You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sheen Brisals <sh...@hp.com> on 2002/03/05 16:59:49 UTC
Resolving complex types
Hi,
Please can you tell me how to resolve explicit complexTypes within a
schema document and generate a simple schema with annonymous complex
types. if I have a schema like this,
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Address">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence>
<xsd:element name="Customer" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="Location" type="Address"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
how can I produce using the parser to have something like,
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Customer" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="Location">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Can I achieve this using the parser or do I have to use some other
means? Please give me few ideas.
Thanks,
Sheen
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Resolving complex types
Posted by John Keyes <jo...@yahoo.com>.
Hi Sheen,
This is an XML transformation issue, i.e. XSLT. The way to achive
this is to write a stylesheet that transforms the first schema
into the second one. This is not a trivial task (i.e. invoking
a method) and as the schema becomes more complex the robustness and
completeness of the stylesheet will be called into question.
For what technical reason do you want to accomplish this?
-John K
Sheen Brisals wrote:
> Hi,
>
> Please can you tell me how to resolve explicit complexTypes within a
> schema document and generate a simple schema with annonymous complex
> types. if I have a schema like this,
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:complexType name="Address">
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> <xsd:element name="street" type="xsd:string"/>
> <xsd:element name="zip" type="xsd:decimal"/>
> </xsd:sequence>
>
> <xsd:element name="Customer" minOccurs="0" maxOccurs="unbounded">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Name" type="xsd:string"/>
> <xsd:element name="Location" type="Address"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
> how can I produce using the parser to have something like,
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="Customer" minOccurs="0" maxOccurs="unbounded">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Name" type="xsd:string"/>
> <xsd:element name="Location">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> <xsd:element name="street" type="xsd:string"/>
> <xsd:element name="zip" type="xsd:decimal"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>
> Can I achieve this using the parser or do I have to use some other
> means? Please give me few ideas.
>
> Thanks,
> Sheen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org