FileDocCategorySizeDatePackage
JAXPVariableStack.javaAPI DocJava SE 5 API2652Fri Aug 26 14:56:10 BST 2005com.sun.org.apache.xpath.internal.jaxp

JAXPVariableStack

public class JAXPVariableStack extends VariableStack
Overrides {@link VariableStack} and delegates the call to {@link javax.xml.xpath.XPathVariableResolver}.
author
Ramesh Mandava ( ramesh.mandava@sun.com )

Fields Summary
private final XPathVariableResolver
resolver
Constructors Summary
public JAXPVariableStack(XPathVariableResolver resolver)

        this.resolver = resolver;
    
Methods Summary
public com.sun.org.apache.xpath.internal.objects.XObjectgetVariableOrParam(com.sun.org.apache.xpath.internal.XPathContext xctxt, com.sun.org.apache.xml.internal.utils.QName qname)

        if ( qname == null ) {
            //JAXP 1.3 spec says that if variable name is null then 
            // we need to through IllegalArgumentException
            String fmsg = XSLMessages.createXPATHMessage( 
                XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
                new Object[] {"Variable qname"} );
            throw new IllegalArgumentException( fmsg );
        }
	javax.xml.namespace.QName name =
	    new javax.xml.namespace.QName(
                qname.getNamespace(),
                qname.getLocalPart());
        Object varValue = resolver.resolveVariable( name );		
        if ( varValue == null ) {
            String fmsg = XSLMessages.createXPATHMessage( 
                XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
                new Object[] { name.toString()} );
            throw new TransformerException( fmsg );
        } 
        return XObject.create( varValue, xctxt );