javascript: parse HTML string into DOM

Discussion in 'Firefox' started by kit, Feb 4, 2008.

  1. kit

    kit

    Joined:
    Jan 27, 2008
    Messages:
    1
    As title, I need to parse html string into node-tree.
    But there are some complications.
    1) I need to parse HTML, not XHTML or some other XML subsets. e.g. text may have 'script' tags with plain javascript inside.
    2) I need to parse whole HTML document. From <html xmlns=...> to </html>. Many methods (like innerHTML or some dojo functions) can't handle whole HTML document but only pieces. Moreover, when I write html document in that way, internal content usually becomes corrupted. Simply speaking, most of tags are missed in resulted structure.

    In fact, after few days of search I've come to solution which works for IE7. Will describe it briefly. 'iframe' tag by default has empty document inside (even if it's declared without 'src' attribute). So it's possible to declare hidden iframe and then make 'doc.write(text)'. But in FF written data becomes corrupted, like I said above.

    So the question: may be someone did something similiar before :) The problem is really weird and I gonna give up. Will appreciate any help.
     
    kit, Feb 4, 2008
    #1
    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. yours
    Replies:
    0
    Views:
    817
    yours
    May 12, 2007
  2. Shane

    To Javascript, or not to Javascript

    Shane, Aug 29, 2005, in forum: NZ Computing
    Replies:
    5
    Views:
    555
    Waylon Kenning
    Aug 30, 2005
  3. anjali1213

    Html Dom

    anjali1213, Jul 17, 2008, in forum: Software
    Replies:
    0
    Views:
    673
    anjali1213
    Jul 17, 2008
  4. newasp.net
    Replies:
    1
    Views:
    1,663
    imransyed63
    Aug 21, 2008
  5. abhicreate

    Parse XML data into Excel in unix

    abhicreate, Oct 19, 2011, in forum: General Computer Support
    Replies:
    0
    Views:
    1,261
    abhicreate
    Oct 19, 2011
Loading...

Share This Page