xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David --- <danova...@yahoo.fr>
Subject Re: SAX2XMLReader simple parsing problem. Newbie help needed
Date Mon, 08 Mar 2004 21:04:50 GMT
Hi alberto,
Here is the code....
    
/////
//The parser
/////
SaxParser::SaxParser()
{
    std::cout << "Trying to instantiate SAXParser" <<
std::endl;
    bool doNamespaces = false;
    bool doSchema = false;
    bool schemaFullChecking = false;
    bool namespacePrefixes = true;
    bool CoreValidation = true;
    SAX2XMLReader::ValSchemes valScheme =
SAX2XMLReader::Val_Never;
    c_parser = XMLReaderFactory::createXMLReader();
    
       
c_parser->setFeature(XMLUni::fgSAX2CoreValidation,CoreValidation);
    c_parser->setFeature(XMLUni::fgSAX2CoreNameSpaces,
doNamespaces);
    c_parser->setFeature(XMLUni::fgXercesSchema,
doSchema);
   
c_parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
schemaFullChecking);
   
c_parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes,
namespacePrefixes);
    std::cout << "SAXParser instantiated ok" <<
std::endl;
}



////////
//Class error
/////////

    Error(const XMLCh* toTranscode)
	{
	    // Call the private transcoding method
	    char * errormessage =
XMLString::transcode(toTranscode);
	}
    
    /* ~Error() */
/* 	{ */
/* 	    XMLString::release(&errormessage); */
/* 	} */

     //
-----------------------------------------------------------------------
    //  Getter methods
    //
-----------------------------------------------------------------------
    
    const char* displayerror() const
	{
	    return errormessage;
	}

private :
    char* errormessage;
};


inline std::ostream& operator<<(XERCES_STD_QUALIFIER
ostream& target, const Error& Dump)
{
    target << Dump.displayerror();
    return target;
}
 

--- Alberto Massari <amassari@progress.com> a écrit :
> At 23.05 04/03/2004 +0100, David --- wrote:
> >Hello,
> >I'm getting a strange error message parsing an xml
> >file with the SAX2XMLReader parser.
> >The error is just below, the beg of the xml file
> just
> >after. Can anybody help me please ?? By the way
> does
> >anybody know of an irc channel for xerces ???
> >
> >thanks,
> >david
> 
> To see the full error message you have to transcode
> it into the local code 
> page; casting it to be a char* will only display the
> first letter of it.
> 
> Trying to guess what the error is, and looking at
> the line/col information, 
> it could be that you have set the enableValidation
> property to "always". 
> Can you post the lines of code you use to set up the
> parser?
> 
> Alberto
> 
> 
> > >
> > >SAXParser instantiated ok
> > >Trying to parse example.xml...
> >
> >Error parsing xml file at, line 1, char 15
> >   Message: U
> >
> >Error parsing xml file at, line 2, char 17
> >   Message: U
> >
> >Error parsing xml file at, line 2, char 25
> >   Message: A
> >
> >Error parsing xml file at, line 3, char 7
> >   Message: U
> >
> >#######
> >Xmlfile
> >
> ><PubmedArticle>
> ><MedlineCitation Status="Publisher">
> >     <PMID>14676294</PMID>
> >     <DateCreated>
> >         <Year>2003</Year>
> >         <Month>Dec</Month>
> >         <Day>16</Day>
> >     </DateCreated>
> >     <Article>
> >         <Journal>
> >             <ISSN>0022-1007</ISSN>
> >             <JournalIssue>
> >                 <Volume>198</Volume>
> >                 <Issue>12</Issue>
> >                 <PubDate>
> >                     <Year>2003</Year>
> >                     <Month>Dec</Month>
> >                     <Day>15</Day>
> >                 </PubDate>
> >
> >
> >
> >
> >
> >
> >Yahoo! Mail : votre e-mail personnel et gratuit qui
> vous suit partout !
> >Créez votre Yahoo! Mail sur
> http://fr.benefits.yahoo.com/
> >
> >Dialoguez en direct avec vos amis grâce à Yahoo!
> Messenger !Téléchargez 
> >Yahoo! Messenger sur http://fr.messenger.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> >For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>  


	

	
		
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger
sur http://fr.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Mime
View raw message