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

The Archive Base Latest Questions

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

I have a xml file… <?xml version=1.0 ?> -<dict> <ID>USDUSD</ID> <VALUE>0.00</VALUE> <ID>USDGBP</ID> <VALUE>0.6465</VALUE> <ID>USDEUR</ID>

  • 0

I have a xml file…

<?xml version="1.0" ?> 
-<dict>
   <ID>USDUSD</ID> 
   <VALUE>0.00</VALUE> 
   <ID>USDGBP</ID> 
   <VALUE>0.6465</VALUE> 
   <ID>USDEUR</ID> 
   :
   :
</dict>

An i tried with sax parser with following code

private boolean getUpdatedCurrencyValue(Context context) {
    try {

        /** Handling XML */
        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser sp = spf.newSAXParser();
        XMLReader xr = sp.getXMLReader();

        /** Send URL to parse XML Tags */

        URL sourceUrl = new URL("http:..../currencyconv.php");
        /** Create handler to handle XML Tags ( extends DefaultHandler ) */
        XMLHandler myXMLHandler = new XMLHandler();
        xr.setContentHandler(myXMLHandler);
        InputSource is=new InputSource(sourceUrl.openStream());
        Log.d("DEBUG",""+is);
        xr.parse(is);
        if(myMap!=null){
              myMap.clear();
        }  


        for (int i = 0; i < XMLHandler.countriesNames.size(); i++) {
            myMap.put(XMLHandler.countriesNames.get(i), XMLHandler.currencyValues.get(i));
             log(XMLHandler.countriesNames.get(i)+"  "+ XMLHandler.currencyValues.get(i));
        }

    } catch (Exception e) {
        e.printStackTrace();
        isError=true;


    }
}



public class XMLHandler extends DefaultHandler{

int counter=0;
protected static ArrayList<String> backupCurrencyValues = new ArrayList<String>();

//protected static String[] currencyValues=new String[290];
protected static ArrayList<String> currencyValues = new ArrayList<String>();
protected static ArrayList<String> countriesNames = new ArrayList<String>();
   //   private String[] countriesNames=new String[290];
  public XMLHandler() {
    counter=0;
  }


@Override
public void characters(char ch[], int start, int length) {
        String temp=new String(ch,start,length); //  this function retrieves values a from a tag each time
        Log.d("CURRENCY","Original "+temp);

        }

}

This function retrieves values a from a tag each time

but want values based on tags ..Any help?

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

    Do you mean retrieving tag attribute value from a tag?

    You might want to refer to my current XML parsing articles series: https://xjaphx.wordpress.com/learning/tutorials/

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

Sidebar

Related Questions

I have xml file whose structure is defined with following xsd: <?xml version=1.0 encoding=utf-8?>
I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>
I have an XML file that reads like this <abc> <ab>value</ab> <aa>time</aa> <ac>money</ac> </abc>
I have an xml file with the following structure: <main_tag> <first> <tag1>val1</tag1> <conf> <tag2>val2</tag2>
I have XML-file with settings like this <?xml version=1.0 encoding=utf-8 ?> <configuration> <configSections> <sectionGroup
We have XML file like below... <?xml version='1.0'?> <T0020 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd xmlns=http://www.safersys.org/namespaces/T0020V1> <IRP_ACCOUNT>
I have xml file like this <?xml version=1.0 encoding=UTF-8?> <specification xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=file://Desktop/normal.xsd> <university> <refstr>bdvl_te_skrm_stc</refstr>
i have xml file that looks like this: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE pointList SYSTEM
I have xml-file <?xml version=1.0 encoding=UTF-8?> <products xmlns=http://www.myapp.com/shop xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.myapp.com/shop shop.xsd> <category name=yyy> <subcategory
i have xml file and xslt transformation below: <?xml version=1.0 encoding=utf-8 ?> <?xml-stylesheet version=1.0

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.