[jdom-interest] Namespace prefix

Kesav Kumar kesavk at voquette.com
Mon Oct 16 09:58:41 PDT 2000


Thanks Brett You rock it.  Now its working perfectly.  I found a small bug
in Element.java, when we use clone or getCopy the additonal attributes are
not transfeered to the new Element.  Now I added this line in getCopy method
in Element.java

clone.additionalNamespaces=additionalNamespace;

This solves the problem of namespaces completly.  I have tested this
Namespace fix in severl ways, now its absolutly perfect.  Thans to Brett for
this fix.

Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:kesavk at voquette.com
http://www.voquette.com


-----Original Message-----
From: Brett McLaughlin [mailto:brett.mclaughlin at lutris.com]
Sent: Friday, October 13, 2000 4:24 PM
Cc: 'jdom-interest at jdom.org'
Subject: Re: [jdom-interest] Namespace prefix


Kesav Kumar wrote:

> Hi 
> 
> I am trying to parse a the following XML and wants the same XML to print.
> 
> <Template>
> 	<Application1 xmlns:xplt="www.xxxx.com" xmlns:xpl="www.xxxx.com"
> version="3.0">
> 		<xpl:insertText/>
> 		<xplt:anyElement>
> 			<Name/>
> 		</xplt:anyElement>
> 	</Application1>
> 	<Application2 xmlns:xplt="www.xxxx.com" xmlns:xpl="www.xxxx.com"
> version="3.0">
> 		<xpl:insertText/>
> 		<xplt:anyElement>
> 			<Name/>
> 		</xplt:anyElement>
> 	</Application2>
> </Template>
> 
> >From this template I want to print the Application1 node as it is like
> 
> 	<Application1 xmlns:xplt="www.xxxx.com" xmlns:xpl="www.xxxx.com"
> version="3.0">
> 		<xpl:insertText/>
> 		<xplt:anyElement>
> 			<Name/>
> 		</xplt:anyElement>
> 	</Application1>
> 
> I tried with the latest SAXBuilder which Brett has fixed the Namespace
> problems.  But still I couldn't get
> the output which I mentioned.  The Attributes xmlns:xplt and xmlns:xpl are
> totally disappeared and the output
> came like the following
> 
> <Application xmlns="www.xxx.com">
> 	<xpl:inserText xmlns="www.xxx.com/>
> 	<xplt:anyElement>
> 		<Name/>
> 	</xplt>
> </Application>
> 
> Can any one suggest me how to get the unchanged xml file.


Hey, Kesev-

  Well, you managed to find a nice bug in my work, plus uncover a huge 
one in XMLOutputter where it would /never/ output a namespace prefix in 
many cases!! You guys out there testing?? ;-)

  Seriously, I think I got everything nice and cleared up, and changed 
checked into CVS. Can you try it now? I even added your XML document to 
samples/testNamespaces.xml, and it works correctly.

Thanks,
Brett

> 
> 
> Kesav Kumar
> Software Engineer
> Voquette, Inc.
> 650 356 3740
> mailto:kesavk at voquette.com
> http://www.voquette.com
> 
> 
> 



_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list