logo       

declaring a namespace for XML literal, was Re: xquery2src: msg#00070

lang.scala

Subject: declaring a namespace for XML literal, was Re: xquery2src

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,

The current version of xquery2src does not seem to support namespace declarations (declare namespace ...; ). Do you plan to implement this ? When do you think you would make available the new Scalax package ?

The relevance of this is that currently my application ( a financial planner for insurance companies) is implemented all the way using XSL and XQuery calculations. My research area at the moment is to find a programming environment which allows the use of my business terms - as opposed to the XML domain specific approach of XSL/XQuery - and supports a relatively painless migration path. XQuery calculations are the first area in my application I would use for benchmarking an alternative architecture.

regards,
Balazs



--
Burak Emir

http://lamp.epfl.ch/~emir




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise