• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to dynmically determine the system ID

 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have to parser an xml which has to be validated against an xsd.
EG. . XML..1 xsd is request.xsd
private static String request="<?xml version=\"1.0\" encoding=\"UTF-8\"?><request xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"request.xsd\" debug=\"T\"><appid id=\"AppId\"></appid><platform id=\"4\"></platform</request>" ;
EG. . XML..2 xsd is retrieve.xsd
private static String request="<?xml version=\"1.0\" encoding=\"UTF-8\"?><retrieve xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"retrieve.xsd\" debug=\"T\"><retrieve-appid id=\"AppId\"></retrieve-appid><retrieve-platform id=\"6\"></retrieve-platform</retrieve>" ;

How can I let the parser dynamically determine the xsd to use depending on what the xml I pass . I dont want to hardcode the xsd values into the parser .

For DTD I used parser.setEntityResolver(EntityResolver res) .. Does this work for xsd's too if so can some please paste a code snippet how the parser validates against xsd's dynamically.
Thanks
Dhiren
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic