Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::XmlElement Class Reference

Element of a DOM tree. More...

#include <arcane/core/XmlNode.h>

Public Member Functions

 XmlElement (XmlNode &parent, const String &name, const String &value)
 Creates a child element of parent. The created element has the name name and the value value. It is added to the end of the list of children of parent.
 XmlElement (XmlNode &parent, const String &name)
 Creates a child element of parent. The created element has the name name and the value value. It is added to the end of the list of children of parent.
Public Member Functions inherited from Arcane::XmlNode
 XmlNode (IRessourceMng *m, const dom::Node &node)
 XmlNode (IRessourceMng *m)
iterator begin ()
 Returns an iterator over the first element of the array.
iterator end ()
 Returns an iterator over the first element after the end of the array.
const_iterator begin () const
 Returns a constant iterator over the first element of the array.
const_iterator end () const
 Returns a constant iterator over the first element after the end of the array.
eType type () const
 Node type.
String name () const
 Node name.
String xpathFullName () const
 XPath name of the node with its ancestors.
bool isNamed (const String &name) const
 True if the element name is name.
String value () const
 Node value.
Integer valueAsInteger (bool throw_exception=false) const
 Node value converted to integer.
Int64 valueAsInt64 (bool throw_exception=false) const
 Node value converted to 64-bit integer. 0 if conversion fails.
bool valueAsBoolean (bool throw_exception=false) const
 Node value converted to boolean.
Real valueAsReal (bool throw_exception=false) const
 Node value converted to real number. If conversion fails, if throw_exception is false returns 0.0, otherwise throws an exception.
void setValue (const String &value)
 Sets the node value.
String attrValue (const String &name, bool throw_exception=false) const
 Value of attribute name.
void setAttrValue (const String &name, const String &value)
 Sets the attribute name to the value value.
XmlNode attr (const String &name, bool throw_exception=false) const
 Returns the attribute of name name.
XmlNode forceAttr (const String &name)
 Returns the attribute of name name. If no attribute with this name exists, an attribute with the null string as value is created and returned.
void removeAttr (const String &name) const
 Removes the attribute of name name from this node. If this node is not an element, nothing is done.
XmlNode documentElement () const
 Returns the document element.
XmlNode ownerElement () const
 Returns the owning element of this attribute.
void clear ()
 Deletes all child nodes.
XmlNode child (const String &name) const
 Child node of this node with name name.
XmlNode expectedChild (const String &name) const
 Child node of this node with name name.
XmlNodeList children (const String &name) const
 Set of child nodes of this node having the name name.
XmlNodeList children () const
 Set of child nodes of this node.
XmlNode parent () const
 Parent of this node (null if none).
void append (const XmlNode &child_node)
 Adds child_node as a child of this node.
void remove (const XmlNode &child_node)
 Removes the child node child_node.
void replace (const XmlNode &new_node, XmlNode &ref_node)
 Replaces the child node ref_node with the node new_node.
void remove ()
 Removes this node from the document.
XmlNode front () const
 First child.
XmlNode last () const
 Last child.
XmlNode next () const
 Next node (nextSibling()).
XmlNode prev () const
 Previous node (previousSibling()).
XmlNode nextWithName (const String &name) const
 Returns the next node after this node having the name name.
XmlNode prevWithName (const String &name) const
 Returns the previous node before this node having the name name.
XmlNode nextSameType () const
 Returns the next node of the same type.
XmlNode prevSameType () const
 Returns the previous node of the same type.
void operator++ ()
void operator-- ()
bool null () const
 True if the node is null.
bool operator! () const
dom::Node domNode () const
void assignDomNode (const dom::Node &node)
XmlNode insertAfter (const XmlNode &new_child, const XmlNode &ref_node)
 Inserts a node. Inserts the node new_child after the node ref_node. If new_child is null, does nothing. If ref_node is null, new_child is added to the end (like append()). Otherwise, ref_node must be a child of this node and new_child is inserted after ref_node. On success, returns the added node (new_child), otherwise the null node.
XmlNode childWithAttr (const String &elem_name, const String &attr_name, const String &attr_value) const
 Returns the child of this node having the name elem_name and an attribute of name attr_name with value attr_value.
XmlNode childWithNameAttr (const String &elem_name, const String &attr_value) const
 Returns the child of this node having the name elem_name and an attribute of name "name" with value attr_value.
XmlNode xpathNode (const String &xpath_expr) const
 Returns a node from an XPath expression.
XmlNode createNode (eType type, const String &name, const String &value)
 Creates a node of a given type.
XmlNode createNode (eType type, const String &name_or_value)
 Creates a node of a given type.
XmlNode createText (const String &value)
 Creates a text node.
XmlNode createElement (const String &name)
XmlNode createAndAppendElement (const String &name)
XmlNode createAndAppendElement (const String &name, const String &value)
XmlNode ownerDocument () const
IRessourceMngrm () const

Additional Inherited Members

Public Types inherited from Arcane::XmlNode
enum  eType {
  ELEMENT = 1 , ATTRIBUTE = 2 , TEXT = 3 , CDATA_SECTION = 4 ,
  ENTITY_REFERENCE = 5 , ENTITY = 6 , PROCESSING_INSTRUCTION = 7 , COMMENT = 8 ,
  DOCUMENT = 9 , DOCUMENT_TYPE = 10 , DOCUMENT_FRAGMENT = 11 , NOTATION = 12
}
 NodeType An integer indicating which type of node this is. More...
typedef XmlNode value_type
 Type of the elements in the array.
typedef XmlNodeIterator iterator
 Type of the iterator over an element in the array.
typedef XmlNodeConstIterator const_iterator
 Type of the constant iterator over an element in the array.
typedef value_typepointer
 Type pointer of an element in the array.
typedef const value_typeconst_pointer
 Type constant pointer of an element in the array.
typedef value_typereference
 Type reference of an element in the array.
typedef const value_typeconst_reference
 Type constant reference of an element in the array.
typedef Integer size_type
 Type indexing the array.
typedef int difference_type
 Type of a distance between iterator elements in the array.
typedef IterT< XmlNode > iter
 Type of an iterator over the entire array.
typedef ConstIterT< XmlNode > const_iter
 Type of a constant iterator over the entire array.
Protected Member Functions inherited from Arcane::XmlNode
String _value () const
XmlNode _build (const dom::Node &node) const
XmlNode _nullNode () const
void _setNode (const dom::Node &n)
void _throwBadConvert (const char *type_name, const String &value) const

Detailed Description

Element of a DOM tree.

Definition at line 404 of file XmlNode.h.

Constructor & Destructor Documentation

◆ XmlElement() [1/2]

Arcane::XmlElement::XmlElement ( XmlNode & parent,
const String & name,
const String & value )

Creates a child element of parent. The created element has the name name and the value value. It is added to the end of the list of children of parent.

Definition at line 690 of file XmlNode.cc.

References Arcane::XmlNode::name(), Arcane::XmlNode::parent(), and Arcane::XmlNode::value().

◆ XmlElement() [2/2]

Arcane::XmlElement::XmlElement ( XmlNode & parent,
const String & name )

Creates a child element of parent. The created element has the name name and the value value. It is added to the end of the list of children of parent.

Definition at line 700 of file XmlNode.cc.

References Arcane::XmlNode::name(), and Arcane::XmlNode::parent().


The documentation for this class was generated from the following files: