Skip to content
This repository has been archived by the owner on Nov 12, 2017. It is now read-only.

link to listviewer issue requesting this functionality #1

Open
timelyportfolio opened this issue Jan 12, 2016 · 8 comments
Open

link to listviewer issue requesting this functionality #1

timelyportfolio opened this issue Jan 12, 2016 · 8 comments

Comments

@timelyportfolio
Copy link
Contributor

So glad you decided to do this. I thought I should link this issue in listviewer timelyportfolio/listviewer#2 which requests related functionality.

@hrbrmstr
Copy link
Owner

i cld (prbly easily) put an xpath input box at the top and have it
dynamically filter the results. so much for it being a tiny pkg :-)

On Tue, Jan 12, 2016 at 2:50 PM, timelyportfolio [email protected]
wrote:

So glad you decided to do this. I thought I should link this issue in
listviewer timelyportfolio/listviewer#2
timelyportfolio/listviewer#2 which requests
related functionality.


Reply to this email directly or view it on GitHub
#1.

@timelyportfolio
Copy link
Contributor Author

Maybe as an option, but I certainly don't think you want an input box by default on all xml_view. Also, Shiny gives us a good option here.

#devtools::install_github("hrbrmst/xmlview")

library(xmlview)
library(shiny)
library(xml2)

xmld <- xml(paste0(
  "<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
  "<body>Don't forget me this weekend!</body></note>"
))

ui <- fluidPage(
  fluidRow(
    column(6, textInput('xpath1','xpath')),
    column(6, xmlviewOutput('xmlview1'))
  )
)

server <- function(input, output, session){
  output$xmlview1 <- renderXmlview({
    if(input$xpath1 == ""){
      xml_view(xmld)
    } else {
      xml_view(xml_find_all(xmld,input$xpath1))
    }
  })
}

shinyApp(ui,server)

@hrbrmstr
Copy link
Owner

actually, take a look at v0.2.0 (just pushed). basic XPath filtering (there's a new option to xml_view to use a filter bar). no need for shiny for this. I just need to tweak the interface a bit and also do some error messaging for invalid XPath. This cld be a pretty helpful tool for making decent XPath :-)

@hrbrmstr
Copy link
Owner

I'll have to deal with namespaces soon, but it's on a gd trajectory.

@timelyportfolio
Copy link
Contributor Author

Very nice, just tried it out. Works great in RStudio Viewer and Chrome but not Firefox. I left some line notes about the use of id. Let me know if you would like a pull request to illustrate use of class instead. Great work!

@hrbrmstr
Copy link
Owner

It gets "ugh" with large XML docs but I modified it so the parsing happens
only once. The XML that gets stuck into <pre><code> isn't actually XML,
so there's pretty much no chance of it getting confused (just tried it but
will rig up some tests to validate my assumption). I also parse the
passed-in XML outside document and only look for the XPath inside that
external object, so there shldn't be confusion. Again, a test suite shld
help validate.

On Tue, Jan 12, 2016 at 9:55 PM, timelyportfolio [email protected]
wrote:

Very nice, just tried it out. Works great in RStudio Viewer and Chrome. I
left some line notes about the use of id. Let me know if you would like a
pull request to illustrate use of class instead.


Reply to this email directly or view it on GitHub
#1 (comment).

@hrbrmstr
Copy link
Owner

I've relied on Bootstrap/Foundation & jQuery for so long that keeping with
vanilla JS and basic CSS is proving to be a fun exercise, too :-)

On Tue, Jan 12, 2016 at 9:58 PM, boB Rudis [email protected] wrote:

It gets "ugh" with large XML docs but I modified it so the parsing happens
only once. The XML that gets stuck into <pre><code> isn't actually XML,
so there's pretty much no chance of it getting confused (just tried it but
will rig up some tests to validate my assumption). I also parse the
passed-in XML outside document and only look for the XPath inside that
external object, so there shldn't be confusion. Again, a test suite shld
help validate.

On Tue, Jan 12, 2016 at 9:55 PM, timelyportfolio <[email protected]

wrote:

Very nice, just tried it out. Works great in RStudio Viewer and Chrome. I
left some line notes about the use of id. Let me know if you would like
a pull request to illustrate use of class instead.


Reply to this email directly or view it on GitHub
#1 (comment).

@timelyportfolio
Copy link
Contributor Author

I can imagine big XML docs cause some trouble in creation and filtering.

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

No branches or pull requests

2 participants