Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / September 2004

Tip: Looking for answers? Try searching our database.

XML Schema

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shakuf - 27 Sep 2004 08:31 GMT
hi
i would like to define a type with restrictions, i used the following schema
but i get an error

    <xs:element name="Latitude">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="LatitudeType">
                    <xs:attribute name="Units" type="LatLonUnitsType" use="required" />
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>
    <!--
    -->
    <xs:simpleType name="LatitudeType">
        <xs:restriction base="xs:double">
            <xs:minInclusive value="-90.0" />
            <xs:maxInclusive value="90.0" />
        </xs:restriction>
    </xs:simpleType>

it does not recognize the LatitudeType.
i want Latitude to be a double with restriction

can any one tell me how can i corrent it
thanks
Martin Honnen - 27 Sep 2004 12:56 GMT
> i would like to define a type with restrictions, i used the following schema
> but i get an error
[quoted text clipped - 19 lines]
> it does not recognize the LatitudeType.
> i want Latitude to be a double with restriction

You have not shown us your XML instance document.
When I use the following schema

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

<xs:simpleType name="LatitudeType">
  <xs:restriction base="xs:double">
    <xs:minInclusive value="-90.0" />
    <xs:maxInclusive value="90.0" />
  </xs:restriction>
</xs:simpleType>

<xs:element name="Latitude">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="LatitudeType">
        <xs:attribute name="Units" type="xs:string" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

<xs:element name="root">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="Latitude" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>

and the following instance

<?xml version="1.0" encoding="UTF-8"?>
<root
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="test2004092701Xsd.xml">

<Latitude Units="degree">90</Latitude>

<Latitude Units="degree">188.5</Latitude>

</root>

then both Xerces-Java as well as MSXML 4 flag an error for the 188.5 value.

If the above doesn't work for you then please tell us which XML parser
you are using and what else is different in your schema.

Signature

    Martin Honnen
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.