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 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.
|
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;"><soap:Body></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;"> <OpenOrReuse </span>
<span style=" color:#ff0000;">xmlns</span>
<span style=" color:#0000ff;">=</span>
<span style=" color:#aa00ff;">"http://www.sgt.eu/VEDA.SOA/Session.v1" </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;"> <ClientLogin></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;"> <HostName></span>
<span style=" font-weight:600; color:#000000;">00XDSVMAM03200</span>
<span style=" color:#0000ff;"></HostName></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;"> </ClientLogin></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;"> </OpenOrReuse></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;"></soap:Body></span>
</p>
</body>
</html>
◆ 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
-
| buffer | Buffer de N char contenant le Body XML à afficher. |
| hideNamespaces | Si 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
-
| blob | Le flux XML du message à traiter. |
| hideNamespaces | Si 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