Created
September 7, 2011 07:31
-
-
Save max747/1199976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import org.dom4j.Document; | |
import org.dom4j.DocumentException; | |
import org.dom4j.Node; | |
import org.dom4j.io.SAXReader; | |
import org.junit.Test; | |
public class Dom4jTest { | |
@Test | |
public void readXml() throws IOException, DocumentException { | |
SAXReader reader = new SAXReader(); | |
InputStreamReader stream = new InputStreamReader(new FileInputStream(new File("messages_ja.xml"))); | |
Document document = reader.read(stream); | |
Node messageNode = document.selectSingleNode("/MessageCollection/BugPattern[@type='IL_INFINITE_LOOP']"); | |
Node longDesc = messageNode.selectSingleNode("LongDescription"); | |
System.out.println(longDesc.getText()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment