blob: a959faa6b3655ecaa4623ec5eb01c0ea6210a1c2 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// OmahaXmlWriter is a helper class to generate XML for the Omaha request.
class OmahaXmlWriter {
OmahaXmlWriter() = default;
virtual ~OmahaXmlWriter() = default;
// Starts a new element with the given |name|.
virtual void StartElement(const char* name) = 0;
// Ends the current element.
virtual void EndElement() = 0;
// Writes an attribute with the given |name| and |value| to the current
// element.
virtual void WriteAttribute(const char* name, const char* value) = 0;
// Finalizes the XML document. Calling StartElement(), EndElement(), or
// WriteAttribute() will have no effect after calling this method.
virtual void Finalize() = 0;
// Returns the generated XML. This method should only be called after
// Finalize().
virtual std::string GetContentAsString() = 0;