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 "Roytman, Alex" <ro...@peacetech.com> on 2000/05/31 01:11:31 UTC

Xerces 1.1 overlooks DTD/XML inconsistency. While v 1.0.3 finds t he bug

Ok, as suggested I repost it to Xerces-J-Dev.

this is a snippet from my DTD with couple of bugs in it:

<!ELEMENT dataset (tables,choose)>
<!ELEMENT ds-tables (table)+>
<!ELEMENT ds-table EMPTY>
<!ATTLIST ds-table
 name ID  #REQUIRED
>

when I renamed tables -> ds-tables and table -> ds-table I forgot to do so
in <!ELEMENT dataset (tables,choose)>

So I am using correct xml with incorrect DTD:

  <dataset>
    <ds-tables>
      <ds-table name="ds-account"/>
      <ds-table name="ds-alloc"/>
      <ds-table name="ds-adjust"/>
      <ds-table name="ds-trans"/>
    </ds-tables>
    <choose>
      <choose-total ds-tables="ds-alloc">
  ...........


XERCES 1.1 DOES NOT REPORT ANY ERRORS


while Xerces 1.0.3 does:

om.peacetech.xsum.InvalidXMLError:  Warning: The content model of element
"dataset" refers to the undeclared element "tables". (line 3, column 34)
org.xml.sax.SAXParseException: The content model of element "dataset" refers
to the undeclared element "tables". 	at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1225) 	at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1247) 	at
pti.mcps.xtotals.Test.main(Test.java:19)


I use following Parser setup:
 
parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion",
false);
 
parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error
", false);
 
parser.setFeature("http://apache.org/xml/features/validation/warn-on-undecla
red-elemdef", true);
      parser.setFeature("http://xml.org/sax/features/validation", true);
      parser.setFeature("http://apache.org/xml/features/validation/dynamic",
false);
 
parser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whit
espace", false);

Re: Xerces 1.1 overlooks DTD/XML inconsistency. While v 1.0.3 finds the bug

Posted by Eric Ye <er...@locus.apache.org>.
Yes, these are known bugs, because of the restructuring we did for Schema
validation. Actually report of warnings on this kind of error are optional
according to XML1.0 spec . But these should be fixed in the near future
since we are planning another revamp on the parser architecture, which
includes unified features settings on internal parser components.

Thanks
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Roytman, Alex" <ro...@peacetech.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, May 30, 2000 4:11 PM
Subject: Xerces 1.1 overlooks DTD/XML inconsistency. While v 1.0.3 finds the
bug


>
> Ok, as suggested I repost it to Xerces-J-Dev.
>
> this is a snippet from my DTD with couple of bugs in it:
>
> <!ELEMENT dataset (tables,choose)>
> <!ELEMENT ds-tables (table)+>
> <!ELEMENT ds-table EMPTY>
> <!ATTLIST ds-table
>  name ID  #REQUIRED
> >
>
> when I renamed tables -> ds-tables and table -> ds-table I forgot to do so
> in <!ELEMENT dataset (tables,choose)>
>
> So I am using correct xml with incorrect DTD:
>
>   <dataset>
>     <ds-tables>
>       <ds-table name="ds-account"/>
>       <ds-table name="ds-alloc"/>
>       <ds-table name="ds-adjust"/>
>       <ds-table name="ds-trans"/>
>     </ds-tables>
>     <choose>
>       <choose-total ds-tables="ds-alloc">
>   ...........
>
>
> XERCES 1.1 DOES NOT REPORT ANY ERRORS
>
>
> while Xerces 1.0.3 does:
>
> om.peacetech.xsum.InvalidXMLError:  Warning: The content model of element
> "dataset" refers to the undeclared element "tables". (line 3, column 34)
> org.xml.sax.SAXParseException: The content model of element "dataset"
refers
> to the undeclared element "tables". at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1225) at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1247) at
> pti.mcps.xtotals.Test.main(Test.java:19)
>
>
> I use following Parser setup:
>
>
parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion",
> false);
>
>
parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error
> ", false);
>
>
parser.setFeature("http://apache.org/xml/features/validation/warn-on-undecla
> red-elemdef", true);
>       parser.setFeature("http://xml.org/sax/features/validation", true);
>
parser.setFeature("http://apache.org/xml/features/validation/dynamic",
> false);
>
>
parser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whit
> espace", false);
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>