aspose file tools*
The moose likes Web Services and the fly likes XML and Object already defined. JAXB type questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "XML and Object already defined. JAXB type questions" Watch "XML and Object already defined. JAXB type questions" New topic
Author

XML and Object already defined. JAXB type questions

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

OK, so we have an Object Model already that we use in our application. We have a web service with its XML schema defined already. The Object Model and XML are set and I need to be able to convert between the two easily. JAXB has the marshalling and unmarshalling of XML to Object and back.

For some reason in my head, I remember that you can generate Java files from an XML Schema and you can create an XML Schema from a Java Object. But what if you already have those two side defined. Can you just create a mapping file that maps the XML to the Object Model?

Or is there a seperate tool we should use. I know Castor looks like they have such a thing.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

It looks exactly like what Castor can provide. Next question will be what overhead to performance will using Castor to marshal and unmarshal as compared to just using DOM and XPath.

Mark
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
With DOM and XPath implementations, you do the dirty laundary.
With Castor, it does the laundary for you with your schema as the input.
I have known/worked on projects that relied on Castor (as opposed to ding it ourselves) and I assume they did their homework before going that way. So, I would go with Castor rather than DOM/XPath. My two cents.......


- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Just want to be sure of the question. Are you just trying to
have some kind of Java-to-XML-to-Java mapping, and don't
care about web services or JAXB? Or are you trying to use
web services and/or JAXB, but want them to use a mapping
you've already created?

As for performance, I haven't tried castor, but I did
some testing to compare JAXB, XmlSchema, SAX, Digester,
Stax.
- stax was best if you could could
keep a reference to your processor
and keep reusing it
- xmlschema was best if you couldn't
keep a reference to your processor
- jaxb was a close second to xmlschema
when you couldn't keep a reference,
and the jaxb type mappings are much
more flexible.


Reid - SCJP2 (April 2002)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML and Object already defined. JAXB type questions