aspose file tools*
The moose likes XML and Related Technologies and the fly likes problem with schema program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "problem with schema program" Watch "problem with schema program" New topic
Author

problem with schema program

bhargavi kakarala
Ranch Hand

Joined: Jan 03, 2002
Posts: 82
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


Bhargavi
SCJP2,SCWD,SCBCD,IBM Certified SOA Associate,IBM Certified Architectural Design of SOA Solutions
Tomasz Piasecki
Greenhorn

Joined: Dec 14, 2001
Posts: 9
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

Joined: Oct 25, 2000
Posts: 7292

Shouldn't that be 'xsd:' instead of 'xs:'?


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
"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 ]

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with schema program