xml - cvc-elt.1: Cannot find the declaration of element 'Root' -


xsd sample

<?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="shiporder">   <xs:complextype>     <xs:sequence>       <xs:element name="orderperson" type="xs:string" />       <xs:element name="name" type="xs:string" />       <xs:element name="address" type="xs:string" />       </xs:sequence>     <xs:attribute name="orderid" type="xs:string" />   </xs:complextype> </xs:element> </xs:schema> 

xml response sample

<?xml version="1.0" encoding="utf-8"?> <shiporder orderid="str1234">   <orderperson>str1234</orderperson>   <name>str1234</name>   <address>str1234</address> </shiporder> 

schema validate dom source

http://hostcode.sourceforge.net/view/3307

schema validate streamsource

http://hostcode.sourceforge.net/view/3306

validating stream source works fine. when validating domsource experience error. cvc-elt.1: cannot find declaration of element 'shiporder'.

what reason behavior.?

my main question why validator.validate(new domsource(node));  not work in shema validation. reason ? 

during creation of dom structure need explicitly specify dom elements not belong namespace. can calling org.w3c.dom.document#createelementns instead of org.w3c.dom.document#createelement, namespaceuri has null value.

example: document.createelementns(null, qualifiedname).


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -