xsd validation - XSD to xml transformation is not right -


i have xsd below

    <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns="http://www.example.com/api/2.2" elementformdefault="qualified" version="1.0" xml:lang="en" targetnamespace="http://www.example.com/api/2.2">   <xs:element name="configuration">     <xs:complextype>       <xs:sequence>         <xs:element name="domain" type="domain"/> <!-- changed here -->       </xs:sequence>       <xs:attribute name="timestamp" type="xs:normalizedstring" use="optional"/>       <xs:attribute name="version" type="xs:token" fixed="2.2"/>     </xs:complextype>   </xs:element>    <xs:complextype name="domain"> <!-- , here -->     <xs:sequence>       <xs:any minoccurs="0"/>     </xs:sequence>     <xs:attribute name="account" type="uid" use="required">       </xs:attribute>   </xs:complextype>    <xs:simpletype name="uid">     <xs:restriction base="xs:string">       <xs:length value="36"/>       <xs:pattern value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"/>     </xs:restriction>   </xs:simpletype> </xs:schema> 

and xml generated through 1 online xsd xml generator this

  <?xml version="1.0" encoding="utf-8"?>     <configuration timestamp="str111" version="2.2">     <domain account="str123400000000000000000000000000000" /> </configuration> 

but when going validate through javax.xml.validation.validator throwsfollowing exception

error: cvc-elt.1: cannot find declaration of element 'configuration'.; ;130503155804008299000002; ; webcontainer : 2; 

and this

 <commons_error>; errorthe exception occured @ line no.1 column  no.107; ; 130503155804008299000002; ; webcontainer : 2;  

please me...to find out right xml patten above xsd

your schema defines elements within namespace http://www.example.com/api/2.2

the generator seems have ignored that.

add namespace declaration xmlns="http://www.example.com/api/2.2" configuration in xml, , well.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -