You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Philippe HAUTION <ha...@clr34ei.der.edf.fr> on 2002/11/05 17:45:02 UTC

serializing a DOMDocument with namespaces

Hello,

We are trying to serialize an in-memory DOMDocument with a DOMWriter 
into a MemBufFormatTarget (Xerces 2.1.0).
This used to work fine for the tests, when we didn't use namespaces, but 
now we do and the resulting string can't be parsed again since the 
writer doesn't generate the "xmlns" attribute for the root element.

Is there a way to correct this behaviour ?

Regards,

-- 
Philippe Haution
EDF R&D
Département Méthodes d'Optimisation et de Simulation
1 Av du Général de Gaulle
92141 Clamart CEDEX



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: serializing a DOMDocument with namespaces

Posted by Philippe HAUTION <ha...@clr34ei.der.edf.fr>.
Thank you for you quick answer.

Gareth Reakes wrote:

>Hi,
>	you need to use functionality that has not yet been implemented. 
>The DOMWriter should sort out namespaces for you. There is also a method 
>called NormalizeDocument on Node that will do this (again not 
>implemented). 
>
I guess I'll have to implement some sort of custom DOMWriter.

>I believe I have some quite horrible code lying around 
>somewhere that sorts out namespace issues. It would only work with the old 
>model, but it should not be to hard to change. Give me a shout if you want 
>it and Ill have a look.
>
May I have this code please ? I am sure it will be a good starting point.

Regards,

>
>cheers
>
>Gareth 
>
>
>On Tue, 5 Nov 2002, Philippe HAUTION wrote:
>
>>Hello,
>>
>>We are trying to serialize an in-memory DOMDocument with a DOMWriter 
>>into a MemBufFormatTarget (Xerces 2.1.0).
>>This used to work fine for the tests, when we didn't use namespaces, but 
>>now we do and the resulting string can't be parsed again since the 
>>writer doesn't generate the "xmlns" attribute for the root element.
>>
>>Is there a way to correct this behaviour ?
>>
>>Regards,
>>
>>
>

-- 
Philippe Haution
EDF R&D
Département Méthodes d'Optimisation et de Simulation
1 Av du Général de Gaulle
92141 Clamart CEDEX



Re: serializing a DOMDocument with namespaces

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	you need to use functionality that has not yet been implemented. 
The DOMWriter should sort out namespaces for you. There is also a method 
called NormalizeDocument on Node that will do this (again not 
implemented). I believe I have some quite horrible code lying around 
somewhere that sorts out namespace issues. It would only work with the old 
model, but it should not be to hard to change. Give me a shout if you want 
it and Ill have a look.

cheers

Gareth 


On Tue, 5 Nov 2002, Philippe HAUTION wrote:

> Hello,
> 
> We are trying to serialize an in-memory DOMDocument with a DOMWriter 
> into a MemBufFormatTarget (Xerces 2.1.0).
> This used to work fine for the tests, when we didn't use namespaces, but 
> now we do and the resulting string can't be parsed again since the 
> writer doesn't generate the "xmlns" attribute for the root element.
> 
> Is there a way to correct this behaviour ?
> 
> Regards,
> 
> 

-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org