Search in sources :

Example 6 with XMLWriter

use of org.codehaus.plexus.util.xml.XMLWriter in project maven-plugins by apache.

the class DoapUtilTest method testWriteRdfResourceElement.

/**
 * Test method for {@link DoapUtil#writeRdfResourceElement(XMLWriter, String, String)}.
 *
 * @throws Exception if any
 */
public void testWriteRdfResourceElement() throws Exception {
    StringWriter w = new StringWriter();
    XMLWriter writer = new PrettyPrintXMLWriter(w);
    DoapUtil.writeRdfResourceElement(writer, null, "name", "value");
    w.close();
    assertEquals(w.toString(), "<name " + DoapUtil.RDF_RESOURCE + "=\"value\"/>");
    w = new StringWriter();
    writer = new PrettyPrintXMLWriter(w);
    try {
        DoapUtil.writeRdfResourceElement(writer, null, null, null);
        assertTrue("Null not catched", false);
    } catch (IllegalArgumentException e) {
        assertTrue("IllegalArgumentException catched", true);
    } finally {
        w.close();
    }
}
Also used : StringWriter(java.io.StringWriter) PrettyPrintXMLWriter(org.codehaus.plexus.util.xml.PrettyPrintXMLWriter) XMLWriter(org.codehaus.plexus.util.xml.XMLWriter) PrettyPrintXMLWriter(org.codehaus.plexus.util.xml.PrettyPrintXMLWriter)

Example 7 with XMLWriter

use of org.codehaus.plexus.util.xml.XMLWriter in project maven-plugins by apache.

the class ApplicationXmlWriter method initializeRootElementSix.

private XMLWriter initializeRootElementSix(Writer w) {
    XMLWriter writer = initializeXmlWriter(w, null);
    writer.startElement(APPLICATION_ELEMENT);
    writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/javaee");
    writer.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    writer.addAttribute("xsi:schemaLocation", "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd");
    writer.addAttribute("version", "6");
    return writer;
}
Also used : XMLWriter(org.codehaus.plexus.util.xml.XMLWriter)

Example 8 with XMLWriter

use of org.codehaus.plexus.util.xml.XMLWriter in project maven-plugins by apache.

the class ApplicationXmlWriter method initializeRootElementOneDotFour.

private XMLWriter initializeRootElementOneDotFour(Writer w) {
    XMLWriter writer = initializeXmlWriter(w, null);
    writer.startElement(APPLICATION_ELEMENT);
    writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/j2ee");
    writer.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    writer.addAttribute("xsi:schemaLocation", "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd");
    writer.addAttribute("version", "1.4");
    return writer;
}
Also used : XMLWriter(org.codehaus.plexus.util.xml.XMLWriter)

Example 9 with XMLWriter

use of org.codehaus.plexus.util.xml.XMLWriter in project maven-plugins by apache.

the class ApplicationXmlWriter method initializeRootElementOneDotThree.

private XMLWriter initializeRootElementOneDotThree(Writer w) {
    XMLWriter writer = initializeXmlWriter(w, DOCTYPE_1_3);
    writer.startElement(APPLICATION_ELEMENT);
    return writer;
}
Also used : XMLWriter(org.codehaus.plexus.util.xml.XMLWriter)

Example 10 with XMLWriter

use of org.codehaus.plexus.util.xml.XMLWriter in project maven-plugins by apache.

the class ApplicationXmlWriter method initializeRootElementSeven.

private XMLWriter initializeRootElementSeven(Writer w) {
    XMLWriter writer = initializeXmlWriter(w, null);
    writer.startElement(APPLICATION_ELEMENT);
    writer.addAttribute("xmlns", "http://xmlns.jcp.org/xml/ns/javaee");
    writer.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    // CHECKSTYLE_OFF: LineLength
    writer.addAttribute("xsi:schemaLocation", "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd");
    // CHECKSTYLE_ON: LineLength
    writer.addAttribute("version", "7");
    return writer;
}
Also used : XMLWriter(org.codehaus.plexus.util.xml.XMLWriter)

Aggregations

XMLWriter (org.codehaus.plexus.util.xml.XMLWriter)20 PrettyPrintXMLWriter (org.codehaus.plexus.util.xml.PrettyPrintXMLWriter)13 StringWriter (java.io.StringWriter)6 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)6 IOException (java.io.IOException)4 File (java.io.File)3 MavenProject (org.apache.maven.project.MavenProject)3 FileOutputStream (java.io.FileOutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 Writer (java.io.Writer)2 MavenExecutionRequest (org.apache.maven.execution.MavenExecutionRequest)2 ProjectBuilder (org.apache.maven.project.ProjectBuilder)2 ProjectBuildingResult (org.apache.maven.project.ProjectBuildingResult)2 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 RemoteException (java.rmi.RemoteException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DecorationModel (org.apache.maven.doxia.site.decoration.DecorationModel)1 Contributor (org.apache.maven.model.Contributor)1