Sylvain Wallez wrote:
Gianugo Rabellino wrote:

Christopher Oliver wrote:

That is a problem with JXPath. I may be wrong, but if IIRC it doesn't support namespaces properly or at all.



Bad bad news. Actually it seems to do selections just fine, but insertions are flawed. OK, time for tricks then :-/



AFAIK, even for selection you may encounter problems as the prefix is used, but the actual namespace URI is ignored.


There may be a workaround for the binding, however: the o.a.c.util.jxpath.DOMFactory class tries to guess the namespace URI when asked to create a prefixed element by crawling up the DOM tree up to finding an "xmlns:" namespace declaration attribute for that prefix.

So if you add that declaration on the root element of the document you bind to, prefixed elements should be correctly namespaced.

Will give it a try, thanks. It would work much better than what I'm using now (a hacky transformer that gets prefix->namespace mappings from external files and plugs them "on the fly" when it gets a null or empty nsURI for a qualified start/endElement). Actually, however, my problem was in SAX parsing to a SourcePropWritingTransfomer, where I got a DOM Namespace error. Will see if your workaround fixex that.


Thanks so much,

--
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
    (Blogging at: http://www.rabellino.it/blog/)

Reply via email to