http://www.w3.org/2001/XMLSchema.xsd
Then you can build your own tool using the following code.
============================================
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
public class SchemaValidator {
public static void main(String[] args) throws Exception {
XMLReader reader = XMLReaderFactory.createXMLReader();
Source scoure = new SAXSource(reader, new InputSource(
new FileInputStream(new File("path to your schema"))));
// create a SchemaFactory capable of understanding WXS schemas
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// load a WXS schema, represented by a Schema instance
URL url = new URL("http://www.w3.org/2001/XMLSchema.xsd");
Source schemaFile = new StreamSource(url.openStream());
Schema schema = factory.newSchema(schemaFile);
// create a Validator instance, which can be used to validate an instance document
Validator validator = schema.newValidator();
// validate the DOM tree
validator.validate(scoure);
}
}
Wednesday, April 23, 2008
XML Schema validation
If you are looking for a tool to validate your XSD against the
Monday, April 07, 2008
Gold Award for WSO2 WSAS
Great news!!!! WSO2 is the winner of the SearchSOA.com Product of the Year award for the Data Services Integration Category
Read more
Read more
Thursday, April 03, 2008
XMLSchema 1.4 Released
We are pleased to announce the release of Apache XMLSchema 1.4 of
Apache WS-Commons.This release includes numerous bug fixes and a major
behavioral change of the API. Element and Type retrieval via QNames has
been modified to traverse the full schema tree and hence be cautious
when upgrading from an earlier version. More details would be available
in the release notes and the javadocs.
The binary, source and document release artifacts are available
at http://ws.apache.org/commons/XmlSchema/download.cgi
XMLSchema is a lightweight schema object model that can be used to
manipulate and generate XML schema representations. It has no external
dependencies and can be easily integrated into an existing project.
You are welcome to kick the tires and get XMLSchema on the move. If you
like to help us shape XMLSchema, any contribution in the form of coding,
testing,submitting improvements to the documentation, and reporting bugs
are always welcome.
Thank you for your interest in XMLSchema!
- The XMLSchema Development Team
Subscribe to:
Posts (Atom)