DOMdocument search for tag

emormInue

New Member
i am trying to do this: i have several thousand xml files, i am reading them, and i am looking for special text inside an xml with specific tag, but those tags which are having the text i need, are different. what i did till now is this: \[code\]$xml_filename = "xml/".$anzeigen_id.".xml"; $dom = new DOMDocument(); $dom->load($xml_filename); $value = http://stackoverflow.com/questions/13875189/$dom->getElementsByTagName('FormattedPositionDescription'); foreach($value as $v){ $text = $v->getElementsByTagName('Value'); foreach($text as $t){ $anzeige_txt = $t->nodeValue; $anzeige_txt = utf8_decode($anzeige_txt); $anzeige_txt = mysql_real_escape_string($anzeige_txt); echo $anzeige_txt; $sql = "INSERT INTO joinvision_anzeige(`firmen_id`,`anzeige_id`,`anzeige_txt`) VALUES ('$firma_id','$anzeigen_id','$anzeige_txt')"; $sql_inserted = mysql_query($sql); if($sql_inserted){ echo "'$anzeigen_id' from $xml_filename inserted<br />"; }else{ echo mysql_errno() . ": " . mysql_error() . "\n"; } } }\[/code\]now what i need to do is this: look for \[code\]FormattedPositionDescription\[/code\] in xml and if there is not this tag there, then look for \[code\]anothertag\[/code\] in that same xml file.. how can i do this, thanks for help in advance
 
Back
Top