use of org.apache.xalan.templates.ElemTemplateElement in project robovm by robovm.
the class ProcessorTemplateElem method startElement.
/**
* Receive notification of the start of an element.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param localName The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param attributes The specified or defaulted attributes.
*/
public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException {
super.startElement(handler, uri, localName, rawName, attributes);
try {
// ElemTemplateElement parent = handler.getElemTemplateElement();
XSLTElementDef def = getElemDef();
Class classObject = def.getClassObject();
ElemTemplateElement elem = null;
try {
elem = (ElemTemplateElement) classObject.newInstance();
elem.setDOMBackPointer(handler.getOriginatingNode());
elem.setLocaterInfo(handler.getLocator());
elem.setPrefixes(handler.getNamespaceSupport());
} catch (InstantiationException ie) {
//"Failed creating ElemTemplateElement instance!", ie);
handler.error(XSLTErrorResources.ER_FAILED_CREATING_ELEMTMPL, null, ie);
} catch (IllegalAccessException iae) {
//"Failed creating ElemTemplateElement instance!", iae);
handler.error(XSLTErrorResources.ER_FAILED_CREATING_ELEMTMPL, null, iae);
}
setPropertiesFromAttributes(handler, rawName, attributes, elem);
appendAndPush(handler, elem);
} catch (TransformerException te) {
throw new org.xml.sax.SAXException(te);
}
}
use of org.apache.xalan.templates.ElemTemplateElement in project robovm by robovm.
the class ProcessorText method appendAndPush.
/**
* Append the current template element to the current
* template element, and then push it onto the current template
* element stack.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param elem non-null reference to a {@link org.apache.xalan.templates.ElemText}.
*
* @throws org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
*/
protected void appendAndPush(StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException {
// Don't push this element onto the element stack.
ProcessorCharacters charProcessor = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text");
charProcessor.setXslTextElement((ElemText) elem);
ElemTemplateElement parent = handler.getElemTemplateElement();
parent.appendChild(elem);
elem.setDOMBackPointer(handler.getOriginatingNode());
}
use of org.apache.xalan.templates.ElemTemplateElement in project robovm by robovm.
the class ProcessorLRE method endElement.
/**
* Receive notification of the end of an element.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param localName The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
*/
public void endElement(StylesheetHandler handler, String uri, String localName, String rawName) throws org.xml.sax.SAXException {
ElemTemplateElement elem = handler.getElemTemplateElement();
if (elem instanceof ElemLiteralResult) {
if (((ElemLiteralResult) elem).getIsLiteralResultAsStylesheet()) {
handler.popStylesheet();
}
}
super.endElement(handler, uri, localName, rawName);
}
use of org.apache.xalan.templates.ElemTemplateElement in project robovm by robovm.
the class ProcessorAttributeSet method startElement.
/**
* Receive notification of the start of an xsl:attribute-set 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.
*
* @see org.apache.xalan.processor.StylesheetHandler#startElement
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
*/
public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes) throws org.xml.sax.SAXException {
ElemAttributeSet eat = new ElemAttributeSet();
eat.setLocaterInfo(handler.getLocator());
try {
eat.setPrefixes(handler.getNamespaceSupport());
} catch (TransformerException te) {
throw new org.xml.sax.SAXException(te);
}
eat.setDOMBackPointer(handler.getOriginatingNode());
setPropertiesFromAttributes(handler, rawName, attributes, eat);
handler.getStylesheet().setAttributeSet(eat);
// handler.pushElemTemplateElement(eat);
ElemTemplateElement parent = handler.getElemTemplateElement();
parent.appendChild(eat);
handler.pushElemTemplateElement(eat);
}
use of org.apache.xalan.templates.ElemTemplateElement in project robovm by robovm.
the class ProcessorCharacters method startNonText.
/**
* Receive notification of the start of the non-text event. This
* is sent to the current processor when any non-text event occurs.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
*/
public void startNonText(StylesheetHandler handler) throws org.xml.sax.SAXException {
if (this == handler.getCurrentProcessor()) {
handler.popProcessor();
}
int nChars = m_accumulator.length();
if ((nChars > 0) && ((null != m_xslTextElement) || !XMLCharacterRecognizer.isWhiteSpace(m_accumulator)) || handler.isSpacePreserve()) {
ElemTextLiteral elem = new ElemTextLiteral();
elem.setDOMBackPointer(m_firstBackPointer);
elem.setLocaterInfo(handler.getLocator());
try {
elem.setPrefixes(handler.getNamespaceSupport());
} catch (TransformerException te) {
throw new org.xml.sax.SAXException(te);
}
boolean doe = (null != m_xslTextElement) ? m_xslTextElement.getDisableOutputEscaping() : false;
elem.setDisableOutputEscaping(doe);
elem.setPreserveSpace(true);
char[] chars = new char[nChars];
m_accumulator.getChars(0, nChars, chars, 0);
elem.setChars(chars);
ElemTemplateElement parent = handler.getElemTemplateElement();
parent.appendChild(elem);
}
m_accumulator.setLength(0);
m_firstBackPointer = null;
}
Aggregations