Examples of PrettyPrintXMLWriter


Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

    private Reader writeComponentsXml( final List<ComponentDef> componentDefs )
        throws IOException
    {
        final StringWriter writer = new StringWriter();

        final PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter( writer );

        xmlWriter.startElement( "component-set" );
        xmlWriter.startElement( "components" );

        for ( final ComponentDef def : componentDefs )
        {
            xmlWriter.startElement( "component" );

            xmlWriter.startElement( "role" );
            xmlWriter.writeText( def.role );
            xmlWriter.endElement();

            final String roleHint = def.roleHint;
            if ( roleHint != null )
            {
                xmlWriter.startElement( "role-hint" );
                xmlWriter.writeText( roleHint );
                xmlWriter.endElement();
            }

            xmlWriter.startElement( "implementation" );
            xmlWriter.writeText( def.implementation );
            xmlWriter.endElement();

            xmlWriter.endElement();
        }

        xmlWriter.endElement();
        xmlWriter.endElement();

        return new StringReader( writer.toString() );
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

public class AntrunXmlPlexusConfigurationWriter {

  public void write(PlexusConfiguration configuration, Writer writer) throws IOException {
    int depth = 0;

    PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter(writer);
    write(configuration, xmlWriter, depth);
  }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

    /** {@inheritDoc} */
    public void tableCaption( SinkEventAttributes attributes )
    {
        StringWriter sw = new StringWriter();
        this.tableCaptionWriterStack.addLast( sw );
        this.tableCaptionXMLWriterStack.addLast( new PrettyPrintXMLWriter( sw ) );

        // <fo:table-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.95
        //writeStartTag( TABLE_CAPTION_TAG );

        // TODO: how to implement this otherwise?
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

    private static final String DEFAULT_INDENT = StringUtils.repeat( " ", XmlUtil.DEFAULT_INDENTATION_SIZE );

    /** {@inheritDoc} */
    protected Sink createSink( Writer writer )
    {
        return new XmlWriterXdocSink( new PrettyPrintXMLWriter( writer ) );
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

    /** {@inheritDoc} */
    public void tableCaption()
    {
        tableCaptionWriter = new StringWriter();
        tableCaptionXMLWriter = new PrettyPrintXMLWriter( tableCaptionWriter );
        actionContext.setAction( SinkActionContext.TABLE_CAPTION );
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

    @Override
    public void tableCaption( SinkEventAttributes attributes )
    {
        StringWriter sw = new StringWriter();
        this.tableCaptionWriterStack.addLast( sw );
        this.tableCaptionXMLWriterStack.addLast( new PrettyPrintXMLWriter( sw ) );

        // TODO: tableCaption should be written before tableRows (DOXIA-177)
        MutableAttributeSet atts = SinkUtils.filterAttributes(
                attributes, SinkUtils.SINK_SECTION_ATTRIBUTES  );
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

     * @since 1.1
     */
    protected ITextSink( Writer writer, String encoding )
    {
        // No doctype since itext doctype is not up to date!
        this( new PrettyPrintXMLWriter( writer, encoding, null ) );

        this.writer = writer;
        this.writeStart = true;
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

        } catch (IOException ex) {
            throw new JbiPluginException("Exception while opening file["
                    + descriptor.getAbsolutePath() + "]", ex);
        }

        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
        writer.startElement("jbi");
        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
        writer.addAttribute("version", "1.0");

        writer.startElement("services");
        writer.addAttribute("binding-component", bc ? "true" : "false");

        // We need to get all the namespaces into a hashmap so we
        // can get the QName output correctly
        Map namespaceMap = getNamespaceMap(provides, consumes);

        // Set-up the namespaces
        for (Iterator iterator = namespaceMap.keySet().iterator(); iterator
                .hasNext();) {
            String key = (String) iterator.next();
            StringBuffer namespaceDecl = new StringBuffer();
            namespaceDecl.append("xmlns:");
            namespaceDecl.append(namespaceMap.get(key));
            writer.addAttribute(namespaceDecl.toString(), key);
        }

        // Put in the provides
        for (Iterator iterator = provides.iterator(); iterator.hasNext();) {
            Provides providesEntry = (Provides) iterator.next();
            writer.startElement("provides");
            addQNameAttribute(writer, "interface-name", providesEntry
                    .getInterfaceName(), namespaceMap);
            addQNameAttribute(writer, "service-name", providesEntry
                    .getServiceName(), namespaceMap);
            addStringAttribute(writer, "endpoint-name", providesEntry
                    .getEndpointName());
            writer.endElement();
        }

        // Put in the consumes
        for (Iterator iterator = consumes.iterator(); iterator.hasNext();) {
            Consumes consumesEntry = (Consumes) iterator.next();
            writer.startElement("consumes");
            addQNameAttribute(writer, "interface-name", consumesEntry
                    .getInterfaceName(), namespaceMap);
            addQNameAttribute(writer, "service-name", consumesEntry
                    .getServiceName(), namespaceMap);
            addStringAttribute(writer, "endpoint-name", consumesEntry
                    .getEndpointName());

            // TODO Handling of LinkType?

            writer.endElement();
        }

        writer.endElement();

        writer.endElement();

        close(w);
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

        } catch (IOException ex) {
            throw new JbiPluginException("Exception while opening file["
                    + descriptor.getAbsolutePath() + "]", ex);
        }

        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
        writer.startElement("jbi");
        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
        writer.addAttribute("version", "1.0");

        writer.startElement("shared-library");
        writer.addAttribute("class-loader-delegation", classLoaderDelegation);
        writer.addAttribute("version", version);

        writer.startElement("identification");
        writer.startElement("name");
        writer.writeText(name);
        writer.endElement();
        writer.startElement("description");
        writer.writeText(description);
        writer.endElement();
        writer.endElement();

        writer.startElement("shared-library-class-path");
        for (Iterator it = uris.iterator(); it.hasNext();) {
            DependencyInformation dependency = (DependencyInformation) it
                    .next();
            writer.startElement("path-element");
            writer.writeText(dependency.getFilename());
            writer.endElement();
        }
        writer.endElement();

        writer.endElement();
        writer.endElement();

        close(w);
    }
View Full Code Here

Examples of org.codehaus.plexus.util.xml.PrettyPrintXMLWriter

        } catch (IOException ex) {
            throw new JbiPluginException("Exception while opening file["
                    + descriptor.getAbsolutePath() + "]", ex);
        }

        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
        writer.startElement("jbi");
        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
        writer.addAttribute("version", "1.0");

        writer.startElement("component");
        writer.addAttribute("type", type);
        writer.addAttribute("component-class-loader-delegation",
                componentClassLoaderDelegation);
        writer.addAttribute("bootstrap-class-loader-delegation",
                bootstrapClassLoaderDelegation);

        writer.startElement("identification");
        writer.startElement("name");
        writer.writeText(name);
        writer.endElement();
        writer.startElement("description");
        writer.writeText(description);
        writer.endElement();
        writer.endElement();

        writer.startElement("component-class-name");
        writer.writeText(component);
        writer.endElement();
        writer.startElement("component-class-path");
        for (Iterator it = uris.iterator(); it.hasNext();) {
            DependencyInformation info = (DependencyInformation) it.next();
            if ("jar".equals(info.getType()) || "bundle".equals(info.getType())) {
                writer.startElement("path-element");
                writer.writeText(info.getFilename());
                writer.endElement();
            }
        }
        writer.endElement();

        writer.startElement("bootstrap-class-name");
        writer.writeText(bootstrap);
        writer.endElement();
        writer.startElement("bootstrap-class-path");
        for (Iterator it = uris.iterator(); it.hasNext();) {
            DependencyInformation info = (DependencyInformation) it.next();
            if ("jar".equals(info.getType())) {
                writer.startElement("path-element");
                writer.writeText(info.getFilename());
                writer.endElement();
            }
        }
        writer.endElement();

        for (Iterator it = uris.iterator(); it.hasNext();) {
            DependencyInformation info = (DependencyInformation) it.next();
            if ("jbi-shared-library".equals(info.getType())) {
                writer.startElement("shared-library");
                writer.addAttribute("version", info.getVersion());
                writer.writeText(info.getName());
                writer.endElement();
            }
        }

        writer.endElement();

        writer.endElement();

        close(w);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.