I need a little guidance on a Java problem I am tackling. I hope you can spare a moment for some advice.
I am working with a server that outputs some complex XML over http(s). By complex I mean that a lot of the items contain attributes.
I have a need to build a servlet that will be able to receive this XML content via http(s) and then be able to apply a given XSLT against it, which creates HTML output.
I am reading through a book called "Java and XSLT" (O'Reilly) which provides examples, but they also use very small XML files that are simple and usually created by the user via a web page.
At a high level, I believe the approach is to simply:
Fetch a given URL and store it as an XML object.
Load an XSLT file into memory.
Apply the XSLT to the XML and then display the results back to the user.
Can you help me fill in the gaps of what else I would need to do. I don't know if I need to create classes to for each of the XML elements in the XML file. In the examples I am seeing, it seems that is what they are doing.
Well, your first step should be to gain familiarity with the process. So first write some code which gets its source XML from a file and transforms it the way you would like. Then read the Java Networking Tutorial to find out how you can get an InputStream which points to your HTTP resource. Feed that InputStream to your XML parser and you're about done.