Binding Java to Manual Class Definition

I have an XML schema for which I will need to create Java classes. This is not a very large scheme, I would say that it will lead to 20 classes. I am trying to weigh whether to use automatic binding (such as supplied in JAXB or JiBX), or manually write my own classes and use something like XStream to sort / unset the sort.

What are the advantages / disadvantages of writing your own classes, rather than using a binding program.

In addition, I use a binding program, I am bound to it forever. For example, if I use the JAXB binding compiler to create classes, should I use JAXB for all marshalling / unmarshalling?

ps I saw the following XML binding / serialization questions that were useful but did not answer my question completely: xml-serialization-in-java and java-xml-binding

+5
source share
2 answers

I do not think that your question has a definitive answer. But I can give you some advice. Here are a few things to consider:

  • It takes a long time to write marshalling and non-marking code, especially for the first time.

  • You will have to spend a lot of time studying the nuances of your DOM library (Xerces or its equivalent).

  • There are many duplicates, so you will end up having to write some helper classes.

  • , , .

, " JAXB ". , , JAXB , JAXB Java 5/6.

JAXB, , , :

*** , JAXB .

, , JAXB . JAXB ( , ), ( , , ).

JAXB factory, JAXB POJO , . JAXB, JDBC; JAXB - , POJO. POJO - , , . JAXB - .

+13

, - , JAR-. , , , , . . , , .

0

All Articles