Skip to main content

Questions tagged [xpath]

The primary purpose of XPath is to address parts of an XML document. It also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax. XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax.

7 votes
2 answers
16k views

Using SQL Server 2005's XQuery select all nodes with a specific attribute value, or with that attribute missing

Update: giving a much more thorough example. The first two solutions offered were right along the lines of what I was trying to say not to do. I can't know location, it needs to be able to look at ...
phloopy's user avatar
  • 5,563
6 votes
5 answers
7k views

Flatten XML to HTML table

There must be a generic way to transform some hierachical XML such as: <element1 A="AValue" B="BValue"> <element2 C="DValue" D="CValue"> <element3 E="EValue1" F="FValue1"/> ...
user avatar
15 votes
7 answers
38k views

Get list of XML attribute values in Python

I need to get a list of attribute values from child elements in Python. It's easiest to explain with an example. Given some XML like this: <elements> <parent name="CategoryA"> ...
roomaroo's user avatar
  • 5,871
-1 votes
4 answers
2k views

How do get element out of xml file

I get an XML file From a web service. Now I want to get one of those elements out of the file. I think I should go use XPath - any good starter reference?
nslindtner's user avatar
4 votes
2 answers
706 views

Getting The XML Data Inside Custom XPath function

Is there a way to get the current xml data when we make our own custom XPath function (see here). I know you have access to an XPathContext but is this enough? Example: Our XML: <foo> <...
SCdF's user avatar
  • 58.7k
8 votes
5 answers
25k views

Match conditionally upon current node value

Given the following XML: <current> <login_name>jd</login_name> </current> <people> <person> <first>John</first> <last>Doe</last>...
Pierre Spring's user avatar
3 votes
2 answers
5k views

How to load an xml string in the code behind to databound UI controls that bind to the XPath of the XML?

Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the ...
Vin's user avatar
  • 6,145
5 votes
1 answer
9k views

Count the number of nodes that match a given XPath expression in XmlSpy

I am using XmlSpy to analyze an xml file, and I want to get a quick count of the number of nodes that match a given xpath. I know how to enter the XPathand get the list of nodes, but I am really just ...
pkaeding's user avatar
  • 37.3k
40 votes
3 answers
27k views

Can XPath match on parts of an element's name?

I want to do this: //*fu which returns all nodes whose name ends in fu, such as <tarfu /> and <snafu />, but not <fubar />
user avatar
10 votes
5 answers
7k views

Can I create a value for a missing tag in XPath?

I have an application which extracts data from an XML file using XPath. If a node in that XML source file is missing I want to return the value "N/A" (much like the Oracle NVL function). The trick is ...
JPLemme's user avatar
  • 4,474
16 votes
3 answers
12k views

How do I select an XML-node based on its content?

How can I use XPath to select an XML-node based on its content? If I e.g. have the following xml and I want to select the <author>-node that contains Ritchie to get the author's full name: &...
Cros's user avatar
  • 4,367
12 votes
4 answers
10k views

XPath and Selecting a single node

I'm using XPath in .NET to parse an XML document, along the lines of: XmlNodeList lotsOStuff = doc.SelectNodes("//stuff"); foreach (XmlNode stuff in lotsOStuff) { XmlNode stuffChild = stuff....
FlySwat's user avatar
  • 175k
17 votes
5 answers
11k views

XPATHS and Default Namespaces

What is the story behind XPath and support for namespaces? Did XPath as a specification precede namespaces? If I have a document where elements have been given a default namespace: <foo xmlns="...
t3rse's user avatar
  • 10.1k
3 votes
5 answers
455 views

Regex Rejecting matches because of Instr

What's the easiest way to do an "instring" type function with a regex? For example, how could I reject a whole string because of the presence of a single character such as :? For example: this - ...
t3rse's user avatar
  • 10.1k
263 votes
11 answers
387k views

How to use XPath in Python?

What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?
user avatar

15 30 50 per page
1
2629 2630 2631 2632
2633