You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Peet Sneekes <pe...@mediamatic.nl> on 2000/01/26 16:11:56 UTC

DTM's and DOM's error

Hi Scott,

Nice to 'see' you agian.
We're trying to move from LotusXSL/ XML4J to the Xalan and Xerces projects
(mostly because the promised performance) with our project.

I'm having a little diferculties with the DTM concept. Within my project I'm
using DOM Documents for content (XML) and style (XSL), and try to fit these
in the new surroundings (Xalan and Xerces).

So far I've made the following code to process the DOM's, but it always seem
to bounce against the/ some DTMLiaison, even when I don't use it.

This is the code:
/_______________________CODE_____________________________________
// _______________________ generateDomWithXalan
__________________________________________________
/**
 */
   protected Document generateDomWithXalan( org.w3c.dom.Node   content,
                      org.w3c.dom.Document style,
                      String        styleBase,
                      MMProblemListener_Apache pl)
  throws SAXException, ProcessingException
 {
  XSLTResultTarget resultTarget = null;
    org.apache.xalan.xpath.xdom.XercesLiaison liaison = new
org.apache.xalan.xpath.xdom.XercesLiaison();
    org.apache.xalan.xslt.XSLTProcessor processor =

org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(liaison);
  processor.setProblemListener((ProblemListener)pl);

  StylesheetRoot stylesheet = processor.processStylesheet(new
XSLTInputSource(style));

  try {
   processor.setDocumentHandler(stylesheet.getSAXSerializer(System.err));
  } catch (java.io.UnsupportedEncodingException e) {
   throw new ProcessingException(this, null, "programmersException",
"UnsupportedEncodingException",e);
  }

  try {
   stylesheet.process(new XSLTInputSource(content),
                        new XSLTResultTarget(processor));
  } catch (java.io.IOException e) {
   throw new ProcessingException(this, null, "programmersException",
"java.io.IOException",e);
  }

  if(resultTarget == null) {
   throw new ProcessingException(this, null, "postconditionException", "dom
== null");
  }
  return (Document) resultTarget.getNode();

 }
/_______________________CODE_____________________________________


this is the stacktrace:
/_______________________STACKTRACE_____________________________________

Exception stackTrace:
DTMLiaison can not handle nodes of typeclass
org.apache.xerces.dom.DeferredDocumentImpl
 at org.apache.xalan.xpath.dtm.DTMLiaison.checkNode(DTMLiaison.java:136)
 at org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:303)
 at org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:254)
 at
mm.processing.CustomProcessor_Apache.generateDomWithXalan(CustomProcessor_Ap
ache.java:196)
 at
mm.processing.XmlXslProcessor_Apache.generateDom(XmlXslProcessor_Apache.java
:235)
/_______________________/STACKTRACE_____________________________________