[
Lists Home |
Date Index |
Thread Index
]
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
|