You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Senthil (JIRA)" <xe...@xml.apache.org> on 2017/01/03 12:50:58 UTC

[jira] [Comment Edited] (XERCESJ-356) DOM parser throws exception doing XML Schema Validation

    [ https://issues.apache.org/jira/browse/XERCESJ-356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15794995#comment-15794995 ] 

Senthil edited comment on XERCESJ-356 at 1/3/17 12:50 PM:
----------------------------------------------------------

Please me let know what was the fix for this issue? Can not find Bug 10102. 
I'm facing similar issue in my environment as follows

I'm getting "Attribute 'soapenv:encodingStyle' is not allowed to appear in element 'myns:myAccount'" exception from schema validation.

The request: 
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myns="http://myinterface.mydomain.com">
   <soapenv:Header/>
   <soapenv:Body>
      <myns:myAccount soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <acNumber xsi:type="xsd:string">gggg</acNumber>
      </myns:myAccount>
   </soapenv:Body>
</soapenv:Envelope>

if anyone identify what is wrong with it and the fix info will be appreciated and helpful for me.

Regards,
Senthil


was (Author: softsenthil):
Please let know what was the fix for this issue? Can not find Bug 10102. 
I'm facing similar issue in my environment as follows

I'm getting "Attribute 'soapenv:encodingStyle' is not allowed to appear in element 'myns:myAccount'" exception from schema validation.

The request: 
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myns="http://myinterface.mydomain.com">
   <soapenv:Header/>
   <soapenv:Body>
      <myns:myAccount soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <acNumber xsi:type="xsd:string">gggg</acNumber>
      </myns:myAccount>
   </soapenv:Body>
</soapenv:Envelope>

if anyone identify what is wrong with it and the fix info will be appreciated and helpful for me.

Regards,
Senthil

> DOM parser throws exception doing XML Schema Validation
> -------------------------------------------------------
>
>                 Key: XERCESJ-356
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-356
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.0.1
>         Environment: Operating System: Windows NT/2K
> Platform: PC
>            Reporter: Andrea Tevoi
>
> I try to validate a Xml document that is actually a Soap message envelope. This 
> is my message:
>  
> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" 
> env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>     <env:Body>...</env:Body>
> </env:Envelope>
>  
> And this is my java code to parse Xml document: 
>  
> static final String JAXP_SCHEMA_LANGUAGE =
> "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
> static final String W3C_XML_SCHEMA =
> http://www.w3.org/2001/XMLSchema;
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> dbf.setNamespaceAware(true);
> dbf.setValidating(true);
> dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); 
> dbf.setAttribute(
> "http://apache.org/xml/properties/schema/external-schemaLocation",
> "http://schemas.xmlsoap.org/soap/envelope/ 
> http://schemas.xmlsoap.org/soap/envelope/");
> DocumentBuilder domBuilder = dbf.newDocumentBuilder();
> System.out.println("parsing xml document...");
> domBuilder.parse("file:/C:/tmp/soapMsg.xml");
> I have this exception:
>  
> Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
> set, which is probably not what is desired. Parser will use a default
> ErrorHandler to print the first 10 errors. Please call
> the 'setErrorHandler' method to fix this.
> Error: URI=file:/C:/tmp/soapMsg.xml Line=11: cvc-complex-type.3.2.2: 
> Attribute 'env:encodingStyle' is not allowed to appear in 
> element 'env:Envelope'.
>  
>  
> Parser says that attribute env:encodingStyle is not allowed... why? I looked at 
> envelope schema and there is an element <xs:anyAttribute...> in envelope 
> complex type, so it would be ok... so why does parser say me that attribute is 
> not allowed?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org