mixed content

Added support for mixed contents. in which text nodes are placed in conjunction with subelements within an element. Similar to the way I handled <any>, text nodes are placed in DataRecord[String] object along with other DataRecord objects under a member value called mixed.

Suppose we have a schema that looks like this:

<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>

The usage code from the unit test looks like this:

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)