Re: Instantiating objects from XML



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

.



Relevant Pages

  • Re: Parsing large amounts of data (200,000 entries) with XML?
    ... SQL Server currently can do this without any configuration changes. ... directly to XML since version 2.5, ... save a file to and an ADO Stream object as a place to write the XML to ... so you can build and load it directly into the parser. ...
    (microsoft.public.vb.general.discussion)
  • Re: Biztalk 2002 XML Intermittent Parsing error
    ... "A BizTalk Enthusiast" ... > The XML parser is at the top of the Parser List in Biztalk. ... > Biztalk server and SQL with the Biztalk DB's are on the same standalone ...
    (microsoft.public.biztalk.server)
  • CoInitializeEx(), CoUninitialize() and CORBA/threads
    ... My application uses CORBA to communicate between components, and now uses COM to access some libraries (eg. MS XML parser). ... The only sure fire way to do this is for every method in my CORBA server to call CoInitializeExnear the start of the method, ...
    (microsoft.public.vc.language)
  • Re: Duplicate Record with .ADDNEW
    ... If the database server will allow you to create a table without something, ... table there is no possibility of duplicate records. ... field imported from the XML. ... Use the Command object instead. ...
    (microsoft.public.vb.database.ado)
  • RE: XML iFilter needed for SPS 2003 infopath forms?
    ... did in fact need to be installed on the Sharepoint server, ... Apparently the claim that SP indexes xml files is not quite specific enough. ... It must use a default text Filter not a true xml ifilter. ...
    (microsoft.public.sharepoint.portalserver)