You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Renato Tegon Forti <re...@acm.org> on 2012/10/02 13:38:23 UTC
How to create a new document using DOM?
Hi All,
Anyone can help-me?
I have this documment:
<?xml version="1.0" encoding="UTF-8" ?>
<x1 versao="1.10" xmlns="http://www.ts.inf/x1">
<x2>
<x3>
<x4>
...
</x4>
</x3>
</x2>
</x1>
I am loadind this document using:
XercesDOMParser * parser = new XercesDOMParser;
// ...
DOMDocument *theDOM = parser->getDocument();
// ..
Now I want create a new document like this:
<?xml version="1.0" encoding="UTF-8" ?>
<x3>
<x4>
...
</x4>
</x3>
Using firs document like an base!
How I can do this? Anyone can send me a sample code! Thaks a lot!
Re: How to create a new document using DOM?
Posted by Ben Griffin <be...@redsnapper.net>.
Renato,
This is the line that you are looking for.
DomDocument new_doc = theDOM->cloneNode(true);
On 2 Oct 2012, at 12:38, "Renato Tegon Forti" <re...@acm.org> wrote:
> Hi All,
>
>
>
> Anyone can help-me?
>
>
>
> I have this documment:
>
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <x1 versao="1.10" xmlns="http://www.ts.inf/x1">
>
> <x2>
>
> <x3>
>
> <x4>
>
> ...
>
> </x4>
>
> </x3>
>
> </x2>
>
> </x1>
>
>
>
> I am loadind this document using:
>
>
>
> XercesDOMParser * parser = new XercesDOMParser;
>
> // ...
>
> DOMDocument *theDOM = parser->getDocument();
>
> // ..
>
>
>
> Now I want create a new document like this:
>
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <x3>
>
> <x4>
>
> ...
>
> </x4>
>
> </x3>
>
>
>
> Using firs document like an base!
>
>
>
> How I can do this? Anyone can send me a sample code! Thaks a lot!
>