Package org.eclipse.rdf4j.common.xml
Class XMLUtil
java.lang.Object
org.eclipse.rdf4j.common.xml.XMLUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
escapeAttributeValue
(String value) Escapes all characters that have a special meaning in XML attribute values -- i.e.static String
escapeCharacterData
(String text) Escapes any special characters in the supplied text so that it can be included as character data in an XML document.static String
escapeDoubleQuotedAttValue
(String value) Escapes any special characters in the supplied value so that it can be used as an double-quoted attribute value in an XML document.static String
escapeSingleQuotedAttValue
(String value) Escapes any special characters in the supplied value so that it can be used as an single-quoted attribute value in an XML document.static String
escapeText
(String text) Escapes all characters that have a special meaning in XML text -- i.e.static int
findURISplitIndex
(String uri) Tries to find a point in the supplied URI where this URI can be safely split into a namespace part and a local name.static final boolean
isCombiningChar
(char c) static final boolean
isDigit
(char c) static final boolean
isExtender
(char c) static final boolean
isIdeographic
(char c) static final boolean
isLetter
(char c) static final boolean
Checks whether the supplied String is an NCName (Namespace Classified Name) as specified at http://www.w3.org/TR/REC-xml-names/#NT-NCName .static final boolean
isNCNameChar
(char c) static final boolean
isNCNameStartChar
(char c) static boolean
isValidCharacterDataChar
(char c) Returns whether the specified character can appear in XML character data.static boolean
isValidCharacterDataChar
(int c) Returns whether the specified character can appear in XML character data.static String
Removes all non-valid XML character data chars from the specified String.static String
resolveEntities
(String text) Replaces all XML character entities with the character they represent.static String
resolveEntity
(String entName) Resolves an entity reference or character reference to its value.
-
Constructor Details
-
XMLUtil
public XMLUtil()
-
-
Method Details
-
escapeCharacterData
-
escapeDoubleQuotedAttValue
-
escapeSingleQuotedAttValue
-
resolveEntities
-
resolveEntity
Resolves an entity reference or character reference to its value.- Parameters:
entName
- The 'name' of the reference. This is the string between & and ;, e.g. amp, quot, #65 or #x41.- Returns:
- The value of the supplied reference, or the reference itself if it could not be resolved.
-
findURISplitIndex
Tries to find a point in the supplied URI where this URI can be safely split into a namespace part and a local name. According to the XML specifications, a local name must start with a letter or underscore and can be followed by zero or more 'NCName' characters.- Parameters:
uri
- The URI to split.- Returns:
- The index of the first character of the local name, or -1 if the URI can not be split into a namespace and local name.
-
isNCName
Checks whether the supplied String is an NCName (Namespace Classified Name) as specified at http://www.w3.org/TR/REC-xml-names/#NT-NCName . -
isNCNameStartChar
public static final boolean isNCNameStartChar(char c) -
isNCNameChar
public static final boolean isNCNameChar(char c) -
escapeAttributeValue
-
escapeText
-
isValidCharacterDataChar
public static boolean isValidCharacterDataChar(char c) Returns whether the specified character can appear in XML character data. -
isValidCharacterDataChar
public static boolean isValidCharacterDataChar(int c) Returns whether the specified character can appear in XML character data. The integer encoding also makes the representation of supplementary Unicode characters possible. -
removeInvalidCharacterDataChars
-
isLetter
public static final boolean isLetter(char c) -
isIdeographic
public static final boolean isIdeographic(char c) -
isCombiningChar
public static final boolean isCombiningChar(char c) -
isDigit
public static final boolean isDigit(char c) -
isExtender
public static final boolean isExtender(char c)
-