Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. HTML de-bloater

HTML de-bloater

Scheduled Pinned Locked Moved The Lounge
questionhtmlcomannouncement
41 Posts 18 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Steven Hicks n 1

    Well the browser translates the HTML "code" into something visual it could regenerate what was translated and displayed back into code (which would be smaller, and not resulting in <font color="blue">h</font>he<font color="black">ll</font>o world). -Steven "the yellow dart" Hicks

    CPA

    CodeProjectAddict

    Actual Linux Penguins were harmed in the creation of this message.

    More tutorials: Ltpb.8m.com: Tutorials |404Browser.com (Download Link)

    P Offline
    P Offline
    Paul Watson
    wrote on last edited by
    #30

    I hear what you are saying. When IE parses the HTML document it must convert style="color: red" into something which Windows can understand and display. Also I assume it builds up a "tree" of the code. Now, it would be nice to think IE optimises that tree, detects redudnant styles and bits and excludes them. But does it? Also if you have ever used the DOM in IE to access the innerHTML property of an element you will see the pure and utter tripe that IE returns. It even takes wonderfully coded HTML and spits out rubbish (not knocking Chris at all but go to the submission wizard and using the nice new WYSIWYG editor put in some good HTML. Then swap to WYSIWYG view, then swap back to HTML view... You see what it does? Uppercases elements, rips out quotes, puts in FONT tags and what not. That is IE doing it! Shocking.) Redundant tags are fine, even I could probably write a parser that figured out redundant tags. It is when someone uses a TABLE instead of a DIV or a SPAN instead of a LABEL that it must become damned hard to write an optimiser. Also how does an optimiser "see" what the developer is trying to produce and then re-write the code to make it happen? Really, I don't think currently that can be done.

    Paul Watson
    Bluegrass
    Cape Town, South Africa

    Robert Edward Caldecott wrote: My father-in-law calls yer man bits "weasels"

    S 1 Reply Last reply
    0
    • V Vikram A Punathambekar

      Short question: Does anybody know of a good HTML debloater that can strip useless HTML code? Long reason: I happen to be a Frontpage fan. I'm rewriting my site from scratch using FP, and the only gripe I have with it is that it produces incredibly bloated HTML code. It doesn't rub well with those on dialup, like me. On a related note: Following CP advice, I decided to try out Dreamweaver MX. I have 25 more days to go before the trial version expires and it can prove to me that it doesn't suck. So far, it's losing - badly. If I can't get my hands on a debloater, I'll have to do it by hand. X| TIA,
      Vikram. ----------------------------- My soon-to-be-updated site KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames. pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking.

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #31

      You may want to check out this tool: HTML TIDY Sounds like it might do just what you need... :)

      Shog9

      drifting along with the tumbling tumbleweeds...

      J 1 Reply Last reply
      0
      • S Shog9 0

        You may want to check out this tool: HTML TIDY Sounds like it might do just what you need... :)

        Shog9

        drifting along with the tumbling tumbleweeds...

        J Offline
        J Offline
        J Dunlap
        wrote on last edited by
        #32

        Excellent! I use this sometimes, because HTML-Kit has a "Check With HTML-Tidy" command built in. :cool:

        "Blessed are the peacemakers, for they shall be called sons of God." - Jesus
        "You must be the change you wish to see in the world." - Mahatma Gandhi

        1 Reply Last reply
        0
        • P Paul Watson

          I hear what you are saying. When IE parses the HTML document it must convert style="color: red" into something which Windows can understand and display. Also I assume it builds up a "tree" of the code. Now, it would be nice to think IE optimises that tree, detects redudnant styles and bits and excludes them. But does it? Also if you have ever used the DOM in IE to access the innerHTML property of an element you will see the pure and utter tripe that IE returns. It even takes wonderfully coded HTML and spits out rubbish (not knocking Chris at all but go to the submission wizard and using the nice new WYSIWYG editor put in some good HTML. Then swap to WYSIWYG view, then swap back to HTML view... You see what it does? Uppercases elements, rips out quotes, puts in FONT tags and what not. That is IE doing it! Shocking.) Redundant tags are fine, even I could probably write a parser that figured out redundant tags. It is when someone uses a TABLE instead of a DIV or a SPAN instead of a LABEL that it must become damned hard to write an optimiser. Also how does an optimiser "see" what the developer is trying to produce and then re-write the code to make it happen? Really, I don't think currently that can be done.

          Paul Watson
          Bluegrass
          Cape Town, South Africa

          Robert Edward Caldecott wrote: My father-in-law calls yer man bits "weasels"

          S Offline
          S Offline
          Steven Hicks n 1
          wrote on last edited by
          #33

          Well I created an XML Editor last summer (which now I don't have the source code to anymore due to an nefarious XP+ZoneAlarm crash during linking), but it parsed the XML document in to a tree when it was opened, when it had been modified and saved then it recreated the XML file, but without the unneeded spaces between tags etc. -Steven "the yellow dart" Hicks

          CPA

          CodeProjectAddict

          Actual Linux Penguins were harmed in the creation of this message.

          More tutorials: Ltpb.8m.com: Tutorials |404Browser.com (Download Link)

          P 1 Reply Last reply
          0
          • T Terry Denham

            Chris, What problem are you having with the APS.NET controls? I don't like how hard they are to use in the VS.NET designer especially the Panel control but I work around this by using Tables to control my layout. The controls themselves appear to render just fine although I've seen some problem with them rendering against NS 4.x. but then they would also have problems rendering against IE 4.x

            C Offline
            C Offline
            Chris Maunder
            wrote on last edited by
            #34

            The ASP controls output appalling HTML. Take a table, give it a border of 1 and take a look at the output. I can guarantee it's not <table border="1">. Also, if you create a form using the ASP.NET controls then the old "type your input and hit Enter" doesn't work becuase ASP.NET likes to use a button with javascript to fire the postback instead of the <input type=submit that is usual. Great - what if the user has javascript disabled? Or has webwashing software the strips out javascript? And, ASP.NET controls (at the moment) really only work with IE5 and above. Anything else is considered 'downlevel'. Mozilla 5 and Netscape 6 were actually more standards compliant than IE5 yet Microsoft considered these 'downlevel' which is at the best lazy, and at the worst offensive - especially when many websites (eg http://windowsxp.devx.com[^]) simply crash some versions of IE6 but work just fine thank you very much using any other browser. Ask Paul about XHTML and ASP.NET... cheers, Chris Maunder

            1 Reply Last reply
            0
            • J Jamie Hale

              I find you can cut down on that lag by moving the de-bloatification code to firmware. I reprogrammed an old toaster of mine to do it for me. Keep up with the times, Johnny. :cool: J

              "You can get anything you want at Alice's Restaurant."

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #35

              Jamie Hale wrote: I reprogrammed an old toaster of mine to do it for me :laugh: Paul ;) Computers let you make more mistakes than any other invention in history....with the possible exception of handguns and tequila.

              1 Reply Last reply
              0
              • S Steven Hicks n 1

                Well I created an XML Editor last summer (which now I don't have the source code to anymore due to an nefarious XP+ZoneAlarm crash during linking), but it parsed the XML document in to a tree when it was opened, when it had been modified and saved then it recreated the XML file, but without the unneeded spaces between tags etc. -Steven "the yellow dart" Hicks

                CPA

                CodeProjectAddict

                Actual Linux Penguins were harmed in the creation of this message.

                More tutorials: Ltpb.8m.com: Tutorials |404Browser.com (Download Link)

                P Offline
                P Offline
                Paul Watson
                wrote on last edited by
                #36

                Ok this is what we are all saying. Stripping out spaces, redundant tags and things like that is fine, that we can do and there are tools for it. Now if my bet is wrong then you are sitting on a gold mine but I bet your XML Editor does not look at an XML doc and say "hey buddy! you don't need those namespaces and you can do away with that entity reference and what about changing that string element to a foobar element" etc. etc. Something a bit intelligent that can divine the purpose of a document and optimise it accordingly. Now big apps such as Dreamweaver, Frontpage, GoLive etc. don't have these optimisers. They have the strippers and what not, but not the semantic-like optimisers. XML is probably actually easier to optimise than HTML because there is no visual representation side to worry about. Now I believe anything is possible. Given enough time and some big brains someone could figure this out, but it is not as simple as stripping white space and redundant tags.

                Paul Watson
                Bluegrass
                Cape Town, South Africa

                Robert Edward Caldecott wrote: My father-in-law calls yer man bits "weasels"

                1 Reply Last reply
                0
                • realJSOPR realJSOP

                  I do all my HTML "code" by hand. ------- signature starts "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 Please review the Legal Disclaimer in my bio. ------- signature ends

                  S Offline
                  S Offline
                  Sijin
                  wrote on last edited by
                  #37

                  But why?..It's like coding in assembly.


                  I always think that the idea of a compiler that compiles another compiler or itself is rather incestuous in a binary way. - Colin Davies My .Net Blog

                  1 Reply Last reply
                  0
                  • B basementman

                    I have a little utility I wrote to strip out all of the unnecessary spaces and tabs to help compress dynamic html fragments. If you would like to use it, let me know.  onwards and upwards...

                    V Offline
                    V Offline
                    Vikram A Punathambekar
                    wrote on last edited by
                    #38

                    basementman wrote: If you would like to use it, let me know. Not exactly what I was looking for, but it never hurts to get your hands on something new. :-D What's the URL? Thanx,
                    Vikram. ----------------------------- My soon-to-be-updated site KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames. pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking.

                    B 1 Reply Last reply
                    0
                    • V Vikram A Punathambekar

                      basementman wrote: If you would like to use it, let me know. Not exactly what I was looking for, but it never hurts to get your hands on something new. :-D What's the URL? Thanx,
                      Vikram. ----------------------------- My soon-to-be-updated site KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames. pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking.

                      B Offline
                      B Offline
                      basementman
                      wrote on last edited by
                      #39

                      http://test.pubsuite.com/Jeff/StripSpaces.zip  onwards and upwards...

                      V 1 Reply Last reply
                      0
                      • D dandy72

                        > I do all my HTML "code" by hand. I'm a Notepad fan myself. If there's any bloat, you only have yourself to blame. ;P

                        W Offline
                        W Offline
                        William Bartholomew
                        wrote on last edited by
                        #40

                        Vim is the way to go :)

                        1 Reply Last reply
                        0
                        • B basementman

                          http://test.pubsuite.com/Jeff/StripSpaces.zip  onwards and upwards...

                          V Offline
                          V Offline
                          Vikram A Punathambekar
                          wrote on last edited by
                          #41

                          basementman wrote: _http://test.pubsuite.com/Jeff/StripSpaces.zip_ Thanks! :rose:
                          Vikram. ----------------------------- My soon-to-be-updated site KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames. pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups