|
declaring a namespace for XML literal, was Re: xquery2src: msg#00070lang.scala
Hello Molnár, Hopefully, I will release updated and v1.4.0.3-checked scalax before beginning of next week. (I noticed that v1.4.0.4 has a bug appearing when mixing in the MarkupReader class which v1.4.0.3 doesn't have ... ). about the question: I don't recall the exact namespace-declaration syntax of XQuery for now, but it should be easy to support this. Since it might be useful for scala.xml hackers, I'll give some more details here. -- An XML literal <bla:foo ....xmlns:ga="gu">kids</foo> is translated in something like this val $tmp = $scp { val $scp = new NamespaceBinding("ga", "gu", $tmp); // shares the old bindings Elem("bla","foo", attrs, $scp, kids) } (Actually, the namespace business is what makes everything look so ugly, blocks, variables...) The way to declare a namespace mapping from prefix "ga" to URI "gu" would thus be something like the following. declare namespace ga = gu; (morecode) ==> val $tmp = $scp { val $scp = new NamespaceBinding("ga", "gu", $tmp); // shares the old bindings (morecode) } The special variable $scp is visible in every program, because it is defined in Predef.scala -- I hope the scalax tools can account for "a relatively painless migration path", that was in principle what they were made for. cheers, Burak Molnár Balázs wrote: Hello Burak, -- Burak Emir http://lamp.epfl.ch/~emir |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | xquery2src: 00070, Molnár Balázs |
|---|---|
| Next by Date: | Rewriting introduction mixin example for Scala2: 00070, Gabriel Riba |
| Previous by Thread: | xquery2srci: 00070, Molnár Balázs |
| Next by Thread: | announce: new scalax source "release": 00070, Burak Emir |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |