混在内容
一つの要素内にテキストノードと子要素が並列して混在している混在内容のサポートを実装しました.<any>と同様にテキストは他のDataRecordオブジェクトと一緒にDataRecord[String]オブジェクトの中に保存され,mixedという値で呼ばれます.
次のようなスキーマがあるとすると,,
<element name="Element3">
<complexType mixed="true">
<choice maxOccurs="unbounded">
<element ref="ipo:Choice1"/>
<element ref="ipo:Choice2"/>
<any namespace="##other" processContents="lax" />
</choice>
</complexType>
</element>
使用例のコードは以下のようになります.
val subject = <foo xmlns="http://www.example.com/IPO"
xmlns:ipo="http://www.example.com/IPO">foo<Choice2>2</Choice2>bar</foo>
val obj = Element3.fromXML(subject)
obj match {
case Element3(Seq(DataRecord("http://www.example.com/IPO", "Choice2", 2)),
Seq(DataRecord(null, null, "foo"),
DataRecord("http://www.example.com/IPO", "Choice2", 2),
DataRecord(null, null, "bar"))) =>
case _ => error("match failed: " + obj.toString)
}
val document = obj.toXML(null, "foo", subject.scope)