Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 876085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:22:33+00:00 2026-05-15T11:22:33+00:00

This is a piece of my XML document: <?xml version=1.0 encoding=UTF-8?> <catalog> <mfVictor> <decal>

  • 0

This is a piece of my XML document:

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<mfVictor>
 <decal>
    <company>Victor</company>
    <title>Wood Horn with Blue Background</title>
    <image>
      <url>victor01.jpg</url>
      <width>60</width>
      <height>60</height>
      <name>Wood Horn Blue Background</name>
      <link></link>
    </image>
    <price>$15.00</price>
    <instock>In Stock</instock>
    <notes>none</notes>
  </decal>
</mfVictor>
</catalog>

I have a function that generates a list of the text from each “title” element. So then, onmousedown of each list item I want to navigate to the “decal” and access all of its children. So far I have this:

//decal[contains(.,\'"+itemName+"\')]

where the itemName is this.innerHTML passed to the function. It looks like the decal is accessed because in the console.log I can see an XMLobject with a length of 1. But I can’t figure out how to access either the children of “decal” or the siblings of “title”.

Thanks for reading.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:22:34+00:00Added an answer on May 15, 2026 at 11:22 am

    If you need to select a decal based on his title I would prefer the following xpaths:

    //decal/title[contains(.,\'"+itemName+"\')]/parent::node()
    //decal/title[contains(.,\'"+itemName+"\')]/..
    //decal[title[contains(.,\'"+itemName+"\')]]
    

    to select a sibling of the title of the decal you selected you can use

    //decal/title[contains(.,\'"+itemName+"\')]/following-sibling::*
    

    If you want all the children of the decal you select you can use (maybe you need this)

    //decal[title[contains(.,\'"+itemName+"\')]]/child::*
    

    or better, if you have the complete title

    //decal[title[text()=\'"+itemName+"\']]/child::*
    

    With the square bracket you instruct the parser to walk the xml tree to make a selection based on the condition you specify but without changing the context node. Think to the square brackets as a rubber-band, once the test contained in it are satisfied the parser revert back to the starting node and evaluate the rest of the xpath expression. The first two examples are a tipical

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a piece of XML that is structured similar to this: <root> <score
I came across this piece of Java function to convert an XML node to
I'm trying to write some xml by this piece of code docs = XmlReportGenerator()
I'm trying to write some xml by this piece of code docs = XmlReportGenerator()
This piece of T-SQL is deprecated in 2005: BACKUP LOG [DB_NAME] WITH TRUNCATE_ONLY I
Given this piece of code: (void)someFunction(void) { int array[] = {1,2,3,4,5,6,7,8,9,10}; } Where are
I have this piece of code (summarized)... AnsiString working(AnsiString format,...) { va_list argptr; AnsiString
I have this piece of Javascript and it just won't work. I allready checked
I've found this piece of code on Koders : private ServiceProvider SiteServiceProvider { get
I have this piece of code #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.