JAXPUtils (Apache Ant API)
Keywords: org.apache.tools.ant.util.JAXPUtils class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.util
Class JAXPUtils

    java.lang.Object
      org.apache.tools.ant.util.JAXPUtils

public class JAXPUtils
extends java.lang.Object

Collection of helper methods that retrieve a ParserFactory or Parsers and Readers.

This class will create only a single factory instance.

Since:
  Ant 1.5
Author:
  Stefan Bodewig

Constructor Summary
`JAXPUtils()`

Method Summary
`static org.xml.sax.Parser` | `getParser()` Returns a newly created SAX 1 Parser, using the default parser factory.
`static javax.xml.parsers.SAXParserFactory` | `getParserFactory()` Returns the parser factory to use.
`static java.lang.String` | `getSystemId(java.io.File file)` This is a best attempt to provide a URL.toExternalForm() from a file URL.
`static org.xml.sax.XMLReader` | `getXMLReader()` Returns a newly created SAX 2 XMLReader, using the default parser factory.
`static javax.xml.parsers.SAXParserFactory` | `newParserFactory()` Returns a new parser factory instance.

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

Constructor Detail

### JAXPUtils

    public JAXPUtils()

Method Detail

### getParserFactory

    public static javax.xml.parsers.SAXParserFactory getParserFactory()
                                                               throws BuildException

  Returns the parser factory to use. Only one parser factory is ever created by this method and is then cached for future use.

  Returns:
    a SAXParserFactory to use
  Throws:
    `BuildException`
  Since:
    Ant 1.5

### newParserFactory

    public static javax.xml.parsers.SAXParserFactory newParserFactory()
                                                               throws BuildException

  Returns a new parser factory instance.

  Throws:
    `BuildException`
  Since:
    Ant 1.5

### getParser

    public static org.xml.sax.Parser getParser()
                                        throws BuildException

  Returns a newly created SAX 1 Parser, using the default parser factory.

  Returns:
    a SAX 1 Parser.
  Throws:
    `BuildException`
  Since:
    Ant 1.5
  See Also:
    `getParserFactory()`

### getXMLReader

    public static org.xml.sax.XMLReader getXMLReader()
                                              throws BuildException

  Returns a newly created SAX 2 XMLReader, using the default parser factory.

  Returns:
    a SAX 2 XMLReader.
  Throws:
    `BuildException`
  Since:
    Ant 1.5
  See Also:
    `getParserFactory()`

### getSystemId

    public static java.lang.String getSystemId(java.io.File file)

  This is a best attempt to provide a URL.toExternalForm() from a file URL. Some parsers like Crimson choke on uri that are made of backslashed paths (ie windows) as it is does not conform URI specifications.

  Parameters:
    `file` - the file to create the system id from.
  Returns:
    the systemid corresponding to the given file.
  Since:
    Ant 1.5.2

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.