Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-132

[configuration] HierarchicalConfigurationXMLReader stores comments as text nodes

    Details

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

      Operating System: Windows XP
      Platform: PC

      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>

        Activity

        Henri Yandell made changes -
        Affects Version/s Nightly Builds [ 12311710 ]
        Henri Yandell made changes -
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Affects Version/s Nightly Builds [ 12311648 ]
        Project Commons [ 12310458 ] Commons Configuration [ 12310467 ]
        Key COM-1477 CONFIGURATION-132
        Component/s Configuration [ 12311107 ]
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 30597 12341629
        woodman created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            woodman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development