Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-831

Define DTD on XML

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.M1
    • Fix Version/s: 1.1.0.M1
    • Component/s: WEB MVC
    • Labels:
      None
    • Environment:
      * Roo version 1.1.-M1
      * JDK-1.5.0_07

      Description

      Hi!

      When I update or create an xml file using the command:

      OperationImpl.java
      XmlUtils.writeXml(webXmlMutableFile.getOutputStream(), webXml);
      

      The updated XML (i.e. layouts.xml) loses its DTD definition:

       
      <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
      <tiles-definitions>
      

      DOCTYPE disappears using this command in ROO v1.1.0-M1.

      I solved it using Transformer and call the other writeXml method in XmlUtils to update/create a file:

      OperationImpl.java
        final static String DOCTYPE_PUBLIC = "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN";
        final static String DOCTYPE_SYSTEM = "http://tiles.apache.org/dtds/tiles-config_2_1.dtd";
        .
        .
      	TransformerFactory transformerFactory = TransformerFactory
      		.newInstance();
      
      	// Define DTD
      	Transformer xformer;
      	try {
      	    xformer = transformerFactory.newTransformer();
      	} catch (Exception ex) {
      	    throw new IllegalStateException(ex);
      	}
      
      	xformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, DOCTYPE_PUBLIC);
      	xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, DOCTYPE_SYSTEM);
      
      	XmlUtils.writeXml(xformer, webXmlMutableFile.getOutputStream(), layoutsXml);
      
      

      In ROO v1.0.2 this bug doesn't exists.
      Thanks!

        Attachments

          Activity

            People

            Assignee:
            sschmidt Stefan Schmidt
            Reporter:
            ricardogarfe Ricardo GarcĂ­a
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: