Hi Guys,
I am using JDOM 1.0 to read xml. I am trying to validate using xerces 2.8.0. But I am getting from XercesImpl.jar. What's the best way to validate?
Any code snippet is highly appreciated.
My input xml is like below.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<x:Indexes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xml.dadd.com/schema/indexSummary
http://xml.dadd.com/schema/DaDDIndexSummary.xsd" xmlns:x="http://xml.dadd.com/schema/indexSummary">
My
Java code is like below.
SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);
builder.setFeature( "http://apache.org/xml/features/validation/schema", true);
builder.setProperty( "http://apache.org/xml/properties/schema/external-schemaLocation",
"http://xml.dadd.com/schema/indexSummary
http://xml.dadd.com/schema/DaDDIndexSummary.xsd"); Document
doc = builder.build(inputXml);
Thanks,
-p