- From: by way of <cmsmcq@acm.org>
- Date: Tue, 14 May 2002 18:32:16 -0700
- To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
- Message-Id: <5.1.0.14.1.20020514183207.02aa51b8@localhost>
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) THANKS! Zahra
Attachments
- text/plain attachment: payroll1.xsd
- application/xml attachment: hphood_payroll1.xml
Received on Wednesday, 15 May 2002 15:57:51 UTC