Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
r2ogs6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
OpenGeoSys Tools
r2ogs6
Commits
b48d8314
Commit
b48d8314
authored
4 years ago
by
Ruben Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
[feature] Altered so NULL values do not get printed
parent
ca868ff5
No related branches found
No related tags found
2 merge requests
!4
7 parameter
,
!2
Basic import and export functionality
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/export_utils.R
+13
-9
13 additions, 9 deletions
R/export_utils.R
with
13 additions
and
9 deletions
R/export_utils.R
+
13
−
9
View file @
b48d8314
#'to_node
#'@description Recursive function to restructure objects so xml2::as_xml_document()
#' function will convert them to the desired XML format
#'@param object An object (so far works for r2ogs6 class objects, strings, numbers, lists and vectors)
#'@description Recursive function to restructure objects so
#' xml2::as_xml_document() function will convert them to the desired XML format
#'@param object An object (so far works for r2ogs6 class objects, strings,
#' numbers, lists and vectors)
#'@param object_name Optional: The object name. If not supplied, this function
#' will try to guess the tag name by deparsing the 'object' parameter
#'@param attribute_names Optional: A character vector containing names of attributes
#' or attribute nodes
#'@param flatten_on_exp Optional: This is for vectors which will be flattened to a string in XML
#'@param attribute_names Optional: A character vector containing names of
#' attributes or attribute nodes
#'@param flatten_on_exp Optional: This is for vectors which will be flattened
#' to a string in XML
to_node
<-
function
(
object
,
object_name
=
""
,
attribute_names
=
character
(),
flatten_on_exp
=
character
()){
...
...
@@ -88,9 +90,11 @@ to_node <- function(object, object_name = "",
#Handle depending on if it's a child or attribute
if
(
is.list
(
param_node
)){
object_node
[[
1
]][[
length
(
object_node
[[
1
]])
+1
]]
<-
param_node
object_node
[[
1
]][[
length
(
object_node
[[
1
]])
+1
]]
<-
param_node
}
else
{
attr
(
object_node
[[
1
]],
names
(
param_node
)[[
1
]])
<-
param_node
[[
1
]]
attr
(
object_node
[[
1
]],
names
(
param_node
)[[
1
]])
<-
param_node
[[
1
]]
}
}
return
(
invisible
(
object_node
))
...
...
@@ -112,4 +116,4 @@ to_node <- function(object, object_name = "",
return
(
invisible
(
object_node
))
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment