[rkward-cvs] SF.net SVN: rkward:[4399] trunk/rkward/packages/XiMpLe/R

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Tue Oct 30 15:59:37 UTC 2012


Revision: 4399
          http://rkward.svn.sourceforge.net/rkward/?rev=4399&view=rev
Author:   m-eik
Date:     2012-10-30 15:59:36 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------
XiMpLe: adding some examples

Modified Paths:
--------------
    trunk/rkward/packages/XiMpLe/R/XMLNode.R
    trunk/rkward/packages/XiMpLe/R/XMLTree.R
    trunk/rkward/packages/XiMpLe/R/parseXMLTree.R
    trunk/rkward/packages/XiMpLe/R/pasteXMLTag.R

Modified: trunk/rkward/packages/XiMpLe/R/XMLNode.R
===================================================================
--- trunk/rkward/packages/XiMpLe/R/XMLNode.R	2012-10-30 13:12:37 UTC (rev 4398)
+++ trunk/rkward/packages/XiMpLe/R/XMLNode.R	2012-10-30 15:59:36 UTC (rev 4399)
@@ -14,6 +14,10 @@
 #' @param .children Alternative way of specifying children, if you have them already as a list.
 #' @return An object of class XiMpLe.node
 #' @export
+#' @examples
+#' sample.XML.node <- XMLNode("a",
+#'   attrs=list(href="http://example.com", target="_blank"),
+#'   .children="klick here!")
 
 XMLNode <- function(name, ..., attrs=NULL, namespace="", namespaceDefinitions=NULL, .children=list(...)){
 

Modified: trunk/rkward/packages/XiMpLe/R/XMLTree.R
===================================================================
--- trunk/rkward/packages/XiMpLe/R/XMLTree.R	2012-10-30 13:12:37 UTC (rev 4398)
+++ trunk/rkward/packages/XiMpLe/R/XMLTree.R	2012-10-30 15:59:36 UTC (rev 4399)
@@ -10,6 +10,18 @@
 #' @param .children Alternative way of specifying children, if you have them already as a list.
 #' @return An object of class XiMpLe.doc
 #' @export
+#' @examples
+#' sample.XML.a <- XMLNode("a",
+#'   attrs=list(href="http://example.com", target="_blank"),
+#'   .children="klick here!")
+#' sample.XML.body <- XMLNode("body", .children=list(sample.XML.a))
+#' sample.XML.html <- XMLNode("html", .children=list(XMLNode("head", ""),
+#'   sample.XML.body))
+#' sample.XML.tree <- XMLTree(sample.XML.html,
+#'   xml=list(version="1.0", encoding="UTF-8"),
+#'   dtd=list(doctype="html PUBLIC",
+#'     id="-//W3C//DTD XHTML 1.0 Transitional//EN",
+#'     refer="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"))
 
 XMLTree <- function(..., xml=NULL, dtd=NULL, .children=list(...)){
 

Modified: trunk/rkward/packages/XiMpLe/R/parseXMLTree.R
===================================================================
--- trunk/rkward/packages/XiMpLe/R/parseXMLTree.R	2012-10-30 13:12:37 UTC (rev 4398)
+++ trunk/rkward/packages/XiMpLe/R/parseXMLTree.R	2012-10-30 15:59:36 UTC (rev 4399)
@@ -17,6 +17,10 @@
 #'				(text value between a pair of start/end tags, if found).}
 #'		}
 #' @export
+#' @examples
+#' \dontrun{
+#' sample.XML.object <- parseXMLTree("~/data/sample_file.xml")
+#' }
 
 parseXMLTree <- function(file, drop=NULL, object=FALSE){
 	if(isTRUE(object)){

Modified: trunk/rkward/packages/XiMpLe/R/pasteXMLTag.R
===================================================================
--- trunk/rkward/packages/XiMpLe/R/pasteXMLTag.R	2012-10-30 13:12:37 UTC (rev 4398)
+++ trunk/rkward/packages/XiMpLe/R/pasteXMLTag.R	2012-10-30 15:59:36 UTC (rev 4399)
@@ -24,6 +24,12 @@
 #'		"<", ">" and "&" in attribute values. For comment or CDATA tags, if the text includes newline characters
 #'		they will also be indented.
 #' @export
+#' @examples
+#' sample.XML.tag <- pasteXMLTag("a",
+#'   attr=list(href="http://example.com", target="_blank"),
+#'   child="klick here!",
+#'   empty=FALSE)
+
 pasteXMLTag <- function(tag, attr=NULL, child=NULL, empty=TRUE, level=1, allow.empty=FALSE, rename=NULL, shine=2, indent.by="\t", tidy=TRUE){
 	# what attributes do we have?
 	all.attributes <- pasteXMLAttr(attr, tag=tag, level=level, rename=rename, shine=shine, indent.by=indent.by, tidy=tidy)

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list