com.topologi.diffx.xml
Class XMLUtils

java.lang.Object
  extended by com.topologi.diffx.xml.XMLUtils

public final class XMLUtils
extends Object

A utility class for XML data.

Version:
2.0, 24 March 2004
Author:
Christophe Lauret

Method Summary
static String escape(String s)
          Replaces characters which are invalid in element values, by the corresponding entity in a given String.
static String escapeAttr(String s)
          Replace characters which are invalid in attribute values, by the corresponding entity in a given String.
static String toElementName(String name)
          Return a valid element name from the given string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

escape

public static String escape(String s)
Replaces characters which are invalid in element values, by the corresponding entity in a given String.

these characters are:


escapeAttr

public static String escapeAttr(String s)
Replace characters which are invalid in attribute values, by the corresponding entity in a given String.

these characters are:


toElementName

public static String toElementName(String name)
Return a valid element name from the given string.

Letters are put to lower case and other characters are replaced by hyphens. If the first character is not a letter it is replaced by 'x'.

Parameters:
name - The candidate element name
Returns:
A valid element name