CData and string()

15 views
Skip to first unread message

Alexey Romanchuk

unread,
Mar 6, 2013, 1:29:54 AM3/6/13
to scale...@googlegroups.com
Hey!

string() applied to XPath does not contains CData text. Here it is short example.

import org.scalatest.FunSuite
import java.io.StringReader
import org.xml.sax.InputSource
import scales.xml._
import scales.xml.ScalesXml._
import scales.xml.Functions._

class StringAndCDagta extends FunSuite {
  test("Minimum items") {
    val input = """<root>
                  | <nested1>1</nested1>
                  | <nested2><![CDATA[1]]></nested2>
                  |    </root>
                  | """.stripMargin('|')
    val xml = pullXml(new InputSource(new StringReader(input)))
    val root = iterate(List("root" l), xml).next()
    assert( "1" === string(root \* "nested1"))
    assert( "1" === string(root \* "nested2"))
  }
}

It fails on second assert.


Is it bug? If no then how should I access CData's text?

Thanks!

Chris Twiner

unread,
Mar 6, 2013, 4:44:58 PM3/6/13
to scale...@googlegroups.com
list fyi - Alexey raised #24 against this. Indeed a bug.

Many thanks for finding this.
> --
> You received this message because you are subscribed to the Google Groups
> "scales-xml" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scales-xml+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages