SAX and children node

Patos <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
There is a better exemple of what im currently doing :

void XMLStartElementHandler(void *data, const char *name, const char **atts)
{
    XmlReader *p = reinterpret_cast<XmlReader *>(data);
    XmlNode *xn = p->m_pCurrentReader->m_pCurrentNode;
    /* default value. */
    xn->m_ChildNodes = true;
    xn->m_Name = String(name);
    /* retrieve the node attribute. */
    for (int i = 0; atts[i]; i += 2)
    {
            XmlAttribute *att = new XmlAttribute(String(atts[i]),
String(atts[i + 1]));
            /* add the attribute. */
            xn->m_pAttrList->Add(att);
     }
    /* node readed. */
    p->m_pCurrentReader->m_NodeComplete = true;
    xn->m_Depth = ++p->m_Depth;
}

void XMLEndElementHandler(void *data, const char *name)
{
    XmlReader *p = reinterpret_cast<XmlReader *>(data);
    XmlNodeReader *xnr = p->m_pCurrentReader;
    /* do we have child. */
    xnr->m_pCurrentNode->m_ChildNodes = p->m_Depth !=
xnr->m_pCurrentNode->m_Depth;
    p->m_Depth--; /* were done, get back to the previous depth. */
    /* stop the parser. */
    xnr->m_NodeComplete = true;
}

and im calling XML_Parse in a ReadNext method with only 4 bytes at a time
looping on the value m_NodeComplete.

Patrick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.