| 124 | } |
| 125 | |
| 126 | void Node::_raw_xml(std::string& xml, int& depth) const |
| 127 | { |
| 128 | xml.append(depth * 2, ' '); |
| 129 | xml.append("<" + name); |
| 130 | |
| 131 | for (auto it = m_attrs.begin(), itEnd = m_attrs.end(); it != itEnd; ++it) |
| 132 | { |
| 133 | xml.append(" " + it->first + "=\"" + it->second + "\""); |
| 134 | } |
| 135 | |
| 136 | if (cdata.length() == 0 && children.size() == 0) |
| 137 | { |
| 138 | xml.append("/>\n"); |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | xml.append(">"); |
| 143 | |
| 144 | if (cdata.length()) |
| 145 | { |
| 146 | xml.append(cdata); |
| 147 | } |
| 148 | |
| 149 | if (children.size()) |
| 150 | { |
| 151 | xml.append("\n"); |
| 152 | ++depth; |
| 153 | |
| 154 | for (auto it = children.begin(), itEnd = children.end(); it != itEnd; ++it) |
| 155 | { |
| 156 | it->_raw_xml(xml, depth); |
| 157 | } |
| 158 | |
| 159 | --depth; |
| 160 | xml.append(depth * 2, ' '); |
| 161 | } |
| 162 | |
| 163 | xml.append("</" + name + ">\n"); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | Document::Document() : |
| 168 | root(nullptr), |
nothing calls this directly
no outgoing calls
no test coverage detected