• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with schema program

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone check this program and tell me what is the problem .i tried 2 do this but ic ouldn't find any error in this.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="contactdetails">
<xs:complexType>
<xs:sequence>
<xs:element ref="contact " maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="middlename" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="billingadress" type="Address"/>
<xs:element ref="mailingadress" type="Address"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Address">
<xs:sequence>
<xs:element name="street1" type="xs:string"/>
<xs:element name="street2" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="state" type="xs:string"/>
<xs:element name="zip" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
thanks in advance
bhargavi
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I ran it through the XML Spy:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/1999/XMLSchema">
<xs:element name="contactdetails">
<xs:complexType>
<xs:sequence>
<xs:element ref="contact " maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="middlename" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="billingadress" type="Address"/>
<xs:element ref="mailingadress" type="Address"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Address">
<xs:sequence>
<xs:element name="street1" type="xs:string"/>
<xs:element name="street2" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="state" type="xs:string"/>
<xs:element name="zip" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
and it says that the document is well-formed, but
validation displayed error msg:
_____________________________
"element 'xs:' is undefined"
_____________________________
and that as a part of another schema it may be OK.
I couldn't find anything wrong with it either, but I hope this will help you to figure it out.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shouldn't that be 'xsd:' instead of 'xs:'?
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"xs" is only a prefix, it can be anything as long as it is properly defined. And it is defined:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
Here is the output IBM Schema Quality Checker gave:
ERROR
file = file:c:/test.xsd line 22 column 49
SEVERITY: 1
ERROR TYPE: 1
MESSAGE
The following attributes are mutually exclusive in the element item <xs:element> when the attribute "ref" is specified :
type type
------------------------------------------------------------------------
ERROR
file = file:c:/test.xsd line 23 column 49
SEVERITY: 1
ERROR TYPE: 1
MESSAGE
The following attributes are mutually exclusive in the element item <xs:element> when the attribute "ref" is specified :
type type
------------------------------------------------------------------------
ERROR
file = file:c:/test.xsd line 22 column 49
SEVERITY: 1
ERROR TYPE: 2
MESSAGE
The global element billingadress is not found.
------------------------------------------------------------------------
ERROR
file = file:c:/test.xsd line 23 column 49
SEVERITY: 1
ERROR TYPE: 2
MESSAGE
The global element mailingadress is not found.
------------------------------------------------------------------------

apparently your problem is here:
<xs:element ref="billingadress" type="Address"/>
<xs:element ref="mailingadress" type="Address"/>
[ February 06, 2002: Message edited by: Mapraputa Is ]
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic