fixed indentation
authorJiri Srain <jsrain@suse.cz>
Fri, 18 Nov 2005 12:18:34 +0000 (12:18 +0000)
committerJiri Srain <jsrain@suse.cz>
Fri, 18 Nov 2005 12:18:34 +0000 (12:18 +0000)
21 files changed:
zypp/parser/yum/YUMFileListParser.cc
zypp/parser/yum/YUMFileListParser.h
zypp/parser/yum/YUMGroupParser.cc
zypp/parser/yum/YUMGroupParser.h
zypp/parser/yum/YUMOtherParser.cc
zypp/parser/yum/YUMOtherParser.h
zypp/parser/yum/YUMParserData.cc
zypp/parser/yum/YUMParserData.h
zypp/parser/yum/YUMPatchParser.cc
zypp/parser/yum/YUMPatchParser.h
zypp/parser/yum/YUMPrimaryParser.cc
zypp/parser/yum/YUMPrimaryParser.h
zypp/parser/yum/YUMRepomdParser.cc
zypp/parser/yum/YUMRepomdParser.h
zypp/parser/yum/schemanames.h
zypp/source/yum/YUMMessageImpl.cc
zypp/source/yum/YUMMessageImpl.h
zypp/source/yum/YUMPackageImpl.cc
zypp/source/yum/YUMPackageImpl.h
zypp/source/yum/YUMScriptImpl.cc
zypp/source/yum/YUMScriptImpl.h

index 0e815ac..bd1cb07 100644 (file)
@@ -35,77 +35,81 @@ Purpose:    Parses file list files in a YUM repository
 
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
-
-
-YUMFileListParser::YUMFileListParser(istream &is, const string& baseUrl)
-: XMLNodeIterator<YUMFileListDataPtr>(is, baseUrl,FILELISTSCHEMA)
-{
-  fetchNext();
-}
-
-YUMFileListParser::YUMFileListParser()
-{ }
-
-YUMFileListParser::YUMFileListParser(YUMFileListDataPtr& entry)
-: XMLNodeIterator<YUMFileListDataPtr>(entry)
-{ }
-
-
-
-YUMFileListParser::~YUMFileListParser()
-{
-}
-
-
-
-
-// select for which elements process() will be called
-bool 
-YUMFileListParser::isInterested(const xmlNodePtr nodePtr)
-{
-  bool result = (_helper.isElement(nodePtr)
-                 && _helper.name(nodePtr) == "package");
-  return result;
-}
-
-
-// do the actual processing
-YUMFileListDataPtr
-YUMFileListParser::process(const xmlTextReaderPtr reader)
-{
-  assert(reader);
-  YUMFileListDataPtr dataPtr = new YUMFileListData;
-  xmlNodePtr dataNode = xmlTextReaderExpand(reader);
-  assert(dataNode);
-
-  dataPtr->pkgId = _helper.attribute(dataNode,"pkgid");
-  dataPtr->name = _helper.attribute(dataNode,"name");
-  dataPtr->arch = _helper.attribute(dataNode,"arch");
-
-  for (xmlNodePtr child = dataNode->children;
-       child != 0;
-       child = child->next) {
-         if (_helper.isElement(child)) {
-           string name = _helper.name(child);
-           if (name == "version") {
-             dataPtr->epoch = _helper.attribute(child,"epoch");
-             dataPtr->ver = _helper.attribute(child,"ver");
-             dataPtr->rel = _helper.attribute(child,"rel");
-           }
-           else if (name == "file") {
-             dataPtr->files.push_back
-               (FileData(_helper.content(child),
-                         _helper.attribute(child,"type")));
-           }
-           else {
-             WAR << "YUM <filelists> contains the unknown element <" << name << "> "
-               << _helper.positionInfo(child) << ", skipping" << endl;
-           }
-         }
-       }
-  return dataPtr;
-}
-
-
-}}}
+namespace zypp {
+  namespace parser {
+    namespace yum {
+
+
+      YUMFileListParser::YUMFileListParser(istream &is, const string& baseUrl)
+      : XMLNodeIterator<YUMFileListDataPtr>(is, baseUrl,FILELISTSCHEMA)
+      {
+        fetchNext();
+      }
+      
+      YUMFileListParser::YUMFileListParser()
+      { }
+      
+      YUMFileListParser::YUMFileListParser(YUMFileListDataPtr& entry)
+      : XMLNodeIterator<YUMFileListDataPtr>(entry)
+      { }
+      
+      
+      
+      YUMFileListParser::~YUMFileListParser()
+      {
+      }
+      
+      
+      
+      
+      // select for which elements process() will be called
+      bool 
+      YUMFileListParser::isInterested(const xmlNodePtr nodePtr)
+      {
+        bool result = (_helper.isElement(nodePtr)
+                       && _helper.name(nodePtr) == "package");
+        return result;
+      }
+      
+      
+      // do the actual processing
+      YUMFileListDataPtr
+      YUMFileListParser::process(const xmlTextReaderPtr reader)
+      {
+        assert(reader);
+        YUMFileListDataPtr dataPtr = new YUMFileListData;
+        xmlNodePtr dataNode = xmlTextReaderExpand(reader);
+        assert(dataNode);
+      
+        dataPtr->pkgId = _helper.attribute(dataNode,"pkgid");
+        dataPtr->name = _helper.attribute(dataNode,"name");
+        dataPtr->arch = _helper.attribute(dataNode,"arch");
+      
+        for (xmlNodePtr child = dataNode->children;
+             child != 0;
+             child = child->next) {
+               if (_helper.isElement(child)) {
+                 string name = _helper.name(child);
+                 if (name == "version") {
+                   dataPtr->epoch = _helper.attribute(child,"epoch");
+                   dataPtr->ver = _helper.attribute(child,"ver");
+                   dataPtr->rel = _helper.attribute(child,"rel");
+                 }
+                 else if (name == "file") {
+                   dataPtr->files.push_back
+                     (FileData(_helper.content(child),
+                               _helper.attribute(child,"type")));
+                 }
+                 else {
+                   WAR << "YUM <filelists> contains the unknown element <" << name << "> "
+                     << _helper.positionInfo(child) << ", skipping" << endl;
+                 }
+               }
+             }
+        return dataPtr;
+      }
+  
+
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
index de4f947..fe7dacd 100644 (file)
@@ -28,66 +28,70 @@ Purpose: Parses file list files in a YUM repository
 #include <LibXMLHelper.h>
 #include <list>
 
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-  /**
-  * @short Parser for YUM filelists files
-  * Use this class as an iterator that produces, one after one,
-  * YUMFileListDataPtr(s) for the XML package elements.
-  * Here's an example:
-  * 
-  * for (YUMFileListParser iter(anIstream, baseUrl),
-  *      iter != YUMFileListParser.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().
-  */
-  class YUMFileListParser : public XMLNodeIterator<YUMFileListDataPtr>
-  {
-  public:
-    /**
-     * Constructor.
-     * @param is the istream to read from
-     * @param baseUrl the base URL of the XML document. Can be left empty.
-     */
-    YUMFileListParser(std::istream &is, const std::string &baseUrl);
-    YUMFileListParser();
-    YUMFileListParser(YUMFileListDataPtr& entry);
-
-    
-    /**
-     * Destructor.
-     */
-    virtual ~YUMFileListParser();
+      /**
+      * @short Parser for YUM filelists files
+      * Use this class as an iterator that produces, one after one,
+      * YUMFileListDataPtr(s) for the XML package elements.
+      * Here's an example:
+      * 
+      * for (YUMFileListParser iter(anIstream, baseUrl),
+      *      iter != YUMFileListParser.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().
+      */
+      class YUMFileListParser : public XMLNodeIterator<YUMFileListDataPtr>
+      {
+      public:
+        /**
+         * Constructor.
+         * @param is the istream to read from
+         * @param baseUrl the base URL of the XML document. Can be left empty.
+         */
+        YUMFileListParser(std::istream &is, const std::string &baseUrl);
+        YUMFileListParser();
+        YUMFileListParser(YUMFileListDataPtr& entry);
     
-  private:
-    /**
-     * decides if the parser is interested in the node (and subtree) of an element.
-     * @param nodePtr the XML node
-     * @return true if the parser is interested.
-     */
-    virtual bool isInterested(const xmlNodePtr nodePtr);
+        
+        /**
+         * Destructor.
+         */
+        virtual ~YUMFileListParser();
+        
+      private:
+        /**
+         * decides if the parser is interested in the node (and subtree) of an element.
+         * @param nodePtr the XML node
+         * @return true if the parser is interested.
+         */
+        virtual bool isInterested(const xmlNodePtr nodePtr);
+        
+        /**
+         * creates a new object from the xml subtree
+         * @param reader 
+         * @return 
+         */
+        virtual YUMFileListDataPtr process(const xmlTextReaderPtr reader);
     
-    /**
-     * creates a new object from the xml subtree
-     * @param reader 
-     * @return 
-     */
-    virtual YUMFileListDataPtr process(const xmlTextReaderPtr reader);
-
-    /**
-     * converts the xml stuff to c++ stuff and filters the right namespaces
-     */
-    LibXMLHelper _helper;
-  };
-}}}
+        /**
+         * converts the xml stuff to c++ stuff and filters the right namespaces
+         */
+        LibXMLHelper _helper;
+      };
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 #endif
index 5870dce..32c84cd 100644 (file)
 #include <schemanames.h>
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-YUMGroupParser::YUMGroupParser()
-{ }
-
-YUMGroupParser::YUMGroupParser(YUMGroupDataPtr& entry)
-: XMLNodeIterator<YUMGroupDataPtr>(entry)
-{ }
-
-
-YUMGroupParser::~YUMGroupParser()
-{ }
-
-
-// select for which elements process() will be called
-bool 
-YUMGroupParser::isInterested(const xmlNodePtr nodePtr)
-{
-  return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "group";
-}
-
-// do the actual processing
-YUMGroupDataPtr
-YUMGroupParser::process(const xmlTextReaderPtr reader)
-{
-  assert(reader);
-  YUMGroupDataPtr dataPtr = new YUMGroupData;
-  xmlNodePtr dataNode = xmlTextReaderExpand(reader);
-  assert(dataNode);
-  
-  for (xmlNodePtr child = dataNode->children;
-       child && child != dataNode;
-       child = child->next) {
-         if (_helper.isElement(child)) {
-           string name = _helper.name(child);
-           if (name == "groupid") {
-             dataPtr->groupId = _helper.content(child);
-           }
-           else if (name == "name") {
-             dataPtr->name.push_back
-               (MultiLang(_helper.attribute(child,"lang"),
-                          _helper.content(child)));
-           }
-           else if (name == "default") {
-             dataPtr->default_ = _helper.content(child);
-           }
-           else if (name == "uservisible") {
-             dataPtr->userVisible = _helper.content(child);
-           }
-           else if (name == "description") {
-             dataPtr->description.push_back
-               (MultiLang(_helper.attribute(child,"lang"),
-                          _helper.content(child)));
-           }
-           else if (name == "grouplist") {
-             parseGrouplist(dataPtr, child);
-           }
-           else if (name == "packagelist") {
-             parsePackageList(dataPtr, child);
-           }
-           else {
-             WAR << "YUM <group> contains the unknown element <" << name << "> "
-               << _helper.positionInfo(child) << ", skipping" << endl;
-           }
-         }
-       }
-  return dataPtr;
-} /* end process */
-
-void YUMGroupParser::parseGrouplist(YUMGroupDataPtr dataPtr,
-                                          xmlNodePtr node)
-{
-  assert(dataPtr);
-  assert(node);
-  
-  for (xmlNodePtr child = node->children;
-       child != 0;
-       child = child ->next) {
-         if (_helper.isElement(child)) {
-           string name = _helper.name(child);
-           if (name == "metapkg" || name == "groupreq") {
-             dataPtr->grouplist.push_back
-               (MetaPkg(_helper.attribute(child,"type"),
-                        _helper.content(child)));
-           }
-           else {
-             WAR << "YUM <grouplist> contains the unknown element <" << name << "> "
-               << _helper.positionInfo(child) << ", skipping" << endl;
-           }
-         }
-       }
-}
-
-
-void YUMGroupParser::parsePackageList(YUMGroupDataPtr dataPtr,
-                                            xmlNodePtr node)
-{
-  assert(dataPtr);
-  assert(node);
-  
-  for (xmlNodePtr child = node->children;
-       child != 0;
-       child = child ->next) {
-         if (_helper.isElement(child)) {
-           string name = _helper.name(child);
-           if (name == "packagereq") {
-           dataPtr->packageList.push_back
-             (PackageReq(_helper.attribute(child,"type"),
-                         _helper.attribute(child,"epoch"),
-                         _helper.attribute(child,"ver"),
-                         _helper.attribute(child,"rel"),
-                         _helper.content(child)));
-           }
-           else {
-             WAR << "YUM <packagelist> contains the unknown element <" << name << "> "
-               << _helper.positionInfo(child) << ", skipping" << endl;
-           }
-         }
-       }
-}
-
-
-
-YUMGroupParser::YUMGroupParser(istream &is, const string &baseUrl)
-: XMLNodeIterator<YUMGroupDataPtr>(is, baseUrl,GROUPSCHEMA)
-{ 
-  fetchNext();
-}
-
-}}}
+      YUMGroupParser::YUMGroupParser()
+      { }
+      
+      YUMGroupParser::YUMGroupParser(YUMGroupDataPtr& entry)
+      : XMLNodeIterator<YUMGroupDataPtr>(entry)
+      { }
+      
+      
+      YUMGroupParser::~YUMGroupParser()
+      { }
+      
+      
+      // select for which elements process() will be called
+      bool 
+      YUMGroupParser::isInterested(const xmlNodePtr nodePtr)
+      {
+        return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "group";
+      }
+      
+      // do the actual processing
+      YUMGroupDataPtr
+      YUMGroupParser::process(const xmlTextReaderPtr reader)
+      {
+        assert(reader);
+        YUMGroupDataPtr dataPtr = new YUMGroupData;
+        xmlNodePtr dataNode = xmlTextReaderExpand(reader);
+        assert(dataNode);
+        
+        for (xmlNodePtr child = dataNode->children;
+             child && child != dataNode;
+             child = child->next) {
+               if (_helper.isElement(child)) {
+                 string name = _helper.name(child);
+                 if (name == "groupid") {
+                   dataPtr->groupId = _helper.content(child);
+                 }
+                 else if (name == "name") {
+                   dataPtr->name.push_back
+                     (MultiLang(_helper.attribute(child,"lang"),
+                                _helper.content(child)));
+                 }
+                 else if (name == "default") {
+                   dataPtr->default_ = _helper.content(child);
+                 }
+                 else if (name == "uservisible") {
+                   dataPtr->userVisible = _helper.content(child);
+                 }
+                 else if (name == "description") {
+                   dataPtr->description.push_back
+                     (MultiLang(_helper.attribute(child,"lang"),
+                                _helper.content(child)));
+                 }
+                 else if (name == "grouplist") {
+                   parseGrouplist(dataPtr, child);
+                 }
+                 else if (name == "packagelist") {
+                   parsePackageList(dataPtr, child);
+                 }
+                 else {
+                   WAR << "YUM <group> contains the unknown element <" << name << "> "
+                     << _helper.positionInfo(child) << ", skipping" << endl;
+                 }
+               }
+             }
+        return dataPtr;
+      } /* end process */
+      
+      void YUMGroupParser::parseGrouplist(YUMGroupDataPtr dataPtr,
+                                                xmlNodePtr node)
+      {
+        assert(dataPtr);
+        assert(node);
+        
+        for (xmlNodePtr child = node->children;
+             child != 0;
+             child = child ->next) {
+               if (_helper.isElement(child)) {
+                 string name = _helper.name(child);
+                 if (name == "metapkg" || name == "groupreq") {
+                   dataPtr->grouplist.push_back
+                     (MetaPkg(_helper.attribute(child,"type"),
+                              _helper.content(child)));
+                 }
+                 else {
+                   WAR << "YUM <grouplist> contains the unknown element <" << name << "> "
+                     << _helper.positionInfo(child) << ", skipping" << endl;
+                 }
+               }
+             }
+      }
+      
+      
+      void YUMGroupParser::parsePackageList(YUMGroupDataPtr dataPtr,
+                                                  xmlNodePtr node)
+      {
+        assert(dataPtr);
+        assert(node);
+        
+        for (xmlNodePtr child = node->children;
+             child != 0;
+             child = child ->next) {
+               if (_helper.isElement(child)) {
+                 string name = _helper.name(child);
+                 if (name == "packagereq") {
+                 dataPtr->packageList.push_back
+                   (PackageReq(_helper.attribute(child,"type"),
+                               _helper.attribute(child,"epoch"),
+                               _helper.attribute(child,"ver"),
+                               _helper.attribute(child,"rel"),
+                               _helper.content(child)));
+                 }
+                 else {
+                   WAR << "YUM <packagelist> contains the unknown element <" << name << "> "
+                     << _helper.positionInfo(child) << ", skipping" << endl;
+                 }
+               }
+             }
+      }
+      
+      
+      
+      YUMGroupParser::YUMGroupParser(istream &is, const string &baseUrl)
+      : XMLNodeIterator<YUMGroupDataPtr>(is, baseUrl,GROUPSCHEMA)
+      { 
+        fetchNext();
+      }
+      
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
index e5a457d..cc245ce 100644 (file)
@@ -8,48 +8,52 @@
 #include <LibXMLHelper.h>
 #include <list>
 
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-  /**
-  *
-  * @short Parser for YUM group files.
-  *
-  * Use this class as an iterator that produces, one after one,
-  * YUMGroupDataPtr(s) for the XML group elements.
-  * Here's an example:
-  *
-  * for (YUMGroupParser iter(anIstream, baseUrl),
-  *      iter != YUMFileListParser.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().
-  */
-  class YUMGroupParser : public XMLNodeIterator<YUMGroupDataPtr>
-  {
-  public:
-    YUMGroupParser(std::istream &is, const std::string &baseUrl);
-    YUMGroupParser();
-    YUMGroupParser(YUMGroupDataPtr& entry);
-    virtual ~YUMGroupParser();
-    
-  private:
-    virtual bool isInterested(const xmlNodePtr nodePtr);
-    virtual YUMGroupDataPtr process(const xmlTextReaderPtr reader);
-    void parseGrouplist(YUMGroupDataPtr dataPtr,
-                        xmlNodePtr node);
-    void parsePackageList(YUMGroupDataPtr dataPtr,
-                          xmlNodePtr node);
-    
-    LibXMLHelper _helper;
-  };
-}}}
+      /**
+      *
+      * @short Parser for YUM group files.
+      *
+      * Use this class as an iterator that produces, one after one,
+      * YUMGroupDataPtr(s) for the XML group elements.
+      * Here's an example:
+      *
+      * for (YUMGroupParser iter(anIstream, baseUrl),
+      *      iter != YUMFileListParser.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().
+      */
+      class YUMGroupParser : public XMLNodeIterator<YUMGroupDataPtr>
+      {
+      public:
+        YUMGroupParser(std::istream &is, const std::string &baseUrl);
+        YUMGroupParser();
+        YUMGroupParser(YUMGroupDataPtr& entry);
+        virtual ~YUMGroupParser();
+        
+      private:
+        virtual bool isInterested(const xmlNodePtr nodePtr);
+        virtual YUMGroupDataPtr process(const xmlTextReaderPtr reader);
+        void parseGrouplist(YUMGroupDataPtr dataPtr,
+                            xmlNodePtr node);
+        void parsePackageList(YUMGroupDataPtr dataPtr,
+                              xmlNodePtr node);
+        
+        LibXMLHelper _helper;
+      };
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 #endif
index d69e727..d4a6f6f 100644 (file)
@@ -32,77 +32,81 @@ Purpose:    Parses other.xml files in a YUM repository
 #include <schemanames.h>
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
-
-
-YUMOtherParser::YUMOtherParser(istream &is, const string& baseUrl)
-: XMLNodeIterator<YUMOtherDataPtr>(is, baseUrl,OTHERSCHEMA)
-{
-  fetchNext();
-}
-
-YUMOtherParser::YUMOtherParser()
-{ }
-
-YUMOtherParser::YUMOtherParser(YUMOtherDataPtr& entry)
-: XMLNodeIterator<YUMOtherDataPtr>(entry)
-{ }
-
-
-
-YUMOtherParser::~YUMOtherParser()
-{
-}
-
-
-
-
-// select for which elements process() will be called
-bool 
-YUMOtherParser::isInterested(const xmlNodePtr nodePtr)
-{
-  bool result = (_helper.isElement(nodePtr)
-                 && _helper.name(nodePtr) == "package");
-  return result;
-}
-
-
-// do the actual processing
-YUMOtherDataPtr
-YUMOtherParser::process(const xmlTextReaderPtr reader)
-{
-  assert(reader);
-  YUMOtherDataPtr dataPtr = new YUMOtherData;
-  xmlNodePtr dataNode = xmlTextReaderExpand(reader);
-  assert(dataNode);
-
-  dataPtr->pkgId = _helper.attribute(dataNode,"pkgid");
-  dataPtr->name = _helper.attribute(dataNode,"name");
-  dataPtr->arch = _helper.attribute(dataNode,"arch");
-
-  for (xmlNodePtr child = dataNode->children;
-       child != 0;
-       child = child->next) {
-         if (_helper.isElement(child)) {
-           string name = _helper.name(child);
-           if (name == "version") {
-             dataPtr->epoch = _helper.attribute(child,"epoch");
-             dataPtr->ver = _helper.attribute(child,"ver");
-             dataPtr->rel = _helper.attribute(child,"rel");
-           }
-           else if (name == "file") {
-             dataPtr->changelog.push_back
-               (ChangelogEntry(_helper.attribute(child,"author"),
-                               _helper.attribute(child,"date"),
-                               _helper.content(child)));
-           }
-           else {
-             WAR << "YUM <otherdata> contains the unknown element <" << name << "> "
-               << _helper.positionInfo(child) << ", skipping" << endl;
-           }
-         }
-       }
-  return dataPtr;
-}
-
-}}}
+namespace zypp {
+  namespace parser {
+    namespace yum {
+
+
+      YUMOtherParser::YUMOtherParser(istream &is, const string& baseUrl)
+      : XMLNodeIterator<YUMOtherDataPtr>(is, baseUrl,OTHERSCHEMA)
+      {
+        fetchNext();
+      }
+      
+      YUMOtherParser::YUMOtherParser()
+      { }
+      
+      YUMOtherParser::YUMOtherParser(YUMOtherDataPtr& entry)
+      : XMLNodeIterator<YUMOtherDataPtr>(entry)
+      { }
+      
+      
+      
+      YUMOtherParser::~YUMOtherParser()
+      {
+      }
+      
+      
+      
+      
+      // select for which elements process() will be called
+      bool 
+      YUMOtherParser::isInterested(const xmlNodePtr nodePtr)
+      {
+        bool result = (_helper.isElement(nodePtr)
+                       && _helper.name(nodePtr) == "package");
+        return result;
+      }
+      
+      
+      // do the actual processing
+      YUMOtherDataPtr
+      YUMOtherParser::process(const xmlTextReaderPtr reader)
+      {
+        assert(reader);
+        YUMOtherDataPtr dataPtr = new YUMOtherData;
+        xmlNodePtr dataNode = xmlTextReaderExpand(reader);
+        assert(dataNode);
+      
+        dataPtr->pkgId = _helper.attribute(dataNode,"pkgid");
+        dataPtr->name = _helper.attribute(dataNode,"name");
+        dataPtr->arch = _helper.attribute(dataNode,"arch");
+      
+        for (xmlNodePtr child = dataNode->children;
+             child != 0;
+             child = child->next) {
+               if (_helper.isElement(child)) {
+                 string name = _helper.name(child);
+                 if (name == "version") {
+                   dataPtr->epoch = _helper.attribute(child,"epoch");
+                   dataPtr->ver = _helper.attribute(child,"ver");
+                   dataPtr->rel = _helper.attribute(child,"rel");
+                 }
+                 else if (name == "file") {
+                   dataPtr->changelog.push_back
+                     (ChangelogEntry(_helper.attribute(child,"author"),
+                                     _helper.attribute(child,"date"),
+                                     _helper.content(child)));
+                 }
+                 else {
+                   WAR << "YUM <otherdata> contains the unknown element <" << name << "> "
+                     << _helper.positionInfo(child) << ", skipping" << endl;
+                 }
+               }
+             }
+        return dataPtr;
+      }
+      
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
index 00536b4..3eef7d3 100644 (file)
@@ -28,66 +28,70 @@ Purpose:    Parses other.xml files in a YUM repository
 #include <LibXMLHelper.h>
 #include <list>
 
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-  /**
-  * @short Parser for YUM other.xml files
-  * Use this class as an iterator that produces, one after one,
-  * YUMOtherDataPtr(s) for the XML package elements.
-  * Here's an example:
-  * 
-  * for (YUMOtherParser iter(anIstream, baseUrl),
-  *      iter != YUMOtherParser.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().
-  */
-  class YUMOtherParser : public XMLNodeIterator<YUMOtherDataPtr>
-  {
-  public:
-    /**
-     * Constructor.
-     * @param is the istream to read from
-     * @param baseUrl the base URL of the XML document. Can be left empty.
-     */
-    YUMOtherParser(std::istream &is, const std::string &baseUrl);
-
-    YUMOtherParser();
-    YUMOtherParser(YUMOtherDataPtr& entry);
-    
-    /**
-     * Destructor.
-     */
-    virtual ~YUMOtherParser();
+      /**
+      * @short Parser for YUM other.xml files
+      * Use this class as an iterator that produces, one after one,
+      * YUMOtherDataPtr(s) for the XML package elements.
+      * Here's an example:
+      * 
+      * for (YUMOtherParser iter(anIstream, baseUrl),
+      *      iter != YUMOtherParser.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().
+      */
+      class YUMOtherParser : public XMLNodeIterator<YUMOtherDataPtr>
+      {
+      public:
+        /**
+         * Constructor.
+         * @param is the istream to read from
+         * @param baseUrl the base URL of the XML document. Can be left empty.
+         */
+        YUMOtherParser(std::istream &is, const std::string &baseUrl);
     
-  private:
-    /**
-     * decides if the parser is interested in the node (and subtree) of an element.
-     * @param nodePtr the XML node
-     * @return true if the parser is interested.
-     */
-    virtual bool isInterested(const xmlNodePtr nodePtr);
+        YUMOtherParser();
+        YUMOtherParser(YUMOtherDataPtr& entry);
+        
+        /**
+         * Destructor.
+         */
+        virtual ~YUMOtherParser();
+        
+      private:
+        /**
+         * decides if the parser is interested in the node (and subtree) of an element.
+         * @param nodePtr the XML node
+         * @return true if the parser is interested.
+         */
+        virtual bool isInterested(const xmlNodePtr nodePtr);
+        
+        /**
+         * creates a new object from the xml subtree
+         * @param reader 
+         * @return 
+         */
+        virtual YUMOtherDataPtr process(const xmlTextReaderPtr reader);
     
-    /**
-     * creates a new object from the xml subtree
-     * @param reader 
-     * @return 
-     */
-    virtual YUMOtherDataPtr process(const xmlTextReaderPtr reader);
-
-    /**
-     * converts the xml stuff to c++ stuff and filters the right namespaces
-     */
-    LibXMLHelper _helper;
-  };
-}}}
+        /**
+         * converts the xml stuff to c++ stuff and filters the right namespaces
+         */
+        LibXMLHelper _helper;
+      };
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 #endif
index 194fdf9..21bc196 100644 (file)
@@ -24,159 +24,163 @@ Purpose:    Boring constructors of YUM repository data structures
 #include <YUMParserData.h>
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
-
-YUMDependency::YUMDependency()
-{ }
-
-YUMDependency::YUMDependency(const std::string& name,
-                             const std::string& flags,
+namespace zypp {
+  namespace parser {
+    namespace yum {
+
+      YUMDependency::YUMDependency()
+      { }
+      
+      YUMDependency::YUMDependency(const std::string& name,
+                                   const std::string& flags,
+                                   const std::string& epoch,
+                                   const std::string& ver,
+                                   const std::string& rel,
+                                   const std::string& pre)
+      : name(name),
+      flags(flags),
+      epoch(epoch),
+      ver(ver),
+      rel(rel),
+      pre(pre)
+      { };
+      
+      YUMDirSize::YUMDirSize()
+      { }
+      
+      YUMDirSize::YUMDirSize(const std::string& path,
+                             const std::string& sizeKByte,
+                             const std::string& fileCount)
+      : path(path), sizeKByte(sizeKByte), fileCount(fileCount)
+      { }
+      
+      YUMRepomdData::YUMRepomdData()
+      { }
+      
+      YUMPrimaryData::YUMPrimaryData()
+      { }
+      
+      FileData::FileData()
+      { }
+      
+      YUMPatchData::YUMPatchData()
+      { }
+      
+      FileData::FileData(const std::string &name,
+                         const std::string &type)
+      : name(name), type(type)
+      { }
+      
+      
+      YUMGroupData::YUMGroupData()
+      { }
+      
+      MultiLang::MultiLang()
+      { }
+      
+      MultiLang::MultiLang(const std::string& language,
+                           const std::string& text)
+      : language(language), text(text)
+      { }
+      
+      
+      MetaPkg::MetaPkg()
+      { }
+      
+      MetaPkg::MetaPkg(const std::string& type,
+                       const std::string& name)
+      : type(type), name(name)
+      { }
+      
+      PackageReq::PackageReq()
+      { }
+      
+      PackageReq::PackageReq(const std::string& type,
                              const std::string& epoch,
                              const std::string& ver,
                              const std::string& rel,
-                             const std::string& pre)
-: name(name),
-flags(flags),
-epoch(epoch),
-ver(ver),
-rel(rel),
-pre(pre)
-{ };
-
-YUMDirSize::YUMDirSize()
-{ }
-
-YUMDirSize::YUMDirSize(const std::string& path,
-                       const std::string& sizeKByte,
-                       const std::string& fileCount)
-: path(path), sizeKByte(sizeKByte), fileCount(fileCount)
-{ }
-
-YUMRepomdData::YUMRepomdData()
-{ }
-
-YUMPrimaryData::YUMPrimaryData()
-{ }
-
-FileData::FileData()
-{ }
-
-YUMPatchData::YUMPatchData()
-{ }
-
-FileData::FileData(const std::string &name,
-                   const std::string &type)
-: name(name), type(type)
-{ }
-
-
-YUMGroupData::YUMGroupData()
-{ }
-
-MultiLang::MultiLang()
-{ }
-
-MultiLang::MultiLang(const std::string& language,
-                     const std::string& text)
-: language(language), text(text)
-{ }
-
-
-MetaPkg::MetaPkg()
-{ }
-
-MetaPkg::MetaPkg(const std::string& type,
-                 const std::string& name)
-: type(type), name(name)
-{ }
-
-PackageReq::PackageReq()
-{ }
-
-PackageReq::PackageReq(const std::string& type,
-                       const std::string& epoch,
-                       const std::string& ver,
-                       const std::string& rel,
-                       const std::string& name)
-: type(type), epoch(epoch), ver(ver), rel(rel), name(name)
-{ }
-
-ChangelogEntry::ChangelogEntry()
-{ }
-
-ChangelogEntry::ChangelogEntry(const std::string& author,
-                               const std::string& date,
-                               const std::string& entry)
-: author(author), date(date), entry(entry)
-{ }
-
-                
-YUMFileListData::YUMFileListData()
-{ }
-
-YUMOtherData::YUMOtherData()
-{ }
-
-
-/* Define pointer classes */
-
-IMPL_PTR_TYPE(YUMRepomdData);
-IMPL_PTR_TYPE(YUMPrimaryData);
-IMPL_PTR_TYPE(YUMGroupData);
-IMPL_PTR_TYPE(YUMFileListData);
-IMPL_PTR_TYPE(YUMOtherData);
-IMPL_PTR_TYPE(YUMPatchData);
-IMPL_PTR_TYPE(YUMPatchPackage);
-IMPL_PTR_TYPE(YUMPatchScript);
-IMPL_PTR_TYPE(YUMPatchMessage);
-
-/* output operators */
-
-namespace {
-  /**
-   * @short Generic stream output for lists of Ptrs
-   * @param out the ostream where the output goes to
-   * @param aList the list to output
-   * @return is out
-   */
-  template<class T>
-  ostream& operator<<(ostream &out, const list<T>& aList)
-  {
-    typedef typename list<T>::const_iterator IterType;
-    for (IterType iter = aList.begin();
-        iter != aList.end();
-        ++iter) {
-          if (iter != aList.begin())
-            out << endl;
-          ::operator<<(out,*iter);
+                             const std::string& name)
+      : type(type), epoch(epoch), ver(ver), rel(rel), name(name)
+      { }
+      
+      ChangelogEntry::ChangelogEntry()
+      { }
+      
+      ChangelogEntry::ChangelogEntry(const std::string& author,
+                                     const std::string& date,
+                                     const std::string& entry)
+      : author(author), date(date), entry(entry)
+      { }
+      
+                      
+      YUMFileListData::YUMFileListData()
+      { }
+      
+      YUMOtherData::YUMOtherData()
+      { }
+      
+      
+      /* Define pointer classes */
+      
+      IMPL_PTR_TYPE(YUMRepomdData);
+      IMPL_PTR_TYPE(YUMPrimaryData);
+      IMPL_PTR_TYPE(YUMGroupData);
+      IMPL_PTR_TYPE(YUMFileListData);
+      IMPL_PTR_TYPE(YUMOtherData);
+      IMPL_PTR_TYPE(YUMPatchData);
+      IMPL_PTR_TYPE(YUMPatchPackage);
+      IMPL_PTR_TYPE(YUMPatchScript);
+      IMPL_PTR_TYPE(YUMPatchMessage);
+      
+      /* output operators */
+      
+      namespace {
+        /**
+         * @short Generic stream output for lists of Ptrs
+         * @param out the ostream where the output goes to
+         * @param aList the list to output
+         * @return is out
+         */
+        template<class T>
+        ostream& operator<<(ostream &out, const list<T>& aList)
+        {
+          typedef typename list<T>::const_iterator IterType;
+          for (IterType iter = aList.begin();
+              iter != aList.end();
+              ++iter) {
+                if (iter != aList.begin())
+                  out << endl;
+                ::operator<<(out,*iter);
+              }
+          return out;
         }
-    return out;
-  }
-}
-
-  /**
-   * Join a list of strings into a single string
-   * @param aList the list of strings
-   * @param joiner what to put between the list elements
-   * @return the joined string
-   */
-  string join(const list<string>& aList,
-              const string& joiner)
-  {
-    string res;
-    for (list<string>::const_iterator iter = aList.begin();
-        iter != aList.end();
-        ++ iter) {
-          if (iter != aList.begin())
-            res += joiner;
-          res += *iter;
-        }
-    return res;
-  }
-
-}}} // namespaces
-
-using namespace zypp::parser::YUM;
+      }
+      
+      /**
+       * Join a list of strings into a single string
+       * @param aList the list of strings
+       * @param joiner what to put between the list elements
+       * @return the joined string
+       */
+      string join(const list<string>& aList,
+                  const string& joiner)
+      {
+        string res;
+        for (list<string>::const_iterator iter = aList.begin();
+            iter != aList.end();
+            ++ iter) {
+              if (iter != aList.begin())
+                res += joiner;
+              res += *iter;
+            }
+        return res;
+      }
+
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
+
+using namespace zypp::parser::yum;
   
 ostream& operator<<(ostream &out, const YUMDependency& data)
 {
index 07e225b..1e1a1aa 100644 (file)
@@ -31,414 +31,418 @@ Purpose: Declares the various YUMData classes, which are rather dumb
 #include <list>
 #include <iostream>
 
-namespace zypp { namespace parser { namespace YUM {
-
-  DEFINE_PTR_TYPE( YUMRepomdData );
-  DEFINE_PTR_TYPE( YUMPrimaryData );
-  DEFINE_PTR_TYPE( YUMGroupData );
-  DEFINE_PTR_TYPE( YUMFileListData );
-  DEFINE_PTR_TYPE( YUMOtherData );
-  DEFINE_PTR_TYPE( YUMPatchData );
-  DEFINE_PTR_TYPE( YUMPatchPackage );
-  DEFINE_PTR_TYPE( YUMPatchScript );
-  DEFINE_PTR_TYPE( YUMPatchMessage );
-
-  /**
-  * @short Holds dependency data
-  */
-  class YUMDependency {
-  public:
-    YUMDependency();
-    YUMDependency(const std::string& name,
-                  const std::string& flags,
+namespace zypp {
+  namespace parser {
+    namespace yum {
+
+      DEFINE_PTR_TYPE( YUMRepomdData );
+      DEFINE_PTR_TYPE( YUMPrimaryData );
+      DEFINE_PTR_TYPE( YUMGroupData );
+      DEFINE_PTR_TYPE( YUMFileListData );
+      DEFINE_PTR_TYPE( YUMOtherData );
+      DEFINE_PTR_TYPE( YUMPatchData );
+      DEFINE_PTR_TYPE( YUMPatchPackage );
+      DEFINE_PTR_TYPE( YUMPatchScript );
+      DEFINE_PTR_TYPE( YUMPatchMessage );
+    
+      /**
+      * @short Holds dependency data
+      */
+      class YUMDependency {
+      public:
+        YUMDependency();
+        YUMDependency(const std::string& name,
+                      const std::string& flags,
+                      const std::string& epoch,
+                      const std::string& ver,
+                      const std::string& rel,
+                      const std::string& pre);
+        std::string name;
+        std::string flags;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::string pre;
+      };
+    
+    
+      /**
+      * @short Holds data about how much space will be needed per directory
+      **/
+      class YUMDirSize {
+      public:
+        YUMDirSize();
+        YUMDirSize(const std::string& path,
+                  const std::string& size,
+                  const std::string& fileCount);
+        const std::string path;
+        const std::string sizeKByte;
+        const std::string fileCount;
+      };
+    
+      /**
+       * @short Holds Data about file and file type
+       *  (directory, plain) within other YUM data
+       **/
+      class FileData {
+      public:
+        std::string name;
+        std::string type;
+        FileData();
+        FileData(const std::string &name,
+                 const std::string &type);
+      };
+    
+      /**
+       * @short A Multi-language text
+       * (usually you have a list<MultiLang>)
+       **/
+      class MultiLang {
+      public:
+        MultiLang();
+        MultiLang(const std::string& langugage,
+                  const std::string& text);
+        std::string language;
+        std::string text;
+      };
+    
+      /**
+       * @short Defines "meta packages" that are in YUMGroupData
+       * FIXME: I'm not certain what this is ;-)
+       **/
+      class MetaPkg {
+      public:
+        MetaPkg();
+        MetaPkg(const std::string& type,
+                const std::string& name);
+        std::string type;
+        std::string name;
+      };
+    
+      /**
+       * @short A Package reference, e.g. within YUMGroupData
+       * this is without architecture.
+       **/
+      class PackageReq {
+      public:
+        PackageReq();
+        PackageReq(const std::string& type,
                   const std::string& epoch,
                   const std::string& ver,
                   const std::string& rel,
-                  const std::string& pre);
-    std::string name;
-    std::string flags;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::string pre;
-  };
-
-
-  /**
-  * @short Holds data about how much space will be needed per directory
-  **/
-  class YUMDirSize {
-  public:
-    YUMDirSize();
-    YUMDirSize(const std::string& path,
-              const std::string& size,
-              const std::string& fileCount);
-    const std::string path;
-    const std::string sizeKByte;
-    const std::string fileCount;
-  };
-
-  /**
-   * @short Holds Data about file and file type
-   *  (directory, plain) within other YUM data
-   **/
-  class FileData {
-  public:
-    std::string name;
-    std::string type;
-    FileData();
-    FileData(const std::string &name,
-             const std::string &type);
-  };
-
-  /**
-   * @short A Multi-language text
-   * (usually you have a list<MultiLang>)
-   **/
-  class MultiLang {
-  public:
-    MultiLang();
-    MultiLang(const std::string& langugage,
-              const std::string& text);
-    std::string language;
-    std::string text;
-  };
-
-  /**
-   * @short Defines "meta packages" that are in YUMGroupData
-   * FIXME: I'm not certain what this is ;-)
-   **/
-  class MetaPkg {
-  public:
-    MetaPkg();
-    MetaPkg(const std::string& type,
-            const std::string& name);
-    std::string type;
-    std::string name;
-  };
-
-  /**
-   * @short A Package reference, e.g. within YUMGroupData
-   * this is without architecture.
-   **/
-  class PackageReq {
-  public:
-    PackageReq();
-    PackageReq(const std::string& type,
-              const std::string& epoch,
-              const std::string& ver,
-              const std::string& rel,
-              const std::string& name);
-    std::string type;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::string name;
-  };
-
-  /**
-  * @short A single changelog entry
-  **/
-  class ChangelogEntry {
-  public:
-    ChangelogEntry();
-    ChangelogEntry(const std::string& author,
-                  const std::string& date,
-                  const std::string& entry);
-    std::string author;
-    std::string date;
-    std::string entry;
-  };
-
-  class YUMBaseVersion {
-  public:
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::string md5sum;
-    std::string buildtime;
-    std::string source_info;
-  };
-
-  class YUMPatchPackage : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMPatchPackage() {};
-    // data for primary
-    std::string type;
-    std::string name;
-    std::string arch;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::string checksumType;
-    std::string checksumPkgid;
-    std::string checksum;
-    std::string summary;
-    std::string description;
-    std::string packager;
-    std::string url;
-    std::string timeFile;
-    std::string timeBuild;
-    std::string sizePackage;
-    std::string sizeInstalled;
-    std::string sizeArchive;
-    std::string location;
-    std::string license;
-    std::string vendor;
-    std::string group;
-    std::string buildhost;
-    std::string sourcerpm;
-    std::string headerStart;
-    std::string headerEnd;
-    std::list<YUMDependency> provides;
-    std::list<YUMDependency> conflicts;
-    std::list<YUMDependency> obsoletes;
-    std::list<YUMDependency> requires;
-    std::list<FileData> files;
-    // SuSE specific data
-    std::list<std::string> authors;
-    std::list<std::string> keywords;
-    std::string  media;
-    std::list<YUMDirSize> dirSizes;
-    std::list<YUMDependency> freshen;
-    bool installOnly;
-    // Change Log
-    std::list<ChangelogEntry> changelog;
-    // Package Files
-    struct {
-      std::string arch;
-      std::string filename;
-      std::string downloadsize;
-      std::string md5sum;
-      std::string buildtime;
-    } plainRpm;
-    struct {
-      std::string arch;
-      std::string filename;
-      std::string downloadsize;
-      std::string md5sum;
-      std::string buildtime;
-      std::list<YUMBaseVersion> baseVersions;
-    } patchRpm;
-    struct {
-      std::string arch;
-      std::string filename;
-      std::string downloadsize;
-      std::string md5sum;
-      std::string buildtime;
-      YUMBaseVersion baseVersion;
-    } deltaRpm;
-  };
-
-  class YUMPatchScript : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMPatchScript() {};
-    std::string name;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::string do_script;
-    std::string undo_script;
-    std::list<YUMDependency> provides;
-    std::list<YUMDependency> conflicts;
-    std::list<YUMDependency> obsoletes;
-    std::list<YUMDependency> freshen;
-    std::list<YUMDependency> requires;
-  };
-
-  class YUMPatchMessage : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMPatchMessage() {};
-    std::string name;
-    std::string type;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::list<YUMDependency> provides;
-    std::list<YUMDependency> conflicts;
-    std::list<YUMDependency> obsoletes;
-    std::list<YUMDependency> freshen;
-    std::list<YUMDependency> requires;
-    std::string text;
-  };
-
-  class YUMPatchAtom {
-  public:
-    std::string type;
-    // union not possibel due to constructors
-    // there is no common parent
-    YUMPatchPackagePtr package;
-    YUMPatchScriptPtr script;
-    YUMPatchMessagePtr message;
-  };
-
-  /**
-   * @short Holds the metadata about a YUM repository
-   **/
-  class YUMRepomdData : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMRepomdData();
-    std::string type;
-    std::string location;
-    std::string checksumType;
-    std::string checksum;
-    std::string timestamp;
-    std::string openChecksumType;
-    std::string openChecksum;
-  };
-
-  /**
-   * @short Describes a package in a YUM repository
-   **/
-  class YUMPrimaryData : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMPrimaryData();
-    std::string type;
-    std::string name;
-    std::string arch;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::string checksumType;
-    std::string checksumPkgid;
-    std::string checksum;
-    std::string summary;
-    std::string description;
-    std::string packager;
-    std::string url;
-    std::string timeFile;
-    std::string timeBuild;
-    std::string sizePackage;
-    std::string sizeInstalled;
-    std::string sizeArchive;
-    std::string location;
-    std::string license;
-    std::string vendor;
-    std::string group;
-    std::string buildhost;
-    std::string sourcerpm;
-    std::string headerStart;
-    std::string headerEnd;
-    std::list<YUMDependency> provides;
-    std::list<YUMDependency> conflicts;
-    std::list<YUMDependency> obsoletes;
-    std::list<YUMDependency> requires;
-    std::list<FileData> files;
-
-    // SuSE specific data
-    std::list<std::string> authors;
-    std::list<std::string> keywords;
-    std::string  media;
-    std::list<YUMDirSize> dirSizes;
-    std::list<YUMDependency> freshen;
-    bool installOnly;
-  };
-
-  /**
-  * @short Describes the groups in a YUM repository
-  **/
-
-  class YUMGroupData : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-
-    YUMGroupData();
-    std::string groupId;
-    std::list<MultiLang> name;
-    std::string default_;
-    std::string userVisible;
-    std::list<MultiLang> description;
-    std::list<MetaPkg> grouplist;
-    std::list<PackageReq> packageList;
-  };
-
-  /**
-   * @short Contains the file list for a YUM package.
-   **/
-  class YUMFileListData : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-
-    YUMFileListData();
-
-    std::string pkgId;
-    std::string name;
-    std::string arch;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::list<FileData> files;
-  };
-
-  /**
-  * @short Data from other.mxl, i.e., changelogs
-  **/
-  class YUMOtherData : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMOtherData();
-    std::string pkgId;
-    std::string name;
-    std::string arch;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::list<ChangelogEntry> changelog;
-  };
-
-/* ** YUMPatchData not yet finalized **/
-
-  class YUMPatchData : public base::ReferenceCounted, private base::NonCopyable {
-  public:
-    YUMPatchData();
-    ~YUMPatchData() {
-
-    }
-
-    std::string patchId;
-    std::string timestamp;
-    std::string engine;
-    std::string name;
-    MultiLang summary;
-    MultiLang description;
-    std::string epoch;
-    std::string ver;
-    std::string rel;
-    std::list<YUMDependency> provides;
-    std::list<YUMDependency> conflicts;
-    std::list<YUMDependency> obsoletes;
-    std::list<YUMDependency> freshen;
-    std::list<YUMDependency> requires;
-    std::string category;
-    bool rebootNeeded;
-    bool packageManager;
-    std::string updateScript;
-    // FIXME this copying of structures is inefective
-    std::list<YUMPatchAtom> atoms;
-  };
-
-
-}}} /* end of namespace YUM */
+                  const std::string& name);
+        std::string type;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::string name;
+      };
+    
+      /**
+      * @short A single changelog entry
+      **/
+      class ChangelogEntry {
+      public:
+        ChangelogEntry();
+        ChangelogEntry(const std::string& author,
+                      const std::string& date,
+                      const std::string& entry);
+        std::string author;
+        std::string date;
+        std::string entry;
+      };
+    
+      class YUMBaseVersion {
+      public:
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::string md5sum;
+        std::string buildtime;
+        std::string source_info;
+      };
+    
+      class YUMPatchPackage : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMPatchPackage() {};
+        // data for primary
+        std::string type;
+        std::string name;
+        std::string arch;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::string checksumType;
+        std::string checksumPkgid;
+        std::string checksum;
+        std::string summary;
+        std::string description;
+        std::string packager;
+        std::string url;
+        std::string timeFile;
+        std::string timeBuild;
+        std::string sizePackage;
+        std::string sizeInstalled;
+        std::string sizeArchive;
+        std::string location;
+        std::string license;
+        std::string vendor;
+        std::string group;
+        std::string buildhost;
+        std::string sourcerpm;
+        std::string headerStart;
+        std::string headerEnd;
+        std::list<YUMDependency> provides;
+        std::list<YUMDependency> conflicts;
+        std::list<YUMDependency> obsoletes;
+        std::list<YUMDependency> requires;
+        std::list<FileData> files;
+        // SuSE specific data
+        std::list<std::string> authors;
+        std::list<std::string> keywords;
+        std::string  media;
+        std::list<YUMDirSize> dirSizes;
+        std::list<YUMDependency> freshen;
+        bool installOnly;
+        // Change Log
+        std::list<ChangelogEntry> changelog;
+        // Package Files
+        struct {
+          std::string arch;
+          std::string filename;
+          std::string downloadsize;
+          std::string md5sum;
+          std::string buildtime;
+        } plainRpm;
+        struct {
+          std::string arch;
+          std::string filename;
+          std::string downloadsize;
+          std::string md5sum;
+          std::string buildtime;
+          std::list<YUMBaseVersion> baseVersions;
+        } patchRpm;
+        struct {
+          std::string arch;
+          std::string filename;
+          std::string downloadsize;
+          std::string md5sum;
+          std::string buildtime;
+          YUMBaseVersion baseVersion;
+        } deltaRpm;
+      };
+    
+      class YUMPatchScript : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMPatchScript() {};
+        std::string name;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::string do_script;
+        std::string undo_script;
+        std::list<YUMDependency> provides;
+        std::list<YUMDependency> conflicts;
+        std::list<YUMDependency> obsoletes;
+        std::list<YUMDependency> freshen;
+        std::list<YUMDependency> requires;
+      };
+    
+      class YUMPatchMessage : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMPatchMessage() {};
+        std::string name;
+        std::string type;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::list<YUMDependency> provides;
+        std::list<YUMDependency> conflicts;
+        std::list<YUMDependency> obsoletes;
+        std::list<YUMDependency> freshen;
+        std::list<YUMDependency> requires;
+        std::string text;
+      };
+    
+      class YUMPatchAtom {
+      public:
+        std::string type;
+        // union not possibel due to constructors
+        // there is no common parent
+        YUMPatchPackagePtr package;
+        YUMPatchScriptPtr script;
+        YUMPatchMessagePtr message;
+      };
+    
+      /**
+       * @short Holds the metadata about a YUM repository
+       **/
+      class YUMRepomdData : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMRepomdData();
+        std::string type;
+        std::string location;
+        std::string checksumType;
+        std::string checksum;
+        std::string timestamp;
+        std::string openChecksumType;
+        std::string openChecksum;
+      };
+    
+      /**
+       * @short Describes a package in a YUM repository
+       **/
+      class YUMPrimaryData : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMPrimaryData();
+        std::string type;
+        std::string name;
+        std::string arch;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::string checksumType;
+        std::string checksumPkgid;
+        std::string checksum;
+        std::string summary;
+        std::string description;
+        std::string packager;
+        std::string url;
+        std::string timeFile;
+        std::string timeBuild;
+        std::string sizePackage;
+        std::string sizeInstalled;
+        std::string sizeArchive;
+        std::string location;
+        std::string license;
+        std::string vendor;
+        std::string group;
+        std::string buildhost;
+        std::string sourcerpm;
+        std::string headerStart;
+        std::string headerEnd;
+        std::list<YUMDependency> provides;
+        std::list<YUMDependency> conflicts;
+        std::list<YUMDependency> obsoletes;
+        std::list<YUMDependency> requires;
+        std::list<FileData> files;
+    
+        // SuSE specific data
+        std::list<std::string> authors;
+        std::list<std::string> keywords;
+        std::string  media;
+        std::list<YUMDirSize> dirSizes;
+        std::list<YUMDependency> freshen;
+        bool installOnly;
+      };
+    
+      /**
+      * @short Describes the groups in a YUM repository
+      **/
+    
+      class YUMGroupData : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+    
+        YUMGroupData();
+        std::string groupId;
+        std::list<MultiLang> name;
+        std::string default_;
+        std::string userVisible;
+        std::list<MultiLang> description;
+        std::list<MetaPkg> grouplist;
+        std::list<PackageReq> packageList;
+      };
+    
+      /**
+       * @short Contains the file list for a YUM package.
+       **/
+      class YUMFileListData : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+    
+        YUMFileListData();
+    
+        std::string pkgId;
+        std::string name;
+        std::string arch;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::list<FileData> files;
+      };
+    
+      /**
+      * @short Data from other.mxl, i.e., changelogs
+      **/
+      class YUMOtherData : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMOtherData();
+        std::string pkgId;
+        std::string name;
+        std::string arch;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::list<ChangelogEntry> changelog;
+      };
+    
+    /* ** YUMPatchData not yet finalized **/
+    
+      class YUMPatchData : public base::ReferenceCounted, private base::NonCopyable {
+      public:
+        YUMPatchData();
+        ~YUMPatchData() {
+    
+        }
+    
+        std::string patchId;
+        std::string timestamp;
+        std::string engine;
+        std::string name;
+        MultiLang summary;
+        MultiLang description;
+        std::string epoch;
+        std::string ver;
+        std::string rel;
+        std::list<YUMDependency> provides;
+        std::list<YUMDependency> conflicts;
+        std::list<YUMDependency> obsoletes;
+        std::list<YUMDependency> freshen;
+        std::list<YUMDependency> requires;
+        std::string category;
+        bool rebootNeeded;
+        bool packageManager;
+        std::string updateScript;
+        // FIXME this copying of structures is inefective
+        std::list<YUMPatchAtom> atoms;
+      };
+
+
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 
   /* Easy output */
 
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMDependency& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMDirSize& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMRepomdData& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::FileData& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::MultiLang& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::MetaPkg& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::PackageReq& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::ChangelogEntry& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMRepomdData& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMPrimaryData& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMGroupData& data);
-std::ostream& operator<<(std::ostream &out, const zypp::parser::YUM::YUMFileListData& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMOtherData& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMPatchData& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMPatchAtom& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMPatchMessage& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMPatchScript& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMPatchPackage& data);
-std::ostream& operator<<(std::ostream& out, const zypp::parser::YUM::YUMBaseVersion& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMDependency& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMDirSize& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMRepomdData& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::FileData& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::MultiLang& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::MetaPkg& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::PackageReq& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::ChangelogEntry& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMRepomdData& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMPrimaryData& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMGroupData& data);
+std::ostream& operator<<(std::ostream &out, const zypp::parser::yum::YUMFileListData& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMOtherData& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMPatchData& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMPatchAtom& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMPatchMessage& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMPatchScript& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMPatchPackage& data);
+std::ostream& operator<<(std::ostream& out, const zypp::parser::yum::YUMBaseVersion& data);
 
 
 
index 3c9b6d0..47ab044 100644 (file)
 #include <schemanames.h>
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
-
-YUMPatchParser::~YUMPatchParser()
-{ }
-
-YUMPatchParser::YUMPatchParser(istream &is, const string& baseUrl)
-: XMLNodeIterator<YUMPatchDataPtr>(is, baseUrl,PATCHSCHEMA)
-{
-  fetchNext();
-}
-
-YUMPatchParser::YUMPatchParser()
-{ }
-
-YUMPatchParser::YUMPatchParser(YUMPatchDataPtr& entry)
-: XMLNodeIterator<YUMPatchDataPtr>(entry)
-{ }
-
-
-// select for which elements process() will be called
-bool 
-YUMPatchParser::isInterested(const xmlNodePtr nodePtr)
-{
-  return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "patch";
-}
-
-// do the actual processing
-YUMPatchDataPtr
-YUMPatchParser::process(const xmlTextReaderPtr reader)
-{
-  assert(reader);
-  YUMPatchDataPtr patchPtr = new YUMPatchData;
-  xmlNodePtr dataNode = xmlTextReaderExpand(reader);
-  assert(dataNode);
-  patchPtr->timestamp = _helper.attribute(dataNode,"timestamp");
-  patchPtr->patchId = _helper.attribute(dataNode,"patchid");
-  patchPtr->engine = _helper.attribute(dataNode,"engine");
-
-  // default values for optional entries
-  patchPtr->rebootNeeded = false;
-  patchPtr->packageManager = false;
-
-  // FIXME move the respective method to a common class, inherit it  
-  YUMPrimaryParser prim;
-
-  for (xmlNodePtr child = dataNode->children; 
-       child && child != dataNode;
-       child = child->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "name") {
-       patchPtr->name = _helper.content(child);
-      }
-      else if (name == "summary") {
-        patchPtr->summary = MultiLang(
-         _helper.attribute(child,"lang"),
-         _helper.content(child));
-      }
-      else if (name == "description") {
-        patchPtr->description = MultiLang(
-         _helper.attribute(child,"lang"),
-         _helper.content(child));
-      }
-      else if (name == "version") {
-        patchPtr->epoch = _helper.attribute(child,"epoch");
-        patchPtr->ver = _helper.attribute(child,"ver");
-        patchPtr->rel = _helper.attribute(child,"rel");
-      }
-      else if (name == "provides") {
-        prim.parseDependencyEntries(& patchPtr->provides, child);
-      }
-      else if (name == "conflicts") {
-        prim.parseDependencyEntries(& patchPtr->conflicts, child);
-      }
-      else if (name == "obsoletes") {
-        prim.parseDependencyEntries(& patchPtr->obsoletes, child);
-      }
-      else if (name == "requires") {
-        prim.parseDependencyEntries(& patchPtr->requires, child);
-      }
-      else if (name == "freshen") {
-        prim.parseDependencyEntries(& patchPtr->requires, child);
-      }
-      else if (name == "category") {
-       patchPtr->category = _helper.content(child);
-      }
-      else if (name == "reboot_needed") {
-       patchPtr->rebootNeeded = true;
-      }
-      else if (name == "package_manager") {
-       patchPtr->packageManager = true;
-      }
-      else if (name == "update_script") {
-       patchPtr->updateScript = _helper.content(child);
-      }
-      else if (name == "atoms") {
-        parseAtomsNode(patchPtr, child);
-      }
-      else {
-        WAR << "YUM <data> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-  return patchPtr;
-} /* end process */
-
-
-void 
-YUMPatchParser::parseAtomsNode(YUMPatchDataPtr dataPtr,
-                               xmlNodePtr formatNode)
-{
-  assert(formatNode);
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "package")
+namespace zypp {
+  namespace parser {
+    namespace yum {
+
+      YUMPatchParser::~YUMPatchParser()
+      { }
+      
+      YUMPatchParser::YUMPatchParser(istream &is, const string& baseUrl)
+      : XMLNodeIterator<YUMPatchDataPtr>(is, baseUrl,PATCHSCHEMA)
       {
-       parsePackageNode (dataPtr, child);
-      }
-      else if (name == "script")
+        fetchNext();
+      }
+      
+      YUMPatchParser::YUMPatchParser()
+      { }
+      
+      YUMPatchParser::YUMPatchParser(YUMPatchDataPtr& entry)
+      : XMLNodeIterator<YUMPatchDataPtr>(entry)
+      { }
+      
+      
+      // select for which elements process() will be called
+      bool 
+      YUMPatchParser::isInterested(const xmlNodePtr nodePtr)
       {
-       parseScriptNode (dataPtr, child);
+        return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "patch";
       }
-      else if (name == "message")
+      
+      // do the actual processing
+      YUMPatchDataPtr
+      YUMPatchParser::process(const xmlTextReaderPtr reader)
       {
-       parseMessageNode (dataPtr, child);
-      }
-      else {
-        WAR << "YUM <atoms> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-void 
-YUMPatchParser::parseFormatNode(YUMPatchPackage *dataPtr,
-                                        xmlNodePtr formatNode)
-{
-  assert(formatNode);
-  dataPtr->installOnly = false;
-
-  // FIXME move the respective method to a common class, inherit it  
-  YUMPrimaryParser prim;
-
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "license") {
-        dataPtr->license = _helper.content(child);
-      }
-      else if (name == "vendor") {
-        dataPtr->vendor = _helper.content(child);
-      }
-      else if (name == "group") {
-        dataPtr->group = _helper.content(child);
-      }
-      else if (name == "buildhost") {
-        dataPtr->buildhost = _helper.content(child);
-      }
-      else if (name == "sourcerpm") {
-        dataPtr->sourcerpm = _helper.content(child);
-      }
-      else if (name == "header-range") {
-        dataPtr->headerStart = _helper.attribute(child,"start");
-        dataPtr->headerEnd = _helper.attribute(child,"end");
-      }
-      else if (name == "provides") {
-        prim.parseDependencyEntries(& dataPtr->provides, child);
-      }
-      else if (name == "conflicts") {
-        prim.parseDependencyEntries(& dataPtr->conflicts, child);
-      }
-      else if (name == "obsoletes") {
-        prim.parseDependencyEntries(& dataPtr->obsoletes, child);
-      }
-      else if (name == "requires") {
-        prim.parseDependencyEntries(& dataPtr->requires, child);
-      }
-      else if (name == "file") {
-        dataPtr->files.push_back
-          (FileData(_helper.content(child),
-                    _helper.attribute(child,"type")));
-      }
-      /* SUSE specific elements */
-      else if (name == "authors") {
-        prim.parseAuthorEntries(& dataPtr->authors, child);
-      }
-      else if (name == "keywords") {
-        prim.parseKeywordEntries(& dataPtr->keywords, child);
-      }
-      else if (name == "media") {
-        dataPtr->media = _helper.attribute(child,"mediaid");
-      }
-      else if (name == "dirsizes") {
-        prim.parseDirsizeEntries(& dataPtr->dirSizes, child);
-      }
-      else if (name == "freshen") {
-        prim.parseDependencyEntries(& dataPtr->freshen, child);
-      }
-      else if (name == "install_only") {
-        dataPtr->installOnly = true;
-      }
-      else {
-        WAR << "YUM <atom/package/format> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-void
-YUMPatchParser::parsePkgPlainRpmNode(YUMPatchPackage *dataPtr,
-                               xmlNodePtr formatNode)
-{
-  dataPtr->plainRpm.arch = _helper.attribute( formatNode, "arch" );
-  dataPtr->plainRpm.filename = _helper.attribute( formatNode, "filename" );
-  dataPtr->plainRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
-  dataPtr->plainRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
-  dataPtr->plainRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      WAR << "YUM <atom/package/pkgfiles/plain> contains the unknown element <"
-       << name << "> "
-        << _helper.positionInfo(child) << ", skipping" << endl;
-    }
-  }
-}
-
-void
-YUMPatchParser::parsePkgPatchRpmNode(YUMPatchPackage *dataPtr,
-                               xmlNodePtr formatNode)
-{
-  dataPtr->patchRpm.arch = _helper.attribute( formatNode, "arch" );
-  dataPtr->patchRpm.filename = _helper.attribute( formatNode, "filename" );
-  dataPtr->patchRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
-  dataPtr->patchRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
-  dataPtr->patchRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "base_version") {
-       YUMBaseVersion base_version;
-       parsePkgBaseVersionNode( &base_version, child);
-        dataPtr->patchRpm.baseVersions.push_back( base_version );
-      }
-      else {
-        WAR << "YUM <atom/package/pkgfiles/patch> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-void
-YUMPatchParser::parsePkgDeltaRpmNode(YUMPatchPackage *dataPtr,
-                               xmlNodePtr formatNode)
-{
-  dataPtr->deltaRpm.arch = _helper.attribute( formatNode, "arch" );
-  dataPtr->deltaRpm.filename = _helper.attribute( formatNode, "filename" );
-  dataPtr->deltaRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
-  dataPtr->deltaRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
-  dataPtr->deltaRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "base_version") {
-       parsePkgBaseVersionNode( &(dataPtr->deltaRpm.baseVersion), child);
-      }
-      else {
-        WAR << "YUM <atom/package/pkgfiles/delta> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-
-void
-YUMPatchParser::parsePkgBaseVersionNode(YUMBaseVersion *dataPtr,
-                                       xmlNodePtr formatNode)
-{
-  dataPtr->epoch = _helper.attribute( formatNode, "epoch" );
-  dataPtr->ver = _helper.attribute( formatNode, "ver" );
-  dataPtr->rel = _helper.attribute( formatNode, "rel" );
-  dataPtr->md5sum = _helper.attribute( formatNode, "md5sum" );
-  dataPtr->buildtime = _helper.attribute( formatNode, "buildtime" );
-  dataPtr->source_info = _helper.attribute( formatNode, "source_info" );
-}
-
-void
-YUMPatchParser::parsePkgFilesNode(YUMPatchPackage *dataPtr,
-                                xmlNodePtr formatNode)
-{
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "plainrpm") {
-       parsePkgPlainRpmNode( dataPtr, child );
-      }
-      else if (name == "patchrpm") {
-       parsePkgPatchRpmNode( dataPtr, child );
-      }
-      else if (name == "deltarpm") {
-       parsePkgDeltaRpmNode( dataPtr, child );
-      }
-      else {
-        WAR << "YUM <atom/package/pkgfiles> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-
-
-
-
-
-void
-YUMPatchParser::parsePackageNode(YUMPatchDataPtr dataPtr,
-                               xmlNodePtr formatNode)
-{
-  YUMPatchAtom at;
-  at.type = "package";
-  at.package = new YUMPatchPackage;
-  at.package->type = _helper.attribute(formatNode,"type");
-  at.package->installOnly = false;
-
-  // FIXME move the respective method to a common class, inherit it  
-  YUMPrimaryParser prim;
-
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "name") {
-       at.package->name = _helper.content(child);
-      }
-      else if (name == "arch") {
-        at.package->arch = _helper.content(child);
-      }
-      else if (name == "version") {
-        at.package->epoch = _helper.attribute(child,"epoch");
-        at.package->ver = _helper.attribute(child,"ver");
-        at.package->rel = _helper.attribute(child,"rel");
-      }
-      else if (name == "checksum") {
-        at.package->checksumType = _helper.attribute(child,"type");
-        at.package->checksumPkgid = _helper.attribute(child,"pkgid");
-        at.package->checksum = _helper.content(child);
-      }
-      else if (name == "summary") {
-        at.package->summary = _helper.content(child);
-      }
-      else if (name == "description") {
-        at.package->description = _helper.content(child);
-      }
-      else if (name == "packager") {
-        at.package->packager = _helper.content(child);
-      }
-      else if (name == "url") {
-        at.package->url = _helper.content(child);
-      }
-      else if (name == "time") {
-        at.package->timeFile = _helper.attribute(child,"file");
-        at.package->timeBuild = _helper.attribute(child,"build");
-      }
-      else if (name == "size") {
-        at.package->sizePackage = _helper.attribute(child,"package");
-        at.package->sizeInstalled = _helper.attribute(child,"installed");
-        at.package->sizeArchive = _helper.attribute(child,"archive");
-      }
-      else if (name == "location") {
-        at.package->location = _helper.attribute(child,"href");
-      }
-      else if (name == "format") {
-       parseFormatNode (&*at.package, child);
-      }
-      else if (name == "pkgfiles")
+        assert(reader);
+        YUMPatchDataPtr patchPtr = new YUMPatchData;
+        xmlNodePtr dataNode = xmlTextReaderExpand(reader);
+        assert(dataNode);
+        patchPtr->timestamp = _helper.attribute(dataNode,"timestamp");
+        patchPtr->patchId = _helper.attribute(dataNode,"patchid");
+        patchPtr->engine = _helper.attribute(dataNode,"engine");
+      
+        // default values for optional entries
+        patchPtr->rebootNeeded = false;
+        patchPtr->packageManager = false;
+      
+        // FIXME move the respective method to a common class, inherit it  
+        YUMPrimaryParser prim;
+      
+        for (xmlNodePtr child = dataNode->children; 
+             child && child != dataNode;
+             child = child->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "name") {
+       patchPtr->name = _helper.content(child);
+            }
+            else if (name == "summary") {
+              patchPtr->summary = MultiLang(
+         _helper.attribute(child,"lang"),
+         _helper.content(child));
+            }
+            else if (name == "description") {
+              patchPtr->description = MultiLang(
+         _helper.attribute(child,"lang"),
+         _helper.content(child));
+            }
+            else if (name == "version") {
+              patchPtr->epoch = _helper.attribute(child,"epoch");
+              patchPtr->ver = _helper.attribute(child,"ver");
+              patchPtr->rel = _helper.attribute(child,"rel");
+            }
+            else if (name == "provides") {
+              prim.parseDependencyEntries(& patchPtr->provides, child);
+            }
+            else if (name == "conflicts") {
+              prim.parseDependencyEntries(& patchPtr->conflicts, child);
+            }
+            else if (name == "obsoletes") {
+              prim.parseDependencyEntries(& patchPtr->obsoletes, child);
+            }
+            else if (name == "requires") {
+              prim.parseDependencyEntries(& patchPtr->requires, child);
+            }
+            else if (name == "freshen") {
+              prim.parseDependencyEntries(& patchPtr->requires, child);
+            }
+            else if (name == "category") {
+       patchPtr->category = _helper.content(child);
+            }
+            else if (name == "reboot_needed") {
+       patchPtr->rebootNeeded = true;
+            }
+            else if (name == "package_manager") {
+       patchPtr->packageManager = true;
+            }
+            else if (name == "update_script") {
+       patchPtr->updateScript = _helper.content(child);
+            }
+            else if (name == "atoms") {
+              parseAtomsNode(patchPtr, child);
+            }
+            else {
+              WAR << "YUM <data> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+        return patchPtr;
+      } /* end process */
+      
+      
+      void 
+      YUMPatchParser::parseAtomsNode(YUMPatchDataPtr dataPtr,
+                                     xmlNodePtr formatNode)
       {
-       parsePkgFilesNode (&*at.package, child);
-      }
-      else {
-        WAR << "YUM <atoms/package> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-  dataPtr->atoms.push_back(at);
-}
-
-void
-YUMPatchParser::parseScriptNode(YUMPatchDataPtr dataPtr,
-                               xmlNodePtr formatNode)
-{
-  YUMPatchAtom at;
-  at.type = "script";
-  at.script = new YUMPatchScript;
-
-  // FIXME move the respective method to a common class, inherit it  
-  YUMPrimaryParser prim;
-
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "name") {
-       at.script->name = _helper.content(child);
-      }
-      else if (name == "version") {
-        at.script->epoch = _helper.attribute(child,"epoch");
-        at.script->ver = _helper.attribute(child,"ver");
-        at.script->rel = _helper.attribute(child,"rel");
-      }
-      else if (name == "do") {
-       at.script->do_script = _helper.content(child);
-      }
-      else if (name == "undo") {
-       at.script->undo_script = _helper.content(child);
-      }
-      else if (name == "provides") {
-        prim.parseDependencyEntries(& at.script->provides, child);
-      }
-      else if (name == "conflicts") {
-        prim.parseDependencyEntries(& at.script->conflicts, child);
-      }
-      else if (name == "obsoletes") {
-        prim.parseDependencyEntries(& at.script->obsoletes, child);
-      }
-      else if (name == "requires") {
-        prim.parseDependencyEntries(& at.script->requires, child);
-      }
-      else if (name == "freshen") {
-        prim.parseDependencyEntries(& at.script->requires, child);
-      }
-      else {
-        WAR << "YUM <atoms/script> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-  dataPtr->atoms.push_back(at);
-}
-
-void
-YUMPatchParser::parseMessageNode(YUMPatchDataPtr dataPtr,
-                               xmlNodePtr formatNode)
-{
-  YUMPatchAtom at;
-  at.type = "message";
-  at.message = new YUMPatchMessage;
-  at.message->type = _helper.attribute(formatNode,"type");
-
-  // FIXME move the respective method to a common class, inherit it  
-  YUMPrimaryParser prim;
-
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "name") {
-       at.message->name = _helper.content(child);
-      }
-      else if (name == "version") {
-        at.message->epoch = _helper.attribute(child,"epoch");
-        at.message->ver = _helper.attribute(child,"ver");
-        at.message->rel = _helper.attribute(child,"rel");
-      }
-      else if (name == "text") {
-       at.message->text = _helper.content(child);
-      }
-      else if (name == "provides") {
-        prim.parseDependencyEntries(& at.message->provides, child);
-      }
-      else if (name == "conflicts") {
-        prim.parseDependencyEntries(& at.message->conflicts, child);
-      }
-      else if (name == "obsoletes") {
-        prim.parseDependencyEntries(& at.message->obsoletes, child);
-      }
-      else if (name == "requires") {
-        prim.parseDependencyEntries(& at.message->requires, child);
-      }
-      else if (name == "freshen") {
-        prim.parseDependencyEntries(& at.message->requires, child);
-      }
-      else {
-        WAR << "YUM <atoms/message> contains the unknown element <"
-         << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-  dataPtr->atoms.push_back(at);
-}
-
-}}}
+        assert(formatNode);
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "package")
+            {
+       parsePackageNode (dataPtr, child);
+            }
+            else if (name == "script")
+            {
+       parseScriptNode (dataPtr, child);
+            }
+            else if (name == "message")
+            {
+       parseMessageNode (dataPtr, child);
+            }
+            else {
+              WAR << "YUM <atoms> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      void 
+      YUMPatchParser::parseFormatNode(YUMPatchPackage *dataPtr,
+                                              xmlNodePtr formatNode)
+      {
+        assert(formatNode);
+        dataPtr->installOnly = false;
+      
+        // FIXME move the respective method to a common class, inherit it  
+        YUMPrimaryParser prim;
+      
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "license") {
+              dataPtr->license = _helper.content(child);
+            }
+            else if (name == "vendor") {
+              dataPtr->vendor = _helper.content(child);
+            }
+            else if (name == "group") {
+              dataPtr->group = _helper.content(child);
+            }
+            else if (name == "buildhost") {
+              dataPtr->buildhost = _helper.content(child);
+            }
+            else if (name == "sourcerpm") {
+              dataPtr->sourcerpm = _helper.content(child);
+            }
+            else if (name == "header-range") {
+              dataPtr->headerStart = _helper.attribute(child,"start");
+              dataPtr->headerEnd = _helper.attribute(child,"end");
+            }
+            else if (name == "provides") {
+              prim.parseDependencyEntries(& dataPtr->provides, child);
+            }
+            else if (name == "conflicts") {
+              prim.parseDependencyEntries(& dataPtr->conflicts, child);
+            }
+            else if (name == "obsoletes") {
+              prim.parseDependencyEntries(& dataPtr->obsoletes, child);
+            }
+            else if (name == "requires") {
+              prim.parseDependencyEntries(& dataPtr->requires, child);
+            }
+            else if (name == "file") {
+              dataPtr->files.push_back
+                (FileData(_helper.content(child),
+                          _helper.attribute(child,"type")));
+            }
+            /* SUSE specific elements */
+            else if (name == "authors") {
+              prim.parseAuthorEntries(& dataPtr->authors, child);
+            }
+            else if (name == "keywords") {
+              prim.parseKeywordEntries(& dataPtr->keywords, child);
+            }
+            else if (name == "media") {
+              dataPtr->media = _helper.attribute(child,"mediaid");
+            }
+            else if (name == "dirsizes") {
+              prim.parseDirsizeEntries(& dataPtr->dirSizes, child);
+            }
+            else if (name == "freshen") {
+              prim.parseDependencyEntries(& dataPtr->freshen, child);
+            }
+            else if (name == "install_only") {
+              dataPtr->installOnly = true;
+            }
+            else {
+              WAR << "YUM <atom/package/format> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      void
+      YUMPatchParser::parsePkgPlainRpmNode(YUMPatchPackage *dataPtr,
+                               xmlNodePtr formatNode)
+      {
+        dataPtr->plainRpm.arch = _helper.attribute( formatNode, "arch" );
+        dataPtr->plainRpm.filename = _helper.attribute( formatNode, "filename" );
+        dataPtr->plainRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
+        dataPtr->plainRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
+        dataPtr->plainRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            WAR << "YUM <atom/package/pkgfiles/plain> contains the unknown element <"
+       << name << "> "
+              << _helper.positionInfo(child) << ", skipping" << endl;
+          }
+        }
+      }
+      
+      void
+      YUMPatchParser::parsePkgPatchRpmNode(YUMPatchPackage *dataPtr,
+                               xmlNodePtr formatNode)
+      {
+        dataPtr->patchRpm.arch = _helper.attribute( formatNode, "arch" );
+        dataPtr->patchRpm.filename = _helper.attribute( formatNode, "filename" );
+        dataPtr->patchRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
+        dataPtr->patchRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
+        dataPtr->patchRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "base_version") {
+       YUMBaseVersion base_version;
+       parsePkgBaseVersionNode( &base_version, child);
+              dataPtr->patchRpm.baseVersions.push_back( base_version );
+            }
+            else {
+              WAR << "YUM <atom/package/pkgfiles/patch> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      void
+      YUMPatchParser::parsePkgDeltaRpmNode(YUMPatchPackage *dataPtr,
+                               xmlNodePtr formatNode)
+      {
+        dataPtr->deltaRpm.arch = _helper.attribute( formatNode, "arch" );
+        dataPtr->deltaRpm.filename = _helper.attribute( formatNode, "filename" );
+        dataPtr->deltaRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
+        dataPtr->deltaRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
+        dataPtr->deltaRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "base_version") {
+       parsePkgBaseVersionNode( &(dataPtr->deltaRpm.baseVersion), child);
+            }
+            else {
+              WAR << "YUM <atom/package/pkgfiles/delta> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      
+      void
+      YUMPatchParser::parsePkgBaseVersionNode(YUMBaseVersion *dataPtr,
+                                       xmlNodePtr formatNode)
+      {
+        dataPtr->epoch = _helper.attribute( formatNode, "epoch" );
+        dataPtr->ver = _helper.attribute( formatNode, "ver" );
+        dataPtr->rel = _helper.attribute( formatNode, "rel" );
+        dataPtr->md5sum = _helper.attribute( formatNode, "md5sum" );
+        dataPtr->buildtime = _helper.attribute( formatNode, "buildtime" );
+        dataPtr->source_info = _helper.attribute( formatNode, "source_info" );
+      }
+      
+      void
+      YUMPatchParser::parsePkgFilesNode(YUMPatchPackage *dataPtr,
+                                xmlNodePtr formatNode)
+      {
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "plainrpm") {
+       parsePkgPlainRpmNode( dataPtr, child );
+            }
+            else if (name == "patchrpm") {
+       parsePkgPatchRpmNode( dataPtr, child );
+            }
+            else if (name == "deltarpm") {
+       parsePkgDeltaRpmNode( dataPtr, child );
+            }
+            else {
+              WAR << "YUM <atom/package/pkgfiles> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      
+      
+      
+      
+      
+      void
+      YUMPatchParser::parsePackageNode(YUMPatchDataPtr dataPtr,
+                                     xmlNodePtr formatNode)
+      {
+        YUMPatchAtom at;
+        at.type = "package";
+        at.package = new YUMPatchPackage;
+        at.package->type = _helper.attribute(formatNode,"type");
+        at.package->installOnly = false;
+      
+        // FIXME move the respective method to a common class, inherit it  
+        YUMPrimaryParser prim;
+      
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "name") {
+       at.package->name = _helper.content(child);
+            }
+            else if (name == "arch") {
+              at.package->arch = _helper.content(child);
+            }
+            else if (name == "version") {
+              at.package->epoch = _helper.attribute(child,"epoch");
+              at.package->ver = _helper.attribute(child,"ver");
+              at.package->rel = _helper.attribute(child,"rel");
+            }
+            else if (name == "checksum") {
+              at.package->checksumType = _helper.attribute(child,"type");
+              at.package->checksumPkgid = _helper.attribute(child,"pkgid");
+              at.package->checksum = _helper.content(child);
+            }
+            else if (name == "summary") {
+              at.package->summary = _helper.content(child);
+            }
+            else if (name == "description") {
+              at.package->description = _helper.content(child);
+            }
+            else if (name == "packager") {
+              at.package->packager = _helper.content(child);
+            }
+            else if (name == "url") {
+              at.package->url = _helper.content(child);
+            }
+            else if (name == "time") {
+              at.package->timeFile = _helper.attribute(child,"file");
+              at.package->timeBuild = _helper.attribute(child,"build");
+            }
+            else if (name == "size") {
+              at.package->sizePackage = _helper.attribute(child,"package");
+              at.package->sizeInstalled = _helper.attribute(child,"installed");
+              at.package->sizeArchive = _helper.attribute(child,"archive");
+            }
+            else if (name == "location") {
+              at.package->location = _helper.attribute(child,"href");
+            }
+            else if (name == "format") {
+       parseFormatNode (&*at.package, child);
+            }
+            else if (name == "pkgfiles")
+            {
+       parsePkgFilesNode (&*at.package, child);
+            }
+            else {
+              WAR << "YUM <atoms/package> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+        dataPtr->atoms.push_back(at);
+      }
+      
+      void
+      YUMPatchParser::parseScriptNode(YUMPatchDataPtr dataPtr,
+                                     xmlNodePtr formatNode)
+      {
+        YUMPatchAtom at;
+        at.type = "script";
+        at.script = new YUMPatchScript;
+      
+        // FIXME move the respective method to a common class, inherit it  
+        YUMPrimaryParser prim;
+      
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "name") {
+       at.script->name = _helper.content(child);
+            }
+            else if (name == "version") {
+              at.script->epoch = _helper.attribute(child,"epoch");
+              at.script->ver = _helper.attribute(child,"ver");
+              at.script->rel = _helper.attribute(child,"rel");
+            }
+            else if (name == "do") {
+       at.script->do_script = _helper.content(child);
+            }
+            else if (name == "undo") {
+       at.script->undo_script = _helper.content(child);
+            }
+            else if (name == "provides") {
+              prim.parseDependencyEntries(& at.script->provides, child);
+            }
+            else if (name == "conflicts") {
+              prim.parseDependencyEntries(& at.script->conflicts, child);
+            }
+            else if (name == "obsoletes") {
+              prim.parseDependencyEntries(& at.script->obsoletes, child);
+            }
+            else if (name == "requires") {
+              prim.parseDependencyEntries(& at.script->requires, child);
+            }
+            else if (name == "freshen") {
+              prim.parseDependencyEntries(& at.script->requires, child);
+            }
+            else {
+              WAR << "YUM <atoms/script> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+        dataPtr->atoms.push_back(at);
+      }
+      
+      void
+      YUMPatchParser::parseMessageNode(YUMPatchDataPtr dataPtr,
+                                     xmlNodePtr formatNode)
+      {
+        YUMPatchAtom at;
+        at.type = "message";
+        at.message = new YUMPatchMessage;
+        at.message->type = _helper.attribute(formatNode,"type");
+      
+        // FIXME move the respective method to a common class, inherit it  
+        YUMPrimaryParser prim;
+      
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "name") {
+       at.message->name = _helper.content(child);
+            }
+            else if (name == "version") {
+              at.message->epoch = _helper.attribute(child,"epoch");
+              at.message->ver = _helper.attribute(child,"ver");
+              at.message->rel = _helper.attribute(child,"rel");
+            }
+            else if (name == "text") {
+       at.message->text = _helper.content(child);
+            }
+            else if (name == "provides") {
+              prim.parseDependencyEntries(& at.message->provides, child);
+            }
+            else if (name == "conflicts") {
+              prim.parseDependencyEntries(& at.message->conflicts, child);
+            }
+            else if (name == "obsoletes") {
+              prim.parseDependencyEntries(& at.message->obsoletes, child);
+            }
+            else if (name == "requires") {
+              prim.parseDependencyEntries(& at.message->requires, child);
+            }
+            else if (name == "freshen") {
+              prim.parseDependencyEntries(& at.message->requires, child);
+            }
+            else {
+              WAR << "YUM <atoms/message> contains the unknown element <"
+         << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+        dataPtr->atoms.push_back(at);
+      }
+
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
index 8c48bcb..917f692 100644 (file)
@@ -8,51 +8,55 @@
 #include <LibXMLHelper.h>
 #include <list>
 
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-  /**
-  * @short Parser for YUM primary.xml files (containing package metadata)
-  * Use this class as an iterator that produces, one after one,
-  * YUMPatchDataPtr(s) for the XML package elements in the input.
-  * Here's an example:
-  *
-  * for (YUMPatchParser iter(anIstream, baseUrl),
-  *      iter != YUMOtherParser.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().
-  */
-  class YUMPatchParser : public XMLNodeIterator<YUMPatchDataPtr>
-  {
-  public:
-    YUMPatchParser(std::istream &is, const std::string &baseUrl);
-    YUMPatchParser();
-    YUMPatchParser(YUMPatchDataPtr& entry);
-    virtual ~YUMPatchParser();
-
-  private:
-    virtual bool isInterested(const xmlNodePtr nodePtr);
-    virtual YUMPatchDataPtr process(const xmlTextReaderPtr reader);
-    void parseAtomsNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
-    void parsePackageNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
-    void parseMessageNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
-    void parseScriptNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
-    void parseFormatNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
-    void parsePkgFilesNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
-    void parsePkgPlainRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
-    void parsePkgPatchRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
-    void parsePkgDeltaRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
-    void parsePkgBaseVersionNode(YUMBaseVersion *dataPtr, xmlNodePtr formatNode);
-    LibXMLHelper _helper;
-  };
-}}}
+      /**
+      * @short Parser for YUM primary.xml files (containing package metadata)
+      * Use this class as an iterator that produces, one after one,
+      * YUMPatchDataPtr(s) for the XML package elements in the input.
+      * Here's an example:
+      *
+      * for (YUMPatchParser iter(anIstream, baseUrl),
+      *      iter != YUMOtherParser.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().
+      */
+      class YUMPatchParser : public XMLNodeIterator<YUMPatchDataPtr>
+      {
+      public:
+        YUMPatchParser(std::istream &is, const std::string &baseUrl);
+        YUMPatchParser();
+        YUMPatchParser(YUMPatchDataPtr& entry);
+        virtual ~YUMPatchParser();
+    
+      private:
+        virtual bool isInterested(const xmlNodePtr nodePtr);
+        virtual YUMPatchDataPtr process(const xmlTextReaderPtr reader);
+        void parseAtomsNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
+        void parsePackageNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
+        void parseMessageNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
+        void parseScriptNode(YUMPatchDataPtr dataPtr, xmlNodePtr formatNode);
+        void parseFormatNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
+        void parsePkgFilesNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
+        void parsePkgPlainRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
+        void parsePkgPatchRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
+        void parsePkgDeltaRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
+        void parsePkgBaseVersionNode(YUMBaseVersion *dataPtr, xmlNodePtr formatNode);
+        LibXMLHelper _helper;
+      };
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 #endif
index bead36e..b8a752e 100644 (file)
 
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
-
-
-YUMPrimaryParser::YUMPrimaryParser(istream &is, const string& baseUrl)
-  : XMLNodeIterator<YUMPrimaryDataPtr>(is, baseUrl,PRIMARYSCHEMA)
-{
-  fetchNext();
-}
-
-YUMPrimaryParser::YUMPrimaryParser()
-{ }
-
-YUMPrimaryParser::YUMPrimaryParser(YUMPrimaryDataPtr& entry)
-: XMLNodeIterator<YUMPrimaryDataPtr>(entry)
-{ }
-
-
-YUMPrimaryParser::~YUMPrimaryParser()
-{
-}
-  
-
-
-
-// select for which elements process() will be called
-bool 
-YUMPrimaryParser::isInterested(const xmlNodePtr nodePtr)
-{
-  bool result = (_helper.isElement(nodePtr)
-                 && _helper.name(nodePtr) == "package");
-  return result;
-}
-
-
-// do the actual processing
-YUMPrimaryDataPtr
-YUMPrimaryParser::process(const xmlTextReaderPtr reader)
-{
-  assert(reader);
-  YUMPrimaryDataPtr dataPtr = new YUMPrimaryData;
-  xmlNodePtr dataNode = xmlTextReaderExpand(reader);
-  assert(dataNode);
-
-  dataPtr->type = _helper.attribute(dataNode,"type");
-  dataPtr->installOnly = false;
-  
-  for (xmlNodePtr child = dataNode->children; 
-       child != 0;
-       child = child->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "name") {
-        dataPtr->name = _helper.content(child);
-      }
-      else if (name == "arch") {
-        dataPtr->arch = _helper.content(child);
-      }
-      else if (name == "version") {
-        dataPtr->epoch = _helper.attribute(child,"epoch");
-        dataPtr->ver = _helper.attribute(child,"ver");
-        dataPtr->rel = _helper.attribute(child,"rel");
-      }
-      else if (name == "checksum") {
-        dataPtr->checksumType = _helper.attribute(child,"type");
-        dataPtr->checksumPkgid = _helper.attribute(child,"pkgid");
-        dataPtr->checksum = _helper.content(child);
-      }
-      else if (name == "summary") {
-        dataPtr->summary = _helper.content(child);
-      }
-      else if (name == "description") {
-        dataPtr->description = _helper.content(child);
-      }
-      else if (name == "packager") {
-        dataPtr->packager = _helper.content(child);
-      }
-      else if (name == "url") {
-        dataPtr->url = _helper.content(child);
-      }
-      else if (name == "time") {
-        dataPtr->timeFile = _helper.attribute(child,"file");
-        dataPtr->timeBuild = _helper.attribute(child,"build");
-      }
-      else if (name == "size") {
-        dataPtr->sizePackage = _helper.attribute(child,"package");
-        dataPtr->sizeInstalled = _helper.attribute(child,"installed");
-        dataPtr->sizeArchive = _helper.attribute(child,"archive");
-      }
-      else if (name == "location") {
-        dataPtr->location = _helper.attribute(child,"href");
-      }
-      else if (name == "format") {
-        parseFormatNode(dataPtr, child);
-      }
-      else {
-        WAR << "YUM <metadata> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-  return dataPtr;
-} /* end process */
-
-
-
-void 
-YUMPrimaryParser::parseFormatNode(YUMPrimaryDataPtr dataPtr,
-                                        xmlNodePtr formatNode)
-{
-  assert(formatNode);
-  dataPtr->installOnly = false;
-  for (xmlNodePtr child = formatNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "license") {
-        dataPtr->license = _helper.content(child);
-      }
-      else if (name == "vendor") {
-        dataPtr->vendor = _helper.content(child);
-      }
-      else if (name == "group") {
-        dataPtr->group = _helper.content(child);
-      }
-      else if (name == "buildhost") {
-        dataPtr->buildhost = _helper.content(child);
-      }
-      else if (name == "sourcerpm") {
-        dataPtr->sourcerpm = _helper.content(child);
-      }
-      else if (name == "header-range") {
-        dataPtr->headerStart = _helper.attribute(child,"start");
-        dataPtr->headerEnd = _helper.attribute(child,"end");
-      }
-      else if (name == "provides") {
-        parseDependencyEntries(& dataPtr->provides, child);
-      }
-      else if (name == "conflicts") {
-        parseDependencyEntries(& dataPtr->conflicts, child);
-      }
-      else if (name == "obsoletes") {
-        parseDependencyEntries(& dataPtr->obsoletes, child);
-      }
-      else if (name == "requires") {
-        parseDependencyEntries(& dataPtr->requires, child);
-      }
-      else if (name == "file") {
-        dataPtr->files.push_back
-          (FileData(_helper.content(child),
-                    _helper.attribute(child,"type")));
-      }
-      /* SUSE specific elements */
-      else if (name == "authors") {
-        parseAuthorEntries(& dataPtr->authors, child);
-      }
-      else if (name == "keywords") {
-        parseKeywordEntries(& dataPtr->keywords, child);
-      }
-      else if (name == "media") {
-        dataPtr->media = _helper.attribute(child,"mediaid");
-      }
-      else if (name == "dirsizes") {
-        parseDirsizeEntries(& dataPtr->dirSizes, child);
-      }
-      else if (name == "freshen") {
-        parseDependencyEntries(& dataPtr->freshen, child);
-      }
-      else if (name == "install_only") {
-        dataPtr->installOnly = true;
-      }
-      else {
-        WAR << "YUM <format> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-
-void
-YUMPrimaryParser::parseDependencyEntries(list<YUMDependency> *depList,
-                                               xmlNodePtr depNode)
-{
-  assert(depList);
-  assert(depNode);
-
-  for (xmlNodePtr child = depNode->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "entry") { 
-        depList->push_back
-          (YUMDependency(_helper.attribute(child,"name"),
-                         _helper.attribute(child,"flags"),
-                         _helper.attribute(child,"epoch"),
-                         _helper.attribute(child,"ver"),
-                         _helper.attribute(child,"rel"),
-                         _helper.attribute(child,"pre")));
-      }
-      else {
-        WAR << "YUM dependency within <format> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-void
-YUMPrimaryParser::parseAuthorEntries(list<string> *authors,
-                                           xmlNodePtr node)
-{
-  assert(authors);
-  assert(node);
-
-  for (xmlNodePtr child = node->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "author") { 
-        authors->push_back(_helper.content(child));
-      }
-      else {
-        WAR << "YUM <authors> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-void YUMPrimaryParser::parseKeywordEntries(list<string> *keywords,
+namespace zypp {
+  namespace parser {
+    namespace yum {
+      
+      
+      YUMPrimaryParser::YUMPrimaryParser(istream &is, const string& baseUrl)
+        : XMLNodeIterator<YUMPrimaryDataPtr>(is, baseUrl,PRIMARYSCHEMA)
+      {
+        fetchNext();
+      }
+      
+      YUMPrimaryParser::YUMPrimaryParser()
+      { }
+      
+      YUMPrimaryParser::YUMPrimaryParser(YUMPrimaryDataPtr& entry)
+      : XMLNodeIterator<YUMPrimaryDataPtr>(entry)
+      { }
+      
+      
+      YUMPrimaryParser::~YUMPrimaryParser()
+      {
+      }
+        
+      
+      
+      
+      // select for which elements process() will be called
+      bool 
+      YUMPrimaryParser::isInterested(const xmlNodePtr nodePtr)
+      {
+        bool result = (_helper.isElement(nodePtr)
+                       && _helper.name(nodePtr) == "package");
+        return result;
+      }
+      
+      
+      // do the actual processing
+      YUMPrimaryDataPtr
+      YUMPrimaryParser::process(const xmlTextReaderPtr reader)
+      {
+        assert(reader);
+        YUMPrimaryDataPtr dataPtr = new YUMPrimaryData;
+        xmlNodePtr dataNode = xmlTextReaderExpand(reader);
+        assert(dataNode);
+      
+        dataPtr->type = _helper.attribute(dataNode,"type");
+        dataPtr->installOnly = false;
+        
+        for (xmlNodePtr child = dataNode->children; 
+             child != 0;
+             child = child->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "name") {
+              dataPtr->name = _helper.content(child);
+            }
+            else if (name == "arch") {
+              dataPtr->arch = _helper.content(child);
+            }
+            else if (name == "version") {
+              dataPtr->epoch = _helper.attribute(child,"epoch");
+              dataPtr->ver = _helper.attribute(child,"ver");
+              dataPtr->rel = _helper.attribute(child,"rel");
+            }
+            else if (name == "checksum") {
+              dataPtr->checksumType = _helper.attribute(child,"type");
+              dataPtr->checksumPkgid = _helper.attribute(child,"pkgid");
+              dataPtr->checksum = _helper.content(child);
+            }
+            else if (name == "summary") {
+              dataPtr->summary = _helper.content(child);
+            }
+            else if (name == "description") {
+              dataPtr->description = _helper.content(child);
+            }
+            else if (name == "packager") {
+              dataPtr->packager = _helper.content(child);
+            }
+            else if (name == "url") {
+              dataPtr->url = _helper.content(child);
+            }
+            else if (name == "time") {
+              dataPtr->timeFile = _helper.attribute(child,"file");
+              dataPtr->timeBuild = _helper.attribute(child,"build");
+            }
+            else if (name == "size") {
+              dataPtr->sizePackage = _helper.attribute(child,"package");
+              dataPtr->sizeInstalled = _helper.attribute(child,"installed");
+              dataPtr->sizeArchive = _helper.attribute(child,"archive");
+            }
+            else if (name == "location") {
+              dataPtr->location = _helper.attribute(child,"href");
+            }
+            else if (name == "format") {
+              parseFormatNode(dataPtr, child);
+            }
+            else {
+              WAR << "YUM <metadata> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+        return dataPtr;
+      } /* end process */
+      
+      
+      
+      void 
+      YUMPrimaryParser::parseFormatNode(YUMPrimaryDataPtr dataPtr,
+                                              xmlNodePtr formatNode)
+      {
+        assert(formatNode);
+        dataPtr->installOnly = false;
+        for (xmlNodePtr child = formatNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "license") {
+              dataPtr->license = _helper.content(child);
+            }
+            else if (name == "vendor") {
+              dataPtr->vendor = _helper.content(child);
+            }
+            else if (name == "group") {
+              dataPtr->group = _helper.content(child);
+            }
+            else if (name == "buildhost") {
+              dataPtr->buildhost = _helper.content(child);
+            }
+            else if (name == "sourcerpm") {
+              dataPtr->sourcerpm = _helper.content(child);
+            }
+            else if (name == "header-range") {
+              dataPtr->headerStart = _helper.attribute(child,"start");
+              dataPtr->headerEnd = _helper.attribute(child,"end");
+            }
+            else if (name == "provides") {
+              parseDependencyEntries(& dataPtr->provides, child);
+            }
+            else if (name == "conflicts") {
+              parseDependencyEntries(& dataPtr->conflicts, child);
+            }
+            else if (name == "obsoletes") {
+              parseDependencyEntries(& dataPtr->obsoletes, child);
+            }
+            else if (name == "requires") {
+              parseDependencyEntries(& dataPtr->requires, child);
+            }
+            else if (name == "file") {
+              dataPtr->files.push_back
+                (FileData(_helper.content(child),
+                          _helper.attribute(child,"type")));
+            }
+            /* SUSE specific elements */
+            else if (name == "authors") {
+              parseAuthorEntries(& dataPtr->authors, child);
+            }
+            else if (name == "keywords") {
+              parseKeywordEntries(& dataPtr->keywords, child);
+            }
+            else if (name == "media") {
+              dataPtr->media = _helper.attribute(child,"mediaid");
+            }
+            else if (name == "dirsizes") {
+              parseDirsizeEntries(& dataPtr->dirSizes, child);
+            }
+            else if (name == "freshen") {
+              parseDependencyEntries(& dataPtr->freshen, child);
+            }
+            else if (name == "install_only") {
+              dataPtr->installOnly = true;
+            }
+            else {
+              WAR << "YUM <format> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      
+      void
+      YUMPrimaryParser::parseDependencyEntries(list<YUMDependency> *depList,
+                                                     xmlNodePtr depNode)
+      {
+        assert(depList);
+        assert(depNode);
+      
+        for (xmlNodePtr child = depNode->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "entry") { 
+              depList->push_back
+                (YUMDependency(_helper.attribute(child,"name"),
+                               _helper.attribute(child,"flags"),
+                               _helper.attribute(child,"epoch"),
+                               _helper.attribute(child,"ver"),
+                               _helper.attribute(child,"rel"),
+                               _helper.attribute(child,"pre")));
+            }
+            else {
+              WAR << "YUM dependency within <format> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      void
+      YUMPrimaryParser::parseAuthorEntries(list<string> *authors,
                                                  xmlNodePtr node)
-{
-  assert(keywords);
-  assert(node);
-
-  for (xmlNodePtr child = node->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "keyword") { 
-        keywords->push_back(_helper.content(child));
-      }
-      else {
-        WAR << "YUM <keywords> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-}
-
-void YUMPrimaryParser::parseDirsizeEntries(list<YUMDirSize> *sizes,
-                                                 xmlNodePtr node)
-{
-  assert(sizes);
-  assert(node);
-
-  for (xmlNodePtr child = node->children; 
-       child != 0;
-       child = child ->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "dirsize") { 
-        sizes->push_back(YUMDirSize(_helper.attribute(child,"path"),
-                                    _helper.attribute(child,"size-kbyte"),
-                                    _helper.attribute(child,"filecount")));
-      }
-      else {
-        WAR << "YUM <dirsizes> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
+      {
+        assert(authors);
+        assert(node);
+      
+        for (xmlNodePtr child = node->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "author") { 
+              authors->push_back(_helper.content(child));
+            }
+            else {
+              WAR << "YUM <authors> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      void YUMPrimaryParser::parseKeywordEntries(list<string> *keywords,
+                                                       xmlNodePtr node)
+      {
+        assert(keywords);
+        assert(node);
+      
+        for (xmlNodePtr child = node->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "keyword") { 
+              keywords->push_back(_helper.content(child));
+            }
+            else {
+              WAR << "YUM <keywords> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+      }
+      
+      void YUMPrimaryParser::parseDirsizeEntries(list<YUMDirSize> *sizes,
+                                                       xmlNodePtr node)
+      {
+        assert(sizes);
+        assert(node);
+      
+        for (xmlNodePtr child = node->children; 
+             child != 0;
+             child = child ->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "dirsize") { 
+              sizes->push_back(YUMDirSize(_helper.attribute(child,"path"),
+                                          _helper.attribute(child,"size-kbyte"),
+                                          _helper.attribute(child,"filecount")));
+            }
+            else {
+              WAR << "YUM <dirsizes> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
       }
-    }
-  }
-}
 
-}}}
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
index 5a811ee..91a8922 100644 (file)
@@ -8,54 +8,58 @@
 #include <LibXMLHelper.h>
 #include <list>
 
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-  /**
-  * @short Parser for YUM primary.xml files (containing package metadata)
-  * Use this class as an iterator that produces, one after one,
-  * YUMPrimaryDataPtr(s) for the XML package elements in the input.
-  * Here's an example:
-  *
-  * for (YUMPrimaryParser iter(anIstream, baseUrl),
-  *      iter != YUMOtherParser.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().
-  */
-  class YUMPrimaryParser : public XMLNodeIterator<YUMPrimaryDataPtr>
-  {
-  public:
-    YUMPrimaryParser(std::istream &is, const std::string &baseUrl);
-    YUMPrimaryParser();
-    YUMPrimaryParser(YUMPrimaryDataPtr& entry);
-    virtual ~YUMPrimaryParser();
-
-  private:
-    // FIXME move needed method to a common class, inherit it
-    friend class YUMPatchParser;
-    virtual bool isInterested(const xmlNodePtr nodePtr);
-    virtual YUMPrimaryDataPtr process(const xmlTextReaderPtr reader);
-    void parseFormatNode(YUMPrimaryDataPtr dataPtr,
-                         xmlNodePtr formatNode);
-    void parseDependencyEntries(std::list<YUMDependency> *depList, 
-                                xmlNodePtr depNode);
-    void parseAuthorEntries(std::list<std::string> *authors,
-                            xmlNodePtr node);
-    void parseKeywordEntries(std::list<std::string> *keywords,
-                             xmlNodePtr node);
-    void parseDirsizeEntries(std::list<YUMDirSize> *sizes,
-                             xmlNodePtr node);
-
-    LibXMLHelper _helper;
-  };
-}}}
+      /**
+      * @short Parser for YUM primary.xml files (containing package metadata)
+      * Use this class as an iterator that produces, one after one,
+      * YUMPrimaryDataPtr(s) for the XML package elements in the input.
+      * Here's an example:
+      *
+      * for (YUMPrimaryParser iter(anIstream, baseUrl),
+      *      iter != YUMOtherParser.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().
+      */
+      class YUMPrimaryParser : public XMLNodeIterator<YUMPrimaryDataPtr>
+      {
+      public:
+        YUMPrimaryParser(std::istream &is, const std::string &baseUrl);
+        YUMPrimaryParser();
+        YUMPrimaryParser(YUMPrimaryDataPtr& entry);
+        virtual ~YUMPrimaryParser();
+    
+      private:
+        // FIXME move needed method to a common class, inherit it
+        friend class YUMPatchParser;
+        virtual bool isInterested(const xmlNodePtr nodePtr);
+        virtual YUMPrimaryDataPtr process(const xmlTextReaderPtr reader);
+        void parseFormatNode(YUMPrimaryDataPtr dataPtr,
+                             xmlNodePtr formatNode);
+        void parseDependencyEntries(std::list<YUMDependency> *depList, 
+                                    xmlNodePtr depNode);
+        void parseAuthorEntries(std::list<std::string> *authors,
+                                xmlNodePtr node);
+        void parseKeywordEntries(std::list<std::string> *keywords,
+                                 xmlNodePtr node);
+        void parseDirsizeEntries(std::list<YUMDirSize> *sizes,
+                                 xmlNodePtr node);
+    
+        LibXMLHelper _helper;
+      };
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 #endif
index 9df7779..34b8a64 100644 (file)
@@ -9,69 +9,73 @@
 #include <schemanames.h>
 
 using namespace std;
-namespace zypp { namespace parser { namespace YUM {
+namespace zypp {
+  namespace parser {
+    namespace yum {
 
-YUMRepomdParser::~YUMRepomdParser()
-{ }
-
-YUMRepomdParser::YUMRepomdParser()
-{ }
-
-YUMRepomdParser::YUMRepomdParser(YUMRepomdDataPtr& entry)
-: XMLNodeIterator<YUMRepomdDataPtr>(entry)
-{ }
-
-
-// select for which elements process() will be called
-bool 
-YUMRepomdParser::isInterested(const xmlNodePtr nodePtr)
-{
-  return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "data";
-}
-
-// do the actual processing
-YUMRepomdDataPtr
-YUMRepomdParser::process(const xmlTextReaderPtr reader)
-{
-  assert(reader);
-  YUMRepomdDataPtr repoPtr = new YUMRepomdData;
-  xmlNodePtr dataNode = xmlTextReaderExpand(reader);
-  assert(dataNode);
-  repoPtr->type = _helper.attribute(dataNode,"type");
-  
-  for (xmlNodePtr child = dataNode->children; 
-       child && child != dataNode;
-       child = child->next) {
-    if (_helper.isElement(child)) {
-      string name = _helper.name(child);
-      if (name == "location") {
-        repoPtr->location = _helper.attribute(child,"href");
+      YUMRepomdParser::~YUMRepomdParser()
+      { }
+      
+      YUMRepomdParser::YUMRepomdParser()
+      { }
+      
+      YUMRepomdParser::YUMRepomdParser(YUMRepomdDataPtr& entry)
+      : XMLNodeIterator<YUMRepomdDataPtr>(entry)
+      { }
+      
+      
+      // select for which elements process() will be called
+      bool 
+      YUMRepomdParser::isInterested(const xmlNodePtr nodePtr)
+      {
+        return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "data";
       }
-      else if (name == "checksum") {
-        repoPtr->checksumType = _helper.attribute(child,"type");
-        repoPtr->checksum = _helper.content(child);
+      
+      // do the actual processing
+      YUMRepomdDataPtr
+      YUMRepomdParser::process(const xmlTextReaderPtr reader)
+      {
+        assert(reader);
+        YUMRepomdDataPtr repoPtr = new YUMRepomdData;
+        xmlNodePtr dataNode = xmlTextReaderExpand(reader);
+        assert(dataNode);
+        repoPtr->type = _helper.attribute(dataNode,"type");
+        
+        for (xmlNodePtr child = dataNode->children; 
+             child && child != dataNode;
+             child = child->next) {
+          if (_helper.isElement(child)) {
+            string name = _helper.name(child);
+            if (name == "location") {
+              repoPtr->location = _helper.attribute(child,"href");
+            }
+            else if (name == "checksum") {
+              repoPtr->checksumType = _helper.attribute(child,"type");
+              repoPtr->checksum = _helper.content(child);
+            }
+            else if (name == "timestamp") {
+              repoPtr->timestamp = _helper.content(child);
+            }
+            else if (name == "open-checksum") {
+              repoPtr->openChecksumType = _helper.attribute(child, "type");
+              repoPtr->openChecksum = _helper.content(child);
+            }
+            else {
+              WAR << "YUM <data> contains the unknown element <" << name << "> "
+                << _helper.positionInfo(child) << ", skipping" << endl;
+            }
+          }
+        }
+        return repoPtr;
+      } /* end process */
+      
+        
+      YUMRepomdParser::YUMRepomdParser(istream &is, const string &baseUrl)
+      : XMLNodeIterator<YUMRepomdDataPtr>(is, baseUrl,REPOMDSCHEMA)
+      {
+        fetchNext();
       }
-      else if (name == "timestamp") {
-        repoPtr->timestamp = _helper.content(child);
-      }
-      else if (name == "open-checksum") {
-        repoPtr->openChecksumType = _helper.attribute(child, "type");
-        repoPtr->openChecksum = _helper.content(child);
-      }
-      else {
-        WAR << "YUM <data> contains the unknown element <" << name << "> "
-          << _helper.positionInfo(child) << ", skipping" << endl;
-      }
-    }
-  }
-  return repoPtr;
-} /* end process */
-
-  
-YUMRepomdParser::YUMRepomdParser(istream &is, const string &baseUrl)
-: XMLNodeIterator<YUMRepomdDataPtr>(is, baseUrl,REPOMDSCHEMA)
-{
-  fetchNext();
-}
-
-}}}
+      
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
index 14b81b9..2829994 100644 (file)
@@ -7,42 +7,46 @@
 #include <XMLNodeIterator.h>
 #include <LibXMLHelper.h>
 
-namespace zypp { namespace parser { namespace YUM {
-
-  /**
-  * @short Parser for YUM repomd.xml files (describing the repository)
-  * Use this class as an iterator that produces, one after one,
-  * YUMRepomdDataPtr(s) for the XML package elements.
-  * Here's an example:
-  *
-  * for (YUMRepomdParser iter(anIstream, baseUrl),
-  *      iter != YUMOtherParser.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().
-  */
-  class YUMRepomdParser : public XMLNodeIterator<YUMRepomdDataPtr>
-  {
-  public:
-    YUMRepomdParser(std::istream &is, const std::string &baseUrl);
-    YUMRepomdParser();
-    YUMRepomdParser(YUMRepomdDataPtr& entry);
-    virtual ~YUMRepomdParser();
-
-  private:
-    virtual bool isInterested(const xmlNodePtr nodePtr);
-    virtual YUMRepomdDataPtr process(const xmlTextReaderPtr reader);
-
-    LibXMLHelper _helper;
-  };
-}}}
+namespace zypp {
+  namespace parser {
+    namespace yum {
+
+      /**
+      * @short Parser for YUM repomd.xml files (describing the repository)
+      * Use this class as an iterator that produces, one after one,
+      * YUMRepomdDataPtr(s) for the XML package elements.
+      * Here's an example:
+      *
+      * for (YUMRepomdParser iter(anIstream, baseUrl),
+      *      iter != YUMOtherParser.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().
+      */
+      class YUMRepomdParser : public XMLNodeIterator<YUMRepomdDataPtr>
+      {
+      public:
+        YUMRepomdParser(std::istream &is, const std::string &baseUrl);
+        YUMRepomdParser();
+        YUMRepomdParser(YUMRepomdDataPtr& entry);
+        virtual ~YUMRepomdParser();
+    
+      private:
+        virtual bool isInterested(const xmlNodePtr nodePtr);
+        virtual YUMRepomdDataPtr process(const xmlTextReaderPtr reader);
+    
+        LibXMLHelper _helper;
+      };
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 #endif
index b98eb8f..3ba380f 100644 (file)
@@ -22,16 +22,20 @@ Purpose:    Pathnames of schemas for validation
 #ifndef schemanames_h
 #define schemanames_h
 
-namespace zypp { namespace parser { namespace YUM {
-/* FIXME: How do I do this properly? */
-#define SCHEMABASE "/usr/share/YaST2/schema/packagemanager/"
-#define REPOMDSCHEMA (SCHEMABASE "repomd.rng")
-#define PRIMARYSCHEMA (SCHEMABASE "suse-primary.rng")
-#define GROUPSCHEMA (SCHEMABASE "groups.rng")
-#define FILELISTSCHEMA (SCHEMABASE "filelists.rng")
-#define OTHERSCHEMA (SCHEMABASE "other.rng")
-#define PATCHSCHEMA (SCHEMABASE "patch.rng")
-}}}
+namespace zypp {
+  namespace parser {
+    namespace yum {
+    /* FIXME: How do I do this properly? */
+    #define SCHEMABASE "/usr/share/YaST2/schema/packagemanager/"
+    #define REPOMDSCHEMA (SCHEMABASE "repomd.rng")
+    #define PRIMARYSCHEMA (SCHEMABASE "suse-primary.rng")
+    #define GROUPSCHEMA (SCHEMABASE "groups.rng")
+    #define FILELISTSCHEMA (SCHEMABASE "filelists.rng")
+    #define OTHERSCHEMA (SCHEMABASE "other.rng")
+    #define PATCHSCHEMA (SCHEMABASE "patch.rng")
+    } // namespace yum
+  } // namespace parser
+} // namespace zypp
 
 
 #endif
index b22a2ab..92d27ff 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace source
   { /////////////////////////////////////////////////////////////////
-    namespace YUM
+    namespace yum
     {
       ///////////////////////////////////////////////////////////////////
       //
@@ -31,7 +31,7 @@ namespace zypp
   
       /** Default ctor */
       YUMMessageImpl::YUMMessageImpl(
-       const zypp::parser::YUM::YUMPatchMessage & parsed
+       const zypp::parser::yum::YUMPatchMessage & parsed
       )
 #warning MA cannot be constructed that way
 #if 0
@@ -51,7 +51,7 @@ namespace zypp
     std::list<YUMDependency> requires;
 */
       }
-    } // namespace YUM 
+    } // namespace yum 
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////
index bfce4f5..3563b19 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace source
   { /////////////////////////////////////////////////////////////////
-    namespace YUM
+    namespace yum
     { //////////////////////////////////////////////////////////////
 
       ///////////////////////////////////////////////////////////////////
@@ -33,10 +33,10 @@ namespace zypp
       {
       public:
         /** Default ctor */
-        YUMMessageImpl( const zypp::parser::YUM::YUMPatchMessage & parsed );
+        YUMMessageImpl( const zypp::parser::yum::YUMPatchMessage & parsed );
        };
       ///////////////////////////////////////////////////////////////////
-    } // namespace YUM
+    } // namespace yum
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////
index 6cae51e..f02264c 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace source
   { /////////////////////////////////////////////////////////////////
-    namespace YUM
+    namespace yum
     {
       ///////////////////////////////////////////////////////////////////
       //
@@ -31,7 +31,7 @@ namespace zypp
   
       /** Default ctor */
       YUMPackageImpl::YUMPackageImpl(
-       const zypp::parser::YUM::YUMPatchPackage & parsed
+       const zypp::parser::yum::YUMPatchPackage & parsed
       )
 #warning MA cannot be constructed that way
 #if 0
@@ -110,7 +110,7 @@ namespace zypp
 
 */
       }
-    } // namespace YUM 
+    } // namespace yum 
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////
index 2e331dc..d9f42c1 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace source
   { /////////////////////////////////////////////////////////////////
-    namespace YUM
+    namespace yum
     { //////////////////////////////////////////////////////////////
 
       ///////////////////////////////////////////////////////////////////
@@ -33,10 +33,10 @@ namespace zypp
       {
       public:
         /** Default ctor */
-        YUMPackageImpl( const zypp::parser::YUM::YUMPatchPackage & parsed );
+        YUMPackageImpl( const zypp::parser::yum::YUMPatchPackage & parsed );
        };
       ///////////////////////////////////////////////////////////////////
-    } // namespace YUM
+    } // namespace yum
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////
index b9c7c9d..00de328 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace source
   { /////////////////////////////////////////////////////////////////
-    namespace YUM
+    namespace yum
     {
 
       ///////////////////////////////////////////////////////////////////
@@ -32,7 +32,7 @@ namespace zypp
 
       /** Default ctor */
       YUMScriptImpl::YUMScriptImpl(
-       const zypp::parser::YUM::YUMPatchScript & parsed
+       const zypp::parser::yum::YUMPatchScript & parsed
       )
 #warning MA: CANT BE CONSTUCTED THAT WAY ANYMORE
 #if 0
@@ -56,7 +56,7 @@ namespace zypp
 
 */
       }
-    } // namespace YUM
+    } // namespace yum
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////
index 9a911d1..15d295a 100644 (file)
@@ -21,7 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace source
   { /////////////////////////////////////////////////////////////////
-    namespace YUM
+    namespace yum
     { //////////////////////////////////////////////////////////////
 
       ///////////////////////////////////////////////////////////////////
@@ -33,10 +33,10 @@ namespace zypp
       {
       public:
         /** Default ctor */
-        YUMScriptImpl( const zypp::parser::YUM::YUMPatchScript & parsed );
+        YUMScriptImpl( const zypp::parser::yum::YUMPatchScript & parsed );
        };
       ///////////////////////////////////////////////////////////////////
-    } // namespace YUM
+    } // namespace yum
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////