You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Russ Reeves <ru...@hotmail.com> on 2000/01/03 23:22:13 UTC

How to validate

Is there documentation that explains how to validate using xerces?
Here's what I've tried:
private Document validateXMLInstance(String xmlString) throws SAXException, 
IOException
{
  InputSource inputSource = new InputSource(new StringReader(xmlString));
  // to resolve relative reference to dtd
  inputSource.setSystemId("file:/DTDs/Job.dtd");
  DOMParser DP = new DOMParser();
  DP.parse(inputSource);
  Document document = DP.getDocument();
  RevalidatingDOMParser rDP = new RevalidatingDOMParser();
  if(rDP.validate(document.getDocumentElement()) == null)
    return document;
   else
    return null;
}

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Re: How to validate

Posted by Ted Leung <tw...@sauria.com>.
Russ,

try this

 private Document validateXMLInstance(String xmlString) throws SAXException,
 IOException
 {
   InputSource inputSource = new InputSource(new StringReader(xmlString));
   // to resolve relative reference to dtd
   inputSource.setSystemId("file:/DTDs/Job.dtd");
   DOMParser DP = new DOMParser();
   ((Configurable) DP).setFeature("http://xml.org/sax/features/validation",
true);

   DP.parse(inputSource);
   Document document = DP.getDocument();
 }

----- Original Message -----
From: "Russ Reeves" <ru...@hotmail.com>
To: <xe...@xml.apache.org>
Sent: Monday, January 03, 2000 2:22 PM
Subject: How to validate


> Is there documentation that explains how to validate using xerces?
> Here's what I've tried:
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
>