Flatten XSD

M

mre

Is there a program that will flatten an XSD, that is, will transform...

<xsd:element name="name" type="nameType"/>

<xsd:complexType name="nameType">
<xsd:sequence>
<xsd:element name="firstname" type="xsd:string"/>
<xsd:element name="surname" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

....into...

<xsd:element name="name">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="firstname" type="xsd:string"/>
<xsd:element name="surname" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

.... It should also handle includes/imports, merge complexContent, and
what have you?

I want to be able to take multiple XSDs, most of which contain just
type information in various namespaces, and turn it all it one big
file, one namespace.

If there is no program that can do this I'll write one myself. However,
as I'm an XSD beginner; how does complexContent and group merge? I'm
guessing that, other than these two, the rest is as straight-forward as
my example above - is there anything I need to watch out for?

Thank you for any help,
Regards,
MRe
 
M

mre

I've started writing a prog myself and would appreciate any helps
anyone can give

What does <xsd:element ref="foo:bar"> mean? Do I replace that element
with the 'bar' element? The bar element looks like this <xsd:element
name="bar" type="foo:barType" abstract="true">. It seems to me that ref
and type are almost the same thing?

Also,
This is short version of something I got off www.w3schools.com...

<xsd:element name="employee" type="fullpersoninfo"/>
<xsd:complexType name="personinfo">
<xsd:sequence><xsd:element name="firstname"
type="xsd:string"/></xsd:sequence>
<xsd:attribute name="lastUpdateDate" type="xsd:date" use="optional" />
</xsd:complexType>
<xsd:complexType name="fullpersoninfo">
<xsd:complexContent>
<xsd:extension base="personinfo">
<xsd:sequence><xsd:element name="address"
type="xsd:string"/></xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

....should it become...

<xsd:element name="employee">
<xsd:complexType >
<xsd:complexContent>
<xsd:sequence><xsd:element name="firstname"
type="xsd:string"/></xsd:sequence>
<xsd:attribute name="lastUpdateDate" type="xsd:date" use="optional"
/>
<xsd:sequence><xsd:element name="address"
type="xsd:string"/></xsd:sequence>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

....or should the double xsd:sequence be grouped into one, or should
something else happen, or what?

Also,
What does group and substitutionGroup mean for my program.

Please help, please!
Thank you,
Regards,
MRe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top