[xquery-talk] Need to generate an empty instance from an XML Schema

Adam Retter adam.retter at googlemail.com
Wed Aug 31 09:36:41 PDT 2011


If you don't mind some java, trang can do this for you...
On Aug 31, 2011 5:33 PM, "Loren Cahlander" <loren.cahlander at gmail.com>
wrote:
> Hello folks,
>
> Has anyone developed a transform to take an XML Schema and create an XML
document with empty elements and attributes that adheres to the schema?
>
> I have an example schema here:
>
>
> <xs:schema xmlns:schema1="
http://example.com/apps/foo/resources/schemas/Other1" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:schema2="
http://example.com/apps/foo/resources/schemas/Other2"
elementFormDefault="unqualified">
> <xs:import namespace="http://example.com/apps/foo/resources/schemas/Other1"
schemaLocation="http://example.com/apps/foo/resources/schemas/Other1.xsd"/>
> <xs:import namespace="http://example.com/apps/foo/resources/schemas/Other2"
schemaLocation="http://example.com/apps/foo/resources/schemas/Other2.xsd"/>
> <xs:element name="FuBar">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Data">
> <xs:complexType>
> <xs:sequence minOccurs="0">
> <xs:element name="Owner">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Name" type="xs:string"/>
> <xs:element name="Phone" type="xs:string"/>
> <xs:element name="Other2" type="schema2:Other2Type"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="Issuances">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Issuance" maxOccurs="unbounded" minOccurs="0">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Data">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Person">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Name" type="xs:string"/>
> <xs:element name="Phone" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="EffectiveDate" type="xs:date"/>
> <xs:element name="ExpirationDate" type="xs:date"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="Other1" type="schema1:Other1Type"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="Other1" type="schema1:Other1Type"/>
> </xs:sequence>
> <xs:attribute name="id" use="required" type="xs:NCName"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> Thank you,
> Loren
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20110831/bd60a9b8/attachment.html>


More information about the talk mailing list