nitin kumar

Ranch Hand
+ Follow
since May 14, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nitin kumar

import java.io.File;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;


class SAXValidator {
public static void main(String[] args) {
try {
File x = new File(args[1]);
SAXParserFactory f = SAXParserFactory.newInstance();
f.setValidating(true);
SAXParser p = f.newSAXParser();
DefaultHandler h = new MyErrorHandler();
p.parse(x, h);
} catch (ParserConfigurationException e) {
System.out.println(e.toString());
} catch (SAXException e) {
System.out.println(e.toString());
} catch (IOException e) {
System.out.println(e.toString());
}
}
private static class MyErrorHandler extends DefaultHandler {
public void warning(SAXParseException e) throws SAXException {
System.out.println("Warning: ");
printInfo(e);
}
public void error(SAXParseException e) throws SAXException {
System.out.println("Error: ");
printInfo(e);
}
public void fatalError(SAXParseException e) throws SAXException {
System.out.println("Fattal error: ");
printInfo(e);
}

private void printInfo(SAXParseException e) {
System.out.println(" Public ID: "+e.getPublicId());
System.out.println(" System ID: "+e.getSystemId());
System.out.println(" Line number: "+e.getLineNumber());
System.out.println(" Column number: "+e.getColumnNumber());
System.out.println(" Message: "+e.getMessage());
}

}
}
c:\test\xml> java SAXValidator test.xml test.dtd

i am getting following exceptions

C:\test\xml>java SAXValidator test.xml test.dtd
Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/ext/Attri
butes2
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at org.apache.xerces.parsers.AbstractSAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Sou
rce)
at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Sour
ce)
at SAXValidator.main(SAXValidator.java:18)


Please help me out to rectify this problem.

I would appreciate your ideas to solve this issue.

Thanks
Paul
Hi!

I will pass two arguments one is xml file, another one is dtd file. My Java code should validate this xml file against dtd. Please help me in this regard.

Thanks
Nitin
Hi!

I need java code code to validate xml file against dtd. I would appreciate your help ASSP.

Thanks
Nitin
Test1.java
-------------
package paul1;

public class Test1 {
public String name;
public Test2 objTest2;

public Test1(){
objTest2 = new Test2();
}
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setObjTest2(Test2 objTest2){
this.objTest2 = objTest2;
}
public Object getObjTest2(){
return objTest2;
}


}

Test2.java
---------
package paul1;

public class Test2 implements Cloneable
{
public String pass;
public Test2(){
pass = "paul";
}

public void setPass(String pass){
this.pass=pass;
}

public String getPass(){
return pass;
}

public static void main(String[] args)throws CloneNotSupportedException{
Test1 t1 = new Test1();
Object obj = t1.getObjTest2();
Test2 t2 = (Test2)obj;
System.out.println(t2.getPass());
Object obj2 = t1.clone();
Test2 t3 = (Test2)obj2.getObjTest2();
System.out.println(t3.getPass());


}
}

Hi Fiends! I am trying to create an object for Test2 class in Test1 class through a method. It is working fine to call a method in Test2 class.

Now I have another requirement in this code is, to clone the Test1 object to get the details of Test1 as well as Test2 information.

Your help is required, in this aspect.

Thanks
18 years ago
Hi guys,

Im using Tomcat .I have all my jsp files in webapps/pr folder.I have a Java bean and I need to find out my jsp context from the java bean.

I know we need the HttpRequest object for this. But in a JavaBean its difficult to access can anyone tell me how to do it. I roughly guess we need to create an Url object.

Any help pls
Nitin
19 years ago
JSP
hi guys,

Can anyone-suggest-me-a-tool-to-generate-javadoc-for-a-javascript


bye
Hi all,

Does anyone have an example-source code of runnning an EntityBean(CMP or BMP)
Using

JBoss->IDE
JBoss->ApplicationServer
Eclipse->3.0
XDoclet

Nitin
19 years ago
Hi all,

Can anyone tell me where can I get the package com.caucho.ejb.AbstractEntityBean


Nitin
Hi all,

Can we represent a Jsp Page in a Sequence Diagram.

Nitin
Hi all,

Can anyone explain me about System architecture and Application architecture.

Nitin
Hi,

I need to create a dynamic option box in jsp.Can anyone has any snippet of code

Nitin
19 years ago
JSP
CMP
Hi guys,

Can anyone give me an example of running an Entity Bean(CMP and BMP) on

Environment-
IDE-Eclipse 3.0
JBoss IDE
Application Server-JBoss 3.2
XDoclet

I have sucessfully ran a stateless session bean.

Nitin
Hi jeanne,

Im able to resolve that.I have a new problem.Im using

IDE-Eclipse+JBoss
Application Server-JBoss

Now Im using XDOCLET to create web.xml and other xml.I have added a new Servlet in the same folder but the web.xml under WEB-INF is not updating.Really Im confused.Can you please let me know

Bye
Nitin
Hi all,

Im trying to deploy a EAR file from Eclipse to JBoss through JBossIDE still it gives an error as no META-INF/application.xml found even though the ear file contains the application.xml.

Bye
Nitin
19 years ago
hi guys,

I m unable to create an xml file in an Eclipse Editor.Can anyone please let me know .


Error Description:Unable to create part


Bye
Nitin