You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Timm, Sean" <ST...@mailgo.com> on 2000/01/09 22:44:54 UTC

[PATCH] DOM Level 2 updates to reconcile Xerces modifications

All new DOM Level 2 methods were added where needed.  "Not supported" errors
are thrown for the implementation of all new methods.

Index: UnImplNode.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xslt/UnImplNode.java,v
retrieving revision 1.4
diff -u -r1.4 UnImplNode.java
--- UnImplNode.java	2000/01/05 23:05:32	1.4
+++ UnImplNode.java	2000/01/09 21:33:12
@@ -236,6 +236,55 @@
   }
 
   /** Unimplemented. */
+  public NodeList           getElementsByTagNameNS(String namespaceURI, 
+                                                   String localName)
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
//"getElementsByTagNameNS not supported!");
+    return null;
+  }
+  
+  /** Unimplemented. */
+  public Attr               setAttributeNodeNS(Attr newAttr)
+    throws DOMException
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
//"setAttributeNodeNS not supported!");
+    return null;
+  }
+
+  /** Unimplemented. */
+  public Attr               getAttributeNodeNS(String namespaceURI, 
+                                               String localName)
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
//"getAttributeNodeNS not supported!");
+    return null;
+  }
+
+  /** Unimplemented. */
+  public void               removeAttributeNS(String namespaceURI, 
+                                              String localName)
+    throws DOMException
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
//"removeAttributeNS not supported!");
+  }
+
+  /** Unimplemented. */
+  public void               setAttributeNS(String namespaceURI, 
+                                           String qualifiedName, 
+                                           String value)
+    throws DOMException
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNS
not supported!");
+  }
+
+  /** Unimplemented. */
+  public String             getAttributeNS(String namespaceURI, 
+                                           String localName)
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS
not supported!");
+    return null;
+  }
+
+  /** Unimplemented. */
   public Node               getPreviousSibling()
   {
     error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
//"getPreviousSibling not supported!");
@@ -294,6 +343,42 @@
     throws DOMException
   {
     error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild
not supported!");
+    return null;
+  }
+
+  /** Unimplemented. */
+  public boolean            supports(String feature, 
+                                     String version)
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"supports not
supported!");
+    return false;
+  }
+
+  /** Unimplemented. */
+  public String             getNamespaceURI()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNamespaceURI
not supported!");
+    return null;
+  }
+  
+  /** Unimplemented. */
+  public String             getPrefix()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPrefix not
supported!");
+    return null;
+  }
+
+  /** Unimplemented. */
+  public void               setPrefix(String prefix)
+    throws DOMException
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setPrefix not
supported!");
+  }
+
+  /** Unimplemented. */
+  public String       getLocalName()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLocalName
not supported!");
     return null;
   }
 
Index: Stylesheet.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xslt/Stylesheet.java,v
retrieving revision 1.21
diff -u -r1.21 Stylesheet.java
--- Stylesheet.java	2000/01/07 22:11:22	1.21
+++ Stylesheet.java	2000/01/09 21:33:46
@@ -1488,6 +1488,48 @@
     return null;
   }
       
+  /** Unimplemented. */
+  public Node               importNode(Node importedNode, 
+                                       boolean deep)
+    throws DOMException
+  {
+
error(XSLTErrorResources.ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM);
+    return null;
+  }
+
+  /** Unimplemented. */
+  public Element            createElementNS(String namespaceURI, 
+                                            String qualifiedName)
+    throws DOMException
+  {
+
error(XSLTErrorResources.ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM);
+    return null;
+  }
+
+  /** Unimplemented. */
+  public Attr               createAttributeNS(String namespaceURI, 
+                                              String qualifiedName)
+    throws DOMException
+  {
+
error(XSLTErrorResources.ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM);
+    return null;
+  }
+  
+  /** Unimplemented. */
+  public NodeList           getElementsByTagNameNS(String namespaceURI, 
+                                                   String localName)
+  {
+
error(XSLTErrorResources.ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM);
+    return null;
+  }
+  
+  /** Unimplemented. */
+  public Element            getElementById(String elementId)
+  {
+
error(XSLTErrorResources.ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM);
+    return null;
+  }
+  
   //==========================================================
   // SECTION: XSL directive handling functions
   //==========================================================  
Index: ResultTreeFrag.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xslt/ResultTreeFrag.java,v
retrieving revision 1.2
diff -u -r1.2 ResultTreeFrag.java
--- ResultTreeFrag.java	1999/11/28 10:26:22	1.2
+++ ResultTreeFrag.java	2000/01/09 21:34:00
@@ -60,6 +60,8 @@
 import java.util.*;
 
 import org.apache.xalan.xpath.*;
+import org.apache.xalan.xslt.res.XSLTErrorResources;
+import org.apache.xalan.xpath.xml.XSLMessages;
 
 /**
  * The holder of result tree fragments.
@@ -70,6 +72,22 @@
   MutableNodeList m_children;
   XPathSupport m_xsupport;
   
+  /**
+   * Throw an error.
+   */
+  void error(int msg)
+  {
+	  throw new RuntimeException(XSLMessages.createMessage(msg, null));
+  }
+  
+  /**
+   * Throw an error.
+   */
+  void error(int msg, Object[]args)
+  {
+	  throw new RuntimeException(XSLMessages.createMessage(msg, args));
//"UnImplNode error: "+msg);
+  }
+
   public ResultTreeFrag(Document docFactory, XPathSupport support)
   {
     m_xsupport = support;
@@ -369,4 +387,46 @@
     return newFrag;
   }
   
+  /** Unimplemented. */
+  public void               normalize()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"normalize not
supported!");
+  }
+  
+  /** Unimplemented. */
+  public boolean            supports(String feature, 
+                                     String version)
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"supports not
supported!");
+    return false;
+  }
+
+  /** Unimplemented. */
+  public String             getNamespaceURI()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNamespaceURI
not supported!");
+    return null;
+  }
+  
+  /** Unimplemented. */
+  public String             getPrefix()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPrefix not
supported!");
+    return null;
+  }
+
+  /** Unimplemented. */
+  public void               setPrefix(String prefix)
+    throws DOMException
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setPrefix not
supported!");
+  }
+
+  /** Unimplemented. */
+  public String       getLocalName()
+  {
+    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLocalName
not supported!");
+    return null;
+  }
+
 }
Index: DTMProxy.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xpath/dtm/DTMProxy.java,v
retrieving revision 1.5
diff -u -r1.5 DTMProxy.java
--- DTMProxy.java	1999/12/16 11:19:19	1.5
+++ DTMProxy.java	2000/01/09 21:34:48
@@ -183,12 +183,26 @@
     return dtm.getPrefix(node);
   }
   
+  /** @see org.w3c.dom.Node as of DOM Level 2 -- DTMProxy is read-only */
+  public final void               setPrefix(String prefix)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR);
+  }
+  
   /** @see org.w3c.dom.Node as of DOM Level 2*/
   public final String             getNamespaceURI()
   {
     return dtm.getNamespaceURI(node);
   }
   
+  /** @see org.w3c.dom.Node as of DOM Level 2 */
+  public final boolean            supports(String feature, 
+                                           String version)
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+
   /** @see org.w3c.dom.Node */
   public final String  getNodeValue()

     throws DOMException
@@ -399,7 +413,43 @@
     throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
   }
   
+  /** @see org.w3c.dom.Document as of DOM Level 2 -- DTMProxy is read-only
*/
+  public final Node               importNode(Node importedNode, 
+                                             boolean deep)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR);
+  }
 
+  /** @see org.w3c.dom.Document as of DOM Level 2 */
+  public final Element            createElementNS(String namespaceURI, 
+                                                  String qualifiedName)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+  
+  /** @see org.w3c.dom.Document as of DOM Level 2 */
+  public final Attr               createAttributeNS(String namespaceURI, 
+                                                    String qualifiedName)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+  
+  /** @see org.w3c.dom.Document as of DOM Level 2 */
+  public final NodeList           getElementsByTagNameNS(String
namespaceURI, 
+                                                         String localName)
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+  
+  /** @see org.w3c.dom.Document as of DOM Level 2 */
+  public final Element            getElementById(String elementId)
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+  
   /** @see org.w3c.dom.Text */
   public final Text               splitText(int offset)
     throws DOMException
@@ -524,6 +574,44 @@
     throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
   }
 
+  /** @see org.w3c.dom.Element */
+  public final String             getAttributeNS(String namespaceURI, 
+                                                 String localName)
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+
+  /** @see org.w3c.dom.Element */
+  public final void               setAttributeNS(String namespaceURI, 
+                                                 String qualifiedName, 
+                                                 String value)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+
+  /** @see org.w3c.dom.Element */
+  public final void               removeAttributeNS(String namespaceURI, 
+                                                    String localName)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+
+  /** @see org.w3c.dom.Element */
+  public final Attr               getAttributeNodeNS(String namespaceURI, 
+                                                     String localName)
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+  
+  /** @see org.w3c.dom.Element */
+  public final Attr               setAttributeNodeNS(Attr newAttr)
+    throws DOMException
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+  
   /** @see org.w3c.dom.Attr */
   public final String             getName()
   {
@@ -545,6 +633,12 @@
   
   /** @see org.w3c.dom.Attr */
   public final void               setValue(String value)
+  {
+    throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+  }
+
+  /** @see org.w3c.dom.Attr as of DOM Level 2 */
+  public final Element            getOwnerElement()
   {
     throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
   }
Index: DTMProxyMap.java
===================================================================
RCS file:
/home/cvspublic/xml-xalan/src/org/apache/xalan/xpath/dtm/DTMProxyMap.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 DTMProxyMap.java
--- DTMProxyMap.java	1999/11/08 20:56:05	1.1.1.1
+++ DTMProxyMap.java	2000/01/09 21:35:03
@@ -138,5 +138,25 @@
         throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR);
     }
     
+    /** Retrieve a node specified by local name and namespace URI -- DOM
Level 2 */
+    public Node getNamedItemNS(String namespaceURI, 
+                               String localName)
+    {
+        throw new DTMException(DTMException.NOT_SUPPORTED_ERR);
+    }
 
+    /** DOM 2 API requires this, but DTM is a read-only model */
+    public Node setNamedItemNS(Node arg)
+      throws DOMException
+    {
+        throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR);
+    }
+
+    /** DOM 2 API requires this, but DTM is a read-only model */
+    public Node removeNamedItemNS(String namespaceURI, 
+                                  String localName)
+      throws DOMException
+    {
+        throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR);
+    }
 }