Turning XML Return Value into Model for MVC

sohnaych

New Member
I have a question. I have a webservice that simple returns XML strings. For example, If I had a database with First Name, Last Name, Phone, Address for columns. I would get an XML string like the following...\[code\]<xml><Person> <FirstName id="Fname" value="http://stackoverflow.com/questions/10687727/Greg"/> <LastName id="Lname" value ="http://stackoverflow.com/questions/10687727/Brady"/> <Phone id="phone" value="http://stackoverflow.com/questions/10687727/8675309" /> <Address id="Address" value="http://stackoverflow.com/questions/10687727/123 MakeBelieve Lane"/></Person>\[/code\](That was just an example XML.. the stuff I am using is much more complex) Now previously, I have just used the XML string as my model, and I just built my views but Xpathing through the xml string and getting what I need out of there based on various things which are not important to this exmaple. I want to improve this a little bit. I know for a fact that I am still going to be getting an XML string out of this service. So I want to turn this XML string into an object that can actually be used as a model in the MVC pattern. So I posit that I will need a repository layer to help out with this. I am wondering if there is a set pattern to do this. Since this is not going to be the standard MVC pattern, (for example, when the model changes, you would have to update an XML string and send that accross the wire via a webservice) I was wondering if it would work in a similar fashion. Or would I need to make many changes that would be hard to implement...I guess I am just to think of ways that this would break the pattern that I already have... I am hoping that this would be a relatively quick and simple change (I know whenever you change the foundation of an application you are not necessarily talking about quick and simple, but I think in this case it should be). What are your thoughts?
 
Back
Top