You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Gi...@i2.com on 2001/01/04 18:16:41 UTC

Runtime error with Xerces on AIX 4.3.3

Hello,

I am having a problem using Xerces 1.1.2 (in fact the version delivered
with Xalan 1.2.2) on an AIX box using the IBM version of Java 2 v1.2.2:

When I try to validate a document, if I submit the following piece of XML:

<?xml version="1.0" ?><!DOCTYPE MDoc SYSTEM "Test.dtd">
<MDoc/>

I get the following error:

Exception in thread "main" java.lang.RuntimeException: Internal Error:
fPreviousChunk == NULL
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:925)
        at com.i2.glm.utils.xmlchecker.XMLChecker.check(XMLChecker.java:84)

Now if I add a carriage return between the XML header and the doctype
declaration it works:

<?xml version="1.0" ?>
<!DOCTYPE MDoc SYSTEM "Test.dtd">
<MDoc/>


The best is, if you process the same document twice (ignoring the first
exception), the second execution is successfull!!

Did somebody already encountered this problem? Do you have any idea of what
is happening?

Thanks for your help.

Gilles.

PS: Sorry for this duplicated email, I forgot to set the subject.


Re: DOM Parser

Posted by David Halsted <ha...@tcimet.net>.
Have a look at the sample code that ships with Xerces.  The source for
DOMCount, I think it is, has a pretty complete set of examples of
error-handling.

----- Original Message -----
From: Milind Gadre <mi...@ecplatforms.com>
To: <xe...@xml.apache.org>
Sent: Sunday, January 07, 2001 10:55 AM
Subject: Re: DOM Parser


> Perhaps you need to associate an error handler with the parser, and
> throw an exception for any error/fatalError that is encountered.
>
> Regards...
>
> Milind Gadre
> ecPlatforms, Inc
> 901 Mariner's Island Blvd, Suite 565
> San Mateo, CA 94404
> C: 510-919-0596
> F: 815-352-0779
> milind@ecplatforms.com
>
> ----- Original Message -----
> From: "Dream Catcher" <is...@leonis.nus.edu.sg>
> To: <xe...@xml.apache.org>
> Sent: Saturday, January 06, 2001 8:42 PM
> Subject: DOM Parser
>
>
> > document.xml file at all. May I know where is my fault? I have already
> > done this in my program:
> >   DOMParser p = new DOMParser();
> >   p.setFeature("http://xml.org/sax/features/validation", true);
> >   p.setFeature("http://apache.org/xml/features/validation/schema",
> true);
> >
> >
> >   thanks...
> >
> > Best Regards
> > Wang Yue
> >
> >     *------------------------------*
> >       Attitude makes the difference
> >     *------------------------------*
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>


Re: DOM Parser

Posted by Andy Clark <an...@apache.org>.
Milind Gadre wrote:
> Andy, it would make sense to have this default behavior in the case
> where validation is set to true. It *is* confusing (initially) when you

Those were also my thoughts. And in non-validating mode, the
parser knows not to report validation warnings and errors. But
even in non-validating mode the user would see the report of
fatal errors.

> tell the parser 'validate', and see nothing even when things are
> obviously wrong.

And it's one of the most reported "bugs". So the new default
behavior will really help in that respect.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

Re: DOM Parser

Posted by Milind Gadre <mi...@ecplatforms.com>.
Andy, it would make sense to have this default behavior in the case
where validation is set to true. It *is* confusing (initially) when you
tell the parser 'validate', and see nothing even when things are
obviously wrong.

Regards...

> To avoid questions like this in the future, I changed Xerces2
> recently to install an error handler by default whose error
> messages are printed to standard out. Should do the same with
> Xerces 1.x?



Re: DOM Parser

Posted by Andy Clark <an...@apache.org>.
Milind Gadre wrote:
> Perhaps you need to associate an error handler with the parser, and
> throw an exception for any error/fatalError that is encountered.

To avoid questions like this in the future, I changed Xerces2
recently to install an error handler by default whose error
messages are printed to standard out. Should do the same with 
Xerces 1.x?

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

Re: DOM Parser

Posted by Milind Gadre <mi...@ecplatforms.com>.
Perhaps you need to associate an error handler with the parser, and
throw an exception for any error/fatalError that is encountered.

Regards...

Milind Gadre
ecPlatforms, Inc
901 Mariner's Island Blvd, Suite 565
San Mateo, CA 94404
C: 510-919-0596
F: 815-352-0779
milind@ecplatforms.com

----- Original Message -----
From: "Dream Catcher" <is...@leonis.nus.edu.sg>
To: <xe...@xml.apache.org>
Sent: Saturday, January 06, 2001 8:42 PM
Subject: DOM Parser


> document.xml file at all. May I know where is my fault? I have already
> done this in my program:
>   DOMParser p = new DOMParser();
>   p.setFeature("http://xml.org/sax/features/validation", true);
>   p.setFeature("http://apache.org/xml/features/validation/schema",
true);
>
>
>   thanks...
>
> Best Regards
> Wang Yue
>
>     *------------------------------*
>       Attitude makes the difference
>     *------------------------------*
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>


DOM Parser

Posted by Dream Catcher <is...@leonis.nus.edu.sg>.
Hi, all. 

In my program I use Xerces1.2.3's DOM parser to parse my .xml file whose
grammar is in .xsd file. I discover even I omit
  xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
  xsi:noNamespaceSchemaLocation='document.xsd' 
in the root level element the parser doesn't complain at all. And I add
some undefined elments into the document.xml file on purpose, the DOM
parser doesn't complain either!!! It seems the grammar doesn't govern my
document.xml file at all. May I know where is my fault? I have already
done this in my program:
  DOMParser p = new DOMParser();
  p.setFeature("http://xml.org/sax/features/validation", true);
  p.setFeature("http://apache.org/xml/features/validation/schema", true);


  thanks...

Best Regards
Wang Yue

    *------------------------------*
      Attitude makes the difference
    *------------------------------*