googlehunter Posted March 25, 2007 Share Posted March 25, 2007 This is the xml file I have: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <ebl:RequesterCredentials xmlns="urn:ebay:apis:eBLBaseComponents" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" soapenv:mustUnderstand="0"> <ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">/9zSjcXsC6VqZ8XkDzYu/ZA==</ebl:NotificationSignature> </ebl:RequesterCredentials> </soapenv:Header> <soapenv:Body> <GetItemTransactionsResponse xmlns="urn:ebay:apis:eBLBaseComponents"> <Timestamp>2007-03-25T08:06:30.254Z</Timestamp> <Ack>Success</Ack> <CorrelationID>171816430</CorrelationID> <Version>503</Version> <Build>e503_core_Bundled_4329350_R1</Build> <NotificationEventName>EndOfAuction</NotificationEventName> <RecipientUserID>digitalsales1</RecipientUserID> <PaginationResult> <TotalNumberOfPages>1</TotalNumberOfPages> <TotalNumberOfEntries>1</TotalNumberOfEntries> </PaginationResult> <HasMoreTransactions>false</HasMoreTransactions> <TransactionsPerPage>100</TransactionsPerPage> <PageNumber>1</PageNumber> <ReturnedTransactionCountActual>1</ReturnedTransactionCountActual> <Item> <AutoPay>false</AutoPay> <BuyerProtection>ItemIneligible</BuyerProtection> <BuyItNowPrice currencyID="USD">33.0</BuyItNowPrice> <Currency>USD</Currency> <ItemID>110017876641</ItemID> <ListingDetails> <StartTime>2007-03-23T14:00:17.000Z</StartTime> <EndTime>2007-03-25T08:06:25.000Z</EndTime> <ExpressListing>false</ExpressListing> </ListingDetails> <ListingType>Chinese</ListingType> <PaymentMethods>PayPal</PaymentMethods> <PrimaryCategory> <CategoryID>29792</CategoryID> </PrimaryCategory> <PrivateListing>false</PrivateListing> <Quantity>1</Quantity> <SecondaryCategory> <CategoryID>0</CategoryID> </SecondaryCategory> <Seller> <AboutMePage>false</AboutMePage> <EIASToken>nY+sHZ2PrBmdj6wVnY+sEZ2PdrA2dj6wFk4CnCpSGqQqdj6x9nY+seQ==</EIASToken> <Email>[email protected]</Email> <FeedbackScore>10</FeedbackScore> <FeedbackPrivate>false</FeedbackPrivate> <FeedbackRatingStar>Yellow</FeedbackRatingStar> <IDVerified>true</IDVerified> <eBayGoodStanding>true</eBayGoodStanding> <NewUser>false</NewUser> <RegistrationDate>1995-01-01T19:59:59.000Z</RegistrationDate> <Site>US</Site> <Status>Confirmed</Status> <UserID>digitalsales1</UserID> <UserIDChanged>true</UserIDChanged> <UserIDLastChanged>2007-03-19T20:59:29.000Z</UserIDLastChanged> <VATStatus>NoVATTax</VATStatus> <SellerInfo> <AllowPaymentEdit>true</AllowPaymentEdit> <CheckoutEnabled>true</CheckoutEnabled> <CIPBankAccountStored>false</CIPBankAccountStored> <GoodStanding>true</GoodStanding> <LiveAuctionAuthorized>false</LiveAuctionAuthorized> <MerchandizingPref>OptIn</MerchandizingPref> <QualifiesForB2BVAT>false</QualifiesForB2BVAT> <SellerLevel>None</SellerLevel> <StoreOwner>false</StoreOwner> <ExpressEligible>false</ExpressEligible> <ExpressWallet>false</ExpressWallet> <SafePaymentExempt>false</SafePaymentExempt> </SellerInfo> </Seller> <SellingStatus> <BidCount>1</BidCount> <ConvertedCurrentPrice currencyID="USD">33.0</ConvertedCurrentPrice> <CurrentPrice currencyID="USD">33.0</CurrentPrice> <QuantitySold>1</QuantitySold> <ListingStatus>Completed</ListingStatus> </SellingStatus> <Site>US</Site> <StartPrice currencyID="USD">32.0</StartPrice> <Title>testing</Title> <GetItFast>false</GetItFast> </Item> <TransactionArray> <Transaction> <AmountPaid currencyID="USD">37.95</AmountPaid> <AdjustmentAmount currencyID="USD">0.0</AdjustmentAmount> <ConvertedAdjustmentAmount currencyID="USD">0.0</ConvertedAdjustmentAmount> <Buyer> <AboutMePage>false</AboutMePage> <EIASToken>nY+sHZ2PrBmdjd6wVnY+sEZ2PrA2dj6wFk4CnCpSLoQ6dj6x9nY+seQ==</EIASToken> <Email>[email protected]</Email> <FeedbackScore>0</FeedbackScore> <FeedbackPrivate>false</FeedbackPrivate> <FeedbackRatingStar>None</FeedbackRatingStar> <IDVerified>false</IDVerified> <eBayGoodStanding>true</eBayGoodStanding> <NewUser>true</NewUser> <RegistrationDate>2007-03-21T01:52:47.000Z</RegistrationDate> <Site>US</Site> <Status>Confirmed</Status> <UserID>homerjsimpson</UserID> <UserIDChanged>false</UserIDChanged> <UserIDLastChanged>2007-03-21T01:52:46.000Z</UserIDLastChanged> <VATStatus>NoVATTax</VATStatus> <BuyerInfo> <ShippingAddress> <Name>homerj simpson</Name> <Street1>street</Street1> <Street2>pobox</Street2> <CityName>pittsburgh</CityName> <StateOrProvince>PA</StateOrProvince> <Country>US</Country> <CountryName>United States</CountryName> <Phone>(412) 778-7878</Phone> <PostalCode>15235</PostalCode> <AddressID>3467918</AddressID> <AddressOwner>eBay</AddressOwner> </ShippingAddress> </BuyerInfo> <UserAnonymized>false</UserAnonymized> </Buyer> <ShippingDetails> <ChangePaymentInstructions>true</ChangePaymentInstructions> <InsuranceFee currencyID="USD">0.0</InsuranceFee> <InsuranceOption>NotOffered</InsuranceOption> <InsuranceWanted>false</InsuranceWanted> <PaymentEdited>false</PaymentEdited> <SalesTax> <SalesTaxPercent>0.0</SalesTaxPercent> <ShippingIncludedInTax>false</ShippingIncludedInTax> </SalesTax> <ShippingServiceOptions> <ShippingService>USPSFirstClass</ShippingService> <ShippingServiceCost currencyID="USD">4.95</ShippingServiceCost> <ShippingServicePriority>1</ShippingServicePriority> <ExpeditedService>false</ExpeditedService> <ShippingTimeMin>2</ShippingTimeMin> <ShippingTimeMax>5</ShippingTimeMax> </ShippingServiceOptions> <InternationalShippingServiceOption> <ShippingService>USPSAirmailParcel</ShippingService> <ShippingServiceCost>6.95</ShippingServiceCost> <ShippingServicePriority>1</ShippingServicePriority> <ShipToLocation>Worldwide</ShipToLocation> </InternationalShippingServiceOption> <ShippingType>Flat</ShippingType> <SellingManagerSalesRecordNumber>282</SellingManagerSalesRecordNumber> <ThirdPartyCheckout>false</ThirdPartyCheckout> <TaxTable/> <GetItFast>false</GetItFast> </ShippingDetails> <ConvertedAmountPaid currencyID="USD">37.95</ConvertedAmountPaid> <ConvertedTransactionPrice currencyID="USD">33.0</ConvertedTransactionPrice> <CreatedDate>2007-03-25T08:06:25.000Z</CreatedDate> <DepositType>None</DepositType> <QuantityPurchased>1</QuantityPurchased> <Status> <eBayPaymentStatus>NoPaymentFailure</eBayPaymentStatus> <CheckoutStatus>CheckoutIncomplete</CheckoutStatus> <LastTimeModified>2007-03-25T08:06:25.000Z</LastTimeModified> <PaymentMethodUsed>None</PaymentMethodUsed> <CompleteStatus>Incomplete</CompleteStatus> <BuyerSelectedShipping>false</BuyerSelectedShipping> </Status> <TransactionID>0</TransactionID> <TransactionPrice currencyID="USD">33.0</TransactionPrice> <BestOfferSale>false</BestOfferSale> <ShippingServiceSelected> <ShippingInsuranceCost currencyID="USD">0.0</ShippingInsuranceCost> <ShippingService>USPSFirstClass</ShippingService> <ShippingServiceCost currencyID="USD">4.95</ShippingServiceCost> </ShippingServiceSelected> <TransactionPlatform>eBay</TransactionPlatform> </Transaction> </TransactionArray> </GetItemTransactionsResponse> </soapenv:Body> </soapenv:Envelope> That is the xml information I get from ebay. I tried to access the "ShippingServices" node with the following code. $xml = simplexml_load_file("test.xml"); $result = $xml->xpath("//ShippingServices"); print_r($result); It only returns an empty array and it returns an empty array with any node I try to query. Array ( ) I then stumbled upon what seems to be a solution but with problems. I changed "xmlns=" to "xmlns:ns=" in the following line: <GetItemTransactionsResponse xmlns="urn:ebay:apis:eBLBaseComponents"> and the query for ShippingServices still returned an empty string. However When I tried "//RegistrationDate" it worked! So to summarize: With the original xml file I could not retrieve any nodes but after I added ":ns" to that line only some queries work. The queries return an empty array when I use no forward slashes "Shippingservices" for any node name as well, regardless of whether I add ns: to that line. What is going on? I am in need of urgent help. Thank you so much. Link to comment https://forums.phpfreaks.com/topic/44207-xpath-query-not-working-urgent-help-needed-thank-you/ Share on other sites More sharing options...
Barand Posted March 25, 2007 Share Posted March 25, 2007 Do you get anything from $xml = simplexml_load_file("test.xml"); echo '<pre>', print_r($xml, true), '</pre>'; All I get is [pre] SimpleXMLElement Object ( ) [/pre] instead of the usual array of objects Link to comment https://forums.phpfreaks.com/topic/44207-xpath-query-not-working-urgent-help-needed-thank-you/#findComment-214706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.