XML输入
<?xml version="1.0"?>
<Templates>
<Template>
<ObjTmplId>1</ObjTmplId>
<AttTmplId>1</AttTmplId>
<Is_Ingest>0</Is_Ingest>
<System_Name>DNC</System_Name>
<System_Category>ALL</System_Category>
<System_Class>hazarda</System_Class>
<System_Table>BD000</System_Table>
<System_Attribute>cod</System_Attribute>
<System_Value>-32768</System_Value>
</Template>
</Templates>
xsd doc
<?xml version= '1.0' encoding= 'UTF-8' ?>
<xsd:schema targetNamespace="http://cfpe/export/objects" xmlns="http://cfpe/export /objects" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="Templates" type="TemplateListType" />
<xsd:complexType name="TemplateListType">
<xsd:sequence>
<xsd:element name="Template" type="TemplateType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TemplateType">
<xsd:sequence>
<xsd:element name="ObjTmplId" type="xsd:integer"/>
<xsd:element name="AttTmplId" type="xsd:integer"/>
<xsd:element name="Is_Ingest" type="xsd:integer"/>
<xsd:element name="System_Name" type="xsd:string"/>
<xsd:element name="System_Category" type="xsd:string"/>
<xsd:element name="System_Class" type="xsd:string"/>
<xsd:element name="System_Table" type="xsd:string"/>
<xsd:element name="System_Attribute" type="xsd:string"/>
<xsd:element name="System_Value" type="xsd:string"/>
<xsd:element name="Condition" minOccurs="0" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
xsd无法验证xml。我试图让xml文件对xsd有效。我附上了xml和xsd文档
答案 0 :(得分:1)
正确的xml是..
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Templates xmlns:ns1="http://cfpe/export/objects">
<ns1:Template>
<ns1:ObjTmplId/>
<ns1:AttTmplId/>
<ns1:Is_Ingest/>
<ns1:System_Name/>
<ns1:System_Category/>
<ns1:System_Class/>
<ns1:System_Table/>
<ns1:System_Attribute/>
<ns1:System_Value/>
<ns1:Condition/>
</ns1:Template>
</ns1:Templates>
我通过XMLSpear验证了