-- prodigitalson <[email protected]> wrote
(on Wednesday, 28 October 2009, 01:43 PM -0700):
> Well i havent used Zend_Dom either but i assume its using SimpleXml for its
> underlying functionality. 

Nope -- it uses the DOM extension.

> If this is indeed the case im thinking that maybe its the namespace...
> try removing the "xml" namespace prefix from your xpath string. I know
> simpleXML requires a fully expanded prefix when using an xpath query.
> While i would hope this isnt the case with the xml namespace its worth
> a shot...
> 
> 
> 
> oportell wrote:
> > 
> > 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-tp26093704p26101728.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/

Reply via email to