[xsd-users] retrieving data from wildcard element

Boris Kolpackov boris at codesynthesis.com
Mon Jun 11 09:13:28 EDT 2012


Hi Keith,

Keith Milhouse <kmilhous at yahoo.com> writes:

> // From using the mixed example.
> // Found Element Node Value
> xml_schema::type & t(*reinterpret_cast<xml_schema::type*> (n->getUserData(xml_schema::dom::tree_node_key)));
> Value& a(dynamic_cast<Value&> (t));
> 
> Value::any_optional &valO = a.any();
> 
> if (valO.present())
> {
>  DOMElement &elem(valO.get());
>  cout << "Elem local name = " << xsd::cxx::xml::transcode<char>(elem.getLocalName()) << endl;
> }
> 
> valO is not present. Any ideas what I'm doing wrong?

You are still confused about what's going on here. There is nothing
between <Value> and </Value> tags in your XML that matches the
wildcard. So it doesn't matter whether you access the widlcard
content in the Value node directly or go via DOM (this, BTW, will
result in the same node, as per design) -- your wildcard content
will still be empty. xs:any matches elements. Your content is text.

Boris



More information about the xsd-users mailing list