OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] What is XML For?

[ Lists Home | Date Index | Thread Index ]

Similar functionality is available in the .NET Framework via XML Serialization. The following article on XML.com compares both mechanisms 
 
http://www.xml.com/pub/a/2002/07/24/databinding.html

	-----Original Message----- 
	From: Jeff Lowery [mailto:jlowery@scenicsoft.com] 
	Sent: Thu 10/24/2002 11:35 AM 
	To: tblanchard@mac.com; xml-dev 
	Cc: 'Paul Prescod' 
	Subject: RE: [xml-dev] What is XML For?
	
	

	> > That last bit - manipulate the data and then write a
	> modified version of
	> > it is something I don't see an analog for in XML.
	>
	> node.appendChildNode("foo")
	> doc.toXML()
	
	Or you can map class objects to XML structures using introspection:
	
	/**
	 * Helper method for marshalling objects to XML.
	 *
	 * @param obj Object to marshal.
	 */
	private static void marshallBean( Object obj )
	{
	        if (obj == null ) throw new RuntimeException( "obj is null" );
	
	        OutputStream os = System.out;
	        PrintWriter writer = new PrintWriter( os );
	         try
	        {
	                Marshaller.marshal(obj, writer);
	        }
	        catch (MarshalException e)
	        {
	                System.out.println( e.toString() );
	        }
	        catch (ValidationException e)
	        {
	                System.out.println( e.toString() );
	        }
	        writer.close();
	}
	
	The above code uses Castor's Java Bean marshaller.
	
	http://www.castor.org/xml-mapping.html
	
	Don't like the default marshalling behavior? Change it with a mapping file
	(XML format).
	
	Unfortunately Castor is written in, and only works with, dirty old Java.
	However Castor code is open source, so porting it to Smalltalk is possible
	by motivated individuals such as yourself.
	
	
	
	-----------------------------------------------------------------
	The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
	initiative of OASIS <http://www.oasis-open.org>
	
	The list archives are at http://lists.xml.org/archives/xml-dev/
	
	To subscribe or unsubscribe from this list use the subscription
	manager: <http://lists.xml.org/ob/adm.pl>
	
	





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS