xpath « xpath « Java XML Q&A

Home
Java XML Q&A
1.convert
2.Development
3.document
4.dom
5.dom4j
6.dtd
7.element
8.jaxb
9.jaxp
10.jdom
11.jsoup
12.namespace
13.Node
14.parse
15.parser
16.pdf
17.sax
18.schema
19.stax
20.tag
21.transform
22.Validation
23.xalan
24.xmlbeans
25.xpath
26.xsd
27.xslt
28.xstream
Java XML Q&A » xpath » xpath 

1. not strict xpath for java    stackoverflow.com

do you know any not strict xpath for java? (I want it to not check dtd and schema) and it would be cool if it dont care about correct xml.

2. Which XPathAPI should I use in Java 1.5?    stackoverflow.com

I have been using com.sun.org.apache.xpath.internal.XPathAPI for some time and it seems to work ok. Recently I tried to use the TPTP profiler in Eclipse but it could not find the XPathAPI ...

3. how to skip well-formedness check XML    stackoverflow.com

I am using Xpath (and java) to extract information from some websites. However my problem is that since some of these websites are not well-formed, I cannot process them. Is there ...

4. Evaluating XPath Commands with java    stackoverflow.com

Hi I have an xml document like this

<root>
  <cert id="1">

  </cert>
  <cert id="2">

  </cert>
  <cert id="3">

  </cert>
</root>
now I get a request and want to select ...

5. Search in xpath    stackoverflow.com

Suppose this is the xml:

<lib>
<books type="paperback" name="A" />
<books type="pdf" name="B" />
<books type="hardbound" name="A" />
</lib>
What will be the xpath code to search for book of type="paperback" and name="A"? TIA. Currently my code looks ...

6. How to traverse XPath recursively?    stackoverflow.com

is there a way (and if so, how ?) to traverse a XPath query recursively ? I have an AST in Java with the following scenario

@Relevant
public void foo() {
   bar(true);
}

public ...

7. xpath to get rows inside a table    stackoverflow.com

I have a html table like:

<table ..... class="cars">

<tr class="item-odd">
...
</tr>
<tr class="item-even">
</tr>

</table>
How could I get the table rows using xpath?
//tr[contains(@class, ???)
can I use OR in there somehow to say item-odd|item-even

8. Casting an Integer to a Double in XPath 1.0    stackoverflow.com

I am currently building a XML based Jasper Report in which I am trying to add a tax percent onto the cost. A problem occurs when I use sum(//net-total) to value calculate ...

9. Don't understand why I am getting this - 'Error: Value storage corrupted: negative offset'    stackoverflow.com

I just started using IntelliJ-IDEA, and I don't know if the problem resides with the IDE or not. I'm assuming not but I have no idea. I've spent quite a lot ...

10. obtaining a unique set with javas xpath    stackoverflow.com

Given the following xml document (assuming more books then actually listed) and using the java implementation of xpath. What expression would I use to find a unique set of author names?

<inventory>
  ...

11. Xpath and variables    stackoverflow.com

i have an xpath expression that search a static value, in this example 'test'

XPathExpression expr = xpath.compile("//doc[contains(., 'test')]/*/text()");
How to pass a variable instead of a fixed text ? i use java ...

12. Stuck with XPath    stackoverflow.com

Can somebody find what is wrong with this code. It always returns o nodes no matter whatever XPath I chose

DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true);
domFactory.setIgnoringComments(true);
domFactory.setIgnoringElementContentWhitespace(true);

DocumentBuilder builder = domFactory.newDocumentBuilder();
Document dDoc = builder.parse("P:/MyBooks.xml");
NodeList myNodes = ...

13. XPath: How to implement XpathResolver correctly    stackoverflow.com

I want to use XPath to filter information from an XML.

XPathFactory factory = XPathFactory.newInstance();
     XPath xpath = factory.newXPath();
     Object result = null;
 ...

14. XPath NodeSet in Java    stackoverflow.com

I have this code in eclipse

NodeSet nodes = (NodeSet) xPath.evaluate(expression,inputSource, XPathConstants.NODESET);
and its giving me compile time error on NodeSet. These are the stuff that I have imported. Can you tell me ...

15. What am I doing wrong with XPath?    stackoverflow.com

I am trying to manipulate xsd schema as an xml document that should not be a problem, I believe. But facing troubles with XPath. Whatever XPath I try, it returns nothing. ...

16. Java XML DSig and XPath    stackoverflow.com

I'm signing part of an XML document using the Java XML DSig api. I'm trying to understand how it is arriving at the Digest value. My document is:

<?xml version=\"1.0\" encoding=\"UTF-8\"?><PurchaseOrder><foo>bar</foo></PurchaseOrder>
My xpath ...

17. IE9 selectSingleNode missing from beta, how to overcome this in JavaScript?    stackoverflow.com

XMLDocument object in Internet Explorer 9 does not contain definition for selectSingleNode Xpath-based traversal anymore. Of course, I googled a little and came across this thread, where it is unsure is it ...

18. using xpath in java to go through this list?    stackoverflow.com

i have an xml file that contains lots of different nodes. some in particularly are nested like this:

 <emailAddresses>
            <emailAddress>
 ...

19. XPath not working out correctly    stackoverflow.com

I have the following Java code working with XPath to get data from XML elements. The first time the expression is evaulated in title, it works as it should. But the ...

20. how to read multiple children from xml    stackoverflow.com

in my project we use xpath to extract values from xml for example:

String AntLid = "/DokxAPI/DokxReply/ReplyBody/Service-Impact-Rep/AntLid/text()";
Now the xml got changed like it has max of 13 children to one lid list some thing like ...

21. A case-insensitive related implementation problem    stackoverflow.com

I am going through a final refinement posted by the client, which needs me to do a case-insesitive query. I will basically walk through how this simple program works. First of all, ...

22. XML, XPATH adding values    stackoverflow.com

i have XML files which contain records with the following structure:

<xml>
   <payment contractType="1">
     <income type="0">
       <gr code="1" amount="1506.00"/>
  ...

23. How do I get the package of a local variable declaration in PMD and XPath?    stackoverflow.com

My problem

I want to create a custom ruleset for PMD that finds all declared variables that use a specific package. And it should be a XPath ruleset, because that ...

24. Talend tExtractXMLField    stackoverflow.com

I have this job in Talend that is supposed to retrieve a field and loop through it. My big problem is that the code is looping through the XML fields but it's ...

25. Jackrabbit dateformat for comparison    stackoverflow.com

I am using Jackrabbit to store my documents. Now I would like to search for documents that were created e.g. after a specific date using XPATH. To do so, I tried ...

26. Factory Pattern within XPath    stackoverflow.com

I'm trying to implement an XSL-Stylesheet that accesses a toString()-Method of a TextExtractor. The parser I'm using is Saxon9HE. Simple Classdiagram:

AbstractText
+toString() : String
Factory
+load(String uri) : AbstractText // Returns a instance of a ...

27. In Cognos Java SDK, how do I filter a report response with XPATH?    stackoverflow.com

In Cognos Java SDK, how do I filter a report response with XPATH so that it looks like this:

<filterresultset xmlns="http://www.ibm.com/xmlns/prod/cognos/layoutData/200904">
 <filterresult>
  <filtertype>XPATH</filtertype>
  <filtervalue>/document/pages/page/body/item/lst/group/row/cell/item/txt/val</filtervalue>
  <reportelement>
   <val></val>
  ...

28. does JDK 6 support all features of XPath 2.0?    stackoverflow.com

like for, sum, if, intersect...and if not, or not entirely, where can I find the details? And if it does, where can I find an official confirmation?

29. how to update the xml using xpath in java    stackoverflow.com

I am having one xml and and xpath for the same xml.Now i have to update this xml by using the xpath at the run time. How can i do it..? I ...

30. XPath produces garbled output instead of Unicode characters    stackoverflow.com

I am parsing this XML file:

<?xml version="1.0" encoding="UTF-8"?>

<tests>
    <test category="???????"/>
    <test category="????????"/>
    <test category="??"/>
    <test category="English"/>
</tests>
Main class is:
import java.io.File;
import ...

31. How to avoid adding XMLNS when using using Java XML Transformer?    stackoverflow.com

In JAVA I copy nodes from one XML document to another new document using importNode. In original document there is an xmlns defined, but in output document I would like to ...

32. Open Source XPath Filter 2.0 implementation    stackoverflow.com

Does anyone know of an open source implementation for XPath Filter 2.0, preferrably in Java? But any other language would also be fine. The standard is not that new, ...

33. How does XPath "evaluate" method work?    stackoverflow.com

I want to understand a difference between execution of evaluation when-

  1. Document object's setNameSpaceAware and isValidating is set to true- In this case, I understand that if my XML uses a namespace, ...

34. TagSoup and XPath    stackoverflow.com

I'm trying to use TagSoup with XPath (JAXP). I know how to obtain SAX parser from TagSoup (or XMLReader). But I failed to find how to create DocumentBuilder that will use ...

35. Using Both Tagged And Untagged Data With XPath    stackoverflow.com

I'm trying to parse some HTML using XPath in Java. Consider this HTML:

    <td class="postbody"> 
        <img src="...""><br />
<br />
<b>What is ...

36. Xpath memory leak?    stackoverflow.com

There appears to be a memory leak when using the standard Java library (1.6.0_27) for evaluating XPath expressions. See below for some code to reproduct this problem:

public class XpathTest {

   ...

37. sorting in XPath using Java    stackoverflow.com

I am using XML in my project for data to be Insert/Update/Delete & Searching. currently i am using XPath for doing the above operations from my JAVA application. How can i sort ...

38. java XPath api reference    stackoverflow.com

The java standard tutorial http://download.oracle.com/javase/tutorial/jaxp/xslt/xpath.html explains the XPath standard itself but not the java api for XPath. I need:
1) I know XPath syntax, that is how to reference /person/dateofbirth ...

39. XPath dealing with intermixed content    stackoverflow.com

How to extract the text of such an element via XPath:

<document>
  some text
     <subelement>subelement text</subelement>
  postscript
</document>
The XPath expression:
/document
returns document node text and all its ...

40. Java XPath interpreting '-' as minus with GUIDs    stackoverflow.com

I'm writing an XPath expression in Java, and am trying to grab all elements with a particular GUID. Basically, I'm doing: (NodeList) xpath.evaluate("//object[guid=" + guid + "]", objectDoc, XPathConstants.NODESET); with a GUID:

eb52a56c-2a16-4256-ab0c-523cb6d19a3f
XPath throws ...

41. Get specific XML Subvalues with Commons Configuration    stackoverflow.com

Lets say we have the following XML:

<root>
    <sub>
        <id>1</id>
        <values>
     ...

42. xml Xpath    bytes.com

43. XPath Problem    coderanch.com

Book-1 $50.00 Book-2 Book-3 $100.00 ------------------------------------------------------- Description: What I want to do is create a set of "Book" nodes then use XPath to extract book data from each Book Node and match book titles with prices. ------------------------------------------------------- import org.xml.sax.SAXException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; ...

44. XPath Problem    coderanch.com

Book-1 $50.00 Book-2 Book-3 $100.00 ------------------------------------------------------- Description: What I want to do is create a set of "Book" nodes then use XPath to extract book data from each Book Node and match book titles with prices. ------------------------------------------------------- import org.xml.sax.SAXException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; ...

45. Problem in XPath    coderanch.com

hi, Is there any condition to parse a XML file by using XPath APIs? I have a .xml file with the following heading ( it is .xpdl file generated from BPMN). .... <....> .... ... ..... The Above file is not parseing. My codeing is XPath ...

46. org.apache.xpath cannot be resolved    coderanch.com

47. Getting the result from xpath+using interfaces    coderanch.com

Dear All, I am trying to get the results from an xpath excpression but the problem is i do not know how to get it in a nodeset , nodelist or even a normal list the only thing that is working is a String , so i get only one output String projectStatements = (String) xpath.evaluate(stmtExpr, inputSource, XPathConstants.STRING ); when i ...

48. Cant run sample Xpath example    coderanch.com

49. XPath problem    coderanch.com

public XML(String uri) throws MalformedURLException, IOException { URL url = new URL(uri); inputStream = url.openStream(); public NodeList getXpathNodeList (String xPathFilter) { XPath xpath = XPathFactory.newInstance().newXPath(); InputSource inputSource = new InputSource(this.inputStream); // get nodes with the topic PowerBuilder NodeList nl = null; try { nl = (NodeList) xpath.evaluate(xPathFilter, inputSource, XPathConstants.NODESET); } catch (XPathExpressionException ex) { Logger.getLogger(XML.class.getName()).log(Level.SEVERE, null, ex); } return nl; } ...

50. Using XPath with an XHTML web site    java-forums.org

Hi everyone, I've been trying to use XPath with an XHTML web site but I can't get it working... Here's the start of the web page: .... The error I'm getting is: java.net.MalformedURLException: no protocol: (and then it lists the entire web document string) The error happens ...

51. cannot use XPATH - need advice    forums.oracle.com

52. XPath question    forums.oracle.com

55. Newbie questioni on XPath    forums.oracle.com

Exception in thread "main" javax.xml.transform.TransformerException: Expected ], but found: at com.sun.org.apache.xpath.internal.compiler.XPathParser.error(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.consumeExpected(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.Predicate(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.Step(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.RelativeLocationPath(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.LocationPath(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.PathExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.UnionExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.UnaryExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.MultiplicativeExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.AdditiveExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.RelationalExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.EqualityExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.AndExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.OrExpr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.Expr(Unknown Source) at com.sun.org.apache.xpath.internal.compiler.XPathParser.initXPath(Unknown Source) at ...

56. Getting XPath from java    forums.oracle.com

after 19 posts you should have figured out by now that people are not going to do your homework for you. Research java and xpath yourself and see what kind of libraries can help you. Try to write some code first and if you get stuck, post what you have done and people can guide you. I will at least give ...

57. emergency xpath help    forums.oracle.com

58. Good Java XPath Resources / Tutorials    forums.oracle.com

And yeah, there used to be decent Java XML tutorials out there, but lately they have disappeared and been replaced by less focused tutorials, as you found. The second link that Google gives me is this one: [Java API for XML Processing|http://72.5.124.55/j2ee/1.4/docs/tutorial-update6/doc/JAXPIntro.html] -- although it seems to be abandoned, Google still knows the IP address of the server.

59. Java and XPath Question    forums.oracle.com

61. Using XPATH is my Java code.Please see.    forums.oracle.com

62. a doubt regarding XPath API    forums.oracle.com

Here to find the title of the book, whose author name is "Neal Stephenson", we can use the expression, XPathExpression expr = xpath.compile("//book[author='Neal Stephenson']/title/text()"); but my doubt is how to get the title of the book which was pritned in the Year "2000". Any body here do u know, is that possible using XPath API and if then, how to ...

63. XPath & Java    forums.oracle.com

Aim Make search in XML file with XPath expression, which sets in Web form. Return search results to user browser. I understand the task, but the method evaluate from XPath interface it's signature xPath.evaluate(xPathExpression, docWrite, XPathConstants.STRING); It's third parameter, which define, what to receive, may be one of XPathConstants.BOOLEAN XPathConstants.NODE XPathConstants.NODESET XPathConstants.NUMBER XPathConstants.STRING and when we use overloaded version of the ...

64. Problem with XPath API    forums.oracle.com

actually the output is empty. 0 was the size of a list where I put the expected results. In fact, this XPath Expression (/definitions/message/part/@name) returns an empty NodeList! /definitions/message/part also returns an empty NodeList even if I put some text inbetween the tags texttext isn't this strange? Regards, Pesho Message was edited by: Pesho_318i

65. XPATH readout - HAshmap/Array or Enum    forums.oracle.com

how do I do the calculation to get the first 3 Objects and the summation of any keys not in size > 3 into the final key value? That code looks strange. Not sure what it means, but I think I understand your goal. Like I said I would create a new class that would handle the logic of this business ...

66. xpath help is required    forums.oracle.com

67. XPath resolution error.    forums.oracle.com

I am trying to develop a simple script for my client, credits to load testing, in OATS. The flow is the simplest we can ever have. The provided URL has to be opened, a specific tab in the opened page has to be clicked and then the "Sign Out" link in the opened web page has to be clicked. The script ...

69. How to integrate a Xpath pmd rules with jdeveloper?.    forums.oracle.com

I have some customized Xpath pmd rules.(i.e all rules are in inside of the one xml file.). But i dono to integrate these rules with jdeveloper?.Some predefined rules are defined in xml files inside of the PMD-4.2.5.jar file.Suppose i added my rules into the predefined rules (inside of the jar).Its working fine.We can directly import our custom rule into jdeveloper?.Is possible? ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.