com.starbase.util
Class XMLUtils

java.lang.Object
  |
  +--com.starbase.util.XMLUtils

public class XMLUtils
extends java.lang.Object

A class with XML related utility methods.


Constructor Summary
XMLUtils()
          Deprecated.  
 
Method Summary
 boolean equals(java.lang.Object source)
          returns true if this object instance is equal to the source
static java.lang.String escape(java.lang.String rawText)
          Returns the specified arbitrary text reformated in a form suitable for the contents of an XML element.
 int hashCode()
          returns a unique hash for all instances of this type
static boolean isXML(java.io.File file)
          Test to see if a file could be an XML file.
static void writeEscaped(java.lang.String rawText, java.io.BufferedWriter out)
          Deprecated.  
static void writeEscaped(java.lang.String rawText, java.lang.StringBuffer out)
          Writes the specified arbitrary text to the specified StringBuffer in a form suitable for the contents of an XML element.
static void writeEscaped(java.lang.String rawText, java.io.Writer out)
          Writes the specified arbitrary text to the specified output in a form suitable for the contents of an XML element.
static void writeEscapedAttributeValue(java.lang.String rawText, java.io.Writer out)
          Properly escape a text string for use as an XML attribute value.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtils

public XMLUtils()
Deprecated.  

Method Detail

writeEscaped

public static void writeEscaped(java.lang.String rawText,
                                java.lang.StringBuffer out)
Writes the specified arbitrary text to the specified StringBuffer in a form suitable for the contents of an XML element. In particular the following characters will be escaped: ", ', >, <, &

Parameters:
rawText - the raw text to be encoded for XML output
out - the StringBuffer to which the encoded text will be written

writeEscaped

public static void writeEscaped(java.lang.String rawText,
                                java.io.BufferedWriter out)
                         throws java.io.IOException
Deprecated.  

Writes the specified arbitrary text to the specified output in a form suitable for the contents of an XML element. In particular the following characters will be escaped: ", ', >, <, &

Parameters:
rawText - the raw text to be encoded for XML output
out - the output to which the encoded text will be written
java.io.IOException

writeEscaped

public static void writeEscaped(java.lang.String rawText,
                                java.io.Writer out)
                         throws java.io.IOException
Writes the specified arbitrary text to the specified output in a form suitable for the contents of an XML element. In particular the following characters will be escaped: ", ', >, <, &

Parameters:
rawText - the raw text to be encoded for XML output
out - the output to which the encoded text will be written
java.io.IOException

escape

public static java.lang.String escape(java.lang.String rawText)
Returns the specified arbitrary text reformated in a form suitable for the contents of an XML element. In particular the following characters will be escaped: ", ', >, <, &

Parameters:
rawText - the raw text to be encoded for XML output

writeEscapedAttributeValue

public static void writeEscapedAttributeValue(java.lang.String rawText,
                                              java.io.Writer out)
                                       throws java.io.IOException
Properly escape a text string for use as an XML attribute value. The characters that need to be escaped are CR, LF, TAB, <, >, & ' (single quote), " (double quote). In addition all control characters (those chars < 0x20) are escaped.

Parameters:
rawText - the text string to be written
out - the output destination of the text
java.io.IOException

isXML

public static boolean isXML(java.io.File file)
Test to see if a file could be an XML file. Not that the file might have a byte order mark. Supported byte order marks include UTF8, UTF16LE, and UTF16BE. Following the byte order mark the file must start with "
Parameters:
file - the file to test
Returns:
true if the file could be an XML file

equals

public boolean equals(java.lang.Object source)
returns true if this object instance is equal to the source

Overrides:
equals in class java.lang.Object
Parameters:
source - Object the source to comapre with
Returns:
boolean true if this object is equal to the source

hashCode

public int hashCode()
returns a unique hash for all instances of this type

Overrides:
hashCode in class java.lang.Object
Returns:
int a unique hash for all instances of this type


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.