Hi, Is there an easy way for doing a search in an XML file?
I have an TMX file with a language list: <?xml version="1.0" ?> <tmx version="1.4"> <header creationtool="hand made" creationtoolversion="1.0.0" datatype="winres" segtype="sentence" adminlang="ca" srclang="ca" o-tmf="abc"> </header> <body> <tu tuid="de" datatype="plaintext"> <tuv xml:lang="ca"><seg>alemany</seg></tuv> <tuv xml:lang="es"><seg>alemán</seg></tuv> <tuv xml:lang="en"><seg>German</seg></tuv> </tu> <tu tuid="en" datatype="plaintext"> <tuv xml:lang="ca"><seg>anglès</seg></tuv> <tuv xml:lang="es"><seg>inglés</seg></tuv> <tuv xml:lang="en"><seg>English</seg></tuv> </tu> </body> </tmx> And I would like to get all languages (for example from tuv nodes which have xml:lang='en') that match a query text introduced in an AJAX form. For testing purposes (I never used Zend_Dom before) i have written the following code in the search action in order to match all tuv nodes with language en: $xmlfile = BASE_PATH . '/language/all_languages.tmx'; if (file_exists($xmlfile)) { $xml = file_get_contents($xmlfile); $dom = new Zend_Dom_Query(); $dom->setDocumentXml($xml); $xpath = "//t...@xml:lang='en']"; $results = $dom->queryXPath($xpath); $rows = count($results); } But $rows always gets a value of 1. Why is that? And... what xpath expression should I use to match the query text entered in the AJAX form? Thanks in advance, Oriol -- View this message in context: http://www.nabble.com/Problems-using-Zend_Dom-tp26093704p26093704.html Sent from the Zend Framework mailing list archive at Nabble.com.