xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan 'Spocke' Sörlin" <spo...@paregos.se>
Subject Why can I get the validation to work??
Date Wed, 23 Feb 2000 10:46:25 GMT
I've used the IBM xml4j parser before and Iäm thinking of migrating to
Xerces but
I cant even make simple validation correctly, can some one help me???

Should'nt this code produce a parse error on a invalid document??


Java Source:
 org.apache.xerces.parsers.DOMParser parser = new
org.apache.xerces.parsers.DOMParser( );
  Document document;

  ((Configurable)
arser).setFeature( "http://xml.org/sax/features/validation", true );

  parser.setValidating( true );

  parser.parse("d:\\test.xml");

  document = parser.getDocument( );


tem.out.println( document.getDocumentElement( ).getFirstChild( ).getNodeName
( ) );


XML code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE document SYSTEM "document.dtd">
<document>
<title>bla bla</title>
<text>
bla bla bla
</text>
<ERROR>In valid element</ERROR>
</document>

______________________________________________
// -=: p a r e g o s : m e d i a d e s i g n :=-
// box 390 : S-931 24 skellefteå : sweden
// direct.tel: +46.(0)910.715705 : fax: +46.(0)910.715729
// http://www.paregos.se : js@paregos.se : ICQ: 9991973



Mime
View raw message