[xsde-users] Generating skel for split schema

Ninh Tran Dang tdninh at tma.com.vn
Tue Oct 14 04:39:52 EDT 2008


Hi Boris,

 

We have difficulty with skeleton code generation when breaking our schema to
smaller pieces of schemas. Currently our schema is too big, at the result of
this it generates very big skeleton codes. So we decided to split them to
smaller schemas and the main schema will include the split schemas.

 

And the problem here is the xsde binary doesn't know to generate skel codes
for the included schemas when we stay at the main schema.

 

Are there any other options of xsde where we could use to generate the whole
schema tree starting from the root schema?

 

Thanks,

Ninh

 

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, June 18, 2008 2:03 PM
To: Ninh Tran Dang
Cc: xsde-users at codesynthesis.com
Subject: handling content of anyType

 

Hi Ninh,

 

In the future please send technical questions like these to the

xsde-users mailing list (which I've CC'ed) instead of to me directly.

This way other developers who may have experienced a similar problem

can provide you with a solution. Plus questions and answers will be

archived and available to others with similar problems.

 

 

Ninh Tran Dang <tdninh at tma.com.vn> writes:

 

> I have trouble when using XSDe to parse an empty element. The root parser

> class doesn't allow me to set the parser for the person element.

> 

> Because the element type under the root node is anyType, so it will accept

> all xml elements under the root provided they are validated themselves,
but

> in this case I cannot parse the xml document.

 

More precisely, anyType accepts any well-formed XML fragment. There

won't be any XML Schema validation though. For example, in the sample

XML you provided below, the person element won't be validated against

the person element defined in the schema.

 

 

> Could you answer me whether XSDe supports to parse this kind of schema? Or

> do we have anyway to overcome this situation?

 

Similar to wildcards (any and anyAttribute) all content matched by

anyType will be reported via the following "raw XML" callbacks:

 

  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&);

 

You can override them in root_pimpl. If you know that the content

matched by anyType can be parsed by some other parser (e.g., 

person_pimpl in the below example), then you can route these calls

to the corresponding parser. For more information on how to do

this refer to the wildcard example in examples/cxx/parser/wildcard/.

 

Boris

 

 

[The rest of the original email follows for context.]

 

> 

> Thanks,

> 

> Ninh

> 

> <root xsi:noNamespaceSchemaLocation="E:\temp\conf\question.xsd"

>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

> 

>  <person>

>    <first-name>String</first-name>

>    <last-name>String</last-name>

>  </person>

> 

> </root>

> 

>  

> 

> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

>            elementFormDefault="qualified" 

>            attributeFormDefault="unqualified">

> 

> <xs:element name="root">

>   <xs:complexType>

>     <xs:complexContent>

>       <xs:extension base="xs:anyType">

>       </xs:extension>

>     </xs:complexContent> 

>   </xs:complexType>

> </xs:element>

> 

> <xs:element name="person">

>   <xs:complexType>

>     <xs:sequence>

>       <xs:element name="first-name" type="xs:string"/>

>       <xs:element name="last-name" type="xs:string"/>

>     </xs:sequence>

>   </xs:complexType>

> </xs:element>

> 

> </xs:schema>



More information about the xsde-users mailing list