summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PropertyList.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/PropertyList.php b/PropertyList.php
index c407011..b1d103b 100644
--- a/PropertyList.php
+++ b/PropertyList.php
@@ -12,12 +12,20 @@
class PropertyList
{
function __construct($xmlFile) {
- if (!file_exists($xmlFile)) {
- echo "{$xmlFile}: no such file";
+ $loaded = false;
+ $document = new DOMDocument();
+
+ if (file_exists($xmlFile)) {
+ $loaded = $document->load($xmlFile);
+ } else {
+ $loaded = $document->loadXML($xmlFile);
+ }
+
+ if ($loaded === false) {
+ echo "Failed to load input: {$xmlFile}";
return false;
}
- $document = new DOMDocument();
- $document->load($xmlFile);
+
$plistNode = $document->documentElement;
$this->root = $plistNode->firstChild;
while ($this->root->nodeName == "#text") {