[xsd-users] Extracting text nodes from "any" type mapping
Wood, Matthew D
matthew.d.wood at intel.com
Tue Sep 11 19:18:49 EDT 2007
I am using XSD version 3.0.0 to manipulate data conforming to the XACML
2.0 policy schema
(http://docs.oasis-open.org/xacml/2.0/access_control-xacml-2.0-policy-sc
hema-os.xsd). I am translating the schema with the following command
line:
xsd cxx-tree --generate-wildcard --generate-polymorphic --show-sloc
--namespace-map
urn:oasis:names:tc:xacml:2.0:policy:schema:os=XACMLPolicyParser
--char-type char --root-element Policy --root-element PolicySet
access_control-xacml-2.0-policy-schema-os.xsd
The complex type "AttributeValueType" is defined as follows:
<xs:complexType name="AttributeValueType" mixed="true">
<xs:complexContent mixed="true">
<xs:extension base="xacml:ExpressionType">
<xs:sequence>
<xs:any namespace="##any" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="DataType" type="xs:anyURI" use="required"/>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Valid document instances can contain either a Text node or an Element
node. XSD maps the "any" type to a collection of DOMElement nodes. When
an instance containing only text is parsed, the mapping ignores the Text
node completely. What is the best way to work around this limitation? Do
I need to parse with the xml_schema::flags::keep_dom flag to access the
DOMNode objects and extract the text?
Thanks,
Matt
More information about the xsd-users
mailing list