Re: [xml] Get sub-document from xmlDocPtr



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/



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