public class XMLUtil extends java.lang.Object implements XMLConstants
CDATA, XLINK_HREF, XLINK_NAMESPACE, XLINK_PREFIX, XML_NAMESPACE, XML_PREFIX, XML_SPACE, XMLNS_NAMESPACE_URI, XMLNS_PREFIX
Constructor and Description |
---|
XMLUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addAttribute(org.xml.sax.helpers.AttributesImpl atts,
org.apache.xmlgraphics.util.QName attribute,
java.lang.String value)
Adds an attribute to a given
AttributesImpl instance. |
static void |
addAttribute(org.xml.sax.helpers.AttributesImpl atts,
java.lang.String localName,
java.lang.String value)
Adds an attribute to a given
AttributesImpl instance. |
static java.util.Locale |
convertRFC3066ToLocale(java.lang.String lang)
Converts an RFC 3066 compliant language identifier to a
Locale instance. |
static boolean |
getAttributeAsBoolean(org.xml.sax.Attributes attributes,
java.lang.String name,
boolean defaultValue)
Returns an attribute value as a boolean value.
|
static int |
getAttributeAsInt(org.xml.sax.Attributes attributes,
java.lang.String name)
Returns an attribute value as a int value.
|
static int |
getAttributeAsInt(org.xml.sax.Attributes attributes,
java.lang.String name,
int defaultValue)
Returns an attribute value as a int value.
|
static int[] |
getAttributeAsIntArray(org.xml.sax.Attributes attributes,
java.lang.String name)
Returns an attribute value as a integer array.
|
static java.lang.Integer |
getAttributeAsInteger(org.xml.sax.Attributes attributes,
java.lang.String name)
Returns an attribute value as a Integer value.
|
static java.awt.Rectangle |
getAttributeAsRectangle(org.xml.sax.Attributes attributes,
java.lang.String name)
Returns an attribute value as a Rectangle value.
|
static java.awt.geom.Rectangle2D |
getAttributeAsRectangle2D(org.xml.sax.Attributes attributes,
java.lang.String name)
Returns an attribute value as a Rectangle2D value.
|
static java.lang.String |
toRFC3066(java.util.Locale language)
Converts a
Locale instance to an RFC 3066 compliant language identifier. |
public static boolean getAttributeAsBoolean(org.xml.sax.Attributes attributes, java.lang.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(org.xml.sax.Attributes attributes, java.lang.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(org.xml.sax.Attributes attributes, java.lang.String name) throws org.xml.sax.SAXException
attributes
- the Attributes objectname
- the name of the attributeorg.xml.sax.SAXException
- if the attribute is missingpublic static java.lang.Integer getAttributeAsInteger(org.xml.sax.Attributes attributes, java.lang.String name)
attributes
- the Attributes objectname
- the name of the attributepublic static java.awt.geom.Rectangle2D getAttributeAsRectangle2D(org.xml.sax.Attributes attributes, java.lang.String name)
attributes
- the Attributes objectname
- the name of the attributepublic static java.awt.Rectangle getAttributeAsRectangle(org.xml.sax.Attributes attributes, java.lang.String name)
attributes
- the Attributes objectname
- the name of the attributepublic static int[] getAttributeAsIntArray(org.xml.sax.Attributes attributes, java.lang.String name)
attributes
- the Attributes objectname
- the name of the attributepublic static void addAttribute(org.xml.sax.helpers.AttributesImpl atts, org.apache.xmlgraphics.util.QName attribute, java.lang.String value)
AttributesImpl
instance.atts
- the attributes collectionattribute
- the attribute to addvalue
- the attribute's CDATA valuepublic static void addAttribute(org.xml.sax.helpers.AttributesImpl atts, java.lang.String localName, java.lang.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 java.lang.String toRFC3066(java.util.Locale language)
Locale
instance to an RFC 3066 compliant language identifier.language
- the languagepublic static java.util.Locale convertRFC3066ToLocale(java.lang.String lang)
Locale
instance.lang
- the language stringCopyright 1999-2010 The Apache Software Foundation. All Rights Reserved.