[xsd-users] Question: root element in 'import' schema

Boris Kolpackov boris at codesynthesis.com
Fri Nov 16 02:50:39 EST 2007


Hi Nicholas,

Nicholas Xu <xunich at gmail.com> writes:

> You can see that the root element is from common-policy schema, but
> some extentions is defined in pres-rules schema. I don't know how xsd
> handles this situation.

Your schemas use wildcard (xsd:any & xsd:anyAttribute) to provide
"extension points". You can request XSD to generate the wildcard
mapping with the --generate-wildcard option. The resulting code
will allow you to access the wildcard content as DOM fragments
(that is, a list of DOMElement's for xsd:any and DOMAttr's for
xsd:anyAttribute). See Section 2.12, "Mapping for any and
anyAttribute" in the C++/Tree Mapping User Manual:

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

Once you get to the DOM content, you have two choices: you can
handle the data using the DOM API or, if you have schemas for the
data, parse the DOM fragments to obtain the corresponding object
model. Since you have the schema describing your "extension data",
you would probably want to use the latter approach. For an example
on how to do it see the 'wildcard' example in the examples/cxx/tree
directory.

Boris




More information about the xsd-users mailing list