#include <XMLNodeIterator.h>
Inheritance diagram for zypp::parser::XMLNodeIteratorBase:

Public Member Functions | |
| XMLNodeIteratorBase (std::istream &input, const std::string &baseUrl, const char *validationPath, parser::ParserProgress::Ptr progress) | |
| Constructor. | |
| XMLNodeIteratorBase (const Pathname xml_file_path, const std::string &baseUrl, const char *validationPath, parser::ParserProgress::Ptr progress) | |
| Constructor. | |
| XMLNodeIteratorBase () | |
| Constructor for an empty iterator. | |
| virtual | ~XMLNodeIteratorBase () |
| Destructor. | |
| bool | atEnd () const |
| Have we reached the end? A parser error also means "end reached". | |
| bool | operator== (const XMLNodeIteratorBase &other) const |
| Two iterators are equal if both are at the end or if they are identical. | |
| bool | operator!= (const XMLNodeIteratorBase &otherNode) const |
| Opposit of operator==. | |
| const XMLParserError * | errorStatus () const |
| returns the error status or 0 if no error the returned pointer is not-owning, it will be deleted upon destruction of the XMLNodeIterator. | |
Protected Member Functions | |
| virtual bool | isInterested (const xmlNodePtr nodePtr)=0 |
| filter for the xml nodes The derived class decides which xml nodes it is actually interested in. | |
| virtual void | _process (const xmlTextReaderPtr readerPtr)=0 |
| process an xml node and set it as next element The derived class has to produce the ENTRYTYPE object here. | |
| void | fetchNext () |
| Fetch the next element and save it as next element. | |
| virtual void | setCurrent (const void *data)=0 |
| virtual void * | getCurrent () const =0 |
Static Protected Member Functions | |
| static void | errorHandler (void *arg, const char *msg, int severity, xmlTextReaderLocatorPtr locator) |
| Internal function to set the _error variable in case of a parser error. | |
Private Member Functions | |
| XMLNodeIteratorBase & | operator= (const XMLNodeIteratorBase &otherNode) |
| assignment is forbidden. | |
| XMLNodeIteratorBase (const XMLNodeIteratorBase &otherNode) | |
| copy constructor is forbidden. | |
Private Attributes | |
| std::auto_ptr< XMLParserError > | _error |
| if an error occured, this contains the error. | |
| std::istream * | _input |
| contains the istream to read the xml file from. | |
| FILE * | _file |
| contains the file to read the xml file from. | |
| xmlTextReaderPtr | _reader |
| contains the xmlTextReader used to parse the xml file. | |
| std::string | _baseUrl |
| contains the base URL of the xml documentation | |
| parser::ParserProgress::Ptr | _progress |
| last progress information | |
| long int | _stream_size |
| size of the stream to parse | |
| long int | _bytes_consumed |
| bytes consumed in last report | |
Derive from XMLNodeIterator<ENTRYTYPE> to get an iterator that returns ENTRYTYPE objects. A derived class must provide isInterested() and process(). It should also provide a Constructor Derived(std::stream,std::string baseUrl) which must call fetchNext().
The derived iterator class should be compatible with an stl input iterator. Use like this:
for (Iterator iter(anIstream, baseUrl), iter != Iterator.end(), // or: iter() != 0, or ! iter.atEnd() ++iter) { doSomething(*iter) }
The iterator owns the pointer (i.e., caller must not delete it) until the next ++ operator is called. At this time, it will be destroyed (and a new ENTRYTYPE is created.)
If the input is fundamentally flawed so that it makes no sense to continue parsing, XMLNodeIterator will log it and consider the input as finished. You can query the exit status with errorStatus().
Definition at line 135 of file XMLNodeIterator.h.
|
||||||||||||||||||||
|
Constructor. Derived classes must call fetchNext() here.
Definition at line 156 of file XMLNodeIterator.cc. References _reader, errorHandler(), and WAR. |
|
||||||||||||||||||||
|
Constructor. Derived classes must call fetchNext() here.
Definition at line 129 of file XMLNodeIterator.cc. References _reader, zypp::filesystem::Pathname::asString(), errorHandler(), WAR, and ZYPP_THROW. |
|
|
Constructor for an empty iterator. An empty iterator is already at its end. This is what end() returns ... Definition at line 181 of file XMLNodeIterator.cc. |
|
|
Destructor.
Definition at line 187 of file XMLNodeIterator.cc. References _reader. |
|
|
copy constructor is forbidden. Reason: We can't copy an xmlTextReader FIXME: This prevents implementing the end() method for derived classes.
|
|
|
Have we reached the end? A parser error also means "end reached".
Definition at line 195 of file XMLNodeIterator.cc. References _error, _progress, and getCurrent(). Referenced by zypp::source::yum::YUMSourceImpl::downloadMetadata(), zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >::operator *(), zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >::operator++(), zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >::operator->(), operator==(), zypp::source::yum::YUMSourceImpl::providePackages(), zypp::source::yum::YUMSourceImpl::providePatches(), zypp::source::yum::YUMSourceImpl::providePatterns(), zypp::source::yum::YUMSourceImpl::provideProducts(), zypp::source::yum::YUMSourceImpl::provideSelections(), zypp::source::yum::YUMSourceImpl::readRepomd(), and zypp::storage::XMLFilesBackend::resolvablesFromFile(). |
|
|
Two iterators are equal if both are at the end or if they are identical. Since you cannot copy an XMLNodeIterator, everything else is not equal.
Definition at line 208 of file XMLNodeIterator.cc. References atEnd(). Referenced by operator!=(). |
|
|
Opposit of operator==.
Definition at line 194 of file XMLNodeIterator.h. References operator==(). |
|
|
returns the error status or 0 if no error the returned pointer is not-owning, it will be deleted upon destruction of the XMLNodeIterator.
Definition at line 218 of file XMLNodeIterator.cc. References _error. |
|
|
|
process an xml node and set it as next element The derived class has to produce the ENTRYTYPE object here. Details about the xml reader is in the libxml2 documentation. You'll most probably want to use xmlTextReaderExpand(reader) to request the full subtree, and then use the links in the resulting node structure to traverse, and class LibXMLHelper to access the attributes and element contents. fetchNext() cannot throw an error since it will be called in the constructor. Instead, in case of a fundamental syntax error the error is saved and will be thrown with the next checkError().
Implemented in zypp::parser::XMLNodeIterator< ENTRYTYPE >, zypp::parser::XMLNodeIterator< XMLProductData_Ptr >, zypp::parser::XMLNodeIterator< XMLPatternData_Ptr >, zypp::parser::XMLNodeIterator< XMLLanguageData_Ptr >, zypp::parser::XMLNodeIterator< YUMOtherData_Ptr >, zypp::parser::XMLNodeIterator< XMLPatchData_Ptr >, zypp::parser::XMLNodeIterator< YUMGroupData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatchesData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatchData_Ptr >, zypp::parser::XMLNodeIterator< YUMPrimaryData_Ptr >, zypp::parser::XMLNodeIterator< SourceInfo_Ptr >, zypp::parser::XMLNodeIterator< YUMFileListData_Ptr >, zypp::parser::XMLNodeIterator< YUMProductData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatternData_Ptr >, and zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >. Referenced by fetchNext(). |
|
|
Fetch the next element and save it as next element.
Definition at line 224 of file XMLNodeIterator.cc. References _bytes_consumed, _error, _process(), _progress, _reader, errorHandler(), isInterested(), setCurrent(), and xml_assert. Referenced by zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >::operator++(), zypp::parser::xmlstore::XMLLanguageParser::XMLLanguageParser(), zypp::parser::xmlstore::XMLPatchParser::XMLPatchParser(), zypp::parser::xmlstore::XMLPatternParser::XMLPatternParser(), zypp::parser::xmlstore::XMLProductParser::XMLProductParser(), zypp::parser::xmlstore::XMLSourceCacheParser::XMLSourceCacheParser(), zypp::parser::yum::YUMFileListParser::YUMFileListParser(), zypp::parser::yum::YUMGroupParser::YUMGroupParser(), zypp::parser::yum::YUMOtherParser::YUMOtherParser(), zypp::parser::yum::YUMPatchesParser::YUMPatchesParser(), zypp::parser::yum::YUMPatchParser::YUMPatchParser(), zypp::parser::yum::YUMPatternParser::YUMPatternParser(), zypp::parser::yum::YUMPrimaryParser::YUMPrimaryParser(), zypp::parser::yum::YUMProductParser::YUMProductParser(), and zypp::parser::yum::YUMRepomdParser::YUMRepomdParser(). |
|
||||||||||||||||||||
|
Internal function to set the _error variable in case of a parser error. It logs the message and saves errors in _error, so that they will be thrown by checkError().
Definition at line 276 of file XMLNodeIterator.cc. References ERR, WAR, and xml_assert. Referenced by fetchNext(), and XMLNodeIteratorBase(). |
|
|
Implemented in zypp::parser::XMLNodeIterator< ENTRYTYPE >, zypp::parser::XMLNodeIterator< XMLProductData_Ptr >, zypp::parser::XMLNodeIterator< XMLPatternData_Ptr >, zypp::parser::XMLNodeIterator< XMLLanguageData_Ptr >, zypp::parser::XMLNodeIterator< YUMOtherData_Ptr >, zypp::parser::XMLNodeIterator< XMLPatchData_Ptr >, zypp::parser::XMLNodeIterator< YUMGroupData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatchesData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatchData_Ptr >, zypp::parser::XMLNodeIterator< YUMPrimaryData_Ptr >, zypp::parser::XMLNodeIterator< SourceInfo_Ptr >, zypp::parser::XMLNodeIterator< YUMFileListData_Ptr >, zypp::parser::XMLNodeIterator< YUMProductData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatternData_Ptr >, and zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >. Referenced by fetchNext(). |
|
|
Implemented in zypp::parser::XMLNodeIterator< ENTRYTYPE >, zypp::parser::XMLNodeIterator< XMLProductData_Ptr >, zypp::parser::XMLNodeIterator< XMLPatternData_Ptr >, zypp::parser::XMLNodeIterator< XMLLanguageData_Ptr >, zypp::parser::XMLNodeIterator< YUMOtherData_Ptr >, zypp::parser::XMLNodeIterator< XMLPatchData_Ptr >, zypp::parser::XMLNodeIterator< YUMGroupData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatchesData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatchData_Ptr >, zypp::parser::XMLNodeIterator< YUMPrimaryData_Ptr >, zypp::parser::XMLNodeIterator< SourceInfo_Ptr >, zypp::parser::XMLNodeIterator< YUMFileListData_Ptr >, zypp::parser::XMLNodeIterator< YUMProductData_Ptr >, zypp::parser::XMLNodeIterator< YUMPatternData_Ptr >, and zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >. Referenced by atEnd(). |
|
|
assignment is forbidden. Reason: We can't copy an xmlTextReader |
|
|
if an error occured, this contains the error.
Definition at line 286 of file XMLNodeIterator.h. Referenced by atEnd(), errorStatus(), fetchNext(), and zypp::parser::XMLNodeIterator< YUMRepomdData_Ptr >::operator()(). |
|
|
contains the istream to read the xml file from. Can be 0 if at end or if the current element is the only element left. Definition at line 292 of file XMLNodeIterator.h. |
|
|
contains the file to read the xml file from. Can be 0 if at end or if the current element is the only element left. Definition at line 298 of file XMLNodeIterator.h. |
|
|
contains the xmlTextReader used to parse the xml file.
Definition at line 304 of file XMLNodeIterator.h. Referenced by fetchNext(), XMLNodeIteratorBase(), and ~XMLNodeIteratorBase(). |
|
|
contains the base URL of the xml documentation
Definition at line 309 of file XMLNodeIterator.h. |
|
|
last progress information
Definition at line 314 of file XMLNodeIterator.h. Referenced by atEnd(), and fetchNext(). |
|
|
size of the stream to parse
Definition at line 319 of file XMLNodeIterator.h. |
|
|
bytes consumed in last report
Definition at line 323 of file XMLNodeIterator.h. Referenced by fetchNext(). |
1.4.6