0N/A/*
0N/A * reserved comment block
0N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
0N/A * Copyright 1999-2004 The Apache Software Foundation.
0N/A *
0N/A * Licensed under the Apache License, Version 2.0 (the "License");
0N/A * you may not use this file except in compliance with the License.
0N/A * You may obtain a copy of the License at
0N/A *
0N/A * http://www.apache.org/licenses/LICENSE-2.0
0N/A *
0N/A * Unless required by applicable law or agreed to in writing, software
0N/A * distributed under the License is distributed on an "AS IS" BASIS,
0N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0N/A * See the License for the specific language governing permissions and
0N/A * limitations under the License.
0N/A *
0N/A */
0N/Apackage com.sun.org.apache.xml.internal.security.transforms.implementations;
0N/A
0N/A
0N/A
0N/Aimport com.sun.org.apache.xml.internal.dtm.DTMManager;
0N/Aimport com.sun.org.apache.xml.internal.security.utils.I18n;
0N/Aimport com.sun.org.apache.xpath.internal.CachedXPathAPI;
0N/Aimport com.sun.org.apache.xpath.internal.XPathContext;
0N/Aimport org.w3c.dom.Node;
0N/A
0N/A
0N/A/**
0N/A * {@link FuncHereContext} extends {@link XPathContext} for supplying context
0N/A * for the <CODE>here()</CODE> function. The here() function needs to know
0N/A * <I>where</I> in an XML instance the XPath text string appeared. This can be
0N/A * in {@link org.w3c.dom.Text}, {@link org.w3c.dom.Attr}ibutes and {@ProcessingInstrinction} nodes. The
0N/A * correct node must be supplied to the constructor of {@link FuncHereContext}.
0N/A * The supplied Node MUST contain the XPath which is to be executed.
0N/A *
0N/A * <PRE>
0N/A * From: Scott_Boag\@lotus.com
0N/A * To: Christian Geuer-Pollmann <maillist\@nue.et-inf.uni-siegen.de>
0N/A * CC: xalan-dev@xml.apache.org
0N/A * Subject: Re: Cleanup of XPathContext & definition of XSLTContext
0N/A * Date: Tue, 21 Aug 2001 18:36:24 -0400
0N/A *
0N/A * > My point is to say to get this baby to run, the XPath must have a
0N/A * > possibility to retrieve the information where itself occured in a
0N/A * > document.
0N/A *
0N/A * It sounds to me like you have to derive an XMLSigContext from the
0N/A * XPathContext?
0N/A *
0N/A * > and supplied the Node which contains the xpath string as "owner". Question:
0N/A * > Is this the correct use of the owner object? It works, but I don't know
0N/A * > whether this is correct from the xalan-philosophy...
0N/A *
0N/A * Philosophically it's fine. The owner is the TransformerImpl if XPath is
0N/A * running under XSLT. If it is not running under XSLT, it can be whatever
0N/A * you want.
0N/A *
0N/A * -scott
0N/A * </PRE>
0N/A *
661N/A * @author $Author: mullan $
0N/A * @see com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHere
0N/A * @see com.sun.org.apache.xml.internal.security.utils.XPathFuncHereAPI
0N/A * @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-core/Overview.html#function-here">XML Signature - The here() function</A>
0N/A */
0N/Apublic class FuncHereContext extends XPathContext {
0N/A
0N/A /**
0N/A * This constuctor is disabled because if we use the here() function we
0N/A * <I>always</I> need to know in which node the XPath occured.
0N/A */
0N/A private FuncHereContext() {}
0N/A
0N/A /**
0N/A * Constructor FuncHereContext
0N/A *
0N/A * @param owner
0N/A */
0N/A public FuncHereContext(Node owner) {
0N/A super(owner);
0N/A }
0N/A
0N/A /**
0N/A * Constructor FuncHereContext
0N/A *
0N/A * @param owner
0N/A * @param xpathContext
0N/A */
0N/A public FuncHereContext(Node owner, XPathContext xpathContext) {
0N/A
0N/A super(owner);
0N/A
0N/A try {
0N/A super.m_dtmManager = xpathContext.getDTMManager();
0N/A } catch (IllegalAccessError iae) {
0N/A throw new IllegalAccessError(I18n.translate("endorsed.jdk1.4.0")
0N/A + " Original message was \""
0N/A + iae.getMessage() + "\"");
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Constructor FuncHereContext
0N/A *
0N/A * @param owner
0N/A * @param previouslyUsed
0N/A */
0N/A public FuncHereContext(Node owner, CachedXPathAPI previouslyUsed) {
0N/A
0N/A super(owner);
0N/A
0N/A try {
0N/A super.m_dtmManager = previouslyUsed.getXPathContext().getDTMManager();
0N/A } catch (IllegalAccessError iae) {
0N/A throw new IllegalAccessError(I18n.translate("endorsed.jdk1.4.0")
0N/A + " Original message was \""
0N/A + iae.getMessage() + "\"");
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Constructor FuncHereContext
0N/A *
0N/A * @param owner
0N/A * @param dtmManager
0N/A */
0N/A public FuncHereContext(Node owner, DTMManager dtmManager) {
0N/A
0N/A super(owner);
0N/A
0N/A try {
0N/A super.m_dtmManager = dtmManager;
0N/A } catch (IllegalAccessError iae) {
0N/A throw new IllegalAccessError(I18n.translate("endorsed.jdk1.4.0")
0N/A + " Original message was \""
0N/A + iae.getMessage() + "\"");
0N/A }
0N/A }
0N/A}