\section{XMLParser Class Reference}
\label{classXMLParser}\index{XMLParser@{XMLParser}}
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. 


{\tt \#include $<$XMLParser.h$>$}

\subsection*{Public Methods}
\begin{CompactItemize}
\item 
virtual int {\bf set\-Input\-Stream} ({\bf Axis\-IOStream} $\ast$p\-Input\-Stream)=0
\begin{CompactList}\small\item\em Sets the input stream.\item\end{CompactList}\item 
virtual const XML\_\-Ch $\ast$ {\bf get\-NS4Prefix} (const XML\_\-Ch $\ast$pc\-Prefix)=0
\begin{CompactList}\small\item\em Gets the corresponding namespace string for a given prefix.\item\end{CompactList}\item 
virtual int {\bf get\-Status} ()=0
\begin{CompactList}\small\item\em Used to get the parser status.\item\end{CompactList}\item 
virtual const {\bf Any\-Element} $\ast$ {\bf next} (bool b\-Is\-Char\-Data=false)=0
\begin{CompactList}\small\item\em Used to get the next XML event.\item\end{CompactList}\item 
virtual const {\bf Any\-Element} $\ast$ {\bf any\-Next} ()=0
\begin{CompactList}\small\item\em Used to get the next XML event.\item\end{CompactList}\item 
virtual const XML\_\-Ch $\ast$ {\bf get\-Prefix4NS} (const XML\_\-Ch $\ast$pc\-NS)=0
\begin{CompactList}\small\item\em Gets the corresponding namespace string for a given prefix.\item\end{CompactList}\end{CompactItemize}


\subsection{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.

\begin{Desc}
\item[Author: ]\par
Susantha Kumara ({\tt susantha@opensource.lk}, {\tt skumara@virtusa.com}) \end{Desc}




\subsection{Member Function Documentation}
\index{XMLParser@{XMLParser}!anyNext@{anyNext}}
\index{anyNext@{anyNext}!XMLParser@{XMLParser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual const {\bf Any\-Element}$\ast$ XMLParser::any\-Next ()\hspace{0.3cm}{\tt  [pure virtual]}}\label{classXMLParser_a5}


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 {\bf Any\-Element} {\rm (p.\,\pageref{structAnyElement})} 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.

\begin{Desc}
\item[Returns: ]\par
Returns a filled {\bf Any\-Element} {\rm (p.\,\pageref{structAnyElement})} structure that contains all the data of the current XML element. See {\bf Any\-Element.h} for the structure of {\bf Any\-Element} {\rm (p.\,\pageref{structAnyElement})}. \end{Desc}
\index{XMLParser@{XMLParser}!getNS4Prefix@{getNS4Prefix}}
\index{getNS4Prefix@{getNS4Prefix}!XMLParser@{XMLParser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual const XML\_\-Ch$\ast$ XMLParser::get\-NS4Prefix (const XML\_\-Ch $\ast$ {\em pc\-Prefix})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classXMLParser_a2}


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.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
pc\-Prefix}]Prefix for which the namespace string is requested \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The namespace if a match is found. NULL otherwise. \end{Desc}
\index{XMLParser@{XMLParser}!getPrefix4NS@{getPrefix4NS}}
\index{getPrefix4NS@{getPrefix4NS}!XMLParser@{XMLParser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual const XML\_\-Ch$\ast$ XMLParser::get\-Prefix4NS (const XML\_\-Ch $\ast$ {\em pc\-NS})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classXMLParser_a6}


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.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
pc\-NS}]Namespace for which the prefix string is requested \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The prefix if a match is found. NULL otherwise. \end{Desc}
\index{XMLParser@{XMLParser}!getStatus@{getStatus}}
\index{getStatus@{getStatus}!XMLParser@{XMLParser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int XMLParser::get\-Status ()\hspace{0.3cm}{\tt  [pure virtual]}}\label{classXMLParser_a3}


Used to get the parser status.

\begin{Desc}
\item[Returns: ]\par
Returns AXIS\_\-SUCCESS if nothing has gone wrong. AXIS\_\-FAIL otherwise. \end{Desc}
\index{XMLParser@{XMLParser}!next@{next}}
\index{next@{next}!XMLParser@{XMLParser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual const {\bf Any\-Element}$\ast$ XMLParser::next (bool {\em b\-Is\-Char\-Data} = false)\hspace{0.3cm}{\tt  [pure virtual]}}\label{classXMLParser_a4}


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 {\bf Any\-Element} {\rm (p.\,\pageref{structAnyElement})} 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.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
b\-Is\-Char\-Data}]Indicates whether Axis is expecting a character data  event or not. If Axis is NOT expecting a character data event  (b\-Is\-Char\-Data 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. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
Returns a filled {\bf Any\-Element} {\rm (p.\,\pageref{structAnyElement})} structure that contains all the data of the current XML element. See {\bf Any\-Element.h} for the structure of {\bf Any\-Element} {\rm (p.\,\pageref{structAnyElement})}. \end{Desc}
\index{XMLParser@{XMLParser}!setInputStream@{setInputStream}}
\index{setInputStream@{setInputStream}!XMLParser@{XMLParser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int XMLParser::set\-Input\-Stream ({\bf Axis\-IOStream} $\ast$ {\em p\-Input\-Stream})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classXMLParser_a1}


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.

\begin{Desc}
\item[Precondition: ]\par
The stream passed MUST be an already opened stream (established connection. \end{Desc}
\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
p\-Input\-Stream}]Input stream from which the data to be parsed are read by calling its get\-Bytes function. Function should not deallocate either p\-Input\-Stream \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
AXIS\_\-SUCCESS if successfull. AXIS\_\-FAIL otherwise. \end{Desc}


The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf XMLParser.h}\end{CompactItemize}
