question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XPath command does not display resulting xml results

See original GitHub issue

I will reference the BNF grammar below to make the description of the issue as precise as possible:

[39] element ::= EmptyElemTag | STag content ETag [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*

In general terms the BNF grammar for xml defines that an element is defined as a “start tag” followed by some “content” followed by an “end tag”.

When executing the xpath command where the resulting element’s content is “CharData”, the results are displayed accurately.

However when executing the xpath command where the resulting element’s content is another “element” the results take an odd display form. It appears to be a value printout instead of displaying the snippet of xml.

Consider the sample xml:

<giftBasket>
    <apple>Macintosh</apple>
    <apple>Granny Smith</apple>
    <oranges>
        <origin>florida</origin>
        <quantity>3</quantity>
    </oranges>
</giftBasket>

If you run an xpath on //apple you will get the following for the displayed results (good): [Line 2] apple: Macintosh [Line 3] apple: Granny Smith

However if you run an xpath on //oranges you will get the following odd result displayed (bad): [Line 4] oranges: florida 3

What I think should be displayed is: [Line 4] oranges:

<oranges>
        <origin>florida</origin>
        <quantity>3</quantity>
 </oranges>

I will say it would also be nice if the results initially just displayed as a list of results that were collapsed with pluses on the left hand side of each result. Clicking the plus itself would show the snippet of xml where as clicking anywhere else in the row that is displaying the line number would bounce the cursor to that line number in the file. In this way the results pane for the xpath expression would be very useful.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
chebilhajercommented, Jun 11, 2018

Hello, I have the same problem. It will be useful to diplay the results as an xml tree. Will this issue be treated ?

Thank you

0reactions
tkazikcommented, Sep 24, 2021

still an issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: xpath not giving result - Splunk Community
Solved: I want to extract NewValue when Network Settings is International Roaming Bar. Tried with | xpath outfield=NewValue.
Read more >
xPath expression doesn't result expected value - Stack Overflow
I'm using it just to redirect to the correct response on SOAP UI depending on request. It's just for testing purposes on development...
Read more >
Evaluate XPath in the Linux Command Line | Baeldung on Linux
Learn how to evaluate XPath expressions using xmllint, XMLStarlet, and xidel.
Read more >
Evaluating XPath Expressions | Using XML Tools
Using the XPath Results ... An XPath expression can return a subtree of the XML document, multiple subtrees, or a scalar result. The...
Read more >
XML and XPath - W3Schools
XPath is a major element in the XSLT standard. With XPath knowledge you will be able to take great advantage of XSL. XPath...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found