Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,798
    Thanks
    19
    Thanked 156 Times in 147 Posts

    DOM XML/DOM functions question

    With the DOM XML or DOM functions, are you able to parse X/HTML documents as well as regular XML files? I've used these functions before, but only to read XML files.

    Alternatively, can you create a DOM object from a string variable? Or do you have to open up and read a file (with the provided methods) before you can create a DOM object?

    I did some poking around in the PHP manual and couldn't find answers to these questions.....Thanks.
    Last edited by chump2877; 03-07-2007 at 04:46 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    with the DOM classes in PHP5, you can use loadHTMLFile() or loadHTML() to load in html from a file or from an arbitrary html string respectively.

    For loading an XML string, you can use the loadXML() function
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,798
    Thanks
    19
    Thanked 156 Times in 147 Posts
    Great, thanks....do we have the same capabilities with the DOM XML functions, or is this a PHP 5 only privilege?
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #4
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    no idea I'm afraid, I do all my work with 5 :|
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Look here: DOM Reference.

  • #6
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,798
    Thanks
    19
    Thanked 156 Times in 147 Posts
    Thanks, I already looked through the manual regarding the DOM XML functions for PHP 4, and it doesn't look like they support that kind of thing (although, it seems that the only way to know for sure would be to try to open an HTML doc with DOM XML, and see if I can operate on the DOM)...just the DOM functions for PHP 5 do...

    Depending on which server I'm using, it would be nice to have the same functionality for both PHP 4 and 5...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •