Search in sources :

Example 1 with Arg

use of org.apache.xpath.Arg in project j2objc by google.

the class TransformerImpl method resetUserParameters.

/**
 * Reset parameters that the user specified for the transformation.
 * Called during transformer.reset() after we have cleared the
 * variable stack. We need to make sure that user params are
 * reset so that the transformer object can be reused.
 */
private void resetUserParameters() {
    try {
        if (null == m_userParams)
            return;
        int n = m_userParams.size();
        for (int i = n - 1; i >= 0; i--) {
            Arg arg = (Arg) m_userParams.elementAt(i);
            QName name = arg.getQName();
            // The first string might be the namespace, or it might be
            // the local name, if the namespace is null.
            String s1 = name.getNamespace();
            String s2 = name.getLocalPart();
            setParameter(s2, s1, arg.getVal().object());
        }
    } catch (java.util.NoSuchElementException nsee) {
    // Should throw some sort of an error.
    }
}
Also used : QName(org.apache.xml.utils.QName) Arg(org.apache.xpath.Arg)

Example 2 with Arg

use of org.apache.xpath.Arg in project j2objc by google.

the class TransformerImpl method replaceOrPushUserParam.

/**
 * NEEDSDOC Method replaceOrPushUserParam
 *
 * NEEDSDOC @param qname
 * NEEDSDOC @param xval
 */
private void replaceOrPushUserParam(QName qname, XObject xval) {
    int n = m_userParams.size();
    for (int i = n - 1; i >= 0; i--) {
        Arg arg = (Arg) m_userParams.elementAt(i);
        if (arg.getQName().equals(qname)) {
            m_userParams.setElementAt(new Arg(qname, xval, true), i);
            return;
        }
    }
    m_userParams.addElement(new Arg(qname, xval, true));
}
Also used : Arg(org.apache.xpath.Arg)

Example 3 with Arg

use of org.apache.xpath.Arg in project j2objc by google.

the class TransformerImpl method getParameter.

/**
 * Get a parameter that was explicitly set with setParameter
 * or setParameters.
 *
 * NEEDSDOC @param name
 * @return A parameter that has been set with setParameter
 * or setParameters,
 * *not* all the xsl:params on the stylesheet (which require
 * a transformation Source to be evaluated).
 */
public Object getParameter(String name) {
    try {
        // VariableStack varstack = getXPathContext().getVarStack();
        // The first string might be the namespace, or it might be
        // the local name, if the namespace is null.
        QName qname = QName.getQNameFromString(name);
        if (null == m_userParams)
            return null;
        int n = m_userParams.size();
        for (int i = n - 1; i >= 0; i--) {
            Arg arg = (Arg) m_userParams.elementAt(i);
            if (arg.getQName().equals(qname)) {
                return arg.getVal().object();
            }
        }
        return null;
    } catch (java.util.NoSuchElementException nsee) {
        // Should throw some sort of an error.
        return null;
    }
}
Also used : QName(org.apache.xml.utils.QName) Arg(org.apache.xpath.Arg)

Example 4 with Arg

use of org.apache.xpath.Arg in project robovm by robovm.

the class TransformerImpl method replaceOrPushUserParam.

/**
   * NEEDSDOC Method replaceOrPushUserParam 
   *
   *
   * NEEDSDOC @param qname
   * NEEDSDOC @param xval
   */
private void replaceOrPushUserParam(QName qname, XObject xval) {
    int n = m_userParams.size();
    for (int i = n - 1; i >= 0; i--) {
        Arg arg = (Arg) m_userParams.elementAt(i);
        if (arg.getQName().equals(qname)) {
            m_userParams.setElementAt(new Arg(qname, xval, true), i);
            return;
        }
    }
    m_userParams.addElement(new Arg(qname, xval, true));
}
Also used : Arg(org.apache.xpath.Arg)

Example 5 with Arg

use of org.apache.xpath.Arg in project robovm by robovm.

the class TransformerImpl method getParameter.

/**
   * Get a parameter that was explicitly set with setParameter
   * or setParameters.
   *
   *
   * NEEDSDOC @param name
   * @return A parameter that has been set with setParameter
   * or setParameters,
   * *not* all the xsl:params on the stylesheet (which require
   * a transformation Source to be evaluated).
   */
public Object getParameter(String name) {
    try {
        // VariableStack varstack = getXPathContext().getVarStack();
        // The first string might be the namespace, or it might be 
        // the local name, if the namespace is null.
        QName qname = QName.getQNameFromString(name);
        if (null == m_userParams)
            return null;
        int n = m_userParams.size();
        for (int i = n - 1; i >= 0; i--) {
            Arg arg = (Arg) m_userParams.elementAt(i);
            if (arg.getQName().equals(qname)) {
                return arg.getVal().object();
            }
        }
        return null;
    } catch (java.util.NoSuchElementException nsee) {
        // Should throw some sort of an error.
        return null;
    }
}
Also used : QName(org.apache.xml.utils.QName) Arg(org.apache.xpath.Arg)

Aggregations

Arg (org.apache.xpath.Arg)6 QName (org.apache.xml.utils.QName)4