Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing a document

Status
Not open for further replies.

ndogg

Programmer
Feb 7, 2000
156
US
I have been trying to figure out a way of parsing a document, especially the part that will be seen by the browser. My thought is to be able to set up something in frames so that one page in one frame can parse the text in another frame, but I can't figure out how to assign the text to some type of array. Any thoughts? <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
Maybe you could publish your solution to enlighten others....
 
Actually, I ran into another problem anyway. In my attempts to parse a document, I decided the user should just paste the resulting words from the web page to a textarea and I would just parse that. Since the textarea is nothing more than a really huge string, I decided I would use the strip() function to create an array of the words. I knew that documents can get pretty long so the array limit of 99 ended up with its problems. I thought I could get around that by writing code for a multi-dimensional array and that's where I ran into problems. The following is the code for my 2 dimensional array (I changed all the i's to x's so that they're not seen by Tek-Tips as italics):<br>
<i><br>
// Create second dimension array<br>
for (var x; x &lt; strings.length; x++);<br>
{<br>
// The array strings[] was defined earlier<br>
strings[x] = new Array(99);<br>
}<br>
</i><br>
When I decided to try to assign the words to the new 2d array, I realized that it was going to end up having the same first 99 words of the document if I were to use the following code:<br>
<i><br>
// Strip words from form<br>
for (var x; x &lt; 99; x++)<br>
{<br>
strings[x] = dform.strip(&quot; &quot;, 99);<br>
if (strings[x].length &lt; 99)<br>
{<br>
break;<br>
}<br>
}<br>
</i><br>
You can see the problem, right? If anyone knows how to get around this, please let me know. <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top