public final class XMLUtil extends Object implements XMLConstants
CDATA, XLINK_HREF, XLINK_NAMESPACE, XLINK_PREFIX, XML_NAMESPACE, XML_PREFIX, XML_SPACE, XMLNS_NAMESPACE_URI, XMLNS_PREFIX
Modifier and Type | Method and Description |
---|---|
static void |
addAttribute(AttributesImpl atts,
org.apache.xmlgraphics.util.QName attribute,
String value)
Adds an attribute to a given
AttributesImpl instance. |
static void |
addAttribute(AttributesImpl atts,
String localName,
String value)
Adds an attribute to a given
AttributesImpl instance. |
static int[][] |
decodePositionAdjustments(String value)
Decode a string as a glyph position adjustments array, where the string
shall adhere to the syntax specified by
encodePositionAdjustments(int[][], int) . |
static String |
encodePositionAdjustments(int[][] dp)
Encode a glyph position adjustments array as a string, where the string value
adheres to the following syntax:
count ( 'Z' repeat | number )
where each token is separated by whitespace, except that 'Z' followed by repeat
are considered to be a single token with no intervening whitespace.
|
static String |
encodePositionAdjustments(int[][] dp,
int paCount)
Encode a glyph position adjustments array as a string, where the string value
adheres to the following syntax:
count ( 'Z' repeat | number )
where each token is separated by whitespace, except that 'Z' followed by repeat
are considered to be a single token with no intervening whitespace, and where
'Z' repeat encodes repeated zeroes.
|
static String |
escape(String unescaped)
Escape '<', '>' and '&' using NCRs.
|
static boolean |
getAttributeAsBoolean(Attributes attributes,
String name,
boolean defaultValue)
Returns an attribute value as a boolean value.
|
static int |
getAttributeAsInt(Attributes attributes,
String name)
Returns an attribute value as a int value.
|
static int |
getAttributeAsInt(Attributes attributes,
String name,
int defaultValue)
Returns an attribute value as a int value.
|
static int[] |
getAttributeAsIntArray(Attributes attributes,
String name)
Returns an attribute value as a integer array.
|
static Integer |
getAttributeAsInteger(Attributes attributes,
String name)
Returns an attribute value as a Integer value.
|
static int[][] |
getAttributeAsPositionAdjustments(Attributes attributes,
String name)
Returns an attribute value as a glyph position adjustments array.
|
static Rectangle |
getAttributeAsRectangle(Attributes attributes,
String name)
Returns an attribute value as a Rectangle value.
|
static Rectangle2D |
getAttributeAsRectangle2D(Attributes attributes,
String name)
Returns an attribute value as a Rectangle2D value.
|
public static boolean getAttributeAsBoolean(Attributes attributes, String name, boolean defaultValue)
attributes
- the Attributes objectname
- the name of the attributedefaultValue
- the default value if the attribute is not specifiedpublic static int getAttributeAsInt(Attributes attributes, String name, int defaultValue)
attributes
- the Attributes objectname
- the name of the attributedefaultValue
- the default value if the attribute is not specifiedpublic static int getAttributeAsInt(Attributes attributes, String name) throws SAXException
attributes
- the Attributes objectname
- the name of the attributeSAXException
- if the attribute is missingpublic static Integer getAttributeAsInteger(Attributes attributes, String name)
attributes
- the Attributes objectname
- the name of the attributepublic static Rectangle2D getAttributeAsRectangle2D(Attributes attributes, String name)
attributes
- the Attributes objectname
- the name of the attributepublic static Rectangle getAttributeAsRectangle(Attributes attributes, String name)
attributes
- the Attributes objectname
- the name of the attributepublic static int[] getAttributeAsIntArray(Attributes attributes, String name)
attributes
- the Attributes objectname
- the name of the attributepublic static void addAttribute(AttributesImpl atts, org.apache.xmlgraphics.util.QName attribute, String value)
AttributesImpl
instance.atts
- the attributes collectionattribute
- the attribute to addvalue
- the attribute's CDATA valuepublic static void addAttribute(AttributesImpl atts, String localName, String value)
AttributesImpl
instance. The attribute will be
added in the default namespace.atts
- the attributes collectionlocalName
- the local name of the attributevalue
- the attribute's CDATA valuepublic static String encodePositionAdjustments(int[][] dp, int paCount)
dp
- the adjustments arraypaCount
- the number of entries to encode from adjustments arraypublic static String encodePositionAdjustments(int[][] dp)
dp
- the adjustments arraypublic static int[][] decodePositionAdjustments(String value)
encodePositionAdjustments(int[][], int)
.value
- the encoded valuepublic static int[][] getAttributeAsPositionAdjustments(Attributes attributes, String name)
attributes
- the Attributes objectname
- the name of the attributeCopyright © 2022 Apache Software Foundation. All rights reserved.