Re: Instantiating objects from XML
- From: "Pax" <empirium_pax@xxxxxxxxxxx>
- Date: 2 Aug 2005 03:59:34 -0700
Bernhard,
I had a simular situation where I needed to process XML to instantiate
objects for my applications. First, writing your own parser is
possible, but as you have discovered, it can be intrusive to your
domain classes. Second, it is possible that the data format can change
over time. This means your code will eventually break.
My initial solution was to implement methods that would serialize the
domain instances to a stream in XML format. Though this worked well, it
was not completely viable as a solution due to the nature of the data.
I have since implemented Splash clients with a Spray server running in
Dolphin on the server side via Apache and FastCGI. The framework
handles the serialization nicely. I only had to implement methods on
the class side ie, DomainClass class>>sprayElements... Also, additional
comments were added in for server side classes so the factory processes
of the framework could generate the appropriate in/out behavior for
processing SOAP request. The nicest thing of all is that I was able to
drop the MSXML parser... It works, but I was a bit gun shy to have it
in the design and production level clients.
It may not be what you are looking for, but it could provide you with
some answers if you choose to write your own factory processess. Will
you just be loading the XML docs from disk, or can the docs be
retrieved from a web server? If the latter, have a look at the Spray
Web Services Toolkit. Steve Waring has done a fantastic job on the
framework and it works very well.
http://www.dolphinharbor.org/dh/projects/spray/index.html
My project has already seen a number of changes regarding domain
classes and it was quite easy to add/remove/modify attributes for
classes and regenerate WSDL. Best of all, you get interoperability as
well.
Best of luck,
Pax
.
- Follow-Ups:
- Re: Instantiating objects from XML
- From: Bernhard Kohlhaas
- Re: Instantiating objects from XML
- From: Osvaldo Aufiero
- Re: Instantiating objects from XML
- References:
- Instantiating objects from XML
- From: Bernhard Kohlhaas
- Instantiating objects from XML
- Prev by Date: Re: Skins and UI
- Next by Date: Re: Changing a TextEdit to TextEdit to type paswords
- Previous by thread: Instantiating objects from XML
- Next by thread: Re: Instantiating objects from XML
- Index(es):
Relevant Pages
|