[jdom-interest] Validation Using Schema
Jamil Modak
jmodak at digiterrabroadband.com
Wed Mar 5 08:47:14 PST 2003
Sorry if this has already been answered. I could not find anything in the
archive and hence I am posting it here. Thanks in advance for ur help.
I have the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="..\Includes\FollowUpRequestHeader.xsd"/>
<xs:element name="confirm_status">
<xs:annotation>
<xs:documentation>OK, ERROR</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="OK"/>
<xs:pattern value="ERROR"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="content">
<xs:annotation>
<xs:documentation>The content
block</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="confirm_status"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="message">
<xs:annotation>
<xs:documentation>The root tag</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="header"/>
<xs:element ref="content"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
where
..\Includes\FollowUpRequestHeader.xsd" is another include file containing
the header.
I have also published the schema at http://my
webserver/xml/schema/schemafile.xsd
Using jdom, I build the following xml file: How do I add a reference to this
schema definition using jdom so that after I build my document, I can
validate it using the schema?
<message>
<header>
<message_type>3</message_type>
<version>1.1</version>
<timestamp>2003-02-06T21:21:56.625Z</timestamp>
<portal_id>dev</portal_id>
<portal_tracking_id>String</portal_tracking_id>
<provider_id>String</provider_id>
<provider_tracking_ref>String</provider_tracking_ref>
<user_name>String</user_name>
<password>String</password>
</header>
<content>
<confirm_status>OK</confirm_status>
</content>
</message>
Any help would be appreciated.
Thanks,
Jamil
More information about the jdom-interest
mailing list