[zypp-commit] r5344 - in /trunk/libzypp/zypp/parser/xml: Reader.cc Reader.h
Author: dmacvicar Date: Wed Apr 11 19:09:45 2007 New Revision: 5344 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5344&view=rev Log: - add conveniencve method to return text from nodes, makes event parsing much more easy Modified: trunk/libzypp/zypp/parser/xml/Reader.cc trunk/libzypp/zypp/parser/xml/Reader.h Modified: trunk/libzypp/zypp/parser/xml/Reader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xml/Reader.cc?rev=5344&r1=5343&r2=5344&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/xml/Reader.cc (original) +++ trunk/libzypp/zypp/parser/xml/Reader.cc Wed Apr 11 19:09:45 2007 @@ -113,6 +113,21 @@ } } + XmlString Reader::nodeText() + { + if ( ! _node.isEmptyElement() ) + { + if ( nextNode() ) + { + if ( _node.nodeType() == XML_READER_TYPE_TEXT ) + { + return _node.value(); + } + } + } + return XmlString(); + } + /////////////////////////////////////////////////////////////////// // // METHOD NAME : Reader::nextNode Modified: trunk/libzypp/zypp/parser/xml/Reader.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/xml/Reader.h?rev=5344&r1=5343&r2=5344&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/xml/Reader.h (original) +++ trunk/libzypp/zypp/parser/xml/Reader.h Wed Apr 11 19:09:45 2007 @@ -103,6 +103,17 @@ ~Reader(); public: + + /** + * If the cuurent node is not empty, advances the reader to the next + * node, and returns the value + * + * \note if the node has a xml subtree you will probably jump to that node + * and get a empty text value back. Use it only if you are sure the node + * has no XML subtree. + */ + XmlString nodeText(); + /** */ bool nextNode(); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org