1 #ifndef __XMLDOCUMENT_H__INCLUDED__
2 #define __XMLDOCUMENT_H__INCLUDED__
29 std::string mContents;
31 typedef std::vector< XMLElement* > ElementList;
32 typedef std::map< std::string, XMLElement* >ElementMap;
33 typedef std::map< std::string, std::string >AttributeMap;
35 ElementList mChildren;
38 AttributeMap mAttributes;
73 XMLElement(
const char *
tagName,
const char*
const *attrValuePairList,
unsigned int nAttr );
76 XMLElement(
const std::string &
tagName,
const std::vector< std::string > &attrValuePairList );
79 XMLElement(
const std::string &
tagName,
const std::map< std::string, std::string > &attrValuePairList );
135 const std::string&
contents()
const;
157 return mChildren.size();
163 return ( idx < mChildren.size() ) ? mChildren[idx] : 0;
169 return ( idx < mChildren.size() ) ? mChildren[idx] : 0;
187 static std::string empty;
188 return ( mIdAttribute == mAttributes.end() ) ? empty : mIdAttribute->second;
194 static std::string empty;
195 return ( mNameAttribute == mAttributes.end() ) ? empty : mNameAttribute->second;
256 void clear(
bool doAttributes =
true );
261 return mAttributes.find( name );
267 return mAttributes.find( name );
274 void setAttribute(
const std::string &name,
const std::string &value );
292 return mAttributes.begin();
298 return mAttributes.begin();
303 return mAttributes.end();
309 return mAttributes.end();
315 return mChildren.begin();
321 return mChildren.begin();
327 return mChildren.end();
333 return mChildren.end();
346 static void JoinMaps( ElementMap &dst,
const ElementMap &src );
478 virtual bool parse(
const void *buf,
unsigned int len );
491 virtual bool importXML(
const std::string &path );
499 virtual bool exportXML( std::ostream &stream );
502 bool exportXML(
const std::string &filename );
548 virtual const std::string&
getTarget()
const = 0;
561 const std::string &data ) = 0;
565 #endif //__XMLDOCUMENT_H__INCLUDED__