<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<product description="Cardigan Sweater" product_image="cardigan.jpg">
<catalog_item gender="Men's">
<item_number>QWZ5671</item_number>
<price>39.95</price>
<size description="Medium">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
</size>
<size description="Large">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
</size>
</catalog_item>
<catalog_item gender="Women's">
<item_number>RRX9856</item_number>
<price>42.50</price>
<size description="Small">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
</size>
<size description="Medium">
<color_swatch image="red_cardigan.jpg">Red</color_swatch>
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
<size description="Large">
<color_swatch image="navy_cardigan.jpg">Navy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
<size description="Extra Large">
<color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>
<color_swatch image="black_cardigan.jpg">Black</color_swatch>
</size>
</catalog_item>
</product>
</catalog>
这是上面xml文件的xsd文件。
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element name="product">
<xs:complexType>
<xs:sequence>
<xs:element name="catalog_item">
<xs:complexType>
<xs:sequence>
<xs:element name="item_number">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9]"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="price" type="xs:decimal"/>
<xs:element name="size" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="color_swatch" maxOccurs="unbounded">
<xs:complexType mixed="true">
<xs:attribute name="image" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="description" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="gender" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="product_image" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
maxOccurs
出现约束默认为1,因此XSD只允许一个catalog_item
,而XML有两个。
若要允许多个catalog_item
元素,请添加maxOccurs=“unbounded”
...
改变
<xs:element name="catalog_item">
<xs:element name="catalog_item" maxOccurs="unbounded">
我在spring-data-jpa中使用了这个: 但我有个例外:
org.springframework.beans.factory.XML.xmlBeanDefinitionStoreException:ServletContext资源[/web-inf/dispatcher-servlet.XML]的XML文档中的第71行无效;嵌套异常是org.xml.sax.SAXParseException;行号:71;列号:94;CVC-complex-type2.4
在下面的代码中,我得到了这样的错误:“cvc-complex-type.2.4.a:发现从元素'global-method-security'开始的内容无效。”{“http://www.springframework.org/schema/beans”:import,“http://www.springframework.org/schema/beans”:alias,“http://www.sp
我的架构: 请帮我解决上面的错误。 错误原因:org.xml.sax.saxexception:CVC-complex-type.2.4.A:发现以元素“role”开始的无效内容。需要“{”http://schemas.cordys.com/task/1.0/runtime/“:role}”之一。org.xml.sax.SaxParseException;亚麻编号:9;专栏编号:77;CVC-co
我的骆驼路线有问题,它无法识别我的“dataFormats”标签。我想我的命名空间可能有问题,但我不确定。非常感谢任何帮助。我的错误如下: 无法执行目标组织。阿帕奇。camel:camel-maven插件:2.10.4:在ExactTargetSample项目上运行(默认cli):null:MojoExecutionException:InvocationTargetException:文件[C:
需要“{”http://www.springframework.org/schema/beans“:meta,”h ttp://www.springframework.org/schema/beans“:constructor-arg,”http://www.springframework.org/schema/beans“:property,”http://www.springframework