XML schema/ DTD specified at runtime
Hello, Im sure that many of you would have encountered the problem I would describe, I have an input file xml file <Name> <FirstName> Joe </FirstName> <SecondName> Somebody </SecondName> </Name> and this does not have any mention of DTD or Xml schema in it. I would have a xml schema file named (name.xsd) which specifies that <FirstName> and <LastName> cannot contain any numbers! Now,I am using a SAX parser and am using xerces 2.2.1 I tried with the Counter.java file that comes alog with in the /sax directory. I also created my own EntityResolver called MyEntityResolver() and added a System.out.println(" Entity Resolver called") in the resolveEntity() method.. In Counter.java , I added the below code parser.setEntityResolver(new MyEntityResolver()) and the respective flags in Counter.java are all set to true and the parser is the org.apache.xml.parser.SAXParser ( which is the DEFAULT_PARSER in Counter.java) I expected the resolveEntity method to be called.. but it is not happening... Whats missing ?? DO any of you have some code example, that would validate my plain xml file , against a schema or an dtd , which is specfied at runtime ??? Thanks Harish __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format