[xsd-users] Creating elements in code
Attila
atteeela at gmail.com
Wed Apr 30 09:56:36 EDT 2008
Hi,
I am interested in creating objects on a type basis only without specifying
a complete XML document.
So for example, assume that I have an XSD like so:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="bar" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Can I provide an XML snippet instead of an entire XML document like this:
<note>
<to>jon</to>
<from>rick</from>
<heading>hello world</heading>
<body>no text</body>
</note>
And feed it into the Code Synthesis like this:
auto_ptr<note> c = note("noteSnippet.xml");
Furthermore, could I then take these snippets and use it to construct a
complete XML document?
Thanks!
--
Attila
Software Developer
atteeela at gmail.com
More information about the xsd-users
mailing list