1

I have a sourcecode of class, that has been written on Java 1.6 and uses XPath to get XML from InputStream and make some specific changes in XML Document. Now a I have to make this class compatible with Java 1.4. Netbeans highlight import rows for XPath classes "javax.xml.xpath.*". What alternatives of XPath I can use to get NodeList from InputStream whith XML in Java 1.4?

3
  • take a look here: [Parsing XML file using Xpath in jdk1.4][1] [1]: stackoverflow.com/questions/5094116/… Commented Sep 13, 2012 at 5:31
  • I need to use built-in libraries, without any external classes, if it's possible. Commented Sep 13, 2012 at 5:57
  • java.xml.xpath was implemented since 1.5 only...so there is no other solution Commented Sep 13, 2012 at 6:45

1 Answer 1

1

Your question including your commentary comprises a contradiction in terms. The XPath libraries were not built in to JDK 1.4, they are @since 1.5, although they were available separately in the JAXP part of the Web Services pack (JAX-WS?) for a while before that.

You will have to add and use either JAXP from the external bundle or use Apache Xalan directly, like it or not.

Sign up to request clarification or add additional context in comments.

3 Comments

I need no use XPath directly. I need to get NodeList from XML, than copy some nodes to new, Document, modify some nodes in new Document and rename modified nodes, than return new XML. Now I'm trying use DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputSource) instead xpath.evaluate(expression, inputSource, XPathConstants.NODESET)
When you say "I need no use", did you mean "I need to use" or "I need not use"?
@Leonid What exactly does your comment have to do with my answer? Was there something about it that needs clarifying? And how does using DocumentBuilder.parse() constitute using XPath at all?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.