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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:15:23+00:00 2026-06-10T01:15:23+00:00

I pulled two strings from a user input. I need to match one of

  • 0

I pulled two strings from a user input. I need to match one of them to the row ID.

I’m unaware of whether or not I would need to parse the Strings into integers (Perhaps even parse all of my XML data into strings, then look up that data) or if I can use the Strings to directly lookup XML data? Perhaps neither.

Here’s an example of what i’m storing in my XML file:

<?xml version="1.0" encoding="UTF-8"?>
<data>
    <language>
        <row id="7101">
            <language-from>English</language-from>
            <language-to>Thai</language-to>
            <cost>30.00</cost>
            <comment><![CDATA[out source]]></comment>
        </row>
    </language>
</data>
  • 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-10T01:15:25+00:00Added an answer on June 10, 2026 at 1:15 am

    Looking at the XML document, I suggest you parse the XML document to a set of structured objects, store them in a map for easy lookup, where the key is your search criteria that comes from the user’s input. Unless the XML file changes too often, one-time parsing of the document is worth it than any string based searches on it.

    I would define a class to hold that information as follows:

    class TranslationCost
    {
        private int id;
        private String sourceLang;
        private String targetLang;
        private float cost;
        private String comment;
    }
    
    Map<Integer, TranslationCost> idTocostMap;
    
    public float calculateCost(int id, int countOfWords)
    {
        TranslationCost costObj = idToCostMap.get(id);
        if (null == costObj) {
            // throw exception
        }
        return costObj.getCost() * countOfWords;
    }
    

    something like that…

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

Sidebar

Related Questions

How would I add together the values pulled from two separate jQuery.html() calls? Example:
I've got two strings that are lines pulled from a file. I'm trying to
I have two lists. First one is a list of Tasks pulled from an
I pulled from origin to update my local, and one file had conflicting changes.
I am using c#.net I have two times pulled from a database (‘earliest start
I have two arrays. Each is being pulled from MySQL via the following; $query
I am using a table to display data pulled from two database tables. I
I pulled data from RETS server (Using one MLS) but now I am confusing
This morning we pulled from our repo, and git put us on (no branch).
I have pulled an incoming changes from a codeplex-based mercurial repository and have arrived

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.