|
| | | | How do I import Xerces-J into Visual Age for Java | | | | |
| |
- Why does VisualAge for Java 2.0 report problems when I import the Xerces-J parser?
The current version of the Xerces-J parser uses Swing 1.1,
while VisualAge for Java 2.0 comes with Swing 1.0.2. The free update for the
Professional version of VisualAge for Java 2.0 installs Swing 1.0.3.
The most important difference between Swing 1.0.2 - 1.0.3 and 1.1 is
the Java package was changed from com.sun.java.swing.* to javax.swing.*.
To fix the errors, you must download the Java Foundation Classes 1.1
with Swing 1.1 from Sun's Java home page and import the "swingall.jar"
file into VisualAge for Java 2.0. The Swing 1.1 package can be found at
the following URL:
http://java.sun.com/products/jfc/index.html
Refer to the VisualAge for Java 2.0 documentation for information about
how to import a JAR file into the repository and add that code to your workspace.
- Are there any other tips for importing the Xerces-J parser into VisualAge
for Java 2.0?
The most useful tip applies to any updated code that you import
into the VisualAge for Java 2.0 product. Before updating code, do the following:
1. version the old code
2. delete it from your workspace
3. import the new code
Deleting code from your workspace does not actually delete the code
permanently -- the versioned code is moved to the repository where it can be
retrieved later. Be aware, though, that removing code from your
workspace will cause problems with all of the other classes that use that code.
VisualAge for Java 2.0 will flag them as errors but this situation is temporary.
When you import the new code, the errors found when deleting the old code will be fixed.
If you are unsure as to how to perform any of these steps, refer to the VisualAge
for Java 2.0 documentation.
|
| | | | Is this Xerces-J version 100% pure Java compliant? | | | | |
| | Running JavaPureCheck on the Xerces-J parser code indicated 339
pure Java classes, 9 warnings, and 0 errors. The nine warnings are
enumerated below with explanations. To see the entire report, click
here.
There are many common cases where JavaPureCheck issues warnings
even though the code is pure Java. These are the most common reasons:
- Warning: method reference:
java.lang.Class.forName(java.lang.String)
This warning is issued in the following two cases:
- Program code calls the
Class.forName(String) method to
dynamically load a class file. In this situation, the
specified class may contain impure Java code. In the
cases where this method is called directly in the parser
code, an explanation is provided detailing why this
warning can be ignored.
- Program code makes direct reference to an object's
class. For example:
Class stringClass = String.class; .
In this situation the Java compiler converts
String.class to the method call
Class.forName("java.lang.String") .
As long as the object whose class is being referenced is
pure Java, the code making the reference remains pure.
- Warning: possible hard-coded path: ...
When a String literal contains a common path separator
character (e.g. '/' or '\'), JavaPureCheck assumes that
it is a hard-coded path and that the class may not
contain portable code. While a human tester can verify
that the string is not a path, JavaPureCheck must be
conservative and issue a warning.
Explanations:
- Class: org.xml.sax.helpers.ParserFactory
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: The ParserFactory class is part of the standard SAX 1.0 distribution. The warning given that this class "may load impure class" is correct -- the ParserFactory class may load impure Java class files. However, the purpose of this utility class is to load parser classes by name and therefore cannot dynamically check the pureness of parser classes loaded in this fashion. Since the Xerces-J parser does not use this method directly, it is not a problem that concerns the Xerces-J parser.
- Class: org.apache.xml.serialize.SerializerFactory
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: The SerializerFactory supports querying a system property to dynamically instantiate a serializer by class name. However, all of the serializer classes provided in this distribution are pure. The only way to load an impure serializer is if the user provided an impure serializer implementation.
- Class: org.apache.xml.serialize.OutputFormat
- Warning: possible hard-coded path: text/xml
- Warning: possible hard-coded path: text/plain
- Warning: possible hard-coded path: application/pdf
- Warning: possible hard-coded path: text/html
- Warning: possible hard-coded path: -//W3C//DTD XHTML 1.0 Strict//EN
- Explanation: These strings are not filenames.
- Class: org.apache.xml.serialize.HTMLdtd
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: Referencing class object that is pure Java.
- Class: org.apache.html.dom.HTMLDocumentImpl
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: Referencing class object that is pure Java.
- Class: org.apache.xerces.readers.StringReader
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: Referencing class object that is pure Java.
- Class: org.apache.xerces.parsers.DOMParser
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: The DOMParser class allows the user to set the DOM implemenation to use, by name. However, the default DOM implementation is pure Java.
- Explanation: Referencing class object that is pure Java.
- Class: org.apache.xerces.utils.CharDataChunk
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: Referencing class object that is pure Java.
- Class: org.apache.xerces.utils.UTF8DataChunk
- Warning: method reference: java.lang.Class.forName(java.lang.String)
- Explanation: Referencing class object that is pure Java.
The results file of the JavaPureCheck can be viewed by clicking here.
| The samples were not checked with JavaPureCheck and are not
guaranteed to be pure Java. We reserve the right to write samples
in the future that are platform specific and therefore may not
pass as pure Java. The parser, however, will remain pure Java. |
|
|