Re: [xml] xmlSaveToFd problem




I get further now, but still having problems.  Here is my code snippet

.
.
.
xmlSaveCtxtPtr ctxt;

   int fd;
   fd = open ((char*)"c:\\temp\\test.xml", O_RDWR | O_CREAT);
   ctxt = xmlSaveToFd (fd, "UTF-8", 1);
  // ctxt = xmlSaveToFilename ((char *)"c:\\temp\\test.xml", "UTF-8",1);

   long ll;
   
   ll = xmlSaveDoc (ctxt, doc);
   xmlSaveClose(ctxt);
  close (fd);
   
   /*free the document */
   xmlFreeDoc(doc);
.
.
.
If I use the xmlSaveToFilename call I get the output in the file I
expect.
If I open the file to create the file descriptor (fd), the xmlSaveDoc
returns the success value of 0, but the file is empty.  Is there some
options flags I need to set in the open command so the library can write
to the file.
For what it is worth I am running my tests on Windows XP using Visual
Studio .NET 2003.

Bart
Bart torbert ihsenergy com


-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com] 
Sent: Friday, December 08, 2006 10:29 AM
To: Torbert, Barton
Cc: xml gnome org
Subject: Re: [xml] xmlSaveToFd problem

On Fri, Dec 08, 2006 at 10:01:34AM -0700, Torbert, Barton wrote:
  Hello,

First of all I don't see how to use the xmlSave.h file within my code.

  there is no xmlSave.h, but xmlsave.h

When I include it I get a compiler error that the structure
_xmlSaveCtxt
is not defined.

  Either your compiler is buggy or you tried to dereference a pointer to
the
structure. You can't.

I find the definition of this in the xmlSave.c file.
This file includes the xmlSave.h file, but before the declaration of
_xmlSaveCtxt.  So how does anything compile.

  Any normal C compiler can use pointer to undefined structs

Also I don't understand the workflow here, assuming I can get the

  ctxt = xmlSaveToFd(...)
  xmlSaveDoc(ctxt, doc);
  xmlSaveClose(ctxt);
  
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/

Attachment: xml.txt
Description: xml.txt



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