/** * Get the value of the named attribute. * @param attributeName The attribute name. * @param attributes The attribute list. * @return The attribute value, or an empty string if not available (as with DOM). */ public static String getAttribute(String attributeName, Attributes attributes) { return getAttribute(attributeName, attributes, ""); }
/** * Create a {@link QName} instance for the supplied DOM {@link org.w3c.dom.Element}. * @param element The element. * @return Element QName. */ public static QName toQName(Element element) { if(element == null) { return null; } return toQName(element.getNamespaceURI(), DomUtils.getName(element), element.getNodeName()); }
public static String getXPath(SAXElement element) { StringBuilder builder = new StringBuilder(); addXPathElement(element, builder); return builder.toString(); }
private void applyTemplate(Template template, SAXElement element, ExecutionContext executionContext, Writer writer) throws SmooksException { try { Map<String, Object> model = FreeMarkerUtils.getMergedModel(executionContext); template.process(model, writer); writer.flush(); } catch (TemplateException e) { throw new SmooksException("Failed to apply FreeMarker template to fragment '" + SAXUtil.getXPath(element) + "'. Resource: " + config, e); } catch (IOException e) { throw new SmooksException("Failed to apply FreeMarker template to fragment '" + SAXUtil.getXPath(element) + "'. Resource: " + config, e); } }
public int getDepth() { if(element instanceof Element) { return DomUtils.getDepth((Element) element); } else if(element instanceof SAXElement) { return SAXUtil.getDepth((SAXElement) element); } return 0; } }
return new QName(namespaceURI, qName); } else { thowInvalidNameException(namespaceURI, localName, qName); thowInvalidNameException(namespaceURI, localName, qName);
private void applyTemplate(Template template, SAXElement element, ExecutionContext executionContext, Writer writer) throws SmooksException { try { Map<String, Object> model = FreeMarkerUtils.getMergedModel(executionContext); template.process(model, writer); writer.flush(); } catch (TemplateException e) { throw new SmooksException("Failed to apply FreeMarker template to fragment '" + SAXUtil.getXPath(element) + "'. Resource: " + config, e); } catch (IOException e) { throw new SmooksException("Failed to apply FreeMarker template to fragment '" + SAXUtil.getXPath(element) + "'. Resource: " + config, e); } }
public int getDepth() { if(element instanceof Element) { return DomUtils.getDepth((Element) element); } else if(element instanceof SAXElement) { return SAXUtil.getDepth((SAXElement) element); } return 0; } }
return new QName(namespaceURI, qName); } else { thowInvalidNameException(namespaceURI, localName, qName); thowInvalidNameException(namespaceURI, localName, qName);
/** * Get the named attribute from this element. * @param attribute The attribute name. * @return The attribute value, or an empty string if the attribute is not specified. */ public String getAttribute(String attribute) { return SAXUtil.getAttribute(attribute, attributes); }
/** * Create a {@link QName} instance for the supplied DOM {@link org.w3c.dom.Element}. * @param element The element. * @return Element QName. */ public static QName toQName(Element element) { if(element == null) { return null; } return toQName(element.getNamespaceURI(), DomUtils.getName(element), element.getNodeName()); }
public static String getXPath(SAXElement element) { StringBuilder builder = new StringBuilder(); addXPathElement(element, builder); return builder.toString(); }
public int getDepth() { if(element instanceof Element) { return DomUtils.getDepth((Element) element); } else if(element instanceof SAXElement) { return SAXUtil.getDepth((SAXElement) element); } return 0; } }
return new QName(namespaceURI, qName); } else { thowInvalidNameException(namespaceURI, localName, qName); thowInvalidNameException(namespaceURI, localName, qName);
/** * Get the named attribute from this element. * @param attribute The attribute name. * @return The attribute value, or an empty string if the attribute is not specified. */ public String getAttribute(String attribute) { return SAXUtil.getAttribute(attribute, attributes); }
/** * Create a {@link QName} instance for the supplied DOM {@link org.w3c.dom.Element}. * @param element The element. * @return Element QName. */ public static QName toQName(Element element) { if(element == null) { return null; } return toQName(element.getNamespaceURI(), DomUtils.getName(element), element.getNodeName()); }
public static String getXPath(SAXElement element) { StringBuilder builder = new StringBuilder(); addXPathElement(element, builder); return builder.toString(); }
public int getDepth() { if(element instanceof Element) { return DomUtils.getDepth((Element) element); } else if(element instanceof SAXElement) { return SAXUtil.getDepth((SAXElement) element); } return 0; } }