Skip to content

Commit 3f79206

Browse files
committed
* Removed all print calls and replaced with warning or message when relevant
* Add Authors@R field instead if Author and Copyright fields as per feed-back. * Add Steven Brandt as contributor as his article in Java World formed the basis of the XMl parser * Add \value tag to utils.Rd * Add single quote in Title and Description fields where required in DESCRPTION
1 parent b08bc12 commit 3f79206

File tree

11 files changed

+36
-57
lines changed

11 files changed

+36
-57
lines changed

DESCRIPTION

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
Package: xmlr
2-
Version: 0.1.1
3-
Date: 2020-05-03
4-
Title: Read, Write and Work with XML Data
5-
Author: Per Nyfelt [aut, cre]
2+
Version: 0.1.2
3+
Date: 2020-05-06
4+
Title: Read, Write and Work with 'XML' Data
5+
Authors@R: c(
6+
person("Per", "Nyfelt", email = "[email protected]", role = c("cre", "aut")),
7+
person("Alipsa HB", email = "[email protected]", role = "cph"),
8+
person("Steven", "Brandt", role = "ctb")
9+
)
610
Maintainer: Per Nyfelt <[email protected]>
7-
Copyright: Alipsa HB
811
Depends: R (>= 3.1.0)
912
Encoding: UTF-8
10-
Description: XML package for creating and reading and manipulating XML, with an object model based on Reference Classes.
13+
Description: 'XML' package for creating and reading and manipulating 'XML', with an object model based on 'Reference Classes'.
1114
License: MIT + file LICENSE
1215
URL: https://github.com/Alipsa/xmlr
1316
BugReports: https://github.com/Alipsa/xmlr/issues

NAMESPACE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export(Text)
77
export(isRc)
88
export(parse.xmlfile)
99
export(parse.xmlstring)
10-
export(printp)
11-
export(printp0)
1210
export(xmlrToDataFrame)
1311
exportClasses(AbstractClass)
1412
exportClasses(Content)

R/Document.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ Document <- setRefClass(
4545
},
4646

4747
getDocType = function() {
48-
printp("Document$getDocType() not implemented")
48+
warning("Document$getDocType() is not implemented")
4949
},
5050

5151
setDocType = function(docType) {
52-
printp("Document$setDocType(docType) not implemented")
52+
warning("Document$setDocType(docType) not implemented")
5353
},
5454

5555
toString = function() {
5656
if ("root" %in% names(content) & !is.null(content$root)) {
5757
return(paste0(content$root$toString()))
5858
}
59-
print("Attempted toString on a rootless document; There is no root element for this document")
59+
message("Attempted toString on a rootless document; There is no root element for this document")
6060
""
6161
},
6262

R/DomBuilder.R

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,24 @@ DomBuilder <- setRefClass(
1414

1515
startDocument = function() {
1616
"Event signalling parsing has begun"
17-
#print("Start document")
1817
stack <<- Stack$new()
1918
},
2019

2120
endDocument = function() {
2221
"Event signalling parsing has completed"
23-
#print("End document")
2422
doc$setRootElement(root)
2523
stack <<- NULL
26-
#printp("Parsing complete!")
2724
},
2825

2926
startElement = function(name, attributes) {
3027
"start element event; @param name the element name, @param attributes a named list of attributes"
31-
#printp("Start element", name)
3228
e <- Element$new(name)
33-
#print(str(attributes))
3429
e$setAttributes(attributes)
3530
stack$push(e)
3631
},
3732

3833
endElement = function(name) {
3934
"end element event; @param name the element name"
40-
#printp("End element", name)
4135
current <- stack$peek()
4236
if (!stack$isEmpty()) {
4337
e <- stack$pop()
@@ -53,7 +47,6 @@ DomBuilder <- setRefClass(
5347
text = function(text) {
5448
"text event; @param text the character content of the Text node"
5549
if (nchar(trimws(text)) > 0) {
56-
#printp0("Add text '", text, "'")
5750
stack$peek()$setText(text)
5851
}
5952
}

R/Element.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Element <- setRefClass(
2626
if(!is.null(name)) {
2727
m_name <<- name
2828
}
29-
#print(paste("Element created, name is", private$name))
3029
},
3130

3231
addContent = function(content) {
@@ -61,9 +60,10 @@ Element <- setRefClass(
6160
return(NULL)
6261
},
6362

64-
cloneContent = function() {
65-
printp("Element", "cloneContent()", "Not implemented, should return a list containing detached clones of this parent's content list")
66-
},
63+
#cloneContent = function() {
64+
# "should return a list containing detached clones of this parent's content list"
65+
# warning("Element", "cloneContent()", "Not implemented")
66+
#},
6767

6868
contentIndex = function(content) {
6969
"Find the position of the content in the contentList or -1 if not found"
@@ -185,7 +185,6 @@ Element <- setRefClass(
185185
"Return the first child element matching the name"
186186
for (content in contentList) {
187187
if ("Element" == class(content) & content$getName() == name) {
188-
#print(paste("Found child element", content))
189188
return (content)
190189
}
191190
}

R/Parser.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ Parser <- setRefClass(
7474
db$startDocument()
7575

7676
for (c in charVector) {
77-
#printp0(" looking at: '", c, "'")
78-
7977
# We need to map \r, \r\n, and \n to \n See XML spec section 2.11
8078
if (c == '\n' & eol) {
8179
eol <- FALSE

R/Stack.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Stack <- setRefClass(
1818
},
1919

2020
isEmpty = function() {
21-
# printp("Stack size is", size)
2221
if (m_size == 0) {
2322
return(TRUE)
2423
} else {

R/utils.R

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
#' Common utility functions
22

3-
#' @describeIn utils Simple combo of print and paste.
4-
#' @param ... all the stuff that should be printed
5-
#' @export
6-
printp <- function(...) {
7-
print(paste(...))
8-
}
9-
10-
#' @describeIn utils Simple combo of print and paste0.
11-
#' @param ... all the stuff that should be printed
12-
#' @export
13-
printp0 <- function(...) {
14-
print(paste0(...))
15-
}
16-
173
#' @describeIn utils Check if the object is a reference class, similar to isS4().
184
#' @param x the object to check
195
#' @param clazz the name of the class e.g. "Element" for the Element class.
206
#' Optional, if omitted it checks that the object is a reference class
7+
#' @return A boolean indicating whether the object \code{x} belongs to the class or not
218
#' @export
229
isRc <- function(x, clazz = "refClass") {
2310
is(x, clazz)
2411
}
2512

26-
2713
# internal
2814
notImplemented <- function(className, methodName, ...) {
29-
print(paste(paste0(className, "$", methodName), "Not implemented,", ...))
15+
warning(paste(paste0(className, "$", methodName), "Not implemented,", ...))
3016
}
3117

3218
# internal

cran-comments.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
## Resubmission
1+
## Resubmission 2
2+
This is a resubmission. In this version I have:
3+
* Removed all print calls and replaced with warning or message when relevant
4+
* Add Authors@R field instead if Author and Copyright fields as per feed-back.
5+
* Add Steven Brandt as contributor as his article in Java World formed the basis of the XMl parser
6+
* Add \value tag to utils.Rd
7+
* Add single quote in Title and Description fields where required in DESCRPTION
8+
9+
## Resubmission 1
210
This is a resubmission. In this version I have:
311
* Fixed the LICENSE to adhere to the standard template format for MIT
412

man/utils.Rd

Lines changed: 4 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)