[xsd-users] how to access xs:ref="element" target element name

Boris Kolpackov boris at codesynthesis.com
Fri Aug 24 09:07:35 EDT 2012


Hi Vikas,

vikas <pvssvikas at gmail.com> writes:

> *Can you please let me know how to access element name of the parsed xml,
> when reference elements are being used with xsd?*
> 
> *Sample  xsd:*
> 
> <OperationList>
>   <xs:sequence>
>      <xs:element ref="operation" minOccurs="1"
>   maxOccurs="unbounded" />
>   </xs:sequence>
> </OperationList>
> 
> *Sample xml:*
> 
> <OperationList>
> 
>    <createglobaluser id = 1>
>    </createglobaluser>
> 
>    <createlocaluser id = 2>
>    </createglobaluser>
> 
> </OperationList>

I am not sure what you are trying to get. Is it "operation"? Or maybe
"createglobaluser"? Or a value of createglobaluser?

I suspect your schema is using substitution groups. Have you read
Section 2.11, "Mapping for xsi:type and Substitution Groups" in the
C++/Tree Mapping User Manual?

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11

Boris



More information about the xsd-users mailing list