Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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.
 
What are you doing in my house? Get 'em tiny ad!
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic