SophiaFramework UNIVERSE 5.3 |
#include <SFXXMLElement.hpp>
class SFXXMLElement : public SFXXMLNode;
SFMTYPEDEFCLASS(SFXXMLElement)
An Element node(SFXXMLElement) contains an element of the XML document.
An Attribute node(SFXXMLAttribute) can be set to the Element node using the functions such as SFXXMLElement::SetAttributeNode, SFXXMLElement::SetAttribute.
The Attribute node of the Element node can be obtained using the functions such as SFXXMLElement::GetAttributeNode, SFXXMLElement::GetAttributes.
SFXXMLNode | SFXXMLAttribute | SFXXMLCDATASection | SFXXMLComment | SFXXMLDocument | SFXXMLDocumentFragment | SFXXMLDocumentType | SFXXMLEntity | SFXXMLEntityReference | SFXXMLNotation | SFXXMLProcessingInstruction | SFXXMLText
Constructor/Destructor |
---|
SFXXMLElement(
SFXXMLDocumentPtr owner
, SFXAnsiStringConstRef name
) Constructor of the SFXXMLElement class.
|
SFXXMLElement(
SFXXMLDocumentPtr owner
, SFXAnsiStringConstRef name
, SFXAnsiStringConstRef namespaceURI
) Constructor of the SFXXMLElement class.
|
SFXXMLElement(
SFXXMLElementConstRef other
, Bool deep = false
) Constructor of the SFXXMLElement class.
|
~SFXXMLElement( Void ) Destructor of the SFXXMLElement 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.
|
ACharConstPtr |
GetAttribute(
SFXAnsiStringConstRef name
) Get the value of the attribute with the specified name.
|
ACharConstPtr |
GetAttributeNS(
SFXAnsiStringConstRef localname
, SFXAnsiStringConstRef namespaceURI
) Get the value of the attribute with the specified local name and namespace URI.
|
SFXXMLAttributePtr |
GetAttributeNode(
SFXAnsiStringConstRef name
) Get the Attribute node with the specified name.
|
SFXXMLAttributePtr |
GetAttributeNodeNS(
SFXAnsiStringConstRef localname
, SFXAnsiStringConstRef namespaceURI
) Get the Attribute node with the specified local name and namespace URI.
|
DOMNamedNodeMapPtr |
GetAttributes( Void ) Get all the Attribute nodes.
|
DOMNodeListPtr |
GetChildNodes( Void ) Get all the child nodes.
|
DOMNodeListPtr |
GetElementsByTagName(
SFXAnsiStringConstRef name
) Get all the Element nodes that match the specified tag name.
|
DOMNodeListPtr |
GetElementsByTagNameNS(
SFXAnsiStringConstRef localname
, SFXAnsiStringConstRef namespaceURI
) Get all the Element nodes that match the specified local name and namespace URI.
|
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.
|
SFXXMLNodePtr |
GetNextSibling( Void ) Get the next sibling node.
|
ACharConstPtr |
GetNodeName( Void ) Get the node name.
|
NodeType |
GetNodeType( Void ) Get the node type.
|
SFXXMLNodePtr |
GetParentNode( Void ) Get the parent node.
|
ACharConstPtr |
GetPrefix( Void ) Get the prefix.
|
SFXXMLNodePtr |
GetPreviousSibling( Void ) Get the previous sibling node.
|
Bool |
HasAttribute(
SFXAnsiStringConstRef name
) Check whether or not the attribute with the specified name exists.
|
Bool |
HasAttributeNS(
SFXAnsiStringConstRef localname
, SFXAnsiStringConstRef namespaceURI
) Check whether or not the attribute with the specified local name and namespace URI exists.
|
Bool |
HasAttributes( Void ) Check whether any Attribute nodes exist or not.
|
Bool |
HasChildNodes( Void ) Check wheteher or not this node has any child nodes.
|
SFCError |
InsertBefore(
SFXXMLNodeConstPtr newchild
, SFXXMLNodeConstPtr refchild
) Insert the specified node.
|
Void |
RemoveAttribute(
SFXAnsiStringConstRef name
) Remove the attribute with the specified name(QName).
|
Void |
RemoveAttributeNS(
SFXAnsiStringConstRef localname
, SFXAnsiStringConstRef namespaceURI
) Remove the attribute with the specified local name and namespace URI.
|
SFXXMLAttributePtr |
RemoveAttributeNode(
SFXXMLAttributePtr oldAttr
) Remove the specified Attribute node from this 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 |
SetAttribute(
SFXAnsiStringConstRef name
, ACharConstPtr value
) Set the attribute with the specified name to the specified value.
|
Void |
SetAttributeNS(
SFXAnsiStringConstRef localname
, SFXAnsiStringConstRef namespaceURI
, ACharConstPtr value
) Set the attribute with the specified local name and namespace URI to the specified value.
|
SFCError |
SetAttributeNode(
SFXXMLAttributePtr newAttr
) Set the specified Attribute node to this node.
|
SFCError |
SetAttributeNodeNS(
SFXXMLAttributePtr newAttr
) Set the specified Attribute node to this node.
|
ACharConstPtr |
GetNodeValue( Void )
(inherits from SFXXMLNode)
Get the node value.
|
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.
|
Void |
SetNodeValue(
ACharConstPtr value
)
(inherits from SFXXMLNode)
Set the node value.
|
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 )
|
[ public, explicit ] SFXXMLElement( SFXXMLDocumentPtr owner // root node of the DOM tree SFXAnsiStringConstRef name // name of the Element node );
[ public, explicit ] SFXXMLElement( SFXXMLDocumentPtr owner // root node of the DOM tree SFXAnsiStringConstRef name // name of the Element node SFXAnsiStringConstRef namespaceURI // namespace URI of the Element node );
[ public, explicit ] SFXXMLElement( SFXXMLElementConstRef other // Element node Bool deep = false // whether or not to copy the child nodes recursively );
[ public, virtual ] virtual ~SFXXMLElement(Void);
[ public, virtual ] SFCError AppendChild( SFXXMLNodeConstPtr newchild // child node to append );
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.
SFXXMLElement::InsertBefore | SFXXMLNode::AppendChild | SFXXMLNode
[ 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 );
Specify the target node where to copy this node.
If true is set to this argument, copy the child nodes recursively.
Otherwise, copy only this node and its Attribute nodes.
[ public, virtual, const ] Bool EqualNode( SFXXMLNodeConstPtr arg // specified node );
[ public, const ] ACharConstPtr GetAttribute( SFXAnsiStringConstRef name // name of the attribute: QName can be specified if namespace is set );
Specify the name of the attribute. Capital letters and small letters are distinguished. QName can be specified if namespace is set.
Value of the attribute with the specified name.
This function gets the value of the attribute with the specified name.
null will be returned if this node has no attribute value.
Note | |
---|---|
QName can be specified in the name argument if namespace is set. |
Note | |
---|---|
When the attribute is specified with the local name and the namespace URI, the SFXXMLElement::GetAttributeNS function will be used. |
// get "xmlns:dt" attribute value
SFXAnsiString atti = boot->GetAttribute("xmlns:dt");
SFXXMLElement::GetAttributeNS | SFXXMLElement::GetAttributeNode | SFXXMLElement::GetAttributes | SFXXMLElement::SetAttribute | SFXXMLElement::SetAttributeNode | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public, const ] ACharConstPtr GetAttributeNS( SFXAnsiStringConstRef localname // local name of the attribute SFXAnsiStringConstRef namespaceURI // namespace URI of the attribute );
Specify the local name of the attribute(Capital letters and small letters are distinguished).
Specify the namespace URI of the attribute.
Value of the attribute with the specified local name and namespace URI.
This function gets the value of the attribute with the specified local name and namespace URI.
Note | |
---|---|
null will be returned if this node has no attribute value. |
Note | |
---|---|
When the attribute is specified with the QName, the SFXXMLElement::GetAttribute function will be used. |
SFXXMLElement::GetAttribute | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::GetAttributeNodeNS | SFXXMLElement::GetAttributes | SFXXMLElement::SetAttributeNS | SFXXMLElement::SetAttributeNodeNS | SFXXMLElement::HasAttributeNS | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttributeNS
[ public, const ] SFXXMLAttributePtr GetAttributeNode( SFXAnsiStringConstRef name // name of the attribute: QName can be specified if namespace is set );
Specify the name of the attribute. Capital letters and small letters are distinguished. QName can be specified if namespace is set.
Return the Attribute node with the specified name. Return null if no Attribute node with the specified name is found.
This function gets the Attribute node with the specified name.
Note | |
---|---|
QName can be specified in the name argument if namespace is set. |
Note | |
---|---|
When the attribute is specified with the local name and the namespace URI, the SFXXMLElement::GetAttributeNodeNS function will be used. |
// get "xmlns:dt" Attribute node
SFXXMLAttributePtr atti = boot->GetAttributeNode("xmlns:dt");
SFXXMLElement::GetAttributeNodeNS | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributes | SFXXMLElement::SetAttribute | SFXXMLElement::SetAttributeNode | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public, const ] SFXXMLAttributePtr GetAttributeNodeNS( SFXAnsiStringConstRef localname // local name of the attribute SFXAnsiStringConstRef namespaceURI // namespace URI of the attribute );
Specify the local name of the attribute(Capital letters and small letters are distinguished).
Specify the namespace URI of the attribute.
Return the Attribute node with the specified local name and namespace URI. Return null if no Attribute node with the specified local name and namespace URI is found.
This function gets the Attribute node with the specified name(QName).
Note | |
---|---|
When the attribute is specified with the name, the SFXXMLElement::GetAttributeNode function will be used. |
SFXXMLElement::GetAttributeNode | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::GetAttributeNS | SFXXMLElement::GetAttributes | SFXXMLElement::SetAttributeNS | SFXXMLElement::SetAttributeNodeNS | SFXXMLElement::HasAttributeNS | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttributeNS
[ public, const ] DOMNamedNodeMapPtr GetAttributes(Void);
Return the pointer to the Attribute nodes of the SFXXMLNode::DOMNamedNodeMap if any. Return null if not.
// check whether this Element node has any Attribute nodes or not if (SFXXMLElementPtr(child)->HasAttributes()) { // get all the Attribute nodes of this Element node SFXXMLNode::DOMNamedNodeMapPtr attr = SFXXMLElementPtr(child)->GetAttributes(); if (attr) { for (int i = 0; i < attr->GetLength(); i++) { SFXXMLNodePtr item = attr->Item(i); if (item) { if(item->GetNodeType() == SFXXMLNode::ATTRIBUTE_NODE); ... } } } }
SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::GetAttribute | SFXXMLElement::SetAttribute | SFXXMLElement::SetAttributeNode | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::GetAttributeNode | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public, virtual, const ] DOMNodeListPtr GetChildNodes(Void);
Return the pointer to the SFXXMLNode::DOMNodeList instance that contains all child nodes of this node.
Note | |
---|---|
Each element of SFXXMLNode::DOMNodeList is of the "pointer to the SFXXMLNode" type. |
//get element node by tag name SFXXMLNode::DOMNodeListPtr list = root->GetElementsByTagName("BOOK"); if (list) { // get the enumerator SFXXMLNode::DOMNodeList::Enumerator enumer = list->GetFirstEnumerator(); while (enumer.HasNext()) { // get each element node SFXXMLElementPtr elem = static_cast<SFXXMLElementPtr>(enumer.GetNext()); // get all child nodes of each element node SFXXMLNode::DOMNodeListPtr nodeList = elem->GetChildNodes(); // get enumrator of child nodes SFXXMLNode::DOMNodeList::Enumerator childiter = nodeList->GetFirstEnumerator(); while (childiter.HasNext()) { SFXXMLElementPtr child = static_cast<SFXXMLElementPtr>(childiter.GetNext()); TRACE("child name: %s", child->GetName()); // display name of each child node TRACE("child text: %s", child->GetText().GetCString()); // display child node string content } } }
SFXXMLNode::DOMNodeList | SFXXMLNode::GetChildNodes| SFXXMLNode
[ public, const ] DOMNodeListPtr GetElementsByTagName( SFXAnsiStringConstRef name // tag name: QName can be specified if namespace is set );
Specify the tag name. Capital letters and small letters are distinguished. QName can be specified if namespace is set.
All the Element nodes with the specified tag name are returned as the pointer to the SFXXMLNode::DOMNodeList instance.
This function gets all the Element nodes that match the specified tag name.
Note | |
---|---|
When namespace is set, QName(i.e., "namespace prefix:local name") can be specified as a tag name. |
Note | |
---|---|
When the local name and the namespace URI are specified, the SFXXMLElement::GetElementsByTagNameNS function will be used. |
SFXXMLElement::GetElementsByTagNameNS | SFXXMLNode::DOMNodeList | SFXXMLDocument::GetElementsByTagName
[ public, const ] DOMNodeListPtr GetElementsByTagNameNS( SFXAnsiStringConstRef localname // local name of the element SFXAnsiStringConstRef namespaceURI // namespace URI of the element );
Specify the local name of the element. Capital letters and small letters are distinguished.
Specify the namespace URI of the element.
Return all the Element nodes that match the specified local name and namespace URI as the pointer to the SFXXMLNode::DOMNodeList instance.
This function gets all the Element nodes that match the specified local name and namespace URI.
Note | |
---|---|
When the tag name is specified, the SFXXMLElement::GetElementsByTagName function will be used. |
SFXXMLElement::GetElementsByTagName | SFXXMLDocument::GetElementsByTagNameNS | SFXXMLNode::DOMNodeList
[ public, virtual, const ] SFXXMLNodePtr GetFirstChild(Void);
Return the first child node of this node. Return null if this node has no child.
[ public, virtual, const ] SFXXMLNodePtr GetLastChild(Void);
Return the last child node of this node. Return null if this node has no child.
[ public, const ] ACharConstPtr GetLocalName(Void);
Return the local name of this node.
When the name set to this node is qualified name, it is a pair of namespace prefix and local name.
Note | |
---|---|
The name of the Element node is the element name of the XML document. |
[ public, const ] ACharConstPtr GetName(Void);
Same as the SFXXMLElement::GetNodeName function.
Note | |
---|---|
The name of the Element node is the element name of the XML document. |
Note | |
---|---|
When the namespace is set, the qualified name(namespace prefix and local name) is returned. |
<?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output encoding="Shift_JIS" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="DTD/xhtml1-transitional.dtd"/> <xsl:template match="/"> <html> <head> <title>words</title> </head> <body bgcolor="#CCFFFF"> <center> <table border="0"> <xsl:apply-templates select=".//def"/> </table> </center> </body> </html> </xsl:template> <xsl:template match="def"> <tr><td><b><xsl:apply-templates/></b></td></tr> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> // get Element node SFXXMLElementPtr stylesheet = document.GetDocumentElement(); TRACE("Element's name = %s", stylesheet->GetName()); // name as qualified name = xsl:stylesheet TRACE("Element's localname = %s", stylesheet->GetLocalName()); // local name = stylesheet TRACE("Element's prefix = %s", stylesheet->GetPrefix()); // prefix = xsl TRACE("Element's uri = %s", stylesheet->GetNamespaceURI()); // namespace URI = http://www.w3.org/1999/XSL/Transform
SFXXMLElement::GetLocalName | SFXXMLElement::GetNodeName | SFXXMLElement::GetPrefix | SFXXMLElement::GetNamespaceURI
[ public, const ] ACharConstPtr GetNamespaceURI(Void);
Return the namespace URI of this node if set. Otherwise, return null.
[ public, virtual, const ] SFXXMLNodePtr GetNextSibling(Void);
Return the next sibling node of this node. If this node has no next sibling node, null is returned.
SFXXMLDOMParser parser; // parse XML document by DOM method // get root node of DOM tree SFXXMLDocumentPtr root = parser.GetDocument(); // get first child of root node SFXXMLNodePtr node = root->GetFirstChild(); SFXXMLElementPtr elem = static_cast<SFXXMLElementPtr>(node); // convert into Element pointer type SFXXMLNodePtr child = elem->GetFirstChild(); // get first child node SFXXMLNodePtr author = child->GetNextSibling(); // get next sibling node
SFXXMLElement::GetPreviousSibling | SFXXMLNode::GetNextSibling| SFXXMLNode::GetPreviousSibling | SFXXMLNode
[ public, virtual, const ] ACharConstPtr GetNodeName(Void);
Same as the SFXXMLElement::GetName function.
Note | |
---|---|
The name of the Element node is the element name of the XML document. |
Note | |
---|---|
When the namespace is set, the qualified name(namespace prefix and local name) is returned. |
SFXXMLElement::GetName | SFXXMLNode::GetNodeName | SFXXMLNode
[ public, virtual, const ] NodeType GetNodeType(Void);
Return ELEMENT_NODE.
[ public, virtual, const ] SFXXMLNodePtr GetParentNode(Void);
Return the parent node of this node. Return null if this node has no parent.
[ public, const ] ACharConstPtr GetPrefix(Void);
Return the prefix of this node if set. Otherwise return null.
[ public, virtual, const ] SFXXMLNodePtr GetPreviousSibling(Void);
Return the previous sibling node of this node. If this node has no previous sibling node, null is returned.
SFXXMLElement::GetNextSibling | SFXXMLNode::GetPreviousSibling | SFXXMLNode::GetNextSibling | SFXXMLNode
[ public, const ] Bool HasAttribute( SFXAnsiStringConstRef name // name of the attribute: QName can be specified if namespace is set );
Specify the name of the attribute. Capital letters and small letters are distinguished. QName can be specified if namespace is set.
This function checks whether or not the attribute with the specified name exists.
Note | |
---|---|
QName can be specified in the name argument if namespace is set. |
Note | |
---|---|
When the attribute is specified with the local name and the namespace URI, the SFXXMLElement::HasAttributeNS function will be used. |
// check whether the Attribute node with name of "isdn" exists or not
if(book->HasAttribute("isdn") == false){
.....
}
SFXXMLElement::HasAttributeNS | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::HasAttributes | SFXXMLElement::SetAttribute | SFXXMLElement::SetAttributeNode | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributeNode | SFXXMLElement::GetAttributes | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public, const ] Bool HasAttributeNS( SFXAnsiStringConstRef localname // local name of the attribute SFXAnsiStringConstRef namespaceURI // namespace URI of the attribute );
Specify the local name of the attribute(Capital letters and small letters are distinguished).
Specify the namespace URI of the attribute.
This function checks whether or not the attribute with the specified local name and namespace URI exists.
Note | |
---|---|
When the attribute is specified with the name, the SFXXMLElement::HasAttribute function will be used. |
SFXXMLElement::HasAttribute | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::HasAttributes | SFXXMLElement::SetAttributeNS | SFXXMLElement::SetAttributeNodeNS | SFXXMLElement::GetAttributeNS | SFXXMLElement::GetAttributeNodeNS | SFXXMLElement::GetAttributes | SFXXMLElement::RemoveAttributeNS
[ public, const ] Bool HasAttributes(Void);
// check whether any Attribute nodes exist or not
if(book->HasAttributes() == false){
.....
}
SFXXMLElement::HasAttribute | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributes | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public, virtual, const ] Bool HasChildNodes(Void);
[ public, virtual ] SFCError InsertBefore( SFXXMLNodeConstPtr newchild // node to insert SFXXMLNodeConstPtr refchild // newchild node is inserted before refchild node );
Insert the newchild node before the refchild node. If the refchild argument is specified as null, append the newchild node as the last child node.
When the newchild node is the DocumentFragment node, all the child nodes of the newchild node are inserted in the same order before the refchild node.
When the newchild node has already existed in the DOM tree, it is removed before insertion.
// create Element node SFXXMLElementPtr isbn = document.CreateElement("ISBN"); // add Text node to Element node isbn->AppendChild(SFXXMLNodePtr(document.CreateTextNode("4-7741-1616-5"))); // insert Element node book->InsertBefore(SFXXMLNodePtr(isbn), book->GetFirstChild());
[ public ] Void RemoveAttribute( SFXAnsiStringConstRef name // name(QName) of the attribute to remove );
Specify the name(QName) of the attribute.
This function removes the attribute with the specified name(QName).
If the attribute with the specified name(QName) does not exist, no attribute will be removed.
Note | |
---|---|
When the attribute is specified with the local name and the namespace URI, the SFXXMLElement::RemoveAttributeNS function will be used. |
// remove "dt:dt" Attribute node of "date" Element node
date->RemoveAttribute("dt:dt");
SFXXMLElement::RemoveAttributeNS | SFXXMLElement::RemoveAttributeNode | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributeNode | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::SetAttribute | SFXXMLElement::SetAttributeNode
[ public ] Void RemoveAttributeNS( SFXAnsiStringConstRef localname // local name of the attribute SFXAnsiStringConstRef namespaceURI // namespace URI of the attribute );
Specify the local name of the attribute(Capital letters and small letters are distinguished).
Specify the namespace URI of the attribute.
This function removes the attribute with the specified local name and namespace URI.
If the attribute with the specified local name and namespace URI does not exist, no attribute will be removed.
Note | |
---|---|
When the attribute is specified with the QName, the SFXXMLElement::RemoveAttribute function will be used. |
SFXXMLElement::RemoveAttribute | SFXXMLElement::GetAttributeNS | SFXXMLElement::GetAttributeNodeNS | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttributeNS | SFXXMLElement::HasAttributes | SFXXMLElement::SetAttributeNS | SFXXMLElement::SetAttributeNodeNS | SFXXMLElement::RemoveAttributeNode
[ public ] SFXXMLAttributePtr RemoveAttributeNode( SFXXMLAttributePtr oldAttr // Attribute node to remove );
Return the removed Attribute node (SFXXMLAttribute).
This function removes the specified Attribute node from this node.
Concretely, the specified Attribute node will be removed from the SFXXMLNode::DOMNamedNodeMap object which contains the attribute information on this Element node.
The return value of this function is the removed Attribute node.
// get "dt:dt" Attrubite node SFXXMLAttributePtr atti = book->GetAttributeNode("dt:dt"); // remove this Attribite node from DOMNamedNodeMap book->RemoveAttributeNode(atti); // delete this node delete atti;
SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributeNode | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::SetAttribute | SFXXMLElement::SetAttributeNode | SFXXMLElement::RemoveAttribute | SFXXMLAttribute
[ public, virtual ] SFCError RemoveChild( SFXXMLNodeConstPtr oldchild // child node to remove );
[ public, virtual ] SFCError ReplaceChild( SFXXMLNodeConstPtr newchild // new child node to replace with SFXXMLNodeConstPtr oldchild // old child node to be replaced );
// create the name node SFXXMLElementPtr name = document.CreateElement("NAME"); // set a text to the name node name->AppendChild(SFXXMLNodePtr(document.CreateTextNode("Cosmos"))); // replace the first child of book node with the name node book->ReplaceChild(name, book->GetFirstChild());
SFXXMLElement::InsertBefore | SFXXMLElement::RemoveChild | SFXXMLNode::ReplaceChild| SFXXMLNode
[ public ] Void SetAttribute( SFXAnsiStringConstRef name // name of the attribute to set: QName can be specified if namespace is set ACharConstPtr value // value of the attribute to set );
Specify the name of the attribute. Capital letters and small letters are distinguished. QName can be specified if namespace is set.
Specify the value of the attribute.
If the attribute with the specified name already exists, new value will be set to this attribute.
Note | |
---|---|
QName can be specified in the name argument if namespace is set. |
Note | |
---|---|
When the attribute is specified with the local name and the namespace URI, the SFXXMLElement::SetAttributeNS function will be used. |
SFXXMLElement::SetAttributeNS | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::SetAttributeNode | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributeNode | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public ] Void SetAttributeNS( SFXAnsiStringConstRef localname // local name of the attribute SFXAnsiStringConstRef namespaceURI // namespace URI of the attribute ACharConstPtr value // value of the attribute to set );
Specify the local name of the attribute(Capital letters and small letters are distinguished).
Specify the namespace URI of the attribute.
Specify the value of the attribute.
If the attribute with the specified local name and namespace URI already exists, new value will be set to this attribute.
Note | |
---|---|
When the attribute is specified with the name, the SFXXMLElement::SetAttribute function will be used. |
SFXXMLElement::SetAttribute | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::SetAttributeNodeNS | SFXXMLElement::GetAttributeNS | SFXXMLElement::GetAttributeNodeNS | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttributeNS | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttributeNS
[ public ] SFCError SetAttributeNode( SFXXMLAttributePtr newAttr // Attribute node to set );
This function set the specified Attribute node to the SFXXMLNode::DOMNamedNodeMap object which this node contains internally.
When the Attribute node with the same name already exists in the SFXXMLNode::DOMNamedNodeMap object, the existing Attribute node will be removed and replaced with the specified Attribute node.
Note | |
---|---|
When the specified Attribute node is searched from the SFXXMLNode::DOMNamedNodeMap object with the local name and the namespace URI, the SFXXMLElement::SetAttributeNodeNS function will be used. |
// create isdn attribute (attribute value is set, too) SFXXMLAttributePtr atti = document.CreateAttribute("isdn","4-7741-1616-5"); // add attribute to BOOK element book->SetAttributeNode(atti);
SFXXMLElement::SetAttributeNodeNS | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::SetAttribute | SFXXMLElement::GetAttribute | SFXXMLElement::GetAttributeNode | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttribute | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttribute | SFXXMLElement::RemoveAttributeNode
[ public ] SFCError SetAttributeNodeNS( SFXXMLAttributePtr newAttr // Attribute node to set );
This function set the specified Attribute node to the SFXXMLNode::DOMNamedNodeMap object which this node contains internally.
When the Attribute node with the same local name and namespace URI already exists in the SFXXMLNode::DOMNamedNodeMap object, the existing Attribute node will be removed and replaced with the specified Attribute node.
Note | |
---|---|
When the specified Attribute node is searched from the SFXXMLNode::DOMNamedNodeMap object with the name, the SFXXMLElement::SetAttributeNode function will be used. |
SFXXMLElement::SetAttributeNode | SFXXMLNode::DOMNamedNodeMap | SFXXMLElement::SetAttributeNS | SFXXMLElement::GetAttributeNS | SFXXMLElement::GetAttributeNodeNS | SFXXMLElement::GetAttributes | SFXXMLElement::HasAttributeNS | SFXXMLElement::HasAttributes | SFXXMLElement::RemoveAttributeNS
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |