Posts tagged xsd
The challenge is a common one. We have got data in a domain model, based on POJOs. And we need to marshall that data into an XML document. Note that the exact structure of that document is not so important – we will probably translate is somewhere anyway. At this point, all we have is a set of POJO definitions. There is no XSD, no predefined XML structure.
JAXB – the Java Architecture for XML Binding – seems like the technology to turn to. My experience with JAXB has mainly been from the other end: we have XML data, described by an XSD, that we want to turn into Java Objects (unmarshall XML to Java). In that case, we take the XSD that describes the XML, generate Java classes and use JAXB to unmarshall XML into objects based on those classes. The alternative round – taking classes and marshalling them into XML would be just as simple – or even simpler, now would it not?
Well, it was not as straightforward as I hoped it would be. I thought that adding a few JAXB annotations to my existing POJO model would do the trick – but no such luck. Unless I am completely misguided and mistaken, the steps required are:
- create an XSD based on the original POJO model
- generate JAXB annotated More >
While looking into the XML functionality in JDeveloper 11g, I came across a feature that was added in the 184.108.40.206.0 release – July 2009: [Create] XML Schema from XML Document. Functionality previously found in commercial products such as XMLSpy, that enables us to make a head start with the development of XML Schema Definitions by using an existing XML Document as starting point.
In this article, I will very briefly demonstrate what this functionality allows us to do. And what its current limitations are.
In short: we can indicate an XML document and have an XSD created that derives its element, type and attribute definitions from the actual XML content in that document. Most XML documents do not represent the entire set of restrictions and freedom that the XSD will describe, so the generated XSD is only a starting point – but a very useful one all the same.
At this moment, the XML source document has to exist on the file system (we cannot feed the tool with a URL). The created XSD document does not work well with multiple namespaces – as well will see in this example. The tool does not create named (complexTypes) – only (nested) elements. It does create, when so requested, More >
A few months ago I came across a relatively new book: Processing XML Documents with Oracle JDeveloper 11g by Deepak Vohra (370 pages, Packt Publishing, ISBN 978-1-847196-66-8, February 2009).
It is an interesting mix of topics, all having to do with XML and most directly related to JDeveloper. The topcis and chapters do not at all times seem logically bundled together (for example design time and run time seem to be somewhat strangely intermingled in the book) but they provide a lot of useful information to any developer working on applications that involve XML in some way (and which one does not today) using JDeveloper as an IDE or Oracle XDK 11g..
And JDeveloper 11g’s XML capabilities may not be entirely on par with single issue IDEs such as XMLSpy, it certainly does a very good job at many frequent and less frequent XML tasks. This book does a good job at showing the various XML specific features of JDeveloper – although it also fails to mention one or two. It contains many examples of writing Java code to process XML in some way, primarily using XDK 11g; those examples are not always really specifically related to JDeveloper 11g, as the code uses standard libraries that can More >
Recently I have been doing quite some work with WebServices – calling them and implementing them, from and in both PL/SQL and Java. And in conjunction with BPEL and ESB. Today, I did some quick tests using JDeveloper 11g (TP4) and more specifically JAX-WS. It turns out to be very simple to publish (and test) a Java based WebService – a matter of minutes.
This article will very briefly demonstrate how to get a WebService up and running, based on a simple Java Class. (more…)