Re: How do I access the original name for XML elements, including the original namespace prefix.
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, October 22, 2008, 12:49:20 PM, Geoff Shuetrim wrote: > Daniel > > Thanks for the quick response. Just to be absolutely clear, I am > generating an XML DOM object using a namespace-aware document builder > factory. That produces XML DOM objects where I can call the getPrefix() > method (see http://tinyurl.com/56onqp) for element nodes and get back > the namespace prefix used for that node. Thus, the original prefixes > are exposed by my original data structure. Yes, in W3C DOM they expose it, and even stuff like the line numbers, but they are still not really part of the XML info-model. Maybe someone will point to the spec and say that the prefix is, but then that's just stupid. :) Anyway, see may response to Jonathan for a possible solution, and also regarding my doubts if it will help. I still think that the easiest would be if you configure the document builder factory to namespace unaware. Of course, if you also have to use the same DOM for other purposes than reproducing an XML source code, then that's not an option. > However, when I access those same element nodes in the XML DOM from > within a freemarker template and then use the getPrefix() method > (eg: element.prefix) I run into a situation where I get back an > empty freemarker.ext.dom.NodeListModel. > Is there something about the way that the element nodes are being > wrapped that hides the prefixes from me? XML is not wrapped with the general-purpose BeansWrapper, it has a totally independent wrapping. The only stuff that is exposed is that's described here: http://freemarker.org/docs/xgui_imperative_formal.html > Cheers > > Geoff Shuetrim -- Best regards, Daniel Dekany ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/