|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.topologi.diffx.xml.XMLUtils
public final class XMLUtils
A utility class for XML data.
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 |
---|
public static String escape(String s)
String
.
these characters are:
Empty strings or null
return respectively "" and null
.
Note: this function assumes that there are no entities in the given String. If there are existing entities, then the ampersand character will be escaped by the ampersand entity.
This method does not replaces " (by ") which is an invalid character in attribute values.
s
- The String to be parsed
null
or empty.escapeAttr(java.lang.String)
public static String escapeAttr(String s)
String
.
these characters are:
Empty strings or null
return respectively
"" and null
.
Note: this function assumes that there are no entities in the given String. If there are existing entities, then the ampersand character will be escaped by the ampersand entity.
s
- The String to be parsed
null
or empty.public static String toElementName(String name)
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'.
name
- The candidate element name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |