com.aliasi.util
Class XML

java.lang.Object
  extended by com.aliasi.util.XML

Deprecated. Implement functionality directly.

@Deprecated
public class XML
extends Object

Static utility methods and classes for processing XML.

Since:
LingPipe1.0
Version:
3.9.3
Author:
Bob Carpenter

Field Summary
static String NAMESPACES_FEATURE
          Deprecated. The feature used to set an XMLReader to handle namespaces.
static String VALIDATION_FEATURE
          Deprecated. The feature used to set an XMLReader to be validating or not.
static String XERCES_BUFFER_SIZE_PROPERTY
          Deprecated. Configure Xerces on an ad-hoc basis as needed.
static FileFilter XML_FILE_FILTER
          Deprecated. Filter for XML files and directories.
static FileFilter XML_FILE_ONLY_FILTER
          Deprecated. Filter for XML files only.
static String XML_SUFFIX
          Deprecated. Suffix for XML files.
 
Method Summary
static void escape(char c, StringBuilder sb)
          Deprecated. Write an XML-escaped version of the specified character to the specified string buffer.
static String escape(String in)
          Deprecated. Returns an XML-escaped version of the specified string.
static void escape(String in, StringBuilder sb)
          Deprecated. Write an XML-escaped version of the specified string to the specified string buffer.
static void escapeEntity(String xmlEntity, StringBuilder sb)
          Deprecated. Write an XML-escaped version of the entity specified by name to the specified string buffer.
static void handle(String document, DefaultHandler handler)
          Deprecated. Handle the document specified as a string with the specified handler.
static void parse(File file, String charEncoding, DefaultHandler handler)
          Deprecated. 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

XML_SUFFIX

public static final String XML_SUFFIX
Deprecated. 
Suffix for XML files.

See Also:
Constant Field Values

XML_FILE_FILTER

public static final FileFilter XML_FILE_FILTER
Deprecated. 
Filter for XML files and directories.


XML_FILE_ONLY_FILTER

public static final FileFilter XML_FILE_ONLY_FILTER
Deprecated. 
Filter for XML files only.


VALIDATION_FEATURE

public static final String VALIDATION_FEATURE
Deprecated. 
The feature used to set an 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.

See Also:
Constant Field Values

NAMESPACES_FEATURE

public static final String NAMESPACES_FEATURE
Deprecated. 
The feature used to set an 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.

See Also:
Constant Field Values

XERCES_BUFFER_SIZE_PROPERTY

@Deprecated
public static final String XERCES_BUFFER_SIZE_PROPERTY
Deprecated. Configure Xerces on an ad-hoc basis as needed.
The feature used to set the buffer size for the Xerces parser in bytes. Use
XMLReader reader;
reader.setProperty(XML.XERCES_BUFFER_SIZE_PROPERTY,2048);

See SAX Project Features and Properties.

Also see: Xerces 2 Properties.

See Also:
Constant Field Values
Method Detail

escape

public static String escape(String in)
Deprecated. 
Returns an XML-escaped version of the specified string.

Parameters:
in - String to escape.
Returns:
Escaped version of the specified string.

escape

public static void escape(String in,
                          StringBuilder sb)
Deprecated. 
Write an XML-escaped version of the specified string to the specified string buffer.

Parameters:
in - String to escape.
sb - String buffer to whcih to write escaped version of string.

escape

public static void escape(char c,
                          StringBuilder sb)
Deprecated. 
Write an XML-escaped version of the specified character to the specified string buffer.

Parameters:
c - Character to write.
sb - String buffer to which to write escaped version of character.

escapeEntity

public static void escapeEntity(String xmlEntity,
                                StringBuilder sb)
Deprecated. 
Write an XML-escaped version of the entity specified by name to the specified string buffer.

Parameters:
xmlEntity - Name of entity with no markup.
sb - String Buffer to which escaped form of entity is written.

handle

public static void handle(String document,
                          DefaultHandler handler)
                   throws IOException,
                          SAXException
Deprecated. 
Handle the document specified as a string with the specified handler.

An XMLReader instance will be created using Java's built-in XMLReaderFactory.

Parameters:
document - String representation of XML document.
handler - Handler for SAX events from document.
Throws:
SAXException - If there is a SAX exception handling the document.
IOException - If there is an I/O exception reading from the document.

parse

public static void parse(File file,
                         String charEncoding,
                         DefaultHandler handler)
                  throws IOException,
                         SAXException
Deprecated. 
Parse the specified file encoded in the specified character encoding, sending XML events to the specified handler. If the character encoding is null, the parser will attempt to infer the encoding.

An XMLReader instance will be created using Java's built-in XMLReaderFactory.

Parameters:
file - File to parse.
charEncoding - Character encoding for file, or null if it's unknown.
handler - Handler for SAX events from document.
Throws:
SAXException - If there is a SAX exception handling the document.
IOException - If there is an I/O exception reading from the document.