in Education by
I know this questions might seem a little odd, but I want to make sure. One of my superiors is kind of convinced that there is a more or less easy way to convert the XML serialization of an object back to the java code that created it. I am, however, pretty sure that the best I can get is the object. So basically my questions is: Is there any way to convert something like this 42 23 back to something like JPanel jPanel = new JPanel(); jPanel.setSize(42,23); Thanks in advance. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Provided that all serialized objects comply to the java beans contract, you can re-create the process that the XML de-serializer follows to unmarshal the java objects, in order to recreate the code that goes with it. Back in the golden XML days, I worked some projects that used similar processes to generate Java code from XML definitions. Departing from your serialized model, you can use a XSL-T transformation to recreate the code that lead to the serialized objects. This process will create very linear code (as in non-modular), but you'll have what you're looking for. An example to get you started: To process the XML you provided, you can use the following recursive transformation: copy/paste it & try it here: online XSL-T (the template is based on Xpath 1.0 to be able to use the online tool. Xpath 2.0 will improve the code in some areas, like string functions) <?xml version="1.0" encoding="ISO-8859-1"?> = new (); _ .set( ); , Disclaimer: I tested the template on the sample provided and some variations of it, including some containign several more objects. I did not test deeper object nesting. It's an example and not a fully-functional XML Serialization to Java transformation, which is left as an exercise to the reader :-)

Related questions

0 votes
    In the same way that you can use JSON in javascript? At least the static properties? Or maybe even ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    What happens if no call back is specified for XML file in d3.js?...
asked Nov 14, 2020 in Technology by JackTerrance
0 votes
    You are converting your HTML file into XHTML Strict. Which code snippet will validate without errors? asked Mar 10, 2023 in Technology by JackTerrance
0 votes
    Which component is responsible for converting bytecode into machine specific code? (a) JVM (b) JDK (c) ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    What is the code snippet to go back to a history twice? (a) history(2); (b) history(-2); ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    You are working with this XML code snippet from the XML document cars.xml. You need to return the information about the cars ... D.doc("cars.xml")/cars/car[integer(year) > 2000]...
asked Mar 10, 2023 in Technology by JackTerrance
0 votes
    The first part of index.Rmd is XML code. (a) True (b) False I had been asked this question ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    Which character in JavaScript code will be interpreted as XML markup? (a) ! (b) > (c) & (d) ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    The first part of index.Rmd is XML code. (a) True (b) False...
asked Oct 9, 2021 in Technology by JackTerrance
0 votes
    Which of these is an interface for control over serialization and deserialization? (a) Serializable (b) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    I'm trying to convert a long timestamp that is UTC to Eastern Standard Time and am totally lost. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I'm trying to convert a long timestamp that is UTC to Eastern Standard Time and am totally lost. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    Which concept of Java is a way of converting real world objects in terms of class? (a) Polymorphism ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    I am new to java so excuse my lame questions:) I am trying to build a web service in Java ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
...