public:
wxXmlNode()
: m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL),
- m_lineNo(-1)
+ m_lineNo(-1), m_noConversion(false)
{
}
void SetAttributes(wxXmlAttribute *attr) { m_attrs = attr; }
virtual void AddAttribute(wxXmlAttribute *attr);
+ // If true, don't do encoding conversion to improve efficiency - node content is ACII text
+ bool GetNoConversion() const { return m_noConversion; }
+ void SetNoConversion(bool noconversion) { m_noConversion = noconversion; }
+
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED( inline wxXmlAttribute *GetProperties() const );
wxDEPRECATED( inline bool GetPropVal(const wxString& propName,
wxXmlAttribute *m_attrs;
wxXmlNode *m_parent, *m_children, *m_next;
int m_lineNo; // line number in original file, or -1
+ bool m_noConversion; // don't do encoding conversion - node is plain text
void DoCopy(const wxXmlNode& node);
};
*/
int GetDepth(wxXmlNode* grandparent = NULL) const;
+ /**
+ Returns a flag indicating whether encoding conversion is necessary when saving. The default is @false.
+
+ You can improve saving efficiency considerably by setting this value.
+ */
+ bool GetNoConversion() const;
+
/**
Returns line number of the node in the input XML file or @c -1 if it is unknown.
*/
/**
Sets as first attribute the given wxXmlAttribute object.
- The caller is responsible to delete any previously present attributes
+ The caller is responsible for deleting any previously present attributes
attached to this node.
*/
void SetAttributes(wxXmlAttribute* attr);
/**
Sets as first child the given node.
- The caller is responsible to delete any previously present children node.
+ The caller is responsible for deleting any previously present children node.
*/
void SetChildren(wxXmlNode* child);
/**
Sets as sibling the given node.
- The caller is responsible to delete any previously present sibling node.
+ The caller is responsible for deleting any previously present sibling node.
*/
void SetNext(wxXmlNode* next);
+ /**
+ Sets a flag to indicate whether encoding conversion is necessary when saving. The default is @false.
+
+ You can improve saving efficiency considerably by setting this value.
+ */
+ void SetNoConversion(bool noconversion);
+
/**
Sets as parent the given node.
- The caller is responsible to delete any previously present parent node.
+ The caller is responsible for deleting any previously present parent node.
*/
void SetParent(wxXmlNode* parent);
: m_type(type), m_name(name), m_content(content),
m_attrs(attrs), m_parent(parent),
m_children(NULL), m_next(next),
- m_lineNo(lineNo)
+ m_lineNo(lineNo),
+ m_noConversion(false)
{
if (m_parent)
{
: m_type(type), m_name(name), m_content(content),
m_attrs(NULL), m_parent(NULL),
m_children(NULL), m_next(NULL),
- m_lineNo(lineNo)
+ m_lineNo(lineNo), m_noConversion(false)
{}
wxXmlNode::wxXmlNode(const wxXmlNode& node)
m_name = node.m_name;
m_content = node.m_content;
m_lineNo = node.m_lineNo;
+ m_noConversion = node.m_noConversion;
m_children = NULL;
wxXmlNode *n = node.m_children;
wxUnusedVar(convMem);
if ( !convFile )
convFile = &wxConvUTF8;
-
+#if 1
+ // JACS test
+ const wxWX2MBbuf buf(str.mb_str(*convFile));
+ if (!buf.length())
+ return false;
+
+ stream.Write((const char*)buf, strlen((const char*)buf));
+#else
const wxScopedCharBuffer buf(str.mb_str(*convFile));
if ( !buf.length() )
{
}
stream.Write(buf, buf.length());
+#endif
+
#else // !wxUSE_UNICODE
if ( convFile && convMem )
{
break;
case wxXML_TEXT_NODE:
- rc = OutputEscapedString(stream, node->GetContent(),
+ if (node->GetNoConversion())
+ {
+ stream.Write(node->GetContent().c_str(), node->GetContent().Length());
+ rc = true;
+ }
+ else
+ rc = OutputEscapedString(stream, node->GetContent(),
convMem, convFile,
Escape_Text);
break;