Processing XPath in Java

Let’s look at how to perform streaming XPath-based XML content evaluation.

The following example calls Oracle XDK to evaluate the XPath expression without building a DOM object in memory. The example only works on a subset of XPath functions and axes (including child, descendant, attribute, text, parent, and ancestor).

Listing 6-3 XPath Evaluation with Oracle XDK Scalable DOM

package xmlbook.chp06;

import java.io.File;

import java.io.FileInputStream;

import java.net.URL;

import javax.xml.xpath.XPath;

import javax.xml.xpath.XPathConstants;

import javax.xml.xpath.XPathFactory;

import oracle.xml.parser.v2.DOMParser;

import oracle.xml.parser.v2.FilePageManager;

import oracle.xml.parser.v2.XMLDocument;

import oracle.xml.scalable.BinaryStream; ...

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.