Search in sources :

Example 11 with OutputProperties

use of org.apache.xalan.templates.OutputProperties in project robovm by robovm.

the class ProcessorOutputElem method startElement.

/**
   * Receive notification of the start of an xsl:output element.
   *
   * @param handler The calling StylesheetHandler/TemplatesBuilder.
   * @param uri The Namespace URI, or the empty string if the
   *        element has no Namespace URI or if Namespace
   *        processing is not being performed.
   * @param localName The local name (without prefix), or the
   *        empty string if Namespace processing is not being
   *        performed.
   * @param rawName The raw XML 1.0 name (with prefix), or the
   *        empty string if raw names are not available.
   * @param attributes The attributes attached to the element.  If
   *        there are no attributes, it shall be an empty
   *        Attributes object.
   *
   * @throws org.xml.sax.SAXException
   */
public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException {
    // Hmmm... for the moment I don't think I'll have default properties set for this. -sb
    m_outputProperties = new OutputProperties();
    m_outputProperties.setDOMBackPointer(handler.getOriginatingNode());
    m_outputProperties.setLocaterInfo(handler.getLocator());
    m_outputProperties.setUid(handler.nextUid());
    setPropertiesFromAttributes(handler, rawName, attributes, this);
    // Access this only from the Hashtable level... we don't want to 
    // get default properties.
    String entitiesFileName = (String) m_outputProperties.getProperties().get(OutputPropertiesFactory.S_KEY_ENTITIES);
    if (null != entitiesFileName) {
        try {
            String absURL = SystemIDResolver.getAbsoluteURI(entitiesFileName, handler.getBaseIdentifier());
            m_outputProperties.getProperties().put(OutputPropertiesFactory.S_KEY_ENTITIES, absURL);
        } catch (TransformerException te) {
            handler.error(te.getMessage(), te);
        }
    }
    handler.getStylesheet().setOutput(m_outputProperties);
    ElemTemplateElement parent = handler.getElemTemplateElement();
    parent.appendChild(m_outputProperties);
    m_outputProperties = null;
}
Also used : OutputProperties(org.apache.xalan.templates.OutputProperties) TransformerException(javax.xml.transform.TransformerException) ElemTemplateElement(org.apache.xalan.templates.ElemTemplateElement)

Example 12 with OutputProperties

use of org.apache.xalan.templates.OutputProperties in project robovm by robovm.

the class TransformerImpl method getOutputPropertyNoDefault.

/**
   * Get the value of a property, without using the default properties.  This
   * can be used to test if a property has been explicitly set by the stylesheet
   * or user.
   *
   * NEEDSDOC @param qnameString
   *
   * @return The value of the property, or null if not found.
   *
   * @throws IllegalArgumentException If the property is not supported,
   * and is not namespaced.
   */
public String getOutputPropertyNoDefault(String qnameString) throws IllegalArgumentException {
    String value = null;
    OutputProperties props = getOutputFormat();
    value = (String) props.getProperties().get(qnameString);
    if (null == value) {
        if (!OutputProperties.isLegalPropertyKey(qnameString))
            //"output property not recognized: "
            throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[] { qnameString }));
    // + qnameString);
    }
    return value;
}
Also used : OutputProperties(org.apache.xalan.templates.OutputProperties)

Example 13 with OutputProperties

use of org.apache.xalan.templates.OutputProperties in project robovm by robovm.

the class TransformerIdentityImpl method reset.

/**
   * Reset the status of the transformer.
   */
public void reset() {
    m_flushedStartDoc = false;
    m_foundFirstElement = false;
    m_outputStream = null;
    clearParameters();
    m_result = null;
    m_resultContentHandler = null;
    m_resultDeclHandler = null;
    m_resultDTDHandler = null;
    m_resultLexicalHandler = null;
    m_serializer = null;
    m_systemID = null;
    m_URIResolver = null;
    m_outputFormat = new OutputProperties(Method.XML);
}
Also used : OutputProperties(org.apache.xalan.templates.OutputProperties)

Example 14 with OutputProperties

use of org.apache.xalan.templates.OutputProperties in project robovm by robovm.

the class TransformerIdentityImpl method getOutputProperty.

/**
   * Get an output property that is in effect for the
   * transformation.  The property specified may be a property
   * that was set with setOutputProperty, or it may be a
   * property specified in the stylesheet.
   *
   * @param name A non-null String that specifies an output
   * property name, which may be namespace qualified.
   *
   * @return The string value of the output property, or null
   * if no property was found.
   *
   * @throws IllegalArgumentException If the property is not supported.
   *
   * @see javax.xml.transform.OutputKeys
   */
public String getOutputProperty(String name) throws IllegalArgumentException {
    String value = null;
    OutputProperties props = m_outputFormat;
    value = props.getProperty(name);
    if (null == value) {
        if (!OutputProperties.isLegalPropertyKey(name))
            //"output property not recognized: "
            throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[] { name }));
    // + name);
    }
    return value;
}
Also used : OutputProperties(org.apache.xalan.templates.OutputProperties)

Example 15 with OutputProperties

use of org.apache.xalan.templates.OutputProperties in project robovm by robovm.

the class TransformerImpl method getOutputProperty.

/**
   * Get an output property that is in effect for the
   * transformation.  The property specified may be a property
   * that was set with setOutputProperty, or it may be a
   * property specified in the stylesheet.
   *
   * NEEDSDOC @param qnameString
   *
   * @return The string value of the output property, or null
   * if no property was found.
   *
   * @throws IllegalArgumentException If the property is not supported.
   *
   * @see javax.xml.transform.OutputKeys
   */
public String getOutputProperty(String qnameString) throws IllegalArgumentException {
    String value = null;
    OutputProperties props = getOutputFormat();
    value = props.getProperty(qnameString);
    if (null == value) {
        if (!OutputProperties.isLegalPropertyKey(qnameString))
            //"output property not recognized: "
            throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[] { qnameString }));
    //+ qnameString);
    }
    return value;
}
Also used : OutputProperties(org.apache.xalan.templates.OutputProperties)

Aggregations

OutputProperties (org.apache.xalan.templates.OutputProperties)16 OutputStream (java.io.OutputStream)4 Writer (java.io.Writer)4 Properties (java.util.Properties)4 TransformerException (javax.xml.transform.TransformerException)4 Serializer (org.apache.xml.serializer.Serializer)4 ElemTemplateElement (org.apache.xalan.templates.ElemTemplateElement)2 ContentHandler (org.xml.sax.ContentHandler)2