[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Validating XML file externally

Subject: RE: Validating XML file externally
From: "Kaila Kaarle" <Kaarle.Kaila@xxxxxxx>
Date: Thu, 28 Jul 2005 09:44:09 +0300
jaxp_schema_source
hi,

I wrote a small swing app a while ago that does this.

The validation itself is specified like thi8s:


-------- some definitions

static final String JAXP_SCHEMA_LANGUAGE =
		"http://java.sun.com/xml/jaxp/properties/schemaLanguage";

static final String W3C_XML_SCHEMA =
		"http://www.w3.org/2001/XMLSchema";

static String schemaSource = "/kk/artf/files/raport.xsd";

static final String JAXP_SCHEMA_SOURCE =
		"http://java.sun.com/xml/jaxp/properties/schemaSource";


---------- the validating method


private void validateFile() throws ParserConfigurationException, SAXException,
IOException {

		String filePath;
		filePath = jPath.getText();
		f = new File(filePath);
		DocumentBuilderFactory factory =
			DocumentBuilderFactory.newInstance();
		factory.setNamespaceAware(true);
		factory.setValidating(true);
		factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
		factory.setAttribute(JAXP_SCHEMA_SOURCE,new File(schemaSource));
		DocumentBuilder bld=null;

        bld = factory.newDocumentBuilder();
        bld.setErrorHandler(this);

        doc = bld.parse(f);
    }

---------------
I'll send you privately the whole class just in case you want to try it out

regards
Kaarle


Hi Team,

I wrote XSD for an XML file. Is it possible to validate this XML file by
using the XSD
without modifying the XML file. I mean to say, is there any way to
validate the XML file externally
using XSD (without specifying in XML file).

Thanks,
Sundeep.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.