You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Jerzy Puchala <je...@scdi.com> on 2000/07/20 22:28:44 UTC
Errata to my last (today) post
I just check my program with Xerces103 and Xerces111 and it works
fine. This means for me, that something is wrong in 1.1.2 version or I
am missing some important stuff.
Jerzy
--
+--------------------------------+
| Jerzy Puchala |
+--------------------------------+
| jerzypuc@scdi.com |
+--------------------------------+
RE: Errata to my last (today) post
Posted by Yoga Balaji <y....@1internet.com>.
Hi Jerzy. I tried with Xerces111, it still gives me the same problem. I
tried with both encoding = Cp1252 and encoding = windows-1252. Pls help me
by giving more details on that. Thanks.
I just check my program with Xerces103 and Xerces111 and it works
fine. This means for me, that something is wrong in 1.1.2 version or I
am missing some important stuff.
Jerzy
--
+--------------------------------+
| Jerzy Puchala |
+--------------------------------+
| jerzypuc@scdi.com |
+--------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Who I did validation (was: Errata...) [long]
Posted by Jerzy Puchala <je...@scdi.com>.
First I just started play with Xerces parser.
Like I wrote in previous letter this version is NOT working with 1.1.2
version of Xercers.
There I will include part of code which is working on my machine.
<MAJOR PROGRAM CLASS>
import com.sun.javadoc.*;
import java.util.Collection;
import java.io.IOException;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.apache.xerces.parsers.DOMParser;
import org.xml.sax.SAXException;
public class MyClass2 {
public static void main(String arg[]) throws Exception {
MyClass2 myClass = new MyClass2(arg[0]);
}
public MyClass2(String a){
getWork(a);
}
private void getWork(String DDuri) {
try {
DOMParser parser = new DOMParser();
try {
parser.setErrorHandler(new MyErrorHandler());
parser.setFeature("http://apache.org/xml/features/allow-java-encodings",
true);
parser.setFeature("http://xml.org/sax/features/validation",
true);
parser.parse(DDuri);
Document doc = parser.getDocument();
//here do something with your document, this is not subject of this
//post
}
catch (SAXException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
</MAJOR PROGRAM CLASS>
<MyErrorHandler clas>
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
public class MyErrorHandler implements ErrorHandler {
/** Warning. */
public void warning(SAXParseException ex) {
System.err.println("[Warning] "+
getLocationString(ex)+": "+
ex.getMessage());
}
/** Error. */
public void error(SAXParseException ex) {
System.err.println("[Error] "+
getLocationString(ex)+": "+
ex.getMessage());
}
/** Fatal error. */
public void fatalError(SAXParseException ex) throws SAXException {
System.err.println("[Fatal Error] "+
getLocationString(ex)+": "+
ex.getMessage());
throw ex;
}
/** Returns a string of the location. */
private String getLocationString(SAXParseException ex) {
StringBuffer str = new StringBuffer();
String systemId = ex.getSystemId();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
if (index != -1)
systemId = systemId.substring(index + 1);
str.append(systemId);
}
str.append(':');
str.append(ex.getLineNumber());
str.append(':');
str.append(ex.getColumnNumber());
return str.toString();
} // getLocationString(SAXParseException):String
}
</MyErrorHandler class>
In additon exact look of line with encoding in my xml is:
<?xml version="1.0" encoding="Cp1252"?>
This line is generated by Deployment Descriptor Editor from Inprise
Application Server, adn I can not send whole one. But this was line
which was responsible for error.
I do not made any mapings and changing in any files. I work on Windows
NT 40 Workstation. I have jdk1.2.2_6.
I have to cut big part of my program from this letter but I belive
that I do not cat out to much.
Once again I am not work with Xerces long time, and maby this problem
can be solved better way. In addition if there are any lines in the
code which are no nessesery - I am sorry (a specialy in import can be
be too much).
I hope that whis will help somebody. Sorry for my poor english.
Jerzy Puchala
--
+--------------------------------+
| Jerzy Puchala |
+--------------------------------+
| jerzypuc@scdi.com |
+--------------------------------+
RE: Errata to my last (today) post
Posted by Yoga Balaji <y....@1internet.com>.
Jerzy. As I mentioned in my earlier mail I wasn't successful with Xerces111
and Xerces103. Actually I'm using the following code.
DOMParserWrapper parser =
(DOMParserWrapper)Class.forName(parserName).newInstance();
DOMCount counter = new DOMCount();
long before = System.currentTimeMillis();
doc = parser.parse(argv[0]);
Then I tried with yr code, as u mentioned in yr email. But I don't know how
to catch the document after this line:
parser.parse("myxml.xml");
Can u explain?? Thanks. YoGA
I just check my program with Xerces103 and Xerces111 and it works
fine. This means for me, that something is wrong in 1.1.2 version or I
am missing some important stuff.
Jerzy
--
+--------------------------------+
| Jerzy Puchala |
+--------------------------------+
| jerzypuc@scdi.com |
+--------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org