BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.xml.stream
Interface XMLInputStream

All Known Subinterfaces:
BufferedXMLInputStream, XMLInputOutputStream, XMLInputStreamFilter

public interface XMLInputStream

This is the top level interface for iterating over XML Events in an XML document.

Difference from SAX

An event stream can be thought of encapsulating SAX events. It applies an iterator/pull metaphor to the parser allowing procedural, stream-based, handling of input XML rather than having to write chained event handlers to handle complex XML documents.

Difference from DOM

The pull metaphor allows single-pass, stream-based parsing of the document rather than tree based manipulation.

Author:
Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
See Also:
XMLEvent, CharacterData, ProcessingInstruction, StartElement, EndElement, CharacterData, XMLName

Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 ReferenceResolver getReferenceResolver()
          Returns the reference resolver that was set for this stream, returns null if no ReferenceResolver has been set.
 XMLInputStream getSubStream()
          getSubStream() returns a stream which points to the entire next element in the current stream.
 boolean hasNext()
          Check if there are more events to pull of the stream
 XMLEvent next()
          Get the next XMLEvent on the stream
 XMLEvent peek()
          Check the next XMLEvent without reading it from the stream.
 void setReferenceResolver(ReferenceResolver resolver)
          Provides a way to set the ReferenceResolver of the stream, this is mostly needed for handle references to other parts of the document.
 void skip()
          Skip the next stream event
 boolean skip(int eventType)
          Position the stream at the next XMLEvent of this type.
 boolean skip(XMLName name)
          Position the stream at the next element of this name.
 boolean skip(XMLName name, int eventType)
          Position the stream at the next element of this name and this type.
 void skipElement()
          Skips the entire next start tag / end tag pair.
 

Method Detail

next

public XMLEvent next()
              throws XMLStreamException
Get the next XMLEvent on the stream

See Also:
XMLEvent

hasNext

public boolean hasNext()
                throws XMLStreamException
Check if there are more events to pull of the stream

See Also:
XMLEvent

skip

public void skip()
          throws XMLStreamException
Skip the next stream event

skipElement

public void skipElement()
                 throws XMLStreamException
Skips the entire next start tag / end tag pair.

peek

public XMLEvent peek()
              throws XMLStreamException
Check the next XMLEvent without reading it from the stream. Returns null if the stream is at EOF or has no more XMLEvents.

See Also:
XMLEvent

skip

public boolean skip(int eventType)
             throws XMLStreamException
Position the stream at the next XMLEvent of this type. The method returns true if the stream contains another XMLEvent of this type and false otherwise.

Parameters:
eventType - An integer code that indicates the element type.
See Also:
XMLEvent

skip

public boolean skip(XMLName name)
             throws XMLStreamException
Position the stream at the next element of this name. The method returns true if the stream contains another element with this name and false otherwise. Skip is a forward operator only. It does not look backward in the stream.

Parameters:
name - An object that defines an XML name. If the XMLName.getNameSpaceName() method on the XMLName argument returns null the XMLName will match just the local name. Prefixes are not checked for equality.
See Also:
XMLName

skip

public boolean skip(XMLName name,
                    int eventType)
             throws XMLStreamException
Position the stream at the next element of this name and this type. The method returns true if the stream contains another element with this name of this type and false otherwise.

Parameters:
name - An object that defines an XML name. If the XMLName.getNameSpaceName() method on the XMLName argument returns null the XMLName will match just the local name. Prefixes are not checked for equality.
eventType - An integer code that indicates the element type.
See Also:
XMLEvent, XMLName

getSubStream

public XMLInputStream getSubStream()
                            throws XMLStreamException
getSubStream() returns a stream which points to the entire next element in the current stream. For example: take a document that has a root node A, where the children of A are B, C, and D. If the stream is pointing to the start element of A, getSubStream() will return A, B, C and D including the start element of A and the end element of A. The position of the parent stream is not changed and the events read by the substream are written back to its parent.

close

public void close()
           throws XMLStreamException
Closes this input stream and releases any system resources associated with the stream.

getReferenceResolver

public ReferenceResolver getReferenceResolver()
Returns the reference resolver that was set for this stream, returns null if no ReferenceResolver has been set.

See Also:
ReferenceResolver

setReferenceResolver

public void setReferenceResolver(ReferenceResolver resolver)
Provides a way to set the ReferenceResolver of the stream, this is mostly needed for handle references to other parts of the document.

See Also:
ReferenceResolver

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81