473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do I get a string into a Document?

Jim
I probably am not describing what I want to do very well. I'm using the
method described in http://jibbering.com/2002/4/httprequest.html to
obtain an html document generated by a cgi script. I would like to use
the DOM access methods, like getelmentbyid and/or loop through elements
included in the html.

As shown in the example, I do:

xmlhttp.open("GET", "/cgi-bin/getall.cgi",true);

and

var stringData = xmlhttp.responseText;

Now that stringData is truely a string of the entire html document. I
know I can parse the document manually but I was sort of hoping I could
stuff it into a document. I also recognize it would be possible to have
the cgi generate an xml document which I could parse easily, however the
eventual goal is to take the output of a proprietary cgi program that
spits out formatted html.

So am I barking up the wrong tree or is there a way to get there from here?

Thanks,
Jim.
Sep 4 '06 #1
2 989


Jim wrote:

var stringData = xmlhttp.responseText;

Now that stringData is truely a string of the entire html document. I
know I can parse the document manually but I was sort of hoping I could
stuff it into a document.
So am I barking up the wrong tree or is there a way to get there from here?
Consider loading the URI /cgi-bin/getall.cgi directly into an iframe
then you can access the DOM of the iframe. I don't know of any of the
mainstream browser currently allowing you to parse a string with a
complete HTML document markup into a DOM document without using a
frame/iframe.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 4 '06 #2
Jim
Martin Honnen wrote:
>

Jim wrote:

>var stringData = xmlhttp.responseText;

Now that stringData is truely a string of the entire html document. I
know I can parse the document manually but I was sort of hoping I
could stuff it into a document.
>So am I barking up the wrong tree or is there a way to get there from
here?

Consider loading the URI /cgi-bin/getall.cgi directly into an iframe
then you can access the DOM of the iframe. I don't know of any of the
mainstream browser currently allowing you to parse a string with a
complete HTML document markup into a DOM document without using a
frame/iframe.
OK, thanks. I did try var doc = new Document(); but that generated an
error. Guess documents are not objects that can be instantiated.

Jim.
Sep 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wee | last post by:
String.value.length and String.value doesn't work together in a single function in IE. I've no problem running either of this, but not together at the same time. var...
3
by: sjanie | last post by:
The error code is: Microsoft JScript compilation error '800a03ec' Expected ';' /bicc.nl/Connections/BICCwebsite.asp, line 2 Set Conn = Server.CreateObject("ADODB.Connection") ----^
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
5
by: nboutelier | last post by:
Scenario: you enter "foo bar" into a text field... Is it possible through javascript to select/highlight just "foo"? formObject.select() selects all. I need to select only part of the string....
1
by: Daniel | last post by:
in C# how do i transform an xml document with an xsl document when my xml document is a string and my xsl document is a string? the msdn examples only show how to do it with steams and files. in my...
1
by: Daniel | last post by:
in C# how do i transform an xml document with an xsl document when my xml document is a string and my xsl document is a string? the msdn examples only show how to do it with steams and files. in my...
2
by: VK | last post by:
Does anyone have a reputable reference about internal string storage in JavaScript? (for some particular implementation I mean). Say having 1,048,576 characters long string from the geometric...
1
Atli
by: Atli | last post by:
The following small HowTo is a compilation of an original problem in getting some cookie-values through different methods of string-handling. The original Problem was posted as follows: As...
14
by: Stevo | last post by:
If you split a string into an array using the split method, it's not working the way I'd expect it to. That doesn't mean it's wrong of course, but would anyone else agree it's working somewhat...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.