CMarkup类简介

CMarkup类简介

Initialization

Load: Populates the CMarkup objectfrom a file and parses it.

SetDoc: Populates the CMarkup objectfrom a string and parses it.

Output

Save: Writes the document to file.

GetDoc: Returns the whole documentas a markup string.

GetDocFormatted: Returns the formatted markupstring of the whole document.

File mode

Open: Opens file, initiating filemode for read or write (and append is a special case of write mode).

Close: Closes file and ends filemode.

Flush: For file write mode, thisflushes any partial document in memory (up to the closing tags) and the file streamitself.

Changing the current position

FindElem: Locates next element, optionallymatching tag name or path.

FindChildElem: Locates next child elementmatching tag name or path.

FindPrevElem: Locates previous element,optionally matching tag name.

FindPrevChildElem: Locates previous child element,optionally matching tag name.

FindNode: Locates next node, optionallymatching node type(s).

IntoElem: Go "into" currentmain position element such that it becomes the current parent position.

OutOfElem: Makes the current parent positioninto the current main position.

ResetPos: Resets the current positionto the start of the document.

ResetMainPos: Resets the current main positionto before the first sibling.

ResetChildPos: Resets the current child positionto before the first child.

Adding to the Document

AddElem: Adds an element after thecurrent main position element or last sibling.

InsertElem: Inserts an element beforethe current main position element or first sibling.

AddChildElem: Adds an element after thecurrent child position element or last child.

InsertChildElem: Inserts an element beforethe current child position element or first child.

AddSubDoc: Adds a subdocument after thecurrent main position element or last sibling.

InsertSubDoc: Inserts a subdocument beforethe current main position element or first sibling.

AddChildSubDoc: Adds a subdocument after thecurrent child position element or last child.

InsertChildSubDoc: Inserts a subdocument beforethe current child position element or first child.

AddNode: Adds a node after the currentnode or at the end of the parent element content.

InsertNode: inserts a node before thecurrent node or at the beginning of the parent element content.

Removing from the Document

RemoveElem: Removes the current main positionelement including child elements.

RemoveChildElem: Removes the current childposition element including its child elements.

RemoveNode: Removes the current node.

RemoveAttrib: Removes the specified attributefrom the current main position element.

RemoveChildAttrib: Removes the specified attributefrom the current child position element.

Getting Values

GetData: Returns the string value ofthe current main position element or node.

GetChildData: Returns the string value ofthe current child position element.

GetElemContent: Returns the string markupcontent of the current main position element including child elements.

GetSubDoc: Returns the subdocument markupstring of the current main position element including child elements.

GetChildSubDoc: Returns the subdocument markupstring of the current child position element including child elements.

GetAttrib: Returns the string value ofthe specified attribute of the main position element (or processing instruction).

GetChildAttrib: Returns the string value ofthe specified attribute of the child position element.

HasAttrib: Returns true if the specifiedattribute exists in the main position element (or processing instruction).

HasChildAttrib: Returns true if the specifiedattribute exists in the child position element.

GetTagName: Returns the tag name of themain position element (or processing instruction).

GetChildTagName: Returns the tag name of thechild position element.

FindGetData: Locates the next element matchingthe specified path and returns the string value.

Setting Values

SetData: Sets the value of the currentmain position element or node.

SetChildData: Sets the value of the currentchild position element.

SetElemContent: Sets the markup content ofthe current main position element.

SetAttrib: Sets the value of the specifiedattribute of the current main position element (or processing instruction).

SetChildAttrib: Sets the value of the specifiedattribute of the current child position element.

FindSetData: Locates the next element matchingthe specified path and sets the value.

Other Info

GetNthAttrib: Returns the name and valueof attribute specified by number for the current main position element.

GetAttribName: Returns the name of attributespecified by number for the current main position element.

GetNodeType: Returns the node type of thecurrent node.

GetElemLevel: Returns the level of the currentmain position.

GetElemFlags: Returns the current main positionelement's flags.

SetElemFlags: Sets the current main positionelement's flags.

GetOffsets: Obtains the document textoffsets of the current main position.

GetAttribOffsets: Obtains the document textoffsets of the specified attribute in the current main position.

Remembering positions

SavePos: Saves the current positionwith an optional string name using a hash map.

RestorePos: Goes to the position savedwith SavePos.

SetMapSize: Sets the size of a map foruse with the SavePos and RestorePos methods.

GetElemIndex: Returns the integer indexof the current main position element.

GotoElemIndex: Sets the current main positionelement to that of the given integer index.

GetChildElemIndex: Returns the integer indexof the current child position element.

GotoChildElemIndex: Sets the current child positionelement to that of the given integer index.

GetParentElemIndex: Returns the integer indexof the current parent position element.

GotoParentElemIndex: Sets the current parent positionelement to that of the given integer index.

GetElemPath: Returns a string representingthe absolute path of the main position element.

GetChildElemPath: Returns a string representingthe absolute path of the child position element.

GetParentElemPath: Returns a string representingthe absolute path of the parent position element.

Document Status

IsWellFormed: Determines if document hasa single root element and properly contained elements.

GetResult: Returns result markup fromlast parse or file operation.

GetError: Returns English error/resultsynopsis string from last parse or file operation.

GetDocFlags: Returns the document flags.

SetDocFlags: Sets the document flags.

GetDocElemCount: Returns the number of elementsin the document.

Static Utility Functions

ReadTextFile: Reads a text file into a string.

WriteTextFile: Writes a string to a textfile.

GetDeclaredEncoding: Returns the encoding nameas a string from the XML declaration.

EscapeText: Returns the string with specialcharacters encoded for markup.

UnescapeText: Returns the string with specialcharacters unencoded for a string value.

UTF8ToA: Converts a UTF-8 string toa non-Unicode ("ANSI") string.

AToUTF8: Converts a non-Unicode ("ANSI")string to UTF-8.

UTF16To8: Converts a UTF-16 string toUTF-8.

UTF8To16: Converts a UTF-8 string toUTF-16.

EncodeBase64: Encodes a binary data bufferto a Base64 string.

DecodeBase64: Encodes a Base64 string toa binary data buffer.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值