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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:29:35+00:00 2026-05-16T10:29:35+00:00

My XML looks like: <key>A</key> How do I extract the string A from the

  • 0

My XML looks like:

<key>A</key>

How do I extract the string “A” from the XML with java in Eclipse?
My Java code looks like:

    XmlResourceParser xmlSymptoms = getResources().getXml(R.xml.symptoms);
    while (eventType != XmlResourceParser.END_DOCUMENT) {
        if (eventType == XmlResourceParser.START_TAG) {
            // Get the name of the tag (eg scores or score)
            String strName = xmlSymptoms.getName();
            if (strName.equals("key")) {
                 keyName = xmlSymptoms.getAttributeName(0);
                 keyA = xmlSymptoms.getAttributeValue(0);
            }
         }
         eventType = xmlSymptoms.next();
    }

But I think AttributeName and AttributeValue are for items that are part of the key description, i.e. they would be used to obtain “item” and “first”.

<key item="first">A</key>

What do I use to obtain the string between
“<key>”
and
“</key>“?

  • 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-16T10:29:35+00:00Added an answer on May 16, 2026 at 10:29 am

    You need to watch for the XMLResourceParser.TEXT event in addition to the START_TAG event. START_TAG only is concerned with <key item="first">. TEXT is concerned with A. END_TAG </key> etc.

    Once you’ve recieved a TEXT event, call xmlSymptoms.getText(). This would return “A” in your example.

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

Sidebar

Related Questions

I've this strange issue. I've an xml string which looks like below - <key><int>5</int></key><value><int>10</int>
Here is an example bit from the xml file: <array> <dict> <key>Name</key> <string>Joe Smith</string>
I have code which parses XML that looks like this: <custom_fields> <custom_field> <column_name>foo</column_name> <column_value>0</column_value>
I have an XML document with (basically) looks like this: ... <param> <key>age</key> <value>10</value>
I have some XML that looks something like this: <ExtensionObject> <Value xmlns=> <Key>key01</Key> <StringValue>somewords</StringValue>
My XML looks like : <?xml version=\1.0\?> <itemSet> <Item>one</Item> <Item>two</Item> <Item>three</Item> .....maybe more Items
My xml looks like this: <nodes><skus><sku>abc</sku><sku>def123</sku></skus></nodes> I want to get all the elements with
My xml looks like: <nodes> <node name=somekey> <item name=subject>blah</item> <item name=body>body</item> </node> </nodes> And
My xml looks like this- <?xml version=1.0 encoding=UTF-8?> <root> <Objects> <object1>object1Value</object1> <object2>object1Value</object2> </Objects> </root>
My XML looks like this. I would like to export collected_objects into another document.

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.