You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Chendica, NagaX M" <na...@intel.com> on 2000/12/13 21:13:04 UTC

Validation problem

I am facing validation problem while validating my Xml file against a DTD in
my java program like this.
I am using xeces-1_2_3 Parser.

            DOMParser parser = new DOMParser();
   	    boolean validate = true;
            parser.setFeature("http://xml.org/sax/features/validation",
validate);

After this I am parsing my file. I am getting the dom object and i am
getting the data also.
But what the parser doing is simply it is ignorning the tags, if it not as
per dtd.

Can any body suggest me on this.

Thanks & Regards,
Malle
503-547-0592(H)




Re: Validation problem

Posted by paul campbell <se...@halcyon.com>.
This worked for me on 1_2_3. I tested using the data/personal-schema.xml
I inserted code below, beginning with /* Test Validation Changes
into samples/ui/TreeView.java after the other
parser.setFeature statements

       /* Test Validation changes at Line 354 */
       System.out.println("\tValidation Requested-Start");
       try {
         parser.setFeature("http://xml.org/sax/features/validation", true);
         if ( parser.getFeature
              ( "http://xml.org/sax/features/validation")) {
           System.out.println("\t\tValidation = on");
         }
         System.out.println("\tValidation Requested-End");
       } catch (org.xml.sax.SAXNotRecognizedException e) {
         System.out.println("Error in setting up parser feature");
         System.out.println("Validation= " +
                            parser.getFeature
                            ("http://xml.org/xml/features/validation") );
         System.out.println("Validation Requested");
       }


At 12:13 PM 12/13/00, you wrote:
>I am facing validation problem while validating my Xml file against a DTD in
>my java program like this.
>I am using xeces-1_2_3 Parser.
>
>             DOMParser parser = new DOMParser();
>             boolean validate = true;
>             parser.setFeature("http://xml.org/sax/features/validation",
>validate);
>
>After this I am parsing my file. I am getting the dom object and i am
>getting the data also.
>But what the parser doing is simply it is ignorning the tags, if it not as
>per dtd.
>
>Can any body suggest me on this.
>
>Thanks & Regards,
>Malle
>503-547-0592(H)
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-dev-help@xml.apache.org