[jdom-interest] Schema validation

Boris Mann boris_mann at sympatico.ca
Sun Feb 18 08:53:16 PST 2001


I'm not a 100% certain on this, but from your included XMLSchema, you
*haven't* defined "ULLPreQualificationRequest".

The proper syntax should be:

<xsd:complexType name="ULLPreQualificationRequest">
    <xsd:sequence>
    ...
    </xsd:sequence>
</xsd:complexType>

Also, the "Address" element should be changed to follow the same format.

Another way to do it would be to define Address separately, like so:

<xsd:complexType name="AddressType">
    <xsd:sequence>
        <xsd:element name="Locale" type="xsd:string"/>
        <xsd:element name="Type" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>

Then, in your definition of "ULLPreQualificationRequest", you would put:

<xsd:element name="Address" type="AddressType" />


Might want to check it out on an XMLSchema mailing list. Also, I have found
this URL to be the most useful as an XMLSchema reference:
http://www.xml.com/pub/a/2000/11/29/schemas/part1.html

Hope this helps,

-- Boris


on 2/15/01 10:33 PM, Paul Carter at mumbled something about:

> I am trying to validate an xml docuemnt against a schema when parsing. I
> have no problems validating against a dtd but when I change to a schema I
> get the following error:
> 
> org.jdom.JDOMException: Element type "ULLPreQualificationRequest" must be
> declared.: Error on line 2: Element type "ULLPreQualificationRequest" must
> be declared.
> 
> Could anyone give me a clue as to what the problem may be???  XML document
> and schema are attached.
> 
> Thanks
> 
> Paul Carter
> Objectif Telecmmunications Ltd
> 
> 
> 
> XML SCHEMA:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
> <xsd:element name="ULLPreQualificationRequest">
> <xsd:annotation>
> <xsd:documentation>Comment describing your root
> element</xsd:documentation>
> </xsd:annotation>
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="RequestId" type="xsd:string"/>
> <xsd:element name="ServiceNo" type="xsd:string" maxOccurs="unbounded"/>
> <xsd:element name="Address">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Locale" type="xsd:string"/>
> <xsd:element name="Type" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="LineSpeed" type="xsd:integer"/>
> <xsd:element name="ServiceType" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> 
> 
> XML DOCUMENT:
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <ULLPreQualificationRequest
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="D:\XMLStuff\Examples\ULLPreQualificationReque
> st.xsd">
> <RequestId>iou123</RequestId>
> <ServiceNo>99883434</ServiceNo>
> <ServiceNo>99883434</ServiceNo>
> <Address>
> <Locale>AU</Locale>
> <Type>ACIFSTREET</Type>
> </Address>
> <LineSpeed>123</LineSpeed>
> <ServiceType>Test</ServiceType>
> </ULLPreQualificationRequest>
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.
> com




More information about the jdom-interest mailing list