Transform html to code

S

Steve

Is there a class that will assist with taking existing aspx markup from a
file and creating a sort of tree structure that will allow you to transform
the html layout to code?

Example aspx code:

<asp:Table runat=server>
<asp:TableRow>
<asp:TableCell>
<asp:Label id=mylabel>test</asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>

Resulting code:

Table t= new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();
Label lbl = new Label();
lbl.Text = "test";
tc.Controls.Add(lbl);
tr.Cells.Add(tc);
t.Rows.Add(tr);

Thanks,
S
 
K

Kannan.V [MCSD.net]

hi steve,

I havent heard of it till now, somebody else might.....
Nice idea for a small application.......to be written.....

Some ideas just in case nothing is available.....
The file structure is similar to an XML file, so the aspx file can be read
and the code can be generated using the XML tags.......in the way u wanted.

regds
Kannan.V
 
S

Steve

Kannan,

Thank you for the response. I may pursue it in the future when I have more
time. Do you know if C# supports some kind of eval function that would
attempt to create a new instance of whatever tag name it found or would you
have to evaluate each tag name on a case-by-case basis?

Steve
 
K

Kannan.V [MCSD.net]

hi steve,

Thinking of doing something similar when i get some free time
Not sure of any C# eval function.
We need to do it on a case by case basis.

Having a faint idea on using XML and XSLT to loop thro similar tags and
having XSLT convert them, this will be something similar to coverting XL data
to XML and XML data to XL using XSLT's.....

need to a lot more research into that......
wishing u good luck on ur quest.

thanks
Kannan.V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top