|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.util.XML
public class XML
Static utility methods and classes for processing XML.
| Field Summary | |
|---|---|
static String |
NAMESPACES_FEATURE
The feature used to set an XMLReader to
handle namespaces. |
static String |
VALIDATION_FEATURE
The feature used to set an XMLReader to be
validating or not. |
static String |
XERCES_BUFFER_SIZE_PROPERTY
The feature used to set the buffer size for the Xerces parser in bytes. |
static FileFilter |
XML_FILE_FILTER
Filter for XML files and directories. |
static FileFilter |
XML_FILE_ONLY_FILTER
Filter for XML files only. |
static String |
XML_SUFFIX
Suffix for XML files. |
| Method Summary | |
|---|---|
static void |
escape(char c,
StringBuffer sb)
Write an XML-escaped version of the specified character to the specified string buffer. |
static String |
escape(String in)
Returns an XML-escaped version of the specified string. |
static void |
escape(String in,
StringBuffer sb)
Write an XML-escaped version of the specified string to the specified string buffer. |
static void |
escapeEntity(String xmlEntity,
StringBuffer sb)
Write an XML-escaped version of the entity specified by name to the specified string buffer. |
static void |
handle(String document,
DefaultHandler handler)
Handle the document specified as a string with the specified handler. |
static void |
parse(File file,
String charEncoding,
DefaultHandler handler)
Parse the specified file encoded in the specified character encoding, sending XML events to the specified handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String XML_SUFFIX
public static final FileFilter XML_FILE_FILTER
public static final FileFilter XML_FILE_ONLY_FILTER
public static final String VALIDATION_FEATURE
XMLReader to be
validating or not. To turn on validation, which is off
by default, use:
xmlReader.setFeature(XML.VALIDATION_FEATURE,true);
See SAX Project Features and Properties.
public static final String NAMESPACES_FEATURE
XMLReader to
handle namespaces. This is an expensive feature and
turning it off can double parsing speed. To turn
off namespace parsing, which is on by default, use:
xmlReader.setFeature(XML.NAMESPACES_FEATURE,true)
See SAX Project Features and Properties.
public static final String XERCES_BUFFER_SIZE_PROPERTY
XMLReader reader;
reader.setProperty(XML.XERCES_BUFFER_SIZE_PROPERTY,2048);
See SAX Project Features and Properties.
Also see: Xerces 2 Properties.
| Method Detail |
|---|
public static String escape(String in)
in - String to escape.
public static void escape(String in,
StringBuffer sb)
in - String to escape.sb - String buffer to whcih to write escaped version of
string.
public static void escape(char c,
StringBuffer sb)
c - Character to write.sb - String buffer to which to write escaped version of
character.
public static void escapeEntity(String xmlEntity,
StringBuffer sb)
xmlEntity - Name of entity with no markup.sb - String Buffer to which escaped form of entity is
written.
public static void handle(String document,
DefaultHandler handler)
throws IOException,
SAXException
An XMLReader instance will be created using Java's
built-in XMLReaderFactory.
document - String representation of XML document.handler - Handler for SAX events from document.
SAXException - If there is a SAX exception handling the
document.
IOException - If there is an I/O exception reading from
the document.
public static void parse(File file,
String charEncoding,
DefaultHandler handler)
throws IOException,
SAXException
null, the parser will attempt
to infer the encoding.
An XMLReader instance will be created using Java's
built-in XMLReaderFactory.
file - File to parse.charEncoding - Character encoding for file, or
null if it's unknown.handler - Handler for SAX events from document.
SAXException - If there is a SAX exception handling the
document.
IOException - If there is an I/O exception reading from
the document.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||