jd.xml.util
Class SaxUtil

java.lang.Object
  extended byjd.xml.util.SaxUtil

public abstract class SaxUtil
extends Object

A collection of utility functions for the SAX API.


Field Summary
static String FEATURE_NAMESPACES
           
static String FEATURE_NSPREFIXES
           
static String FEATURE_VALIDATION
           
static String PROPERTY_DECLHANDLER
           
static String PROPERTY_LEXHANDLER
           
 
Constructor Summary
SaxUtil()
           
 
Method Summary
static XMLReader createXmlReader()
          Create a SAX XMLReader.
static XMLReader createXmlReader(String className)
          Create a SAX XMLReader.
static boolean getFeature(XMLReader xmlReader, String feature)
          A helper method to set a SAX feature of a XMLReader.
static boolean isValidating(XMLReader xmlReader)
          Specifies that the parser will validate documents as they are parsed.
static void setFeature(XMLReader xmlReader, String feature, boolean value)
          A helper method to set a SAX feature of a XMLReader.
static void setProperty(XMLReader xmlReader, String property, Object value)
          A helper method to set a SAX property of a XMLReader.
static void setValidating(XMLReader xmlReader, boolean validate)
          Specifies that the parser will validate documents as they are parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE_NAMESPACES

public static final String FEATURE_NAMESPACES
See Also:
Constant Field Values

FEATURE_NSPREFIXES

public static final String FEATURE_NSPREFIXES
See Also:
Constant Field Values

FEATURE_VALIDATION

public static final String FEATURE_VALIDATION
See Also:
Constant Field Values

PROPERTY_LEXHANDLER

public static final String PROPERTY_LEXHANDLER
See Also:
Constant Field Values

PROPERTY_DECLHANDLER

public static final String PROPERTY_DECLHANDLER
See Also:
Constant Field Values
Constructor Detail

SaxUtil

public SaxUtil()
Method Detail

createXmlReader

public static XMLReader createXmlReader()
                                 throws SAXException
Create a SAX XMLReader.

Throws:
SAXException - thrown if no XMLReader can be created.

createXmlReader

public static XMLReader createXmlReader(String className)
                                 throws SAXException
Create a SAX XMLReader.

Parameters:
className - the name of the XMLReader class. If it is the name of a deprecated SAX Parser class, then the Parser is instantiated and wrapped with a SAX ParserAdapter.
Throws:
SAXException - thrown if the XMLReader can be created.

setFeature

public static void setFeature(XMLReader xmlReader,
                              String feature,
                              boolean value)
A helper method to set a SAX feature of a XMLReader. All exceptions are silently catched.


getFeature

public static boolean getFeature(XMLReader xmlReader,
                                 String feature)
A helper method to set a SAX feature of a XMLReader. Exceptions are silently catched.


setValidating

public static void setValidating(XMLReader xmlReader,
                                 boolean validate)
Specifies that the parser will validate documents as they are parsed. If the XMLReader has no ErrorHandler a DefaultErrorHandler is set.


isValidating

public static boolean isValidating(XMLReader xmlReader)
Specifies that the parser will validate documents as they are parsed. If the XMLReader has no ErrorHandler a DefaultErrorHandler is set.


setProperty

public static void setProperty(XMLReader xmlReader,
                               String property,
                               Object value)
A helper method to set a SAX property of a XMLReader. All exceptions are silently catched.