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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:43:29+00:00 2026-06-11T17:43:29+00:00

i’ve got an xml like this: <dict> <key>id</key> <string><![CDATA[ 1 ]]></string> <key>posizione</key> <string><![CDATA[ 1

  • 0

i’ve got an xml like this:

<dict>
    <key>id</key>
    <string><![CDATA[ 1 ]]></string>
    <key>posizione</key>
    <string><![CDATA[ 1 ]]></string>
    <key>id_parent</key>
    <string><![CDATA[ 0 ]]></string>
    <key>prodotto</key>
    <string><![CDATA[ Caduta temporanea ]]></string>
</dict>
<dict>
    <key>id</key>
    <string><![CDATA[ 1 ]]></string>
    <key>posizione</key>
    <string><![CDATA[ 1 ]]></string>
    <key>id_parent</key>
    <string><![CDATA[ 0 ]]></string>
    <key>prodotto</key>
    <string><![CDATA[ Caduta temporanea ]]></string>
</dict>

how can i parse this to obtain a simple string for each ?
usually, i use this method: Android xml with cdata return nothing
but with this, i obtain only the first couple of

can someone help me?

  • 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-06-11T17:43:31+00:00Added an answer on June 11, 2026 at 5:43 pm

    Use below Code for Parse Same Tag Using Dom Parser.

    public class DomParserSampleActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            ScrollView mScrView1 = new ScrollView(this);
    
            /** Create a new layout to display the view */
            LinearLayout layout = new LinearLayout(this);
            layout.setOrientation(1);
    
            /** Create a new textview array to display the results */
            TextView id[];
            TextView published[];
            TextView content[];
            TextView title[];
    
            TextView mediacontent[];
            TextView mediathumbnail[];
    
            try {
                URL url = new URL("URL_OF_XML_FILE");
                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                DocumentBuilder db = dbf.newDocumentBuilder();
                Document doc = db.parse(new InputSource(url.openStream()));
                doc.getDocumentElement().normalize();
    
                NodeList nodeList = doc.getElementsByTagName("dict");
    
                /** Assign textview array length by arraylist size */
                firstkey = new TextView[nodeList.getLength()];
                secondkey = new TextView[nodeList.getLength()];
                thirdkey = new TextView[nodeList.getLength()];
                fourthkey = new TextView[nodeList.getLength()];
    
                for (int i = 0; i < nodeList.getLength(); i++) {
    
                    Node node = nodeList.item(i);
    
                    firstkey[i] = new TextView(this);
                    secondkey[i] = new TextView(this);
                    thirdkey[i] = new TextView(this);
                    fourthkey[i] = new TextView(this);
    
                    Element fstElmnt = (Element) node;
    
                    NodeList keyList = fstElmnt.getElementsByTagName("key");
                    Element keyElement = (Element) keyList.item(0);
                    keyList = keyElement.getChildNodes();
                    firstkey[i].setText("key is = "
                            + ((Node) keyList.item(0)).getNodeValue());
                    secondkey[i].setText("key is = "
                            + ((Node) keyList.item(1)).getNodeValue());
                    thirdkey[i].setText("key is = "
                            + ((Node) keyList.item(2)).getNodeValue());
                    fourthkey[i].setText("key is = "
                            + ((Node) keyList.item(3)).getNodeValue());
    
                    layout.addView(firstkey[i]); 
                    layout.addView(secondkey[i]); 
                    layout.addView(thirdkey[i]); 
                    layout.addView(fourthkey[i]);    
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
    
            /** Set the layout view to display */
    
            mScrView1.addView(layout);
            setContentView(mScrView1);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
Does anyone know how can I replace this 2 symbol below from the string
I would like to count the length of a string with PHP. The string
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't

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.