[xsd-users] Tree-parser constructor fails
olof.tangrot at telia.com
olof.tangrot at telia.com
Thu Jun 18 15:28:33 EDT 2009
Hi, there.
I have written the xsd (which I belive is correct since XML-notepad
parses it without problems):
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema
>
<xs:simpleType name="stringtype">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_]+" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CANFrameDescription">
<xs:sequence>
<xs:element name="CANFrameName" type="stringtype" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CANReposType">
<xs:sequence>
<xs:element name="CANFrame" type="CANFrameDescription"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="CANRepos" type="CANReposType" />
</xs:schema>
Then I tried to build the parser using:
xsd cxx-tree --root-element CANRepos CANRepos.xsd
That the generated code (based on the hello-example) is used to parse
the content (which I also belive is correct since it
was entered using XML-nodpad and verified using the above xsd):
<?xml version="1.0" encoding="utf-8"?>
<CANRepos>
<CANFrame>
<CANFrameName>CCAN_Frame1</CANFrameName>
</CANFrame>
<CANFrame>
<CANFrameName>CCAN_DataVX</CANFrameName>
</CANFrame>
</CANRepos>
But then the constructor auto_ptr<CANReposType> h (CANRepos (argv
[1]));
fails emitting error messages like:
C:\Documents and Settings\olof\Mina dokument\project\FreeCAN\XML-
parser\RepositoryParser\Debug>RepositoryParser.exe ../../..
/XML/CANrepos2.xml
C:\Documents and Settings\olof\Mina
dokument\project\FreeCAN/XML/CANrepos2.xml:2:11 error: no declaration
found for element 'CANRepos'
C:\Documents and Settings\olof\Mina
dokument\project\FreeCAN/XML/CANrepos2.xml:3:13 error: no declaration
found for element 'CANFrame'
C:\Documents and Settings\olof\Mina
dokument\project\FreeCAN/XML/CANrepos2.xml:4:19 error: no declaration
found for element 'CANFrameName'
C:\Documents and Settings\olof\Mina
dokument\project\FreeCAN/XML/CANrepos2.xml:6:13 error: no declaration
found for element 'CANFrame'
C:\Documents and Settings\olof\Mina
dokument\project\FreeCAN/XML/CANrepos2.xml:7:19 error: no declaration
found for element 'CANFrameName'
I just don't get it. What have I done wrong?
Regards Olof
More information about the xsd-users
mailing list