Base Framework
Public Member Functions | Protected Member Functions | List of all members
Element Class Reference

DOM element node. More...

#include <base/xml/Element.h>

Inherits Node.

Public Member Functions

 Element (const Node &node)
 
 Element (const Node::ShadowElement &element) noexcept
 
String getTagName () const noexcept
 
Attribute getFirstAttribute () noexcept
 
String getAttribute (const String &name) const
 
String getAttribute (const char *name) const
 
void setAttribute (const String &name, const String &value)
 
void setAttribute (const char *name, const char *value)
 
void removeAttribute (const String &name)
 
void removeAttribute (const char *name)
 
Attribute getAttributeNode (const String &name)
 
Attribute getAttributeNode (const char *name)
 
Attribute setAttributeNode (Attribute attribute)
 
Attribute removeAttributeNode (Attribute attribute)
 
Attribute getAttributeNodeNS (const String &namespaceURI, const String &localName)
 
Attribute getAttributeNodeNS (const char *namespaceURI, const char *localName)
 
String getAttributeNS (const String &namespaceURI, const String &localName)
 
String getAttributeNS (const char *namespaceURI, const char *localName)
 
void setAttributeNS (const String &namespaceURI, const String &qualifiedName, const String &value)
 
void setAttributeNS (const char *namespaceURI, const char *qualifiedName, const char *value)
 
void removeAttributeNS (const String &namespaceURI, const String &localName)
 
void removeAttributeNS (const char *namespaceURI, const char *localName)
 
Attribute setAttributeNodeNS (Attribute attribute)
 
bool hasAttributes () const noexcept
 
bool hasAttribute (const char *name) const noexcept
 
bool hasAttribute (const String &name) const noexcept
 
bool hasAttributeNS (const char *namespaceURI, const char *localName) const noexcept
 
bool hasAttributeNS (const String &namespaceURI, const String &localName) const noexcept
 
- Public Member Functions inherited from Node
 Node () noexcept
 
 Node (const Node &copy) noexcept
 
Nodeoperator= (const Node &assign) noexcept
 
Node appendChild (Node child)
 
Node insertBefore (Node newChild, Node refChild)
 
Node removeChild (Node child)
 
Node replaceChild (Node newChild, Node oldChild)
 
Node cloneNode (bool deep)
 
String getLocalName () const noexcept
 
String getNamespaceURI () const noexcept
 
String getName () const
 
NodeType getType () const
 
String getValue () const
 
ShadowDocument getOwnerDocument () noexcept
 
String getPrefix () const
 
void setPrefix (const String &prefix)
 
Node getParent () const noexcept
 
Node getPreviousSibling () const noexcept
 
Node getNextSibling () const noexcept
 
Node getFirstChild () const
 
Node getLastChild () const
 
bool hasAttributes () const noexcept
 
bool hasChildNodes () const
 
bool isSupported (const String &feature, const String &version) const noexcept
 
void normalize ()
 
void setValue (const String &value)
 
bool isValid () const noexcept
 
bool isInvalid () const noexcept
 
bool isUnlinked () const noexcept
 
bool isSame (const Node &node) const noexcept
 
bool operator== (const Node &node) const noexcept
 
bool hasSameOwner (const Node &node) const noexcept
 
bool isAncestor (const Node &node) const noexcept
 
 operator bool () const noexcept
 
 ~Node () noexcept
 

Protected Member Functions

 Element (void *context) noexcept
 
- Protected Member Functions inherited from Node
 Node (void *_context) noexcept
 
void * getContext () noexcept
 
const void * getContext () const noexcept
 

Additional Inherited Members

- Public Types inherited from Node
enum  NodeType {
  ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE,
  ENTITY_REFERENCE_NODE, ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE,
  DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE,
  ATTRIBUTE_DECL_NODE, ELEMENT_DECL_NODE, ENTITY_DECL_NODE
}
 

Detailed Description

DOM element node.

Representation of an element in an XML document.

Version
1.0
Examples
testsuite/dom.cpp, and testsuite/sax.cpp.

Constructor & Destructor Documentation

◆ Element() [1/3]

Element::Element ( void *  context)
inlineprotectednoexcept

Internal constructor.

◆ Element() [2/3]

Element::Element ( const Node node)
inline

Initializes element from node.

◆ Element() [3/3]

Element::Element ( const Node::ShadowElement element)
inlinenoexcept

Initializes element.

Member Function Documentation

◆ getAttribute()

String Element::getAttribute ( const String name) const
inline

Retrieves an attribute value by name.

◆ getAttributeNode()

Attribute Element::getAttributeNode ( const String name)
inline

Retrieves an attribute node by name.

◆ getAttributeNodeNS()

Attribute Element::getAttributeNodeNS ( const String namespaceURI,
const String localName 
)
inline

Retrieves an Attribute node by local name and namespace URI.

◆ getAttributeNS()

String Element::getAttributeNS ( const String namespaceURI,
const String localName 
)
inline

Retrieves an attribute value by local name and namespace URI.

◆ getFirstAttribute()

Attribute Element::getFirstAttribute ( )
noexcept

Returns the first attribute node of this element.

Examples
testsuite/dom.cpp.

◆ getTagName()

String Element::getTagName ( ) const
noexcept

Returns the target.

Examples
testsuite/dom.cpp.

◆ hasAttribute()

bool Element::hasAttribute ( const String name) const
inlinenoexcept

Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.

◆ hasAttributeNS()

bool Element::hasAttributeNS ( const String namespaceURI,
const String localName 
) const
inlinenoexcept

Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.

◆ hasAttributes()

bool Element::hasAttributes ( ) const
noexcept

Returns true if the element has any attributes.

Examples
testsuite/dom.cpp.

◆ removeAttribute()

void Element::removeAttribute ( const String name)
inline

Removes an attribute by name.

◆ removeAttributeNode()

Attribute Element::removeAttributeNode ( Attribute  attribute)

Removes the specified attribute node.

◆ removeAttributeNS()

void Element::removeAttributeNS ( const String namespaceURI,
const String localName 
)
inline

Removes an attribute by local name and namespace URI.

◆ setAttribute()

void Element::setAttribute ( const String name,
const String value 
)
inline

Adds a new attribute.

Examples
testsuite/sax.cpp.

◆ setAttributeNode()

Attribute Element::setAttributeNode ( Attribute  attribute)

Adds a new attribute node.

◆ setAttributeNodeNS()

Attribute Element::setAttributeNodeNS ( Attribute  attribute)

Adds a new attribute.

◆ setAttributeNS()

void Element::setAttributeNS ( const String namespaceURI,
const String qualifiedName,
const String value 
)
inline

Adds a new attribute.