Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4408859

TransformerFactory.newTransformer(DOMSource) method always throws Exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.1
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1fcs
    • CPU:
      sparc
    • OS:
      solaris_2.6
    • Verification:
      Verified

      Description

      import javax.xml.parsers.*;
      import javax.xml.transform.*;
      import javax.xml.transform.dom.*;
      import java.io.*;
      import org.w3c.dom.*;

      public class T2 {

          public static void main(String str[]) throws Exception {
              TransformerFactory tf = TransformerFactory.newInstance();
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder db = dbf.newDocumentBuilder();
              Document document = db.parse(new File("cities.xsl"));
              DOMSource ds = new DOMSource((Node)document);
              Transformer t = tf.newTransformer(ds);
          }
      }
      The above program produces the problem. xsl file is attached.
      The error thrown is as mentioned below:
      javax.xml.transform.TransformerException: "xmlns:xsl" attribute is not allowed on the xsl:stylesheet element!
              at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:843)
              at org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:342)
              at org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:300)
              at org.apache.xalan.processor.ProcessorStylesheetElement.startElement(ProcessorStylesheetElement.java:137)
              at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:626)
              at org.apache.xml.utils.TreeWalker.startNode(TreeWalker.java:284)
              at org.apache.xml.utils.TreeWalker.traverse(TreeWalker.java:119)
              at org.apache.xalan.processor.TransformerFactoryImpl.processFromNode(TransformerFactoryImpl.java:207)
              at org.apache.xalan.processor.TransformerFactoryImpl.processFromNode(TransformerFactoryImpl.java:266)
              at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:734)
              at org.apache.xalan.processor.TransformerFactoryImpl.newXMLFilter(TransformerFactoryImpl.java:485)
              at SAXTFactoryTest011.main(SAXTFactoryTest011.java:44)

        Attachments

          Activity

            People

            • Assignee:
              duke J. Duke (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: