a parse error when using the xml4c.

Discussion in 'XML' started by H.L Bai, Jan 5, 2004.

  1. H.L Bai

    H.L Bai Guest

    hi, everybody

    i meet a parse error when i used the xml4c.

    any proposal is helpful.

    The error is following

    .../XMLRegionHandler.h:59 parse error before '*'
    .../XMLRegionHandler.h:60 parse error before '*'
    .../XMLRegionHandler.h:61 parse error before '*'
    .../XMLRegionHandler.h:62 parse error before '*'
    .../XMLRegionHandler.h:63 parse error before '*'
    .../XMLRegionHandler.cc: in method 'void
    XMLRegionHandler::StartElement(...)':

    .../XMLRegionHandler.cc:107: 'local name' undecleared (first use in use
    function)


    #ifndef __XML_REGION_HANDLER_H__
    #define __XML_REGION_HANDLER_H__
    class Attributes; // this is from <sax2/Attributes.hpp>

    // XML4C include for SAX2 API...
    #include <xercesc/sax2/DefaultHandler.hpp>

    XERCES_CPP_NAMESPACE_USE

    class XMLRegionHandler : public DefaultHandler
    {
    ........
    void startDocument();
    void endDocument();

    void startElement(const XMLCh *const uri, //59 line
    const XMLCh *const localname, //60line
    const XMLCh *const qname, //61line
    const Attributes &attributes); //62line

    void endElement(const XMLCh *const uri,
    const XMLCh *const localname,
    const XMLCh *const qname);
    ........
    }
    endif



    #include "XMLRegionHandler.h"

    #include <xercesc/util/XMLString.hpp> // XMLString class with static
    character conversion methods
    #include <xercesc/sax2/Attributes.hpp>

    void XMLRegionHandler::startElement(const XMLCh *const uri,
    const XMLCh *const localname,
    const XMLCh *const qname,
    const Attributes &attributes)
    {

    char *element_name = XMLString::transcode(localname);

    if (strcasecmp(element_name, "md_blob_frame") == 0) // matched
    this element name?
    {
    // call specific function
    handle_frame(&attributes);

    // we have gone one level further into the document
    parsing_level++;
    return;
    }

    if (strcasecmp(element_name, "blob") == 0) // matched this
    element name?
    {
    // call specific function
    handle_blob(&attributes);

    // we have gone one level further into the document
    parsing_level++;
    return;
    }

    if (strcasecmp(element_name, "info2d") == 0) // matched this
    element name?
    {
    // call specific function
    handle_info2d(&attributes);

    // we have gone one level further into the document
    parsing_level++;
    return;
    }

    if (strcasecmp(element_name, "info3d") == 0) // matched this
    element name?
    {
    // call specific function
    handle_info3d(&attributes);

    // we have gone one level further into the document
    parsing_level++;
    return;
    }

    if (strcasecmp(element_name, "occlusion") == 0) // matched this
    element name?
    {
    // call specific function
    handle_occlusion(&attributes);

    // we have gone one level further into the document
    parsing_level++;
    return;
    }

    // if we end up here, the element name was not matched
    // give an error message and ignore the data
    cerror << " XMLRegionHandler::startElement(): Unknown XML element
    »"
    << element_name
    << "« while parsing XML region data from MotionDetector "
    << endl;

    // de-allocate memory allocated by char
    *XMLString::transcode(const XMLCh *)
    delete [] element_name;
    }
     
    H.L Bai, Jan 5, 2004
    #1
    1. Advertising

  2. H.L Bai

    H.L Bai Guest

    more..

    the OS is SuSE Linux 8.0
    -I/opt/xml4c/include
    -L/opt/xml4c/lib


    thank you

    (H.L Bai) wrote in message news:<>...
    > hi, everybody
    >
    > i meet a parse error when i used the xml4c.
    >
    > any proposal is helpful.
    >
    > The error is following
    >
    > ../XMLRegionHandler.h:59 parse error before '*'
    > ../XMLRegionHandler.h:60 parse error before '*'
    > ../XMLRegionHandler.h:61 parse error before '*'
    > ../XMLRegionHandler.h:62 parse error before '*'
    > ../XMLRegionHandler.h:63 parse error before '*'
    > ../XMLRegionHandler.cc: in method 'void
    > XMLRegionHandler::StartElement(...)':
    >
    > ../XMLRegionHandler.cc:107: 'local name' undecleared (first use in use
    > function)
    >
    >
    > #ifndef __XML_REGION_HANDLER_H__
    > #define __XML_REGION_HANDLER_H__
    > class Attributes; // this is from <sax2/Attributes.hpp>
    >
    > // XML4C include for SAX2 API...
    > #include <xercesc/sax2/DefaultHandler.hpp>
    >
    > XERCES_CPP_NAMESPACE_USE
    >
    > class XMLRegionHandler : public DefaultHandler
    > {
    > .......
    > void startDocument();
    > void endDocument();
    >
    > void startElement(const XMLCh *const uri, //59 line
    > const XMLCh *const localname, //60line
    > const XMLCh *const qname, //61line
    > const Attributes &attributes); //62line
    >
    > void endElement(const XMLCh *const uri,
    > const XMLCh *const localname,
    > const XMLCh *const qname);
    > .......
    > }
    > endif
    >
    >
    >
    > #include "XMLRegionHandler.h"
    >
    > #include <xercesc/util/XMLString.hpp> // XMLString class with static
    > character conversion methods
    > #include <xercesc/sax2/Attributes.hpp>
    >
    > void XMLRegionHandler::startElement(const XMLCh *const uri,
    > const XMLCh *const localname,
    > const XMLCh *const qname,
    > const Attributes &attributes)
    > {
    >
    > char *element_name = XMLString::transcode(localname);
    >
    > if (strcasecmp(element_name, "md_blob_frame") == 0) // matched
    > this element name?
    > {
    > // call specific function
    > handle_frame(&attributes);
    >
    > // we have gone one level further into the document
    > parsing_level++;
    > return;
    > }
    >
    > if (strcasecmp(element_name, "blob") == 0) // matched this
    > element name?
    > {
    > // call specific function
    > handle_blob(&attributes);
    >
    > // we have gone one level further into the document
    > parsing_level++;
    > return;
    > }
    >
    > if (strcasecmp(element_name, "info2d") == 0) // matched this
    > element name?
    > {
    > // call specific function
    > handle_info2d(&attributes);
    >
    > // we have gone one level further into the document
    > parsing_level++;
    > return;
    > }
    >
    > if (strcasecmp(element_name, "info3d") == 0) // matched this
    > element name?
    > {
    > // call specific function
    > handle_info3d(&attributes);
    >
    > // we have gone one level further into the document
    > parsing_level++;
    > return;
    > }
    >
    > if (strcasecmp(element_name, "occlusion") == 0) // matched this
    > element name?
    > {
    > // call specific function
    > handle_occlusion(&attributes);
    >
    > // we have gone one level further into the document
    > parsing_level++;
    > return;
    > }
    >
    > // if we end up here, the element name was not matched
    > // give an error message and ignore the data
    > cerror << " XMLRegionHandler::startElement(): Unknown XML element
    > »"
    > << element_name
    > << "« while parsing XML region data from MotionDetector "
    > << endl;
    >
    > // de-allocate memory allocated by char
    > *XMLString::transcode(const XMLCh *)
    > delete [] element_name;
    > }
     
    H.L Bai, Jan 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. learning_C++

    error: parse error before `(' token

    learning_C++, Sep 21, 2004, in forum: C++
    Replies:
    4
    Views:
    10,037
    Sharad Kala
    Sep 21, 2004
  2. xml4c child nodes

    , Oct 12, 2006, in forum: XML
    Replies:
    14
    Views:
    866
    Joseph Kesselman
    Oct 12, 2006
  3. Replies:
    1
    Views:
    501
    Joe Kesselman
    Oct 19, 2006
  4. Replies:
    19
    Views:
    1,184
    Daniel Vallstrom
    Mar 15, 2005
  5. 7stud --

    optparse: parse v. parse! ??

    7stud --, Feb 20, 2008, in forum: Ruby
    Replies:
    3
    Views:
    212
    7stud --
    Feb 20, 2008
Loading...

Share This Page