Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-132

[configuration] HierarchicalConfigurationXMLReader stores comments as text nodes

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

    • Bugzilla Id:
      30597

      Description

      I am seeing behavior in the HierarchicalConfigurationXMLReader class (v 1.5
      2004/07/05 09:54:17) where XML Comments are inappropriately stored as text
      nodes.

      When using ConfigurationXMLDocument (ConfigurationXMLDocument.java,v 1.6
      2004/06/24 14:01:03) to write the configuration back out to a file, the
      original XML comments are written out as concatenated text nodes.

      Here are the steps for recreation:

      1) Read in this configuration using the hierarchicalXml designator:

      <config>
      <!-- Settings for the Wizard, now externalized via Perl. -->
      <Wizard>
      <!-- Location of perl binary. -->
      <PerlPath>C:/cygwin/bin/perl</PerlPath>

      <!-- Perl script and arguments for the wizard. -->
      <WizardScript>C:/foo/wizard.pl</WizardScript>
      </Wizard>
      </config>

      2) Pass the HierarchicalXMLConfiguration instance to ConfigurationXMLDocument
      to write() to a file:

      ConfigurationXMLDocument configDoc = new ConfigurationXMLDocument(config);
      Writer out = new BufferedWriter(new FileWriter(outputFile));
      configDoc.write(out);

      3) The resulting XML (written out by Dom4J) demonstrates that all comments were
      read in and concatenated into text nodes:

      <config>Settings for the Wizard, now externalized via Perl.
      <Wizard>Location of perl binary. Perl script and arguments for the wizard.
      <PerlPath>C:/cygwin/bin/perl</PerlPath>
      <WizardScript>C:/foo/wizard.pl</WizardScript>
      </Wizard>
      </config>

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              woodman@iswsolutions.com woodman
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: