Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] How can I pass two filter in a transform method ??

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Kunal Chauhan <mail4ck AT gmail.com>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] How can I pass two filter in a transform method ??
  • Date: Fri, 4 May 2012 17:54:18 +0530

Here in transform method I apply XQuery two time

public Nodes transform(Element subtree) {


Nodes results = XQueryUtil.xquery(subtree, ".[@id]");

for (int i=0; i < results.size(); i++) {


Element ele = (Element)((Node) results.get(i));

String id = ele.getAttributeValue("id");

Nodes results1 = XQueryUtil.xquery(subtree, ".[@id='"+id+"' or
@category='"+id+"']");
for (int j=0; j < results1.size(); j++) {

System.out.println("result: " + " : " +
results1.get(j).toXML());
}
}

return NONE;
}

};


based on result of first query I fatch id attribute's value and pass it
into second query that will gives me
<main-prod> and <sub-prod> elements which have same id and category
respectivly.

so i want to retrive sets of <main-prod> and <sub-prod> as per id I pass to
it.

but here two times XQuery implementation didn't work as I expect.

every time I got <main-prod> list only.

On Fri, May 4, 2012 at 4:37 PM, Elliotte Rusty Harold
<elharo AT ibiblio.org>wrote:

> I'm not sure what you're asking. It sounds like this might be an
> XQuery question.
>
> --
> Elliotte Rusty Harold
> elharo AT ibiblio.org
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>



--
*Kunal Chauhan*
mail4ck AT gmail.com
[+918655517141]
[+919904983614]




Archive powered by MHonArc 2.6.24.

Top of Page