Skip to content

feat: error when parsing invalid paths - #158

Open
malklera wants to merge 1 commit into
beevik:mainfrom
malklera:invalid
Open

malklera wants to merge 1 commit into
beevik:mainfrom
malklera:invalid

Conversation

@malklera

Copy link
Copy Markdown

Hello and thank you for the package.

When first trying to use it, I just asked an LLM to build me an XPath to search for what I wanted, it gave me something like this //[starts-with(@id, 'replace')]

When it returned no elements, I thought that I had done something wrong, actually reading the documentation learned that the function is not supported, but then etree.MustCompilePath did not panic when I ran my program.

I actually do not know enough about XML and XPath, but the LLM tells me that tags cannot contain , ) (, so I just added a new check before defaulting to treating the filter as a tag.

Added a test to check.

Hello and thank you for the package.

When first trying to use it, I just asked an LLM to build me an XPath
to search for what I wanted, it gave me something like this
`//[starts-with(@id, 'replace')]`

When it returned no elements, I thought that I had done something
wrong, actually reading the documentation learned that the function
is not supported, but then `etree.MustCompilePath` did not panic
when I ran my program.

I actually do not know enough about XML and XPath, but the LLM
tells me that tags cannot contain `, ) (`, so I just added a new
check before defaulting to treating the filter as a tag.

Added a test to check.
@beevik

beevik commented Sep 27, 2026

Copy link
Copy Markdown
Owner

This package doesn't support the full XPath specification. It supports a smaller subset of the spec. See the documetation on etree's path syntax here. (Perhaps you can point the LLM at this documentation.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants