List Info

Thread: xmlSaveToFd problem




xmlSaveToFd problem
user name
2006-12-08 18:53:23
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.torbertihsenergy.com


-----Original Message-----
From: Daniel Veillard [mailto:veillardredhat.com] 
Sent: Friday, December 08, 2006 10:29 AM
To: Torbert, Barton
Cc: xmlgnome.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/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
	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",
XML_SAVE_FORMAT);
   long ll;
   
   ll = xmlSaveDoc (ctxt, doc);
   xmlSaveClose(ctxt);
  // close (fd);
   
   /*free the document */
   xmlFreeDoc(doc);
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )