src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/FuncHere.java

Print this page

        

@@ -1,29 +1,29 @@
 /*
  * reserved comment block
  * DO NOT REMOVE OR ALTER!
  */
-/*
- * Copyright  1999-2004 The Apache Software Foundation.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package com.sun.org.apache.xml.internal.security.transforms.implementations;
 
-
-
 import javax.xml.transform.TransformerException;
 
 import com.sun.org.apache.xml.internal.dtm.DTM;
 import com.sun.org.apache.xml.internal.security.utils.I18n;
 import com.sun.org.apache.xml.internal.security.utils.XMLUtils;

@@ -34,11 +34,10 @@
 import com.sun.org.apache.xpath.internal.objects.XObject;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
-
 /**
  * The 'here()' function returns a node-set containing the attribute or
  * processing instruction node or the parent element of the text node
  * that directly bears the XPath expression.  This expression results
  * in an error if the containing XPath expression does not appear in the

@@ -70,10 +69,11 @@
     *
     * @param xctxt
     * @return the xobject
     * @throws javax.xml.transform.TransformerException
     */
+    @Override
    public XObject execute(XPathContext xctxt)
            throws javax.xml.transform.TransformerException {
 
       Node xpathOwnerNode = (Node) xctxt.getOwnerObject();
 

@@ -90,20 +90,18 @@
       if (DTM.NULL == docContext) {
          error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
       }
 
       {
-
          // check whether currentNode and the node containing the XPath expression
          // are in the same document
          Document currentDoc =
             XMLUtils.getOwnerDocument(dtm.getNode(currentNode));
          Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode);
 
          if (currentDoc != xpathOwnerDoc) {
-            throw new TransformerException(I18n
-               .translate("xpath.funcHere.documentsDiffer"));
+                throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer"));
          }
       }
 
       XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
       NodeSetDTM nodeSet = nodes.mutableNodeset();

@@ -111,20 +109,13 @@
       {
          int hereNode = DTM.NULL;
 
          switch (dtm.getNodeType(xpathOwnerNodeDTM)) {
 
-         case Node.ATTRIBUTE_NODE : {
-            // returns a node-set containing the attribute
-            hereNode = xpathOwnerNodeDTM;
-
-            nodeSet.addNode(hereNode);
-
-            break;
-         }
+            case Node.ATTRIBUTE_NODE :
          case Node.PROCESSING_INSTRUCTION_NODE : {
-            // returns a node-set containing the processing instruction node
+                // returns a node-set containing the attribute /  processing instruction node
             hereNode = xpathOwnerNodeDTM;
 
             nodeSet.addNode(hereNode);
 
             break;

@@ -154,9 +145,8 @@
     * @param vars
     * @param globalsSize
     */
    @SuppressWarnings("rawtypes")
    public void fixupVariables(java.util.Vector vars, int globalsSize) {
-
       // do nothing
    }
 }