2

I am trying to read xml using Apache commons configuration

this is my sample xml file

<tu tuid="chan@">
        <note>Label for iCare OLTP administration.</note>
        <prop type="maxlength">75</prop><prop type="minlength">1</prop>
        <tuv lang="ES-ES">
               <seg>Programa, tarjetas, cupones y reglas</seg>
        </tuv>
</tu>

this is my java code:

 List<ConfigurationNode> tuvNode = element.getChildren("tuv");
 List<ConfigurationNode> segNode = tuvNode.get(0).getChildren("seg");                  

 System.out.println(segNode.get(0).getValue());

out put is:

Programa

Actually it is working.problem is when it has "," then it doesn't give rest of other values.i need whole value.any one can give idea. my expected out put is:

Programa, tarjetas, cupones y reglas

i really appreciate

thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Zcon
  • 153
  • 6
  • 18
  • also, if you accept to use another xml library, it is very easy with java xml. – guillaume girod-vitouchkina Dec 18 '15 at 07:44
  • This situation i have to use this library.so i need to how to get whole value.it is working other characters.problems is if there "," it is not return rest of other values...Thank you – Zcon Dec 18 '15 at 07:49

2 Answers2

1

',' is interpreted as a value separator.

try this:

setDelimiterParsingDisabled(true); //  to disable parsing list of properties.

more details here: apache commons configuration loads property until "," character

Community
  • 1
  • 1
  • first link is not working (http://commons.apache.org/configuration/apidocs/org/apache/commons/configuration/PropertiesConfiguration.html) please give correct link.thank you very much – Zcon Dec 18 '15 at 08:00
  • where I must set this vale setDelimiterParsingDisabled(true); this is sample code snip config = new XMLConfiguration(filename); Node node = config.getRoot(); List bodyTag = node.getChildren("body"); List elementsInBodyTag = bodyTag.get(0).getChildren();....... List tuvNode = element.getChildren("tuv"); List segNode = tuvNode.get(0).getChildren("seg"); String segNodeVal = segNode.get(0).getValue();Thank you – Zcon Dec 18 '15 at 08:16
  • config = new XMLConfiguration(filename); config.setDelimiterParsingDisabled(true); I did SetDekimiter true. but it is not working..any way thanks very much for your idea and wating for your reply – Zcon Dec 18 '15 at 08:31
0

@ guillaume girod-vitouchkina Thanks for your Idea

we have set value like that initialize Configuration object with no arguments

config = new XMLConfiguration();

Then disable delimiter

config.setDelimiterParsingDisabled(true);

after that give xml file name

config.load(filename);

after that rest of code

useful linkdoc

Zcon
  • 153
  • 6
  • 18