• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Advanced XML search

New Here ,
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

Hi guys,
I use this piece of code to find a current rote of my site's tree: rote = XMLSearch(rotes, "//rote[@name='roteName']");
Here I have my current rote and it's child rotes. All is fine.

Question one is: how to get this rote's parent rotes without hard coding and recursion?
Question two is: how make my search function to search the rote with one more argument? I.e. rote with argument name=roteName and argument status=visible.

Thank you,
Sergei
TOPICS
Advanced techniques

Views

438

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

> Question one is: how to get this rote's parent rotes without hard coding and
> recursion?

Do you mean PARENT (singular: there can be only one), or ANCESTORS?

Either way, have a look @ xpath's concept of AXES:
http://www.zvon.org/xxl/XPathTutorial/Output/example13.html


> Question two is: how make my search function to search the rote with one more
> argument? I.e. rote with argument name=roteName and argument status=visible.

You can do this:

[@colour='green' and @animal='marmoset']

This is worth reading:
http://www.w3schools.com/xpath/default.asp

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

Thank you Adam,

> Do you mean PARENT (singular: there can be only one), or ANCESTORS?

I mean user is in rote news_archive and i want to build his path from homepage to news_archive.

Like: Homepage > News > Archive.

Can I somehow get this branch with a single query if I know only that my current node is "news_archive" and my root node is "root"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

LATEST
ANCESTORS, that's right! Thank you, great link!

This one works good for me: XMLSearch(Application.rotes, "//rote[@name='ggg']/ancestor::*");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation