org.idoox.xmlrpc.encoding
Interface EncodingTokenizer


public interface EncodingTokenizer

This class tokenizes the incoming XML-based stream of generic encoding into a stream of structural tokens.

Since:
4.0
Component:
Core

Method Summary
 QName convertToQName(java.lang.String qname)
          converts qname to expanded name
 int[] getArrayDimensions()
          returns the dimensions of the array.
 int[] getArrayOffset()
          returns the offset of the first member of the array.
 int[] getArrayPosition(int expectedDimensions)
          returns the position of the current structural token (structure, array start, primitive, reference) in the array
 int getCurrentToken()
          returns the current token
 org.w3c.dom.Element getElementTokenValue(org.w3c.dom.Document doc)
          returns token as DOM element
 java.lang.String getID()
          returns the id of the current element
 java.lang.String getPrimitiveTokenValue()
          returns the value of the primitive token
 java.lang.String getReference()
          returns the reference location
 java.lang.String getTokenName()
          returns the name of the previously returned token
 java.lang.String getTokenNamespaceURI()
          returns the namespace of the previously returned token
 java.lang.String getTokenTypeName()
          returns the type of the previously returned token
 java.lang.String getTokenTypeNamespaceURI()
          returns the namespace of the type of the previously returned token
 void init(Configurable config)
          initializes the encoding tokenizer
 int next()
          fills the internal token arguments (such as name, type, etc.) and returns the next token.
 org.w3c.dom.Element nextAsElement(org.w3c.dom.Document doc)
          Deprecated.  
 int nextToken()
          fills the internal token arguments (such as name, type, etc.) and returns the next token.
 void setInput(Tokenizer parser, java.lang.String encodingId)
          sets the input as a pair of tokenizer and source URI.
 void setInputMessage(Message message, java.lang.String encodingId)
          sets the input message part
 

Method Detail

setInputMessage

public void setInputMessage(Message message,
                            java.lang.String encodingId)
                     throws MessageProcessingException
sets the input message part

Parameters:
message - the input message
encodingId - the id of the group of encodings which is being used
Throws:
MessageProcessingException - if the message is malformed

setInput

public void setInput(Tokenizer parser,
                     java.lang.String encodingId)
              throws MessageProcessingException
sets the input as a pair of tokenizer and source URI. This method is used when one tokenizer detects different encoding, obtains the tokenizer from the encoding repository and calls the tokenizer with current tokenizer and URL.

Parameters:
parser - the raw xml tokenizer
encodingId - the id of the group of encodings which is being used
Throws:
MessageProcessingException - if the message is malformed

nextToken

public int nextToken()
              throws MessageProcessingException
fills the internal token arguments (such as name, type, etc.) and returns the next token. Use next() if you want to be able to call getElementtokenValue() afterwards.

Returns:
the next token
Throws:
MessageProcessingException - if the message is malformed
See Also:
EncodingToken

next

public int next()
         throws MessageProcessingException
fills the internal token arguments (such as name, type, etc.) and returns the next token. Returns EncodingTokenizer.UNKNOWN if the token type can not be estimated at this point. In this case, successive call to the getCurrentToken() will return the token.

Returns:
the next token
Throws:
MessageProcessingException - if the message is malformed
See Also:
EncodingToken

nextAsElement

public org.w3c.dom.Element nextAsElement(org.w3c.dom.Document doc)
                                  throws MessageProcessingException
Deprecated.  

returns next token as DOM element

Parameters:
doc - document in which the resulting element should be created.
Returns:
Element containing the next member.
Throws:
MessageProcessingException - thrown when the message is malformed.

getElementTokenValue

public org.w3c.dom.Element getElementTokenValue(org.w3c.dom.Document doc)
                                         throws MessageProcessingException
returns token as DOM element

Parameters:
doc - document in which the resulting element should be created.
Returns:
Element containing the next member.
Throws:
MessageProcessingException - thrown when the message is malformed.

getCurrentToken

public int getCurrentToken()
                    throws MessageProcessingException
returns the current token

Returns:
the current token
Throws:
MessageProcessingException - if the message is malformed

getTokenName

public java.lang.String getTokenName()
                              throws MessageProcessingException
returns the name of the previously returned token

Returns:
the name of the token
Throws:
MessageProcessingException - if the message is malformed

getTokenNamespaceURI

public java.lang.String getTokenNamespaceURI()
                                      throws MessageProcessingException
returns the namespace of the previously returned token

Returns:
the namespace of the token
Throws:
MessageProcessingException - if the message is malformed

getTokenTypeName

public java.lang.String getTokenTypeName()
                                  throws MessageProcessingException
returns the type of the previously returned token

Returns:
the type of the token or null if there was no type in the message
Throws:
MessageProcessingException - if the message is malformed

getTokenTypeNamespaceURI

public java.lang.String getTokenTypeNamespaceURI()
                                          throws MessageProcessingException
returns the namespace of the type of the previously returned token

Returns:
the namespace of the type the token or null if there was no type in the message
Throws:
MessageProcessingException - if the message is malformed

getArrayDimensions

public int[] getArrayDimensions()
                         throws MessageProcessingException
returns the dimensions of the array.

Returns:
allocated array of dimensions. This call must always return newly allocated array, since the modification is desired.
Throws:
MessageProcessingException - if the message is malformed

getArrayOffset

public int[] getArrayOffset()
                     throws MessageProcessingException
returns the offset of the first member of the array. This method must be called at ARRAY_START.

Returns:
allocated array of the offset of the first member.
Throws:
MessageProcessingException - if the message is malformed

getArrayPosition

public int[] getArrayPosition(int expectedDimensions)
                       throws MessageProcessingException
returns the position of the current structural token (structure, array start, primitive, reference) in the array

Parameters:
expectedDimensions - the number of expected dimensions
Returns:
the position in the array. The returned array may have size larged than expectedDimensions and may be rewritten during any following call to EncodingTokenizer
Throws:
MessageProcessingException - if the message is malformed

getPrimitiveTokenValue

public java.lang.String getPrimitiveTokenValue()
                                        throws MessageProcessingException
returns the value of the primitive token

Returns:
the value of the primitive token
Throws:
MessageProcessingException - if the message is malformed

getID

public java.lang.String getID()
                       throws MessageProcessingException
returns the id of the current element

Returns:
the id of the current element
Throws:
MessageProcessingException - if the message is malformed

getReference

public java.lang.String getReference()
                              throws MessageProcessingException
returns the reference location

Returns:
the reference location
Throws:
MessageProcessingException - if the message is malformed

convertToQName

public QName convertToQName(java.lang.String qname)
converts qname to expanded name

Parameters:
qname - the name to be converted
Returns:
the resulting qname

init

public void init(Configurable config)
initializes the encoding tokenizer

Parameters:
config - the configuration of the tokenizer