You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Rajan Gupta <rg...@yahoo.com> on 2000/12/20 14:51:57 UTC
LocalFileInputSource
I have the following XML document which I am trying to
parse with LocalFileInputSource but I get the error
Error in parsing.
line: 0, col: 0
Message: An exception occured! Type:RuntimeException,
Message:The primary docum
nt entity could not be opened.
Id=D:\USERS\TEMP\Dom1\�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T
The following is the document:
<?xml version='1.0' encoding='ascii'?>
<company>
<product>XML4C</product>
<category idea='great'>XML Parsing
Tools</category>
<developedAt>
IBM Center for Java Technology, Silicon Valley,
Cupertino, CA
</developedAt>
</company>
& the code is
main()
{
try {
XMLPlatformUtils::Initialize();
}
catch (XMLException& e) {
cerr << "\nError initializing XML42C:\n"
<< "Exception message is: \n"
<< e.getMessage() << "\n" << endl;
return -1;
}
LocalFileInputSource *aFileInput = new
LocalFileInputSource((const XMLCh*)
"D:/USERS/TEMP/Dom1/Dom1.xml");
aFileInput->setPublicId((const XMLCh*) "Hello");
DOMParser *parser = new DOMParser();
ErrorHandler *ehandler = new SimpleErrorHandler();
parser->setErrorHandler(ehandler);
parser->setDoValidation(false);
parser->setDoNamespaces(false);
try {
parser->parse(*aFileInput);
}
catch (XMLException& e) {
cerr << "\nError during parsing memory stream:\n"
<< "Exception message is: \n"
<< e.getMessage() << "\n" << endl;
return -1;
}
If I use MemBufInputSource or use the method on parser
to parse the file it works OK.
Has anybody else encountered such a problem.
Thanks
Rajan
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/