XSD to xml transformation is not right

I have a xsd as 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"> <!-- and 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 the xml generated through one online xsd to xml generator is like this

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

But when I am going to validate through javax.xml.validation.Validator it throwsfollowing exception

Error: cvc-elt.1: Cannot find the declaration of element 'configuration'.; ;130503155804008299000002; ; WebContainer : 2;

and this

 <COMMONS_ERROR>; ErrorThe Exception occured at Line No.1 Column  No.107; ; 130503155804008299000002; ; WebContainer : 2; 

Please help me...to find out the right xml patten for the above xsd

Answers


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

The generator seems to have ignored that.

Add a namespace declaration xmlns="http://www.example.com/api/2.2" to configuration in the xml, and all will be well.


Need Your Help

Is it possible to have SSL certificate for IP address, not domain name?

https dns ip-address ssl-certificate

I want my site to use URLs like http://2.2.2.2/... and https://2.2.2.2/... for static content to avoid unnecessary cookies in request AND avoid additional DNS request.

How to implement type-safe extensible type system in Scala?

scala types extensibility

I'm writing a project in Scala. This project involves a set of features and a set of configurations, both extensible. By "extensible" I mean that I'm going to add new features in the hierarchy late...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.