vscode-xml
vscode-xml copied to clipboard
XPath Evaluator has no output or unexpected output
Description The XPath evaluator does not work. If I use the output of Get Current XPath as the input for Evaluate XPath, it will create an output below with an "outputs" tab below rather than a new pane to the right. Running the same XPath evaluation causes it to simple echo the XPath expression but not show the results. After some amount of time, it seems to start working again. The list of outputs also gets filled up with XPath Results outputs, but these cannot be deleted.
It almost looks like the command never finishes processing.
Screenshots If applicable, add screenshots to help explain your problem.
Extension Version 2.5.1
VS Code Version 1.66.2
Operating System Windows
Output tab, Log (Extension Host):
[exthost] [warning] Cannot execute xmlTools.evaluateXPath because there is no active text editor
XPath Evaluator doesn't work.
XPath doesnt work
I think the current document loses "focus" after running an xpath command. If you click back into your xml editor pane and then run the xpath command it seems to work.
Steps to reproduce...
- Open xml file and click into its editor pane.
- ctrl-shift-p evaluate xpath. Enter a valid path
- Results window shows correct xpath and value.
- Repeat step 2.
- Results window shows correct xpath but no value.
- FIX.... Click into xml file editor pane.
- Repeat step 2.
- Results window shows correct xpath and value.
I believe this is a core feature and would be great to have working. I have never got it working (Windows 11 + WSL2). Then I decided to look into all log outputs and discovered this under Window:
[error] [Extension Host] [xmldom error] element parse error: Error: invalid attribute:xmlns:default:abc
@#[line:5,col:1]
So, the XML I'm looking at indeed has the namespace prefix abc
. Trying a bare XML file with no namespaces, the query works in some way, resulting in some output in the XPath Results log, but only showing the values of elements under the queried XPath.
Given:
<Party>
<Member>
<Assignee>
John
</Assignee>
<Assignee>
Mary
</Assignee>
</Member>
</Party>
Querying /Party/Member
yields:
XPath Query: /Party/Member
[Line 2] Member:
John
Mary
Try the same at https://www.freeformatter.com/xpath-tester.html#before-output, you get:
<Member>
<Assignee>
John
</Assignee>
<Assignee>
Mary
</Assignee>
</Member>
Which is the right kind of output we expect for the given query and data.