• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDOM - XML Validation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 think she's lovely. It's this tiny ad that called her crazy:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic