SophiaFramework UNIVERSE 5.3 |
A Text node(SFXXMLText) contains a textual content of an Element node(SFXXMLElement) or an Attribute node (SFXXMLAttribute).
SFXXMLNode | SFXXMLAttribute | SFXXMLCDATASection | SFXXMLComment | SFXXMLDocument | SFXXMLDocumentFragment | SFXXMLDocumentType | SFXXMLElement | SFXXMLEntity | SFXXMLEntityReference | SFXXMLNotation | SFXXMLProcessingInstruction
Constructor/Destructor |
---|
SFXXMLText(
SFXXMLDocumentPtr owner
, SFXAnsiStringConstRef name
) Constructor of the SFXXMLText class.
|
SFXXMLText(
SFXXMLTextConstRef other
) Constructor of the SFXXMLText class.
|
~SFXXMLText( Void ) Desctructor of SFXXMLText class.
|
Public Functions | |
---|---|
Void |
AppendData(
ACharConstPtr data
) Append a new string at the end of the string of this node.
|
SFCError |
CloneNode(
SFXXMLNodeHandle clonenode
, Bool deep
) Create a copy of this node.
|
Void |
DeleteData(
SInt32 offset
, SInt32 count
) Remove specified range of characters from the string of text node.
|
ACharConstPtr |
GetData( Void ) Get the node value.
|
SInt32 |
GetLength( Void ) Get the length of text.
|
SFXXMLNodePtr |
GetNextSibling( Void ) Get the next sibling node.
|
ACharConstPtr |
GetNodeName( Void ) Get the node name.
|
NodeType |
GetNodeType( Void ) Get the node type.
|
ACharConstPtr |
GetNodeValue( Void ) Get the node value.
|
SFXXMLNodePtr |
GetParentNode( Void ) Get the parent node.
|
SFXXMLNodePtr |
GetPreviousSibling( Void ) Get the previous sibling node.
|
Void |
InsertData(
SInt32 offset
, ACharConstPtr data
) Inserts the string in the textual content of the Text node.
|
Void |
ReplaceData(
SInt32 offset
, SInt32 count
, ACharConstPtr data
) Replace the text.
|
Void |
SetData(
ACharConstPtr data
) Set the node value.
|
Void |
SetNodeValue(
ACharConstPtr value
) Set the node value.
|
SFXXMLTextPtr |
SplitText(
SInt32 offset
) Divide a text node into 2 text nodes.
|
SFXAnsiString |
SubstringData(
SInt32 offset
, SInt32 count
) Extract the substring of the text.
|
SFCError |
AppendChild(
SFXXMLNodeConstPtr newchild
)
(inherits from SFXXMLNode)
Append the specified child node at the end.
|
Bool |
EqualNode(
SFXXMLNodeConstPtr arg
)
(inherits from SFXXMLNode)
Check whether this node equals the specified node or not.
|
DOMNodeListPtr |
GetChildNodes( Void )
(inherits from SFXXMLNode)
Get all the child nodes.
|
SFXXMLNodePtr |
GetFirstChild( Void )
(inherits from SFXXMLNode)
Get the first child node.
|
SFXXMLNodePtr |
GetLastChild( Void )
(inherits from SFXXMLNode)
Get the last child node.
|
SFXAnsiString |
GetText( Void )
(inherits from SFXXMLNode)
Get the node text.
|
Bool |
HasChildNodes( Void )
(inherits from SFXXMLNode)
Check whether this node has any child nodes or not.
|
SFCError |
InsertBefore(
SFXXMLNodeConstPtr newchild
, SFXXMLNodeConstPtr refchild
)
(inherits from SFXXMLNode)
Insert the specified node.
|
Bool |
IsSameNode(
SFXXMLNodeConstPtr other
)
(inherits from SFXXMLNode)
Check whether this node is the same as the specified one or not.
|
SFCError |
RemoveChild(
SFXXMLNodeConstPtr oldchild
)
(inherits from SFXXMLNode)
Remove the specified child node including its descendant nodes.
|
SFCError |
ReplaceChild(
SFXXMLNodeConstPtr newchild
, SFXXMLNodeConstPtr oldchild
)
(inherits from SFXXMLNode)
Replace the specified child node.
|
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 ] SFXXMLText( SFXXMLDocumentPtr owner // root node of the DOM tree SFXAnsiStringConstRef name // name of the Text node );
[ public, explicit ] SFXXMLText( SFXXMLTextConstRef other // Text node );
[ public, virtual ] virtual ~SFXXMLText(Void);
[ public ] Void AppendData( ACharConstPtr data // new string to append );
[ 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[Invalid] );
Specify the target node where to copy this node.
This argument is invalid.
[ public ] Void DeleteData( SInt32 offset // start delete position SInt32 count // end delete position );
[ public, const ] ACharConstPtr GetData(Void);
Same as the SFXXMLText::GetNodeValue function.
Note | |
---|---|
The value of the Text node is the textual content. |
<?xml version="1.0" encoding="Shift_JIS" ?> <root> <title>Add, insert, replace, and delete strings</title> <data>This is testXXX</data> </root> // get Text node SFXXMLTextPtr text = SFXXMLTextPtr(data->GetFirstChild()); // get node value TRACE(text->GetData()); // "this is testXXX" // get length of string TRACE("number of characters: %d", text->GetLength()); // add string text->AppendData("(06/02/22)"); // "this is textXXX(06/02/22)" // insert string text->InsertData(12, "of the text edit"); // "this is test of the text editXXX(06/02/22)" // substitute "test" with "experiment" text->ReplaceData(8, 10, "experiment"); // "this is experiment of the text editXXX(06/02/22)" // delete last part of string text->DeleteData(35,13); // "this is experiment of the text edit" // get substring SFXAnsiString str = text->SubstringData(26, 5); // get "text " // split Text node at 8th character SFXXMLTextPtr splittext = text->SplitText(8); // "experiment of the text edit" SFXAnsiString(splittext->GetData()).Equals("experiment of the text edit");
SFXXMLText::GetNodeValue | SFXXMLText::SetNodeValue | SFXXMLText::SetData | SFXXMLText::GetNodeValue
[ public, const ] SInt32 GetLength(Void);
[ 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.
SFXXMLText::GetPreviousSibling | SFXXMLNode::GetNextSibling| SFXXMLNode::GetPreviousSibling | SFXXMLNode
[ public, virtual, const ] ACharConstPtr GetNodeName(Void);
Return the "#text" string.
[ public, virtual, const ] NodeType GetNodeType(Void);
Return TEXT_NODE.
[ public, virtual, const ] ACharConstPtr GetNodeValue(Void);
Same as the SFXXMLText::GetData function.
Note | |
---|---|
The value of the Text node is the textual content. |
SFXXMLText::GetData | SFXXMLText::SetNodeValue | SFXXMLText::SetData | SFXXMLNode::GetNodeValue | SFXXMLNode
[ public, virtual, const ] SFXXMLNodePtr GetParentNode(Void);
Return the parent node of this node. Return null if this node has no parent.
[ 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.
SFXXMLProcessingInstruction::GetNextSibling | SFXXMLNode::GetPreviousSibling | SFXXMLNode::GetNextSibling | SFXXMLNode
[ public ] Void InsertData( SInt32 offset // start position ACharConstPtr data // string to insert );
[ public ] Void ReplaceData( SInt32 offset // start position of text to be replaced SInt32 count // size of data to be replaced ACharConstPtr data // new text to replace with );
If the sum of "offset" and "count" arguments exceeds the end of text to be replaced, all text until the end will be replaced.
[ public ] Void SetData( ACharConstPtr data // text );
Same as the SFXXMLText::SetNodeValue function.
Note | |
---|---|
The value of the Text node is the textual content. |
[ public, virtual ] Void SetNodeValue( ACharConstPtr value // text );
Same as the SFXXMLText::SetData function.
Note | |
---|---|
The value of the Text node is the textual content. |
SFXXMLText::SetData | SFXXMLText::GetNodeValue | SFXXMLText::GetData | SFXXMLNode::SetNodeValue | SFXXMLNode
[ public ] SFXXMLTextPtr SplitText( SInt32 offset // position where the divide occur );
Divide a text node into 2 text nodes at the specified position.
Both new text nodes belong to the original text node's parent.
If offset is the length of the original text node, the new node has no data.
If offset is 0, an empty text node is created.
If offset is larger than the length of the original text node, return null.
[ public, const ] SFXAnsiString SubstringData( SInt32 offset // start position to extract SInt32 count // size of data to extract );
Return the substring of the text. If the sum of "offset" and "count" arguments exceeds the end of text to be replaced, all text until the end will be returned.
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |