Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-20-2009, 02:43 PM   #1
Registered: Nov 2006
Distribution: xubuntu
Posts: 451

Rep: Reputation: 31
XML Schemas and Java XML Parsers

Hi there,

I have seen a number of tutorials for parsing an XML file with Java XML Parsers but I have failed to find any tutorial for validating an XML file according to its schema with a Java Parser.
Can anyone list any tutorial or give some sample code.

Many thanks.
Old 03-20-2009, 08:51 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
The standard parsers that come with the JDK should all be validating parsers these days. So all you have to do is turn on validation when you create the object:
   // EXAMPLE:
   SAXParserFactory factory = SAXParserFactory.newInstance();
Here's a more elaborate example (you can easily find better, newer and more comprehensive examples, I'm sure):

'Hope that helps .. PSM


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
checking for XML::Parser... configure: error: XML::Parser perl module is required for kornerr Linux - General 11 11-16-2008 07:24 AM
LXer: Thinking XML: Firefox 3.0 and XML LXer Syndicated Linux News 0 07-30-2008 06:50 PM
no xml, convert tvtime stationlist to xml for mythtv/freevo... frenchn00b Linux - General 8 11-03-2007 11:35 PM
LXer: StAX’ing up XML: Streaming API for XML LXer Syndicated Linux News 0 11-30-2006 07:54 AM
configure: error: could not find DocBook XML DTD V4.1.2 in XML catalog Fadoksi Linux - Software 1 07-16-2006 06:41 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration