XML Common Operation C++

initialization

Load imports an XML file into a CMarkup object and parses it. Similar to C#'s Load.
SetDoc imports XML data from a string and parses it. Similar to C#'s LoadXml.

output

Save writes XML data to a file. Similar to C#'s Save.
GetDoc returns the entire XML data document as a string.

change current location

FindElem locates the next element, which may match a tag name or path.
FindChildElem locates the next child element, matching element name or path.
FindPrevElem Locates the previous element, possibly matching a tag name or path.
FindPrevChildElem Locates the previous child element, possibly matching a tag name.
FindNode Locates the next node, possibly matching the node type.
IntoElem Goes one level below the current primary location, and the current location becomes the parent location.
OutOfElem makes the current parent position the current position.
ResetPos resets the current position to the beginning of the document.
ResetMainPos resets the current main position to the position before the first sibling.
ResetChildPos resets the current child position to before the first child position.

Documentation added

AddElem Adds an element after the current primary position element or the last sibling position.
InsertElem Inserts an element before the current primary position element or the first sibling position.
AddChildElem Adds an element after the current child position element or the last child position.
InsertChileElem Inserts an element at the current child position element or one child position lower.
AddSubDoc Adds a subdocument after the current main position element or the last sibling position.
InsertSubDoc Inserts a subdocument before the current main position element or the first sibling position.
AddChildSubDoc Adds a subdocument after the current child position element or the last child position.
InsertChildSubDoc Inserts a subdocument before the current child position element or the first child position.
AddNode Adds a node after the current node or at the end of the content of the parent element.
InsertNode Inserts a node before the current node or at the beginning of the content of the parent element.

document delete

RemoveElem Delete the current main position element including child elements
RemoveChildElem Delete including the current child element and its child elements
RemoveNode Delete the current node
RemoveAttrib Delete the specific attribute of the current position element
RemoveChildAttrib Delete a specific attribute of the current child position element

get value

GetData Get the string value of the current main position element or node
GetChildData Get the string value of the current child position element
GetElemContent Get the current main position element including its sub-element tag content string value
GetSubDoc Get the current main position element including its sub-element's document Fragment tag string value GetChildSubDoc Get the document of the current child location
element including its
sub-elements
String value
GetTagName Get the tag name of the main location element (or the ongoing instruction)
GetChildTagName Get the tag name of the child location element
FindGetData Locate the next element matching a specific path and return the string value

Settings

SetData Set the value of the current main location element or node
SetChildData Set the value of the current child location element
SetElemContent Set the tag content of the current main location element
SetAttrib Set the value of a specific attribute of the current main location element (or the ongoing instruction)
SetChildAttrib Set the current The value of a specific attribute of a sub-location element
FindSetData locates the next element matching a specific path and sets its value

get additional information

GetAttribName Get the attribute name by the specific index of the element attribute at the current position
GetNodeType Get the node type of the current node
GetElemLevel Get the level of the
current main position GetElemFlags Get the flag of the element at the current main position
SetElemFlags Set the flag of the element at the current main position
GetOffsets Get at the current main position Offset doctext
GetAttribOffsets Get cheap doctext for a specific attribute at the current master position

save location

SavePos saves the current position in the hash map with an optional string name
RestorePos navigates to the position saved by SavePos
SetMapSize Sets the size of the hash map used by SavePos and RestorePos
GetElemIndex Gets the integer index value of the current main position element GotoElemIndex
Sets the current main position element to a given value Get the integer index value of the
element at the current child position GetChildElemIndex Get the integer index value of the element at the current child
position GotoChildElemIndex Set the element at the current child position to the given integer index value GetParentElemIndex Get the integer index value of the element at the current parent position
GotoParentElemIndex
Set the element at the current parent position to the given integer index value
GetElemPath Gets the string representing the absolute path of the primary location element
GetChildElemPath Gets the string representing the absolute path of the child location element
GetParentElemPath Gets the string representing the absolute path of the parent location element

document status

IsWellFormed Determines if the document has a single root element and contains elements properly
GetError Returns the error (information) string from the final parse
GetDocFlags Returns the document flags
SetDocFlags Sets the document flags
GetDocElemCount Returns the number of elements in the document

static utility functions

ReadTextFile Read a text file and convert it to a string
WirteTextFile Write a string to a text file
GetDeclareEncoding Get the name of the encoding from the XML declaration
EscapeText Return the encoding of a character in the markup
UnescapeText Return a string worth a specific character Decode
UTF8ToA Convert UTF-8 Convert characters to non-Unicode (such as ANSI) characters
AToUTF8 Convert non-Unicode (such as ANSI) characters to UTF-8 characters
UTF16T08 Convert UTF-16 characters to UTF-8
UTF8To16 Convert UTF-8 characters to UTF-16
EncodeBase64 Convert binary Translate data into Base64 string
DecodeBase64 Translate Base64 characters into binary data

Guess you like

Origin blog.csdn.net/m0_73344394/article/details/130275481