# Php dom/xml difficulty ARGHHH

**URL:** https://forum.kirupa.com/t/php-dom-xml-difficulty-arghhh/166595
**Category:** Uncategorized
**Created:** [October 21, 2005, 5:41am UTC](https://forum.kirupa.com/t/php-dom-xml-difficulty-arghhh/166595 "2005-10-21T05:41:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Snx](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/snx/32/929_2.png) [@Snx](https://forum.kirupa.com/u/Snx)
#### Post date: [October 21, 2005, 5:41am UTC](https://forum.kirupa.com/t/php-dom-xml-difficulty-arghhh/166595/1 "2005-10-21T05:41:00Z")

</div>

trying to wrap my head around why i cant access the textContent of the firstChild element in an xml file using php’s dom… will return the element id’s however… does anyone know why???

xml file:

```auto

<?xml version="1.0"?>
<Index>
<Item>
<Date>20051013</Date>
<Title>Massive Stars Can Grow Near Black Holes</Title>
</Item>
<Item>
<Date>20051019</Date>
<Title>Researchers Study Changes in Hurricanes</Title>
</Item>
</Index>

```

```php

<?php
$dom = new DOMDocument;
$dom->load('test.xml');

//$Items = $dom->documentElement->getElementsByTagName('Item');
foreach ($Items as $item) {
		print $item->firstChild->textContent;
		print '<br />';
		if($item->firstChild->textContent == '20051019')
		{
			//$item->parentNode->removeChild($item);
		}
} 
//$dom->saveXML();
print '<br /> done.';
?> 

```

thx!  
snx
