SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: DOM Problem

  1. #1
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DOM Problem

    Well PHP keeps tearing everything up in the DOM area to gain full DOM2 Compliance and I am stuck.

    I am trying to access the content of a child node and the function get_content() is aparently deprecated and non-DOM compliant, so how am I supposed to access the content of the child node?
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  2. #2
    SitePoint Zealot marcoBR's Avatar
    Join Date
    Jun 2002
    Location
    Brazil
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try to use $content = $dom_doc->dump_node($node); might it works.
    Last edited by marcoBR; May 24, 2003 at 11:22.

  3. #3
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured out what was happening, I forgot text nodes are a separate node itself so I had to iterate one more time to get to it, which is very annoying.

    How could I write a get_content equivelent since its being deprecated?

    this is my quick stab at it, let me know if I am wrong...

    PHP Code:
    function get_content(&$node) {
    $content $node->child_nodes();
    return 
    $content[0];

    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a wild guess though if your script doesn't work; try this slight alteration ?

    PHP Code:
    function get_content(&$node) { 
    $content $node->child_nodes(); 
    return 
    $content[1]; 


  5. #5
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its actually a return $content[0]->content; so I messed up there anyway.

    Does anyone know if someone has written a DOM wrapper class to give a common interface to DOM? By this I mean a object to contain everything, resulting in much less code.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer


Bookmarks

Posting Permissions

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