0

我想使用 XML 模式创建一个 Java bean。我尝试使用 freeformatter.com 的 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.
4

1 回答 1

0

是的,这个免费工具似乎无法处理命名空间。所以要么向作者投诉以修复它,要么使用不同的工具 - 周围有很多。

于 2013-08-19T08:00:10.727 回答