[xsd-users] retrieving data from wildcard element

Boris Kolpackov boris at codesynthesis.com
Mon Jun 11 05:35:15 EDT 2012


Hi Keith,

Keith Milhouse <kmilhous at yahoo.com> writes:

> I have a schema where I am not able to retrieve the wildcard element's
> value from the parsed xml.
>
> [...]
>
>       <xs:element name="Value" minOccurs="0">
>         <xs:complexType mixed="true">
>           <xs:sequence>
>             <xs:any processContents="lax" minOccurs="0"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>
> Sample XML:
>
> [...]
>
>         <Value>true</Value>

This is not really wildcard content. xs:any in the above type will match
any nested element. But what you have is text, which is allowed thanks to
the type having mixed content (mixed="true"). In other words, if you had
something like this:

<Value><Text>true</Text></Value>

Then there would be an element (<Text>true</Text>) in the wildcard content.
The way it is now, you will need to retrieve it as mixed content. See the
'mixed' and 'custom/mixed' examples for details on how this can be done.

Boris



More information about the xsd-users mailing list