Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am having an XML file which contains details Library and books and a JSON file which also contains details Library and books as well, but with a different structure and we need a web service which manipulates the two different files and returns a unified output as XML to a front-end MVC app that displays returned results in a grid (each row represent a hotel with child rows that represent rooms) with a filtration facility. Combine results from both JSON and XML files in a unified output.

What I have tried:

[WebMethod]
public DataSet XmlReadHotel()
{
XmlTextReader xrdr = new XmlTextReader(Server.MapPath("Xml Hotels Result.xml"));

DataSet ds = new DataSet();

ds.ReadXml(xrdr);

return ds;
}
Posted
Updated 26-Jul-16 1:13am
Comments
Mehdi Gholam 26-Jul-16 6:44am    
Just add a table to your DataSet and populate it via the json data.

1 solution

I'd come up with an object that represents the unified data you want to present to the site, and you'll probably want a List of those.

Then you'll need a routine that reads the XML and converts that XML to a list of the unified data object. Then a separate routine that does the same for JSON. You can add the outputs of both of those routines to the same List and return that list as XML via serialisation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900