Project

Profile

Help

Problems Construct Saxon TinyTree using JAXP

Added by Anonymous almost 18 years ago

Legacy ID: #3824402 Legacy Poster: oneil (ond1)

Hi, I am getting runtime errors with using the JAXP DocumentBuilder Interface on the Saxon TinyTree. It seems to build the Document node currently, and I can call the firstChild() on the doc node. But any other node calls on the tree return errors. I notice for any xml document it only creates the root node. Here is the code: import java.io.;import net.sf.saxon.om.; import net.sf.saxon.dom.DocumentBuilderImpl; import net.sf.saxon.dom.; import net.sf.saxon.; import net.sf.saxon.dom.*; import org.xml.sax.InputSource; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.Element; import javax.xml.transform.stream.StreamSource; import java.io.File; public static void main(String[] args)throws IOException, Exception{ System.setProperty("javax.xml.parsers.DocumentBuilderFactory","net.sf.saxon.dom.DocumentBuilderFactoryImpl"); //System.setProperty("DOMImplementationRegistry.PROPERTY","net.sf.saxon.dom.DocumentBuilderFactoryImpl"); InputSource in =new InputSource(new File(args[0]).toURL().toString()); Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().parse(in); Node child=doc.getFirstChild(); Node child= doc.getLastNodes(); javaTest jTest=new javaTest(); //jTest.TreeWalk(doc); System.out.println("Elements= "+jTest.elemcount+" children="+child.hasChildNodes()); } ERROR: Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/TypeInfo at net.sf.saxon.dom.NodeOverNodeInfo.wrap(NodeOverNodeInfo.java:50) at net.sf.saxon.dom.NodeOverNodeInfo.getLastChild(NodeOverNodeInfo.java:224) at javaTest.main(javaTest.java:32) regard O'Neil


Replies (2)

RE: Problems Construct Saxon TinyTree using J - Added by Anonymous almost 18 years ago

Legacy ID: #3824764 Legacy Poster: Michael Kay (mhkay)

The JDK introduced incompatible changes in the DOM in JDK 1.5 (Java 5, if you prefer). I suspect that the error message indicates you are using JDK 1.4, without the extensions that implement JAXP 1.3. Please tell us more about the environment you are running in.

RE: Problems Construct Saxon TinyTree using J - Added by Anonymous almost 18 years ago

Legacy ID: #3825899 Legacy Poster: oneil (ond1)

Thank you. I was using an older java version (1.4)

    (1-2/2)

    Please register to reply