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

  • SEARCH
  • Home
  • 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 7417101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:37:59+00:00 2026-05-29T07:37:59+00:00

I have set a variable in my url wich i get in my next

  • 0

I have set a variable in my url wich i get in my next page, this variable is the title of an article in my xml. I have tried to get the rest of the contents in this article and misserably failed… The layout of the xml is.

    <title>
      <artist>
      Nirvana
      </artist>
      <description>
      Nirvana in concert
      </description>
      <date>
      18/05/1987
      </date>
   </title>
    <title>
    <artist>
    led zeppelin
    </artist>
    <description>
    led in concert
    </description>
    <date>
    18/05/1987
    </date>
    </title>

When i search for 18/05/1987 i want do display nirvana and led + description, so the whole content of the corresponding node.

EDIT I have tried the code and only seem to get 1 answer… im pretty new so i don’t get why i don’t get more answers when the check is itterated

    xmlDoc=loadXMLDoc("data.xml");
var hash = getUrlVars(); 
var date = hash['date'];
var nodeList = xmlDoc.getElementsByTagName("article");

for (var i = 0; i < nodeList.length; i++) {
    var titleNode = nodeList[i];
    if(titleNode.getElementsByTagName("urltext")[i].nodeValue = date){
        document.write("<div style='width:450px;'>")
        document.write("<p>"+titleNode.getElementsByTagName("title")[i].childNodes[0].nodeValue+"</p>");
        document.write("<p>"+titleNode.getElementsByTagName("description")[i].childNodes[0].nodeValue+"</p>");
        document.write("<p>"+titleNode.getElementsByTagName("urltext")[i].childNodes[0].nodeValue+"</p>");
        document.write("</div>")
    }
}

Ty in advance

  • 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-29T07:38:00+00:00Added an answer on May 29, 2026 at 7:38 am

    Here is a little JavaScript function I use to create an XML DOM Document I can work with…

    function GetXMLDoc(xml) {
        var xmlDoc;
        if (window.DOMParser) {
            var parser = new DOMParser();
            xmlDoc = parser.parseFromString(xml, "text/xml");
        }
        else // Internet Explorer
        {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async = "false";
            xmlDoc.loadXML(xml);
        }
    
        return xmlDoc;
    }
    

    You can then use this like so to get the title, for example…

    var xmlDoc = GetXMLDoc(XML_String_Input);
    var title = xmlDoc.getElementsByTagName("title")[0].nodeValue;
    

    EDIT: As you appear to want to perform a search on the XML you can do something like this…

    var nodeList = xmlDoc.getElementsByTagName("title");
    var resultNodes = [];
    
    for (var i = 0; i < nodeList.length; i++) {
        var titleNode = nodeList[i];
        if(titleNode.getElementsByTagName("artist")[0].nodeValue == "Nirvana"){
            //match found for artist "Nirvana"
            resultNodes.push(titleNode);
        }
    }
    
    //here you will now have a list (`resultNodes`) of "title" nodes that matched the search (i.e. artist == "Nirvana")
    //there is enough sample code above for you to be able to process each of the seach results and gets the values for the various other properties like "data" for example
    

    See here for more information on XML DOM function and properties

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

Sidebar

Related Questions

I have a page which, If a variable is set(in a session) it will
I have a block of code that looks like this: def create_page_object(url) begin page
My problem is that I have to set a variable in a try statement
I have set my default-input-method variable to english-dvorak: (custom-set-variables '(default-input-method english-dvorak)) When I launch
I have installed a servlet (solr) that requires that I set the variable solr.solr.home
I have the following code to set a userId variable: (userId set in prior
I have a variable define as: set filePath=.\file.txt I'm writing a windows batch file.
I have a variable, emailBody, which is set to a string stored in a
I have an existing panel where I set the html manually with a variable
I have a static variable partner in the class. And I want to set

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.