Hi Santosh,

you should also be aware that a file like the following is no valid xml.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<city>
    <citycode>XYZ</citycode>
    <countrycode>au</countrycode>
</city>
<city>
    <citycode>ABC</citycode>
    <countrycode>ad</countrycode>
</city>

An xml file has to contain exactly one root element.

Christian



Am 22.11.2011 23:13, schrieb santoshjoshi:
Environment
Camel:2.8.1
java 6

i have a  pojo like

@XmlRootElement(name = "city")
public class City{

     @XmlElement(name = "citycode", required = true)
     protected String citycode;

     @XmlElement(name = "countrycode", required = true)
     protected String countrycode;

}


i am getting a list of the above cities from a web service Calls Like
*List<City>  cities *

I want to split the above list and group the country related cities into a
single file
and for which i am using the below code

<camel:split streaming="true">
        <camel:simple>body</camel:simple>
        <camel:to
uri="file:/home/country-{body.countrycode}/?fileName=city.xml&amp;fileExist=Append"
/>
</camel:split>

the code works fine but it gives me the out like

*<?xml version="1.0" encoding="UTF-8" standalone="yes"?>*
<city>
     <citycode>XYZ</citycode>
     <countrycode>au</countrycode>
</city>
*<?xml version="1.0" encoding="UTF-8" standalone="yes"?>*
<city>
     <citycode>ABC</citycode>
     <countrycode>ad</countrycode>
</city>


I just want to ignore all<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>  while writing and appending to xml files.


Thanks
Santosh

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-write-or-append-content-to-XML-file-without-XML-declaration-tp5014969p5014969.html
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com

Reply via email to