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]>
Thursday, October 23, 2008, 2:17:04 AM, Geoff Shuetrim wrote:

> On Wed, 2008-10-22 at 13:19 +0200, Daniel Dekany wrote:
> [snip]
>> 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.
> [snip]
>
> You are right that this is the sticking point.  The DOM is more normally
> used for things where namespace awareness is critical.  I can parse the
> XML document both ways but that is not particularly elegant so I have
> been casting around for other options.
>
> I am not sure I quite get Jonathan's suggestion yet.  Does it involve
> tinkering with the Freemarker freemarker.ext.dom.ElementModel and
> freemarker.ext.dom.NodeOutputter classes so that I can use
> @@original_prefix as a key for element nodes?  That looks like it would
> work but it is a pity to be customising Freemarker directly.

I meant that *we* could add that. However, more would be needed for
what you need. First of all, you can't even get the local name of the
element, so @@local_name should be added too. Secondly, you will have
to generate the xmlns:... attributes as well, and as things stand you
can't even get their @@qname now, as it seems to be undefined.

> As a side question, where can I read about the convention regarding
> variables with names that start with @ and @@?  I have not come across
> anything in the reference pages on the website.

As I said earlier:
http://freemarker.org/docs/xgui_imperative_formal.html

> Regards
>
> Geoff Shuetrim
>
>
> -------------------------------------------------------------------------
> 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=/
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user

-- 
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=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.