PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFXXMLAttribute
[XML] Class which represents an Attribute node.
#include <SFXXMLAttribute.hpp>
class SFXXMLAttribute : public SFXXMLNode;
SFMTYPEDEFCLASS(SFXXMLAttribute)

Inheritance diagram

 Inheritance diagram of SFXXMLAttributeClass

Collaboration diagram

 Collaboration diagram of SFXXMLAttributeClass

Description

An Attribute node(SFXXMLAttribute) contains an attribute of the XML document.

Reference

SFXXMLNode | SFXXMLCDATASection | SFXXMLComment | SFXXMLDocument | SFXXMLDocumentFragment | SFXXMLDocumentType | SFXXMLElement | SFXXMLEntity | SFXXMLEntityReference | SFXXMLNotation | SFXXMLProcessingInstruction | SFXXMLText

Member

Constructor/Destructor
SFXXMLAttribute( SFXXMLDocumentPtr owner , SFXAnsiStringConstRef name , SFXAnsiStringConstRef value )
Constructor of the SFXXMLAttribute class.
SFXXMLAttribute( SFXXMLDocumentPtr owner , SFXAnsiStringConstRef name , SFXAnsiStringConstRef namespaceURI , SFXAnsiStringConstRef value )
Constructor of the SFXXMLAttribute class.
SFXXMLAttribute( SFXXMLAttributeConstRef other , Bool deep = false )
Constructor of the SFXXMLAttribute class.
~SFXXMLAttribute( Void )
Destructor of the SFXXMLAttribute class.
Public Functions
SFCError AppendChild( SFXXMLNodeConstPtr newchild )
Append the specified child node at the end.
SFCError CloneNode( SFXXMLNodeHandle clonenode , Bool deep )
Create a copy of this node.
Bool EqualNode( SFXXMLNodeConstPtr arg )
Check whether this node equals the specified node or not.
DOMNodeListPtr GetChildNodes( Void )
Get all the child nodes.
SFXXMLNodePtr GetFirstChild( Void )
Get the first child node.
SFXXMLNodePtr GetLastChild( Void )
Get the last child node.
ACharConstPtr GetLocalName( Void )
Get the local name.
ACharConstPtr GetName( Void )
Get the node name.
ACharConstPtr GetNamespaceURI( Void )
Get the namespace URI.
ACharConstPtr GetNodeName( Void )
Get the node name.
NodeType GetNodeType( Void )
Get the node type.
ACharConstPtr GetNodeValue( Void )
Get the node value.
ACharConstPtr GetPrefix( Void )
Get the prefix.
ACharConstPtr GetValue( Void )
Get the node value.
Bool HasChildNodes( Void )
Check whether this node has any child nodes or not.
SFCError InsertBefore( SFXXMLNodeConstPtr newchild , SFXXMLNodeConstPtr refchild )
Insert the specified node.
SFCError RemoveChild( SFXXMLNodeConstPtr oldchild )
Remove the specified child node including its descendant nodes.
SFCError ReplaceChild( SFXXMLNodeConstPtr newchild , SFXXMLNodeConstPtr oldchild )
Replace the specified child node.
Void SetNodeValue( ACharConstPtr value )
Set the node value.
Void SetValue( SFXAnsiStringConstRef value )
Set the node value.
SFXXMLNodePtr GetNextSibling( Void ) (inherits from SFXXMLNode)
Get the next sibling node.
SFXXMLNodePtr GetParentNode( Void ) (inherits from SFXXMLNode)
Get the parent node.
SFXXMLNodePtr GetPreviousSibling( Void ) (inherits from SFXXMLNode)
Get the previous sibling node.
SFXAnsiString GetText( Void ) (inherits from SFXXMLNode)
Get the node text.
Bool IsSameNode( SFXXMLNodeConstPtr other ) (inherits from SFXXMLNode)
Check whether this node is the same as the specified one or not.
SFCError SetText( SFXAnsiStringConstRef text ) (inherits from SFXXMLNode)
Set the node text.
Types
DOMNamedNodeMap (inherits from SFXXMLNode)
Class to manage the DOM nodes by name
DOMNodeList (inherits from SFXXMLNode)
Class to manage the DOM nodes by list
NodeType (inherits from SFXXMLNode)
SFXXMLNode::NodeType is an enumeration type of NodeType values defined in the W3C DOM Level 1 Specification. Document Object Model (DOM) Level 1 Specification )

SFXXMLAttribute::SFXXMLAttribute
Constructor of the SFXXMLAttribute class.
[ public, explicit ]
SFXXMLAttribute(
    SFXXMLDocumentPtr owner       // root node of the DOM tree
    SFXAnsiStringConstRef name    // name of the Attribute node
    SFXAnsiStringConstRef value   // value of the Attribute node
);
[ public, explicit ]
SFXXMLAttribute(
    SFXXMLDocumentPtr owner              // root node of the DOM tree
    SFXAnsiStringConstRef name           // name of the Attribute node
    SFXAnsiStringConstRef namespaceURI   // namespace URI of the Attribute node
    SFXAnsiStringConstRef value          // value of the Attribute node
);
[ public, explicit ]
SFXXMLAttribute(
    SFXXMLAttributeConstRef other   // Attribute node
    Bool deep = false               // whether or not to copy child nodes recursively
);

SFXXMLAttribute::~SFXXMLAttribute
Destructor of the SFXXMLAttribute class.
[ public, virtual ]
virtual ~SFXXMLAttribute(Void);

SFXXMLAttribute::AppendChild
Append the specified child node at the end.
[ public, virtual ]
SFCError AppendChild(
    SFXXMLNodeConstPtr newchild   //  child node to append
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If invalid argument: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed: SFERR_FAILED

Description

The "newchild" node is appended as the last child node to this node without copying it.

If the "newchild" node belongs to a DOM tree, it will be removed from that tree.

Reference

SFXXMLNode::AppendChild | SFXXMLNode


SFXXMLAttribute::CloneNode
Create a copy of this node.
[ public, virtual ]
SFCError CloneNode(
    SFXXMLNodeHandle clonenode   // target node where to copy this node(Handle type)
    Bool deep                    // whether or not to copy the child nodes recursively
);

Argument

clonenode

Specify the target node where to copy this node.

deep

If true is set to this argument, copy the child nodes recursively.

Otherwise, copy only this node.

Return value

  • If succeeds: SFERR_NO_ERROR
  • If failed: SFERR_FAILED

Reference

SFXXMLNode::CloneNode | SFXXMLNode


SFXXMLAttribute::EqualNode
Check whether this node equals the specified node or not.
[ public, virtual, const ]
Bool EqualNode(
    SFXXMLNodeConstPtr arg   // specified node 
);

Return value

  • If yes: true
  • Otherwise: false

Reference

SFXXMLNode::EqualNode | SFXXMLNode


SFXXMLAttribute::GetChildNodes
Get all the child nodes.
[ public, virtual, const ]
DOMNodeListPtr GetChildNodes(Void);

Return value

Return the pointer to the SFXXMLNode::DOMNodeList instance that contains all child nodes of this node.

Description

[Note] Note
Each element of SFXXMLNode::DOMNodeList is of the "pointer to the SFXXMLNode" type.

Reference

SFXXMLNode::DOMNodeList | SFXXMLNode::GetChildNodes | SFXXMLNode


SFXXMLAttribute::GetFirstChild
Get the first child node.
[ public, virtual, const ]
SFXXMLNodePtr GetFirstChild(Void);

Return value

Return the first child node of this node. Return null if this node has no child.

Reference

SFXXMLNode::GetFirstChild | SFXXMLNode


SFXXMLAttribute::GetLastChild
Get the last child node.
[ public, virtual, const ]
SFXXMLNodePtr GetLastChild(Void);

Return value

Return the last child node of this node. Return null if this node has no child.

Reference

SFXXMLNode::GetLastChild | SFXXMLNode


SFXXMLAttribute::GetLocalName
Get the local name.
[ public, const ]
ACharConstPtr GetLocalName(Void);
-->

Return value

Return the local name of this node.

Description

When the name set to this node is qualified name, it is a pair of namespace prefix and local name.

[Note] Note
The name of the Attribute node is the attribute name of the XML document.

Reference

SFXXMLAttribute::GetNodeName


SFXXMLAttribute::GetName
Get the node name.
[ public, const ]
ACharConstPtr GetName(Void);

Description

Same as the SFXXMLAttribute::GetNodeName function.

[Note] Note
The name of the Attribute node is the attribute name of the XML document.
[Note] Note
When the namespace is set, the qualified name(namespace prefix and local name) is returned.

Example

// create Attribute node with  Namespace URI and qualified name
SFXXMLAttributePtr atti = document.CreateAttributeNS("book:isbn","http://www.w3.org/book");
// set value to Attribute node
atti->SetValue("4-7741-1616-5");
// set Attribute node to Element node
book->SetAttributeNode(atti);
    
TRACE("Attribute's name = %s", atti->GetName());       // attribute name as qualified name = book:isbn
TRACE("Attribute's value = %s", atti->GetValue());     // attribute value                  = 4-7741-1616-5
TRACE("Attribute's prefix = %s", atti->GetPrefix());   // prefix                           = book
TRACE("Attribute's uri = %s", atti->GetNamespaceURI());// namespace URI                    = http://www.w3.org/book

Reference

SFXXMLAttribute::GetNodeName | SFXXMLAttribute::GetPrefix


SFXXMLAttribute::GetNamespaceURI
Get the namespace URI.
[ public, const ]
ACharConstPtr GetNamespaceURI(Void);

Return value

Return the namespace URI of this node if set. Otherwise, return null.


SFXXMLAttribute::GetNodeName
Get the node name.
[ public, virtual, const ]
ACharConstPtr GetNodeName(Void);

Description

Same as the SFXXMLAttribute::GetName function.

[Note] Note
The name of the Attribute node is the attribute name of the XML document.
[Note] Note
When the namespace is set, the qualified name(namespace prefix and local name) is returned.

Reference

SFXXMLAttribute::GetName | SFXXMLNode::GetNodeName | SFXXMLNode


SFXXMLAttribute::GetNodeType
Get the node type.
[ public, virtual, const ]
NodeType GetNodeType(Void);

Return value

Return ATTRIBUTE_NODE.

Reference

SFXXMLNode::NodeType | SFXXMLNode::GetNodeType | SFXXMLNode


SFXXMLAttribute::GetNodeValue
Get the node value.
[ public, virtual, const ]
ACharConstPtr GetNodeValue(Void);

Description

Same as the SFXXMLAttribute::GetValue function.

[Note] Note
The value of the Attribute node is the attribute value of the XML document.

Reference

SFXXMLAttribute::GetValue| SFXXMLNode::GetNodeValue | SFXXMLNode


SFXXMLAttribute::GetPrefix
Get the prefix.
[ public, const ]
ACharConstPtr GetPrefix(Void);

Return value

Return the prefix of this node if set. Otherwise return null.

Reference

SFXXMLAttribute::GetName


SFXXMLAttribute::GetValue
Get the node value.
[ public, const ]
ACharConstPtr GetValue(Void);

Description

Same as the SFXXMLAttribute::GetNodeValue function.

[Note] Note
The value of the Attribute node is the attribute value of the XML document.

Reference

SFXXMLAttribute::GetNodeValue


SFXXMLAttribute::HasChildNodes
Check whether this node has any child nodes or not.
[ public, virtual, const ]
Bool HasChildNodes(Void);

Return value

  • If yes: true
  • Otherwise: false

Reference

SFXXMLNode::HasChildNodes | SFXXMLNode


SFXXMLAttribute::InsertBefore
Insert the specified node.
[ public, virtual ]
SFCError InsertBefore(
    SFXXMLNodeConstPtr newchild   // node to insert
    SFXXMLNodeConstPtr refchild   // newchild node is inserted before refchild node
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If invalid argument: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed: SFERR_FAILED

Reference

SFXXMLNode::InsertBefore | SFXXMLNode


SFXXMLAttribute::RemoveChild
Remove the specified child node including its descendant nodes.
[ public, virtual ]
SFCError RemoveChild(
    SFXXMLNodeConstPtr oldchild   // child node to remove
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If failed: SFERR_FAILED

Reference

SFXXMLNode::RemoveChild | SFXXMLNode


SFXXMLAttribute::ReplaceChild
Replace the specified child node.
[ public, virtual ]
SFCError ReplaceChild(
    SFXXMLNodeConstPtr newchild   // new child node to replace with
    SFXXMLNodeConstPtr oldchild   // old child node to be replaced
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If invalid argument: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed: SFERR_FAILED

Reference

SFXXMLNode::ReplaceChild | SFXXMLNode


SFXXMLAttribute::SetNodeValue
Set the node value.
[ public, virtual ]
Void SetNodeValue(
    ACharConstPtr value   //new node content
);

Description

Same as the SFXXMLAttribute::SetNodeValue function.

[Note] Note
The value of the Attribute node is the attribute value of the XML document.

Reference

SFXXMLAttribute::SetValue | SFXXMLNode::SetNodeValue | SFXXMLNode


SFXXMLAttribute::SetValue
Set the node value.
[ public ]
Void SetValue(
    SFXAnsiStringConstRef value   // attribute value 
);

Description

Same as the SFXXMLAttribute::SetValue function.

[Note] Note
The value of the Attribute node is the attribute value of the XML document.

Reference

SFXXMLAttribute::SetNodeValue