SOAP-SVCLOG-Viewer 1.4
A friendly SOAP log messages viewer
BodyTextParser Class Reference

La classe statique BodyTextParser analyse le Body XML d'un message, pour l'afficher sous forme de texte simple dans l'onglet "Text View". More...

#include <BodyTextParser.h>

Static Public Member Functions

static int parse (std::string blob, bool hideNamespaces)
 Cette méthode effectue le parsing d'un XML sous forme de std::string.
static int parse (char *buffer, bool hideNamespaces)
 Cette méthode effectue le parsing d'un message XML sous forme de char*.
static std::string getFormatedBlob ()
 Cette méthode retourne le flux XML formaté par le Parser en ajoutant des balises html de coloration syntaxique.
static void XMLCALL startElementHandler (void *userData, const XML_Char *name, const XML_Char **attrs)
 Ce handler statique est appelé à chaque balise ouvrante. On ajoute le texte dans formatedBlob.
static void XMLCALL endElementHandler (void *userData, const XML_Char *name)
 Ce handler statique est appelé à chaque balise fermante. On ajoute le texte dans formatedBlob.
static void XMLCALL commentHandler (void *userData, const XML_Char *data)
 Ce Handler est appelé à chaque fois qu'il y a un Commentaire.
static void XMLCALL dataHandler (void *userData, const XML_Char *content, int length)
 Ce Handler est appelé à chaque fois qu'il y a un Content.

Detailed Description

La classe statique BodyTextParser analyse le Body XML d'un message, pour l'afficher sous forme de texte simple dans l'onglet "Text View".


Elle sert à convertir un blob XML (typiquement le body d'un message SOAP) en une string formatée, contenant des balises de coloration syntaxique, pour un affichage dans QT. Le parser SAX est basé sur la librarie EXPAT.

Author
David de Lorenzo

Exemple de formatedBlob:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
   <head>
     <meta name="qrichtext" content="1" />
     <style type="text/css"> p, li { white-space: pre-wrap; }</style>
   </head>
   <body style=" font-family:'Courier New'; font-size:9pt; font-weight:400; font-style:normal;">
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">&lt;soap:Body&gt;</span>
      </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">   &lt;OpenOrReuse </span>
         <span style=" color:#ff0000;">xmlns</span>
         <span style=" color:#0000ff;">=</span>
         <span style=" color:#aa00ff;">&quot;http://www.sgt.eu/VEDA.SOA/Session.v1&quot; </span>
      </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">      &lt;ClientLogin&gt;</span>
      </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">         &lt;HostName&gt;</span>
         <span style=" font-weight:600; color:#000000;">00XDSVMAM03200</span>
         <span style=" color:#0000ff;">&lt;/HostName&gt;</span>
      </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">      &lt;/ClientLogin&gt;</span>
      </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">   &lt;/OpenOrReuse&gt;</span>
      </p>
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
         <span style=" color:#0000ff;">&lt;/soap:Body&gt;</span>
      </p>
   </body>
</html>

Member Function Documentation

◆ commentHandler()

void XMLCALL BodyTextParser::commentHandler ( void * userData,
const XML_Char * data )
static

Ce Handler est appelé à chaque fois qu'il y a un Commentaire.


Parameters
userData: Non utilisé.
data: Le texte du commentaire.

◆ dataHandler()

void XMLCALL BodyTextParser::dataHandler ( void * userData,
const XML_Char * content,
int length )
static

Ce Handler est appelé à chaque fois qu'il y a un Content.


Parameters
userData: Non utilisé.
content: Contenu textuel de la section XML.
length: Le contenu textuel n'étant pas NULL-terminated: il faut utiliser length.

◆ endElementHandler()

void XMLCALL BodyTextParser::endElementHandler ( void * userData,
const XML_Char * name )
static

Ce handler statique est appelé à chaque balise fermante. On ajoute le texte dans formatedBlob.


Parameters
userData: Non utilisé.
name: Nom de la balise.

◆ getFormatedBlob()

std::string BodyTextParser::getFormatedBlob ( )
static

Cette méthode retourne le flux XML formaté par le Parser en ajoutant des balises html de coloration syntaxique.


Returns
le flux XML avec les balises html de coloration syntaxique.

◆ parse() [1/2]

int BodyTextParser::parse ( char * buffer,
bool hideNamespaces )
static

Cette méthode effectue le parsing d'un message XML sous forme de char*.


Parameters
bufferBuffer de N char contenant le Body XML à afficher.
hideNamespacesSi True, on n'affichera pas les namespace.
Returns
le code d'erreur rencontré (XML_ERROR_NONE si aucun).

◆ parse() [2/2]

int BodyTextParser::parse ( std::string blob,
bool hideNamespaces )
static

Cette méthode effectue le parsing d'un XML sous forme de std::string.


Parameters
blobLe flux XML du message à traiter.
hideNamespacesSi True, on n'affichera pas les namespace.
Returns
le code d'erreur rencontré (XML_ERROR_NONE si aucun).

◆ startElementHandler()

void XMLCALL BodyTextParser::startElementHandler ( void * userData,
const XML_Char * name,
const XML_Char ** attrs )
static

Ce handler statique est appelé à chaque balise ouvrante. On ajoute le texte dans formatedBlob.


Parameters
userData: Non utilisé.
name: Nom de la balise.
attrs: Eventuel tableau des attributs.

The documentation for this class was generated from the following files:
  • E:/Sources/Repositories/VOR/TOOLS/SOAP-Message-Viewer/Sources/BodyTextParser.h
  • E:/Sources/Repositories/VOR/TOOLS/SOAP-Message-Viewer/Sources/BodyTextParser.cpp