| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/libxml_utils.h" | 5 #include "chrome/common/libxml_utils.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Skip all other node types. | 110 // Skip all other node types. |
| 111 continue; | 111 continue; |
| 112 } | 112 } |
| 113 } while (Read()); | 113 } while (Read()); |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 // XmlWriter functions | 118 // XmlWriter functions |
| 119 | 119 |
| 120 XmlWriter::XmlWriter() : | 120 XmlWriter::XmlWriter() |
| 121 writer_(NULL), | 121 : writer_(NULL), |
| 122 buffer_(NULL) {} | 122 buffer_(NULL) {} |
| 123 | 123 |
| 124 XmlWriter::~XmlWriter() { | 124 XmlWriter::~XmlWriter() { |
| 125 if (writer_) | 125 if (writer_) |
| 126 xmlFreeTextWriter(writer_); | 126 xmlFreeTextWriter(writer_); |
| 127 if (buffer_) | 127 if (buffer_) |
| 128 xmlBufferFree(buffer_); | 128 xmlBufferFree(buffer_); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void XmlWriter::StartWriting() { | 131 void XmlWriter::StartWriting() { |
| 132 buffer_ = xmlBufferCreate(); | 132 buffer_ = xmlBufferCreate(); |
| 133 writer_ = xmlNewTextWriterMemory(buffer_, 0); | 133 writer_ = xmlNewTextWriterMemory(buffer_, 0); |
| 134 xmlTextWriterSetIndent(writer_, 1); | 134 xmlTextWriterSetIndent(writer_, 1); |
| 135 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); | 135 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void XmlWriter::StopWriting() { | 138 void XmlWriter::StopWriting() { |
| 139 xmlTextWriterEndDocument(writer_); | 139 xmlTextWriterEndDocument(writer_); |
| 140 xmlFreeTextWriter(writer_); | 140 xmlFreeTextWriter(writer_); |
| 141 writer_ = NULL; | 141 writer_ = NULL; |
| 142 } | 142 } |
| OLD | NEW |