vscode-xml icon indicating copy to clipboard operation
vscode-xml copied to clipboard

XPath Evaluator has no output or unexpected output

Open don01001000 opened this issue 2 years ago • 5 comments

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

don01001000 avatar Apr 22 '22 18:04 don01001000

Output tab, Log (Extension Host): [exthost] [warning] Cannot execute xmlTools.evaluateXPath because there is no active text editor

RyuuOujiXS avatar Jul 15 '22 05:07 RyuuOujiXS

XPath Evaluator doesn't work.

ipaint avatar Oct 12 '22 01:10 ipaint

XPath doesnt work

justinpenguin45 avatar Sep 26 '23 22:09 justinpenguin45

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...

  1. Open xml file and click into its editor pane.
  2. ctrl-shift-p evaluate xpath. Enter a valid path
  3. Results window shows correct xpath and value.
  4. Repeat step 2.
  5. Results window shows correct xpath but no value.
  6. FIX.... Click into xml file editor pane.
  7. Repeat step 2.
  8. Results window shows correct xpath and value.

ewen-r avatar Dec 15 '23 09:12 ewen-r

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.

schivmeister avatar Mar 29 '24 15:03 schivmeister