In Java, essentially taking the code base and adding its service functions: Using the code from the
Question:
In Java, essentially taking the code base and adding its service functions:
Using the code from the JSON. org-repo here: https://github.com/stleary/JSON-java perform the following 3 things:
- Add an overloaded static method to the XML class with the signature static JSONObject toJSONObject(Reader reader, JSONPointer path) which does, inside the library, the same thing as: reading an XML file into a JSON object, and extracting some smaller sub-object inside, given a certain path (use JSONPointer) and writing that smaller object to disk as a JSON file in client code, before writing to disk. Being this done now inside the library, you should be able to do it more efficiently. Specifically, you shouldn't need to read the entire XML file, as you can stop parsing it as soon as you find the object in question.
- Add an overloaded static method to the XML class with the signature:
static JSONObject toJSONObject(Reader reader, JSONPointer path, JSONObject replacement)
which does, inside the library, the same thing as reading an XML file into a JSON object, replacing a sub-object on a certain key path with another JSON object that you construct, and then writing the result on disk as a JSON file in the client code, before writing to disk.
Are there any possible performance gains from doing this inside the library? If so, implement them in your version of the library.
Write unit tests that use these two new functions, both for obtaining correct results and for testing error conditions.
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill