[rkward-cvs] [rkward] packages/XiMpLe: allowing for empty attributes in XML nodes, and fixing the ChangeLog

m.eik michalke meik.michalke at uni-duesseldorf.de
Tue Dec 2 13:48:29 UTC 2014


Git commit 52757445cda5f3b5f0116ce8938d33dc4e118377 by m.eik michalke.
Committed on 01/12/2014 at 21:15.
Pushed by meikm into branch 'master'.

allowing for empty attributes in XML nodes, and fixing the ChangeLog

M  +5    -1    packages/XiMpLe/ChangeLog
M  +7    -9    packages/XiMpLe/R/XiMpLe-internal.R

http://commits.kde.org/rkward/52757445cda5f3b5f0116ce8938d33dc4e118377

diff --git a/packages/XiMpLe/ChangeLog b/packages/XiMpLe/ChangeLog
index 24abb28..7afb927 100644
--- a/packages/XiMpLe/ChangeLog
+++ b/packages/XiMpLe/ChangeLog
@@ -1,6 +1,10 @@
 ChangeLog for package XiMpLe
 
-changes in version 0.03-22 (2014-03-05)
+changes in version 0.03-22 (2014-12-02)
+changed:
+  - allowing empty attributes (attr=""), these were skipped, but only if there was more than one attribute
+
+changes in version 0.03-21 (2013-12-21)
 added:
   - new attribute "as.list" added to XMLScan(), if TRUE forces the return
     value to be a list of length 1 (default is still to directly return the
diff --git a/packages/XiMpLe/R/XiMpLe-internal.R b/packages/XiMpLe/R/XiMpLe-internal.R
index b1978dc..47f591b 100644
--- a/packages/XiMpLe/R/XiMpLe-internal.R
+++ b/packages/XiMpLe/R/XiMpLe-internal.R
@@ -211,15 +211,13 @@ pasteXMLAttr <- function(attr=NULL, tag=NULL, level=1, rename=NULL, shine=2, ind
     for (this.attr in names(attr)){
       # skip empty elements
       if(is.null(attr[[this.attr]])){next}
-      if(nchar(attr[[this.attr]]) > 0){
-        if(!is.null(rename)){
-          # look up attribute name to paste
-          attr.name <- lookupAttrName(tag, this.attr, rename=rename)
-        } else {
-          attr.name <- this.attr
-        }
-        full.attr <- trim(paste0(full.attr, new.attr, new.indent, attr.name, "=\"", attr[[this.attr]], "\""))
-      } else {}
+      if(!is.null(rename)){
+        # look up attribute name to paste
+        attr.name <- lookupAttrName(tag, this.attr, rename=rename)
+      } else {
+        attr.name <- this.attr
+      }
+      full.attr <- trim(paste0(full.attr, new.attr, new.indent, attr.name, "=\"", attr[[this.attr]], "\""))
     }
   } else {
     if(!is.null(rename)){





More information about the rkward-tracker mailing list