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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:11:50+00:00 2026-05-28T04:11:50+00:00

I exported a flash web gallery from Lightroom. It uses an XML file to

  • 0

I exported a flash web gallery from Lightroom. It uses an XML file to display the caption of each photo. All I want is to extract the description tag from this XML file so that I can send it to a proofreader. I’ve been trying to use javascript to do this but it just isn’t working. The code I have is able to get me a partial list of all the descriptions. My code iterates through the description tags but once it meets an empty tag: it (using Chrome debugger) throws a Uncaught TypeError: Cannot read property ‘data’ of null and stops execution.
I’ve tried to check against “null !==” but the I am guessing the code still runs because I still get the error.

So far, I am convinced that XML is evil.

Sample of XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<mediaGroup>
  <amgVersion version="1.3" />
  <groupInfo>
    <bunch of="data I don't care about" />
  </groupInfo>
  <sizes>
    <bunch of="data I don't care about" />
  </sizes>

  <media totalGallerySize="104">
    <item>
      <title></title>
      <description>Yo! Look at that monkey on the bars</description>
      <imageID />
      <mediaType/>
      <renditions>
        <rendition size="large" />
        <rendition size="medium" />
        <rendition size="small" />
        <rendition size="thumb"  />
      </renditions>
    </item>
    <item>
      <title></title>
      <description>It's trying to parse XML files ahhaha</description>
      <imageID />
      <mediaType/>
      <renditions>
        <rendition size="large" />
        <rendition size="medium" />
        <rendition size="small" />
        <rendition size="thumb"  />
      </renditions>
    </item>
    <item>
      <title></title>
      <description></description>
      <imageID />
      <mediaType/>
      <renditions>
        <rendition size="large" />
        <rendition size="medium" />
        <rendition size="small" />
        <rendition size="thumb"  />
      </renditions>
    </item>
    <item>
      <title></title>
      <description>That missing description is going to make him angry</description>
      <imageID />
      <mediaType/>
      <renditions>
        <rendition size="large" />
        <rendition size="medium" />
        <rendition size="small" />
        <rendition size="thumb"  />
      </renditions>
    </item>  
  </mediaGroup>

For my code I have the following:

<script type="text/javascript">
  function loadXMLDoc(dname) {
if (window.XMLHttpRequest)
    {
    xhttp=new XMLHttpRequest();
    }
else
    {
    xhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
xhttp.open("GET",dname,false);
xhttp.send();
return xhttp.responseXML;
  } //end function

  xmlDoc=loadXMLDoc("group.xml");
  var z=xmlDoc.getElementsByTagName("item"), nameELEM;
  document.write(z.length);
  for (i=0;i<=z.length;i++){
    nameELEM=z[i].getElementsByTagName("description")[0];
    if (typeof nameELEM.firstChild.data !== "undefined") { //This is the line the error quotes
      //handle property xxx of documentFragment as required
      document.write(nameELEM.firstChild.data + "<br />");
    }
  }
 </script>

Line 38: Uncaught TypeError: Cannot read property ‘data’ of null
Line 38 = if (typeof nameELEM.firstChild.data !== “undefined”) {

  • 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-28T04:11:50+00:00Added an answer on May 28, 2026 at 4:11 am

    Instead of:

    if (nameELEM.firstChild.data !== null)
    

    Try:

    if (typeof nameELEM.firstChild.data !== "undefined")

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

Sidebar

Related Questions

I exported a build.xml file from an Eclipse/Android project (under Windows). Then I use
I'm trying to display an image exported from a flash BitmapData in a basic
How do I list the symbols being exported from a .so file? If possible,
I exported a .bin file from RealFlow 4 and now need to be able
I'm attemting to load an image that I exported from flash CS3 it's a
I'm using Flash CS5 and I have a problem with my exported SWF file:
I imported an FLV file to my FLA flash file, and exported it as
Well, I have Flash file which has one movie-clip (Box1) and it is exported
I created a flash video player using Flash CS3. I exported the player to
I have this exported file of some weird (standard for this industry!) format, which

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.