srikotesh
asked on
how to validate xml files using java
Hi Experts,
how to validate xml using java
i dont want any data from the xml just need validate it as valid xml or not
how to validate xml using java
i dont want any data from the xml just need validate it as valid xml or not
Valid XML or valid against his XSD?
ASKER
hi Theo,
valid xml only.
hi girionis,
from that link I am not sure what is the myxsd I have to pass.
Source schemaFile = new StreamSource(new File("mySchema.xsd"));
Domparser I am using to validate xml
valid xml only.
hi girionis,
from that link I am not sure what is the myxsd I have to pass.
Source schemaFile = new StreamSource(new File("mySchema.xsd"));
Domparser I am using to validate xml
Are you using a DocumentBuilderFactory? If yes then you simply need to do:
factory.setValidating(true );
factory.setValidating(true
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Java has built-in support for validation. For sample code have a look at the validation package:
https://docs.oracle.com/javase/7/docs/api/javax/xml/validation/package-summary.html