Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 1048
نمايش فراداده

SAXParserjavax.xml.parsers

Java 1.4

The SAXParser class is a wrapper around an org.xml.sax.XMLReader class and is used to parse XML documents using the SAX version 2 API. Obtain a SAXParser from a SAXParserFactory. Call setProperty( ) if desired to set a property on the underlying parser. (See method to tell you about it. And when it finds a run of plain text, it passes that text to the characters( ) method. In Java 5.0, the reset( ) method restores a SAXParser to its original state so that it can be reused.

Instead of using one of the parse( ) methods of this class, you can also call getXMLReader( ) to obtain the underlying XMLReader object and work with it directly to parse the desired document. SAXParser objects are not typically threadsafe.

Note that the getParser( ) method as well as the parse( ) methods that take an org.xml.sax.HandlerBase object are based on the SAX version 1 API, and should be avoided.

public abstract class

SAXParser { // Protected Constructors protected

SAXParser ( ); // Public Instance Methods public abstract org.xml.sax.Parser

getParser ( ) throws org.xml.sax.SAXException; public abstract Object

getProperty (String

name ) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException;

5.0 public javax.xml.validation.Schema

getSchema ( ); public abstract org.xml.sax.XMLReader

getXMLReader ( ) throws org.xml.sax.SAXException; public abstract boolean

isNamespaceAware ( ); public abstract boolean

isValidating ( );

5.0 public boolean

isXIncludeAware ( ); public void

parse (org.xml.sax.InputSource

is , org.xml.sax.HandlerBase

hb ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (org.xml.sax.InputSource

is , org.xml.sax.helpers.DefaultHandler

dh ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (java.io.File

f , org.xml.sax.helpers.DefaultHandler

dh ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (java.io.InputStream

is , org.xml.sax.helpers.DefaultHandler

dh ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (java.io.InputStream

is , org.xml.sax.HandlerBase

hb ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (String

uri , org.xml.sax.HandlerBase

hb ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (String

uri , org.xml.sax.helpers.DefaultHandler

dh ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (java.io.File

f , org.xml.sax.HandlerBase

hb ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (java.io.InputStream

is , org.xml.sax.HandlerBase

hb , String

systemId ) throws org.xml.sax.SAXException, java.io.IOException; public void

parse (java.io.InputStream

is , org.xml.sax.helpers.DefaultHandler

dh , String

systemId ) throws org.xml.sax.SAXException, java.io.IOException;

5.0 public void

reset ( ); public abstract void

setProperty (String

name , Object

value ) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException; }

Returned By

SAXParserFactory.newSAXParser( )