|
Revision 262
(checked in by shiva, 4 years ago)
|
From ssphys-trust-encoding branch: Eliminate XML character set
sanitizing and trust that VSS character set is in the declared
encoding.
From Unicode branch: Declare UTF-8 encoding around sqlite2 DBI calls
to prevent double-encoding. Output UTF-8 to DataCache?.
|
- Property svn:mime-type set to
text/plain
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
// XML.cpp: |
|---|
| 2 |
// |
|---|
| 3 |
////////////////////////////////////////////////////////////////////// |
|---|
| 4 |
|
|---|
| 5 |
#include "StdAfx.h" |
|---|
| 6 |
#include "XML.h" |
|---|
| 7 |
|
|---|
| 8 |
XMLNode::XMLNode (XMLNode* pParent, std::string name, AttribMap attrib) |
|---|
| 9 |
: m_Node (name), m_pParent (pParent) |
|---|
| 10 |
{ |
|---|
| 11 |
SetAttributes (attrib); |
|---|
| 12 |
} |
|---|
| 13 |
|
|---|
| 14 |
void XMLNode::SetAttributes (AttribMap attrib) |
|---|
| 15 |
{ |
|---|
| 16 |
AttribMap::iterator itor = attrib.begin (); |
|---|
| 17 |
for (; itor != attrib.end (); ++itor) |
|---|
| 18 |
{ |
|---|
| 19 |
m_Node.SetAttribute(itor->first, itor->second); |
|---|
| 20 |
} |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
void XMLNode::AddChild (XMLNode* pChild) |
|---|
| 24 |
{ |
|---|
| 25 |
m_Node.InsertEndChild(pChild->m_Node); |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
void XMLNode::AddText (XMLText* pContent) |
|---|
| 29 |
{ |
|---|
| 30 |
m_Node.InsertEndChild(pContent->m_Text); |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
void XMLNode::SetText (std::string text) |
|---|
| 34 |
{ |
|---|
| 35 |
TiXmlText xmlText (text); |
|---|
| 36 |
m_Node.InsertEndChild(xmlText); |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
XMLNode::~XMLNode () |
|---|
| 40 |
{ |
|---|
| 41 |
if (m_pParent) |
|---|
| 42 |
m_pParent->AddChild (this); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
// --------------------------------------------------------------- |
|---|
| 46 |
XMLText::~XMLText () |
|---|
| 47 |
{ |
|---|
| 48 |
if (m_pParent) |
|---|
| 49 |
m_pParent->AddText(this); |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
void XMLText::SetValue (std::string value) |
|---|
| 54 |
{ |
|---|
| 55 |
m_Text.SetValue (value); |
|---|
| 56 |
} |
|---|