|
Posted by marcin.a.zajkowski on 11/07/07 21:01
Hello,
Below is an example of an XML and PHP file I'm developing, I'm trying
to insertBefore into the XML file butI continue to get this error:
Fatal error: Uncaught exception 'DOMException' with message 'Not Found
Error' in /home/.boots/rddesign/forttryon.com/availabilities/
editor_adjustment.php:100
All help is appreciated!
<XML
<?xml version="1.0" encoding="utf-8"?>
<availabilities>
<unit type="Studios">
<availability>
<name>000000</name>
<size>000000</size>
<cost>000000</cost>
<stat>000000</stat>
<show>000000</show>
</availability>
<availability>
<name>4489 5G</name>
<size>400</size>
<cost>$182,500.00</cost>
<stat>Available</stat>
<show>Studio-J</show>
</availability>
</unit>
<unit type="1 Bedroom Apartments">
<availability>
<name>000000</name>
<size>000000</size>
<cost>000000</cost>
<stat>000000</stat>
<show>000000</show>
</availability>
<availability>
<name>257 6D</name>
<size>575</size>
<cost>$299,125.00</cost>
<stat>Contract Signed</stat>
<show>1BR-H</show>
</availability>
</unit>
<unit type="2 Bedroom Apartments">
<availability>
<name>000000</name>
<size>000000</size>
<cost>000000</cost>
<stat>000000</stat>
<show>000000</show>
</availability>
<availability>
<name>259 7D</name>
<size>900</size>
<cost>$303,500.00</cost>
<stat>Available</stat>
<show>2BR-I.</show>
</availability>
</unit>
</availabilities>
XML>
<?PHP
$dom = new DomDocument();
$dom->load("testData.xml");
$dom->preserveWhitespace = true;
$xpath = new DomXPath($dom);
//$availabilities = $xpath->query("/availabilities/
unit[@type='Studios']/availability")->item(0);
$availabilities = $xpath->query("/availabilities/
unit[@type='Studios']/availability/name")->item(0);
$availability = $dom->createElement('availability','helloWorld');
$dom->insertBefore($availability, $availabilities);
$dom->save("testData.xml");
?>
Navigation:
[Reply to this message]
|