SOLVE PHP PROBLEM in ONE FILE using PHP and XML Write a PHP
SOLVE PHP PROBLEM in ONE FILE using PHP and XML
Write a PHP script that accepts HTTP GET and POST requests. When sent a GET request, your script should generate HTML markup containing a simple form with a text input box like that shown below. Enter XML: The user is allowed to enter simple XML into the text box to perform an arithmetic operation, by specifying the type of operation: add/subtract/multiply/divide, and a pair of numbers on which to perform the operation. When the user clicks the Submit button shown above, the PHP script should be sent a POST request with the XML entered by the user. Your script will need to parse the XML to perform the requested arithmetic operation. Ensure that your script can parse and understand the XML code below and perform the requested \'add\' operation. add 5 3 The parser should also be able to handle the other arithmetic operations including subtract, multiply and divide. It should also report parse errors and invalid arithmetic operations, and handle divide-by-zero errors.Solution
public class Node{ Object data; Node next; Node(Object data, Node next){ this.data = data; this.next = next; } public Object getData(){ return data; } public void setData (Object data){ this.data = data; } public Node getNext(){ return next; } public void setNext(Node next){ this.next = next; } }