You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Erik Hatcher <eh...@running-start.com> on 2000/11/21 18:46:52 UTC

Serializing XML document with namespaces

Xerces J folks,

I did a fair amount of Google searching and turned up this same question
on another forum, but did not have any luck finding an answer.   I'm
using the 1.2.1 release of Xerces and trying to serialze an XML
DocumentImpl object using the XMLSerializer exactly as the
DOMGenerate.java sample does, except I'm using createElementNS to create
my elements within a namespace.

The resultant String has no namespace information in it.

How do I serialize an XML document to a String with namespace
information intact?

Thanks,
        Erik

Re: Serializing XML document with namespaces

Posted by Erik Hatcher <eh...@running-start.com>.
I'm surprised I didn't get a response about this already, but I still
haven't found a way to serialize XML and maintain namespaces.  I see the
XMLSerializer does have code to deal with namespaces in
startElement(String namespaceURI, String localName, String rawName,
Attributes attrs).  Why isn't this being called?   And how can I get it
to utilize the functionality that exists there?

If there is a better way to serialize an XML document and have it output
namespaces properly on the elements then I'd be glad to hear about that
also!

Thanks,
	Erik


Erik Hatcher wrote:
> 
> Xerces J folks,
> 
> I did a fair amount of Google searching and turned up this same question
> on another forum, but did not have any luck finding an answer.   I'm
> using the 1.2.1 release of Xerces and trying to serialze an XML
> DocumentImpl object using the XMLSerializer exactly as the
> DOMGenerate.java sample does, except I'm using createElementNS to create
> my elements within a namespace.
> 
> The resultant String has no namespace information in it.
> 
> How do I serialize an XML document to a String with namespace
> information intact?
> 
> Thanks,
>         Erik
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org