goxpath: An XPath 1.0 parser

377 views
Skip to first unread message

Chris Trenkamp

unread,
Jun 12, 2016, 7:49:04 PM6/12/16
to golang-nuts
https://github.com/ChrisTrenkamp/goxpath

I've created an XPath 1.0 parser.  The only thing missing is the id() function for complicated reasons.  It also comes with a command-line utility that works like xmlstarlet, except it only has XPath queries.

Looking for feedback.  Let me know if you find this useful.

Henrik Johansson

unread,
Jun 13, 2016, 2:27:30 AM6/13/16
to Chris Trenkamp, golang-nuts
How does it compare to https://godoc.org/launchpad.net/xmlpath?
I have been using it with great satisfaction but it is not complete to my knowledge xpath feature wise.
 

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gustavo Niemeyer

unread,
Jun 13, 2016, 10:57:25 AM6/13/16
to Henrik Johansson, Chris Trenkamp, golang-nuts
Please note that the xmlpath package actually lives at:


--

Chris Trenkamp

unread,
Jun 13, 2016, 5:33:49 PM6/13/16
to golang-nuts, ch...@christrenkamp.com
I've never used xmlpath, so I can't really compare them.

However, I can talk about some of the design goals:
  • Provide a flexible-enough API so you can write your own functions in XPath expressions.
  • Abstract the tree to an interface so that not only can XML documents be parsed, but other document types as well.  Since I started this project, I've been wanting to provide support for XML-tagged structs.
  • Be XPath 1.0 compliant.

sea...@arista.com

unread,
Jun 14, 2017, 8:40:12 AM6/14/17
to golang-nuts
I've been doing some work on goxpath to use it to evaluate xpath expressions used in YANG. One issue I just hit is the XSLT current() function is used in the YANG files, this fails to evaluate as current() isn't included in the implementation. Did you consider it at all ?

Lutz Horn

unread,
Jun 14, 2017, 8:52:23 AM6/14/17
to golan...@googlegroups.com
Hi,
* Are you talking about https://github.com/ChrisTrenkamp/goxpath?
* What is YANG?
* Whom do you address as "you"?

Regards

Lutz

sea...@arista.com

unread,
Jun 14, 2017, 9:57:56 AM6/14/17
to golang-nuts
Yes referring to https://github.com/ChrisTrenkamp/goxpath

YANG is a data modelling language, that may use XML to represent the data stored in a model. Valid relationship between nodes can be expresses as XPATH expressions. These XPATH expression sometimes use current(), for example:

/acl/acl-sets/acl-set[name=current()/../../../../set-name][type=current()/../../../../type]/acl-entries/acl-entry/sequence-id

You would be Chris Trenkamp.


Lutz Horn

unread,
Jun 14, 2017, 10:25:08 AM6/14/17
to golan...@googlegroups.com
Hi,

Am 14.06.2017 15:57 schrieb seamus via golang-nuts:
> Yes referring to https://github.com/ChrisTrenkamp/goxpath
> ...
> You would be Chris Trenkamp.

Then you will probably get better answers if you open an issue on this
GitHub project. The people here on go-nuts did not write this library
nor can they tell you what the current status of it is.

Regards

Lutz

Jim Robinson

unread,
Jun 14, 2017, 11:41:54 AM6/14/17
to golang-nuts, lutz...@posteo.de
Since he was the initial author of this thread you're replying to, it does seem reasonable enough to also raise the question here. :)
Reply all
Reply to author
Forward
0 new messages