Duilib Source Code Analysis (iii) XML parser-cmarkup

Source: Internet
Author: User
Tags xml parser

The previous section describes the control builder Cdialogbuilder, which will then parse its XML parser cmarkup;

Cmarkup:xml parser, currently built in support of three encoding formats: UTF8, UNICODE, Asni;cmarkupnode:xml node class

First introduce cmarkup:

Xmlelement:xml node element type definition, IStart, the starting position of the node element in the XML file, ichild, node element child node, INext, node element's next node (sibling node), iparent, node element's parent node, IData,

The data for the node element.

Cmarkupnode, as a friend of CMarkup, means that CMarkup's member functions and data properties can be accessed, in fact, the later traversal of XML is implemented in conjunction with Cmarkupnode getsibling and Getchild.

Class member Data:

M_pstrxml: A pointer buffer stored for CMARKUP to load the contents of the XML file data;

M_pelements: The buffer that holds the node element information of the XmlElement type, in fact there may be some unforeseen storage space;

M_nelements: The number of active node elements in the actual save m_pelements;

M_nreservedelements: Reserved m_pelements buffer space size, the specific policy is: m_nelements >= m_nreservedelements) {m_nreservedelements + = (m_ NRESERVEDELEMENTS/2)

+ 500;m_pelements = static_cast<xmlelement*> (ReAlloc (m_pelements, m_nreservedelements * sizeof (XMLELEMENT)));

M_SZERRORMSG: Error message at last parse;

M_szerrorxml: XML location information at the time of the last parse;

M_bpreservewhitespace: Skip ignoring whitespace, default is ignore;

    

Cmarkupnode:

XmlAttribute: The structure of the node attribute is defined, Iname is the attribute name, and the Ivalue is the ulong type;

Max_xml_attributes: The node supports a maximum of 64 attributes;

Class member Data:

M_aattributes: A list of node attributes (an array of node properties that hold data similar to key-value pairs);

M_ipos: Specifies the current position of the attribute node in the node element of the owning owner (referred to as the CMarkup object) (in fact its node element is also saved as an array of pointers);

M_nattributes: Number of attributes in the node;

M_powner: The owner of the node (referred to as CMarkup object);

  

Duilib Source Code Analysis (iii) XML parser-cmarkup

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.