Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2007, 02:10 AM
Authorized User
 
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Conforming to a schema

 Hi Michael,

I hope this is the right forum for this question.

I have tried your suggestion but it still doesnt work. When I use <xs:choice> in place of <xs:sequence>, the validator seems to be expecting only one type of child element within the parent. There doesnt seem to be way to 'scheme' this instance of XML document. Am I correct in saying that? May be I need another stylesheet to re-order them so that i can the <xs:sequence>.

-------------------------------------------------------------------
Is it possible to a create a schema that allows an xml document to have repeating child nodes of a parent to be appearing in any order? For example, the following is a sample of my xml document.

<parent>
  <child1>A</child1>
  <child1>B</child1>
  <child2>C</child2>
  <child1>D</child1>
  <child3>E</child3>
  <child3>F</child3>
  <child2>G</child2>
</parent>

With my current schema as shown, the xml document obviouslt doesnt conforms to the schema. How can I change my schema document so that it will allow for any order and with the possiblity that the different child elements to be repeating?

<xs:element name="parent">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="child1" maxOccurs="unbounded"/>
                <xs:element ref="child2" maxOccurs="unbounded"/>
                <xs:element ref="child3" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

thanks


 
Old January 12th, 2007, 04:26 AM
Registered User
 
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<xs:element name="parent">
    <xs:complexType>
        <xs:choice maxOccurs="unbounded">
            <xs:element ref="child1"/>
            <xs:element ref="child2"/>
            <xs:element ref="child3"/>
        </xs:choice>
    </xs:complexType>
</xs:element>

Regards,
George

George Cristian Bina
&lt;oXygen/&gt; XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Conforming to a schema Chamkaur XSLT 1 January 8th, 2007 06:03 AM
Getting schema for database Quick209 ASP.NET 2.0 Basics 0 December 12th, 2006 07:51 PM
Schema to Schema conversion onlyda XSLT 5 March 23rd, 2006 12:25 PM
Schema help!? beerni XML 3 October 14th, 2005 08:24 AM
Schema gabrieldg74 XML 0 August 16th, 2005 05:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.