Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2807

Re: how to convert xml file to a string and write that string to another XML file format in XI/PI?

$
0
0

Hi nitin,

 

Earlier I was done upto string conversion and inserted that string in the output xml file but it always taking that string as a xml code but not as a plain string.

 

see the code below(just see the logic later i can convert this code into PI compatible)

 

public static void main(String[] args)throws IOException

    {

 

  FileInputStream fin = new FileInputStream("path");

  FileOutputStream fout = new FileOutputStream("path");

 

  BufferedReader br = new BufferedReader(new InputStreamReader(fin));

  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fout));

 

  br.readLine();

 

 

  String initialtag = "some code";

  String endtag = "some code";

  String line ;

 

  System.out.println("String Conversion Started");

 

 

  bw.write(initialtag);

    while((line = br.readLine()) != null)

        {

  //line.replaceAll("<","&lt");

    //line.replaceAll(">","&gt");

        bw.append(line);

    }

 

        bw.write(endtag);      

  bw.close();

 

  System.out.println("String Conversion Completed");

    }

 

 

another logic (line.replaceall.....) i tried this too but this didnt work


Viewing all articles
Browse latest Browse all 2807

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>