CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_element.h
1
2
3#pragma once
4
5#include <xml/xml_node_type.h>
6#include <xml/xml_linked_node.h>
7#include <system/shared_ptr.h>
8#include <cstdint>
9
10
12namespace System
13{
14class String;
15namespace Xml
16{
17class DocumentSchemaValidator;
18class DocumentXmlWriter;
19class DocumentXPathNavigator;
20namespace Schema
21{
22class IXmlSchemaInfo;
23class Parser;
24} // namespace Schema
25class XmlAttribute;
26class XmlAttributeCollection;
27class XmlDocument;
28class XmlLoader;
29class XmlName;
30class XmlNode;
31class XmlNodeList;
32class XmlNodeReaderNavigator;
33class XmlWriter;
34namespace XPath
35{
36enum class XPathNodeType;
37} // namespace XPath
38} // namespace Xml
39} // namespace System
41
42namespace System {
43
44namespace Xml {
45
50class ASPOSECPP_SHARED_CLASS XmlElement : public XmlLinkedNode
51{
52 typedef XmlElement ThisType;
53 typedef XmlLinkedNode BaseType;
54
55 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
56 ASPOSECPP_SHARED_RTTI_INFO_DECL();
57
58public:
59
62
63private:
65 friend class DocumentSchemaValidator;
66 friend class DocumentXmlWriter;
67 friend class DocumentXPathNavigator;
68 friend class XmlAttribute;
69 friend class XmlNode;
70 friend class XmlAttributeCollection;
71 friend class XmlDocument;
72 friend class XmlLoader;
73 friend class XmlNodeReaderNavigator;
74 friend class Schema::Parser;
76
77public:
78
81 ASPOSECPP_SHARED_API String get_Name() override;
85 ASPOSECPP_SHARED_API String get_LocalName() override;
88 ASPOSECPP_SHARED_API String get_NamespaceURI() override;
91 ASPOSECPP_SHARED_API String get_Prefix() override;
99 ASPOSECPP_SHARED_API void set_Prefix(String value) override;
102 ASPOSECPP_SHARED_API XmlNodeType get_NodeType() override;
105 ASPOSECPP_SHARED_API SharedPtr<XmlDocument> get_OwnerDocument() override;
109 ASPOSECPP_SHARED_API bool get_IsEmpty();
116 ASPOSECPP_SHARED_API void set_IsEmpty(bool value);
119 virtual ASPOSECPP_SHARED_API bool get_HasAttributes();
122 ASPOSECPP_SHARED_API SharedPtr<Schema::IXmlSchemaInfo> get_SchemaInfo() override;
125 ASPOSECPP_SHARED_API String get_InnerXml() override;
129 ASPOSECPP_SHARED_API void set_InnerXml(String value) override;
132 ASPOSECPP_SHARED_API String get_InnerText() override;
135 ASPOSECPP_SHARED_API void set_InnerText(String value) override;
136
141 ASPOSECPP_SHARED_API SharedPtr<XmlNode> CloneNode(bool deep) override;
148 virtual ASPOSECPP_SHARED_API String GetAttribute(String name);
155 virtual ASPOSECPP_SHARED_API void SetAttribute(String name, String value);
160 virtual ASPOSECPP_SHARED_API void RemoveAttribute(String name);
165 virtual ASPOSECPP_SHARED_API SharedPtr<XmlAttribute> GetAttributeNode(String name);
185 virtual ASPOSECPP_SHARED_API SharedPtr<XmlNodeList> GetElementsByTagName(String name);
192 virtual ASPOSECPP_SHARED_API String GetAttribute(String localName, String namespaceURI);
198 virtual ASPOSECPP_SHARED_API String SetAttribute(String localName, String namespaceURI, String value);
204 virtual ASPOSECPP_SHARED_API void RemoveAttribute(String localName, String namespaceURI);
209 virtual ASPOSECPP_SHARED_API SharedPtr<XmlAttribute> GetAttributeNode(String localName, String namespaceURI);
214 virtual ASPOSECPP_SHARED_API SharedPtr<XmlAttribute> SetAttributeNode(String localName, String namespaceURI);
221 virtual ASPOSECPP_SHARED_API SharedPtr<XmlAttribute> RemoveAttributeNode(String localName, String namespaceURI);
227 virtual ASPOSECPP_SHARED_API SharedPtr<XmlNodeList> GetElementsByTagName(String localName, String namespaceURI);
232 virtual ASPOSECPP_SHARED_API bool HasAttribute(String name);
237 virtual ASPOSECPP_SHARED_API bool HasAttribute(String localName, String namespaceURI);
240 ASPOSECPP_SHARED_API void WriteTo(const SharedPtr<XmlWriter>& w) override;
243 ASPOSECPP_SHARED_API void WriteContentTo(const SharedPtr<XmlWriter>& w) override;
248 virtual ASPOSECPP_SHARED_API SharedPtr<XmlNode> RemoveAttributeAt(int32_t i);
250 virtual ASPOSECPP_SHARED_API void RemoveAllAttributes();
252 ASPOSECPP_SHARED_API void RemoveAll() override;
253
254protected:
255
258 void set_XmlName(const SharedPtr<System::Xml::XmlName>& value);
259 ASPOSECPP_SHARED_API SharedPtr<XmlNode> get_ParentNodeInternal() override;
260 ASPOSECPP_SHARED_API bool get_IsContainer() override;
261 ASPOSECPP_SHARED_API SharedPtr<XmlLinkedNode> get_LastNode() override;
262 ASPOSECPP_SHARED_API void set_LastNode(SharedPtr<XmlLinkedNode> value) override;
263 ASPOSECPP_SHARED_API SharedPtr<XmlAttributeCollection> get_AttributesInternal() override;
264 ASPOSECPP_SHARED_API SharedPtr<XmlNode> get_NextSiblingInternal() override;
265 ASPOSECPP_SHARED_API XPath::XPathNodeType get_XPNodeType() override;
266 ASPOSECPP_SHARED_API String get_XPLocalName() override;
267
268 XmlElement(const SharedPtr<System::Xml::XmlName>& name, bool empty, const SharedPtr<XmlDocument>& doc);
269 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XmlElement, CODEPORTING_ARGS(const SharedPtr<System::Xml::XmlName>& name, bool empty, const SharedPtr<XmlDocument>& doc));
271
277 ASPOSECPP_SHARED_API XmlElement(const String& prefix, const String& localName, const String& namespaceURI, const SharedPtr<XmlDocument>& doc);
278
279 ASPOSECPP_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XmlElement, CODEPORTING_ARGS(const String& prefix, const String& localName, const String& namespaceURI, const SharedPtr<XmlDocument>& doc));
280
282 ASPOSECPP_SHARED_API SharedPtr<XmlNode> AppendChildForLoad(const SharedPtr<XmlNode>& newChild, const SharedPtr<XmlDocument>& doc) override;
283 ASPOSECPP_SHARED_API bool IsValidChildType(XmlNodeType type) override;
284 void RemoveAllChildren();
285 ASPOSECPP_SHARED_API void SetParent(SharedPtr<XmlNode> node) override;
286 ASPOSECPP_SHARED_API String GetXPAttribute(String localName, String ns) override;
288
289 virtual ASPOSECPP_SHARED_API ~XmlElement();
290
292 #ifdef ASPOSE_GET_SHARED_MEMBERS
293 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
294 #endif
296
297private:
298
301 SharedPtr<XmlLinkedNode> _lastChild;
302
303 static void WriteElementTo(const SharedPtr<XmlWriter>& writer, SharedPtr<XmlElement> e);
304 void WriteStartElement(const SharedPtr<XmlWriter>& w);
305
306};
307
308} // namespace Xml
309} // namespace System
310
311
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Represents a collection of attributes that can be accessed by name or index.
Definition: xml_attribute_collection.h:35
Represents an attribute. Valid and default values for the attribute are defined in a document type de...
Definition: xml_attribute.h:50
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
Definition: xml_document.h:100
Represents an element.
Definition: xml_element.h:51
String get_NamespaceURI() override
Returns the namespace URI of this node.
virtual void SetAttribute(String name, String value)
Sets the value of the attribute with the specified name.
virtual SharedPtr< XmlAttribute > RemoveAttributeNode(String localName, String namespaceURI)
Removes the XmlAttribute specified by the local name and namespace URI. (If the removed attribute has...
SharedPtr< XmlDocument > get_OwnerDocument() override
Returns the XmlDocument to which this node belongs.
void RemoveAll() override
Removes all specified attributes and children of the current node. Default attributes are not removed...
void set_Prefix(String value) override
Sets the namespace prefix of this node.
void WriteContentTo(const SharedPtr< XmlWriter > &w) override
Saves all the children of the node to the specified XmlWriter.
void set_InnerText(String value) override
Sets the concatenated values of the node and all its children.
String get_Name() override
Returns the qualified name of the node.
virtual String SetAttribute(String localName, String namespaceURI, String value)
Sets the value of the attribute with the specified local name and namespace URI.
virtual SharedPtr< XmlAttribute > SetAttributeNode(SharedPtr< XmlAttribute > newAttr)
Adds the specified XmlAttribute.
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XmlElement, CODEPORTING_ARGS(const String &prefix, const String &localName, const String &namespaceURI, const SharedPtr< XmlDocument > &doc))
virtual String GetAttribute(String name)
Returns the value for the attribute with the specified name.
void WriteTo(const SharedPtr< XmlWriter > &w) override
Saves the current node to the specified XmlWriter.
virtual SharedPtr< XmlAttribute > GetAttributeNode(String localName, String namespaceURI)
Returns the XmlAttribute with the specified local name and namespace URI.
XmlNodeType get_NodeType() override
Returns the type of the current node.
virtual void RemoveAllAttributes()
Removes all specified attributes from the element. Default attributes are not removed.
virtual void RemoveAttribute(String localName, String namespaceURI)
Removes an attribute with the specified local name and namespace URI. (If the removed attribute has a...
virtual SharedPtr< XmlAttribute > GetAttributeNode(String name)
Returns the XmlAttribute with the specified name.
void set_InnerXml(String value) override
Sets the markup representing just the children of this node.
virtual bool get_HasAttributes()
Returns a bool value indicating whether the current node has any attributes.
virtual SharedPtr< XmlAttribute > SetAttributeNode(String localName, String namespaceURI)
Adds the specified XmlAttribute.
virtual bool HasAttribute(String name)
Determines whether the current node has an attribute with the specified name.
virtual SharedPtr< XmlAttribute > RemoveAttributeNode(SharedPtr< XmlAttribute > oldAttr)
Removes the specified XmlAttribute.
virtual SharedPtr< XmlNode > RemoveAttributeAt(int32_t i)
Removes the attribute node with the specified index from the element. (If the removed attribute has a...
bool get_IsEmpty()
Returns the tag format of the element.
String get_InnerText() override
Returns the concatenated values of the node and all its children.
SharedPtr< Schema::IXmlSchemaInfo > get_SchemaInfo() override
Returns the post schema validation infoset that has been assigned to this node as a result of schema ...
virtual String GetAttribute(String localName, String namespaceURI)
Returns the value for the attribute with the specified local name and namespace URI.
String get_LocalName() override
Returns the local name of the current node.
void set_IsEmpty(bool value)
Sets the tag format of the element.
virtual void RemoveAttribute(String name)
Removes an attribute by name.
XmlElement(const String &prefix, const String &localName, const String &namespaceURI, const SharedPtr< XmlDocument > &doc)
Initializes a new instance of the XmlElement class.
virtual SharedPtr< XmlNodeList > GetElementsByTagName(String name)
Returns an XmlNodeList containing a list of all descendant elements that match the specified XmlEleme...
String get_Prefix() override
Returns the namespace prefix of this node.
String get_InnerXml() override
Returns the markup representing just the children of this node.
virtual bool HasAttribute(String localName, String namespaceURI)
Determines whether the current node has an attribute with the specified local name and namespace URI.
SharedPtr< XmlNode > CloneNode(bool deep) override
Creates a duplicate of this node.
virtual SharedPtr< XmlNodeList > GetElementsByTagName(String localName, String namespaceURI)
Returns an XmlNodeList containing a list of all descendant elements that match the specified XmlEleme...
Returns the node immediately preceding or following this node.
Definition: xml_linked_node.h:32
Represents a single node in the XML document.
Definition: xml_node.h:75
XPathNodeType
Defines the XPath node types that can be returned from the XPathNavigator class.
Definition: xpath_node_type.h:17
@ Schema
Validate according to XML Schema definition language (XSD) schemas, including inline XML Schemas....
@ Xml
Serialize according to the XML 1.0 rules.
XmlNodeType
Specifies the type of node.
Definition: xml_node_type.h:15
Definition: db_command.h:9