XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 13th, 2004, 04:42 AM
techformation techformation is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 22 techformation User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
xml schema problem

Hi

I am writing a schema for an XML document i would like the document to have a structure such as the the one below

------------------------------------------------------------

<?xml version="1.0"?>
<group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='lr2.xsd'>
<house ref="3" name="Waseem House">
<room ref="3443" type="Standard" beds="2">
<price day="2004-06-30">222.99</lrate_price>
<price day="2004-06-29">222.99</lrate_price>
</room>
</house>
</group>

-----------------------------------------------------------
This means the element price must have an attributre and an element value i cant get this to work in my schema, when i do this it says that the element price cant have a simple type "type" and a complex type attribute [i am using perl / xerces] my schema is below

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name="group">
<xs:complexType>
<xs:sequence>
<xs:element ref="house" minOccurs='1' maxOccurs='unbounded'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="house">
<xs:complexType>
<xs:sequence>
<xs:element ref="room" minOccurs='1' maxOccurs='unbounded'/>
</xs:sequence>
<xs:attribute name="ref" type="xs:integer" use='required'/>
<xs:attribute name="name" type="xs:string" use='required'/>
</xs:complexType>
</xs:element>

<xs:element name="room">
<xs:complexType>
<xs:sequence>
<xs:element ref="price" type="lratetype" minOccurs='1' maxOccurs='unbounded'/>
</xs:sequence>
<xs:attribute name="ref" type="xs:integer" use='required'/>
<xs:attribute name="type" type="xs:string" use='required'/>
<xs:attribute name="beds" type="xs:integer" use='required'/>
</xs:complexType>
</xs:element>

<xs:element name="price" type="xs:decimal">
<xs:complexType>
<xs:attribute name="day" type="xs:date" use='required'/>
</xs:complexType>
</element>

</xs:schema>

----------------------------------------------------------

Im not sure what i am doing wrong as i need to make sure the text in the price element is of decimal , do i need to use the restriction syntax ?

Waseem

Reply With Quote
  #2  
Old July 16th, 2004, 10:04 AM
mr.euro mr.euro is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 21 mr.euro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 18 m 8 sec
Reputation Power: 0
I think maybe you need to looak at your xml file first.
It's not exactly well formed,
you should not put (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='lr2.xsd') into the root.
And (<price day="2004-06-30">222.99</lrate_price>) must be changed to
(<price day="2004-06-30">222.99</price>)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xml schema problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT