[jdom-interest] Namespace prefix

Brett McLaughlin brett.mclaughlin at lutris.com
Fri Oct 13 16:23:35 PDT 2000


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
> 
> 
> 






More information about the jdom-interest mailing list