Comments (5)
How about xmlquery and htmlquery? this xpath
package only works for XPath not provides DOM manipulate.
https://pkg.go.dev/golang.org/x/net/html#Node
from xpath.
I don't quite understand what you are suggestion here. Maybe you can try explaining in Chinese? I understand that there is a similar request at antchfx/xmlquery#38, but I don't need xmlquery, but xpath. So,
Can we at least Expose the following *Node related helper functions first pls?
Lines 654 to 659 in cd2afb8
If there are other helper functions, like AddAttr
, AddChild
, AddSibling
, RemoveFromTree
. Would it be OK to expose them as well?
As I understand that xpath is a pure subset of xmlquery, so if xmlquery can do functions like AddAttr
, AddChild
, AddSibling
, RemoveFromTree
, then I see no reason why xpath cannot. Or, better yet, maybe letting xpath and xmlquery share the same xml node handling function is not a bad idea, since they are so similar.
from xpath.
They said that XPath 1.0 is only focus on selection, but XPath 2.0's focus has been shifted to XML manipulation. I may have not express it well, but I don't need dom manipulation, I only need functions like AddAttr
, AddChild
, AddSibling
, RemoveFromTree
, onto the given located xpath node(s).
from xpath.
Sorry for I didn't make it clear.
XPath
is a document query package, it helps you easy find some matched in your document like HTML, XML, JSON and other document and don't need understand your DOM package. In htmlquery
and xmlquery
and jsonquery
they are all implemented NodeNavigator
interface, that means you can create owned DOM and supports XPATH query.
for example, you have a HTML document. when you get the returned HTML node, you can also do some other operations in your DOM package: AddAttribute, AppendChild,
for example:
node:= htmlquery.FindOne(doc,"//div")
node.AddAttribute("class","link") // in here, we assume HTML node have a AddAttribute() method.
node2:= htmlquery.FindOne(doc,"//div[@class='link']"
createChildNode
and addAttribute
in the xpath_test.go
file are just convenient for testing.
from xpath.
Ah, make sense. thx!
from xpath.
Related Issues (20)
- `Compile` didn't report error in predicate HOT 1
- `normalize-space()` should be equal to `normalize-space(.)`
- Discussion: Provide `NodeNavigator` interface to get native data HOT 12
- The multiple filter query with `last()` function HOT 1
- How to use this in rust HOT 1
- string comparison size error HOT 1
- How get the xpath of selected html elem? HOT 1
- How to concatenate json values? HOT 2
- Thank you HOT 1
- stateful interface is cumbersome when performing multiple xpath queries on one document HOT 1
- The multiple filter query with last() and concat() function HOT 3
- How to "zip" two lists together? HOT 1
- Can you give some examples of usage of node axes? ex:getting the matching values of previous sibling and next sibling HOT 1
- why is panic used instead of returning errors? HOT 10
- /descendant::span[1] should not be equivalent to //span[1] HOT 1
- [CHANGES] remove the duplicate element when the query node-set has duplicate element
- xpath `lower-case()` function
- Converting an empty node set to a number should return NaN HOT 1
- memory leak or endless loop in v1.3.0 HOT 5
- Is it possible to create an xpath expression with non-Latin letters? 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 xpath.