Web link data extraction and JSON to XML conversion

Five Stars

Web link data extraction and JSON to XML conversion

Hi
I'm trying to fetch data from software link. 

Here's is my job

tLibraryLoad--->tRest--->tJavaRow--->tFileoutputDelimited--->tfileoutputxml--->tlogrow
In tJavarow am using this

org.json.JSONObject jsonFileObject = new org.json.JSONObject(input_row.Body);
output_row.Body = "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<root>" + org.json.XML.toString(jsonFileObject ).replaceAll("48x48>", "tag48x48>").replaceAll("16x16>", "tag16x16>").replaceAll("32x32>", "tag32x32>").replaceAll("24x24>", "tag24x24>") + "</root>";

In tFileoutputDelimited am getting xml file.

After running a job am getting error like this

Starting job weblink12 at 18:52 19/10/2015.
connecting to socket on port 3412
connected
Error on line 2 of document  : Content is not allowed in trailing section. Nested exception: Content is not allowed in trailing section.
disconnected
Job weblink12 ended at 18:52 19/10/2015.
Please help
Community Manager

Re: Web link data extraction and JSON to XML conversion

For debugging, add a tLogRow after tJavaRow to print the body on the console to see what does the data looks like?
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars

Re: Web link data extraction and JSON to XML conversion

Hi Shong
I'm receiving xml file at tFileoutputDelimited . But there is slightly error in xml file but after fixing that aI'm getting my getting data.
Is there any way to use validate xml file after receiving at tfileoutput delimited and then use that file with ifileinputxml?
Any way ?
Seventeen Stars

Re: Web link data extraction and JSON to XML conversion

Hi all,
seems that you'got some 'bad hyphen' (unwanted) at the end of your xml.
you can check your xml against DTD or XSD thanks txsd validator
regards
laurent