26 #ifndef __TERRALIB_XERCES_INTERNAL_UTILS_H
27 #define __TERRALIB_XERCES_INTERNAL_UTILS_H
33 #include <xercesc/dom/DOM.hpp>
34 #include <xercesc/sax2/Attributes.hpp>
35 #include <xercesc/util/XMLString.hpp>
55 inline bool Equals(
const XMLCh*
const s1,
const char*
const s2)
57 char* s1Aux = xercesc::XMLString::transcode(s1);
59 if(strcmp(s1Aux, s2) == 0)
61 xercesc::XMLString::release(&s1Aux);
66 xercesc::XMLString::release(&s1Aux);
82 inline bool NotEquals(
const XMLCh*
const s1,
const char*
const s2)
84 char* s1Aux = xercesc::XMLString::transcode(s1);
86 if(strcmp(s1Aux, s2) == 0)
88 xercesc::XMLString::release(&s1Aux);
93 xercesc::XMLString::release(&s1Aux);
105 inline int ToInt(
const XMLCh* value)
107 char* sAux = xercesc::XMLString::transcode(value);
108 int iVal = atoi(sAux);
109 xercesc::XMLString::release(&sAux);
122 inline std::string
ToString(
const XMLCh*
const value)
125 return std::string(
"");
127 char* sAux = xercesc::XMLString::transcode(value);
143 inline char*
GetAttributeVal(
const xercesc::Attributes& attrs,
const XMLCh*
const attName)
145 const XMLSize_t nattributes = attrs.getLength();
147 for(XMLSize_t i = 0; i < nattributes; ++i)
148 if(xercesc::XMLString::equals(attrs.getLocalName(i), attName))
149 return xercesc::XMLString::transcode(attrs.getValue(i));
167 const bool doNamespace =
false,
168 const bool doSchema =
false,
169 const bool valid =
false);
bool NotEquals(const XMLCh *const s1, const char *const s2)
It return true if the two strings are different, otherwise, it returns false.
char * GetAttributeVal(const xercesc::Attributes &attrs, const XMLCh *const attName)
It returns the given attribute value.
TEXMLEXPORT xercesc::DOMDocument * readXML(const std::string &xmlFile, const bool doNamespace=false, const bool doSchema=false, const bool valid=false)
It reads the XML file using the DOM API.
std::string ToString(const XMLCh *const value)
It converts the XML string to a standard C++ string.
bool Equals(const XMLCh *const s1, const char *const s2)
It return true if the two strings are identical, otherwise, it returns false.
int ToInt(const XMLCh *value)
It converts the XML string to an integer value.
#define TEXMLEXPORT
You can use this macro in order to export/import classes and functions from this module.
Proxy configuration file for TerraView (see terraview_config.h).