Wednesday, 23rd June 2010
The new frontier for learning Java

Talk:Parsing an XML file and getting info from it via Xpath

From WikiJava

Jump to: navigation, search

Comments on Parsing an XML file and getting info from it via Xpath

Title (required):

Website:

Comment:


I Can't compile it

When i try to compile this code I get this error:

C:\Documents and Settings\...\Desktop>javac XMLReader.java

XMLReader.java:20: warning: com.sun.org.apache.xpath.internal.NodeSet is Sun proprietary API and may be removed in a future release import com.sun.org.apache.xpath.internal.NodeSet;
                                        ^
XMLReader.java:54: warning: com.sun.org.apache.xpath.internal.NodeSet is Sun pro
prietary API and may be removed in a future release
            NodeSet nodeSetResult = (NodeSet) expr.evaluate(doc,
            ^
XMLReader.java:54: warning: com.sun.org.apache.xpath.internal.NodeSet is Sun pro
prietary API and may be removed in a future release
            NodeSet nodeSetResult = (NodeSet) expr.evaluate(doc,
                                     ^
3 warnings

What Could I Do ?

--78.13.58.249 09:54, 16 December 2008 (UTC)

Hi, The one you get is not an error but just a Warning, your compilation goes successful except those warnings, which you can forget about. Unless you plan to compile this program with other JDKs in the far future. After compilation you indeed get the compiled XMLReader.class file.
If you want to run this program from command line you should better remove the package declaration at the top of the file (which makes it more complex to write the command line). Then you can compile (forget about the warnings) and execute it with: java XMLReader. Keep posting if you get more troubles with it. --DonGiulio 10:48, 16 December 2008 (UTC)

Code Update

by the way I fixed a couple of things, the new code is in the repository. Just details though

--DonGiulio 11:34, 16 December 2008 (UTC)