zypp::xml Namespace Reference


Classes

class  Node
 xmlTextReader based interface to Reader's current node. More...
struct  ParseDefImplConsume
class  ParseDef
 Define a xml node structure to parse. More...
struct  ParseDefConsume
 Base class for ParseDef consumer. More...
class  ParseDefConsumeRedirect
 ParseDef consumer redirecting all events to another consumer. More...
class  ParseDefConsumeCallback
 ParseDef consumer that invokes callbacks. More...
struct  ParseDefException
 Common base class for ParseDef exceptions. More...
struct  ParseDefBuildException
 Exceptions when building a ParseDef tree. More...
struct  ParseDefValidateException
 Parse exceptions related to the documents node structure. More...
struct  ParseDefDataException
 Parse exceptions related to the nodes content. More...
struct  ParseDefTraits
struct  Validate
 xmlTextReader document validation. More...
class  Reader
 xmlTextReader based interface to iterate xml streams. More...
class  XmlString
 xmlChar * wrapper. More...

Namespaces

namespace  parse_def_assign
 parseDefAssign exposed details

Typedefs

typedef xmlTextReaderMode ReadState
typedef xmlReaderTypes NodeType

Functions

std::ostream & operator<< (std::ostream &str, const ReadState &obj)
std::ostream & operator<< (std::ostream &str, const NodeType &obj)
std::ostream & operator<< (std::ostream &str, const Node &obj)
template<class _Data>
void rnParse (const InputStream &input_r, _Data &data_r)
 Parse xml input_r and store data in data_r.
std::ostream & operator<< (std::ostream &str, const ParseDef::Impl &obj)
std::ostream & operator<< (std::ostream &str, ParseDef::Mode obj)
std::ostream & operator<< (std::ostream &str, const ParseDef &obj)
int ioread (void *context_r, char *buffer_r, int bufferLen_r)
int ioclose (void *)
void structuredErrorFunc (void *userData, xmlErrorPtr error)
std::string escape (const std::string &in_r)
 Escape xml special charaters (& -> &; from IoBind library).
std::string unescape (const std::string &in_r)
 Unescape xml special charaters (& -> &; from IoBind library).
std::ostream & operator<< (std::ostream &str, const XmlString &obj)

Variables

std::list< std::string > structuredErrors


Typedef Documentation

typedef xmlTextReaderMode zypp::xml::ReadState

Definition at line 30 of file libxmlfwd.h.

typedef xmlReaderTypes zypp::xml::NodeType

Definition at line 34 of file libxmlfwd.h.


Function Documentation

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
const ReadState &  obj 
)

Definition at line 29 of file libxmlfwd.cc.

References X.

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
const NodeType &  obj 
)

Definition at line 50 of file libxmlfwd.cc.

References X.

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
const Node &  obj 
) [related]

Definition at line 60 of file Node.cc.

References zypp::xml::Node::prefix(), and X.

template<class _Data>
void zypp::xml::rnParse ( const InputStream &  input_r,
_Data &  data_r 
) [inline]

Parse xml input_r and store data in data_r.

_Data must be defaultconstructible and assignable.

_Data::RootNode must be a xml::ParseDef constructible from _Data&.

Exceptions:
ParseDefException on parse errors.
To parse a xml file like this:
 <test>
   <setup attr="13">value</setup>
   <list name="A"/>
   <list name="b"/>
 </test>

You need something like this:

  struct XmlData
  {
    // data
    unsigned              attr;
    std::string           value;
    std:list<std::string> names;

    public:
      // Convenience parsing to *this.
      void parse( const Pathname & path_r )
      { xml::rnParse( path_r, *this ); }

    public:
      // Parser description
      struct RootNode : public xml::ParseDef
      {
        RootNode( XmlData & data )
          : ParseDef( "test", MANDTAORY )
          , _data( data )
        {
          (*this)
              ("setup", MANDTAORY,
                        xml::parseDefAssign( data.value )
                                           ( "attr", data.attr ) )
              // Each individual list entry is collected locally
              // and appended to the list after the node is done.
              ("list",  MULTIPLE_OPTIONAL,
                        xml::parseDefAssign( "name", _cname )
                                           >> bind( &RootNode::cdone, this, _1 ) )
              ;
        }

        void cdone( const xml::Node & node_r )
        {
          _data.push_back( _cname );
          _cname.clear(); // prepare for next
        }

        private:
          XmlData &   _data; // stored just because notification callbacks are used.
          std::string _cname;
      };
  };

  XmlData xmlData;
  xmlData.parse( "/tmp/mytest.xml" );

Definition at line 97 of file Parse.h.

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
const ParseDef::Impl &  obj 
)

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
ParseDef::Mode  obj 
) [related]

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
const ParseDef &  obj 
)

Definition at line 466 of file ParseDef.cc.

References zypp::xml::ParseDef::_pimpl.

int zypp::xml::@246::ioread ( void *  context_r,
char *  buffer_r,
int  bufferLen_r 
) [static]

Definition at line 40 of file Reader.cc.

References INT.

int zypp::xml::@246::ioclose ( void *   )  [static]

Definition at line 51 of file Reader.cc.

void zypp::xml::@246::structuredErrorFunc ( void *  userData,
xmlErrorPtr  error 
) [static]

Definition at line 56 of file Reader.cc.

References zypp::str::form(), zypp::str::stripSuffix(), WAR, and X.

Referenced by zypp::xml::Reader::Reader().

std::string zypp::xml::escape ( const std::string &  in_r  )  [inline]

std::string zypp::xml::unescape ( const std::string &  in_r  )  [inline]

Unescape xml special charaters (& -> &; from IoBind library).

Definition at line 30 of file XmlEscape.h.

std::ostream& zypp::xml::operator<< ( std::ostream &  str,
const XmlString &  obj 
) [related]

Definition at line 46 of file XmlString.cc.

References zypp::xml::XmlString::c_str().


Variable Documentation

std::list<std::string> zypp::xml::structuredErrors [static]

Definition at line 55 of file Reader.cc.


Generated on Tue May 5 14:50:00 2015 for libzypp by  doxygen 1.5.6