aspose file tools
The moose likes XML and Related Technologies and the fly likes JDOM - XML Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "JDOM - XML Validation" Watch "JDOM - XML Validation" New topic
Author

JDOM - XML Validation

prabhakar prabhala
Greenhorn

Joined: May 31, 2005
Posts: 2
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JDOM - XML Validation
 
Similar Threads
building error when validating against schema using jdom
Validating XML with Schema
PROBLEM IN VALIDATING XML AGAINST AN XSD
feature not recognized for SAX driver parser.XMLReaderI
old jdom in jrun Updater 7