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

Inheritance diagram

 Inheritance diagram of SFXXMLTextClass

Collaboration diagram

 Collaboration diagram of SFXXMLTextClass

Description

A Text node(SFXXMLText) contains a textual content of an Element node(SFXXMLElement) or an Attribute node (SFXXMLAttribute).

Reference

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

Member

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 )

SFXXMLText::SFXXMLText
Constructor of the SFXXMLText class.
[ 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
);

SFXXMLText::~SFXXMLText
Desctructor of SFXXMLText class.
[ public, virtual ]
virtual ~SFXXMLText(Void);

SFXXMLText::AppendData
Append a new string at the end of the string of this node.
[ public ]
Void AppendData(
    ACharConstPtr data   // new string to append
);

Reference

SFXXMLText::InsertData | SFXXMLText::DeleteData | SFXXMLText::ReplaceData | SFXXMLNode


SFXXMLText::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[Invalid]
);

Argument

clonenode

Specify the target node where to copy this node.

deep

This argument is invalid.

Return value

  • If succeeds: SFERR_NO_ERROR
  • If failed: SFERR_FAILED

Reference

SFXXMLNode::CloneNode | SFXXMLNode


SFXXMLText::DeleteData
Remove specified range of characters from the string of text node.
[ public ]
Void DeleteData(
    SInt32 offset   // start delete position
    SInt32 count    // end delete position
);

Reference

SFXXMLText::InsertData | SFXXMLText::AppendData | SFXXMLText::ReplaceData


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

Description

Same as the SFXXMLText::GetNodeValue function.

[Note] Note
The value of the Text node is the textual content.

Example

<?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");

Reference

SFXXMLText::GetNodeValue | SFXXMLText::SetNodeValue | SFXXMLText::SetData | SFXXMLText::GetNodeValue


SFXXMLText::GetLength
Get the length of text.
[ public, const ]
SInt32 GetLength(Void);

SFXXMLText::GetNextSibling
Get the next sibling node.
[ public, virtual, const ]
SFXXMLNodePtr GetNextSibling(Void);

Return value

Return the next sibling node of this node. If this node has no next sibling node, null is returned.

Reference

SFXXMLText::GetPreviousSibling | SFXXMLNode::GetNextSibling| SFXXMLNode::GetPreviousSibling | SFXXMLNode


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

Return value

Return the "#text" string.

Reference

SFXXMLNode::GetNodeName | SFXXMLNode


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

Return value

Return TEXT_NODE.

Reference

SFXXMLNode::NodeType | SFXXMLNode::GetNodeType | SFXXMLNode


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

Description

Same as the SFXXMLText::GetData function.

[Note] Note
The value of the Text node is the textual content.

Reference

SFXXMLText::GetData | SFXXMLText::SetNodeValue | SFXXMLText::SetData | SFXXMLNode::GetNodeValue | SFXXMLNode


SFXXMLText::GetParentNode
Get the parent node.
[ public, virtual, const ]
SFXXMLNodePtr GetParentNode(Void);

Return value

Return the parent node of this node. Return null if this node has no parent.

Reference

SFXXMLNode::GetParentNode | SFXXMLNode


SFXXMLText::GetPreviousSibling
Get the previous sibling node.
[ public, virtual, const ]
SFXXMLNodePtr GetPreviousSibling(Void);

Return value

Return the previous sibling node of this node. If this node has no previous sibling node, null is returned.

Reference

SFXXMLProcessingInstruction::GetNextSibling | SFXXMLNode::GetPreviousSibling | SFXXMLNode::GetNextSibling | SFXXMLNode


SFXXMLText::InsertData
Inserts the string in the textual content of the Text node.
[ public ]
Void InsertData(
    SInt32 offset        // start position 
    ACharConstPtr data   // string to insert
);

Reference

SFXXMLText::DeleteData | SFXXMLText::AppendData | SFXXMLText::ReplaceData


SFXXMLText::ReplaceData
Replace the text.
[ 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
);

Description

If the sum of "offset" and "count" arguments exceeds the end of text to be replaced, all text until the end will be replaced.

Reference

SFXXMLText::DeleteData | SFXXMLText::AppendData | SFXXMLText::InsertData


SFXXMLText::SetData
Set the node value.
[ public ]
Void SetData(
    ACharConstPtr data   // text
);

Description

Same as the SFXXMLText::SetNodeValue function.

[Note] Note
The value of the Text node is the textual content.

Reference

SFXXMLText::SetNodeValue | SFXXMLText::GetNodeValue | SFXXMLText::GetData


SFXXMLText::SetNodeValue
Set the node value.
[ public, virtual ]
Void SetNodeValue(
    ACharConstPtr value   // text
);

Description

Same as the SFXXMLText::SetData function.

[Note] Note
The value of the Text node is the textual content.

Reference

SFXXMLText::SetData | SFXXMLText::GetNodeValue | SFXXMLText::GetData | SFXXMLNode::SetNodeValue | SFXXMLNode


SFXXMLText::SplitText
Divide a text node into 2 text nodes.
[ public ]
SFXXMLTextPtr SplitText(
    SInt32 offset   // position where the divide occur
);

Description

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.


SFXXMLText::SubstringData
Extract the substring of the text.
[ public, const ]
SFXAnsiString SubstringData(
    SInt32 offset   // start position to extract
    SInt32 count    // size of data to extract
);

return value

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.

Reference

SFXXMLText::DeleteData | SFXXMLText::AppendData | SFXXMLText::ReplaceData | SFXXMLText::InsertData