> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Boris Kolpackov
> Sent: Friday, September 08, 2006 9:15 AM
> To: [email protected]
> Subject: Re: Creating a document from a schema
> 
> 
> Hi Neil,
> 
> "Ferguson, Neil D" <[EMAIL PROTECTED]> writes:
> 
> > In my application I want to use xerces-c to create a 
> skeleton of a DOM 
> > document  based on a schema containing default values for all 
> > elements. There would be no XML file to parse.  I would then find 
> > document nodes by name and set the element values 
> programmatically to 
> > their actual values. After I have set the values I would then write 
> > the document to an XML file that has the necessary attributes to 
> > associate itself with the schema.
> 
> No, this not supported in Xerces-C++. It is also a not very 
> well defined problem in the general case. Imagine you have a 
> schema like this:
> 
>   <xsd:complexType name="Foo">
>     <xsd:sequence>
>       <xsd:element name="bar" type="xsd:string" 
> maxOccurs="10" default="bar"/>
>     </xsd:sequence>
>   </xsd:complexType>
> 
> How many bar elements should the default document contain, 0, 1, 10?
> 
> For what it's worth, our open-source XML data binding 
> compiler[1] does what you want but only for elements with 
> cardinality "exactly 1" and required attributes.
> 
> 
> [1] http://www.codesynthesis.com/products/xsd/
> 
> 
> hth,
> -boris
> 
> 
> -- 
> Boris Kolpackov
> Code Synthesis Tools CC
> http://www.codesynthesis.com
> Open-Source, Cross-Platform C++ XML Data Binding
> 
Thank you.  I have looked at XSD with interest.  Our XML document element
cardinality is always known, but it isn't always 1.  Also, I think we need
object Java-like reflection, which I couldn't find in XSD.

Our solution will probably be to used "default" xml documents, with which we
can provide ourselves.

Neil 

Reply via email to