相关疑难解决方法(0)

JAXB XJC编译器忽略XML Schema文档中的mixed = true

XJC似乎完全忽略mixed="true"了我的XML Schema元素,因此不允许我提取文本内容.从下面的示例XML中,我需要能够提取"标题文本".如果没有mixed="true"被识别,就不会创建访问器,也不会从XML中解组:

<?xml version="1.0" encoding="UTF-8"?>
<title xmlns="urn:hl7-org:v3" integrityCheck="true">Title Text</title>
Run Code Online (Sandbox Code Playgroud)

这是一个完整但最小化的模式,用于演示此问题:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema targetNamespace="urn:hl7-org:v3"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="urn:hl7-org:v3"
  xmlns:mif="urn:hl7-org:v3/mif"
  elementFormDefault="qualified">

  <xs:complexType name="ST" mixed="true">
  <xs:complexContent>
         <xs:restriction base="ED">
            <xs:sequence>
               <xs:element name="reference" type="xs:string" minOccurs="0" maxOccurs="0"/>
               <xs:element name="thumbnail" type="xs:string" minOccurs="0" maxOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="compression" type="xs:string" use="prohibited"/>
         </xs:restriction>
      </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="ED" mixed="true">
    <xs:complexContent>
      <xs:extension base="BIN">
        <xs:sequence>
          <xs:element name="reference" type="xs:string" minOccurs="0" maxOccurs="1" />
          <xs:element name="thumbnail" minOccurs="0" maxOccurs="1" type="xs:string" />
            </xs:sequence>
        <xs:attribute name="compression" type="xs:string" use="optional" />
        <xs:attribute name="integrityCheck" type="xs:string" use="optional" />
        <xs:attribute …
Run Code Online (Sandbox Code Playgroud)

xml mixed jaxb xjc

10
推荐指数
2
解决办法
4103
查看次数

标签 统计

jaxb ×1

mixed ×1

xjc ×1

xml ×1