]> git.mxchange.org Git - simgear.git/blobdiff - simgear/xml/easyxml.cxx
HTTP: Rename urlretrieve/urlload to save/load.
[simgear.git] / simgear / xml / easyxml.cxx
index cb6ee263eb27786684f079d1735d3674399c2091..08a39fa48b20b7b725f671659a4381ccacd89240 100644 (file)
@@ -4,17 +4,26 @@
  * This file is in the Public Domain, and comes with NO WARRANTY of any kind.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+     
 #include <simgear/compiler.h>
 
 #include <string.h>            // strcmp()
 
 #include "easyxml.hxx"
-#include "xmlparse.h"
+     
+#ifdef SYSTEM_EXPAT
+#  include <expat.h>
+#else
+#  include "sg_expat.h"     
+#endif
+     
+#include <fstream>
+#include <iostream>
 
-#include STL_FSTREAM
-#include STL_IOSTREAM
-
-SG_USING_STD(ifstream);
+using std::ifstream;
 
 
 \f
@@ -127,24 +136,10 @@ XMLAttributesDefault::setValue (const char * name, const char * value)
 }
 
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Attribute list wrapper for Expat.
 ////////////////////////////////////////////////////////////////////////
 
-class ExpatAtts : public XMLAttributes
-{
-public:
-  ExpatAtts (const char ** atts) : _atts(atts) {}
-  
-  virtual int size () const;
-  virtual const char * getName (int i) const;
-  virtual const char * getValue (int i) const;
-  
-private:
-  const char ** _atts;
-};
-
 int
 ExpatAtts::size () const
 {
@@ -166,6 +161,11 @@ ExpatAtts::getValue (int i) const
   return _atts[i*2+1];
 }
 
+const char * 
+ExpatAtts::getValue (const char * name) const
+{
+  return XMLAttributes::getValue(name);
+}
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -258,6 +258,7 @@ readXML (istream &input, XMLVisitor &visitor, const string &path)
   }
 
   XML_ParserFree(parser);
+  visitor.endXML();
 }
 
 void
@@ -303,6 +304,7 @@ readXML (const char *buf, const int size, XMLVisitor &visitor)
   }
 
   XML_ParserFree(parser);
+  visitor.endXML();
 }
 
 // end of easyxml.cxx