CMarkup Interface Description

Source: Internet
Author: User
Tags xml parser

CMarkup is a small XML parser, the implementation language is C + +, the English version of the interface description address is: http://www.firstobject.com/dn_markupmethods.htm

There are powerful users have translated the interface of the Chinese description as follows:

1. Initialization
Load imports an XML file into the CMarkup object and parses it. Load similar to C #.
Setdoc imports XML data from a string and parses it. Similar to C # Loadxml.

2. Output
Save writes the XML data to the file. Like save in C #.
Getdoc returns the entire XML data document as a string.

3. Change the current position
Findelem navigates to the next element, possibly matching a tag name or path.
Findchildelem navigates to the next child element, matching the element name or path.
Findprevelem locates the previous element and may match a tag name or path.
Findprevchildelem locates the previous child element, possibly matching the label name.
FindNode locates the next node and may match the node type.
Intoelem enters the next level of the current primary position, and the current position becomes the parent position.
Outofelem causes the current parent position to become the current position.
Resetpos resets the current position to the starting position of the document.
Resetmainpos resets the current primary position to the first sibling position.
Resetchildpos resets the current child position before the first child position.
4. New Document
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 child position.
Insertchileelem inserts an element before the current sub-position element or one of the lower sub-positions.
Addsubdoc adds a subdocument after the current primary position element or the last sibling position.
Insertsubdoc inserts a subdocument before the current primary position element or the first sibling position.
Addchildsubdoc adds a subdocument after the current sub-position element or the last child position.
Insertchildsubdoc inserts a subdocument before the current sub-position element or the first child position.
AddNode adds a node after the current node or at the end of the parent element's content.
Insertnode inserts a node before the current node or at the beginning of the parent element's content.
5. Delete the document
Removeelem Delete the primary position element that currently includes child elements
Removechildelem Delete includes the current child element and its child elements
RemoveNode Delete the current node
Removeattrib Delete the current location element specific properties
Removechildattrib delete a specific property of the current sub-location element
6. Get the value
GetData gets the string value of the current primary position element or node
Getchilddata gets the string value of the current sub-position element
Getelemcontent Gets the tag content string value of the current primary position element including its child elements
Getsubdoc gets the document fragment tag string value of the current primary position element including its child elements
Getchildsubdoc gets the document fragment tag string value of the current sub-position element including its child elements
Getattrib get a specific property string value for the primary position element (or in-progress instruction)
Getchildattrib get a string value for a specific property of a child location
Gettagname gets the label name of the primary position element (or the in-progress instruction)
Getchildtagname gets the label name of the child position element
Findgetdata navigates to the next element that matches a specific path and returns a string value
7. Set the value
SetData setting the value of the current primary location element or node
Setchilddata setting the value of the current sub-position element
Setelemcontent to set the markup content of the current primary location element
Setattrib sets the value of a specific property for the current primary location element (or an in-progress instruction)
Setchildattrib sets the value of a specific property for the current sub-location element
Findsetdata locates the next element that matches a specific path and sets its value
8. Get additional information
Getattribname the property name when a specific index of the current position element attribute is obtained
Getnodetype Gets the node type of the current node
Getelemlevel get the progression of the current master position
Getelemflags gets the flag of the current primary position element
Setelemflags setting flags for the current primary position element
Getoffsets gets the document text offset at the current primary position
Getattriboffsets Get document text that is inexpensive for a specific property in the current primary location
9. Save location information
Savepos Save the current position in a hash map using an optional string name
Restorepos positioning to a location saved through Savepos
Setmapsize Setting the hash map size used by Savepos and Restorepos
Getelemindex get the current primary position element shaping index value
Gotoelemindex sets the current primary position element to the given shaping index value
Getchildelemindex Gets the shaping index value of the current sub-position element
Gotochildelemindex sets the current sub-position element to the given shaping index value
Getparentelemindex Gets the shaping index value of the current parent position element
Gotoparentelemindex sets the current parent position element to the given shaping index value
Getelempath gets the string representing the absolute path of the primary position element
Getchildelempath Gets the string that represents the absolute path of the child location element
Getparentelempath Gets the string that represents the absolute path of the parent position element
10. Document Status
Iswellformed to determine if a document has a single root element and properly contains elements
GetError returns the error (information) string from the final parse
Getdocflags Return Document Flags
Setdocflags Setting Document Flags
Getdocelemcount returns the number of elements in a document
11. Static and Practical functions
ReadTextFile read a text file into a string
Wirtetextfile writing strings to a text file
Getdeclareencoding get the encoded name from the XML declaration
Escapetext returns the encoding of a character in a tag
Unescapetext returns a string that is worth decoding for a particular character
Utf8toa convert UTF-8 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 translating binary data into Base64 strings
DecodeBase64 translating Base64 characters into binary data

CMarkup Interface Description

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.