[jdom-interest] moving namespaces up
Elliotte Rusty Harold
elharo at metalab.unc.edu
Fri Jun 15 17:21:52 PDT 2001
At 4:28 PM -0700 6/15/01, Vladimir Grishchenko wrote:
>Hello,
>
>Here is a dumb question but I need this functionality for my project.
>I looked briefly at JDOM api and couldn't find a way to do the following:
>
>Say, I have an XML doc stored as:
>
><root>
> <A:child1 xmlns:A="FOO:"/>
> <B:child2 xmlns:B="BAR:"/>
></root>
>
>I read it in via SAXBuilder and I want it to be outputted as:
>
><root xmlns:A="FOO:" xmlns:B="BAR:">
> <A:child1/>
> <B:child2/>
><root/>
>
>Basically I need all namespace declarations to be moved up, possibly
>changing prefix names if there's any prefix name collisions.
>
I doubt this will be a part of the JDOM 1.0 core. We used to do
something like this, but then we were convinced that it was
impossible to do in the general case because of the difficulty of
recognizing when prefixes were and were not used in attribute values
and element content.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible (IDG Books, 1999) |
| http://metalab.unc.edu/xml/books/bible/ |
| http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ |
| Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list