PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
pxml_utils.h File Reference
#include "PFileParser.h"
#include "PXml.h"
+ Include dependency graph for pxml_utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef std::vector< PXmlPVecXml
 Vector of PXml. More...
 
typedef std::vector< PXmlAttrPVecXmlAttr
 Vector of PXml. More...
 

Functions

PString pxml_attrStr (const PXmlAttr &xmlAttr, bool isSvg=false)
 Convert attribute in string. More...
 
PString pxml_baliseStr (const PXml &xml, bool isSvg=false)
 Convert xml in string. More...
 
PXml pxml_eraseVecChild (const PXml &xml, const PString &childName)
 Erase the childs of the current xml if it has childName as name. More...
 
bool pxml_getAttrIfExist (PXmlAttr &attr, const PXml &xml, const PString &attrName)
 Get the attribute with given name if exist. More...
 
bool pxml_getChildIfExist (PXml &match, const PXml &xml, const PString &childName)
 Get the child with given name if exist. More...
 
PXmlpxml_getChildPtr (PXml &xml, const PString &childName)
 Get the child with given name if exist. More...
 
PString pxml_getFullContent (const PXml &xml)
 Get the content of the PXml (children or value) More...
 
bool pxml_getVecChildIfExist (PVecXml &vecMatch, const PXml &xml, const PString &childName)
 Get the vector of childs with given name if exist. More...
 
bool pxml_parserContent (PXml &xml, const PString &fileContent, bool isSvg=false)
 Parse a PXml with a file content. More...
 
bool pxml_parserFile (PXml &xml, const PPath &fileName, bool isSvg=false)
 Parse a PXml with a file. More...
 
bool pxml_parserXmlAttribute (PXml &parent, PFileParser &parser)
 Parse the attribute of a xml balise. More...
 
bool pxml_parserXmlContent (PXml &parent, PFileParser &parser, bool isMainBalise=false)
 Parse the content of an xml balise. More...
 
bool pxml_saveFile (const PPath &fileName, const PXml &xml, bool isSvg=false)
 Save a xml in a file. More...
 
void pxml_setAttr (PXml &xml, const PString &nameAttr, const PString &valueAttr)
 Set a value to an attribute. More...
 
PFileParser pxml_setXmlParser (const PString &fileContent, bool isSvg=false)
 Set the PFileParser for xml. More...
 
PString pxml_vecAttrStr (const PVecXmlAttr &vecXmlAttr, bool isSvg)
 Convert attributes in string. More...
 
PString pxml_vecXmlStr (const PVecXml &vecXml, bool isSvg=false)
 Convert a vecto of xml in string. More...
 

Typedef Documentation

◆ PVecXml

typedef std::vector<PXml> PVecXml

Vector of PXml.

Definition at line 14 of file pxml_utils.h.

◆ PVecXmlAttr

typedef std::vector<PXmlAttr> PVecXmlAttr

Vector of PXml.

Definition at line 16 of file pxml_utils.h.

Function Documentation

◆ pxml_attrStr()

PString pxml_attrStr ( const PXmlAttr xmlAttr,
bool  isSvg 
)

Convert attribute in string.

Parameters
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
Returns
output string

Definition at line 368 of file pxml_utils.cpp.

368  {
369  PString body(" ");
370  body += xmlAttr.getName() + "=\"" + xmlAttr.getValue() + "\"";
371  if(isSvg){
372  body += "\n\t";
373  }
374  return body;
375 }
Extends the std::string.
Definition: PString.h:16
const PString & getName() const
Get the variable p_name.
Definition: PXml.cpp:68
const PString & getValue() const
Get the variable p_value.
Definition: PXml.cpp:82

References PXmlAttr::getName(), and PXmlAttr::getValue().

Referenced by pxml_vecAttrStr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_baliseStr()

PString pxml_baliseStr ( const PXml xml,
bool  isSvg 
)

Convert xml in string.

Parameters
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
Returns
output string

Definition at line 318 of file pxml_utils.cpp.

318  {
319  PString body(""), name(xml.getName());
320  PString baseXmlNewLine("\n");
321  if(isSvg){
322  baseXmlNewLine = "";
323  }
324  if(xml.getIsText()){
325  body += xml.getValue();
326  }else{
327  if(name != ""){
328  body += "<";
329  body += name;
330  body += pxml_vecAttrStr(xml.getVecAttr(), isSvg);
331 
332  if(name == "?xml"){body += " ?>\n";}
333  else if(name == "!--"){body += " -->\n";}
334  else if(xml.getIsCompact()){
335  body += " />"+baseXmlNewLine;
336  }else{
337  body += ">"+baseXmlNewLine;
338  body += pxml_vecXmlStr(xml.getVecChild(), isSvg);
339  body += xml.getValue();
340  body += "</"+ name + ">" + baseXmlNewLine;
341  }
342  }else{
343 
344  body += pxml_vecXmlStr(xml.getVecChild(), isSvg);
345  }
346  }
347  return body;
348 }
bool getIsText() const
Get the variable p_isText.
Definition: PXml.cpp:236
const std ::vector< PXml > & getVecChild() const
Get the variable p_vecChild.
Definition: PXml.cpp:264
const PString & getValue() const
Get the variable p_value.
Definition: PXml.cpp:222
bool getIsCompact() const
Get the variable p_isCompact.
Definition: PXml.cpp:208
const std ::vector< PXmlAttr > & getVecAttr() const
Get the variable p_vecAttr.
Definition: PXml.cpp:250
const PString & getName() const
Get the variable p_name.
Definition: PXml.cpp:194
PString pxml_vecAttrStr(const PVecXmlAttr &vecXmlAttr, bool isSvg)
Convert attributes in string.
Definition: pxml_utils.cpp:382
PString pxml_vecXmlStr(const PVecXml &vecXml, bool isSvg)
Convert a vecto of xml in string.
Definition: pxml_utils.cpp:355

References PXml::getIsCompact(), PXml::getIsText(), PXml::getName(), PXml::getValue(), PXml::getVecAttr(), PXml::getVecChild(), pxml_vecAttrStr(), and pxml_vecXmlStr().

Referenced by checkParseXmlFile(), checkXmlString(), pxml_saveFile(), pxml_vecXmlStr(), and saveSlides().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_eraseVecChild()

PXml pxml_eraseVecChild ( const PXml xml,
const PString childName 
)

Erase the childs of the current xml if it has childName as name.

Parameters
xml: current input
childName: name of the childs to be erased
Returns
output xml without childs named childName

Definition at line 288 of file pxml_utils.cpp.

288  {
289  PXml out;
290  out.setName(xml.getName());
291  out.setValue(xml.getValue());
292  out.setVecAttr(xml.getVecAttr());
293  const PVecXml & vecXml = xml.getVecChild();
294  for(PVecXml::const_iterator it(vecXml.begin()); it != vecXml.end(); ++it){
295  if(it->getName() != childName){
296  out.getVecChild().push_back(*it);
297  }
298  }
299  return out;
300 }
Class used to parse xml.
Definition: PXml.h:54
void setVecAttr(const std ::vector< PXmlAttr > &vecAttr)
Set the variable p_vecAttr, of type 'std ::vector<PXmlAttr>'.
Definition: PXml.cpp:180
void setValue(const PString &value)
Set the variable p_value, of type 'PString'.
Definition: PXml.cpp:166
void setName(const PString &name)
Set the variable p_name, of type 'PString'.
Definition: PXml.cpp:152
std::vector< PXml > PVecXml
Vector of PXml.
Definition: pxml_utils.h:14

References PXml::getName(), PXml::getValue(), PXml::getVecAttr(), PXml::getVecChild(), PXml::setName(), PXml::setValue(), and PXml::setVecAttr().

Referenced by processFileSvg(), and testCreateXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_getAttrIfExist()

bool pxml_getAttrIfExist ( PXmlAttr attr,
const PXml xml,
const PString attrName 
)

Get the attribute with given name if exist.

Parameters
[out]attr: vector of matched child
xml: xml input
attrName: name of the searched child
Returns
true if the attribute exists, false otherwise

Definition at line 251 of file pxml_utils.cpp.

251  {
252  bool isSearched(true);
253  const PVecXmlAttr & vecAttr = xml.getVecAttr();
254  PVecXmlAttr::const_iterator it(vecAttr.begin());
255  while(it != vecAttr.end() && isSearched){
256  if(it->getName() == attrName){
257  attr = *it;
258  isSearched = false;
259  }
260  ++it;
261  }
262  return !isSearched;
263 }
std::vector< PXmlAttr > PVecXmlAttr
Vector of PXml.
Definition: pxml_utils.h:16

References PXml::getVecAttr().

Referenced by getInkscapeLabel(), and loadParserSeq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_getChildIfExist()

bool pxml_getChildIfExist ( PXml match,
const PXml xml,
const PString childName 
)

Get the child with given name if exist.

Parameters
[out]match: matched child
xml: xml input
childName: name of the searched child
Returns
true if the child exist, false otherwise

Definition at line 215 of file pxml_utils.cpp.

215  {
216  bool isSearched(true);
217  const PVecXml & vecChild = xml.getVecChild();
218  PVecXml::const_iterator it(vecChild.begin());
219  while(it != vecChild.end() && isSearched){
220  if(it->getName() == childName){
221  match = *it;
222  isSearched = false;
223  }
224  ++it;
225  }
226  return !isSearched;
227 }

References PXml::getVecChild().

Referenced by checkXmlString(), and processFileSvg().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_getChildPtr()

PXml* pxml_getChildPtr ( PXml xml,
const PString childName 
)

Get the child with given name if exist.

Parameters
xml: xml input
childName: name of the searched child
Returns
pointer to the existing child, NULL otherwise

Definition at line 234 of file pxml_utils.cpp.

234  {
235  PXml * out = NULL;
236  PVecXml & vecChild = xml.getVecChild();
237  for(PVecXml::iterator it(vecChild.begin()); it != vecChild.end() && out == NULL; ++it){
238  if(it->getName() == childName){
239  out = &(*it);
240  }
241  }
242  return out;
243 }

References PXml::getVecChild().

Referenced by checkParseSeq(), processFileSvg(), and saveSlides().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_getFullContent()

PString pxml_getFullContent ( const PXml xml)

Get the content of the PXml (children or value)

Parameters
xml: PXml to be used
Returns
content of the PXml (children or value)

Definition at line 395 of file pxml_utils.cpp.

395  {
396  const PVecXml & vecXml = xml.getVecChild();
397  if(vecXml.size() != 0lu){
398  return pxml_vecXmlStr(vecXml);
399  }else{
400  return xml.getValue();
401  }
402 }

References PXml::getValue(), PXml::getVecChild(), and pxml_vecXmlStr().

Referenced by checkParseSeq(), and loadParserSeq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_getVecChildIfExist()

bool pxml_getVecChildIfExist ( PVecXml vecMatch,
const PXml xml,
const PString childName 
)

Get the vector of childs with given name if exist.

Parameters
[out]vecMatch: vector of matched childs
xml: xml input
childName: name of the searched childs
Returns
true if the childs exist, false otherwise

Definition at line 197 of file pxml_utils.cpp.

197  {
198  bool isFound(false);
199  const PVecXml & vecChild = xml.getVecChild();
200  for(PVecXml::const_iterator it(vecChild.begin()); it != vecChild.end(); ++it){
201  if(it->getName() == childName){
202  vecMatch.push_back(*it);
203  isFound = true;
204  }
205  }
206  return isFound;
207 }

References PXml::getVecChild().

Referenced by loadParserSeq(), and processFileSvg().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_parserContent()

bool pxml_parserContent ( PXml xml,
const PString fileContent,
bool  isSvg 
)

Parse a PXml with a file content.

Parameters
[out]xml: PXml to be initialised
fileContent: file content
isSvg: true if the parsed file is a svg
Returns
true on success, false otherwise

Definition at line 48 of file pxml_utils.cpp.

48  {
49  PFileParser parser(pxml_setXmlParser(fileContent, isSvg));
50  xml.setName("root");
51 
52  return pxml_parserXmlContent(xml, parser, true);
53 
54 // return pxml_parserVecXml(xml.getVecChild(), parser, isSvg);
55 }
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
Definition: PFileParser.h:20
PFileParser pxml_setXmlParser(const PString &fileContent, bool isSvg)
Set the PFileParser for xml.
Definition: pxml_utils.cpp:20
bool pxml_parserXmlContent(PXml &parent, PFileParser &parser, bool isMainBalise)
Parse the content of an xml balise.
Definition: pxml_utils.cpp:115

References pxml_parserXmlContent(), pxml_setXmlParser(), and PXml::setName().

Referenced by checkXmlString(), and pxml_parserFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_parserFile()

bool pxml_parserFile ( PXml xml,
const PPath fileName,
bool  isSvg 
)

Parse a PXml with a file.

Parameters
[out]xml: PXml to be initialised
fileName: name of the intialisation file
isSvg: true if the parsed file is a svg
Returns
true on success, false otherwise

Definition at line 38 of file pxml_utils.cpp.

38  {
39  return pxml_parserContent(xml, fileName.loadFileContent(), isSvg);
40 }
PString loadFileContent() const
Get the file content in a PString.
Definition: PPath.cpp:382
bool pxml_parserContent(PXml &xml, const PString &fileContent, bool isSvg)
Parse a PXml with a file content.
Definition: pxml_utils.cpp:48

References PPath::loadFileContent(), and pxml_parserContent().

Referenced by checkParseSeq(), checkParseXmlFile(), and processFileSvg().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_parserXmlAttribute()

bool pxml_parserXmlAttribute ( PXml parent,
PFileParser parser 
)

Parse the attribute of a xml balise.

Parameters
[out]parent: xml parent in wich to put the attribute
[out]parser: parser to be used
Returns
true on success, false otherwise

Definition at line 79 of file pxml_utils.cpp.

79  {
80  parser.setWhiteSpace(" \t\n");
81  while(!pxml_isAttributeEnd(parent, parser) && !parser.isEndOfFile()){
82  PString attributeName(parser.getStrComposedOf(ALLOWED_ATTRIBUTE_CHAR));
83  if(attributeName == ""){
84  std::cerr << "pxml_parserXmlAttribute : error at : " << parser.getLocation() << std::endl;
85  std::cerr << "\tcannot parse the attributes name as '"<<parser.getNextToken()<<"'" << std::endl;
86  return false;
87  }
88  if(!parser.isMatch("=")){
89  std::cerr << "pxml_parserXmlAttribute : error at : " << parser.getLocation() << std::endl;
90  std::cerr << "\texpected '=' after attribute '"<<attributeName<<"'" << std::endl;
91  return false;
92  }
93  if(!parser.isMatch("\"")){
94  std::cerr << "pxml_parserXmlAttribute : error at : " << parser.getLocation() << std::endl;
95  std::cerr << "\texpected '\"' after attribute '"<<attributeName<<"='" << std::endl;
96  return false;
97  }
98  PString attributeValue(parser.getUntilKeyWithoutPatern("\""));
99  PXmlAttr tmpAttribute;
100  tmpAttribute.setName(attributeName);
101  tmpAttribute.setValue(attributeValue);
102  parent.getVecAttr().push_back(tmpAttribute);
103  }
104  parser.setWhiteSpace("");
105  return true;
106 }
PString getNextToken()
Get the next token.
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
PString getStrComposedOf(const PString &charset)
Get string composed of the characters in the string charset.
void setWhiteSpace(const PString &whiteSpace)
Initialise la liste des caractères blancs.
Definition: PFileParser.cpp:35
bool isMatch(const PString &patern)
Says if the patern match with the current caracters of the PFileParser.
PLocation getLocation() const
Fonction qui renvoie la PLocation du PFileParser.
bool isEndOfFile() const
Dit si on est à la fin du fichier.
Definition: PFileParser.cpp:88
Attribute from xml.
Definition: PXml.h:30
void setName(const PString &name)
Set the variable p_name, of type 'PString'.
Definition: PXml.cpp:54
void setValue(const PString &value)
Set the variable p_value, of type 'PString'.
Definition: PXml.cpp:61
bool pxml_isAttributeEnd(PXml &parent, PFileParser &parser)
Say if it is the end of the attribute definition of the current balise.
Definition: pxml_utils.cpp:62
#define ALLOWED_ATTRIBUTE_CHAR
List of allowed char as attribute name.
Definition: pxml_utils.cpp:11

References ALLOWED_ATTRIBUTE_CHAR, PFileParser::getLocation(), PFileParser::getNextToken(), PFileParser::getStrComposedOf(), PFileParser::getUntilKeyWithoutPatern(), PXml::getVecAttr(), PFileParser::isEndOfFile(), PFileParser::isMatch(), pxml_isAttributeEnd(), PXmlAttr::setName(), PXmlAttr::setValue(), and PFileParser::setWhiteSpace().

Referenced by pxml_parserXmlContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_parserXmlContent()

bool pxml_parserXmlContent ( PXml parent,
PFileParser parser,
bool  isMainBalise 
)

Parse the content of an xml balise.

Parameters
[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
Returns
true on success, false otherwise

Definition at line 115 of file pxml_utils.cpp.

115  {
116  parser.setSeparator("<>\"=");
117  parser.setWhiteSpace("");
118  PString balisePartialEnd("/" + parent.getName() + ">");
119  PString baliseEnd("<" + balisePartialEnd);
120  PXml text;
121  text.setIsText(true);
122  while(!parser.isMatch(baliseEnd) && !parser.isEndOfFile()){
123  PString textString(parser.getUntilKeyWithoutPatern("<"));
124  if(textString != ""){ //If the next token is not a < it is a text
125  text.getValue() += textString;
126  if(parent.getVecChild().size() == 0lu){
127  if(parser.isMatch(balisePartialEnd)){
128  parent.setValue(text.getValue());
129  return true;
130  }else{
131  parent.getVecChild().push_back(text);
132  }
133  }else{
134  parent.getVecChild().push_back(text);
135  }
136  text.setValue(""); //Reset value for next one
137  }
138  if(parser.isEndOfFile()){
139  if(isMainBalise){
140  return true;
141  }else{
142  std::cerr << "pxml_parserXmlContent : error at : " << parser.getLocation() << std::endl;
143  std::cerr << "\tunexpected end of file. We are supposed to be in the balise '"<<parent.getName()<<"'" << std::endl;
144  return false;
145  }
146  }
147  if(parser.isMatch(balisePartialEnd)){ //We find the end of the balise
148  return true;
149  }else{ //Or it can be another balise
150  PString childBaliseName(parser.getStrComposedOf(ALLOWED_BALISE_CHAR));
151  if(childBaliseName != ""){ //We find a new balise
152  PXml xml;
153  xml.setName(childBaliseName);
154  if(childBaliseName == "!--"){
155  parser.getUntilKeyWithoutPatern("-->"); //Skip the comment
156  }else if(childBaliseName == "?xml"){
157  parser.getUntilKeyWithoutPatern("?>"); //Skip the svg balise
158  }else{
159  if(!pxml_parserXmlAttribute(xml, parser)){ //Let's parse the attribute
160  std::cerr << "pxml_parserXmlContent : error at : " << parser.getLocation() << std::endl;
161  std::cerr << "\tcannot parse the attributes of balise '"<<childBaliseName<<"'" << std::endl;
162  return false;
163  }
164  if(!xml.getIsCompact()){
165  //Let's parse the content
166  if(!pxml_parserXmlContent(xml, parser, false)){
167  std::cerr << "pxml_parserXmlContent : error at : " << parser.getLocation() << std::endl;
168  std::cerr << "\tcannot parse balise '"<<childBaliseName<<"'" << std::endl;
169  return false;
170  }
171  }
172  parent.getVecChild().push_back(xml);
173  }
174  }else if(parser.isMatch("/")){
175  std::cerr << "pxml_parserXmlContent : in balise '"<<parent.getName()<<"' unexpected '</' at : " << parser.getLocation() << std::endl;
176  return false;
177  }else{ //It was just a text <
178  text.getValue() += "<";
179  }
180  }
181  }
182  return true;
183 }
void setSeparator(const PString &separator)
Initialise la liste des caractères séparateurs.
Definition: PFileParser.cpp:43
void setIsText(bool isText)
Set the variable p_isText, of type 'bool'.
Definition: PXml.cpp:173
bool pxml_parserXmlAttribute(PXml &parent, PFileParser &parser)
Parse the attribute of a xml balise.
Definition: pxml_utils.cpp:79
#define ALLOWED_BALISE_CHAR
List of allowed char as balise name.
Definition: pxml_utils.cpp:8

References ALLOWED_BALISE_CHAR, PXml::getIsCompact(), PFileParser::getLocation(), PXml::getName(), PFileParser::getStrComposedOf(), PFileParser::getUntilKeyWithoutPatern(), PXml::getValue(), PXml::getVecChild(), PFileParser::isEndOfFile(), PFileParser::isMatch(), pxml_parserXmlAttribute(), PXml::setIsText(), PXml::setName(), PFileParser::setSeparator(), PXml::setValue(), and PFileParser::setWhiteSpace().

Referenced by pxml_parserContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_saveFile()

bool pxml_saveFile ( const PPath fileName,
const PXml xml,
bool  isSvg 
)

Save a xml in a file.

Parameters
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
Returns
true on success, false otherwise

Definition at line 308 of file pxml_utils.cpp.

308  {
309  PString body(pxml_baliseStr(xml, isSvg));
310  return fileName.saveFileContent(body);
311 }
bool saveFileContent(const PString &content) const
Save a PString in a file.
Definition: PPath.cpp:395
PString pxml_baliseStr(const PXml &xml, bool isSvg)
Convert xml in string.
Definition: pxml_utils.cpp:318

References pxml_baliseStr(), and PPath::saveFileContent().

Referenced by testCreateXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_setAttr()

void pxml_setAttr ( PXml xml,
const PString nameAttr,
const PString valueAttr 
)

Set a value to an attribute.

Parameters
[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.

270  {
271  bool isSearched(true);
272  PVecXmlAttr & vecAttr = xml.getVecAttr();
273  PVecXmlAttr::iterator it(vecAttr.begin());
274  while(it != vecAttr.end() && isSearched){
275  if(it->getName() == nameAttr){
276  it->setValue(valueAttr);
277  isSearched = false;
278  }
279  ++it;
280  }
281 }

References PXml::getVecAttr().

Referenced by saveSlides(), and testCreateXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_setXmlParser()

PFileParser pxml_setXmlParser ( const PString fileContent,
bool  isSvg 
)

Set the PFileParser for xml.

Parameters
fileContent: content to be parsed
isSvg: true if the parsed file is a svg
Returns
PFileParser

Definition at line 20 of file pxml_utils.cpp.

20  {
21  PFileParser parser;
22  parser.setSeparator("<>\"=");
23  if(isSvg){
24  parser.setWhiteSpace("");
25  }else{
26  parser.setWhiteSpace("\t\n ");
27  }
28  parser.setFileContent(fileContent);
29  return parser;
30 }
void setFileContent(const PString &fileContent)
Set the file content.
Definition: PFileParser.cpp:50

References PFileParser::setFileContent(), PFileParser::setSeparator(), and PFileParser::setWhiteSpace().

Referenced by pxml_parserContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_vecAttrStr()

PString pxml_vecAttrStr ( const PVecXmlAttr vecXmlAttr,
bool  isSvg 
)

Convert attributes in string.

Parameters
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
Returns
output string

Definition at line 382 of file pxml_utils.cpp.

382  {
383  if(vecXmlAttr.size() == 0lu){return "";}
384  PString body("");
385  for(PVecXmlAttr::const_iterator it(vecXmlAttr.begin()); it != vecXmlAttr.end(); ++it){
386  body += pxml_attrStr(*it, isSvg);
387  }
388  return body;
389 }
PString pxml_attrStr(const PXmlAttr &xmlAttr, bool isSvg)
Convert attribute in string.
Definition: pxml_utils.cpp:368

References pxml_attrStr().

Referenced by pxml_baliseStr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pxml_vecXmlStr()

PString pxml_vecXmlStr ( const PVecXml vecXml,
bool  isSvg 
)

Convert a vecto of xml in string.

Parameters
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
Returns
output string

Definition at line 355 of file pxml_utils.cpp.

355  {
356  PString body("");
357  for(PVecXml::const_iterator it(vecXml.begin()); it != vecXml.end(); ++it){
358  body += pxml_baliseStr(*it, isSvg);
359  }
360  return body;
361 }

References pxml_baliseStr().

Referenced by pxml_baliseStr(), and pxml_getFullContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: