Re: Simple XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochem Maas wrote:
Richard Lynch wrote:

Uroš Gruber wrote:

    <resData>
      <domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd">
        <domain:cd>
          <domain:name avail="1">bar.com</domain:name>
        </domain:cd>
        <domain:cd>
          <domain:name avail="1">foo.com</domain:name>
        </domain:cd>
      </domain:chkData>
    </resData>

But I cant get to this "cd" If I print_r complete response object it

out of interest what does print_r() actually output? better yet what does var_dump() actually output? (i.e. post the output please)

Let say I have

$xml = simplexml_load_string($response);
$domains = $xml->response->resData;
var_dump($domains);


I get output

object(SimpleXMLElement)#5 (1) {
  ["chkData"]=>
  object(SimpleXMLElement)#4 (1) {
    ["cd"]=>
    array(2) {
      [0]=>
      object(SimpleXMLElement)#6 (1) {
        ["name"]=>
        string(7) "foo.com"
      }
      [1]=>
      object(SimpleXMLElement)#7 (1) {
        ["name"]=>
        string(7) "bar.com"
      }
    }
  }
}

ok, here I see that foo and bar but.

and then
var_dump($domains->chkData);
var_dump($domains['domain:chkData']);

output this
object(SimpleXMLElement)#8 (0) {
}
NULL

So It seams like object magicaly disapears. But as Jason said that namspaces is not fully implemented yet. I tried same code with RSS XML and schemas and it does not work either. But with one exception.

I can do

$children = $domains->children('schemalocation');

The I can go inside $children. But here with epp xml this doesnt work at all, or maybe I'm missing something.


XML bigots are probably ready to turn their flame-throwers on me. Oh well.


I'm all out of gas, oh hang on I don't even like XML that much :-) - with php4
I found XML a bit nightmarish, and all that namespace stuff can, well, really
screw up your day... I think Uroš knows that already :-/



I think XML is great in such ways, but with this one I can't do anything about to simplify it, because it standard protocol and I have to make a client to comunicate with registrar server :(


I screw about 3 days now, but I found solution with PEAR::XML_Parser. It's not clean but It works for now. If anyone have same problems I can give a code (it's not finished yet).

regards

Uros

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux