![]() |
PhoenixXml
0.1.0
Xml parser for Phoenix
|
#include "pxml_utils.h"
Go to the source code of this file.
Macros | |
#define | ALLOWED_ATTRIBUTE_CHAR "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:-" |
List of allowed char as attribute name. | |
#define | ALLOWED_BALISE_CHAR "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:?!-" |
List of allowed char as balise name. | |
Functions | |
PString | pxml_attrStr (const PXmlAttr &xmlAttr, bool isSvg) |
Convert attribute in string. | |
PString | pxml_baliseStr (const PXml &xml, bool isSvg) |
Convert xml in string. | |
PXml | pxml_eraseVecChild (const PXml &xml, const PString &childName) |
Erase the childs of the current xml if it has childName as name. | |
bool | pxml_getAttrIfExist (PXmlAttr &attr, const PXml &xml, const PString &attrName) |
Get the attribute with given name if exist. | |
bool | pxml_getChildIfExist (PXml &match, const PXml &xml, const PString &childName) |
Get the child with given name if exist. | |
PXml * | pxml_getChildPtr (PXml &xml, const PString &childName) |
Get the child with given name if exist. | |
PString | pxml_getFullContent (const PXml &xml) |
Get the content of the PXml (children or value) | |
bool | pxml_getVecChildIfExist (PVecXml &vecMatch, const PXml &xml, const PString &childName) |
Get the vector of childs with given name if exist. | |
bool | pxml_isAttributeEnd (PXml &parent, PFileParser &parser) |
Say if it is the end of the attribute definition of the current balise. | |
bool | pxml_parserContent (PXml &xml, const PString &fileContent, bool isSvg) |
Parse a PXml with a file content. | |
bool | pxml_parserFile (PXml &xml, const PPath &fileName, bool isSvg) |
Parse a PXml with a file. | |
bool | pxml_parserXmlAttribute (PXml &parent, PFileParser &parser) |
Parse the attribute of a xml balise. | |
bool | pxml_parserXmlContent (PXml &parent, PFileParser &parser, bool isMainBalise) |
Parse the content of an xml balise. | |
bool | pxml_saveFile (const PPath &fileName, const PXml &xml, bool isSvg) |
Save a xml in a file. | |
void | pxml_setAttr (PXml &xml, const PString &nameAttr, const PString &valueAttr) |
Set a value to an attribute. | |
PFileParser | pxml_setXmlParser (const PString &fileContent, bool isSvg) |
Set the PFileParser for xml. | |
PString | pxml_vecAttrStr (const PVecXmlAttr &vecXmlAttr, bool isSvg) |
Convert attributes in string. | |
PString | pxml_vecXmlStr (const PVecXml &vecXml, bool isSvg) |
Convert a vecto of xml in string. | |
#define ALLOWED_ATTRIBUTE_CHAR "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:-" |
List of allowed char as attribute name.
Definition at line 11 of file pxml_utils.cpp.
Referenced by pxml_parserXmlAttribute().
#define ALLOWED_BALISE_CHAR "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:?!-" |
List of allowed char as balise name.
Definition at line 8 of file pxml_utils.cpp.
Referenced by pxml_parserXmlContent().
PString pxml_attrStr | ( | const PXmlAttr & | xmlAttr, |
bool | isSvg ) |
Convert attribute in string.
xmlAttr | : xml attribute to be converted into string |
isSvg | : say if the output xml has to be SVG like (with no space between chevron and newline between attribute |
Definition at line 368 of file pxml_utils.cpp.
References PXmlAttr::getName(), and PXmlAttr::getValue().
Referenced by pxml_vecAttrStr().
PString pxml_baliseStr | ( | const PXml & | xml, |
bool | isSvg ) |
Convert xml in string.
xml | : xml to be converted into string |
isSvg | : say if the output xml has to be SVG like (with no space between chevron and newline between attribute |
Definition at line 318 of file pxml_utils.cpp.
References PXml::getIsCompact(), PXml::getIsText(), PXml::getName(), PXml::getValue(), PXml::getVecAttr(), PXml::getVecChild(), pxml_vecAttrStr(), and pxml_vecXmlStr().
Referenced by pxml_saveFile(), and pxml_vecXmlStr().
Erase the childs of the current xml if it has childName as name.
xml | : current input |
childName | : name of the childs to be erased |
Definition at line 288 of file pxml_utils.cpp.
References PXml::getName(), PXml::getValue(), PXml::getVecAttr(), PXml::getVecChild(), PXml::setName(), PXml::setValue(), and PXml::setVecAttr().
Get the attribute with given name if exist.
[out] | attr | : vector of matched child |
xml | : xml input | |
attrName | : name of the searched child |
Definition at line 251 of file pxml_utils.cpp.
References PXml::getVecAttr().
Referenced by loadParserSeq().
Get the child with given name if exist.
[out] | match | : matched child |
xml | : xml input | |
childName | : name of the searched child |
Definition at line 215 of file pxml_utils.cpp.
References PXml::getVecChild().
Get the child with given name if exist.
xml | : xml input |
childName | : name of the searched child |
Definition at line 234 of file pxml_utils.cpp.
References PXml::getVecChild().
PString pxml_getFullContent | ( | const PXml & | xml | ) |
Get the content of the PXml (children or value)
xml | : PXml to be used |
Definition at line 395 of file pxml_utils.cpp.
References PXml::getValue(), PXml::getVecChild(), and pxml_vecXmlStr().
Referenced by loadParserSeq().
Get the vector of childs with given name if exist.
[out] | vecMatch | : vector of matched childs |
xml | : xml input | |
childName | : name of the searched childs |
Definition at line 197 of file pxml_utils.cpp.
References PXml::getVecChild().
Referenced by loadParserSeq().
bool pxml_isAttributeEnd | ( | PXml & | parent, |
PFileParser & | parser ) |
Say if it is the end of the attribute definition of the current balise.
[out] | parent | : xml parent in wich to set the isCompact attribute |
[out] | parser | : parser to be used |
Definition at line 62 of file pxml_utils.cpp.
References PXml::setIsCompact().
Referenced by pxml_parserXmlAttribute().
bool pxml_parserContent | ( | PXml & | xml, |
const PString & | fileContent, | ||
bool | isSvg ) |
Parse a PXml with a file content.
[out] | xml | : PXml to be initialised |
fileContent | : file content | |
isSvg | : true if the parsed file is a svg |
Definition at line 48 of file pxml_utils.cpp.
References pxml_parserXmlContent(), pxml_setXmlParser(), and PXml::setName().
Referenced by pxml_parserFile().
bool pxml_parserFile | ( | PXml & | xml, |
const PPath & | fileName, | ||
bool | isSvg ) |
Parse a PXml with a file.
[out] | xml | : PXml to be initialised |
fileName | : name of the intialisation file | |
isSvg | : true if the parsed file is a svg |
Definition at line 38 of file pxml_utils.cpp.
References pxml_parserContent().
bool pxml_parserXmlAttribute | ( | PXml & | parent, |
PFileParser & | parser ) |
Parse the attribute of a xml balise.
[out] | parent | : xml parent in wich to put the attribute |
[out] | parser | : parser to be used |
Definition at line 79 of file pxml_utils.cpp.
References ALLOWED_ATTRIBUTE_CHAR, PXml::getVecAttr(), pxml_isAttributeEnd(), PXmlAttr::setName(), and PXmlAttr::setValue().
Referenced by pxml_parserXmlContent().
bool pxml_parserXmlContent | ( | PXml & | parent, |
PFileParser & | parser, | ||
bool | isMainBalise ) |
Parse the content of an xml balise.
[out] | parent | : xml parent in wich to put the content |
[out] | parser | : parser to be used |
isMainBalise | : true if the parent balise if the main one, false otherwise |
Definition at line 115 of file pxml_utils.cpp.
References ALLOWED_BALISE_CHAR, PXml::getIsCompact(), PXml::getName(), PXml::getValue(), PXml::getVecChild(), pxml_parserXmlAttribute(), pxml_parserXmlContent(), PXml::setIsText(), PXml::setName(), and PXml::setValue().
Referenced by pxml_parserContent(), and pxml_parserXmlContent().
bool pxml_saveFile | ( | const PPath & | fileName, |
const PXml & | xml, | ||
bool | isSvg ) |
Save a xml in a file.
fileName | : name of the output file |
xml | : xml to be saved |
isSvg | : say if the output xml has to be SVG like (with no space between chevron and newline between attribute |
Definition at line 308 of file pxml_utils.cpp.
References pxml_baliseStr().
void pxml_setAttr | ( | PXml & | xml, |
const PString & | nameAttr, | ||
const PString & | valueAttr ) |
Set a value to an attribute.
[out] | xml | : xml to be modified |
nameAttr | : name of the attribute | |
valueAttr | : value of the attribute |
Definition at line 270 of file pxml_utils.cpp.
References PXml::getVecAttr().
PFileParser pxml_setXmlParser | ( | const PString & | fileContent, |
bool | isSvg ) |
Set the PFileParser for xml.
fileContent | : content to be parsed |
isSvg | : true if the parsed file is a svg |
Definition at line 20 of file pxml_utils.cpp.
Referenced by pxml_parserContent().
PString pxml_vecAttrStr | ( | const PVecXmlAttr & | vecXmlAttr, |
bool | isSvg ) |
Convert attributes in string.
vecXmlAttr | : xml attributes to be converted into string |
isSvg | : say if the output xml has to be SVG like (with no space between chevron and newline between attribute |
Definition at line 382 of file pxml_utils.cpp.
References pxml_attrStr().
Referenced by pxml_baliseStr().
PString pxml_vecXmlStr | ( | const PVecXml & | vecXml, |
bool | isSvg ) |
Convert a vecto of xml in string.
vecXml | : vecor of xml to be converted into string |
isSvg | : say if the output xml has to be SVG like (with no space between chevron and newline between attribute |
Definition at line 355 of file pxml_utils.cpp.
References pxml_baliseStr().
Referenced by pxml_baliseStr(), and pxml_getFullContent().