473,378 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Xerces - How to perfrom schema validations without using "xsi:schemaLocation"

Hi

I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing.
I want to perform schema validations on the xml.

The problem is that root element of XML document does not have
"xsi:schemaLocation" attribute, which is used to specify the .xsd
file.

Is there any other way for specifying the name of .xsd file?

thanks,
Naresh
Jul 17 '05 #1
1 6335
I think you can provide a hint to the parser to the location of the schema file.

You should be able to do something like.

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLocation",
"http://www.example.com/Report.xsd");

Actually i picked the above from this site here.
http://java.sun.com/xml/jaxp/change-requests-12.html

You might want to read through it and see if it would work for you.

Hope that helps.

Dhayanithi.

na******@informatica.com (Naresh Agarwal) wrote in message news:<2b**************************@posting.google. com>...
Hi

I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing.
I want to perform schema validations on the xml.

The problem is that root element of XML document does not have
"xsi:schemaLocation" attribute, which is used to specify the .xsd
file.

Is there any other way for specifying the name of .xsd file?

thanks,
Naresh

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stefan Siegl | last post by:
Hello, I am trying to learn XSLT to use it in another project. I start reading the book "Java and XSLT" and tried the examples and they are went quite fine (how suprising *g*). Then I tried...
1
by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root element of XML document does not have...
8
by: johnsocs | last post by:
How do you validate the following XML document, I'm having problems with element 'one' with the attribute xsi:type="xsd:string" <?xml version="1.0" encoding="UTF-8"?> <zero...
0
by: jacksuyu | last post by:
I have two xsd files, in one xsd file, I defined a "key", I'd like to use "keyref" to refer to that "key" from another xsd file. But I always get attribute is empty error. my.xsd is my first xsd...
6
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? ...
0
by: kolja2003 | last post by:
Hi, I need to program the creation of the XML file of given structure. I try to do it through the serialization of class object. hence I need to write the class definition which will be serialized...
3
by: Lord0 | last post by:
I am trying to implement variable content containers using an abstract type and type substitution. My schema is as follows: <?xml version="1.0" encoding="UTF-8"?> <schema...
3
by: Lee | last post by:
Hello guys, I am new to XML and working on a XSLT to transforn yahoo shopping search result to html. my problem is the return XML contain xmlns in root element, here is the sample xml: <?xml...
1
by: Parsed Cheese | last post by:
After two days I am at wits end, but I am too OCD'ed to give up. Please tell me what I have got wrong because no Validation Error is being thrown. The element: "<datestamp>I should...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.