<any> revisited

In order for a DataRecord to not lose the freight during the round trip of <any>, I've been storing the scala.xml.Elem object within it. This is convenient for the round trip, but not for consuming the DataRecord. The problem with <any> is that it could be anything, and I wouldn't know how to parse them. At least when they are not built-in types.

Now that mixed contents have been cleaned up, it seemed like a good time to start parsing XSD built-in types too. Here's how it looks like:

def testAny {
  val subject = <foo xmlns="http://www.example.com/any"
        <int xsi:type="xs:int">1</int>
        <byte xsi:type="xs:byte">1</byte>
        <dateTime xsi:type="xs:dateTime">2002-10-10T12:00:00Z</dateTime>
  val obj = Element1.fromXML(subject)
  obj match {
    case Element1(
        DataRecord(Some("http://www.example.com/any"), Some("int"), 1),
        DataRecord(Some("http://www.example.com/any"), Some("byte"), 1),
        DataRecord(Some("http://www.example.com/any"), Some("dateTime"), XMLCalendar("2002-10-10T12:00:00Z"))
      ) =>
    case _ => error("match failed: " + obj.toString)
  val document = Element1.toXML(obj, None, Some("foo"), subject.scope)

The DataRecord object now stores Int, Byte, javax.xml.datatype.XMLGregorianCalendar, or whatever that's appropriate for the built-in types. It also internally remembers how to round trip back with a {http://www.w3.org/2001/XMLSchema-instance}type attribute.