Jump to content
RobertB

including another schema

Recommended Posts

Hi,I am new to XSD and cannot find how to do the following. I will have a bunch of XML documents that consist basically of 2 products. Th 1st product will vary in each XML doc but the second product (with all its restrictions) will always be the same.<?xml version="1.0" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="trxml"> <xs:complexType> <xs:sequence> <xs:element name="product1" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:restriction base="xs:string"> ...What I want here is to "include" the following without retype it every time: <xs:element name="product2" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string">I tried to xs:include the product2 but cannot find a way to make it work. :) Thank's for your help!

Share this post


Link to post
Share on other sites

I found a solution, thank's anyway !FYI, my solution is to assign a type for product2, to define that type in another xsd and to include it in the header of the main XML document. The product2 xml doc only contains the standard header plus the type definition:main XML doc:...<xs:element name="product2" maxOccurs="1" type="sel205Type" />...product2 XML doc:<?xml version="1.0" ?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:simpleType name="sel205Type"> <xs:restriction base="xs:string"> ... </xs:schema>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...