XDK API  3.6.0
Documentation
Data Structures | Typedefs | Enumerations | Functions
Serval_XmlParser.h File Reference

Interface to XML ParserThe purpose of this module is scanning a XML document. This means that the characters are divided in logical (lexical) parts. All information needed to continue parsing is stored inside a context. That way it is possible to simultanously handle multiple SOAP requests. Every message gets its own context for scanning. Furthermore, the original XML document is not modified. More...

#include <Serval_StringDescr.h>
+ Include dependency graph for Serval_XmlParser.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  XmlParser_S
 

Typedefs

typedef struct XmlParser_S XmlParser_T
 

Enumerations

enum  XmlTokenType_T
 

Functions

static void XmlParser_getLevel (XmlParser_T *xmlParser_ptr, uint16_t *level_ptr)
 
static void XmlParser_getTagName (XmlParser_T *xmlParser_ptr, StringDescr_T *str_ptr)
 
static void XmlParser_getTagValue (XmlParser_T *xmlParser_ptr, StringDescr_T *str_ptr)
 
retcode_t XmlParser_initialize (void)
 
bool XmlParser_matchTag (XmlParser_T *ctx_ptr, const char *tagName_ptr, uint16_t level)
 
XmlTokenType_T XmlParser_parseNextToken (XmlParser_T *xmlPraser_ptr)
 
retcode_t XmlParser_setup (XmlParser_T *xmlParser_ptr, const char *xml_ptr, unsigned int len)
 

Detailed Description

*  <node>
*     <subnode attr="attrValue">
*        <subsubnode>nodeValue</subsubnode>
*     </subnode>
*  </node>
*  

results in (notation ("tag type", "tag name", "tag value", "nesting level")):

*  (start, node, NULL, 0)
*     (start, subnode, NULL, 1)
*     (attribute, attr, attrValue, 1)
*        (single, subsubnode, nodValue, 2)
*     (end, subnode, NULL, 1)
*  (end, node, NULL, 0)
*  

Typedef Documentation

typedef struct XmlParser_S XmlParser_T

The context structure describes the current state of one specific parsing process.

See also
struct XmlParser_S

Enumeration Type Documentation

Types of all possible XML tokens

Enumerator
XML_TOKEN_NODE 
XML_TOKEN_NODE_START 
XML_TOKEN_NODE_END 
XML_TOKEN_ATTRIBUTE 
XML_TOKEN_EOF 
XML_TOKEN_INCOMPLETE 
XML_TOKEN_INVALID 

Function Documentation

static void XmlParser_getLevel ( XmlParser_T xmlParser_ptr,
uint16_t *  level_ptr 
)
inlinestatic

This function is called to fetch level of a given context of XML parser.

Parameters
[in]xmlParser_ptrReference to a XmlParser_T object whose level needs to be fetched.
[in]level_ptrThis will hold the value of level when the function returns.
static void XmlParser_getTagName ( XmlParser_T xmlParser_ptr,
StringDescr_T str_ptr 
)
inlinestatic

This function is called to fetch a tag name from a given context of xml parser into a String Descriptor.

Parameters
[in]xmlParser_ptrReference to a XmlParser_T object which contains the context of xml parser from which contains desired tag name.
[in]str_ptrReference to a StringDescr_T object which identifies the instance of destination string descriptor.
Returns
RC_OK, if successful
RC_STRING_DESCRIPTOR_ERROR

+ Here is the call graph for this function:

static void XmlParser_getTagValue ( XmlParser_T xmlParser_ptr,
StringDescr_T str_ptr 
)
inlinestatic

This function is called to fetch a tag value from a given context of xml parser into a String Descriptor.

Parameters
[in]xmlParser_ptrReference to a XmlParser_T object which contains the context of xml parser from which contains desired tag value.
[in]str_ptrReference to a StringDescr_T object which identifies the instance of destination string descriptor.
Returns
RC_OK, if successful
RC_STRING_DESCRIPTOR_ERROR

+ Here is the call graph for this function:

retcode_t XmlParser_initialize ( void  )

This function is called to initialize the XML Parser Module.

Returns
RC_OK, if successful
bool XmlParser_matchTag ( XmlParser_T ctx_ptr,
const char *  tagName_ptr,
uint16_t  level 
)

This function compares a XML parser context with the given tag name and level, and returns the result.

Parameters
[in]ctx_ptrReference to a XmlParser_T object which contains the context of XML parser to be compared.
[in]tagName_ptrC string of tag name to be compared.
[in]level
Returns
true if found equal, otherwise false.
XmlTokenType_T XmlParser_parseNextToken ( XmlParser_T xmlPraser_ptr)

This function returns the next found token. This also causes modification of xmlPraser_ptr.

Parameters
[in]xmlPraser_ptrReference to a XmlParser_T object which gives the context to be processed. It is also modified during the process. Relevant for the application are: tagName, tagValue and level.
Returns
The type of found token.
Note
In principle, it is also possible that the token type is stored inside the context. In contrast, returning the token type enables a better control flow for the calling function. Thats why this approach is used.
retcode_t XmlParser_setup ( XmlParser_T xmlParser_ptr,
const char *  xml_ptr,
unsigned int  len 
)

This function is called to initialize a given scanner context with a XML document.

Parameters
[in]xmlParser_ptrContext to be initialized.
[in]xml_ptrXML document to be used for a later scanning process.
[in]lenContext-Length
Returns
RC_OK, if successful

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:46 by doxygen 1.8.8