Transform html to code

Discussion in 'ASP .Net Building Controls' started by Steve, Apr 10, 2005.

  1. Steve

    Steve Guest

    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
     
    Steve, Apr 10, 2005
    #1
    1. Advertising

  2. 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

    "Steve" wrote:

    > 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
     
    Kannan.V [MCSD.net], Apr 11, 2005
    #2
    1. Advertising

  3. Steve

    Steve Guest

    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

    "Kannan.V [MCSD.net]" wrote:

    > 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
    >
    > "Steve" wrote:
    >
    > > 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
     
    Steve, Apr 11, 2005
    #3
  4. 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

    "Steve" wrote:

    > 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
    >
    > "Kannan.V [MCSD.net]" wrote:
    >
    > > 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
    > >
    > > "Steve" wrote:
    > >
    > > > 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
     
    Kannan.V [MCSD.net], Apr 12, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anthony Harkness-Gripe

    Dataset to XSL Transform not displaying HTML--only XML

    Anthony Harkness-Gripe, Aug 14, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,041
    itnrant
    Jul 8, 2008
  2. ibiza
    Replies:
    5
    Views:
    1,220
    S. Justin Gengo [MCP]
    Feb 9, 2006
  3. =?Utf-8?B?UnViZW4=?=

    Transform Word XML to HTML

    =?Utf-8?B?UnViZW4=?=, Mar 27, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    4,087
    =?Utf-8?B?UnViZW4=?=
    Mar 28, 2006
  4. Johannes Koch
    Replies:
    0
    Views:
    863
    Johannes Koch
    Jul 2, 2003
  5. Marrow
    Replies:
    0
    Views:
    4,171
    Marrow
    Jul 2, 2003
Loading...

Share This Page