Modifier and Type | Field and Description |
---|---|
static String |
BASE64 |
static String |
COMPRESSION_ATT |
static boolean |
EMPTY_TAG
Constant which can be used with composeStartTag().
|
static String |
ENCODING_ATT |
static String |
GZIP |
static boolean |
NOT_EMPTY_TAG
Constant which can be used with composeStartTag().
|
static Pattern |
sEntityPattern2 |
Constructor and Description |
---|
XMLUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
checkXMLNameValidity(String inValue)
Is the tag or element name valid?
|
static String |
composeEndTag(String inName)
Composes an xml end tag (ex: "</inName>").
|
static String |
composeStartTag(String inName)
Composes an xml start tag (ex: "<inName>").
|
static String |
composeStartTag(String inName,
Attributes inAttributes)
Composes an xml start tag (ex: "<inName att1='value1' att2='value2'>").
|
static String |
composeStartTag(String inName,
Attributes inAttributes,
boolean isEmptyTag)
Composes an xml start tag (ex: "<inName att1='value1' att2='value2'>").
|
static String |
composeStartTag(String inName,
Collection<XMLAttribute> inAttributes)
Composes an xml start tag (ex: "<inName att1='value1' att2='value2'>").
|
static String |
composeStartTag(String inName,
Collection<XMLAttribute> inAttributes,
boolean isEmptyTag)
Composes an xml start tag (ex: "<inName att1='value1' att2='value2'>").
|
static String |
composeStartTag(String inName,
Map<String,Object> inAttributes)
Composes an xml start tag (ex: "<inName att1='value1' att2='value2'>").
|
static String |
composeStartTag(String inName,
Map<String,Object> inAttributes,
boolean isEmptyTag)
Composes an xml start tag (ex: "<inName att1='value1' att2='value2'>").
|
static String |
convertCharacterEntitiesToNumeric(String inContent) |
static String |
convertCharacterEntitiesToUnicode(String inContent) |
static String |
escapeAmp(String inAttributeValue) |
static String |
escapeApos(String inAttributeValue) |
static String |
escapeAttributeValue(String inAttributeValue) |
static String |
escapeContent(String inContent) |
static String |
escapeContentIfNecessary(String inContent)
Makes the content XML safe by ensuring that all '<'s are all escaped and that
all '&'s are part of an entity.
|
static String |
escapeDoubleQuotedAttributeValue(String inAttributeValue) |
static String |
escapeQuote(String inAttributeValue) |
static List<XMLNode> |
findNodesByAttribute(XMLNode inRootNode,
String inAttribute) |
static List<XMLNode> |
findNodesByAttribute(XMLNode inRootNode,
XMLAttribute inAttribute) |
static boolean |
isWellFormedContentFragment(String inXML)
Returns whether or not the content fragment is well-formed and if
tags are present internal to the fragment, whether the tag section
and preceding or trailing raw content is well-formed.
|
static boolean |
isWellFormedFragment(String inXML) |
static String |
replaceUnicodeWithEntities(String inString) |
static String |
unescapeAttributeValue(String inAttributeValue) |
static String |
unescapeContent(String inContent) |
static String |
unescapeEntities(String inValue) |
static void |
useDoubleQuotes(boolean inValue)
Set whether to use double quotes or single quotes for attribute values.
|
public static final String COMPRESSION_ATT
public static final String GZIP
public static final String ENCODING_ATT
public static final String BASE64
public static final boolean EMPTY_TAG
public static final boolean NOT_EMPTY_TAG
public static Pattern sEntityPattern2
public XMLUtil()
public static void useDoubleQuotes(boolean inValue)
public static String composeStartTag(String inName)
public static String composeStartTag(String inName, Attributes inAttributes)
public static String composeStartTag(String inName, Attributes inAttributes, boolean isEmptyTag)
public static String composeStartTag(String inName, Collection<XMLAttribute> inAttributes)
public static String composeStartTag(String inName, Collection<XMLAttribute> inAttributes, boolean isEmptyTag)
inName
- the tag nameinAttributes
- a List of XMLAttribute objectsisEmptyTag
- whether or not the tag has any content or subtagspublic static String composeStartTag(String inName, Map<String,Object> inAttributes)
public static String composeStartTag(String inName, Map<String,Object> inAttributes, boolean isEmptyTag)
public static String composeEndTag(String inName)
public static boolean isWellFormedFragment(String inXML)
public static boolean isWellFormedContentFragment(String inXML)
Examples of valid content fragments: '<foo />', 'foo & bar', 'foo', 'foo <bar>1</bar> one' Examples of invalid content fragments: '<foo>', 'foo & bar', 'foo <bar>1</zoot> one'
public static String convertCharacterEntitiesToNumeric(String inContent)
public static String convertCharacterEntitiesToUnicode(String inContent)
public static String escapeContentIfNecessary(String inContent)
inContent
- public static String escapeContent(String inContent)
public static String unescapeContent(String inContent)
public static String escapeAttributeValue(String inAttributeValue)
public static String unescapeAttributeValue(String inAttributeValue)
public static String escapeApos(String inAttributeValue)
public static String escapeQuote(String inAttributeValue)
public static String unescapeEntities(String inValue)
public static void checkXMLNameValidity(String inValue) throws com.hfg.xml.InvalidXMLNameException
com.hfg.xml.InvalidXMLNameException
public static List<XMLNode> findNodesByAttribute(XMLNode inRootNode, XMLAttribute inAttribute)
public static List<XMLNode> findNodesByAttribute(XMLNode inRootNode, String inAttribute)
public static String escapeDoubleQuotedAttributeValue(String inAttributeValue)
public static String replaceUnicodeWithEntities(String inString)