Re: [xml] Copy properties and namespaces




Thanks Daniel. My test shows that for copying namespaces, I only need to
do: 

               B->nsDef=xmlCopyNamespaceList(A->nsDef);

And I don't need to do following:

               B->ns=xmlCopyNamespaceList(A->ns);


So what's the difference between "ns" and "nsDef" of a node?

Thanks,
Yong Chen


-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com] 
Sent: Friday, February 09, 2007 11:51 PM
To: Yong Chen (yongche)
Cc: xml gnome org
Subject: Re: [xml] Copy properties and namespaces

On Fri, Feb 09, 2007 at 07:13:26PM -0800, Yong Chen (yongche) wrote:

Hi,

I've a question regarding copying one node's properties and 
namespaces.

First, I want to copy all properties of node A to B, is it 
correct to 
do following?

                B->properties=xmlCopyPropList(B, A->properties)


Then, I also know that node A has several namespaces 
defined (such as 
xmlns:first="www.first.com" xmlns:second="www.second.com"), 
I want to 
copy all of them to node B, should I do both of following?

               B->ns=xmlCopyNamespaceList(A->ns);
And
               B->nsDef=xmlCopyNamespaceList(A->nsDef);


  yes, in libxml2 they are separate kind of objects,

Daniel

--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  
http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search 
engine  http://rpmfind.net/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]