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 6843781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:17:37+00:00 2026-05-27T00:17:37+00:00

I would appreciate any advice here. Based on what I have found on the

  • 0

I would appreciate any advice here. Based on what I have found on the web, I have tried the following to try get what I need working.

I am using Actionscript 2.0 XPath to try and access a <div> value in an xhtml file, but I have this simple piece of Actionscript that I cannot get working:

=====================
stop();

import mx.xpath.XPathAPI;

var rssfeed_xml:XML = new XML();
rssfeed_xml.ignoreWhite = true;
rssfeed_xml.onLoad = function(success:Boolean) {
trace("onload...");
if (success) {
trace("success...");


var elementId:String = "title1";
var elementPath:String = "//div[@id'" + elementId + "']";
found_elements = XPathAPI.selectNodeList(rssfeed_xml.firstChild, elementPath);


if (found_elements.length == 1) {
  trace(found_elements[0]);
}


} else {
trace("error loading XML");
}
};
rssfeed_xml.load("test.xhtml");

=====================

My test.xhtml is simple, as such:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Landing</title>
</head>

<div id="mainArea">
    <div id="content">
        <div id="calloutContent">
            <div id="title">Search Our QA Database</div>
            <div id="callout1">text1</div>  
            <div id="callout2">text2</div>         
            <div id="callout3">text3</div>
        </div>
    <div id="heroContent">
        <div id="title1">text4</div>
        <div id="title2">text5</div>
    </div>
    </div>
</div>
</body>
</html>

In my Actionscript, I am just trying to get the value of <div id="title1">, which is “text4”.

The Actionscript code looks right, but I am not getting anything coming through on the line trace(found_elements[0]);.

Any ideas?

  • 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-27T00:17:37+00:00Added an answer on May 27, 2026 at 12:17 am

    Your problem is coming from the path you have created. This is your current path (with the variable inlined):

    "//div[@id'title1']"
    

    There are a couple of things wrong here:

    • The XHTML is missing an opening <body> tag
    • the // at the start does nothing. To wildcard a node you need to use the * symbol. This will then give you the first node depth. The get to the depth you require you will need to repeat this three more times.
    • missing an = after the attribute name.

    This path works to target your chosen div:

    "/*/*/*/*/div[@id='title1']"
    

    That path returns the complete node however, so to just extract the text you then request the firstChild.nodeValue:

    trace(found_elements[0].firstChild.nodeValue);
    

    The obvious problem here is that you have to know pretty much where your target node appears within the document.

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

Sidebar

Related Questions

I would really appreciate any help with the following problem: I need to be
I'm relatively new to Java and would appreciate any help on this! I have
I would appreciate any help on this issue. Lets say I want to load
I've been researching memory mapped files for a project and would appreciate any thoughts
My code works (yeah!) which sends json to a server.. would appreciate any thoughts
I would really appreciate any suggestions, no matter how simple or complex, to help
I'm very new to C++ and would really appreciate any and all help. I
I'm trying to make a navigation for my website and would greatly appreciate any
Would very much appreciate any help or hint on were to go next. I'm
Any help with this problem would be fantastic. I appreciate all contributions! Let us

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.