I am having a problem where my parser does not seem to be validating. My
DTD is "sequence.dtd":
<?xml version="1.0" encoding='UTF-8' ?>
<!ELEMENT root (elem1,elem2)>
<!ELEMENT elem1 (#PCDATA)>
<!ELEMENT elem2 (#PCDATA)>
The following is my Java code:
InputSource myIS = new InputSource(new FileInputStream("testXML.xml"));
DOMParser myParser = new DOMParser();
myParser.setFeature("http://xml.org/sax/features/validation", true);
myParser.parse(myIS);
Document myDOM = myParser.getDocument();
... goes on to print elements to System.out
I do not get a parser error regardless of whether my elements are out of
sequence or I introduce foreign elements. Both of the XML samples below
parsed just fine, but I was expecting an error.
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE root SYSTEM "sequence.dtd">
<root>
<elem2>OUT2</elem2>
<elem1>OUT1</elem1>
</root>
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE root SYSTEM "sequence.dtd">
<root>
<elem2>OUT2</elem2>
<elem1>OUT1</elem1>
<foreign>OOPS!</foreign>
</root>
Any help would be much appreciated! Thanks, Wendi
--
Wendi Sisson
Systems Programmer
International Trade Development
FedEx Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]