77 Attribute(
Tag* parent,
const std::string& name,
const std::string& value,
86 Attribute(
const std::string& name,
const std::string& value,
104 const std::string&
name()
const {
return m_name; }
110 const std::string&
value()
const {
return m_value; }
118 bool setValue(
const std::string& value );
124 const std::string xmlns()
const;
132 bool setXmlns(
const std::string& xmlns );
140 bool setPrefix(
const std::string& prefix );
146 const std::string& prefix()
const;
152 const std::string xml()
const;
159 {
return m_name == right.m_name && m_value == right.m_value && m_xmlns == right.m_xmlns; }
166 {
return !( *
this == right ); }
171 operator bool()
const {
return !m_name.empty(); }
174 void init(
const std::string& name,
const std::string& value,
175 const std::string& xmlns );
180 std::string m_prefix;
194 Tag(
const std::string& name,
const std::string& cdata =
EmptyString );
203 Tag(
Tag* parent,
const std::string& name,
const std::string& cdata =
EmptyString );
211 Tag(
const std::string& name,
const std::string& attrib,
const std::string& value );
221 Tag(
Tag* parent,
const std::string& name,
const std::string& attrib,
const std::string& value );
233 const std::string xml()
const;
242 bool setPrefix(
const std::string& prefix );
249 const std::string&
prefix()
const {
return m_prefix; }
256 const std::string& prefix(
const std::string& xmlns )
const;
278 bool setXmlns(
const std::string& xmlns,
const std::string& prefix =
EmptyString );
286 const std::string xmlns()
const;
305 const std::string xmlns(
const std::string& prefix )
const;
317 bool addAttribute( Attribute* attr );
327 bool addAttribute(
const std::string& name,
const std::string& value );
338 bool addAttribute(
const std::string& name,
int value );
349 bool addAttribute(
const std::string& name,
long value );
359 void setAttributes(
const AttributeList& attributes );
365 void addChild(
Tag* child );
372 void addChildCopy(
const Tag* child );
380 bool setCData(
const std::string& cdata );
388 bool addCData(
const std::string& cdata );
394 const std::string&
name()
const {
return m_name; }
400 const std::string cdata()
const;
406 const AttributeList& attributes()
const;
412 const TagList& children()
const;
419 const std::string& findAttribute(
const std::string& name )
const;
427 bool hasAttribute(
const std::string& name,
const std::string& value =
EmptyString )
const;
435 Tag* findChild(
const std::string& name )
const;
445 Tag* findChild(
const std::string& name,
const std::string& attr,
456 bool hasChild(
const std::string& name,
const std::string& attr =
EmptyString,
466 Tag* findChildWithAttrib(
const std::string& attr,
const std::string& value =
EmptyString )
const;
477 {
return findChildWithAttrib( attr, value ) ? true :
false; }
487 TagList findChildren(
const std::string& name,
const std::string& xmlns =
EmptyString )
const;
495 void removeChild(
const std::string& name,
const std::string& xmlns =
EmptyString );
502 void removeChild(
Tag* tag );
510 void removeAttribute(
const std::string& attr,
const std::string& value =
EmptyString,
520 bool hasChildWithCData(
const std::string& name,
const std::string& cdata )
const;
545 const std::string findCData(
const std::string& expression )
const;
557 const Tag* findTag(
const std::string& expression )
const;
568 ConstTagList findTagList(
const std::string& expression )
const;
575 bool operator==(
const Tag &right )
const;
587 operator bool()
const {
return !m_name.empty(); }
603 XPExpectedLeftOperand,
618 Node( Tag* _tag ) : type( TypeTag ), tag( _tag ) {}
619 Node( std::string* _str ) : type( TypeString ), str( _str ) {}
630 typedef std::list<Node*> NodeList;
638 const NodeList& nodes()
const
640 static const NodeList empty;
641 return m_nodes ? *m_nodes : empty;
650 AttributeList* m_attribs;
655 std::string m_prefix;
698 {
delete m_xmlnss; m_xmlnss = xmlns; }
700 Tag* parse(
const std::string& expression,
unsigned& len, TokenType border = XTNone )
const;
702 void closePreviousToken( Tag**, Tag**, TokenType&, std::string& )
const;
703 void addToken( Tag **root, Tag **current, TokenType type,
const std::string& token )
const;
704 void addOperator( Tag **root, Tag **current, Tag* arg, TokenType type,
705 const std::string& token )
const;
706 bool addPredicate( Tag **root, Tag **current, Tag* token )
const;
708 TagList findChildren(
const TagList& list,
const std::string& name,
714 static TokenType getType(
const std::string& c );
716 static bool isWhitespace(
const char c );
717 bool isNumber()
const;
719 bool evaluateBoolean( Tag* token )
const;
720 bool evaluatePredicate( Tag* token )
const {
return evaluateBoolean( token ); }
721 bool evaluateEquals( Tag* token )
const;
This class implements an XML parser.
bool operator!=(const Attribute &right) const
const std::string & value() const
bool operator==(const Attribute &right) const
const std::string & name() const
This is an abstraction of an XML element.
bool hasChildWithAttrib(const std::string &attr, const std::string &value=EmptyString) const
bool operator!=(const Tag &right) const
const std::string & prefix() const
std::list< Attribute * > AttributeList
const std::string & name() const
The namespace for the gloox library.
std::list< Tag * > TagList
std::list< std::string * > StringPList
const std::string EmptyString
std::list< const Tag * > ConstTagList
std::map< std::string, std::string > StringMap