FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Help with regex
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Help with regex [message #184967 is a reply to message #184961] Thu, 20 February 2014 21:43 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
Thomas 'PointedEars' Lahn wrote:

> Christoph Michael Becker wrote:
>
>> Thomas 'PointedEars' Lahn wrote:
>>> knal wrote:
>>>> Could you please give a little more direction on the DOM?
>>> I presume he could.
>>
>> Actually, I have not yet used PHP's DOM extension. However, it should
>> not be too different from other DOM implementations, so basically it
>> comes down to load an HTML document and than use XPath to get the
>> desired information. The mentioned keywords should be sufficient to
>> search the web -- at least for some first steps.
>
> However, implementations of the W3C DOM Core API do not require a way so
> that a document tree can be built from source code, nor is XPath support
> required.

I was not explicitly speaking about the DOM *Core* API, but rather of
DOM implementations in a broad sense. As you surely are aware, there is
the DOM Level 3 Load and Save Specification[1] as well as the XML Path
Language (XPath) Version 1.0[2], both of which are W3C recommendations
since a long time. While XPath support might be missing from some "DOM"
implementations, either implicit or explicit loading of a document
source most likely won't (otherwise the implementation would not allow
to work with existing document sources, and as such would not be too
useful).

> So you had better RTFM yourself before making the suggestion.

I had glimpsed over the manual and found DOMDocument::loadHTML()[3] as
well as DOMXPath[4]...

> There are few if any occasions where such wild guesses are useful.

.... and I have used DOM implementations of other languages (TCL,
FreePascal/Lazarus) so IMHO this wasn't a wild guess, but rather an at
least somewhat educated one.

> Lucky
> for you, you hit the nail this time: there are corresponding methods in
> this (PHP’s) implementation (so there is no need to search the Web).

For someone unaccustomed to the DOM and particularly XPath, searching
the Web for some introduction may well be necessary. The PHP
documentation regarding these topics is rather terse, and the user
comments might not make up for it.

[1] <http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/>
[2] <http://www.w3.org/TR/xpath/>
[3] <http://www.php.net/manual/en/domdocument.loadhtml.php>
[4] <http://www.php.net/manual/en/class.domxpath.php>

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Career Opportunities in Singapore (PHP Tech Lead)
Next Topic: PHP script to get name of file which houses the script?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 18:51:09 GMT 2024

Total time taken to generate the page: 0.04420 seconds