Re: [xml] Get sub-document from xmlDocPtr






Daniel Veillard wrote:

On Thu, Jul 17, 2008 at 06:13:53AM -0700, Andrew Hartley wrote:
Thanks for the reply Daniel.  However, I only wanted to explain that I
had
solved the problem.  Here is a little more of my code just in case others
have the same problem:

  Honneslty i don't see the point:

[code]
xmlDocPtr pXmlDoc = xmlParseFile( szFilepath );

  here you have the document

   xmlXPathObjectPtr pXPathObj = xmlXPathEvalExpression( (const
xmlChar*)"//ct1:Ct1", pXPathCtx );

  you're searching on that document

[...]
         // sub-document containing only the CT1 nodeset:
         xmlDocPtr pXmlSubDoc = pNodeSet->nodeTab[0]->doc;

  that's an element from pXmlDoc, so pXmlSubDoc == pXmlDoc should be
true.

         // ... and save:
         xmlSaveCtxtPtr pSaveCtx = xmlSaveToFilename(
sFilenameCopyTo.c_str(), NULL, 0 );
         long ret = xmlSaveDoc( pSaveCtx, pXmlSubDoc );
         ret = xmlSaveClose( pSaveCtx );

  and you're saving the full document. No i don't understand how that code
does something meaningful...

I must be missing something.

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/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




The <CT1> nodeset is embedded within a soap envelope XML node.  What I am
doing is extracting the <CT1> nodeset and saving it out as a seperate XML
document.  It is working as I intended.

-- 
View this message in context: http://www.nabble.com/Get-sub-document-from-xmlDocPtr-tp18504765p18510752.html
Sent from the Gnome - Lib - Xml - General mailing list archive at Nabble.com.




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