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

parsing a xml file against the schema

From: <zahra.valaie@firstunion.com>
Date: Tue, 16 Apr 2002 10:36:06 -0400 (EDT)
To: xmlschema-dev@w3.org
Message-ID: <OFCB8C75CC.1A4BEC8D-ON85256B9D.00500355@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.
I am attaching the .xml , .xsd file and .xsl file here I will add my java
code here too.

Thaks! Zahra

(See attached file: hphood_payroll.xml)(See attached file: payroll.xsl)(See
attached file: payroll.txt)(See attached file: payroll.xsd)

private static void parseXml()

     try {

          String filename = "C:\\FirsTeam\\Internet\\xml\\hphood_payroll.xml";

          String outFileName = "C:\\FirsTeam\\Internet\\xml\\hphood_payroll.new.xml";
          InputStream in = new FileInputStream(filename);
          Writer writer = new FileWriter(outFileName);
          org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
          parser.parse(new org.xml.sax.InputSource(in));
          Document xmlDoc = parser.getDocument();

          XmlUtil.printXmlNode(xmlDoc, System.out);
     //catch(Exception e) {
     //   e.printStackTrace(System.out);
      catch(IOException e) {
          System.out.println("Error in 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());

here is the java code

Received on Tuesday, 16 April 2002 11:28:34 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:56 UTC