biz.c24.io.api.presentation
Class CDOStreamReader

java.lang.Object
  extended by biz.c24.io.api.presentation.CDOStreamReader
All Implemented Interfaces:
javax.xml.stream.XMLStreamConstants, javax.xml.stream.XMLStreamReader

public class CDOStreamReader
extends Object
implements javax.xml.stream.XMLStreamReader

Lowest level StAX cursor based reader implementation to read Complex Data Objects.

Represents the StAX cursor based reader implementation that allows cursor based, read-only access to Complex Data Objects in the most efficiencent way.

It is designed to create events from a Complex Data Object using hasNext() and next() like on usual XML. The data can be accessed using methods such as getEventType(), getNamespaceURI(), getLocalName(), getText() and so on, according to the contract on StAX cursor based reader. Its behaviour is defined by the JSR-173 specification.

If used with Java 1.5 or 1.4, then please ensure that the JSR-173 API library added to your classpath (jsr173_api.jar).

The next() method causes the reader to read the next cursor event for an underliying Complex Data Object like it is just "plain old XML". The returned event represented by an primitive integer identifies the type of event just read. At any time the current event type can be determined using getEventType() method. Just after construction of the reader, its state is undefined (zero 0 value).

Note. Unlike the XML Stream reader some events that are defined there (DTD, entity declaration, entity reference,white space, attributes and namespaces) will never happen due to their inapplicability for a ComplexDataObject.

The typical usage of the reader is following:

     ComplexDataObject cdo = ...
     CDOStreamReader reader = new CDOStreamReader(cdo);
     while (reader.hasNext()) {
         event = reader.next();
         switch (event) {
             case XMLStreamConstants.START_ELEMENT:
                  // handle start of element
                  ...
                  break;
             case XMLStreamConstants.CHARACTERS:
                  // handle characters
                  ...
                  break;
             case XMLStreamConstants.CDATA:
                  // handle characters incapsulated into <![CDATA[...]]> 
                  ...
                  break;
             case XMLStreamConstants.COMMENT:
                  // handle comments
                  ...
                  break;
             case XMLStreamConstants.END_ELEMENT:
                  // handle end of element
                  ...
                  break;
             case XMLStreamConstants.START_DOCUMENT:
                  // handle start of document
                  ...
                  break;
             case XMLStreamConstants.END_DOCUMENT:
                  // handle end of document
                  ...
                  break;
             case XMLStreamConstants.PROCESSING_INSTRUCTION:
                  // handle processing instructions
                  ...
                  break;
         }
     }
 

Version:
$Revision: 10302 $ $Date: 2008-04-02 14:08:09 -0400 (Wed, 02 Apr 2008) $
See Also:
stream.events.XMLEvent, CDOStreamWriter

Field Summary
 
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
 
Constructor Summary
CDOStreamReader(ComplexDataObject object)
          Constructor with the Complex Data Object.
 
Method Summary
protected  void allocateScanner(biz.c24.io.api.presentation.Scanner scanner)
          The underlied CDO scanner setter.
 void close()
          Frees any resources associated with this Reader.
 int getAttributeCount()
          Gets the attribute count.
 String getAttributeLocalName(int index)
          Returns the local name of the attribute at the provided index.
 QName getAttributeName(int index)
          Returns the QName of the attribute at the provided index.
 String getAttributeNamespace(int index)
          Returns the namespace of the attribute at the provided index.
 String getAttributePrefix(int index)
          Returns the prefix of this attribute at the provided index.
 String getAttributeType(int index)
          Returns the XML type of the attribute at the provided index.
 String getAttributeValue(int index)
          Returns the value of the attribute at the index.
 String getAttributeValue(String namespace, String name)
          Returns the value of the attribute with the specified namespace and local name.
 String getCharacterEncodingScheme()
          The XML charachter encoding getter.
 String getElementText()
          Returns the text of current element.
 String getEncoding()
          Input encoding getter.
 int getEventType()
          Gets the current event.
 String getLocalName()
          Returns the (local) name of the current event.
 javax.xml.stream.Location getLocation()
          Return the current location of the processor.
 QName getName()
          Returns a QName for the current START_ELEMENT or END_ELEMENT event
 NamespaceContext getNamespaceContext()
          Returns a read only namespace context for the current position.
 int getNamespaceCount()
          Gets the namespace count.
 String getNamespacePrefix(int index)
          Returns the prefix for the namespace declared at the index or null if this is the default namespace declaration.
 String getNamespaceURI()
          Returns the URI of the prefix or the default namespace if the current event is a START_ELEMENT or END_ELEMENT, returns null if the event does not have a prefix or haven't name.
 String getNamespaceURI(int index)
          Returns the URI for the namespace declared at the index.
 String getNamespaceURI(String prefix)
          Return the URI for the given prefix.
 String getPIData()
          Get the data section of a processing instruction.
 String getPITarget()
          Get the target of a processing instruction.
 String getPrefix()
          Returns the prefix of the current event or null if the event does not have a prefix.
 Object getProperty(String name)
          Get the value of a feature/property from the underlying implementation
 String getText()
          Returns the current value of the event as a string.
 char[] getTextCharacters()
          Returns an array which contains the characters from this event.
 int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
          Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
 int getTextLength()
          Returns the length of the sequence of characters for this event.
 int getTextStart()
          Returns the offset into the text character array where the first character (of this text event) is stored.
 String getVersion()
          The XML version getter.
 boolean hasName()
          Returns true if the current event has a name (i.e. a START_ELEMENT or END_ELEMENT), returns false otherwise.
 boolean hasNext()
          Checks weather there is any event or not.
 boolean hasText()
          Return true if the current event has a text, false otherwise.
 boolean isAttribute()
          Returns true if the cursor points to a attribute event, false - otherwise.
 boolean isAttributeSpecified(int index)
          Returns a boolean which indicates if this attribute was created by default or not.
 boolean isCDATA()
          Returns true if the cursor points to a character data in CDATA section event, false - otherwise.
 boolean isCharacters()
          Returns true if the cursor points to a character data event, false - otherwise.
 boolean isComment()
          Returns true if the cursor points to a comment event, false - otherwise.
 boolean isEndElement()
          Returns true if the cursor points to an end tag event, false - otherwise.
 boolean isNamespace()
          Returns true if the cursor points to a namespace event, false - otherwise.
 boolean isPI()
          Returns true if the cursor points to a processing instruction event, false - otherwise.
 boolean isStandalone()
          Get the standalone declaration from the Complex Data Object.
 boolean isStartElement()
          Returns true if the cursor points to a start tag event, false - otherwise.
 boolean isWhiteSpace()
          Returns true if the cursor points to a white spaces event, false - otherwise.
 int next()
          Next event in iteration getter.
 int nextTag()
          Seeks the cursor on next element.
 void require(int type, String namespace, String name)
          Checks the current state against the specified conditions.
 boolean standaloneSet()
          Checks if standalone was set in the Complex Data Object.
static String textualizeState(int state)
          Returns the textual representation of specified state.
 String toString()
          Returns a string representation of the reader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CDOStreamReader

public CDOStreamReader(ComplexDataObject object)
Constructor with the Complex Data Object.

Constructs the Complex Data Object stream reader for scanning of the specified object.

Parameters:
object - the Complex Data Object instance just scanned over.
Method Detail

getEventType

public int getEventType()
Gets the current event.

Returns an integer code that indicates the type of the event the cursor is pointing to. Immediately after construction the state of this reader is not defined. This will return the zero.

Specified by:
getEventType in interface javax.xml.stream.XMLStreamReader
Returns:
the current state of reader.
See Also:
hasNext()

hasNext

public boolean hasNext()
                throws javax.xml.stream.XMLStreamException
Checks weather there is any event or not.

Returns true if there are more events and false if there are no more events. This method will return false if and only if the current state of the reader is END_DOCUMENT.

Specified by:
hasNext in interface javax.xml.stream.XMLStreamReader
Returns:
true if there are more events, false otherwise.
Throws:
javax.xml.stream.XMLStreamException - if there is a fatal error detecting the next state.

next

public int next()
         throws javax.xml.stream.XMLStreamException
Next event in iteration getter.

Get next event in iteration. The event iteration is almost like to the standard XML event iteration. So, the client application may expect the START_DOCUMENT, END_DOCUMENT, START_ELEMENT, END_ELEMENT, COMMENT and PROCESSING_INSTRUCTION with the same expectations as during the XML events iteration. The events related to character processing (CHARACTERS and CDATA) occured on any contiguous character data with the differences described in textual data representation for an complex and simple data types. However due the specific of an object that is scanned, this will not return the XML specific events like ENTITY_DECLARATION and ENTITY_DECLARATION. Also there is never happend the whitespace events, the human friendly formatting is under client application responsibility.

Given the Complex Data Object that has a following XML representation:

<foo1> <foo2>content text</foo2> <!--description--> <foo3 att="value"> <![CDATA[<greeting>Hello</greeting>]]> </foo3> </foo1>
    The behavior of calling next() when being on foo will be:
  1. the start element (START_ELEMENT for the <foo2>),
  2. then the characters section (CHARACTERS for an foo2),
  3. the end element (END_ELEMENT for the <foo2>),
  4. the comment (COMMENT),
  5. the start element (START_ELEMENT for the <foo3>),
  6. then the CDATA section (another CHARACTERS in CDATA section),
  7. and the end element (END_ELEMENT for the <foo3>).
  8. NOTE: empty element will be reported with two separate events: START_ELEMENT, END_ELEMENT - This preserves equivalency of empty element to <tag></tag>.

    This method will throw an IllegalStateException if it is called after hasNext() returns false.

    Specified by:
    next in interface javax.xml.stream.XMLStreamReader
    Returns:
    the integer code corresponding to the current parse event
    Throws:
    NoSuchElementException - if this is called when hasNext() returns false
    javax.xml.stream.XMLStreamException - if there is an error scanning the underlying Complex Data object.
    See Also:
    hasNext()

require

public void require(int type,
                    String namespace,
                    String name)
             throws javax.xml.stream.XMLStreamException
Checks the current state against the specified conditions.

Tests if the current event is of the given type and if the namespace and name match the current namespace and name of the current event. If the namespace is null and/or if the name is null they are not checked for equality.

Specified by:
require in interface javax.xml.stream.XMLStreamReader
Parameters:
type - the expected event type
namespace - the expected URI of the event, may be null.
name - the local name of the event, may be null.
Throws:
javax.xml.stream.XMLStreamException - if the required values are not matched to current state.

nextTag

public int nextTag()
            throws javax.xml.stream.XMLStreamException
Seeks the cursor on next element.

Skips any white space, comment or processing instructions until a START_ELEMENT or END_ELEMENT is reached. If other than white space characters, comment, processing instructions, START_ELEMENT, END_ELEMENT are encountered, an exception is thrown. This method should be used when processing element-only content seperated by white space.

Precondition: none
Postcondition: the current event is START_ELEMENT or END_ELEMENT and cursor may have moved over any whitespace event.

Specified by:
nextTag in interface javax.xml.stream.XMLStreamReader
Returns:
the event type of the element read (START_ELEMENT or END_ELEMENT)
Throws:
javax.xml.stream.XMLStreamException - if the current event is not white space, PROCESSING_INSTRUCTION, START_ELEMENT or END_ELEMENT
NoSuchElementException - if this is called when hasNext() returns false

getElementText

public String getElementText()
                      throws javax.xml.stream.XMLStreamException
Returns the text of current element.

Reads the content of a text-only element, an exception is thrown if this is not a text-only element.

Precondition: the current event is START_ELEMENT.
Postcondition: the current event is the corresponding END_ELEMENT.

Specified by:
getElementText in interface javax.xml.stream.XMLStreamReader
Throws:
javax.xml.stream.XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered

hasName

public boolean hasName()
Returns true if the current event has a name (i.e. a START_ELEMENT or END_ELEMENT), returns false otherwise.

Specified by:
hasName in interface javax.xml.stream.XMLStreamReader

getNamespaceURI

public String getNamespaceURI()
Returns the URI of the prefix or the default namespace if the current event is a START_ELEMENT or END_ELEMENT, returns null if the event does not have a prefix or haven't name.

Specified by:
getNamespaceURI in interface javax.xml.stream.XMLStreamReader
Returns:
the URI bound to this elements prefix, the default namespace, or null

getPrefix

public String getPrefix()
Returns the prefix of the current event or null if the event does not have a prefix.

Specified by:
getPrefix in interface javax.xml.stream.XMLStreamReader
Returns:
the prefix or null.

getLocalName

public String getLocalName()
Returns the (local) name of the current event.

For START_ELEMENT or END_ELEMENT returns the (local) name of the current element. The current event must be START_ELEMENT or END_ELEMENT.

Specified by:
getLocalName in interface javax.xml.stream.XMLStreamReader
Returns:
the local name of event.
Throws:
IllegalStateException - if this not a START_ELEMENT or END_ELEMENT.

getName

public QName getName()
Returns a QName for the current START_ELEMENT or END_ELEMENT event

Specified by:
getName in interface javax.xml.stream.XMLStreamReader
Returns:
the QName for the current START_ELEMENT or END_ELEMENT event
Throws:
IllegalStateException - if this not a START_ELEMENT or END_ELEMENT.

getAttributeCount

public int getAttributeCount()
Gets the attribute count.

Returns the count of attributes on this START_ELEMENT event, this method is only valid on a START_ELEMENT or ATTRIBUTE. This count excludes namespace definitions. Attribute indices are zero-based.

Specified by:
getAttributeCount in interface javax.xml.stream.XMLStreamReader
Returns:
returns the number of attributes.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.

isAttributeSpecified

public boolean isAttributeSpecified(int index)
Returns a boolean which indicates if this attribute was created by default or not.

Specified by:
isAttributeSpecified in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
true if this is a default attribute, false - otherwise.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.
NoSuchElementException - if there is no such attribute.

getAttributeLocalName

public String getAttributeLocalName(int index)
Returns the local name of the attribute at the provided index.

Specified by:
getAttributeLocalName in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
the local name of the attribute.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.
NoSuchElementException - if there is no such attribute.

getAttributeNamespace

public String getAttributeNamespace(int index)
Returns the namespace of the attribute at the provided index.

Specified by:
getAttributeNamespace in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
the namespace URI (can be null).
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.
NoSuchElementException - if there is no such attribute.

getAttributePrefix

public String getAttributePrefix(int index)
Returns the prefix of this attribute at the provided index.

Specified by:
getAttributePrefix in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
the prefix of the attribute.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.
NoSuchElementException - if there is no such attribute.

getAttributeType

public String getAttributeType(int index)
Returns the XML type of the attribute at the provided index.

Specified by:
getAttributeType in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
the XML type of the attribute.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.
NoSuchElementException - if there is no such attribute.

getAttributeValue

public String getAttributeValue(int index)
Returns the value of the attribute at the index.

Specified by:
getAttributeValue in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
the attribute value.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.
NoSuchElementException - if there is no such attribute.

getAttributeValue

public String getAttributeValue(String namespace,
                                String name)
Returns the value of the attribute with the specified namespace and local name.

Returns the normalized attribute value of the attribute with provided namespace and local name. If the namespace is null the namespace is not checked for equality.

Specified by:
getAttributeValue in interface javax.xml.stream.XMLStreamReader
Parameters:
namespace - the namespace of the attribute.
name - the local name of the attribute, cannot be null.
Returns:
returns the value of the attribute , returns null if not found
Throws:
IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE
IllegalArgumentException - if the name is null.

getAttributeName

public QName getAttributeName(int index)
Returns the QName of the attribute at the provided index.

Specified by:
getAttributeName in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the attribute.
Returns:
the QName of the attribute.
Throws:
IllegalStateException - if this not a START_ELEMENT or ATTRIBUTE.

getNamespaceCount

public int getNamespaceCount()
Gets the namespace count.

Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT. This method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On an END_ELEMENT the count is of the namespaces that are about to go out of scope. This is the equivalent of the information reported by SAX callback for an end element event.

Specified by:
getNamespaceCount in interface javax.xml.stream.XMLStreamReader
Returns:
returns the number of namespace declarations on this specific element.
Throws:
IllegalStateException - if this not a START_ELEMEN or END_ELEMENT.

getNamespacePrefix

public String getNamespacePrefix(int index)
Returns the prefix for the namespace declared at the index or null if this is the default namespace declaration.

Specified by:
getNamespacePrefix in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the namespace declaration.
Returns:
returns the namespace prefix.
Throws:
IllegalStateException - if this not a START_ELEMENT, END_ELEMENT or NAMESPACE.

getNamespaceURI

public String getNamespaceURI(int index)
Returns the URI for the namespace declared at the index.

Specified by:
getNamespaceURI in interface javax.xml.stream.XMLStreamReader
Parameters:
index - the position of the namespace declaration.
Returns:
returns the namespace URI.
Throws:
IllegalStateException - if this not a START_ELEMENT, END_ELEMENT or NAMESPACE.

getNamespaceURI

public String getNamespaceURI(String prefix)
Return the URI for the given prefix.

The URI returned depends on the current state of the processor.

NOTE: The 'xml' prefix is bound as defined in Namespaces in XML specification to "http://www.w3.org/XML/1998/namespace".

NOTE: The 'xmlns' prefix must be resolved to following namespace http://www.w3.org/2000/xmlns/.

Specified by:
getNamespaceURI in interface javax.xml.stream.XMLStreamReader
Parameters:
prefix - the prefix to lookup, may not be null.
Returns:
the URI bound to the given prefix or null if it is not bound.
Throws:
IllegalArgumentException - if the prefix is null.

getNamespaceContext

public NamespaceContext getNamespaceContext()
Returns a read only namespace context for the current position.

The context is transient and only valid until a call to next() changes the state of the reader.

Specified by:
getNamespaceContext in interface javax.xml.stream.XMLStreamReader
Returns:
return a namespace context.

hasText

public boolean hasText()
Return true if the current event has a text, false otherwise. The following events have text:

Specified by:
hasText in interface javax.xml.stream.XMLStreamReader

getText

public String getText()
Returns the current value of the event as a string.

Returns the string value of a CHARACTERS event, returns the value of a COMMENT, the string value of a CDATA section, the string value for a SPACE event.

Specified by:
getText in interface javax.xml.stream.XMLStreamReader
Returns:
the current text or null if no any.
Throws:
IllegalStateException - if this state is not a valid text state.

getTextLength

public int getTextLength()
Returns the length of the sequence of characters for this event.

Specified by:
getTextLength in interface javax.xml.stream.XMLStreamReader
Throws:
IllegalStateException - if this state is not a valid text state.

getTextStart

public int getTextStart()
Returns the offset into the text character array where the first character (of this text event) is stored.

Specified by:
getTextStart in interface javax.xml.stream.XMLStreamReader
Throws:
IllegalStateException - if this state is not a valid text state.

getTextCharacters

public char[] getTextCharacters()
Returns an array which contains the characters from this event.

This array should be treated as read-only and transient. I.e. the array will contain the text characters until the cursor moves on to the next event. Attempts to hold onto the character array beyond that time or modify the contents of the array are breaches of the contract for this interface.

Specified by:
getTextCharacters in interface javax.xml.stream.XMLStreamReader
Returns:
the current text or an empty array.
Throws:
IllegalStateException - if this state is not a valid text state.

getTextCharacters

public int getTextCharacters(int sourceStart,
                             char[] target,
                             int targetStart,
                             int length)
                      throws javax.xml.stream.XMLStreamException
Gets the the text associated with a CHARACTERS, SPACE or CDATA event.

Text starting a sourceStart is copied into target starting at targetStart. Up to length characters are copied. The number of characters actually copied is returned.

The sourceStart argument must be greater or equal to 0 and less than or equal to the number of characters associated with the event. Usually, one requests text starting at a sourceStart of 0. If the number of characters actually copied is less than the length, then there is no more text. Otherwise, subsequent calls need to be made until all text has been retrieved.

The targetStart argument must be greater than or equal to 0 and less than the length of target, length must be greater than 0 and targetStart + length must be less than or equal to length of target.

Specified by:
getTextCharacters in interface javax.xml.stream.XMLStreamReader
Parameters:
sourceStart - the index of the first character in the source array to copy.
target - the destination array.
targetStart - the start offset in the target array.
length - the number of characters to copy.
Returns:
the number of characters actually copied.
Throws:
IndexOutOfBoundsException - if targetStart < 0 or > than the length of target or if length < 0 or targetStart + length > length of target.
UnsupportedOperationException - if this method is not supported.
NullPointerException - is if target is null.
javax.xml.stream.XMLStreamException

getPITarget

public String getPITarget()
Get the target of a processing instruction.

Specified by:
getPITarget in interface javax.xml.stream.XMLStreamReader
Returns:
the target of current processing instruction.
Throws:
IllegalStateException - if the current event is not a XMLStreamConstants.PROCESSING_INSTRUCTION

getPIData

public String getPIData()
Get the data section of a processing instruction.

Specified by:
getPIData in interface javax.xml.stream.XMLStreamReader
Returns:
the data (if processing instruction has any), or null if the processing instruction only has target.
Throws:
IllegalStateException - if the current event is not a XMLStreamConstants.PROCESSING_INSTRUCTION

isStartElement

public boolean isStartElement()
Returns true if the cursor points to a start tag event, false - otherwise.

Specified by:
isStartElement in interface javax.xml.stream.XMLStreamReader
Returns:
true if and only if the cursor points to a start tag, false - otherwise.

isNamespace

public boolean isNamespace()
Returns true if the cursor points to a namespace event, false - otherwise.

Returns:
true if and only if the cursor points to a namespace, false - otherwise.

isAttribute

public boolean isAttribute()
Returns true if the cursor points to a attribute event, false - otherwise.

Returns:
true if and only if the cursor points to an attribute, false - otherwise.

isCharacters

public boolean isCharacters()
Returns true if the cursor points to a character data event, false - otherwise.

Specified by:
isCharacters in interface javax.xml.stream.XMLStreamReader
Returns:
true if and only if the cursor points to character data, false - otherwise.

isCDATA

public boolean isCDATA()
Returns true if the cursor points to a character data in CDATA section event, false - otherwise.

Returns:
true if and only if the cursor points to character data in CDATA, false - otherwise.

isWhiteSpace

public boolean isWhiteSpace()
Returns true if the cursor points to a white spaces event, false - otherwise.

Specified by:
isWhiteSpace in interface javax.xml.stream.XMLStreamReader
Returns:
true if and only if the cursor points to white spaces, false - otherwise.

isEndElement

public boolean isEndElement()
Returns true if the cursor points to an end tag event, false - otherwise.

Specified by:
isEndElement in interface javax.xml.stream.XMLStreamReader
Returns:
true if and only if the cursor points to a an end tag, false - otherwise.

isPI

public boolean isPI()
Returns true if the cursor points to a processing instruction event, false - otherwise.

Returns:
true if and only if the cursor points to a processing instruction, false - otherwise.

isComment

public boolean isComment()
Returns true if the cursor points to a comment event, false - otherwise.

Returns:
true if and only if the cursor points to a comment, false - otherwise.

getEncoding

public String getEncoding()
Input encoding getter.

Always returns the null since input encoding lies out from a Complex Data Object responsibility.

Specified by:
getEncoding in interface javax.xml.stream.XMLStreamReader
Returns:
the null.

getCharacterEncodingScheme

public String getCharacterEncodingScheme()
The XML charachter encoding getter.

Always returns the null since XML charachter encoding lies out from a Complex Data Object responsibility.

Specified by:
getCharacterEncodingScheme in interface javax.xml.stream.XMLStreamReader
Returns:
the null.

getVersion

public String getVersion()
The XML version getter.

Always returns the null since input XML version lies out from a Complex Data Object responsibility.

Specified by:
getVersion in interface javax.xml.stream.XMLStreamReader
Returns:
the null.

standaloneSet

public boolean standaloneSet()
Checks if standalone was set in the Complex Data Object.

Always returns the false since "XML standalone" lies out from a Complex Data Object responsibility.

Specified by:
standaloneSet in interface javax.xml.stream.XMLStreamReader
Returns:
the false always.

isStandalone

public boolean isStandalone()
Get the standalone declaration from the Complex Data Object.

Always returns the false since "XML standalone" lies out from a Complex Data Object responsibility.

Specified by:
isStandalone in interface javax.xml.stream.XMLStreamReader
Returns:
the false always.

getLocation

public javax.xml.stream.Location getLocation()
Return the current location of the processor. If the Location is unknown the processor should return an implementation of Location that returns -1 for the location and null for the publicId and systemId. The location information is only valid until next() is called.

Specified by:
getLocation in interface javax.xml.stream.XMLStreamReader

getProperty

public Object getProperty(String name)
                   throws IllegalArgumentException
Get the value of a feature/property from the underlying implementation

Specified by:
getProperty in interface javax.xml.stream.XMLStreamReader
Parameters:
name - The name of the property, may not be null
Returns:
The value of the property
Throws:
IllegalArgumentException - if name is null

close

public void close()
           throws javax.xml.stream.XMLStreamException
Frees any resources associated with this Reader. This method does not close the underlying input source.

Specified by:
close in interface javax.xml.stream.XMLStreamReader
Throws:
javax.xml.stream.XMLStreamException - if there are errors freeing associated resources

toString

public String toString()
Returns a string representation of the reader.

Actually returns the textual representation of the state of reader.

Overrides:
toString in class Object
Returns:
a string representation of the reader.

textualizeState

public static String textualizeState(int state)
Returns the textual representation of specified state.

Gets the textual representation of the certain event type provided by specified state value. If event type is not valid or is undefined, the [UNKNOWN] is returned.

Parameters:
state - The event type which textualize.
Returns:
the textual representation of provided event type.

allocateScanner

protected void allocateScanner(biz.c24.io.api.presentation.Scanner scanner)
The underlied CDO scanner setter.

Performs the current scanner substitution that forces to move the cursor for an anderlied Complex Data object.

Parameters:
scanner - the new CDO scanner instance.


C24 Technologies © 2002-2012: All Rights Reserved.