|
From: <cn...@us...> - 2008-12-30 23:50:48
|
Revision: 119
http://hgengine.svn.sourceforge.net/hgengine/?rev=119&view=rev
Author: cnlohr
Date: 2008-12-30 23:50:34 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
make the XML Parser use MercuryFiles
Modified Paths:
--------------
Mercury2/src/XMLParser.cpp
Modified: Mercury2/src/XMLParser.cpp
===================================================================
--- Mercury2/src/XMLParser.cpp 2008-12-30 23:50:17 UTC (rev 118)
+++ Mercury2/src/XMLParser.cpp 2008-12-30 23:50:34 UTC (rev 119)
@@ -1,4 +1,6 @@
#include <XMLParser.h>
+#include <MercuryFile.h>
+
#include <libxml/parser.h>
#include <libxml/tree.h>
@@ -96,8 +98,24 @@
XMLDocument* xmldoc = new XMLDocument();
xmlInitParser(); //XXX WTF am I supposed to do with this
- xmldoc->m_doc = xmlReadFile(file.c_str(), NULL, 0);
-
+
+ char * doc;
+
+ int ret = FileToString( file, doc );
+
+ if( ret == -1 ) //File error
+ {
+ printf( "Warning: Could not open XML File: \"%s\".\n", file.c_str() );
+ return xmldoc;
+ }
+
+ if( (xmldoc->m_doc = xmlReadMemory( doc, ret, NULL, NULL, 0) ) == 0 )
+ {
+ printf( "Warning: Could not parse XML File: \"%s\".\n", file.c_str() );
+ }
+
+ free( doc );
+
return xmldoc;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|