DOM Parsing in Java
DOM parsing is the basis for XSLT/XQuery processing. It’s very convenient to use DOM APIs to access and update XML documents.
Basic DOM Parsing
Let’s get started with a simple DOM parsing example using Oracle XDK Java (DOMSimple.java):
Listing 4-1 DOM Parsing in Oracle XDK
package xmlbook.chp04;
import java.io.File;
import java.io.FileInputStream;
import oracle.xml.parser.v2.DOMParser;
import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XMLElement;
import oracle.xml.parser.v2.XMLNode;
import oracle.xml.parser.v2.XMLParser;
public class DOMSimple {
public static void main(String[] argv) {
DOMParser dp = new DOMParser();
dp.setAttribute(XMLParser.STANDALONE, Boolean.TRUE);
dp.setPreserveWhitespace(false); ...
Get Oracle Database 11g Building Oracle XML DB Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.