System::Xml::XmlElement Class Reference

Inherits System::Xml::XmlNode.

Public Types

typedef SharedPtr< XmlElementPtr
 An alias for shared pointer to an instance of this class. More...
 
- Public Types inherited from System::Xml::XmlNode
typedef SharedPtr< XmlNodePtr
 An alias for shared pointer to an instance of this class. More...
 
- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. More...
 

Public Member Functions

ASPOSECPP_SHARED_API String get_Name () const override
 Returns the name of the node represented by the current object. More...
 
ASPOSECPP_SHARED_API String get_Value () const override
 
ASPOSECPP_SHARED_API String get_LocalName () const override
 Returns the local name of the node represented by the current object. More...
 
ASPOSECPP_SHARED_API String get_Prefix () const override
 Returns the prefix of the node represented by the current object. More...
 
ASPOSECPP_SHARED_API String get_NamespaceURI () const override
 Returns the namespace URI of the node represented by the current object. More...
 
ASPOSECPP_SHARED_API XmlAttributeCollection::Ptr get_Attributes () override
 
ASPOSECPP_SHARED_API bool get_HasAttributes () const
 
ASPOSECPP_SHARED_API bool get_IsEmpty () const
 
ASPOSECPP_SHARED_API XmlElement::Ptr idx_get (String name) const override
 
ASPOSECPP_SHARED_API void set_Prefix (String value) override
 
ASPOSECPP_SHARED_API XmlNode::Ptr AppendChild (XmlNode::Ptr new_child) override
 
ASPOSECPP_SHARED_API XmlNode::Ptr PrependChild (XmlNode::Ptr new_child) override
 
ASPOSECPP_SHARED_API XmlNode::Ptr InsertBefore (XmlNode::Ptr child, XmlNode::Ptr ref_child) override
 
ASPOSECPP_SHARED_API XmlNode::Ptr InsertAfter (XmlNode::Ptr child, XmlNode::Ptr ref_child) override
 
ASPOSECPP_SHARED_API XmlAttribute::Ptr GetAttributeNode (const String &name) const
 
ASPOSECPP_SHARED_API String GetAttribute (const String &name) const
 
ASPOSECPP_SHARED_API String GetAttribute (const String &localName, const String &namespaceURI) const
 
ASPOSECPP_SHARED_API SharedPtr< XmlNodeListGetElementsByTagName (const String &name)
 
ASPOSECPP_SHARED_API SharedPtr< XmlNodeListGetElementsByTagName (const String &localName, const String &namespaceURI)
 
ASPOSECPP_SHARED_API bool HasAttribute (const String &qname) const
 
ASPOSECPP_SHARED_API bool HasAttribute (const String &localName, const String &namespaceURI) const
 
ASPOSECPP_SHARED_API void SetAttribute (const String &name, const String &value)
 
ASPOSECPP_SHARED_API void SetAttribute (const String &localName, const String &namespaceURI, const String &value)
 
ASPOSECPP_SHARED_API XmlAttribute::Ptr SetAttributeNode (const XmlAttribute::Ptr &attribute)
 
ASPOSECPP_SHARED_API void RemoveAllAttributes ()
 Removes all attributes. More...
 
ASPOSECPP_SHARED_API void RemoveAttribute (const String &qname)
 
ASPOSECPP_SHARED_API void RemoveAttribute (const String &loaclName, const String &namespaceURI)
 
ASPOSECPP_SHARED_API XmlNode::Ptr RemoveAttributeAt (int idx)
 
ASPOSECPP_SHARED_API XmlAttribute::Ptr RemoveAttributeNode (const XmlAttribute::Ptr &attribute)
 
ASPOSECPP_SHARED_API XmlAttribute::Ptr RemoveAttributeNode (const String &name)
 
ASPOSECPP_SHARED_API void WriteContentTo (SharedPtr< XmlWriter > writer) override
 
ASPOSECPP_SHARED_API void WriteTo (SharedPtr< XmlWriter > writer) override
 
ASPOSECPP_SHARED_API XmlNode::Ptr CloneNode (bool deep) override
 
- Public Member Functions inherited from System::Xml::XmlNode
virtual ASPOSECPP_SHARED_API ~XmlNode ()
 Destructor. More...
 
virtual ASPOSECPP_SHARED_API XmlNodeType get_NodeType () const
 Returns the type of the XML node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API String get_InnerText () const
 Returns the concatenated values of the XML node represented by the current object and all its child nodes. More...
 
virtual ASPOSECPP_SHARED_API String get_InnerXml () const
 Returns the XML markup representing the child nodes of the XML node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API String get_OuterXml () const
 Returns the XML markup representing the XML node represented by the current object and all its the child nodes. More...
 
virtual ASPOSECPP_SHARED_API bool get_HasChildNodes () const
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr get_FirstChild () const
 Returns the first child of the node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr get_LastChild () const
 Returns the last child of the node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr get_NextSibling () const
 Returns the next sibling of the node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr get_PreviousSibling () const
 Returns the previous sibling of the node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr get_ParentNode () const
 Returns the parent node of the node represented by the current object. More...
 
virtual ASPOSECPP_SHARED_API SharedPtr< XmlDocumentget_OwnerDocument () const
 
virtual ASPOSECPP_SHARED_API SharedPtr< XmlNodeListget_ChildNodes ()
 
virtual ASPOSECPP_SHARED_API void set_Value (String value)
 
virtual ASPOSECPP_SHARED_API void set_InnerText (String value)
 
virtual ASPOSECPP_SHARED_API void set_InnerXml (String value)
 
virtual SharedPtr< XmlElementoperator[] (String name) const
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr ReplaceChild (XmlNode::Ptr new_child, XmlNode::Ptr old_child)
 
virtual ASPOSECPP_SHARED_API void RemoveAll ()
 Removes all child nodes of the XML node reprsented by the current object. More...
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr RemoveChild (XmlNode::Ptr child)
 
virtual ASPOSECPP_SHARED_API String GetPrefixOfNamespace (const String &namespace_uri)
 
virtual ASPOSECPP_SHARED_API String GetNamespaceOfPrefix (const String &prefix)
 
virtual ASPOSECPP_SHARED_API SharedPtr< XmlNodeListSelectNodes (String xPath)
 
virtual ASPOSECPP_SHARED_API SharedPtr< XmlNodeListSelectNodes (String xPath, SharedPtr< XmlNamespaceManager > nsMgr)
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr SelectSingleNode (String xPath)
 
virtual ASPOSECPP_SHARED_API XmlNode::Ptr SelectSingleNode (String xPath, SharedPtr< XmlNamespaceManager > nsMgr)
 
ASPOSECPP_SHARED_API SharedPtr< System::Collections::Generic::IEnumerator< XmlNode::Ptr > > GetEnumerator ()
 
XmlNode::Ptr Clone ()
 
xmlNode * native_node ()
 Returns a pointer to the underlying libxml2 xmlNode object. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared refernce counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () ASPOSE_CONST
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Additional Inherited Members

- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Impleemnts C# typeof(System.Object) construct. More...
 

Detailed Description

Represents an XML element node. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

Member Typedef Documentation

◆ Ptr

An alias for shared pointer to an instance of this class.

Member Function Documentation

◆ AppendChild()

ASPOSECPP_SHARED_API XmlNode::Ptr System::Xml::XmlElement::AppendChild ( XmlNode::Ptr  new_child)
overridevirtual

Adds the specified XML node at the end of the list of children of the XML element represented by the current object.

Parameters
new_childThe XML node to add
Returns
A shared pointer to the specified XmlNode object child

Reimplemented from System::Xml::XmlNode.

◆ CloneNode()

ASPOSECPP_SHARED_API XmlNode::Ptr System::Xml::XmlElement::CloneNode ( bool  deep)
overridevirtual

Returns a copy of the node represented by the current object.

Parameters
deepSpecifies whether to clone the subtree under the node represented by the current object (true) or only the node itself (false)
Returns
A shared pointer to an XmlNode object that is a copy of the current object

Implements System::Xml::XmlNode.

◆ get_Attributes()

ASPOSECPP_SHARED_API XmlAttributeCollection::Ptr System::Xml::XmlElement::get_Attributes ( )
overridevirtual

Returns an XmlAttributeCollection object containing all attributes of the XML element represented by the current object.

Reimplemented from System::Xml::XmlNode.

◆ get_HasAttributes()

ASPOSECPP_SHARED_API bool System::Xml::XmlElement::get_HasAttributes ( ) const

Determines if the XML element represented by the current object has any attributes.

Returns
True if the XML element represented by the current object has at least one attribute, otherwise - false

◆ get_IsEmpty()

ASPOSECPP_SHARED_API bool System::Xml::XmlElement::get_IsEmpty ( ) const

Determines if the XML element represented by the current object has any attributes or child nodes.

Returns
True if the XML element represented by the current object has at least one attribute or at least one child node, otherwise - false

◆ get_LocalName()

ASPOSECPP_SHARED_API String System::Xml::XmlElement::get_LocalName ( ) const
overridevirtual

Returns the local name of the node represented by the current object.

Reimplemented from System::Xml::XmlNode.

◆ get_Name()

ASPOSECPP_SHARED_API String System::Xml::XmlElement::get_Name ( ) const
overridevirtual

Returns the name of the node represented by the current object.

Implements System::Xml::XmlNode.

◆ get_NamespaceURI()

ASPOSECPP_SHARED_API String System::Xml::XmlElement::get_NamespaceURI ( ) const
overridevirtual

Returns the namespace URI of the node represented by the current object.

Reimplemented from System::Xml::XmlNode.

◆ get_Prefix()

ASPOSECPP_SHARED_API String System::Xml::XmlElement::get_Prefix ( ) const
overridevirtual

Returns the prefix of the node represented by the current object.

Reimplemented from System::Xml::XmlNode.

◆ get_Value()

ASPOSECPP_SHARED_API String System::Xml::XmlElement::get_Value ( ) const
overridevirtual

Returns the value of the XML node represented by the current object.

Returns
An empty string

Reimplemented from System::Xml::XmlNode.

◆ GetAttribute() [1/2]

ASPOSECPP_SHARED_API String System::Xml::XmlElement::GetAttribute ( const String name) const

Returns the value of the attribute of the XML element represented by the current object with the specified name.

Parameters
nameThe name of the attribute
Returns
The value of the attribute with name name

◆ GetAttribute() [2/2]

ASPOSECPP_SHARED_API String System::Xml::XmlElement::GetAttribute ( const String localName,
const String namespaceURI 
) const

Returns the name of the attribute of the XML element represented by the current object with the specified local name and namespace URI.

Parameters
localNameThe local name of the attribute
namespaceURIThe namespace URI of the attribute
Returns
The value of the attribute with local name localName and namespace URI namespaceURI

◆ GetAttributeNode()

ASPOSECPP_SHARED_API XmlAttribute::Ptr System::Xml::XmlElement::GetAttributeNode ( const String name) const

Returns an XmlAttribute object representing an XML attribute of the XML element represented by the current object with the specified name.

Parameters
nameThe name of the attribute to return
Returns
An XmlAttribute object representing an XML attribute of the XML element represented by the current object with name name.

◆ GetElementsByTagName() [1/2]

ASPOSECPP_SHARED_API SharedPtr<XmlNodeList> System::Xml::XmlElement::GetElementsByTagName ( const String name)

Returns descendant elements whose qualified names match the specified value.

Parameters
nameThe string to match elements' names against
Returns
An XmlNodeList object containing objects representing XML elements whose qualified names match name

◆ GetElementsByTagName() [2/2]

ASPOSECPP_SHARED_API SharedPtr<XmlNodeList> System::Xml::XmlElement::GetElementsByTagName ( const String localName,
const String namespaceURI 
)

Returns descendant elements whose local names and namespace URIs match the specified values.

Parameters
localNameThe string to match elements' local names against
namespaceURIThe string to match elements' namespace URIs against
Returns
An XmlNodeList object containing objects representing XML elements whose local names match localName and namespace URIs match namespaceURI

◆ HasAttribute() [1/2]

ASPOSECPP_SHARED_API bool System::Xml::XmlElement::HasAttribute ( const String qname) const

Determines if the XML element represented by the current object has an attribute with the specified qualified name.

Parameters
qnameThe qualified name of the attribute to look for
Returns
True if the attribute with the spacified qualified name is found, otherwise - false

◆ HasAttribute() [2/2]

ASPOSECPP_SHARED_API bool System::Xml::XmlElement::HasAttribute ( const String localName,
const String namespaceURI 
) const

Determines if the XML element represented by the current object has an attribute with the specified local name and namespace URI.

Parameters
localNameThe local name of the attribute to look for
namespaceURIThe namespace URI of the attribute to look for
Returns
True if the attribute with the spacified local name and namespace URI is found, otherwise - false

◆ idx_get()

ASPOSECPP_SHARED_API XmlElement::Ptr System::Xml::XmlElement::idx_get ( String  name) const
overridevirtual

Looks for a child XML element with the specified name.

Parameters
nameThe name of the element to look for
Returns
An XmlElement object representing XML element which is a child of the XML element represented by the current object and whos name matches name.

Reimplemented from System::Xml::XmlNode.

◆ InsertAfter()

ASPOSECPP_SHARED_API XmlNode::Ptr System::Xml::XmlElement::InsertAfter ( XmlNode::Ptr  child,
XmlNode::Ptr  ref_child 
)
overridevirtual

Adds the specified XML node to the list of children of the XML element represented by the current object at the position next to the position of the specified reference child node.

Parameters
childThe XML node to add
ref_childThe reference node indicating the position in the list of children prior to which node should be inserted
Returns
A shared pointer to the specified XmlNode object child

Reimplemented from System::Xml::XmlNode.

◆ InsertBefore()

ASPOSECPP_SHARED_API XmlNode::Ptr System::Xml::XmlElement::InsertBefore ( XmlNode::Ptr  child,
XmlNode::Ptr  ref_child 
)
overridevirtual

Adds the specified XML node to the list of children of the XML element represented by the current object at the position prior to the position of the specified reference child node.

Parameters
childThe XML node to add
ref_childThe reference node indicating the position in the list of children prior to which node should be inserted
Returns
A shared pointer to the specified XmlNode object child

Reimplemented from System::Xml::XmlNode.

◆ PrependChild()

ASPOSECPP_SHARED_API XmlNode::Ptr System::Xml::XmlElement::PrependChild ( XmlNode::Ptr  new_child)
overridevirtual

Adds the specified XML node at the beginning of the list of children of the XML element represented by the current object.

Parameters
new_childThe XML node to add
Returns
A shared pointer to the specified XmlNode object child

Reimplemented from System::Xml::XmlNode.

◆ RemoveAllAttributes()

ASPOSECPP_SHARED_API void System::Xml::XmlElement::RemoveAllAttributes ( )

Removes all attributes.

◆ RemoveAttribute() [1/2]

ASPOSECPP_SHARED_API void System::Xml::XmlElement::RemoveAttribute ( const String qname)

Removes the attribute with the specified qualified name.

Parameters
qnameThe qualified name of the attribute to remove

◆ RemoveAttribute() [2/2]

ASPOSECPP_SHARED_API void System::Xml::XmlElement::RemoveAttribute ( const String loaclName,
const String namespaceURI 
)

Removes the attribute with the specified local name and namespace URI.

Parameters
loaclNameThe local name of the attribute to remove
namespaceURIThe namespace URI of the attribute to remove

◆ RemoveAttributeAt()

ASPOSECPP_SHARED_API XmlNode::Ptr System::Xml::XmlElement::RemoveAttributeAt ( int  idx)

Removes the attribute located at the spacified position in the list of attributes af the XML element represented by the current object.

Parameters
idxThe 0-based index of the attribute to remove
Returns
The removed XmlNode object or null-pointer if the node with the specified index does not exist

◆ RemoveAttributeNode() [1/2]

ASPOSECPP_SHARED_API XmlAttribute::Ptr System::Xml::XmlElement::RemoveAttributeNode ( const XmlAttribute::Ptr attribute)

Removes the specified attribute from the list of attributes of the XML element represented by the current object.

Parameters
attributeThe attribute to remove
Returns
The removed attribute

◆ RemoveAttributeNode() [2/2]

ASPOSECPP_SHARED_API XmlAttribute::Ptr System::Xml::XmlElement::RemoveAttributeNode ( const String name)

Removes the attribute with the specified qualified name from the list of attributes of the XML element represented by the current object.

Parameters
nameThe qualified name of the attribute to remove
Returns
The removed attribute

◆ set_Prefix()

ASPOSECPP_SHARED_API void System::Xml::XmlElement::set_Prefix ( String  value)
overridevirtual

Sets the specified value as a prefix for the XML element represented by the current object.

Parameters
valueThe prefix value to set

Reimplemented from System::Xml::XmlNode.

◆ SetAttribute() [1/2]

ASPOSECPP_SHARED_API void System::Xml::XmlElement::SetAttribute ( const String name,
const String value 
)

Sets the specified value to the attribute with the specified qualified name. If the attribut that matches the specified criteria does not exist, it is created.

Parameters
nameThe qualified name of the attribute to set the value of
valueThe value to set

◆ SetAttribute() [2/2]

ASPOSECPP_SHARED_API void System::Xml::XmlElement::SetAttribute ( const String localName,
const String namespaceURI,
const String value 
)

Sets the specified value to the attribute with the specified local name and namespace URI. If the attribut that matches the specified criteria does not exist, it is created.

Parameters
localNameThe local name of the attribute to set the value of
namespaceURIThe namespace URI of the attribute
valueThe value to set

◆ SetAttributeNode()

ASPOSECPP_SHARED_API XmlAttribute::Ptr System::Xml::XmlElement::SetAttributeNode ( const XmlAttribute::Ptr attribute)

Attaches the specified attribute to the XML element represented by the current object.

Returns
The attached attribute

◆ WriteContentTo()

ASPOSECPP_SHARED_API void System::Xml::XmlElement::WriteContentTo ( SharedPtr< XmlWriter writer)
overridevirtual

Saves all children of the node represented by the current object to the specified XmlWiter object.

Parameters
writerThe XmlWriter object to save the nodes to

Reimplemented from System::Xml::XmlNode.

◆ WriteTo()

ASPOSECPP_SHARED_API void System::Xml::XmlElement::WriteTo ( SharedPtr< XmlWriter writer)
overridevirtual

Saves the node represented by the current object to the specified XmlWriter.

Parameters
writerThe XmlWriter object to save the node to

Implements System::Xml::XmlNode.