Note that there are some explanatory texts on larger screens.

plurals
  1. POremoving remaining html tags
    text
    copied!<p>I have a lab assignment and I'm dwelled on about removing html tags. Here is method for removing html tags:</p> <pre><code>public String getFilteredPageContents() { String str = getUnfilteredPageContents(); String temp = ""; boolean b = false; for(int i = 0; i&lt;str.length(); i++) { if(str.charAt(i) == '&amp;' || str.charAt(i) == '&lt;') { b = true; } if(b == false) { temp += str.charAt(i); } if(str.charAt(i) == '&gt;' || str.charAt(i) == ';') { b = false; } } return temp; } </code></pre> <p>And here is my text's earliest form:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt; &lt;meta name="GENERATOR" content="Microsoft FrontPage 2.0"&gt; &lt;title&gt;A Shropshire Lad&lt;/title&gt; &lt;/head&gt; &lt;body bgcolor="#008000" text="#FFFFFF" topmargin="10" leftmargin="20"&gt; &lt;p align="center"&gt;&lt;font size="6"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt; &lt;div align="center"&gt;&lt;center&gt; &lt;pre&gt;&lt;font size="7"&gt;&lt;strong&gt;A Shropshire Lad &lt;/strong&gt;&lt;/font&gt;&lt;strong&gt; by A.E. Housman Published by Dover 1990&lt;/strong&gt;&lt;/pre&gt; &lt;/center&gt;&lt;/div&gt; &lt;p&gt;&lt;strong&gt;This collection of sixty three poems appeared in 1896. Many of them make references to Shrewsbury and Shropshire, however, Housman was not a native of the county. The Shropshire of his book is a mindscape in which he blends old ballad meters, classical reminiscences and intense emotional experiences &amp;quot;recollected in tranquility.&amp;quot; Although they are not particularly to my taste, their style, simplicity and timelessness are obvious even to me. Below are two short poems which amused me, I hope you find them interesting too.&lt;/strong&gt;&lt;/p&gt; &lt;hr size="8" width="80%" color="#FFFFFF"&gt; &lt;div align="left"&gt; &lt;pre&gt;&lt;font size="5"&gt;&lt;strong&gt;&lt;u&gt; XIII&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;strong&gt; When I was one-and-twenty I heard a wise man say, 'Give crowns and pounds and guineas But not your heart away;&lt;/strong&gt;&lt;/font&gt;&lt;/pre&gt; &lt;/div&gt;&lt;div align="left"&gt; &lt;pre&gt;&lt;font size="4"&gt;&lt;strong&gt;Give pearls away and rubies But keep your fancy free. But I was one-and-twenty, No use to talk to me.&lt;/strong&gt;&lt;/font&gt;&lt;/pre&gt; &lt;/div&gt;&lt;div align="left"&gt; &lt;pre&gt;&lt;font size="4"&gt;&lt;strong&gt;When I was one-and-twenty I heard him say again, 'The heart out of the bosom Was never given in vain; 'Tis paid with sighs a plenty And sold for endless rue' And I am two-and-twenty, And oh, 'tis true 'tis true. &lt;/strong&gt;&lt;/font&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/pre&gt; &lt;/div&gt; &lt;hr size="8" width="80%" color="#FFFFFF"&gt; &lt;pre&gt;&lt;font size="5"&gt;&lt;strong&gt;&lt;u&gt;LVI . The Day of Battle&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;strong&gt; 'Far I hear the bugle blow To call me where I would not go, And the guns begin the song, &amp;quot;Soldier, fly or stay for long.&amp;quot;&lt;/strong&gt;&lt;/font&gt;&lt;/pre&gt; &lt;pre&gt;&lt;font size="4"&gt;&lt;strong&gt;'Comrade, if to turn and fly Made a soldier never die, Fly I would, for who would not? 'Tis sure no pleasure to be shot.&lt;/strong&gt;&lt;/font&gt;&lt;/pre&gt; &lt;pre&gt;&lt;font size="4"&gt;&lt;strong&gt;'But since the man that runs away Lives to die another day, And cowards' funerals, when they come, Are not wept so well at home,&lt;/strong&gt;&lt;/font&gt;&lt;/pre&gt; &lt;pre&gt;&lt;font size="4"&gt;&lt;strong&gt;'Therefore, though the best is bad, Stand and do the best, my lad; Stand and fight and see your slain, And take the bullet in your brain.'&lt;/strong&gt;&lt;/font&gt;&lt;/pre&gt; &lt;hr size="8" width="80%" color="#FFFFFF"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And when implement my method on this text:</p> <pre><code> charset=iso-8859-1"&gt; A Shropshire Lad A Shropshire Lad by A.E. Housman Published by Dover 1990 This collection of sixty three poems appeared in 1896. Many of them make references to Shrewsbury and Shropshire, however, Housman was not a native of the county. The Shropshire of his book is a mindscape in which he blends old ballad meters, classical reminiscences and intense emotional experiences recollected in tranquility. Although they are not particularly to my taste, their style, simplicity and timelessness are obvious even to me. Below are two short poems which amused me, I hope you find them interesting too. . . . </code></pre> <p>My question is: How can I get rid of that little code at the very beginning of text <code>charset=iso-8859-1"&gt;</code>. I can't get away from that bunch of code? Thanks...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload