Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Other Open Source Projects and the fly likes StAX xml validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "StAX xml validation" Watch "StAX xml validation" New topic

StAX xml validation

Alex Khvatov
Ranch Hand

Joined: Nov 07, 2005
Posts: 36
how do I validate XML using StAX parser? is there a way to attach XSD document?


SCJP 5<br />SCWCD 5
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Yes. In your factory class (DOM or SAX), there's a method called setSchema(), which you can use to set your schema.

For more information, you can refer to this article.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Alex Khvatov
Ranch Hand

Joined: Nov 07, 2005
Posts: 36
I was talking about StAX (not SAX or DOM) parsers.
StAX XMLInputFactory does not have setSchema method.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

StAX is this? I'll move this to "Other Open Source Products" for you, since this is a question about this specific product and not a Java language question.

[Jess in Action][AskingGoodQuestions]
subject: StAX xml validation
It's not a secret anymore!