  | |  | XML Schema Validation Error | XML Schema Validation Error 2003-08-26 - By Kapas, Mukulika
Hi, I am using Xerces Schema Cache. http://xml.apache.org/xerces2-j/faq-grammars.html
I am using the attached SOAP envelope schema to validate my xml file which has 'actor' and 'mustUnderstand' attributes in the SOAP header.
Given below is the sample XML which i am trying to validate
<env:Envelope xmlns:env="http://www.w3.org/2001/09/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Header env:actor="https://www.xmlswitch.net" env:mustUnderstand="1"> </env:Header> <env:Body> </env:Body> </env:Envelope>
I am getting the following error when i try to validate the above XML with the cached soap-envelope schema.
[Error] file1.xml:2:75: cvc-complex-type.3.2.2: Attribute 'env:actor' is not allowed to appear in element 'env:Header'. [Error] file1.xml:2:75: cvc-complex-type.3.2.2: Attribute 'env:mustUnderstand' is not allowed to appear in element 'env:Header'.
The Header element in SOAP envelope is defined as following. So i should be able to use any attribute in my header. Then what am i doing wrong?
<xs:element name="Header" type="tns:Header"/> <xs:complexType name="Header"> <xs:sequence> <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax"/> </xs:complexType>
regards, Mukulika Kapas
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"> <TITLE>XML Schema Validation Error</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2>Hi,</FONT> <BR><FONT SIZE=2> I am using Xerces Schema Cache. <A HREF="http:/ /xml.apache.org/xerces2-j/faq-grammars.html" TARGET="_blank">http://xml.apache .org/xerces2-j/faq-grammars.html</A></FONT> </P>
<P><FONT SIZE=2>I am using the attached SOAP envelope schema to validate my xml file which has 'actor' and 'mustUnderstand' attributes in the SOAP header .</FONT></P>
<P><FONT SIZE=2>Given below is the sample XML which i am trying to validate< /FONT> </P>
<P><FONT SIZE=2><env:Envelope xmlns:env="<A HREF="http://www.w3.org /2001/09/soap-envelope" TARGET="_blank">http://www.w3.org/2001/09/soap-envelope< /A>" xmlns:xsi="<A HREF="http://www.w3.org/2001/XMLSchema-instance" TARGET="_blank">http://www.w3.org/2001/XMLSchema-instance</A>"></FONT>< /P>
<P> <FONT SIZE=2><env:Header env :actor="<A HREF="https://www.xmlswitch.net" TARGET="_blank">https://www .xmlswitch.net</A>" env:mustUnderstand="1"></FONT> <BR> <FONT SIZE=2></env:Header> </FONT> <BR> <FONT SIZE=2><env:Body>< /FONT> <BR> <FONT SIZE=2></env:Body>< /FONT> <BR><FONT SIZE=2></env:Envelope></FONT> </P> <BR>
<P><FONT SIZE=2>I am getting the following error when i try to validate the above XML with the cached soap-envelope schema.</FONT> </P>
<P><FONT SIZE=2>[Error] file1.xml:2:75: cvc-complex-type.3.2.2: Attribute 'env :actor' is not allowed to appear in element 'env:Header'.</FONT> <BR><FONT SIZE=2>[Error] file1.xml:2:75: cvc-complex-type.3.2.2: Attribute 'env :mustUnderstand' is not allowed to appear in element 'env:Header'.</FONT></P>
<P><FONT SIZE=2>The Header element in SOAP envelope is defined as following. So i should be able to use any attribute in my header. Then what am i doing wrong? </FONT></P> <BR>
<P><FONT SIZE=2><xs:element name="Header" type="tns:Header "/></FONT> <BR> <FONT SIZE=2><xs:complexType name="Header"></FONT> <BR> <FONT SIZE=2><xs:sequence></FONT> <BR> <FONT SIZE=2><xs:any namespace="##other" processContents="lax" minOccurs="0 " maxOccurs="unbounded"/></FONT> <BR> <FONT SIZE=2></xs:sequence></FONT> <BR> <FONT SIZE=2><xs:anyAttribute namespace="##other" processContents="lax"/></FONT> <BR> <FONT SIZE=2></xs:complexType ></FONT> </P> <BR>
<P><FONT SIZE=2>regards,</FONT> <BR><FONT SIZE=2>Mukulika Kapas</FONT> </P>
<P><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT>
</BODY> </HTML> --------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|
 |