[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML and Objects

  • From: Steve Withall <stevew@a...>
  • To: "XML Developers' List" <xml-dev@i...>
  • Date: Tue, 29 Sep 1998 18:04:36 +1000

Re: XML and Objects
At 00:28 29/9/98 -0700, David Brownell wrote:
>For example, in Java it's (way) easy to put together something that
>can "serialize" (not in the "java.io" sense though) beans like:
>
>	<BEAN CLASS="com.example.foo.SimpleBean">
>	    <PROPERTY NAME="prop1" DCD:i4>49</PROPERTY>
>	    <PROPERTY NAME="prop2" DCD:string>hello world</PROPERTY>
>	    ...
>	    </BEAN>
>
>Then reading it back in Java is a case of taking the "CLASS" tag
>and instantiating, then assigning properties.  In C++ it'd need a
>table associating that class with some custom generated C++ stuff.
>Plus of course there are corner cases like wanting to emit strings
>containing characters that are not legal XML -- formfeed, BEL, and
>so on.  (That'd be one reason why when I did such stuff, I didn't
>use DCD.)  Reflection makes stuff like that rather simple to do;
>you can use custom generated code, but don't need to.
>
>That particular solution doesn't require DOM at all. 
>
>- Dave
>
Dave,

The problem I have with this approach is that it limits you to specifying just a single class. Surely in the general case one wants to be able to use an XML element to represent some sort of 'thing' (avoiding the word object), and it should be possible for multiple applications to use this XML document, each one possibly wishing to instantiate the 'thing' using a different class.

I'd prefer the identification of which class a particular application should use for a particular type of element to be external (using DCD, for example). The document itself then remains 'purer', uncluttered with this application-specific information.

Also, I assume (hope!) you're using the element name 'BEAN' just as an example, and that in practice you'd use 'meaningful' element names. This would, however, make the use of 'PROPERTY' attributes more problematical.

Cheers, Steve.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.