SimpleXML

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

 



Hi,

I am trying to write a PHP interface to ISBNdb.com. When I make a certain
request, the following is returned

<ISBNdb server_time="2009-02-24T18:57:31Z">
 <BookList total_results="1" page_size="10" page_number="1"
shown_results="1">
  <BookData book_id="language_proof_and_logic" isbn="157586374X"
isbn13="9781575863740">
   <Title>Language, Proof and Logic</Title>
   <TitleLong></TitleLong>
   <AuthorsText>Jon Barwise, John Etchemendy, </AuthorsText>
   <PublisherText publisher_id="center_for_the_study_of_la_a03">Center for
the Study of Language and Inf</PublisherText>
   <Subjects>
    <Subject
subject_id="amazon_com_nonfiction_philosophy_logic_language">Amazon.com --
Nonfiction -- Philosophy -- Logic &amp; Language</Subject>
    <Subject subject_id="amazon_com_science_general">Amazon.com -- Science
-- General</Subject>
   </Subjects>
  </BookData>
 </BookList>
</ISBNdb>

And when loaded using simplexml_load_string, it gives the following object

object(SimpleXMLElement)#10 (2) {
    ["@attributes"]=>
    array(1) {
      ["server_time"]=>
      string(20) "2009-02-24T18:57:31Z"
    }
    ["BookList"]=>
    object(SimpleXMLElement)#14 (2) {
      ["@attributes"]=>
      array(4) {
        ["total_results"]=>
        string(1) "1"
        ["page_size"]=>
        string(2) "10"
        ["page_number"]=>
        string(1) "1"
        ["shown_results"]=>
        string(1) "1"
      }
      ["BookData"]=>
      object(SimpleXMLElement)#11 (6) {
        ["@attributes"]=>
        array(3) {
          ["book_id"]=>
          string(24) "language_proof_and_logic"
          ["isbn"]=>
          string(10) "157586374X"
          ["isbn13"]=>
          string(13) "9781575863740"
        }
        ["Title"]=>
        string(25) "Language, Proof and Logic"
        ["TitleLong"]=>
        object(SimpleXMLElement)#15 (0) {
        }
        ["AuthorsText"]=>
        string(30) "Jon Barwise, John Etchemendy, "
        ["PublisherText"]=>
        string(40) "Center for the Study of Language and Inf"
        ["Subjects"]=>
        object(SimpleXMLElement)#16 (1) {
          ["Subject"]=>
          array(2) {
            [0]=>
            string(58) "Amazon.com -- Nonfiction -- Philosophy -- Logic &
Language"
            [1]=>
            string(32) "Amazon.com -- Science -- General"
          }
        }
      }
    }

Notice that I lose the attribute subject_id from the Subject tag. Why is
this?? Is there any way from preventing it from happening??

Thanks in advance,

Alex Chamberlain


-- 
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