From: tedd on
At 10:03 AM -0600 4/3/10, Nathan Nobbe wrote:
>-snip- code

Your code worked like a charm.

Thanks.

>Now, I can extract each question by using javascript --
>
>document.getElementById("question").innerHTML;
>
>
>tedd, are you slipping? i thought you were searching by the class
>attribute, lol.

Yeah, I was looking at the wrong example I created.

That example used ID's and I thought it was operating on class.

Sorry,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
From: Ashley Sheridan on
On Sat, 2010-04-03 at 09:33 -0600, Peter Pei wrote:

> > Sort of.
> >
> > Like I said, the folling will work:
> >
> > document.getElementById("question").innerHTML;
> >
> > While you are using a getElementById, which returns an ID, but adding
> > .innerHTML will return the class value.
> >
> > Try it.
> >
> > Cheers,
> >
> > tedd
>
> No, this will not work, if it appeared working, please re-check your data,
> and make sure you didn't miss anything...
>
> Run the following in any browser, and see whether you get a pop up, then
> change class= to ID=, and run it again.
> <body onload='alert(document.getElementById("question").innerHTML)'>
> <p class="question">
> Who is Roger Rabbit?
> </p>
> </body>
>
> innerHTML works off an object, and it does nothing if youu cannot even
> locate the object in the first place.
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>


It might have worked in Internet Explorer, as for a while that browser
got confused over the class and id if two different elements on a page
had the same class and id values.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: "Peter Pei" on

>
> It might have worked in Internet Explorer, as for a while that browser
> got confused over the class and id if two different elements on a page
> had the same class and id values.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

IE and Opera were the two I tested with.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: "Peter Pei" on

> <?php
> // here is where you load a single file or change to iterate over a
> // directory of files
> $oDomDoc = DOMDocument::loadHTMLFile('./tedd.html');
>
> // here is where you search for the question sections of each file
> $oDomXpath = new DOMXPath($oDomDoc);
> $oNodeList = $oDomXpath->query("//p[@class='question']");
>
> // here is where you extract the question sections of each file
> foreach($oNodeList as $oDomNode)
> var_dump($oDomNode->nodeValue);
>
>
> should be trivial to expand that to work w/ multiple files.
>
>
>
>> Now, I can extract each question by using javascript --
>>
>> document.getElementById("question").innerHTML;
>>
>
> tedd, are you slipping? i thought you were searching by the class
> attribute, lol.
>
> -nathan

Beautiful!

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/