Microsoft Information Protection SDK - C++ 1.17
API Reference Documentation for C++
Loading...
Searching...
No Matches
xml_reader.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26
32#ifndef API_MIP_XML_READER_H_
33#define API_MIP_XML_READER_H_
34
35#include <string>
36
37#include "mip/mip_namespace.h"
38#include "mip/xml_node.h"
39
40MIP_NAMESPACE_BEGIN
41
42namespace xml {
43
48class XmlReader {
49public:
57 virtual bool Read() = 0;
63 virtual XmlNodeType GetNodeType() const = 0;
71 virtual std::string GetName() const = 0;
77 virtual bool GetName(std::string& name) const = 0;
85 virtual bool Skip() = 0;
93 virtual bool GetValue(std::string& value) const = 0;
99 virtual std::string GetAncestors() const = 0;
107 virtual bool IsEmptyElement() const = 0;
115 virtual bool GetAttribute(const std::string& attributeName, std::string& attribute) const = 0;
123 virtual bool HasAttributes() const = 0;
131 virtual bool MoveToFirstAttribute() = 0;
139 virtual bool MoveToNextAttribute() = 0;
147 virtual bool MoveToElement() = 0;
157 virtual std::string DumpNode() = 0;
159 virtual ~XmlReader() {}
160protected:
161 XmlReader() {}
163};
164
165} // xml
166
167MIP_NAMESPACE_END
168
169#endif // API_MIP_XML_READER_H_
XmlReader abstraction class.
Definition xml_reader.h:48
virtual std::string GetAncestors() const =0
Returns current node ancestors (for debug text), in the following purpose <node grand parent attribut...
virtual bool GetName(std::string &name) const =0
Returns if name was found. Sets name only when true. empty name is possible.
virtual bool GetValue(std::string &value) const =0
Returns if value was found. Sets value only when true. empty value is possible..
virtual bool Skip()=0
Skips current node until it finds a non empty node.
virtual bool MoveToFirstAttribute()=0
Move to first attribute.
virtual bool MoveToElement()=0
Move from attribute to element.
virtual bool HasAttributes() const =0
Returns whether the current node has attributes.
virtual std::string DumpNode()=0
Method returns all node elements in an unmodified way from the original xml.
virtual XmlNodeType GetNodeType() const =0
Get current node type.
virtual std::string GetName() const =0
Returns the name if found, exception otherwise. empty name is possible.
virtual bool GetAttribute(const std::string &attributeName, std::string &attribute) const =0
Returns true if attributes was found. Sets attribute only when true. empty attribute is possible....
virtual bool Read()=0
Reads the next node of the element.
virtual bool MoveToNextAttribute()=0
Move to Next attribute.
virtual bool IsEmptyElement() const =0
Returns whether the current node as an empty element.
MIP namespace macros.
Definition xml_load_exception.h:12
XmlNodeType
Constants for the different types of xml elements nodes.
Definition xml_node.h:54
Contains XmlNode interface definition used to interact with xml parsers.