我通过编组生成了这个xml文件,然后我想通过验证它到它的模式来解组它。为什么这个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>
这个架构不再是有效的xml:
<?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>
这是错误: Cvc-elt.1.a:找不到元素声明'ProjectConfiguration'..行'2',列'71'。
答案 0 :(得分:1)
xmlns="http://ereg.egov.bg/segment/0009-900001"
targetNamespace="http://www.bulsi.bg/egov/ProjectConfiguration"
这些URI应该匹配。
否则,假定您的Xml文档中的<ProjectConfiguration>
元素属于http://ereg.egov.bg/segment/0009-900001
命名空间,该命名空间未在您的模式中定义。