Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XPath Evaluator has no output or unexpected output #377

Open
don01001000 opened this issue Apr 22, 2022 · 5 comments
Open

XPath Evaluator has no output or unexpected output #377

don01001000 opened this issue Apr 22, 2022 · 5 comments

Comments

@don01001000
Copy link

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

@RyuuOujiXS
Copy link

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

@ipaint
Copy link

ipaint commented Oct 12, 2022

XPath Evaluator doesn't work.

@justinpenguin45
Copy link

XPath doesnt work

@ewen-r
Copy link

ewen-r commented Dec 15, 2023

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.

@schivmeister
Copy link

schivmeister commented Mar 29, 2024

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.

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

No branches or pull requests

6 participants