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 | 8 |
9 #include "SkDOM.h" | 9 #include "SkDOM.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 { | 316 { |
317 SkDEBUGCODE(SkDebugf("xml parse error, line %d\n", parser.fParserError.g
etLineNumber());) | 317 SkDEBUGCODE(SkDebugf("xml parse error, line %d\n", parser.fParserError.g
etLineNumber());) |
318 fRoot = nullptr; | 318 fRoot = nullptr; |
319 fAlloc.reset(); | 319 fAlloc.reset(); |
320 return nullptr; | 320 return nullptr; |
321 } | 321 } |
322 fRoot = parser.getRoot(); | 322 fRoot = parser.getRoot(); |
323 return fRoot; | 323 return fRoot; |
324 } | 324 } |
325 | 325 |
326 const SkDOM::Node* SkDOM::build(const char doc[], size_t len) { | |
327 SkMemoryStream docStream(doc, len); | |
328 return this->build(docStream); | |
329 } | |
330 | |
331 /////////////////////////////////////////////////////////////////////////// | 326 /////////////////////////////////////////////////////////////////////////// |
332 | 327 |
333 static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par
ser) | 328 static void walk_dom(const SkDOM& dom, const SkDOM::Node* node, SkXMLParser* par
ser) |
334 { | 329 { |
335 const char* elem = dom.getName(node); | 330 const char* elem = dom.getName(node); |
336 if (dom.getType(node) == SkDOM::kText_Type) { | 331 if (dom.getType(node) == SkDOM::kText_Type) { |
337 SkASSERT(dom.countChildren(node) == 0); | 332 SkASSERT(dom.countChildren(node) == 0); |
338 parser->text(elem, SkToInt(strlen(elem))); | 333 parser->text(elem, SkToInt(strlen(elem))); |
339 return; | 334 return; |
340 } | 335 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 { | 468 { |
474 if (node == nullptr) | 469 if (node == nullptr) |
475 node = this->getRootNode(); | 470 node = this->getRootNode(); |
476 | 471 |
477 SkDebugWStream debugStream; | 472 SkDebugWStream debugStream; |
478 SkXMLStreamWriter xmlWriter(&debugStream); | 473 SkXMLStreamWriter xmlWriter(&debugStream); |
479 xmlWriter.writeDOM(*this, node, false); | 474 xmlWriter.writeDOM(*this, node, false); |
480 } | 475 } |
481 | 476 |
482 #endif | 477 #endif |
OLD | NEW |