Comments (7)
@adamdecaf is this needed on dispatch? jsoup provides css selectors and dom manipulation.
from reboot.
There are some more features that xpath has that I haven't seen in jsoup. Are they there?
http://en.wikipedia.org/wiki/XPath_2.0#Function_library
from reboot.
- XPath only works for valid documents, afaik. See this Stack Overflow Answer jsoup works on tagsoup (invalid docs).
- For selection, with the regular css3 selectors and psuedo-selectors available from jsoup, the functions listed in that table (except for the datetime transformations) are covered. Since selectors are strings, you could use joda or something to create the correct corresponding string selector.
- For manipulation, the attr('name', 'value'), text('value'), html('html'), prepend('html'), append('html'), and wrap('html') methods are easier to use than corresponding XPath transformations.
- For extraction, the attr('name'), text('name'), outerHtml(), and html() methods are easier to understand and use than the Xpath counterparts.
- For traversal, siblingElements(), firstElementSibling(), lastElementSibling(), nextElementSibling(), previousElementSibling(), parent(), children(), child(int index) are easier to understand than XPath queries that do the same thing.
- The traversal and selector methods are chainable and contextual.
IMHO selector('#someId').parent().lastElementSibling() is easier than //[id='someId']/../following-sibling[last()] or some other such nonsense.
Take it from a front-end dev that has to make interactive guis with the DOM -- selectors, attr, text, outerHtml, innerHtml, nextSibling, parent, children are way easier to use than xpath or xslt. Developers use jQuery and dom traversal to select and change things, not xpath. On top of all of that, if you use </>
on an xml document, you get all the niceties of scala native xml handling. My 2 cents.
from reboot.
Oh yes, I agree that whenever developers can use DOM selection, traversal, etc.. that they should always do that. However, not every legacy application will be able to do that. I'll close this for any future reference.
from reboot.
Right, but using </> they get a NodeSeq, and that allows them to use xpath,
right? If they move their application to reboot, it is a small change for
their application that is less invasive than Promises, imho.
On Thu, Mar 28, 2013 at 8:41 AM, Adam Shannon [email protected]:
Oh yes, I agree that whenever developers can use DOM selection, traversal,
etc.. that they should always do that. However, not every legacy
application will be able to do that. I'll close this for any future
reference.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/47#issuecomment-15588753
.
from reboot.
It lets them do similar things as xpath (and jsoup). They'll still have to deal with promises though. Unless I'm missing what you're saying?
from reboot.
@adamdecaf I don't think so. What I was saying was basically that switching the handler verb is less of an invasive refactor as modifying the application to deal with Promises correctly.
from reboot.
Related Issues (20)
- Upgrade lift-json module for Lift 3.1.0
- Provide plain-english alternatives to every method in the symbolic DSL
- Bump to AHC to 2.0.33
- Possible domain / group id change HOT 4
- Implement implicit vs explicit verb setting
- Cross-build / abstract against AHC HOT 1
- Investigate different thread allocation semantics under the hood
- Please publish a version for Scala 2.13.0-RC1 HOT 15
- sbt eviction notice HOT 1
- Incorrect UriEncoding of emoji characters HOT 1
- setting request body with << changes method from PUT to POST HOT 6
- Requesting URLs with custom parameters is not possible HOT 6
- Emoji character in domains not recognized correctly (punycode) HOT 1
- Emoji character in domains not recognized correctly (punycode) HOT 8
- Rename primary branch HOT 1
- Add support for Scala 2.13 HOT 1
- Add support for Dotty HOT 5
- Update scala-xml dependency to version 2
- Set up dependency update for this repository
- Snapshots are not deployed to sonatype HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reboot.