[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: DTD to Scheme

Subject: Re: DTD to Scheme
From: Stano Paska <paska@xxxxxxx>
Date: Wed, 02 Feb 2005 07:21:05 +0100
dtd2scheme
It is clear for me. Thank you for explanation.
I tried some links to dtd2scheme convertors that I found on www.w3c.org site.
I got same results. I am as good as dtd2scheme convertor! :-)


Thanks again.

Stano.



omprakash.v@xxxxxxxxxxxxx wrote:

Hi,

I believe the error you are getting is not a serious one. I too got the
same erro when I tried to validate my schema using XSV. The reason I found
out was that when the first 'waiting'  is encountered, the parser doesn't
know if it is the waiting belonging to the item having 1 waiting or the
item having '1 waiting and 1 passing'.

This is only a problem with certain parsers while other parsers that
implement some form of look-ahead should validate this document fine.

BTW, have you tried any DTD to schema converter tools to see what result
they gave.

Regards,
Omprakash.V





    <xsd:element name="item">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="risid"/>
                <xsd:choice>
                    <xsd:element ref="waiting"/>
                    <xsd:element ref="passing"/>
                    <xsd:sequence>
                        <xsd:element ref="waiting"/>
                        <xsd:element ref="passing"/>
                    </xsd:sequence>
                </xsd:choice>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>



Stano Paska <paska@xxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx k> cc: (bcc: omprakash.v/Polaris) Subject: DTD to Scheme 02/02/2005 10:53 AM Please respond to xsl-list




Hi,


I need rewrite som DTD into XML Schema.
I have problem with one part.
In element "item" there may be three combinations of waiting/passing
elements:
one waiting, one passing, or both.

In DTD it is easy and it works:
<!ELEMENT item (risid,(waiting|passing|(waiting,passing)))>

In Scheme it is easy, but it does not work:
    <xsd:element name="item">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="risid"/>
                <xsd:choice>
                    <xsd:element ref="waiting"/>
                    <xsd:element ref="passing"/>
                    <xsd:sequence>
                        <xsd:element ref="waiting"/>
                        <xsd:element ref="passing"/>
                    </xsd:sequence>
                </xsd:choice>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

:0,0: Complex type 'C0' violates the Unique Particle Attribution rule in
its components 'waiting' and 'waiting'

It is possible to write corresponding schema?

Thanks for your solutions.

Stano.

Attachments:
-----------------
test.xml
-----------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE result SYSTEM "d:\praca\lucia\klient\dtd.dtd">
<result>
          <item>
                    <risid>DE307001001223</risid>
                    <waiting>
                              <average>13.99</average>
                              <deviation>6.27</deviation>
                              <count>4</count>
                    </waiting>
                    <passing>
                              <average>13.99</average>
                              <deviation>6.27</deviation>
                              <count>4</count>
                    </passing>
          </item>
</result>

----------------
DTD
----------------
<?xml version="1.0" encoding="UTF-8"?>

<!ELEMENT result (item+|error)>

<!ELEMENT error (#PCDATA)>
<!ELEMENT item (risid,(waiting|passing|(waiting,passing)))>

<!ELEMENT risid (#PCDATA)>
<!ELEMENT waiting (average,deviation,count)>
<!ELEMENT passing (average,deviation,count)>

<!ELEMENT average (#PCDATA)>
<!ELEMENT deviation (#PCDATA)>
<!ELEMENT count (#PCDATA)>

-----------------
Scheme
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

          <!-- simple elements -->
          <xsd:element name="risid" type="xsd:string"/>
          <xsd:element name="average" type="xsd:decimal"/>
          <xsd:element name="deviation" type="xsd:decimal"/>
          <xsd:element name="count" type="xsd:nonNegativeInteger"/>
          <xsd:element name="error" type="xsd:string"/>

          <!-- complex elements -->
          <xsd:complexType name="record">
                    <xsd:sequence>
                              <xsd:element ref="average"/>
                              <xsd:element ref="deviation"/>
                              <xsd:element ref="count"/>
                    </xsd:sequence>
          </xsd:complexType>
          <xsd:element name="waiting" type="record"/>
          <xsd:element name="passing" type="record"/>

          <xsd:element name="item">
                    <xsd:complexType>
                              <xsd:sequence>
                                         <xsd:element ref="risid"/>
                                         <xsd:choice>
                                                   <xsd:element ref
="waiting"/>
                                                   <xsd:element ref
="passing"/>
                                                   <xsd:sequence>
                                                             <xsd:element
ref="waiting"/>
                                                             <xsd:element
ref="passing"/>
                                                   </xsd:sequence>
                                         </xsd:choice>
                              </xsd:sequence>
                    </xsd:complexType>
          </xsd:element>

          <xsd:element name="result">
                    <xsd:complexType>
                              <xsd:choice>
                                         <xsd:element ref="error"/>
                                         <xsd:element ref="item" maxOccurs
="unbounded"/>
                              </xsd:choice>
                    </xsd:complexType>
          </xsd:element>

</xsd:schema>






This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.


Visit Us at http://www.polaris.co.in





--
Stanislav Paka
programator, www skupina
KIOS s.r.o.
tel: 033 / 794 00 18

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.