| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 |
| 11 #include "libxml/xmlreader.h" | 11 #include "libxml/xmlreader.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 continue; | 113 continue; |
| 114 } | 114 } |
| 115 } while (Read()); | 115 } while (Read()); |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 // XmlWriter functions | 120 // XmlWriter functions |
| 121 | 121 |
| 122 XmlWriter::XmlWriter() : | 122 XmlWriter::XmlWriter() : |
| 123 writer_(NULL) {} | 123 writer_(NULL), |
| 124 buffer_(NULL) {} |
| 124 | 125 |
| 125 XmlWriter::~XmlWriter() { | 126 XmlWriter::~XmlWriter() { |
| 126 if (writer_) | 127 if (writer_) |
| 127 xmlFreeTextWriter(writer_); | 128 xmlFreeTextWriter(writer_); |
| 128 if (buffer_) | 129 if (buffer_) |
| 129 xmlBufferFree(buffer_); | 130 xmlBufferFree(buffer_); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void XmlWriter::StartWriting() { | 133 void XmlWriter::StartWriting() { |
| 133 buffer_ = xmlBufferCreate(); | 134 buffer_ = xmlBufferCreate(); |
| 134 writer_ = xmlNewTextWriterMemory(buffer_, 0); | 135 writer_ = xmlNewTextWriterMemory(buffer_, 0); |
| 135 xmlTextWriterSetIndent(writer_, 1); | 136 xmlTextWriterSetIndent(writer_, 1); |
| 136 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); | 137 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); |
| 137 } | 138 } |
| 138 | 139 |
| 139 void XmlWriter::StopWriting() { | 140 void XmlWriter::StopWriting() { |
| 140 xmlTextWriterEndDocument(writer_); | 141 xmlTextWriterEndDocument(writer_); |
| 141 xmlFreeTextWriter(writer_); | 142 xmlFreeTextWriter(writer_); |
| 142 writer_ = NULL; | 143 writer_ = NULL; |
| 143 } | 144 } |
| OLD | NEW |