Package org.eigenbase.xom

# Interface Parser

All Known Implementing Classes:
  `GenericDOMParser`, `JaxpDOMParser`, `XercesDOMParser`

public interface Parser
The `Parser` interface abstracts the behavior which the `org.eigenbase.xom` package needs from an XML parser.

If you don't care which implementation you get, call `XOMUtil.createDefaultParser()` to create a parser.

Since:
  2 August, 2001
Version:
  $Id: //open/util/resgen/src/org/eigenbase/xom/Parser.java#4 $
Author:
  jhyde

## Method Summary

Modifier and Type
Method
Description
`DOMWrapper`
`create(String tagName)`
Creates a wrapper representing an XML element.
`boolean`
`isKeepPositions()`
Returns whether the parser is retaining position information.
`DOMWrapper`
`parse(InputStream is)`
Parses an input stream and returns a wrapped element.
`DOMWrapper`
`parse(Reader reader)`
Parses the contents of a reader and returns a wrapped element.
`DOMWrapper`
`parse(String sXml)`
Parses a string and returns a wrapped element.
`DOMWrapper`
`parse(URL url)`
Parses the contents of a URL and returns a wrapped element.
`void`
`setKeepPositions(boolean keepPositions)`
Sets whether to retain position information.

## Method Details

### setKeepPositions

void setKeepPositions(boolean keepPositions)
Sets whether to retain position information.

Parameters:
  `keepPositions` - Whether to keep position information.

### isKeepPositions

boolean isKeepPositions()
Returns whether the parser is retaining position information.

Returns:
  Whether to keep position information.

### parse

DOMWrapper parse(String sXml) throws XOMException
Parses a string and returns a wrapped element.

Parameters:
  `sXml` - XML string
Returns:
  Wrapped element
Throws:
  `XOMException` - on error

### parse

DOMWrapper parse(InputStream is) throws XOMException
Parses an input stream and returns a wrapped element.

Parameters:
  `is` - Input stream
Returns:
  Wrapped element
Throws:
  `XOMException` - on error

### parse

DOMWrapper parse(URL url) throws XOMException
Parses the contents of a URL and returns a wrapped element.

Parameters:
  `url` - URL
Returns:
  Wrapped element
Throws:
  `XOMException` - on error

### parse

DOMWrapper parse(Reader reader) throws XOMException
Parses the contents of a reader and returns a wrapped element.

Parameters:
  `reader` - Reader
Returns:
  Wrapped element
Throws:
  `XOMException` - on error

### create

DOMWrapper create(String tagName)
Creates a wrapper representing an XML element.

Parameters:
  `tagName` - Name of element
Returns:
  Wrapper element