| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkXMLWriter.h" | 8 #include "SkXMLWriter.h" |
| 9 #include "SkStream.h" | 9 #include "SkStream.h" |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 { | 162 { |
| 163 this->onStartElementLen(elem, length); | 163 this->onStartElementLen(elem, length); |
| 164 } | 164 } |
| 165 | 165 |
| 166 ////////////////////////////////////////////////////////////////////////////////
//////// | 166 ////////////////////////////////////////////////////////////////////////////////
//////// |
| 167 | 167 |
| 168 static void write_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLWriter* w,
bool skipRoot) | 168 static void write_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLWriter* w,
bool skipRoot) |
| 169 { | 169 { |
| 170 if (!skipRoot) | 170 if (!skipRoot) |
| 171 { | 171 { |
| 172 w->startElement(dom.getName(node)); | 172 const char* elem = dom.getName(node); |
| 173 if (dom.getType(node) == SkDOM::kText_Type) { |
| 174 SkASSERT(dom.countChildren(node) == 0); |
| 175 w->addText(elem, strlen(elem)); |
| 176 return; |
| 177 } |
| 178 |
| 179 w->startElement(elem); |
| 173 | 180 |
| 174 SkDOM::AttrIter iter(dom, node); | 181 SkDOM::AttrIter iter(dom, node); |
| 175 const char* name; | 182 const char* name; |
| 176 const char* value; | 183 const char* value; |
| 177 while ((name = iter.next(&value)) != NULL) | 184 while ((name = iter.next(&value)) != NULL) |
| 178 w->addAttribute(name, value); | 185 w->addAttribute(name, value); |
| 179 } | 186 } |
| 180 | 187 |
| 181 node = dom.getFirstChild(node, NULL); | 188 node = dom.getFirstChild(node, NULL); |
| 182 while (node) | 189 while (node) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 w.endElement(); | 352 w.endElement(); |
| 346 w.endElement(); | 353 w.endElement(); |
| 347 w.startElement("elem2"); | 354 w.startElement("elem2"); |
| 348 w.endElement(); | 355 w.endElement(); |
| 349 w.endElement(); | 356 w.endElement(); |
| 350 w.endElement(); | 357 w.endElement(); |
| 351 #endif | 358 #endif |
| 352 } | 359 } |
| 353 | 360 |
| 354 #endif | 361 #endif |
| OLD | NEW |