xpath

Do something only on distinct XML nodes

Hello. I'm having hard times in triggering an xsl action only on distinct values. Here's an excerpt of my XML file: <?xml version="1.0" encoding="UTF-8" ?> <Doc Data="February 2010"> <Title>Title 1</Title> <Subject>Subject 1</Subject> </Doc> <Doc Data="January 2010"> <Title>Title 2</Title> <Subject>Subject 2</Subject> </Doc...

Finding unique nodes with xslt

I have an xml document that contains some "Item" elements with ids. I want to make a list of the unique Item ids. The Item elements are not in a list though - they can be at any depth within the xml document - for example: <Node> <Node> <Item id="1"/> <Item id="2"/> </Node> <Node> <Item id="1"/> <Node> <It...

XSLT & XPath: how to change XML file in the most effective way?

Hi guys, I'm a newbie in XSLT & XPath so please forgive me for this simple question. I have the following XML file: <?xml version="1.0"?> <Configuration serviceName="Just Service" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"&gt; <Page name="Books"> <Instances count="5" /> ...

implementation of xpath injection attack...

xpath injection is an attack targeting the websites, where xpath queries are built from user supplied data.Here, Attacker can get the entire xml document without the complete knowledge. How exactly the attack takes place? How can we implement this attack? Thank you ...

Tool to convert from SQL to XPath

Is anyone aware of a tool which can convert from SQL to an XPath query? Thanks. This is a data-warehousing project. We like the idea of storing the data in XML because it's a common data format and lends itself to a search optimization strategy built on DB2. We have found a nice front-end tool for visualization and data mining that gene...

'OR' operator in XPath predicate ?

Hi, What is the XPath expression to select <link> elements with type="application/rss+xml" OR type="application/atom+xml" (RSS and Atom feeds) link[@rel='alternate'][@type='application/rss+xml'] selects RSS feeds link[@rel='alternate'][@type='application/atom+xml'] selects Atom feeds But what is the single XPath expression for selec...

How to extract website information using XPath inside firefox extension?

Hello, I have made a firefox extension which loads a web page using xmlhttprequest. My extension has it's own window opened alongside the main Firefox. The idea of my extension is to load a webpage in memory, modify it and publish in newly opened tab in firefox. The webpage has a div with id "Content". And that's the div i want to mo...

skip certain objects in xml feed using php

I am using php xpath to get the values from the below xml feed and php the function. <FOUND> <IMAGES> <IMAGE> <SMALL>images/small.jpg</SMALL> <MED>images/med.jpg</MED> <LARGE>images/large.jpg</LARGE> <EXTRAL>images/extra.jpg</EXTRAL> </IMAGE> <IMAGE> <SMALL>images1/small.jpg</SMALL> ...

Problem with DOMXPath query in PHP

I have a got piece of HTML code: <form method="post" action="/"> <input type="hidden" name="example-name" value="example-value"> <button type="submit">Submit</button> </form> How can I extract value of the hidden input using DOMXPath in PHP? I have tried somethig like this: //$site - the html code $doc = new DOMDocument(); $doc->...

Xpath Sorting from XML Document

I have a Xml Document and it is contains some date datas like; <Message> <messagetext>Testing purpose only</messagetext> <date>05.02.2010</date> </Message> I want them sorted with a XPath key, how can I get if anyone knows about pls help me thanks all regards ...

Can I use 'and' operator in xsl for-each?

Simply can I execute the following in xsl? <xsl:for-each select="trip/instance[.!=''] and trip/result[.!='']"> </xsl:for-each> Q: When I use select="" in for-each does it change the scope of my selector for the code I use inside for-each? ...

Prototyping selenium Xpath paths in Firefox

I'm using selenium in my test suite, but since it's slow to set up, I'd like to prototype my xpaths on live pages, rather than waiting for tests to run. Is there a good way to do this? Firebug's $x xpath seems to not work very well jQuery doesn't seem to support Xpath selectors natively, though it used to in version 1.2. using the nati...

How do you get PL/SQL to parse XML attributes instead of XML elements in Oracle?

Please see PL/SQL snippets below: create table t23 ( field01 number, field02 number, field03 char(1) ); Example Snippet #1 declare x varchar2(2000) := ' <ArrayOfRecords> <Record> <Field01>130</Field01> <Field02>1700</Field02> <Field03>C</Field03> </Record> <Record> <Field01>131</Field01> <Field02>1701</Field02> <...

How do you use the --pattern option of xmllint?

I'm trying to see how libxml implements XPath support, so it made sense to me to test using xmllint. However, the obvious option, --pattern, is somewhat obscure, and I ended up using something like the following: test.xml: <foo><bar/><bar/></foo> > xmllint --shell test.xml / > dir /foo ELEMENT foo / > dir /foo/* ELEMENT bar ELEMENT b...

How can I return a specific node when there are different selection criteria/depths with xpath?

Given the following XML, <root> <property> <programs> <program>1</program> <program>5</program> </programs> <tool> </tool> </property> <property> <tool> <programs> <program>1</program> <program>2</program> ...

XmlNode.SelectSingleNode returns element outside current ?

Hi, my problem is like this.Let's say i have xml like this <roor> <child Name = "child1"> <element1>Value1</element1> <element2>Value2</element2> </child> <child Name = "child2"> <element1>Value1</element1> <element2>Value2</element2> <element3>Value3</element3> </child> </root> I have a method that gets as parameter...

Getting certain attribute value using XPath

From the following HTML snippet: <link rel="index" href="/index.php" /> <link rel="contents" href="/getdata.php" /> <link rel="copyright" href="/blabla.php" /> <link rel="shortcut icon" href="/img/all/favicon.ico" /> I'm trying to get the href value of the link tag with rel value = "shortcut icon", I'm trying to achieve that using XPa...

jQuery xPath selector, &&

I'm using jQuery to run through all the inputs within a section that I have set from hidden to show, and add required calsses, so as to catch the validation. $("#" + dependant).find("input[type!='radio']").addClass('required'); Works fine, but I also want to exclude the submits. In normal xPath I would; input[type!='radio' and type!=...

xslt php select the first sibling and all its child nodes

How does one select the first sibling of a xml node with all its child nodes and apply some transformations on it? So far I only succeeded in selected either the first sibling and only the first sibling (no child nodes that is) or everything following the xml node. Say we have xhtml like this: <div class="chapter">Chapter <span class="...

How to read large xml file without loading it in memory and using XElement

I want to read a large xml file (100+M). Due to its size, I do not want to load it in memory using XElement. I am using linq-xml queries to parse and read it. What's the best way to do it? Any example on combination of XPath or XmlReader with linq-xml/XElement? Please help. Thanks. ...