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)