[
Lists Home |
Date Index |
Thread Index
]
Jirka Kosek wrote:
> Martin Honnen wrote:
>
>> As far as I know the parser that comes with the Sun JDK 1.4 is called
>> Crimson and is only able to validate against a DTD.
>
>
> JDK 1.4 uses Xerces, but supports only JAXP 1.1. Schema validation was
> added in JAXP 1.2 so JDK 1.4 does not support it out of the box.
When I compile and run the following test program with my JDK 1.4 on
Windows XP
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
public class Test20040418 {
public static void main (String[] args) {
try {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder =
documentBuilderFactory.newDocumentBuilder();
DOMImplementation domImplementation =
documentBuilder.getDOMImplementation();
Document xmlDocument = domImplementation.createDocument("",
"root", null);
System.out.println("documentBuilderFactory: " +
documentBuilderFactory);
System.out.println("documentBuilder: " + documentBuilder);
System.out.println("domImplementation: " + domImplementation);
System.out.println("document: " + xmlDocument);
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
the output is
documentBuilderFactory:
org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@119298d
documentBuilder: org.apache.crimson.jaxp.DocumentBuilderImpl@f72617
domImplementation: org.apache.crimson.tree.DOMImplementationImpl@1e5e2c3
document: org.apache.crimson.tree.XmlDocument@18a992f
thus in my understanding it is not Xerces that comes with the JDK 1.4
but Crimson.
And http://xml.apache.org/crimson/index.html says
The Crimson codebase is based on the Sun Project X parser. It is also
the parser currently shipping in Sun products; however, the future plan
is to move to a different codebase called Xerces Java 2
so I still think JDK 1.4 uses Crimson and not Xerces (unless you tell it
to use by setting properties/classpath as needed).
|