Giter Club home page Giter Club logo

Comments (5)

beevik avatar beevik commented on May 30, 2024

One thing to keep in mind is that, unlike XPath, the etree Path library returns Element pointers instead of strings. This might make it tricky to support XPath-like queries that return attributes, since Attributes are a whole separate type in etree.

from etree.

jranson avatar jranson commented on May 30, 2024

Yeah, my initial thinking was providing a new function like GetAttribute() that accepts the Path and returns []string. Do you have any thoughts on that? Thanks for getting back to me!

from etree.

beevik avatar beevik commented on May 30, 2024

Without having given this a whole lot of thought, my first inclination would be to add FindAttribute and FindAttributes methods that return Attr pointers. This would keep them similar to FindElement and FindElements. But I'm not sure that would be very useful, since the Attr instances do not maintain any information about the element they belong to (unlike the Element instances, which know their children and parents).

What you're asking for is basically a new kind of path system that works more like XPath and less like etree Paths. Basically, you're looking for something that returns strings. Normally when people ask for this, I refer them to the xmlpath package. etree has never attempted to provide a compliant XPath implementation. The path system used by etree is more similar to the python etree module upon which I modeled it.

from etree.

beevik avatar beevik commented on May 30, 2024

Oh, one other thing. I'm going to be replacing the current etree path implementation with the code in pull request #50. I still need to optimize it, so I'm not ready to commit it yet. But if you're going to do any work on paths, you'd probably want to start there.

from etree.

beevik avatar beevik commented on May 30, 2024

Closing this issue since there has been no update for several months. Feel free to reopen if you decide to further pursue this.

from etree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.