Patch level : 12.0 no-patch
Files correlati : Commento : xml : Resa possibil la non codifica dei caratteri speciali del tipo '/' -----> F; in scrittura (maialata dovuta all Major Flexform)
This commit is contained in:
parent
046ab1bfed
commit
a1a639a457
@ -6,10 +6,19 @@
|
|||||||
|
|
||||||
#include <incstr.h>
|
#include <incstr.h>
|
||||||
|
|
||||||
|
bool __xml_encode_text = true;
|
||||||
|
|
||||||
|
bool xml_encode_text(bool on)
|
||||||
|
{
|
||||||
|
__xml_encode_text = on;
|
||||||
|
return __xml_encode_text;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Utilities
|
// Utilities
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
void Spaces(ostream& outf, int nSpaces)
|
void Spaces(ostream& outf, int nSpaces)
|
||||||
{
|
{
|
||||||
outf << '\n';
|
outf << '\n';
|
||||||
@ -98,7 +107,8 @@ void WriteXmlString(ostream& outf, const char* str)
|
|||||||
for (int i = 0; str[i]; i++)
|
for (int i = 0; str[i]; i++)
|
||||||
{
|
{
|
||||||
const char c = str[i];
|
const char c = str[i];
|
||||||
if ((c < ' ' && c != '\n' && c != '\r') || strchr("<>/&", c) != NULL)
|
if ((c < ' ' && c != '\n' && c != '\r') ||
|
||||||
|
(__xml_encode_text && (strchr("<>/&", c) != NULL)))
|
||||||
{
|
{
|
||||||
const unsigned int n = (unsigned char)c;
|
const unsigned int n = (unsigned char)c;
|
||||||
TString8 tmp; tmp.format("&#%02X;", n);
|
TString8 tmp; tmp.format("&#%02X;", n);
|
||||||
|
@ -9,6 +9,8 @@ class TXmlItem;
|
|||||||
|
|
||||||
typedef bool (*XmlItemCallback)(TXmlItem& item, long jolly);
|
typedef bool (*XmlItemCallback)(TXmlItem& item, long jolly);
|
||||||
|
|
||||||
|
bool xml_encode_text(bool on = true);
|
||||||
|
|
||||||
class TXmlItem : public TObject
|
class TXmlItem : public TObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user