Reputation: 297
I generated this xml file by marshalling it and then i want to unmarshall it by validating it to its schema. Why is this xml :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProjectConfiguration xmlns="http://ereg.egov.bg/segment/0009-900001">
<CreationTime>2012-08-30T15:32:06.712+03:00</CreationTime>
<Applications>
<Application>
<Version>1.0</Version>
<CreationTime>2012-08-30T15:32:06.712+03:00</CreationTime>
<FileName>ROSAppl-37</FileName>
</Application>
</Applications>
</ProjectConfiguration>
not a valid xml agains this schema:
<?xml version="1.0"?>
<xsd:schema
targetNamespace="http://www.bulsi.bg/egov/ProjectConfiguration"
xmlns="http://www.bulsi.bg/egov/ProjectConfiguration"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<xsd:element name="ProjectConfiguration" type="ProjectConfigurationType" />
<xsd:complexType name="ProjectConfigurationType">
<xsd:annotation>
<xsd:documentation xml:lang="bg">Конфигурация на проекта</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="CreationTime" type="xsd:dateTime">
<xsd:annotation>
<xsd:documentation xml:lang="bg">Време на създаване</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Applications" minOccurs="1" maxOccurs="1">
<xsd:annotation>
<xsd:documentation xml:lang="bg">Заявления</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Application" type="ApplicationType" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ApplicationType" >
<xsd:annotation>
<xsd:documentation xml:lang="bg">Данни за заявление за вписване</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Version" type="xsd:string">
<xsd:annotation>
<xsd:documentation xml:lang="bg">Версия на заявлението</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="CreationTime" type="xsd:dateTime">
<xsd:annotation>
<xsd:documentation xml:lang="bg">Време на създаване</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="FileName" type="xsd:string">
<xsd:annotation>
<xsd:documentation xml:lang="bg">Име на файл, в който е заявлението. Връзка между конфигурационни параметри и заявлението като файл</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
This is the error : Cvc-elt.1.a: Cannot Find The Declaration Of Element 'ProjectConfiguration'.. Line '2', Column '71'.
Upvotes: 0
Views: 794
Reputation: 20780
xmlns="http://ereg.egov.bg/segment/0009-900001"
targetNamespace="http://www.bulsi.bg/egov/ProjectConfiguration"
These URIs should match.
Otherwise, the <ProjectConfiguration>
element from your Xml document will be assumed to belong to the http://ereg.egov.bg/segment/0009-900001
namespace, which is not defined in your schema.
Upvotes: 1