From: James LewisMoss (jimdres@mindspring.com)
Date: Fri Jan 05 2001 - 16:31:10 EST
The following example illustrates what seems wrong:
Code:
#include <gnome-xml/parser.h>
#include <gnome-xml/parserInternals.h>
#include <gnome-xml/tree.h>
#include <gnome-xml/SAX.h>
#include <gnome-xml/xmlIO.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
int
main(int argc, char** argv)
{
char *filename;
xmlParserCtxtPtr ctxt;
xmlParserInputBufferPtr buf;
xmlParserInputPtr input;
int fd;
xmlDocPtr doc;
char inputbuf[1000];
if(argc != 2)
{
printf("%s file.xml\n", argv[0]);
exit(5);
}
filename = argv[1];
fd = open(filename, O_RDONLY);
memset(inputbuf, 0, 1000);
read(fd, inputbuf, 999);
doc = xmlParseMemory(inputbuf, strlen(inputbuf));
printf("\nDoc is:\n");
xmlDocDump(stdout, doc);
printf("\n\n");
xmlElemDump(stdout, doc, doc->root);
close(fd);
}
----------------------------------------------------------------------
Data:
<foobar version="1">
<bar/>
<baz>This is some content<b>Or not<f/></b>blah</baz>
</foobar>
----------------------------------------------------------------------
Output:
Doc is:
<?xml version="1.0"?>
<foobar version="1">
<bar/>
<baz>This is some content<b>Or not<f/></b>blah</baz>
</foobar>
<foobar version="1">
<bar/>
<baz>This is some content<b>Or not<f/></b>blah</baz>
----------------------------------------------------------------------
There seems to be a missing </foobar> in the second bit output by
xmlElemDump. Am I missing something?
Thanks
Jim
-- @James LewisMoss <dres@debian.org> | Blessed Be! @ http://jimdres.home.mindspring.com | Linux is kewl! @"Argue for your limitations and sure enough, they're yours." Bach ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Fri Jan 05 2001 - 16:43:30 EST