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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:06:11+00:00 2026-05-23T02:06:11+00:00

It look like this in XML. I want to get he Image src value…

  • 0

It look like this in XML. I want to get he Image src value…

<description><![CDATA[<div class="images"><img src="http://www.voicetv.co.th/cache/images/8a1a6f2aeb7b0e9c1d6bb3eae314165f.jpg" /></div>]]></description>

What I am doing is

if ((theElement.getElementsByTagName("description")).getLength() > 0) {

            allChildern = theElement.getElementsByTagName("description").item(0).getChildNodes();

            for (int index = 0; index < allChildern.getLength(); index++) {
                description += allChildern.item(index).getNodeValue();

                NodeList chNodes = allChildern.item(index).getChildNodes();
                for (int i = 0; i < chNodes.getLength(); i++) {

                    String name = chNodes.item(i).getNodeName();
                    if(name.equals("div")) {
                        String clas = allChildern.item(index).getAttributes().getNamedItem("class").getNodeValue();
                        if(clas.equals("images")){
                            String nName = allChildern.item(index).getChildNodes().item(0).getNodeName();
                            if(nName.equals("img")) {
                                String nValue = allChildern.item(index).getChildNodes().item(0).getAttributes().getNamedItem("src").getNodeValue();
                            }
                        }
                    }
                }


            }
            currentStory.setDescription(description);
        }

But is is not working

  • 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-23T02:06:11+00:00Added an answer on May 23, 2026 at 2:06 am

    The description element contains a CDATA node. This means that the <img> “element” you are trying to access is really just a piece of text (and not an element at all).

    You’ll need to parse the text as a new XML document in order to access it via DOM methods.

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

Sidebar

Related Questions

I have a bunch of XML that has lines that look like this <_char
Our C++ application reads configuration data from XML files that look something like this:
I've got menu items that look like this <ul> <li>Item1<span class=context-trigger></span></li> <li>Item2<span class=context-trigger></span></li> <li>Item3<span
I have code that I want to look like this: List<Type> Os; ... foreach
I have an XML document like this: <article> <author>Smith</author> <date>2011-10-10</date> <description>Article about <b>frobnitz</b>, crulps
I want a screen to look like this: ![What I want to see]https://i.stack.imgur.com/E5L4g.png And
I have an xml file with elements that look like this (abbreviated for clarity):
I'm parsing simplexml and normally my simple xml would look like this $sig_size =
My two tables look like this: TABLE1 TABLE2 +--------------------+ +--------------------+ |field1|field2|field3| and |field2|field4|field5| +--------------------+
8 bits representing the number 7 look like this: 00000111 Three bits are 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.