This is starting to piss me off real bad. I have this XML code:
Updated with correct namespaces
<?xml version="1.0" encoding="utf-8"?>
<Infringement xsi:schemaLocation="http://www.movielabs.com/ACNS http://www.movielabs.com/ACNS/ACNS2v1.xsd" xmlns="http://www.movielabs.com/ACNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Case>
<ID>...</ID>
<Status>Open</Status>
</Case>
<Complainant>
<Entity>...</Entity>
<Contact>...</Contact>
<Address>...</Address>
<Phone>...</Phone>
<Email>...</Email>
</Complainant>
<Service_Provider>
<Entity>...</Entity>
<Address></Address>
<Email>...</Email>
</Service_Provider>
<Source>
<TimeStamp>...</TimeStamp>
<IP_Address>...</IP_Address>
<Port>...</Port>
<DNS_Name></DNS_Name>
<Type>...</Type>
<UserName></UserName>
<Number_Files>1</Number_Files>
<Deja_Vu>No</Deja_Vu>
</Source>
<Content>
<Item>
<TimeStamp>...</TimeStamp>
<Title>...</Title>
<FileName>...</FileName>
<FileSize>...</FileSize>
<URL></URL>
</Item>
</Content>
</Infringement>
And this PHP code:
<?php
$data = urldecode($_POST["xml"]);
$newXML = simplexml_load_string($data);
var_dump($newXML->xpath("//ID"));
?>
I've dumped only $newXML and gotten tons of data, but the only xPath I've run that returned anything but an empty array was "*"
Isn't "//ID" supposed to find all ID nodes in the document? Why isn't it working?
Thanks
xmlns:xsi
). Not sure how to help further though, insufficent skills:P
– Isoclinexmlns
byns
. (inspired by this comment on PHP.net. – Ratioxmlns=...
(no colon or prefix), which determines the namespace of elements with no namespace prefix. @Codemonkey doesn't have a default namespace declaration, so that comment does not apply. – Grigson