xpath

Using not() in XPath

Hi! I would like how to use the "not" in XPath properly. I just can't seem to get it to work with attributes. Say I have this expression: //*[@name = 'Bob'] It is valid, and will return all nodes that have a name attribute equaling 'Bob'. Now if I want all nodes that have a name attribute that do not equal 'Bob', I need to use an XPat...

Is there any tool to validate @XmlPath annotations ?

Is there any tool to validate @XmlPath annotations used from MOXy JAXB at a specific xml file at compile time from Eclipse or IntelliJIdea java framework or something else? ...

Using XPATH to access XML elements (was: Good tutorial to learn xpath)

I am trying to learn XPath. The theory seems extremely simple, except for the fact that it doesn't work. I am trying to get the content of every target element XPathDocument doc = new XPathDocument(sPath); XPathNavigator nav = doc.CreateNavigator(); XPathExpression expr; expr = nav.Compile("/doc/file/body/trans-unit/target"); XPathNode...

PHP XPATH Mind Melt

Really simple xpath call but I am having a mindblock. My XML file looks like this <?xml version="1.0"?> <books> <book>bob</book> </books> I want do an XPATH call to find the node with the value of bob whcih seems to work but whenever I put a no exsistent book value in, it still returns the node of bob. My XPATH Query is /books/b...

XPath attribute quoting in JavaScript

I am trying to build a function that will properly quote/escape an attribute in XPath. I have seen solutions posted in C# here and here, but my implementation in JavaScript results in an error "This expression is not a legal expression" Here is my function: function parseXPathAttribute(original){ let result = null; ...

Selecting siblings between two nodes using XPath

How would I select all the tables between the table whose id is header_completed and the first table after the header_completed one that has an align of center? Here is the html I am selecting it from: <table border="0" cellpadding="0" cellspacing="0" width="920" align="center"></table> <table border="0" cellpadding="0" cellspacing="0" ...

XPath expression to select text not in paragraph

I'm deveoping web scraping scoftware that relies on XPath to extract information from web pages. One application of the software is to scrape reviews of shows from websites. One page I'm trying to scrape is the Guardian's latest Edinburgh festival reviews: http://www.guardian.co.uk/culture/edinburghfestival+tone/reviews The section I w...

XSL sort functionality

<xsl:apply-templates select="$tempPosterItemNodeSet/CurrentPosterItemCollection/PosterItem" mode="PosterItem"> <xsl:sort select="$tempPosterItemNodeSet/CurrentPosterItemCollection/PosterItem/Property[@name='WidgetID']" data-type="number"/> </xsl:apply-templates> I need to xslt sort a nodeset that I am passing ...

am I right about what these XPath expressions mean?

Hi, this is for school, if you know your XPath and wouldn't mind telling me if I'm correct: 1. //a[/b]/a every 'a' that has a parent 'a' in a tree where the root is 'b'. (the location of the [/b] is irrelevant? i.e. is the above equivalent to //a/a[/b] ? 2. //*[//a]//a[/a][a] breaking it down from left to right: //*[//a] means all el...

How to check whether an element name contains a specific string?

The source document like this: <a> <b n=n1n1n1n1> <c1> drftgy </c1> </b> <c2> dddd </c2> </a> how to check if the element name = c then we will do something... ...

XML + XPATH: Any way to work with a default Namespace?

I have a XML SOAP result: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <soap:Body> <CreateCIInStockResponse xmlns="http://somenamespace.com/"&gt; ...

XSL select all node where not node of another node

Thse is my xml <element1> <subel1/> </element1> <element2> <subel2/> </element2> <element3> <subel3/> </element3> <criteria> <subel3/> </criteria> how i can select all node with xsl that not are in criteria subnodes? like these <subel1/> <subel2/> How is this done? If the xml is formated as: <element1> <el> subel1 </el> </eleme...

How can I insert the greater- and less-than characters into an XML file modified by WiX during install?

I'm using WiX to author a Windows Installation database for my application. I've got an XML file that is installed along with my app, which needs to be filled with information obtained during installation. The WiXUtilExtension tags util:XmlFile and util:XmlConfig are great ways to do this, in principle, but they don't quite solve my prob...

Navigate HTML table columns with XPath 1.0

Using only an XPath expression (and not in XSLT or DOM - just pure XPath), I'm trying to create a relative path from the current node (in a td) to an associated td in the same column of the same HTML table. For example, suppose I have this type of data: <table> <tr> <td><a>Blue Jeans</a></td> <td><a>Shirt</a></td> </tr> <tr> <td><s...

Selecting a child text node amongst white space text nodes, in a complex XML element using XPath

Hello, I've been racking my brain over this but can't seem to get it right, and I'm not hitting the correct keywords on Google.. I've recently started to play around with XSLT and XPath to create an XML description of natural language glossaries – for a project of mine. The problem is that I have chosen to use 'mixed content' compl...

Axes.SelectItems() with DateTime based query?

Is it possible to do a date based query using xpath syntax? Everything I have researched inidicates that this is not possible. I am querying a group of calendars and only want to bring back a month's worth of data - what strategies could I use to accomplish this? 8/10/2010: Edit for more information I am building a notification system ...

In XSL, how do I select a value, based on multiple attributes?

This has got to be a very basic question, but I'm really struggling with a solution. From the following XML, I'm trying to extract the first instance only, when I have a match on the tag="099" and the code="a" attributes in a marc:datafield node, and a marc:subfield node, respectively <?xml version="1.0" encoding="UTF-8" ?> <marc:colle...

XPath results from XSLT are incorrect - not going through entire XML

Hi! So I have a really confusing problem on my hands.. It seems as though that the entire XML data hierarchy is not being searched through when using an XPath expression in XSL. Some dummy XML data: <pets name="myPets" NUM="2"> <dog name="allMyDogs" NUM="5"> <dog name="Frank" NUM="3"/> <dog name="Spot" NUM="4"/...

XPath query to parse xml properties file

I have the following xml document: <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"&gt; <properties> <comment>My Happy Configuration</comment> <entry key="HappyKey">Happy Key</entry> <entry key="SadKey">Sad Key</entry> <entry key="AngryKey">Angry Key</entry> <entry key="ConfusedKey">Co...

cURL & XPath to display href anchor text?

The following PHP code uses cURL, XPath and displays all the links on a certain page ($target_url). ** What I'm trying to do is figure out how to display only the the anchor text (the linked words in an href) on a given page when I supply the website value. For example...I want to search "randomwebsite.com" to see if there is a lin...