Carsten and Arshad.

Xindice to my best knowledge always delivers an XML Document, so to extract
a text node you will need post-processing or filtering.
Carsten shows two examples of this in java code (The DOM solution should
work as well). Depending on your application environment, you could choose
other methods, e.g. XSL transformation or a simple perl script. But
something will have to be done to the Xindie output.

Best regards
Anders
----- Original Message -----
From: "Carsten Ziegert" <[EMAIL PROTECTED]>
To: "Mailing List dbXML" <[email protected]>
Sent: Wednesday, January 23, 2002 12:14 PM
Subject: Re: HELP: Getting Wierd Result using XPath with Xindice


> Hi Arshad,
>
> I use a simple workaround to solve the problem in my environment:
>
> private static String getContent(String r) {
>   int first = r.indexOf(">");
>   first = r.indexOf(">", first+1) + 1;
>   int last = r.lastIndexOf("<");
>   return(r.substring(first, last));
> }
>
>
> Alternatively, you can cast your Resource to XMLResource  and then use
> "getContentAsDOM" instead of "getContent".
> After this, you'll have a Node (org.w3c.dom.Node), and can apply
> "getNodeValue()" which returns a String, but I havn't tried it.
>
> See:
> http://www.dbxml.org/api/org/xmldb/api/modules/XMLResource.html
> http://xml.apache.org/apiDocs/org/w3c/dom/Node.html
>
>
> Hi list, I hope I'm right?
>
> Carsten
>
>
> Am 23.01.2002 11:45 Uhr schrieb "98030001" unter <[EMAIL PROTECTED]>:
>
> > Hello
> >
> > I am using XPath with the Xindice api. I have the following XML
document:
> >
> > <Start>
> >
> > <User>
> > <LoginName>abc</LoginName>
> > <Password>qqq</Password>
> > </User>
> >
> > <User>
> > <LoginName>xyz</LoginName>
> > <Password>ttt</Password>
> > </User>
> >
> > </Start>
> >
> > Now I want to get the password for the LoginName = 'xyz'.
> > The XPath I have written is:
> > //User[LoginName='xyz']/Password[text()]"
> >
> > The result I get is:
> >
> > <Password xmlns:src="http://www.dbxml.org/Query"; src:col="/db/abc"
> > src:key="140b1bac66655440000000eb895b1ba6">ttt</Password>
> >
> > But what I want is ONLY the password TEXT i.e the value of the password
and
> > NOT the complete node information. What Should I do with the Xpath
string so
> > that the result only gives:   ttt
> >
> > Please help me with this as this has hold me now for quite a long time.
> >
> > Thanx.
> >
> > Arshad
> >
>
> --
> Carsten Ziegert
> Fachhochschule Hannover
> FB Informations- und Kommunikationswesen
> Ricklinger Stadtweg 120
> 30459 Hannover
> ++49-511-9296-768
> http://summit-bmt.fh-hannover.de
>
>
>

Reply via email to