commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Smith <s...@me.com>
Subject XMLPropertyListConfiguration and saving arrays
Date Wed, 03 Nov 2010 01:51:11 GMT
Hi! I am attempting to save out plist files from some groovy code, and I am not having much
success when it comes to arrays. Instead of values wrapped in array tags, I get a series of
key-value pairs. Here is my code (hopefully it should be close enough to java to be clear):

groovy> import org.apache.commons.configuration.plist.* 
groovy> def bob = new XMLPropertyListConfiguration() 
groovy> bob.addProperty("key", "stringvalue") 
groovy> bob.addProperty("numbers", 12345) 
groovy> bob.addProperty("settings", ['height': 20, 'width': 40, 'scale':'very yes']) 
groovy> bob.addProperty("things", ['chair', 'hat', 'door']) 
groovy> bobsave(System.out) 

<?xml version="1.0"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="1.0">
    <dict>
        <key>key</key>
        <string>stringvalue</string>

        <key>numbers</key>
        <integer>12345</integer>

        <key>settings</key>
        <dict>
            <key>height</key>
            <integer>20</integer>

            <key>width</key>
            <integer>40</integer>

            <key>scale</key>
            <string>very yes</string>
        </dict>

        <key>things</key>
        <string>chair</string>

        <key>things</key>
        <string>hat</string>

        <key>things</key>
        <string>door</string>
    </dict>
</plist>


I would expect something like:

        <key>things</key>
        <array>
          <string>chair</string>
          <string>hat</string>
        <string>door</string>
      </array>


From what I can tell, the test case for this currently does not test arrays, the code is commented
out with the caption "todo : investigate why the array structure of 'newarray' is lost in
the saved file":
http://commons.apache.org/configuration/xref-test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.html#199

I cannot find an open issue in jira that relates to XMLPropertyListConfiguration, either.
Is the output I am getting correct, or is it effected by the issue that is preventing array
testing, or something else? should I post a bug?

I should note that I am using the commons-configuration-1.6.tar.gz as a source for org.apache.commons.configuration.

Any help would be great!

Thanks,
Matt Smith
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message