Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creation and mutation of elements, attrs etc #9

Closed
hadley opened this issue Feb 20, 2015 · 13 comments
Closed

Allow creation and mutation of elements, attrs etc #9

hadley opened this issue Feb 20, 2015 · 13 comments

Comments

@hadley
Copy link
Member

hadley commented Feb 20, 2015

If you need this, please 👍 this issue with a brief use case

@jordansread
Copy link

👍 I would use this to 1) build xml for POSTs 2) modify svg elements or programmatically build interactive svgs.

@jennybc
Copy link
Member

jennybc commented Mar 20, 2015

👍 In googlesheets, which wraps the Google Sheets API, we have a function to edit cells in the sheet. The workflow is this: fetch the current cell contents, then edit specific values in the XML, send back via POST. Right now we're using the XML package but I'd rather be using this package.

@jennybc
Copy link
Member

jennybc commented Mar 21, 2015

My first use case was of creating XML sort of de novo. I just found another one that's more of a true mutate. And our current workflow is to just use regex substitution 😳 If this were easier in one of the XML packages, like yours, I'd much prefer to do that.

@timelyportfolio
Copy link

👍 I do this all the time especially with SVG from gridSVG and dev.svg where I might change height, width, viewBox, style attributes. Also, I'm trying to work through a solution namespacing the ids of letters/text from dev.svg in the case where there are multiple separately rendered graphics on the page.

@sjp
Copy link
Contributor

sjp commented Apr 13, 2015

To add to what @timelyportfolio mentioned, it would be nice to be able to build up an image in gridSVG using something other than XML. I suspect that xml2 could greatly improve the performance of SVG image generation.

Additionally, I've been making changes to selectr so that it has plugin packages for XML and xml2. Supporting creation/mutation would be useful because the plugin packages might be good for manipulating scraped data. The same applies for rvest.

@npjc
Copy link

npjc commented May 9, 2015

👍

  • I've done all sorts of crazyness playing with R-bindings of Snap.svg. when it doesn't explode it's very powerful!

@npjc
Copy link

npjc commented May 10, 2015

Say you want to take this vignette and modify/enhance it so that when you hover over each function it displays the function's Arguments documentation (so that if past you has been less explicit than present you would like you can make sense of what's what without having to open up your IDE).

  • functions are wrapped with a <span> of class kw
  • create a related <table> element that contains the Arguments and their explanation
  • default this element with a style such that it is hidden
  • add :hover style behaviour to reveal!

if you could...

h_con <- 'http://cran.r-project.org/web/packages/dplyr/vignettes/data_frames.html'
modified_html <- h_con %>% read_html() %>%  ...

where ... is some combination of ?

node_select() # == rvest::html_node() 
nodes_select() # == rvest::html_nodes() 
node_mutate()
nodes_mutate()
nodes_create()
... and friends?

@cdiener
Copy link

cdiener commented Oct 21, 2015

👍

We use xml2 to handle biochemical reaction models for Systems Biology described in SBML (http://sbml.org). Writing those models to disk is kind of crucial for reproducible research so it would be nice feature avoid writing all the tags etc. by hand.

@renkun-ken
Copy link
Contributor

My use case is to batch create a group of xml configurations to deploy to server programs. The xml contains some nodes with simple structure just like typical configuration files.

@cboettig
Copy link

👍 I'm working on several packages designed to assist researchers both consume and publish datasets with XML-based metadata standards (e.g. EML, NeXML). The basic idea is that it's much easier to discover interesting datasets when you can search a big pool of them over interesting metadata fields. The data repository managers have made fancy tools to do the search and discovery, but pretty much no one wants to write up their metadata in XML. Such R packages would let users turn nice familiar R structures into the required XML easily; complementing the current use case of xml2 as a way to turn XML data into nice R structures. This helps researchers share & organize their own data according to existing standards, rather than just be consumers.

@jennybc
Copy link
Member

jennybc commented Oct 26, 2015

Just recording something already conveyed via email ...

An xml2 option for XML creation and mutation would be a welcome improvement over XML, specifically in terms of better handling of encoding.

And, for that matter, hopefully xml2 would also make it easier to finesse namespaces when creating XML (see e.g. this SO thread).

@imanuelcostigan
Copy link

Use case for me: reading in XML file containing market data, modifying values and attributes to represent "simulated" market data and write modified XML back out for use by another system

@jimhester
Copy link
Member

Closed by #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests