• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

problem with schema program

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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 ]
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic