[jdom-interest] moving namespaces up
Jason Hunter
jhunter at collab.net
Fri Jun 15 17:13:49 PDT 2001
root.addNamespaceDeclaration(a);
root.addNamespaceDeclaration(b);
The outputter knows well enough not to output the decl again if it's
already somewhere up the tree.
-jh-
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.
>
> What else I can do aside from subclassing Element or Document and writing my
>
> own method to do that?
>
> This question comes from the need to integrate the product I'm working on
> with some other tool which is not able to recognize that child1 actually is
> in namespace FOO: and child2 is in namespace BAR: unless namespaces are
> defined
> somewhere up in the tree.
>
> Thanks and regards,
> --V.
>
> ***********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. Any unauthorized review, use, disclosure or distribution
> is prohibited. If you are not the intended recipient, please contact
> the sender by reply e-mail and destroy all copies of the original
> message.
> ***********************************************************************
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list