423,516 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,516 IT Pros & Developers. It's quick & easy.

a parse error when using the xml4c.

P: n/a
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;
}
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
more..

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

ba***@hanwang.com.cn (H.L Bai) wrote in message news:<86**************************@posting.google. com>...
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;
}

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.