• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Errors in Executing validation code

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic