Xpath and simplexml

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjava
    New Member
    • Sep 2009
    • 132

    Xpath and simplexml

    I have this result when i do var_dump to $xml

    Code:
    `object(SimpleXMLElement)[257]
      public '@attributes' => 
        array (size=1)
          'seq' => string '290' (length=3)
      public 'FIN' => 
        object(SimpleXMLElement)[256]
          public '@attributes' => 
            array (size=1)
              'seq' => string '261' (length=3)
          public 'VAL' => string '1' (length=1)
          public 'ATT' => 
            array (size=11)
              0 => 
                object(SimpleXMLElement)[255]`
    i need select with simplexml which seq have value 290

    i do that
    Code:
    $seq=$xmlglobtech->xpath("//GROUP[@seq='290']/FIN/REM")
    i do var_dump($seq) i have that

    no anything array(size=0) empty


    Thanks in advance
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you say that the dump is from $xml, but the code shows an XPath request to $xmlglobtech.

    additionally, the SimpleXML object dump you showed is incomplete.

    the SimpleXML object you showed does not contain a <GROUP> element (as required per XPath).

    the SimpleXML object you showed looks like it is the targeted <GROUP> element, but is does not contain a <REM> element, though that may be due to the incomplete dump.

    Comment

    Working...