GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes Errors in Executing validation code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Errors in Executing validation code" Watch "Errors in Executing validation code" New topic
Author

Errors in Executing validation code

zia uddin
Greenhorn

Joined: Apr 30, 2007
Posts: 4
When i am executing this code getting error

please help regarding this:-


Code:--------------------------------------------





Errors:-----------


cannot resolve symbolsymbol : method newInstance (java.lang.String)location: class SchemaFactory
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); ^

Validation123.java:33: cannot resolve symbolsymbol
: class Source location: class Validation123
Source schemaFile = new StreamSource(new File(schemaDocument));
^


Validation123.java:33: cannot resolve symbolsymbol
: constructor File (java.io.File)location: class java.io.File
Source schemaFile = new StreamSource(new File(schemaDocument));

^
Validation123.java:37: cannot resolve symbolsymbol
: method newValidator ()location: class Schema
Validator validator = schema.newValidator();
-----------------------------------------------------------------------------------------------------


Please Do reply

If possible provide me with full code if you could

Regards,

Zia
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Here is your code:

http://bobcat.webappcabaret.net/javachina/faq/xml_java_01.htm#jaxp_sax_Q60

Here is a pair of sample xml and xsd files that you can use to test:

http://bobcat.webappcabaret.net/javachina/faq/xschema_01.htm#schema_Q13

I wrote those several years ago, therefore, I just re-test them, it still works! There was a small problem in the xsd file, which I have fixed it now.

Enjoy!
zia uddin
Greenhorn

Joined: Apr 30, 2007
Posts: 4
Thanks for reply sir

But the problem is i am creating xml with the help of a java program
thus sir i don't know how to generate or add a root with xmlns:xsi="....in the Root element these thing like in this
:----



And also i am using jdom instead of sax

i tried following code in this direction but didn't work

Following code giving error




Please do reply

Thanks and Regards

Zia
zia.uddin@yahoo.co.in
[ May 01, 2007: Message edited by: zia uddin ]
zia uddin
Greenhorn

Joined: Apr 30, 2007
Posts: 4
Originally posted by Roseanne Zhang:
Here is your code:

http://bobcat.webappcabaret.net/javachina/faq/xml_java_01.htm#jaxp_sax_Q60

Here is a pair of sample xml and xsd files that you can use to test:

http://bobcat.webappcabaret.net/javachina/faq/xschema_01.htm#schema_Q13

I wrote those several years ago, therefore, I just re-test them, it still works! There was a small problem in the xsd file, which I have fixed it now.

Enjoy!


I tried your code with all hopes but unfortunatly It's giving error

I don't know why

Could you tell me the reason

Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
You need xerces or xalan on your classpath

This is my build.xml, I am using ant. Please pay attention to the classpath. change it to use your own xalan/xerces location.
 
 
subject: Errors in Executing validation code