[xsd-users] Generate separate header file for specific elements

Philipp Schmidt philschmidt at gmx.net
Mon Jul 2 08:48:06 EDT 2012


Hello,

I have xsd files where the lowest two elements that are needed to nest every 
other element are defined in every single xsd file, as well as most complex 
datatypes. Can I use --generate-xml-schema to put these definitions into a 
general header that I can then include everywhere else and if yes: How?

For example: I have the following xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  
  <xs:complexType name="fooType">
  <xs:attribute name="foo_id" type="xs:unsignedByte" use="optional" /> 
  </xs:complexType>

  <xs:complexType name="barType" >
    <xs:simpleContent>
      <xs:extension base="xs:integer">
        <xs:attribute name="bar_id" type="xs:unsignedByte" use="required" />
        <xs:attribute name="timestamp" type="xs:unsignedLong" use="optional" 
/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name="asdf">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="qwerty" maxOccurs="1" minOccurs="1">
          
			...
			
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

and want to have the elements "asdf" and "qwertz" as well as the types "foo" 
and "bar" in said separate header file.

Kind regards,
Philipp Schmidt


More information about the xsd-users mailing list