views:

172

answers:

4
+1  Q: 

From XML to object

I would like to define an asp.net page from xml, then parse/render it by calling a command name. Just like they do in Flex. Does someone has an idea how to do that?

Like for example, from XML:

<button onClick="DoJavascript()" text="Submit"/>
<gridview ......./>

To parse:

<asp:button runat="server" onClick="DoJavascript()" text="Submit"/>
<asp:gridview runat="server" ......./>
+1  A: 

You could try XSLT, that's in general what is used to transform XML.

Otávio Décio
A: 

Thanks ocdecio, Yes XSLT does that in general. And that is with data. But what about objects?

The problem I see is when is your generated output gets actually compiled.
Otávio Décio
A: 

In your case data and objects are synonymous. Basically you are taking your top XML and spit it out into ASP.Net pages. I don't have enough experience with ASP.Net to tell you how you would go ahead and now parse the code programmatically into a Page object, but, if you wanna do the transformation and let ASP.Net parse/render the aspx, this is all you need.

siz
A: 

Hiz siz and thank you. I don't think it is that easy. If you look up on example xml and expected output, you say that I can make a general page object creator? As I see it, it will be very favourable if xml->page object can parse entities and attributes by finding the controls through the .net libraries as System.Web.UI.WebControls and System.Web.UI.HtmlControls just by adapting attributes to valid properties and events. You reaaly think that is the case?

Replies to answers need to be put in the comments of that answer. otherwise stuff gets lost when somone votes for something...
Omar Kooheji
He has no rep and you need (or at least did need( rep to comment.
Graphain