This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to change my code from JDOM to JAXP? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to change my code from JDOM to JAXP?" Watch "How to change my code from JDOM to JAXP?" New topic
Author

How to change my code from JDOM to JAXP?

Mullin Yu
Greenhorn

Joined: Feb 24, 2005
Posts: 14
import java.io.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
import org.jdom.xpath.*;


public class DataMapper {

public static List getFieldList(int viewType) throws IOException, JDOMException {

SAXBuilder builder = new SAXBuilder();
Document doc = builder.build("http://localhost/xml/mapping.xml");

XPath fieldPath = XPath.newInstance("//field[ui-display=\"Value1\" or ui-display=\"Value2\"]");
List fields = fieldPath.selectNodes(doc);

return fields;

}
}
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
Why? JDOM is a huge improvement over JAXP, so much so that even Sun Microsystems admitted it and said it may feature in a futute JDK under a different re-packaged name.

JDOM all the way. The only other way is down.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to change my code from JDOM to JAXP?
 
Similar Threads
Parsing XML file using Xpath in jdk1.4
list children of element (jdom)
Problem Parsing XML file with JDOM.
XML Parsing through Java
how to show a XML tree in GUI?