[xsd-users] xsd:any in parser
Jiri Poledna
jiripoledna at seznam.cz
Tue May 22 02:58:18 EDT 2007
Hi Boris
This is what I expect, override some methods, my problem is that I
have nothing to override, when I run xsd.exe it do not generate that
"any" methods to override. Do you think I need switch on some
attribute in generation process to obtain such methods? I'm using "xsd
cxx-parser --morph-anonymous book.xsd"
Thanks
Jiri
Boris Kolpackov wrote:
Hi Jiri,
Jiri Poledna [1]<jiripoledna at seznam.cz> writes:
<xsd:element name="Reviewer">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Title">
<xsd:complexType>
<xsd:attribute name="SchemaVersion" type="xsd:string" default="3
.0.3" />
<xsd:attribute name="ID" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:any namespace="##any" processContents="skip" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
I'm using xsd.exe utility to generate the hxx and txx, I obtained
parserhooks to Title element, but I do not reach Reviewer element.
The hooks you are interested in are:
virtual void
_start_any_element (const xml_schema::ro_string& ns,
const xml_schema::ro_string& name);
virtual void
_end_any_element (const xml_schema::ro_string& ns,
const xml_schema::ro_string& name);
virtual void
_any_attribute (const xml_schema::ro_string& ns,
const xml_schema::ro_string& name,
const xml_schema::ro_string& value);
virtual void
_any_characters (const xml_schema::ro_string&);
They pretty much constitute SAX events and are triggered for elements,
attributes, and text of wildcard/mixed content. In your case, you will
need to override them in the implementation of the Title parser. The
Reviewer element (in place of an any) and all its nested contents will
be delivered via these hooks.
hth,
-boris
References
1. mailto:jiripoledna at seznam.cz
More information about the xsd-users
mailing list