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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:26:11+00:00 2026-06-01T21:26:11+00:00

I have the following xml file: <?xml version=1.0 encoding=UTF-8?> <root> <eq1>-3.874999999999* Math.pow(x, 4.0) +

  • 0

I have the following xml file:

<?xml version="1.0" encoding="UTF-8"?>

<root>
    <eq1>-3.874999999999* Math.pow(x, 4.0) + 48.749999999993* Math.pow(x, 3.0)</eq1>
    <eq2>-0.166666666667* Math.pow(x, 4.0) + 2.166666666667* Math.pow(x, 3.0)</eq2>
</root>

I would like to parse these 2 equations and place them in variables for further calculations. The method I’m using currently is parsing them and placing them in a string, but it won’t work as I need to perform the calculations using the equations.

Is there a better method I can use to work around this? Thanks in advance.

  • 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-01T21:26:13+00:00Added an answer on June 1, 2026 at 9:26 pm

    You can use JAXB to unmarshal the XML file to a custom Object with those fields.

    Your object will probably look something like:

    @XmlRootElement
    public class Equations {
    
        String eq1;
        String eq2;
    
        // create getters and setters as well
        // and put the @XmlElement annotation on the setters
    }
    

    And then just use them from the Equations object. (equations.getEq1() for example);

    Here’s a really simple and quick intro to JAXB: http://www.mkyong.com/java/jaxb-hello-world-example/

    Regarding the execution of the equations, one way is to parse the string and see which instructions and numbers you have and put them on a stack and then when everything is parsed, execute the operations (you’ll have the numbers and operations on the stack). Maybe it’s a little more work but It’s definitely an interesting way to solve the problem.

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

Sidebar

Related Questions

I have following type of file contains in xml format <?xml version=1.0 encoding=UTF-8?> <root>
I have the following xml file: <?xml version=1.0 encoding=utf-8?> <root> <phrase id=test><![CDATA[test]]></phrase> <phrase id=test0><![CDATA[test0]]></phrase>
I have an XML file of the following structure: <?xml version=1.0 encoding=utf-8?> <root> <ArrayOfLocationDTO
I have the following XML layout file, HELPME.XML <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I have the following invalid XML file: <?xml version=1.0 encoding=utf-8 ?> <Page num=1 crop_box=0,
I have created the following vsct file xml. <?xml version=1.0 encoding=utf-8?> <CommandTable xmlns=http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable xmlns:xs=http://www.w3.org/2001/XMLSchema>
I have the following file Log4net.config in my bin directory: <?xml version=1.0 encoding=utf-8 ?>
I have the following XML file: <?xml version=1.0 encoding=utf-8 ?> <strategies> <strategy name=God Class>
I have the following XML file: <?xml version='1.0' encoding='utf-8'?> <Answers> <Question1 q=What is your
I have the following XML file: <?xml version='1.0' encoding='utf-8'?> <Answers> <Question1 q=What is your

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.