Xml XSD-没有?
我有一个简单的XML数据,希望使用 我的XSD文件。我想在任何类型的文件中创建XSD文件 面向对象的方式。因为至少在我看来,理解/阅读更好Xml XSD-没有?,xml,xsd,Xml,Xsd,我有一个简单的XML数据,希望使用 我的XSD文件。我想在任何类型的文件中创建XSD文件 面向对象的方式。因为至少在我看来,理解/阅读更好 s4s-elt-must-match.1: The content of 'Job' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: sequence. 我的XML: &l
s4s-elt-must-match.1: The content of 'Job' must match (annotation?, (simpleType | complexType)?, (unique |
key | keyref)*)). A problem was found starting at: sequence.
我的XML:
<?xml version="1.0" encoding="UTF-8"?>
<DSExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="TestXSD.xsd">
<Job Identifier="someString1">
<Project name="someString2">
<tag1 />
<tag2 />
</Project>
</Job>
</DSExport>
s4s-elt-must-match.1: The content of 'Job' must match (annotation?, (simpleType | complexType)?, (unique |
key | keyref)*)). A problem was found starting at: sequence.
如果我把每一部分都写在主要部分,我知道如何解决它。。。
但是我如何像面向对象那样解决它呢?我想把这些东西分开
每个元素的complexType定义
s4s-elt-must-match.1: The content of 'Job' must match (annotation?, (simpleType | complexType)?, (unique |
key | keyref)*)). A problem was found starting at: sequence.
谢谢你的帮助 您已经两次定义了作业和项目元素。您应该将序列移动到类型定义,如下所示:
s4s-elt-must-match.1: The content of 'Job' must match (annotation?, (simpleType | complexType)?, (unique |
key | keyref)*)). A problem was found starting at: sequence.
<xs:element name="DSExport">
<xs:complexType>
<xs:sequence>
<xs:element name="Job" type="JobType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="JobType">
<xs:sequence>
<xs:element name="Project" type="ProjectType"/>
</xs:sequence>
<xs:attribute name="Identifier" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="ProjectType">
<xs:sequence>
<xs:element name="tag3"></xs:element>
<xs:element name="tag4"></xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
另请参见:谢谢你,伙计!这很有效,在我看来,这真的是可读的!它工作得很好!
s4s-elt-must-match.1: The content of 'Job' must match (annotation?, (simpleType | complexType)?, (unique |
key | keyref)*)). A problem was found starting at: sequence.