Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

XMLParser Class Reference

Interface that any parser wrapper should implement in order to be use in Axis as a XML PULL parser. This interface basically describes XML pull parsing behavior. Any SAX or DOM parser can be wrapped to expose XML pull behavior by implementing this interface. But the efficiency of the overall component depends on the particular implementaion. Its the responsibility of the implementation class to free any memory allocated inside the class. The class should not deallocate the given input stream. More...

#include <XMLParser.h>

List of all members.

Public Methods

virtual int setInputStream (AxisIOStream *pInputStream)=0
 Sets the input stream.

virtual const XML_Ch * getNS4Prefix (const XML_Ch *pcPrefix)=0
 Gets the corresponding namespace string for a given prefix.

virtual int getStatus ()=0
 Used to get the parser status.

virtual const AnyElementnext (bool bIsCharData=false)=0
 Used to get the next XML event.

virtual const AnyElementanyNext ()=0
 Used to get the next XML event.

virtual const XML_Ch * getPrefix4NS (const XML_Ch *pcNS)=0
 Gets the corresponding namespace string for a given prefix.


Detailed Description

Interface that any parser wrapper should implement in order to be use in Axis as a XML PULL parser. This interface basically describes XML pull parsing behavior. Any SAX or DOM parser can be wrapped to expose XML pull behavior by implementing this interface. But the efficiency of the overall component depends on the particular implementaion. Its the responsibility of the implementation class to free any memory allocated inside the class. The class should not deallocate the given input stream.

Author:
Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)


Member Function Documentation

virtual const AnyElement* XMLParser::anyNext   [pure virtual]
 

Used to get the next XML event.

Used to get the any next XML event. The valid events are start element, end element, character data and prefix mappings. If we think of SAX events only processing instruction events are not returned by this method. If the implementation of this interface is wrapping up a SAX parser it should follow the above rules.

As the function signature suggests the returned AnyElement is const and the caller should not deallocate any member of it. Its the sole responsibility of the Parser wrapper implementation to manage any memory allocated by it.

Returns:
Returns a filled AnyElement structure that contains all the data of the current XML element. See AnyElement.h for the structure of AnyElement.

virtual const XML_Ch* XMLParser::getNS4Prefix const XML_Ch *    pcPrefix [pure virtual]
 

Gets the corresponding namespace string for a given prefix.

Gets the corresponding namespace string for a given prefix. The Parser should store the prefix/namespace pairs that it finds and valid at the current cursor position of the stream. This method provides a way to get the corresponding namespace for any valid prefix at the current cursor position of the pull parser.

Parameters:
pcPrefix  Prefix for which the namespace string is requested
Returns:
The namespace if a match is found. NULL otherwise.

virtual const XML_Ch* XMLParser::getPrefix4NS const XML_Ch *    pcNS [pure virtual]
 

Gets the corresponding namespace string for a given prefix.

Gets the corresponding prefix string for a given namespace. The Parser should store the prefix/namespace pairs that it finds and valid at the current cursor position of the stream. This method provides a way to get the corresponding prefix for any valid namespace at the current cursor position of the pull parser.

Parameters:
pcNS  Namespace for which the prefix string is requested
Returns:
The prefix if a match is found. NULL otherwise.

virtual int XMLParser::getStatus   [pure virtual]
 

Used to get the parser status.

Returns:
Returns AXIS_SUCCESS if nothing has gone wrong. AXIS_FAIL otherwise.

virtual const AnyElement* XMLParser::next bool    bIsCharData = false [pure virtual]
 

Used to get the next XML event.

Used to get the next XML data event. The valid events are start element, end element and character data. If we think of SAX events the processing instruction events, namespace prefix mapping events are not returned by this method. If the implementation of this interface is wrapping up a SAX parser it should follow the above rules.

As the function signature suggests the returned AnyElement is const and the caller should not deallocate any member of it. Its the sole responsibility of the Parser wrapper implementation to manage any memory allocated by it.

Parameters:
bIsCharData  Indicates whether Axis is expecting a character data event or not. If Axis is NOT expecting a character data event (bIsCharData is false) the parser should NOT return a character data event. Instead it should skip all character data events until it finds a non-character data event and return it. This behaviour is needed to ignore unexpected white space of the stream.
Returns:
Returns a filled AnyElement structure that contains all the data of the current XML element. See AnyElement.h for the structure of AnyElement.

virtual int XMLParser::setInputStream AxisIOStream   pInputStream [pure virtual]
 

Sets the input stream.

Sets the input stream. Here the parser should be prepared to start parsing a new stream and hence should be initialized to its initial state. Axis will call this function first for each input stream to be parsed.

Precondition:
The stream passed MUST be an already opened stream (established connection.
Parameters:
pInputStream  Input stream from which the data to be parsed are read by calling its getBytes function. Function should not deallocate either pInputStream
Returns:
AXIS_SUCCESS if successfull. AXIS_FAIL otherwise.


The documentation for this class was generated from the following file:
Generated on Tue Jun 29 09:27:58 2004 for AxisC++ by doxygen1.2.18