[rkward-cvs] SF.net SVN: rkward-code:[4541] trunk/rkward/packages/XiMpLe

m-eik at users.sf.net m-eik at users.sf.net
Tue Feb 19 22:26:42 UTC 2013


Revision: 4541
          http://sourceforge.net/p/rkward/code/4541
Author:   m-eik
Date:     2013-02-19 22:26:41 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
XiMpLe: new methods XMLScan() and XMLScan()<- (the latter isn't working yet...)

Modified Paths:
--------------
    trunk/rkward/packages/XiMpLe/ChangeLog
    trunk/rkward/packages/XiMpLe/DESCRIPTION
    trunk/rkward/packages/XiMpLe/NAMESPACE
    trunk/rkward/packages/XiMpLe/R/XiMpLe-package.R
    trunk/rkward/packages/XiMpLe/R/zzz_is_get_utils.R
    trunk/rkward/packages/XiMpLe/debian/changelog
    trunk/rkward/packages/XiMpLe/debian/control
    trunk/rkward/packages/XiMpLe/debian/copyright
    trunk/rkward/packages/XiMpLe/debian/rules
    trunk/rkward/packages/XiMpLe/inst/CITATION
    trunk/rkward/packages/XiMpLe/inst/NEWS.Rd
    trunk/rkward/packages/XiMpLe/inst/doc/XiMpLe_vignette.pdf
    trunk/rkward/packages/XiMpLe/man/XMLGetters-methods.Rd
    trunk/rkward/packages/XiMpLe/man/XiMpLe-package.Rd

Modified: trunk/rkward/packages/XiMpLe/ChangeLog
===================================================================
--- trunk/rkward/packages/XiMpLe/ChangeLog	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/ChangeLog	2013-02-19 22:26:41 UTC (rev 4541)
@@ -1,5 +1,10 @@
 ChangeLog for package XiMpLe
 
+changes in version 0.03-19 (2013-02-19)
+added:
+  - new methods XMLScan() and XMLScan()<- to search an XML tree recursively
+    for appearances of certain node names
+
 changes in version 0.03-18 (2013-02-11)
 changed:
   - renamed getter methods from getXML*() into the more generic XML*()
@@ -10,8 +15,8 @@
 changes in version 0.03-17 (2013-02-04)
 added:
   - added proper is.XiMpLe.node() and is.XiMpLe.doc() functions
-  - added getter functions for all slots in XiMpLe.node and XiMpLe.doc objects
-    (e.g., getXMLName() to get the name slot of a XiMpLe.node object)
+  - added getter functions for all slots in XiMpLe.node and XiMpLe.doc
+    objects (e.g., getXMLName() to get the name slot of a XiMpLe.node object)
 
 changes in version 0.03-16 (2012-11-05)
 added:

Modified: trunk/rkward/packages/XiMpLe/DESCRIPTION
===================================================================
--- trunk/rkward/packages/XiMpLe/DESCRIPTION	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/DESCRIPTION	2013-02-19 22:26:41 UTC (rev 4541)
@@ -19,8 +19,8 @@
 URL: http://reaktanz.de/?c=hacking&s=XiMpLe
 Authors at R: c(person(given="Meik", family="Michalke",
     email="meik.michalke at hhu.de", role=c("aut", "cre")))
-Version: 0.03-18
-Date: 2013-02-11
+Version: 0.03-19
+Date: 2013-02-19
 Collate:
     'XiMpLe-internal.R'
     'XiMpLe.node-class.R'

Modified: trunk/rkward/packages/XiMpLe/NAMESPACE
===================================================================
--- trunk/rkward/packages/XiMpLe/NAMESPACE	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/NAMESPACE	2013-02-19 22:26:41 UTC (rev 4541)
@@ -14,6 +14,7 @@
 exportMethods("XMLDecl<-")
 exportMethods("XMLFile<-")
 exportMethods("XMLName<-")
+exportMethods("XMLScan<-")
 exportMethods("XMLValue<-")
 exportMethods("node<-")
 exportMethods(XMLAttrs)
@@ -22,6 +23,7 @@
 exportMethods(XMLDecl)
 exportMethods(XMLFile)
 exportMethods(XMLName)
+exportMethods(XMLScan)
 exportMethods(XMLValue)
 exportMethods(node)
 exportMethods(pasteXML)

Modified: trunk/rkward/packages/XiMpLe/R/XiMpLe-package.R
===================================================================
--- trunk/rkward/packages/XiMpLe/R/XiMpLe-package.R	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/R/XiMpLe-package.R	2013-02-19 22:26:41 UTC (rev 4541)
@@ -3,8 +3,8 @@
 #' \tabular{ll}{
 #' Package: \tab XiMpLe\cr
 #' Type: \tab Package\cr
-#' Version: \tab 0.03-18\cr
-#' Date: \tab 2013-02-11\cr
+#' Version: \tab 0.03-19\cr
+#' Date: \tab 2013-02-19\cr
 #' Depends: \tab R (>= 2.9.0),methods\cr
 #' Enhances: \tab rkward\cr
 #' Encoding: \tab UTF-8\cr

Modified: trunk/rkward/packages/XiMpLe/R/zzz_is_get_utils.R
===================================================================
--- trunk/rkward/packages/XiMpLe/R/zzz_is_get_utils.R	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/R/zzz_is_get_utils.R	2013-02-19 22:26:41 UTC (rev 4541)
@@ -284,3 +284,104 @@
 		return(obj)
 	}
 )
+
+## scan a tree for appearances of nodes
+#' @rdname XMLGetters-methods
+#' @exportMethod XMLScan
+setGeneric("XMLScan", function(obj, name) standardGeneric("XMLScan"))
+
+# internal helper function
+find.nodes <- function(nodes, nName, res){
+	for (thisNode in nodes){
+			if(identical(XMLName(thisNode), nName)){
+				res <- append(res, thisNode)
+			} else if(length(XMLChildren(thisNode)) > 0){
+				res <- append(res, find.nodes(XMLChildren(thisNode), nName=nName, res=res))
+			} else {}
+		}
+	return(res)
+}
+
+#' @rdname XMLGetters-methods
+#' @aliases
+#'		XMLScan,-methods
+#'		XMLScan,XiMpLe.node-method
+#' @docType methods
+#' @include XiMpLe.node-class.R
+setMethod("XMLScan",
+	signature=signature(obj="XiMpLe.node"),
+	function(obj, name){
+		node.list <- find.nodes(
+			nodes=child.list(obj),
+			nName=name,
+			res=list())
+		return(node.list)
+	}
+)
+
+#' @rdname XMLGetters-methods
+#' @aliases
+#'		XMLScan,XiMpLe.doc-method
+#' @docType methods
+#' @include XiMpLe.doc-class.R
+setMethod("XMLScan",
+	signature=signature(obj="XiMpLe.doc"),
+	function(obj, name){
+		node.list <- find.nodes(
+			nodes=XMLChildren(obj),
+			nName=name,
+			res=list())
+		return(node.list)
+	}
+)
+
+#' @rdname XMLGetters-methods
+#' @exportMethod XMLScan<-
+setGeneric("XMLScan<-", function(obj, name, value) standardGeneric("XMLScan<-"))
+
+# internal helper function
+replace.nodes <- function(nodes, nName, replacement){
+	nodes <- sapply(nodes, function(thisNode){
+			if(identical(XMLName(thisNode), nName)){
+				return(replacement)
+			} else if(length(XMLChildren(thisNode)) > 0){
+				return(replace.nodes(child.list(XMLChildren(thisNode)), nName=nName, replacement=replacement))
+			} else {
+				return(thisNode)
+			}
+		})
+	return(nodes)
+}
+
+#' @rdname XMLGetters-methods
+#' @aliases
+#'		XMLScan<-,-methods
+#'		XMLScan<-,XiMpLe.node-method
+#' @docType methods
+#' @include XiMpLe.node-class.R
+setMethod("XMLScan<-",
+	signature=signature(obj="XiMpLe.node"),
+	function(obj, name, value){
+		obj <- replace.nodes(
+			nodes=child.list(obj),
+			nName=name,
+			replacement=value)
+		return(obj)
+	}
+)
+
+#' @rdname XMLGetters-methods
+#' @aliases
+#'		XMLScan<-,XiMpLe.doc-method
+#' @docType methods
+#' @include XiMpLe.doc-class.R
+setMethod("XMLScan<-",
+	signature=signature(obj="XiMpLe.doc"),
+	function(obj, name, value){
+		obj <- replace.nodes(
+			nodes=XMLChildren(obj),
+			nName=name,
+			replacement=value)
+		return(obj)
+	}
+)

Modified: trunk/rkward/packages/XiMpLe/debian/changelog
===================================================================
--- trunk/rkward/packages/XiMpLe/debian/changelog	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/debian/changelog	2013-02-19 22:26:41 UTC (rev 4541)
@@ -1,3 +1,9 @@
+r-other-reaktanz-ximple (0.03-19-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- m.eik michalke <meik.michalke at hhu.de>  Tue, 19 Feb 2013 23:21:06 +0000
+
 r-other-reaktanz-ximple (0.03-18-1) unstable; urgency=low
 
   * new upstream release

Modified: trunk/rkward/packages/XiMpLe/debian/control
===================================================================
--- trunk/rkward/packages/XiMpLe/debian/control	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/debian/control	2013-02-19 22:26:41 UTC (rev 4541)
@@ -1,4 +1,4 @@
-Source: r-other-rkward-ximple
+Source: r-other-reaktanz-ximple
 Section: math
 Priority: optional
 Maintainer: m.eik michalke <meik.michalke at hhu.de>
@@ -6,7 +6,7 @@
 Standards-Version: 3.9.3.1
 Homepage: http://reaktanz.de/?c=hacking&s=XiMpLe
 
-Package: r-other-rkward-ximple
+Package: r-other-reaktanz-ximple
 Architecture: all
 Section: math
 Depends: r-base (>= 2.15.0)

Modified: trunk/rkward/packages/XiMpLe/debian/copyright
===================================================================
--- trunk/rkward/packages/XiMpLe/debian/copyright	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/debian/copyright	2013-02-19 22:26:41 UTC (rev 4541)
@@ -3,7 +3,7 @@
 This Debian package was put together m.eik michalke <meik.michalke at hhu.de>.
 
 The package was renamed from its upstream name 'XiMpLe' to
-'r-other-rkward-ximple' in harmony with the R packaging policy to indicate
+'r-other-reaktanz-ximple' in harmony with the R packaging policy to indicate
 that the package is external to the CRAN or BioC repositories.
 
 XiMpLe Copyright (C) 2013 Meik Michalke, released under the

Modified: trunk/rkward/packages/XiMpLe/debian/rules
===================================================================
--- trunk/rkward/packages/XiMpLe/debian/rules	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/debian/rules	2013-02-19 22:26:41 UTC (rev 4541)
@@ -1,9 +1,9 @@
 #!/usr/bin/make -f
 #								-*- makefile -*-
-# debian/rules file for the Debian/GNU Linux r-other-rkward-ximple package
+# debian/rules file for the Debian/GNU Linux r-other-reaktanz-ximple package
 # Copyright 2013 by m.eik michalke <meik.michalke at hhu.de>
 
-debRreposname := other-rkward
+debRreposname := other-reaktanz
 
 include /usr/share/R/debian/r-cran.mk
 

Modified: trunk/rkward/packages/XiMpLe/inst/CITATION
===================================================================
--- trunk/rkward/packages/XiMpLe/inst/CITATION	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/inst/CITATION	2013-02-19 22:26:41 UTC (rev 4541)
@@ -2,12 +2,12 @@
 		title="XiMpLe: A simple XML tree parser and generator",
 		author="Meik Michalke",
 		year="2013",
-		note="(Version 0.03-18)",
+		note="(Version 0.03-19)",
 		url="http://reaktanz.de/?c=hacking&s=XiMpLe",
 
 		textVersion =
 		paste("Michalke, M. (2013). ",
-				"XiMpLe: A simple XML tree parser and generator (Version 0.03-18). ",
+				"XiMpLe: A simple XML tree parser and generator (Version 0.03-19). ",
 				"Available from http://reaktanz.de/?c=hacking&s=XiMpLe",
 				sep=""),
 

Modified: trunk/rkward/packages/XiMpLe/inst/NEWS.Rd
===================================================================
--- trunk/rkward/packages/XiMpLe/inst/NEWS.Rd	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/inst/NEWS.Rd	2013-02-19 22:26:41 UTC (rev 4541)
@@ -1,6 +1,14 @@
 \name{NEWS}
 \title{News for Package 'XiMpLe'}
 \encoding{UTF-8}
+\section{Changes in XiMpLe version 0.03-19 (2013-02-19)}{
+  \subsection{added}{
+    \itemize{
+      \item new methods \code{XMLScan()} and \code{XMLScan()}<- to search an XML tree recursively
+        for appearances of certain node names
+    }
+  }
+}
 \section{Changes in XiMpLe version 0.03-18 (2013-02-11)}{
   \subsection{changed}{
     \itemize{
@@ -18,8 +26,8 @@
   \subsection{added}{
     \itemize{
       \item added proper \code{is.XiMpLe.node()} and \code{is.XiMpLe.doc()} functions
-      \item added getter functions for all slots in XiMpLe.node and XiMpLe.doc objects
-        (e.g., \code{getXMLName()} to get the name slot of a XiMpLe.node object)
+      \item added getter functions for all slots in XiMpLe.node and XiMpLe.doc
+        objects (e.g., \code{getXMLName()} to get the name slot of a XiMpLe.node object)
     }
   }
 }

Modified: trunk/rkward/packages/XiMpLe/inst/doc/XiMpLe_vignette.pdf
===================================================================
(Binary files differ)

Modified: trunk/rkward/packages/XiMpLe/man/XMLGetters-methods.Rd
===================================================================
--- trunk/rkward/packages/XiMpLe/man/XMLGetters-methods.Rd	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/man/XMLGetters-methods.Rd	2013-02-19 22:26:41 UTC (rev 4541)
@@ -38,6 +38,14 @@
 \alias{XMLName,-methods}
 \alias{XMLName<-,XiMpLe.node-method}
 \alias{XMLName,XiMpLe.node-method}
+\alias{XMLScan}
+\alias{XMLScan<-}
+\alias{XMLScan<-,-methods}
+\alias{XMLScan,-methods}
+\alias{XMLScan<-,XiMpLe.doc-method}
+\alias{XMLScan,XiMpLe.doc-method}
+\alias{XMLScan<-,XiMpLe.node-method}
+\alias{XMLScan,XiMpLe.node-method}
 \alias{XMLValue}
 \alias{XMLValue<-}
 \alias{XMLValue<-,-methods}

Modified: trunk/rkward/packages/XiMpLe/man/XiMpLe-package.Rd
===================================================================
--- trunk/rkward/packages/XiMpLe/man/XiMpLe-package.Rd	2013-02-19 18:46:33 UTC (rev 4540)
+++ trunk/rkward/packages/XiMpLe/man/XiMpLe-package.Rd	2013-02-19 22:26:41 UTC (rev 4541)
@@ -8,8 +8,8 @@
 }
 \details{
   \tabular{ll}{ Package: \tab XiMpLe\cr Type: \tab
-  Package\cr Version: \tab 0.03-18\cr Date: \tab
-  2013-02-11\cr Depends: \tab R (>= 2.9.0),methods\cr
+  Package\cr Version: \tab 0.03-19\cr Date: \tab
+  2013-02-19\cr Depends: \tab R (>= 2.9.0),methods\cr
   Enhances: \tab rkward\cr Encoding: \tab UTF-8\cr License:
   \tab GPL (>= 3)\cr LazyLoad: \tab yes\cr URL: \tab
   http://reaktanz.de/?c=hacking&s=XiMpLe\cr }





More information about the rkward-tracker mailing list