0
- 据我所知,在XML(和)XSD用于减轻 引用的元素和属性的二义性的命名空间。
- XML模式的属性的targetNamespace为specifiying的 命名空间,在该文件(或一切 ,其具有的targetNamespace在元件内部)中定义的元素对应于。此 仅适用于在此上下文中“声明”的元素(其名称中包含 的名称在属性“name”中声明)。因此,如果我在Schema中声明目标名称空间,那么我对它进行验证的每个实例都必须在架构中声明的任何元素或属性之前使用该名称空间,或者将其声明为默认名称空间以使我不必在每个实例之前键入该架构与它。
如果有任何的不妥,一定要指正。无法验证XML针对与targetNamespace生成XSD,当XSD具有复合类型
是什么力量推动我疯了,这是为什么不这样:
<?xml version="1.0" encoding="UTF-8"?>
<responsabilities xmlns="http://www.library.org">
<responsability>uno</responsability>
<responsability>dos</responsability>
<responsability>tres</responsability>
</responsabilities>
...验证对这样的:
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.library.org" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:bpd="http://www.library.org" >
<element name="responsabilities" type="bpd:responsabilitiesType"/>
<complexType name="responsabilitiesType">
<sequence>
<element maxOccurs="unbounded" name="responsability" type="string" />
</sequence>
</complexType>
</schema>
它显示了这个错误:
The element 'responsabilities' in namespace ' http://www.library.org ' has invalid child element 'responsability' in namespace ' http://www.library.org '. List of possible elements expected: 'responsability'. Line: 1 Column:90
我使用相同的名称空间方案对SimpleType进行验证,并且完全没有问题。
谢谢。