Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xml namesapce (scope) not handled correctly when mixing xml literal and scala code #100

Open
biswanaths opened this issue Jul 20, 2015 · 0 comments

Comments

@biswanaths
Copy link
Owner

in scala console

following code works correctly:

scala> val e = <ns:elems xmlns:ns="http://">{List(1, 2, 3).map(x => <ns:elem>{x}</ns:elem>) ++ List(4, 5, 6).map(x => <ns:elem>{x}</ns:elem>)}</ns:elems>
e: scala.xml.Elem = <ns:elems xmlns:ns="http://"><ns:elem>1</ns:elem><ns:elem>2</ns:elem><ns:elem>3</ns:elem><ns:elem>4</ns:elem><ns:elem>5</ns:elem><ns:elem>6</ns:elem></ns:elems>

scala> e \ "elem"
res0: scala.xml.NodeSeq = NodeSeq(<ns:elem xmlns:ns="http://">1</ns:elem>, <ns:elem xmlns:ns="http://">2</ns:elem>, <ns:elem xmlns:ns="http://">3</ns:elem>, <ns:elem xmlns:ns="http://">4</ns:elem>, <ns:elem xmlns:ns="http://">5</ns:elem>, <ns:elem xmlns:ns="http://">6</ns:elem>)

namespace is correct in each child node.

while if using method call, namespace gets lost:

scala> def f(l: List[Int]) = l.map(x => <ns:elem>{x}</ns:elem>)
f: (l: List[Int])List[scala.xml.Elem]

scala> val e = <ns:elems xmlns:ns="http://">{f(List(1, 2, 3)) ++ f(List(4, 5, 6))}</ns:elems>
e: scala.xml.Elem = <ns:elems xmlns:ns="http://"><ns:elem>1</ns:elem><ns:elem>2</ns:elem><ns:elem>3</ns:elem><ns:elem>4</ns:elem><ns:elem>5</ns:elem><ns:elem>6</ns:elem></ns:elems>

scala> e \ "elem"
res2: scala.xml.NodeSeq = NodeSeq(<ns:elem>1</ns:elem>, <ns:elem>2</ns:elem>, <ns:elem>3</ns:elem>, <ns:elem>4</ns:elem>, <ns:elem>5</ns:elem>, <ns:elem>6</ns:elem>)

Imported from : SI-4865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant