You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Eric Pugh <ep...@upstate.com> on 2004/08/10 10:55:29 UTC

[Configuration] XML Processing Problem

Hi all,

After removing the ConfigurationXMLDocument  I am down to two bugs.  Right
now the testSave method of TestXmlConfiguration fails on the array check
when testing XmlConfiguration.  The reason is that this line:

CharacterData data = document.createTextNode((String) value); seems to be
adding array elements into one string versus multiple elements.  The XML
should look like:

 <test>
          	<array>value1</array>
		<array>value2</array>
		<array>value3</array>
		<array>value4</array>
</test>

However, it looks like:
 <test>
         <array>value1value2value3value4</array>
</test>



The same basic problem occurs with this loop:
        // add an array of strings in an attribute
        for (int i = 1; i < 5; i++)
        {
            conf.addProperty("test.attribute[@array]", "value" + i);
        }

However, in this case, instead of add value1, value2, etc:
 <test>
          	<attribute array="value1"/>
          	<attribute array="value2"/>
          	<attribute array="value3"/>
          	<attribute array="value4"/>
</test>

we get just:
 <test>
          	<attribute array="value4"/>
</test>


Any suggestions on how to fix this?  I am somewhere deep down in private
void setXmlProperty(String name, Object value) and quite lost!

Eric




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Configuration] XML Processing Problem

Posted by Emmanuel Bourg <sm...@lfjr.net>.
Ricardo Gladwell wrote:

> Hi,
> 
> I believe this has already been fixed. The solution I used was:
> 
> <test>
>   <array attribute="value1"/>
>   <array attribute="value2"/>
>   <array attribute="value3"/>
>   <array attribute="value4"/>
> </test>
> 
> Using one comma seperated string would mean that attributes cannot 
> otherwise contain comma characters.
> 
> Kind regards...

This is true for CSV values in PropertiesConfiguration as well, there is 
an RFE to allow alternate delimiters, this would apply to 
XMLConfiguration too.

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Configuration] XML Processing Problem

Posted by Ricardo Gladwell <ri...@btinternet.com>.
Hi,

I believe this has already been fixed. The solution I used was:

<test>
   <array attribute="value1"/>
   <array attribute="value2"/>
   <array attribute="value3"/>
   <array attribute="value4"/>
</test>

Using one comma seperated string would mean that attributes cannot 
otherwise contain comma characters.

Kind regards...

-- 
Ricardo Gladwell

Emmanuel Bourg wrote:
> Eric Pugh wrote:
> 
>> Any suggestions on how to fix this?  I am somewhere deep down in private
>> void setXmlProperty(String name, Object value) and quite lost!
> 
> 
> Hehe welcome to the setXmlProperty hell ;) I think we'd better use comma 
> separated values for list properties in attributes:
> 
> <test>
>     <attribute array="value1, value2, value3, value4">
> </test>
> 
> Emmanuel Bourg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Configuration] XML Processing Problem

Posted by Emmanuel Bourg <sm...@lfjr.net>.
Eric Pugh wrote:

> Any suggestions on how to fix this?  I am somewhere deep down in private
> void setXmlProperty(String name, Object value) and quite lost!

Hehe welcome to the setXmlProperty hell ;) I think we'd better use comma 
separated values for list properties in attributes:

<test>
     <attribute array="value1, value2, value3, value4">
</test>

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org