Class XMLUtilities
java.lang.Object
org.apache.batik.xml.XMLCharacters
org.apache.batik.xml.XMLUtilities
- Direct Known Subclasses:
DOMUtilities
A collection of utility functions for XML.
- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class XMLCharacters
ALPHABETIC_CHARACTER, NAME_CHARACTER, NAME_FIRST_CHARACTER, NAME11_CHARACTER, NAME11_FIRST_CHARACTER, PUBLIC_ID_CHARACTER, VERSION_CHARACTER, XML_CHARACTER -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThis class does not need to be instantiated. -
Method Summary
Modifier and TypeMethodDescriptionprotected static ReadercreateXMLDeclarationReader(PushbackInputStream pbis, String enc) Creates a reader from the given input stream and encoding.static ReaderCreates a Reader initialized to scan the characters in the given XML document's InputStream.static StringencodingToJavaEncoding(String e, String de) Converts the given standard encoding representation to the corresponding Java encoding string.protected static StringReads an XML declaration to get the encoding declaration value.static booleanisXML11Character(int c) Tests whether the given 32 bit character is a valid XML 1.1 character.static booleanisXML11NameCharacter(char c) Tests whether the given character is a valid XML 1.1 name character.static booleanisXML11NameFirstCharacter(char c) Tests whether the given character is usable as the first character of an XML 1.1 name.static booleanisXMLAlphabeticCharacter(char c) Tests whether the given character is a valid aphabetic character.static booleanisXMLCharacter(int c) Tests whether the given 32 bits character is valid in XML documents.static booleanisXMLNameCharacter(char c) Tests whether the given character is a valid XML name character.static booleanisXMLNameFirstCharacter(char c) Tests whether the given character is usable as the first character of an XML name.static booleanisXMLPublicIdCharacter(char c) Tests whether the given character is a valid XML public ID character.static booleanisXMLSpace(char c) Tests whether the given character is a valid space.static booleanisXMLVersionCharacter(char c) Tests whether the given character is a valid XML version character.static intTest whether the given string is an XML 1.0 Name and/or QName.
-
Field Details
-
IS_XML_10_NAME
public static final int IS_XML_10_NAME- See Also:
-
IS_XML_10_QNAME
public static final int IS_XML_10_QNAME- See Also:
-
-
Constructor Details
-
XMLUtilities
protected XMLUtilities()This class does not need to be instantiated.
-
-
Method Details
-
isXMLSpace
public static boolean isXMLSpace(char c) Tests whether the given character is a valid space. -
isXMLNameFirstCharacter
public static boolean isXMLNameFirstCharacter(char c) Tests whether the given character is usable as the first character of an XML name. -
isXML11NameFirstCharacter
public static boolean isXML11NameFirstCharacter(char c) Tests whether the given character is usable as the first character of an XML 1.1 name. -
isXMLNameCharacter
public static boolean isXMLNameCharacter(char c) Tests whether the given character is a valid XML name character. -
isXML11NameCharacter
public static boolean isXML11NameCharacter(char c) Tests whether the given character is a valid XML 1.1 name character. -
isXMLCharacter
public static boolean isXMLCharacter(int c) Tests whether the given 32 bits character is valid in XML documents. Because the majority of code-points is covered by the table-lookup-test, we do it first. This method gives meaningful results only for c >= 0. -
isXML11Character
public static boolean isXML11Character(int c) Tests whether the given 32 bit character is a valid XML 1.1 character. -
isXMLPublicIdCharacter
public static boolean isXMLPublicIdCharacter(char c) Tests whether the given character is a valid XML public ID character. -
isXMLVersionCharacter
public static boolean isXMLVersionCharacter(char c) Tests whether the given character is a valid XML version character. -
isXMLAlphabeticCharacter
public static boolean isXMLAlphabeticCharacter(char c) Tests whether the given character is a valid aphabetic character. -
testXMLQName
Test whether the given string is an XML 1.0 Name and/or QName.- Returns:
- A bitfield of
IS_XML_10_NAMEandIS_XML_10_QNAME.
-
createXMLDocumentReader
Creates a Reader initialized to scan the characters in the given XML document's InputStream.- Parameters:
is- The input stream positionned at the beginning of an XML document.- Returns:
- a Reader positionned at the beginning of the XML document It is created from an encoding figured out from the first few bytes of the document. As a consequence the given input stream is not positionned anymore at the beginning of the document when this method returns.
- Throws:
IOException
-
createXMLDeclarationReader
protected static Reader createXMLDeclarationReader(PushbackInputStream pbis, String enc) throws IOException Creates a reader from the given input stream and encoding. This method assumes the input stream working buffer is at least 128 byte long. The input stream is restored before this method returns. The 4 first bytes are skipped before creating the reader.- Throws:
IOException
-
getXMLDeclarationEncoding
Reads an XML declaration to get the encoding declaration value.- Parameters:
r- a reader positioned just after '<?xm'.e- the encoding to return by default or on error.- Throws:
IOException
-
encodingToJavaEncoding
-