Example usage for javax.xml.stream XMLStreamWriter writeCharacters

List of usage examples for javax.xml.stream XMLStreamWriter writeCharacters

Introduction

In this page you can find the example usage for javax.xml.stream XMLStreamWriter writeCharacters.

Prototype

public void writeCharacters(String text) throws XMLStreamException;

Source Link

Document

Write text to the output

Usage

From source file:org.tolven.app.bean.DataExtractBean.java

protected void writeXMLColumn(XMLStreamWriter xmlStreamWriter, DataField field, Object obj)
        throws XMLStreamException {
    if (obj != null) {
        String value;/*from ww w  .j ava  2s  .  co m*/
        xmlStreamWriter.writeStartElement(xmlName(field));
        if (field.getExternal().equalsIgnoreCase("placeholderIds")) {
            //fill me in with a for loop over the placeholder ids
            Object[] plist = (Object[]) obj;
            for (Object pobj : plist) {
                String[] pentry = pobj.toString().split(",");
                String proot = pentry[0].toString();
                String pext = pentry[1].toString();
                xmlStreamWriter.writeStartElement("id");
                xmlStreamWriter.writeAttribute("root", StringEscapeUtils.escapeXml(proot));
                xmlStreamWriter.writeAttribute("extension", StringEscapeUtils.escapeXml(pext));
                xmlStreamWriter.writeEndElement();
            }
        } else {
            value = obj.toString();
            String df = field.getDisplayFunction();
            if (df != null && "age".equalsIgnoreCase(df)) {
                value = ELFunctions.age((Date) obj, TolvenRequest.getInstance().getAccountUser());
            }
            xmlStreamWriter.writeCharacters(StringEscapeUtils.escapeXml(value));
        }
        xmlStreamWriter.writeEndElement();
    }
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addConnectorModule(String rarFilename, XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:if");
    writer.writeAttribute("test", "count(module/connector[text() = '" + rarFilename + "']) = 0");
    writer.writeCharacters("\n");
    writer.writeStartElement("module");
    writer.writeCharacters("\n");
    writer.writeStartElement("connector");
    writer.writeCharacters(rarFilename);
    writer.writeEndElement();/*from  w w w . j a v  a  2  s  .com*/
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addConnectorModuleTemplates(PluginDescriptor pd, File localDestDir, XMLStreamWriter writer)
        throws XMLStreamException, IOException {
    writer.writeStartElement("xsl:template");
    writer.writeAttribute("name", "addConnectorModules");
    writer.writeCharacters("\n");
    assembleConnectorModuleProducts(pd, writer);
    assembleConnectorModuleProductAdaptors(pd, localDestDir, writer);
    writer.writeEndElement();/*  w  w w .  jav  a 2 s.com*/
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addEJBModuleTemplates(PluginDescriptor pd, File localDestDir, XMLStreamWriter writer)
        throws XMLStreamException, IOException {
    writer.writeStartElement("xsl:template");
    writer.writeAttribute("name", "addEJBModules");
    writer.writeCharacters("\n");
    assembleEJBModuleAdaptors(pd, writer);
    assembleEJBModuleProducts(pd, localDestDir, writer);
    assembleEJBModuleProductAdaptors(pd, localDestDir, writer);
    writer.writeEndElement();//from  w  ww .java 2 s  .c  om
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addEJBModuleXMLEntry(String jarFilename, XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:if");
    writer.writeAttribute("test", "count(module/ejb[text() = '" + jarFilename + "']) = 0");
    writer.writeCharacters("\n");
    writer.writeStartElement("module");
    writer.writeCharacters("\n");
    writer.writeStartElement("ejb");
    writer.writeCharacters(jarFilename);
    writer.writeEndElement();/*from   w  w  w  .  j a v  a 2 s . c om*/
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addMainTemplate(XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:template");
    writer.writeAttribute("match", "/ | * | @* | text() | comment()");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:copy");
    writer.writeAttribute("select", ".");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:apply-templates");
    writer.writeAttribute("select", "* | @* | text() | comment()");
    writer.writeEndElement();/*  w  w w.  j  av  a  2  s . com*/
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addRootConnectorModuleSelects(XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:for-each");
    writer.writeAttribute("select", "tp:module/tp:connector");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:copy-of");
    writer.writeAttribute("select", ".");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:apply-templates");
    writer.writeAttribute("select", "* | @* | text() | comment()");
    writer.writeEndElement();/*from  w ww  .j a  v  a2 s  .  c  o  m*/
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:call-template");
    writer.writeAttribute("name", "addConnectorModules");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addRootDisplayName(XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:if");
    writer.writeAttribute("test", "count(display-name) = 0");
    writer.writeStartElement("xsl:element");
    writer.writeAttribute("name", "display-name");
    writer.writeCharacters("Tolven Application");
    writer.writeEndElement();/*  w  ww  . ja  va2s .  co m*/
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addRootEJBModuleSelects(XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:for-each");
    writer.writeAttribute("select", "tp:module/tp:ejb");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:copy-of");
    writer.writeAttribute("select", ".");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:apply-templates");
    writer.writeAttribute("select", "* | @* | text() | comment()");
    writer.writeEndElement();/* w w  w  .j  a va  2  s. c  o  m*/
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:call-template");
    writer.writeAttribute("name", "addEJBModules");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}

From source file:org.tolven.assembler.ear.EARAssembler.java

protected void addRootSecurityRoleSelects(XMLStreamWriter writer) throws XMLStreamException {
    writer.writeStartElement("xsl:for-each");
    writer.writeAttribute("select", "tp:security-role");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:copy-of");
    writer.writeAttribute("select", ".");
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:apply-templates");
    writer.writeAttribute("select", "* | @* | text() | comment()");
    writer.writeEndElement();//from w ww.j av  a 2s. c  om
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeEndElement();
    writer.writeCharacters("\n");
    writer.writeStartElement("xsl:call-template");
    writer.writeAttribute("name", "addSecurityRoles");
    writer.writeEndElement();
    writer.writeCharacters("\n");
}