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 kb...@informatica.com on 2000/07/15 01:20:37 UTC

Error on Release version

I really do not know what I am doing wrong but the same XML file parses in
Debug but not in Release. I have crossverified the correct versions of
release libraries are linking.

I have a simple piece of code here.
If I parse using xerces1.2, it gives me a error 
"Expected comment or processing instruction."

My file looks like 
---------------
<?xml version="1.0" encoding="utf-8"?>
<MGM>
   <!--The Multinational Garment Manufacturers' Database-->
Error on this line
   <Facility Location="London">
   </Facility>
</MGM>
---------------------

This used to parse ok with version 1.1
This parses well with SAXPrint and I am not able to find out why it gives a
problem.

Here is the snippet of code. I have a MFC application with this code.

Please help!!!

Kiran

class MyHandler : public HandlerBase
{
    void warning(const SAXParseException& toCatch)
    {
        AfxMessageBox("Have a problem warning");
    }
    void error(const SAXParseException& toCatch)
    {
        AfxMessageBox("Have a problem error");
    }
    void fatalError(const SAXParseException& toCatch)
    {
        CString str = toCatch.getMessage();
        AfxMessageBox(str);
    }
};

void CTestXMLDlg::OnButton1() 
{   
    XMLPlatformUtils::Initialize();
    try
    {
        SAXParser parser;
                
        MyHandler handler;
        
        parser.setDocumentHandler(&handler);
        parser.setErrorHandler(&handler);        
        
        XMLPScanToken token;
        if (!parser.parseFirst("d:\\DataCenter\\XMLData\\Garment.xml",
token))
        {                       
            return;
        }
        
        //  We started ok, so lets call scanNext() until we find what we
want
        //  or hit the end.
        BOOL gotMore = true;
        while (gotMore)
            gotMore = parser.parseNext(token);        
    }
    catch (const XMLException&)
    {           
        AfxMessageBox("we have a problem here");
        return ;
    }    

    XMLPlatformUtils::Terminate();
}

Re: Error on Release version

Posted by Dean Roddey <dr...@charmedquark.com>.
I think that you are getting bitten by the bug thta Eric is reporting. Its
one of those 'uninitialized locals' problems where it just happened to be
correct until the code changed around a bit due to recent changes. If that's
it, then it will be a trivial fix.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message -----
From: <kb...@informatica.com>
To: <xe...@xml.apache.org>
Cc: <ar...@hyperreal.org>
Sent: Friday, July 14, 2000 4:20 PM
Subject: Error on Release version


> I really do not know what I am doing wrong but the same XML file parses in
> Debug but not in Release. I have crossverified the correct versions of
> release libraries are linking.
>
> I have a simple piece of code here.
> If I parse using xerces1.2, it gives me a error
> "Expected comment or processing instruction."
>
> My file looks like
> ---------------
> <?xml version="1.0" encoding="utf-8"?>
> <MGM>
>    <!--The Multinational Garment Manufacturers' Database-->
> Error on this line
>    <Facility Location="London">
>    </Facility>
> </MGM>
> ---------------------
>
> This used to parse ok with version 1.1
> This parses well with SAXPrint and I am not able to find out why it gives
a
> problem.
>
> Here is the snippet of code. I have a MFC application with this code.
>
> Please help!!!
>
> Kiran
>
> class MyHandler : public HandlerBase
> {
>     void warning(const SAXParseException& toCatch)
>     {
>         AfxMessageBox("Have a problem warning");
>     }
>     void error(const SAXParseException& toCatch)
>     {
>         AfxMessageBox("Have a problem error");
>     }
>     void fatalError(const SAXParseException& toCatch)
>     {
>         CString str = toCatch.getMessage();
>         AfxMessageBox(str);
>     }
> };
>
> void CTestXMLDlg::OnButton1()
>

>     XMLPlatformUtils::Initialize();
>     try
>     {
>         SAXParser parser;
>
>         MyHandler handler;
>
>         parser.setDocumentHandler(&handler);
>         parser.setErrorHandler(&handler);
>
>         XMLPScanToken token;
>         if (!parser.parseFirst("d:\\DataCenter\\XMLData\\Garment.xml",
> token))
>

>             return;
>         }
>
>         //  We started ok, so lets call scanNext() until we find what we
> want
>         //  or hit the end.
>         BOOL gotMore = true;
>         while (gotMore)
>             gotMore = parser.parseNext(token);
>     }
>     catch (const XMLException&)
>

>         AfxMessageBox("we have a problem here");
>         return ;
>     }
>
>     XMLPlatformUtils::Terminate();
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>