Oxygen XML Editor
 
[XML-DEV Mailing List Archive Home] [By Thread] [By Date]

SAX parser validation with JRE 1.5


  • To: xml-dev@...
  • Subject: SAX parser validation with JRE 1.5
  • From: Rich Knox <rich@...>
  • Date: Wed, 24 Aug 2005 10:17:22 -0700
  • Reply-to: rich@...
  • User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

I have code that uses the SAX parser provided with J2SE 1.4 and 1.5. We have a DTD we wish to validate against. When I run this code against JRE 1.4.2_07, everything works as expected. When I try to run it against JRE 1.5.0_02, parser does not appear to be doing any validation against our DTD. If I make the XML badly formed, we get an error in 1.4 but not 1.5. I know there are significant changes from 1.4 to 1.5. Is there something special we need to do to enable validation? Here is the code we use to create and configure the parser:
        SAXParser   parser;
        XMLReader   reader;
 
        try
        {
            Properties props = System.getProperties();
            props.list(System.out);
            if (null == mFactory)
            {
                mFactory = SAXParserFactory.newInstance();
                mFactory.setValidating(true);
            }
 
            parser = mFactory.newSAXParser();
            reader = parser.getXMLReader();
        }
        catch (SAXException e)
        {
            // ...
        }
        catch (ParserConfigurationException e)
        {
            // ...
        }

Thanks for any assistance you can give me on this.

-rich

 
© 2002-2008 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy
This website was created & generated with <oXygen/> XML Editor
Keywords
xml