[HTML::Element] how to read element by element

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default [HTML::Element] how to read element by element

    Hello
    I read the doc about HTML::Element, but I don't find how to read the
    tree create by parse() element by element. The doc says the tree looks like:
    element #1: _tag: 'html'
    _parent: none
    _content: [element #2, element #5]
    lang: 'en-US'

    element #2: _tag: 'head'
    _parent: element #1
    _content: [element #3, element #4]

    element #3: _tag: 'title'
    _parent: element #2
    _content: [text segment "Stuff"]

    element #4 _tag: 'meta'
    _parent: element #2
    _content: none
    name: author
    content: Jojo

    element #5 _tag: 'body'
    _parent: element #1
    _content: [element #6]

    element #6 _tag: 'h1'
    _parent: element #5
    _content: [text segment "I like potatoes"]

    But, How can I access to element #2, element #5._content, ...?

    Thank you
    Julien

    julien Guest

  2. Similar Questions and Discussions

    1. Handling HTML element events using AxWebBrowser
      Hello, I am trying to hook into the events for HTML textboxes. In particular the onchange event. In the document complete handler I attach a...
    2. HTML::Element->right/->look_down lose, I need to walk the tree
      Consider this HTML::Element dump of a simple HTML page: <html> @0 <head> @0.0 <title> @0.0.0 "HTML::Element test" <body> @0.1 <div> @0.1.0...
    3. How to *modify* text in HTML::Element
      Sorry for the repost, I hit Send too soon. I am using HTML::TreeBuilder to futz with some HTML, and I need to modify the text of some of the...
    4. How to text in HTML::Element
      I am using HTML::TreeBuilder to futz with some HTML, and I need to modify the text of some of the HTML::Elements. But I use can't find an easy way...
    5. Value of an HTML element
      I have a HTML text box (NOT a TextBox server control) in a .aspx page and a button server control. Is it possible with ASP.NET to get the value of...
  3. #2

    Default Re: [HTML::Element] how to read element by element


    "julien" <julien@sobrier.net> wrote in message
    news:3f5926cc$0$28880$626a54ce@news.free.fr...
    > Hello
    > I read the doc about HTML::Element, but I don't find how to read the
    > tree create by parse() element by element.
    It sounds like you are talking about the traverse method. Also, you usually
    don't want to read a tree element by element.

    See look_down(). It is probably more useful. Also see objectify_text().



    Terrence Brannon Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139