## org.apache.batik.xml
Class XMLUtilities

    java.lang.Object
      org.apache.batik.xml.XMLCharacters
          org.apache.batik.xml.XMLUtilities

Direct Known Subclasses:
  DOMUtilities

public class XMLUtilities
extends XMLCharacters

A collection of utility functions for XML.

Field Summary

Fields inherited from class org.apache.batik.xml.XMLCharacters
`ALPHABETIC_CHARACTER, NAME_CHARACTER, NAME_FIRST_CHARACTER, PUBLIC_ID_CHARACTER, VERSION_CHARACTER, XML_CHARACTER`

Constructor Summary
`protected` `XMLUtilities()` This class does not need to be instantiated.

Method Summary
`protected static java.io.Reader` `createXMLDeclarationReader(java.io.PushbackInputStream pbis, java.lang.String enc)` Creates a reader from the given input stream and encoding.
`static java.io.Reader` `createXMLDocumentReader(java.io.InputStream is)` Creates a Reader initialized to scan the characters in the given XML document's InputStream.
`static java.lang.String` `encodingToJavaEncoding(java.lang.String e, java.lang.String de)` Converts the given standard encoding representation to the corresponding Java encoding string.
`protected static java.lang.String` `getXMLDeclarationEncoding(java.io.Reader r, java.lang.String e)` Reads an XML declaration to get the encoding declaration value.
`static boolean` `isXMLAlphabeticCharacter(char c)` Tests whether the given character is a valid aphabetic character.
`static boolean` `isXMLCharacter(int c)` Tests whether the given 32 bits character is valid in XML documents.
`static boolean` `isXMLNameCharacter(char c)` Tests whether the given character is a valid XML name character.
`static boolean` `isXMLNameFirstCharacter(char c)` Tests whether the given character is usable as the first character of an XML name.
`static boolean` `isXMLPublicIdCharacter(char c)` Tests whether the given character is a valid XML public ID character.
`static boolean` `isXMLSpace(char c)` Tests whether the given character is a valid space.
`static boolean` `isXMLVersionCharacter(char c)` Tests whether the given character is a valid XML version character.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XMLUtilities

    protected XMLUtilities()

  This class does not need to be instantiated.

Method Detail

### 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.

### isXMLNameCharacter

    public static boolean isXMLNameCharacter(char c)

  Tests whether the given character is a valid XML name character.

### isXMLCharacter

    public static boolean isXMLCharacter(int c)

  Tests whether the given 32 bits character is valid in XML documents.

### 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.

### createXMLDocumentReader

    public static java.io.Reader createXMLDocumentReader(java.io.InputStream is)
                                                  throws java.io.IOException

  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:
    `java.io.IOException`

### createXMLDeclarationReader

    protected static java.io.Reader createXMLDeclarationReader(java.io.PushbackInputStream pbis,
                                                               java.lang.String enc)
                                                        throws java.io.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:
    `java.io.IOException`

### getXMLDeclarationEncoding

    protected static java.lang.String getXMLDeclarationEncoding(java.io.Reader r,
                                                                java.lang.String e)
                                                         throws java.io.IOException

  Reads an XML declaration to get the encoding declaration value.

  Parameters:
    `r` - a reader positionned just after '`e` - the encoding to return by default or on error.
  Throws:
    `java.io.IOException`

### encodingToJavaEncoding

    public static java.lang.String encodingToJavaEncoding(java.lang.String e,
                                                          java.lang.String de)

  Converts the given standard encoding representation to the corresponding Java encoding string.

  Parameters:
    `e` - the encoding string to convert.
    `de` - the encoding string if no corresponding encoding was found.

Copyright © 2004 Apache Software Foundation. All Rights Reserved.