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);
  close (fd);
   /*free the document */
If I use the xmlSaveToFilename call I get the output in the file I
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 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:

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
is not defined.

  Either your compiler is buggy or you tried to dereference a pointer to
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);

Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

Attachment: xml.txt
Description: xml.txt

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