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 5 of 5
  1. #1
    Regular Coder Actinia's Avatar
    Join Date
    Feb 2007
    Location
    Essex, UK
    Posts
    250
    Thanks
    1
    Thanked 23 Times in 22 Posts

    Using DOM XML functions

    I am trying to convert a string into a DOM tree using:

    Code:
    if ( !$doc = xmldoc($buf) ) {
        die("<html><body><p>cannot open XML string</p></body></html>");
    }
    But all get is nothing! No error messages, no output from later echos.

    I am using Apache 2.2 and PHP 5, downloaded in the last two weeks.

    Using phpinfo() tells me that the DOM functions are enabled.

    John Rostron

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Quote Originally Posted by JohnRostron View Post
    I am trying to convert a string into a DOM tree using:

    Code:
    if ( !$doc = xmldoc($buf) ) {
        die("<html><body><p>cannot open XML string</p></body></html>");
    }
    But all get is nothing! No error messages, no output from later echos.

    I am using Apache 2.2 and PHP 5, downloaded in the last two weeks.

    Using phpinfo() tells me that the DOM functions are enabled.

    John Rostron
    don't u mean
    Code:
    if (  !($doc = xmldoc($buf))  )
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #3
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Try
    PHP Code:
    if ( $doc != xmldoc($buf) ) {
        die(
    "<html><body><p>cannot open XML string</p></body></html>");


  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    No error messages, no output from later echos.
    If PHP comes across an error while reading the PHP, and it is set to not display errors, it will show you a blank screen/empty source.

    If you are debugging, turn on error displaying.

  • Users who have thanked aedrin for this post:

    Actinia (08-30-2007)

  • #5
    Regular Coder Actinia's Avatar
    Join Date
    Feb 2007
    Location
    Essex, UK
    Posts
    250
    Thanks
    1
    Thanked 23 Times in 22 Posts
    I have now discovered how to switch on error messages. Despite phpinfo() telling me that DOM is enabled, the message is that the function xmldoc is not recognized.

    However, I have downloaded Domit!, and this seems to be doing what I want. It also seems to offer more functionality than the DOM functions. The disadvantage is that it is interpreted rather than a pre-compiled package.

    John Rostron


  •  

    Posting Permissions

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