hi Keith,
 
I'm trying to validate XML schema with a xml document. I'm just trying to parse the xml schema. When i parse the same in a standalone application, it is working fine. That is it throws me error when the xml document is not according to schema.. But if i use the same code in a servlet it is not working properly. I'm attaching my test files(one is standalone and other is servlet) alongwith xml and xsl files. U go thru it, and if u find any errors plz let me know...
 
Thanks,
Ragu
 
 
 
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by CSSI (CSSI) -->
<cv version="1.0" initials="CVFP" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="cv_enterprise.xsd" client="b2b">
	<enterprise mode="A">
		<id>A:23-B/7.4</id>
		<!--ID for enterprise-->
		<data>
			<name>RAGUNATH</name>
			<cna>MRUadsfads</cna>
			<carrier_customer>Yes</carrier_customer>
			<access_customer>Yes</access_customer>
			<marketing_code>BRW</marketing_code>
			<reseller>No</reseller>
			<service_request>Internal</service_request>
			<parent_enterprise>4424</parent_enterprise>
			<alias_enterprise>ALIAS</alias_enterprise>
			<active>Yes</active>
			<default_schd_workgroup>SCHEDULER</default_schd_workgroup>
			<default_schd_initials>RM</default_schd_initials>
			<cic>1114</cic>
		</data>
		<billing mode="A">
			<account_number>ASD-RUEY1222</account_number>
			<attention>
				<name>Felix A. Hernandez</name>
				<title>Dir of Sys Tech</title>
				<phone>813-972-2441</phone>
				<fax>813-972-2441</fax>
				<email>[EMAIL PROTECTED]</email>
			</attention>
			<address>
				<format_mode>Fielded</format_mode>
				<street>
					<number>3650</number>
					<direction/>
					<name>Spectrum</name>
					<type>BLVD</type>
				</street>
				<complex>University Tech Center</complex>
				<building>II</building>
				<floor/>
				<suite>160</suite>
				<city>Tampa</city>
				<state_province>FL</state_province>
				<postal_code>33612</postal_code>
				<country>USA</country>
				<free_form1>free_form11</free_form1>
				<free_form2>free_form21</free_form2>
				<free_form3>free_form31</free_form3>
				<free_form4>free_form41</free_form4>
				<free_form5>free_form51</free_form5>
				<free_form6>free_form61</free_form6>
			</address>
			<hold>No</hold>
			<remarks>remarks</remarks>
		</billing>
		<billing mode="A">
			<account_number>123345-13212</account_number>
			<attention>
				<name>name</name>
				<title>title</title>
				<phone>555-1212</phone>
				<fax>555-1212</fax>
				<email>email</email>
			</attention>
			<address>
				<format_mode>Free</format_mode>
				<street>
					<number>num</number>
					<direction>NE</direction>
					<name>name</name>
					<type>ALY</type>
				</street>
				<complex>com</complex>
				<building>bu2</building>
				<floor>1234</floor>
				<suite>su2</suite>
				<city>city</city>
				<state_province>FL</state_province>
				<postal_code>33612</postal_code>
				<country>country</country>
				<free_form1>free_form1</free_form1>
				<free_form2>free_form2</free_form2>
				<free_form3>free_form3</free_form3>
				<free_form4>free_form4</free_form4>
				<free_form5>free_form5</free_form5>
				<free_form6>free_form6</free_form6>
			</address>
			<hold>Yes</hold>
			<remarks>remarks</remarks>
		</billing>
	</enterprise>
	<!--Create Enterprise definition in Circuit Vision-->
	<interface>
		<identifier>FLIGHTPATH</identifier>
		<key>key</key>
		<data_1>data_1</data_1>
		<data_2>data_2</data_2>
		<data_3>data_3</data_3>
		<data_4>data_4</data_4>
		<data_5>data_5</data_5>
	</interface>
</cv>
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Felix A. Hernandez (CSSI) -->
<!--W3C Schema generated by XML Spy v3.5 NT (http://www.xmlspy.com)-->
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"; elementFormDefault="qualified">
	<xsd:element name="access_customer" default="No">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="2"/>
				<xsd:maxLength value="3"/>
				<xsd:enumeration value="Yes"/>
				<xsd:enumeration value="No"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="account_number">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="1"/>
				<xsd:maxLength value="20"/>
				<xsd:pattern value="[\-0-9A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="active" default="Yes">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="2"/>
				<xsd:maxLength value="3"/>
				<xsd:enumeration value="Yes"/>
				<xsd:enumeration value="No"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="address">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="format_mode"/>
				<xsd:element ref="street"/>
				<xsd:element ref="complex"/>
				<xsd:element ref="building"/>
				<xsd:element ref="floor"/>
				<xsd:element ref="suite"/>
				<xsd:element ref="city"/>
				<xsd:element ref="state_province"/>
				<xsd:element ref="postal_code"/>
				<xsd:element ref="country"/>
				<xsd:element ref="free_form1"/>
				<xsd:element ref="free_form2"/>
				<xsd:element ref="free_form3"/>
				<xsd:element ref="free_form4"/>
				<xsd:element ref="free_form5"/>
				<xsd:element ref="free_form6"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="alias_enterprise">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="10"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="attention">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="name">
					<xsd:simpleType>
						<xsd:restriction base="xsd:string">
							<xsd:minLength value="0"/>
							<xsd:maxLength value="40"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element ref="title"/>
				<xsd:element ref="phone"/>
				<xsd:element ref="fax"/>
				<xsd:element ref="email"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="billing">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="account_number"/>
				<xsd:element ref="attention"/>
				<xsd:element ref="address"/>
				<xsd:element ref="hold"/>
				<xsd:element ref="remarks"/>
			</xsd:sequence>
			<xsd:attribute name="mode" use="required">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="A"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="building">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="6"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="carrier_customer" default="No">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="2"/>
				<xsd:maxLength value="3"/>
				<xsd:enumeration value="Yes"/>
				<xsd:enumeration value="No"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="cic">
		<xsd:simpleType>
			<xsd:restriction base="xsd:integer">
				<xsd:minInclusive value="0"/>
				<xsd:maxInclusive value="9999"/>
				<xsd:pattern value="[0-9]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="city">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="30"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="cna">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:maxLength value="3"/>
				<xsd:minLength value="1"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="complex">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="40"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="country">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="40"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="cv">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="enterprise"/>
				<xsd:element ref="interface"/>
			</xsd:sequence>
			<xsd:attribute name="version" use="required">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="1.0"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attribute name="client" use="required">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="b2b"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attribute name="initials" type="xsd:string" use="required"/>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="data">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="name">
					<xsd:simpleType>
						<xsd:restriction base="xsd:string">
							<xsd:minLength value="0"/>
							<xsd:maxLength value="80"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element ref="cna"/>
				<xsd:element ref="carrier_customer"/>
				<xsd:element ref="access_customer"/>
				<xsd:element ref="marketing_code"/>
				<xsd:element ref="reseller"/>
				<xsd:element ref="service_request"/>
				<xsd:element ref="parent_enterprise"/>
				<xsd:element ref="alias_enterprise"/>
				<xsd:element ref="active"/>
				<xsd:element ref="default_schd_workgroup"/>
				<xsd:element ref="default_schd_initials"/>
				<xsd:element ref="cic"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="data_1">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="data_2">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="data_3">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="data_4">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="data_5">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="default_schd_initials">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="4"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="default_schd_workgroup">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="10"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="direction">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:maxLength value="2"/>
				<xsd:minLength value="0"/>
				<xsd:enumeration value="N"/>
				<xsd:enumeration value="S"/>
				<xsd:enumeration value="NW"/>
				<xsd:enumeration value="NE"/>
				<xsd:enumeration value="SW"/>
				<xsd:enumeration value="SE"/>
				<xsd:enumeration value="E"/>
				<xsd:enumeration value="W"/>
				<xsd:enumeration value=""/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="email">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="100"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="enterprise">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="id"/>
				<xsd:element ref="data"/>
				<xsd:element ref="billing" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
			<xsd:attribute name="mode" use="required">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="A"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="fax">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="20"/>
				<xsd:pattern value="[\-0-9]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="floor">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="6"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="format_mode">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="4"/>
				<xsd:maxLength value="7"/>
				<xsd:enumeration value="Free"/>
				<xsd:enumeration value="Fielded"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="free_form1">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="50"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="free_form2">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="50"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="free_form3">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="50"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="free_form4">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="50"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="free_form5">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="50"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="free_form6">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="50"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="hold" default="No">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="2"/>
				<xsd:maxLength value="3"/>
				<xsd:enumeration value="Yes"/>
				<xsd:enumeration value="No"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="id">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="1"/>
				<xsd:maxLength value="10"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="identifier">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="1"/>
				<xsd:maxLength value="20"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="interface">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="identifier"/>
				<xsd:element ref="key"/>
				<xsd:element ref="data_1"/>
				<xsd:element ref="data_2"/>
				<xsd:element ref="data_3"/>
				<xsd:element ref="data_4"/>
				<xsd:element ref="data_5"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="key">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="1"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="marketing_code">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="20"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="name">
		<xsd:complexType/>
	</xsd:element>
	<xsd:element name="number">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="6"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="parent_enterprise">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="10"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="phone">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="20"/>
				<xsd:pattern value="[\-0-9]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="postal_code">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="10"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="remarks">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="80"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="reseller" default="No">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="2"/>
				<xsd:maxLength value="3"/>
				<xsd:enumeration value="Yes"/>
				<xsd:enumeration value="No"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="service_request">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="8"/>
				<xsd:enumeration value="Internal"/>
				<xsd:enumeration value="External"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="state_province">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="2"/>
				<xsd:pattern value="[A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="street">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="number"/>
				<xsd:element ref="direction"/>
				<xsd:element name="name">
					<xsd:simpleType>
						<xsd:restriction base="xsd:string">
							<xsd:minLength value="0"/>
							<xsd:maxLength value="20"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
				<xsd:element ref="type"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="suite">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="6"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="title">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="40"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
	<xsd:element name="type">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:minLength value="0"/>
				<xsd:maxLength value="4"/>
				<xsd:pattern value="[\-.-:A-Z]*"/>
			</xsd:restriction>
		</xsd:simpleType>
	</xsd:element>
</xsd:schema>

Attachment: ParseTest.java
Description: JavaScript source


Attachment: ValidateServlet.java
Description: JavaScript source

Reply via email to