• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with schema program

 
bhargavi kakarala
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
 
Tomasz Piasecki
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.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't that be 'xsd:' instead of 'xs:'?
 
Mapraputa Is
Leverager of our synergies
Sheriff
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic