Common functions of cmarkup, an XML analysis tool under C ++
Source: Internet
Author: User
1. Initialization
Load to import an XML file to the cmarkup object and parse it. Load similar to C.
Setdoc imports XML data from the string and parses it. Similar to loadxml of C. 2. Output
Save writes XML data to a file. Similar to C # Save.
Getdoc returns the entire XML data document as a string. 3. Change the current location
Findelem locates the next element and may match a tag name or path.
Findchildelem locates the next child element and matches the element name or path.
Findprevelem locates the previous element and may match a tag name or path.
Findprevchildelem locates the previous child element and may match the tag name.
Findnode locates the next node, which may match the node type.
Intoelem enters the next level of the current master location, and the current location changes to the parent location.
Outofelem changes the current parent location to the current location.
Resetpos resets the current position as the starting position of the document.
Resetmainpos resets the current primary position to the first sibling position.
Resetchildpos resets the current sub-position to the first sub-position. 4. New documents
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 sub-position element or the last sub-position.
Insertchileelem inserts an element before the current sub-position element or the lower sub-position.
Addsubdoc adds a sub-document after the current primary position element or the last sibling position.
Insertsubdoc inserts a sub-document before the current main position element or the first sibling position.
Addchildsubdoc adds a sub-document after the current sub-position element or the last sub-position.
Insertchildsubdoc inserts a sub-document before the current sub-position element or the first sub-position.
Addnode adds a node after the current node or the end of the parent element.
Insertnode inserts a node before the current node or before the content of the parent element. 5. delete a file
Removeelem deletes the primary location element that currently contains child elements
Removechildelem deletes the child element including the current child element and its child element.
Removenode deletes the current node
Removeattrib deletes the specific attributes of the current position element.
Removechildattrib deletes a specific attribute of the current sub-position element. 6. Obtain the value.
Getdata obtains the string value of the element or node of the current main position.
Getchilddata obtains the string value of the current Child position element.
Getelemcontent: obtains the string value of the TAG content containing its child elements in the current primary position.
Getsubdoc: Get the document segment tag string value of the current main position element including its child elements
Getchildsubdoc: Get the document segment tag string value of the child element including its child element.
Getattrib obtains a specific attribute string value of the main position element (or in progress ).
Getchildattrib obtains the string value of a specific attribute in the sub-position.
Gettagname: Get the Tag Name of the main position element (or in progress)
Getchildtagname: obtains the Tag Name of the Child position element.
Findgetdata locates the next element that matches a specific path and returns the string value. 7. Set the value.
Setdata sets the value of the element or node at the current primary position
Setchilddata sets the value of the current Child position Element
Setelemcontent
Setattrib sets the value of a specific attribute of the current primary position element (or in progress)
Setchildattrib sets the value of a specific attribute of the current sub-position element.
Findsetdata locates the next element that matches a specific path, sets its value 8, and obtains other information.
Getattribname is an index of the element attribute at the current position to obtain the attribute name.
Getnodetype: Get the node type of the current node.
Getelemlevel: obtains the level of the current main position.
Getelemflags: Get the identifier of the element at the current primary position.
Setelemflags
Getoffsets obtains the document text at the current master offset.
Getattriboffsets get the document text that is cheap for specific attributes in the current master location 9. Save the location information
Savepos saves the current location using optional string names in hash Map
Restorepos: Location saved through savepos
Setmapsize: Set the hash map size used by savepos and restorepos.
Get the element integer index value of the current primary position using getelemindex.
Gotoelemindex sets the current primary position element to the given integer index value
Getchildelemindex obtains the integer index value of the element at the current sub-position.
Gotochildelemindex sets the current sub-location element to the given integer index value
Getparentelemindex obtains the integer index value of the element at the current parent position.
Gotoparentelemindex: set the current parent location element to the given integer index value
Getelempath: obtains the string that represents the absolute path of the element at the main position.
Getchildelempath: gets the string that represents the absolute path of the Child position element.
Getparentelempath: String 10 that indicates the absolute path of the parent element, Document Status
Iswellformed determines whether a document has a single root element and appropriately contains the element
Geterror returns an error (information) string from the final Parsing
Getdocflags
Setdocflags
Getdocelemcount returns the number of elements in the Document. 11. Static practical functions
Readtextfile reads a text file and converts it to a string.
Wirtetextfile: Write a string to a text file.
Getdeclareencoding: Get the encoded name from the XML declaration.
Escapetext returns the encoding of a certain character in the tag
Unescapetext returns a string that is worth decoding a specific character.
Utf8toa converts UTF-8 characters to non-Unicode (such as ANSI) characters
Atoutf8 converts a non-Unicode (such as ANSI) character to a UTF-8 character
Utf16t08 convert UTF-16 characters into UTF-8
Utf8to16 convert UTF-8 characters into UTF-16
Encodebase64 translate binary data into base64 strings
Decodebase64 translate base64 characters into binary data
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service