You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Eduardo Saltelli <ed...@gmail.com> on 2007/09/13 22:30:41 UTC
[ dbcp ] Release Date on 1.3
Just wondering if a date has been determined for 1.3?
TIA,
Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [ configuration ] setting top-level attributes
Posted by Oliver Heger <ol...@oliver-heger.de>.
Oliver Heger wrote:
> Bond - James D. wrote:
>>> Bond - James D. wrote:
>>>> Hopefully this is a simple one. I have a semi-non-standard xml file
>>>> that has attributes in the Top-level element and I'm not able to set
>>>> the attributes on it. How would I do that with XMLConfiguration? I
>>>> tried the following but it didn't work:
>>>>
>>>> xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
>>> Hm, your code should work. I added the following unit test, which
>>> runs successful:
>>>
>>> /**
>>> * Tests setting an attribute on the root element.
>>> */
>>> public void testSetRootAttribute() throws ConfigurationException
>>> {
>>> conf.setProperty("[@test]", "true");
>>> assertEquals("Root attribute not set", "true", conf
>>> .getString("[@test]"));
>>> conf.save(testSaveConf);
>>> XMLConfiguration checkConf = new XMLConfiguration();
>>> checkConf.setFile(testSaveConf);
>>> assertTrue("Attribute not found after save", checkConf
>>> .containsKey("[@test]"));
>>> }
>>>
>>> (where conf is a XMLConfiguration). As you can see, I also only
>>> specify the attribute part of the key.
>>>
>>> Can you double-check with this code? Or can you provide an example
>>> code fragment, which does not work?
>>>
>>> Oliver
>>
>> Ok, I can't get it to work ... here's my code:
>>
>> String xmlTemplate = "c:\\temp\\ordermessage.xml";
>> String newXmlTemplate = "c:\\temp\\changedordermessage.xml";
>>
>> XMLConfiguration xmlCfg = new XMLConfiguration(xmlTemplate);
>> xmlCfg.setValidating(false);
>> xmlCfg.setEncoding("UTF-8");
>> xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
>> xmlCfg.setProperty("[@timestamp]", new Date().toString());
>> FileWriter outter = new FileWriter(newXmlTemplate);
>> xmlCfg.save(outter);
>> outter.close();
>> xmlCfg.clear();
>>
>> And here is the XML file:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE cXML SYSTEM
>> "http://xml.cXML.org/schemas/cXML/1.2.008/cXML.dtd">
>> <cXML payloadID="29066032971189013758490"
>> timestamp="2007-09-12T09:34:16-05:00">
>> <Header>
>> <To>
>> <Credential domain="testID">
>> <Identity>12345</Identity>
>> </Credential>
>> </To>
>> </Header>
>> </cXML>
>>
>>
> After some further testing: you are right, there seems to be a bug! If
> the attribute already exists, a new value is not written. Can you open a
> ticket in jira [1], please?
>
> Thanks.
> Oliver
>
> [1]
> http://commons.apache.org/configuration/issue-tracking.html
>
Never mind. I created the ticket [1].
Oliver
[1] https://issues.apache.org/jira/browse/CONFIGURATION-296
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [ configuration ] setting top-level attributes
Posted by Oliver Heger <ol...@oliver-heger.de>.
Bond - James D. wrote:
>> Bond - James D. wrote:
>>> Hopefully this is a simple one. I have a semi-non-standard xml file that
>>> has attributes in the Top-level element and I'm not able to set the
>>> attributes on it. How would I do that with XMLConfiguration? I tried the
>>> following but it didn't work:
>>>
>>> xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
>> Hm, your code should work. I added the following unit test, which runs
>> successful:
>>
>> /**
>> * Tests setting an attribute on the root element.
>> */
>> public void testSetRootAttribute() throws ConfigurationException
>> {
>> conf.setProperty("[@test]", "true");
>> assertEquals("Root attribute not set", "true", conf
>> .getString("[@test]"));
>> conf.save(testSaveConf);
>> XMLConfiguration checkConf = new XMLConfiguration();
>> checkConf.setFile(testSaveConf);
>> assertTrue("Attribute not found after save", checkConf
>> .containsKey("[@test]"));
>> }
>>
>> (where conf is a XMLConfiguration). As you can see, I also only specify
>> the attribute part of the key.
>>
>> Can you double-check with this code? Or can you provide an example code
>> fragment, which does not work?
>>
>> Oliver
>
> Ok, I can't get it to work ... here's my code:
>
> String xmlTemplate = "c:\\temp\\ordermessage.xml";
> String newXmlTemplate = "c:\\temp\\changedordermessage.xml";
>
> XMLConfiguration xmlCfg = new XMLConfiguration(xmlTemplate);
> xmlCfg.setValidating(false);
> xmlCfg.setEncoding("UTF-8");
> xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
> xmlCfg.setProperty("[@timestamp]", new Date().toString());
> FileWriter outter = new FileWriter(newXmlTemplate);
> xmlCfg.save(outter);
> outter.close();
> xmlCfg.clear();
>
> And here is the XML file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.008/cXML.dtd">
> <cXML payloadID="29066032971189013758490" timestamp="2007-09-12T09:34:16-05:00">
> <Header>
> <To>
> <Credential domain="testID">
> <Identity>12345</Identity>
> </Credential>
> </To>
> </Header>
> </cXML>
>
>
After some further testing: you are right, there seems to be a bug! If
the attribute already exists, a new value is not written. Can you open a
ticket in jira [1], please?
Thanks.
Oliver
[1]
http://commons.apache.org/configuration/issue-tracking.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [ configuration ] setting top-level attributes
Posted by "Bond - James D." <ja...@telesoft.com>.
> Bond - James D. wrote:
> > Hopefully this is a simple one. I have a semi-non-standard xml file that
> > has attributes in the Top-level element and I'm not able to set the
> > attributes on it. How would I do that with XMLConfiguration? I tried the
> > following but it didn't work:
> >
> > xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
>
> Hm, your code should work. I added the following unit test, which runs
> successful:
>
> /**
> * Tests setting an attribute on the root element.
> */
> public void testSetRootAttribute() throws ConfigurationException
> {
> conf.setProperty("[@test]", "true");
> assertEquals("Root attribute not set", "true", conf
> .getString("[@test]"));
> conf.save(testSaveConf);
> XMLConfiguration checkConf = new XMLConfiguration();
> checkConf.setFile(testSaveConf);
> assertTrue("Attribute not found after save", checkConf
> .containsKey("[@test]"));
> }
>
> (where conf is a XMLConfiguration). As you can see, I also only specify
> the attribute part of the key.
>
> Can you double-check with this code? Or can you provide an example code
> fragment, which does not work?
>
> Oliver
Ok, I can't get it to work ... here's my code:
String xmlTemplate = "c:\\temp\\ordermessage.xml";
String newXmlTemplate = "c:\\temp\\changedordermessage.xml";
XMLConfiguration xmlCfg = new XMLConfiguration(xmlTemplate);
xmlCfg.setValidating(false);
xmlCfg.setEncoding("UTF-8");
xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
xmlCfg.setProperty("[@timestamp]", new Date().toString());
FileWriter outter = new FileWriter(newXmlTemplate);
xmlCfg.save(outter);
outter.close();
xmlCfg.clear();
And here is the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.008/cXML.dtd">
<cXML payloadID="29066032971189013758490" timestamp="2007-09-12T09:34:16-05:00">
<Header>
<To>
<Credential domain="testID">
<Identity>12345</Identity>
</Credential>
</To>
</Header>
</cXML>
--
James Dalrymple
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [ configuration ] setting top-level attributes
Posted by Oliver Heger <ol...@oliver-heger.de>.
Bond - James D. wrote:
> Hopefully this is a simple one. I have a semi-non-standard xml file that
> has attributes in the Top-level element and I'm not able to set the
> attributes on it. How would I do that with XMLConfiguration? I tried the
> following but it didn't work:
>
> xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
>
Hm, your code should work. I added the following unit test, which runs
successful:
/**
* Tests setting an attribute on the root element.
*/
public void testSetRootAttribute() throws ConfigurationException
{
conf.setProperty("[@test]", "true");
assertEquals("Root attribute not set", "true", conf
.getString("[@test]"));
conf.save(testSaveConf);
XMLConfiguration checkConf = new XMLConfiguration();
checkConf.setFile(testSaveConf);
assertTrue("Attribute not found after save", checkConf
.containsKey("[@test]"));
}
(where conf is a XMLConfiguration). As you can see, I also only specify
the attribute part of the key.
Can you double-check with this code? Or can you provide an example code
fragment, which does not work?
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
[ configuration ] setting top-level attributes
Posted by "Bond - James D." <ja...@telesoft.com>.
Hopefully this is a simple one. I have a semi-non-standard xml file that
has attributes in the Top-level element and I'm not able to set the
attributes on it. How would I do that with XMLConfiguration? I tried the
following but it didn't work:
xmlCfg.setProperty("[@payloadID]", ""+System.currentTimeMillis());
--
James Dalrymple
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [ dbcp ] Release Date on 1.3
Posted by Henri Yandell <fl...@gmail.com>.
On 9/13/07, Eduardo Saltelli <ed...@gmail.com> wrote:
> Just wondering if a date has been determined for 1.3?
Nope, we don't plan release dates here. Rather it's a case of getting
all the issues for a version fixed and then kicking off the release
cycle.
So there's "sometime" for the first step, and "soon" for the second.
Hen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org