W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

Please help

From: <zahra.valaie@firstunion.com>
Date: Tue, 16 Apr 2002 16:38:18 -0400 (EDT)
To: xmlschema-dev@w3.org
Message-ID: <OF9DB4B911.BEA2E61C-ON85256B9D.007106C3@infra.fub.com>
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:

try{
          //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 = "C:\\FirsTeam\\Internet\\xml\\hphood_payroll.new.xml";
          InputStream in = new FileInputStream(filename);

          org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
          parser.setFeature ("http://xml.org/sax/features/validation", true);
          parser.setFeature ("http://apache.org/xml/features/validation/schema", true);
          //parser.setProperty(
          //   "file:///C:\\FirsTeam\\Internet\\xml",
          //   new org.xml.sax.InputSource("payroll.xsd"));
          ErrorChecker errors = new ErrorChecker();
          parser.setErrorHandler(errors);
          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)


Received on Wednesday, 17 April 2002 05:07:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT