我想使用XML架构创建Java bean。我尝试使用freeformatter.com's XSD/XML Schema Generator从XML创建XML模式。这是我生成的XML模式,并产生错误:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://open-services.net/ns/core#" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shortTitle">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="rdf:parseType" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="discussedBy">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="rdf:resource" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="instanceShape">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="rdf:resource" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="serviceProvider">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute ref="rdf:resource" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
这是错误:
- src-resolve.4.2: Error resolving component 'rdf:parseType'. It was detected that 'rdf:parseType' is in namespace 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', but
components from this namespace are not referenceable from schema document 'file:///home/workspace/jaxbexe/xsdfile.xsd'. If this is the incorrect namespace,
perhaps the prefix of 'rdf:parseType' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///home/
workspace/jaxbexe/xsdfile.xsd'.
- s4s-elt-invalid-content.1: The content of '#AnonType_shortTitle' is invalid. Element 'attribute' is invalid, misplaced, or occurs too often.
答案 0 :(得分:0)
是的,这个免费工具似乎无法应对命名空间。所以要么向作者抱怨要修复它,要么使用不同的工具 - 周围有很多。