W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2002

Help with validating the schema

From: by way of <zahra.valaie@firstunion.com>
Date: Tue, 14 May 2002 18:32:16 -0700
Message-Id: <>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
I am having problem parsing my xml against the schema, could you please
help me??????????????

The problem is that If I change the the data types in from int (specified
in .xsd) to a string like (abc)in the .xml file,  I don't get an
exception from the parser.

here is my Java Code:

           //String urlString = "http://localhost:8080/xml/I.P.navigation.xml";
           //java.net.URL url = new java.net.URL(urlString);
           //parser.parse( new org.xml.sax.InputSource(url.openStream()));

           String filename = "C:\\FirsTeam\\Internet\\xml\\hphood_payroll.xml";
           java.lang.String xsdFileDir = "file:///C:\\FirsTeam\\Internet\\xml";
           String outFileName = 
           InputStream in = new FileInputStream(filename);

           org.apache.xerces.parsers.DOMParser parser = new 
           parser.setFeature ("http://xml.org/sax/features/validation", true);
("http://apache.org/xml/features/validation/schema", true);
           //   "file:///C:\\FirsTeam\\Internet\\xml",
           //   new org.xml.sax.InputSource("payroll.xsd"));
           ErrorChecker errors = new ErrorChecker();
           parser.parse(new org.xml.sax.InputSource(in));
           Document xmlDoc = parser.getDocument();
           XmlUtil.printXmlNode(xmlDoc, System.out);

       catch(IOException e) {
         System.out.println("Error reading File: " + e.getMessage());
       catch(SAXException e) {
         System.out.println("Error in parsing: " + e.getMessage());
       catch(DOMException e) {
           System.out.println("Error in parsing: " + e.getMessage());

and Attached are my xml and xsd files
(See attached file: payroll.xsd)(See attached file: 
hphood_payroll.xml)  THANKS! Zahra

Received on Wednesday, 15 May 2002 15:57:51 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:00 UTC