Check this link http://xml.apache.org/xerces-j/features.html
Basically, you need to set the features.

If you use JDom, the following code helps:

  public void validate(InputSource in, String schemaLocation, String
strNamespace)
  throws SAXException, IOException
 {
        SAXParser reader = new SAXParser();

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

        //set the parser's property: the target namespace, and schema
location
        if ((strNamespace != null) && (!strNamespace.trim().equals("")))

reader.setProperty("http://apache.org/xml/properties/schema/external-schemaL
ocation",
                                         strNamespace+" "+schemaLocation);
        else

reader.setProperty("http://apache.org/xml/properties/schema/external-noNames
paceSchemaLocation",
                                       schemaLocation);
        // Register the error handler
        reader.setErrorHandler(new MyErrorHandler());
        reader.parse(in);
 }
----- Original Message -----
éäè : "tom john" <[EMAIL PROTECTED]>
åå : <[EMAIL PROTECTED]>
éäææ : 2002å3æ12æ 18:13
äå : xml validation with schema


> Hi,
> I am very new with xerces and schema.
>
> Can anyone give me a simple example how to validate
> xml using schema? or where to look for it.
> i get xml data which needs to be validated.
> thanks
> tom
>
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free email!
> http://mail.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to