Sign in to follow this  
Shweta k

String To Xml Conversion

Recommended Posts

Hi,

 

 

I am trying to parse String to XML using FileWriter ,so I am able to parse the data.

Next thing is to fetch the data from xml in xhtml page to display the graph.

But the problem is that I have to initially once refresh the XML file.

 

I want to know how to fetch the data from XML without refreshing?

 

 

 

For reference will share my code:

 

 

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

 

 

String strXML = ” <graph caption="Annual Sales Summary" subcaption="For the period of 2004 to 2007"xAxisName="Year" yAxisName="Sales" numberPrefix="$"><set name="2004" value="37800" color='F6BD0F' /><set name="2005" value="21900" color='8BBA00' /></graph> ”

 

 

BufferedWriter out = new BufferedWriter(new FileWriter("WebContent/Data/outfilename.xml"));

 

 

try {

 

out.write(strXML);

 

}

 

catch (IOException e) {

 

e.printStackTrace();

 

}

 

finally{

 

out.close();

 

}

}

 

 

 

Regards,

 

Shweta K

 

 

 

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi Shweta,

 

With regard to your query, could you please confirm once, if you have the entire XML string in the "outfilename.xml" file after writing the "strXML" string contents?

 

Also, could you please provide the code snippet for fetching the data from XML to XHTML page?

 

Please note that FusionCharts takes data in the form of XML data either as string or your can pass the URL of XML file to render the graph.

 

For more information on "FusionCharts XT and XML", please follow the link below:

http://docs.fusioncharts.com/charts/contents/?DataFormats/XML/Overview.html

 

Awaiting your response.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this