You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Peet Sneekes <pe...@mediamatic.nl> on 2000/05/02 18:45:22 UTC

no validation for DOMParser?

Hi, how do I get the DOMParser to validate my XML's realy strict.
There seems no validation going on at all.

Thanks in advance . . .

Peet Sneekes,
Mediamatic IP,
Amsterdam, NL

This is my Java:
.....
    parser.setFeature("http://xml.org/sax/features/validation", true);
    parser.setValidating(true);

parser.setFeature("http://apache.org/xml/features/validation/warn-on-duplica
te-attdef", true);

parser.setFeature("http://apache.org/xml/features/validation/warn-on-undecla
red-elemdef", true);
    parser.setFeature("http://xml.org/sax/features/namespaces", true);
     }

parser.setFeature("http://xml.org/sax/features/external-general-entities",
true);

parser.setFeature("http://xml.org/sax/features/external-parameter-entities",
true);

parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion",
false);

parser.setProperty("http://apache.org/xml/properties/dom/document-class-name
","org.apache.xerces.dom.DocumentImpl");

parser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-node
s", false);
......

and this is the XML:
<?xml version="1.0"?>
<!DOCTYPE screen [
<!ENTITY % screen-dtd SYSTEM "/resources/dtd/screen.dtd">
%screen-dtd;
]>
<screen site-component="jij" index="true" bgcolor="#ff9900"
background="back-o.jpg">
 <title>About you</title>
 <settings>
  <preload>