Retrieve all the child elements belonging to the specified XML layer

I am looking to target all child elements that are part of a specific layer in the XML structure, starting from a given element. For example, if the XML layout is as follows:

  <teststep id="1">
    <description>Teststep 1</description>      
    <call-action id="2">
      <parameters>
        <parameter key="starttime" />
        <parameter key="duration" />
      </parameters>
      <results>
        <store-result key="" destination=""/>
      </results>
    </call-action>
    <call-action id="3">
      <parameters>
        <parameter key="starttime" />
        <parameter key="duration" />
      </parameters>
      <results>
        <store-result key="" destination=""/>
      </results>
    </call-action>
  </teststep>

I want to select all first-level child elements like this:

teststep > select first child elements in hierarchy { ... }

The targeted elements should be only the description and the 2 call-action elements.

This process will then continue for subsequent layers, with the next target being the parameters elements.

Any suggestions on how to achieve this?

Thank you!

Answer №1

To target the description and call-action elements, use the following selector:

teststep > *

To select the parameters elements in relation to this specific teststep, you can use the following selector:

teststep > call-action > parameters

(If you only wish to target them relative to their parent call-action, regardless of the parent of call-action, omit the teststep >.)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What factors determine the height of a table cell?

My forehead is now a grid of indents after battling with HTML tables for days, leaving marks resembling my keyboard. Speaking of grids, I'm curious if there are any clear guidelines on the sizing of <td>. Does it depend solely on content? Is i ...

What is the best way to position the label above the input text in a Material UI TextField component with a Start Adornment?

Struggling to figure out the right Material UI CSS class to style a reusable TextField component? You're not alone. Despite tinkering with InputLabelProps (specifically the shrink class), I can't seem to get it right. Here's the code snippet ...

If an element with a "hidden" display property is loaded in the browser window, will it be visible?

Is an element in a hidden display still using memory when the page is loaded? It's convenient to have many elements on a page, but if 99 elements are hidden and only 1 is displayed, does that impact the loading of the page? I'm curious if the pa ...

Ways to customize the size of a radio button with CSS

Is it possible to adjust the size of a radio button using CSS? ...

I am looking to add some flair to my ID "checkimg" using JavaScript

JavaScript if ((valid1 && valid2 && valid3 & valid4 && valid5 && valid6 && valid7 && valid8)==1) { // include an image in the specified ID. document.formElem.next1.disabled=false; } else { docume ...

Converting SOAP XML to Java Object on Android: A Simple Guide

To retrieve data from a SOAP XML response and convert it into JAVA objects, I initially considered using J-WS and JAXB with client stub code. However, since J-WS and JAXB are not included in the Android AOSP, I will need to handle the process manually. Be ...

Explore the power of Infinity.js for optimizing the rendering of large HTML tables, complete with a detailed example using prototype

Is there a way to efficiently load/render large html tables without compromising performance, especially in Internet Explorer? I recently came across a plugin in prototype.js (https://github.com/jbrantly/bigtable/, post: , demo:) that addresses this issue ...

What is the best way to position a background image so that it covers the entire screen but stops before reaching the bottom?

Having a bit of trouble with background image positioning here - it's simple enough to set a repeating background that starts from a specific point at the top. But what I'm trying to achieve is a black background that starts 100px from the top of ...

Implement CSS to stack images upon zooming

On my menu page, I have two images that I want to display side by side in the web browser and stacked on top of each other in a column when viewed on mobile. Currently, with framework7's row and column classes, the images are positioned next to each o ...

How can I center my dynamic CSS3 menu with varying widths?

I am facing an issue with my css menu where the width is set to 400 for non-Admin users and 500 for Admins. The problem arises when I center the menu for Admins by setting the UL width to 500, as it appears off-kilter for non-admin users whose menu is only ...

Tips for choosing a sibling element on hover using CSS

I'm having trouble figuring out how to make the rect element change color to purple when the text is highlighted. Right now, only the text color is changing. Is there a way to achieve this using just CSS? The goal is for the rect to turn purple on ho ...

Accessing XML files locally via JavaScript on Chrome or Internet Explorer, with compatiblity for Android mobile devices as well

Looking to extract and display data from an XML file directly in an HTML page without the need for a web server. Ready to dive into using JavaScript, jQuery, or Ajax to get the job done. ...

The contents are not visible when using <h> and <p> tags

As I am embarking on creating a whimsical art profile just for the pleasure of it, I've already got a banner and a navbar set up. However, when I tried to enter some text: Welcome to my art profile. This online gallery showcases all of ...

The placement of the breadcrumb trail is not in the right position

My website includes a menu and breadcrumbs. The menu consists of two submenus: Design Services, Design Portfolio, Design Fees, About Us, Contact Us, Design Resources, Design Vacancies, and Terms. Clicking on Design Services reveals Graphic Design, Logo Des ...

"Enhance Your Slide Up/Down Menu with a Unique Hover Effect in jQuery

HTML: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="navigation_desktop"> <div class="button_desktop_01">1.0 Main Menu <div class="SlideItem ...

Display an image when hovering over a list in HTML, utilizing JS and JQuery

When I hover over the text, I want those images to become visible. However, it seems that only the first image is selected because they all have the same ID. Does anyone know how to solve this issue? This is my first post, so please forgive me if I made ...

Ways to stop the floating label from blending with the input field

Attempting to incorporate the Bootstrap Material design theme into my project, I have implemented a basic text input field using the code below: <div class="form-control-wrapper"> <input class="form-control empty" type="text"></input> ...

Can you explain the distinction between using ":" and "::" both before and after a word?

Can someone clarify whether I should use ":" or "::" before and after in this context? I'm curious if there's any distinction between the two. ...

Tips for creating a full screen div layout with fixed top and bottom navigation bars

Can someone help me achieve the following layout style? +-----------------------------------------------------------+ | Top Sticky Nav | +--------------------------------------------------------+--+ | ...

When navigating back, the Bootstrap Multistep Form breaks down

Tools I'm currently utilizing: HTML, CSS, Javascript, Bootstrap 3 Library / Package in use: https://codepen.io/designify-me/pen/qrJWpG Hello there! I am attempting to customize a Codepen-based Bootstrap Multistep Form from the provided link abov ...