<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2014.210" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2><FONT face=Arial>Hi All</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial>I have a suite of Java classes for working
with</FONT><FONT face=Arial> well formed XML in memory. The idea is to
enable applets running in browsers access to XML based data. I am currently
passing data to applets in XMLObject form, I am also using these classes for the
middleware layer in fairly large business critical applications.
</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Why re-invent the wheel? Well t<FONT face=Arial
size=2>he .Jar file is 25k zipped. 30k unzipped. The raw class files run to
about 65k, I have not tried to compress or optimise this yet. Any
exceptions still print debug style messages to assist in fixing any problems.
Compared to the 'full monty' applications from IBM and Microsoft' I reckon thats
good enough reason. </FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>The classes provide the following functionality -
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>create a new empty XmlObject</FONT></DIV>
<DIV><FONT face=Arial size=2>create an XmlObject from a string. ( or text file
)</FONT></DIV>
<DIV><FONT face=Arial size=2>get the value of an attribute</FONT></DIV>
<DIV><FONT face=Arial size=2>set the value of an attribute</FONT></DIV>
<DIV><FONT face=Arial size=2>insert an attribute or node</FONT></DIV>
<DIV><FONT face=Arial size=2>remove an attribute or node</FONT></DIV>
<DIV><FONT face=Arial size=2>insert a copy of an XmlObject into another
XmlObject</FONT></DIV>
<DIV><FONT face=Arial size=2>copy the XmlObject or a subsection of the
XmlObject</FONT></DIV>
<DIV><FONT face=Arial size=2>build a cursor on a list of attributes at a certain
level in the XmlObject</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>nodes and leaves can be located using qualified
names. (IE: get ("customer.address.postcode") )</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Anyway that's the basics, there are a few more
besides. Are there any souls out there interested in testing this lot
before I let it loose on the general community? drop me a mail at <A
href="mailto:ian@imolesworth.demon.co.uk">ian@imolesworth.demon.co.uk</A> and
I'll mail you the files and some documentation.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Ian Molesworth<BR>Tango4 Consulting
ltd</FONT></DIV>
<DIV><FONT face=Arial size=2>+44 (0) 411 378 562</FONT></DIV>
<DIV><FONT face=Arial size=2>+44 (0) 1892 852846</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>Sample follows -</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>public static void main(java.lang.String[] args)
{</FONT></DIV>
<DIV><FONT face=Arial size=2><BR> try<BR> {<BR> // To
build an object from the test file uncomment the following line
and<BR> // comment out the 4 after that<BR>// XmlObject
theObject = XmlObject.createFromFile ("C:\\data\\testdata.xob");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> String theString =
"<XmlStringUser><UserId> 12345 </UserId>
<UserName> Ian Molesworth";<BR> theString +=
"</UserName> <ProductList> <Product> <name> Term life
</name> </Product>
<Product>";<BR> theString +=
"<name> dual life </name> </Product> <Product>
<name> mortgage life </name>
</Product>";<BR> theString
+= "<Product> <name> annuity </name> </Product>
</ProductList> </XmlStringUser>";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// Uncomment the next two lines to see the sample
string streamed out<BR>// System.out.println("A string that will
become an XmlObject -
");<BR>// System.out.println(theString);<BR> <BR> XmlObject
theObject = XmlObject.buildFromString (theString);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// Uncomment the next two lines to see the
formatted XML Object after being built from the
string<BR>// System.out.println("\nThe serialized & formatted
XmlObject - ");<BR>// System.out.println
(theObject.asXml());</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> theObject.insert
("Request","VerifyUser");<BR> <BR> XmlObject
Address = XmlObject.build ("Address");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> Address.insert
("PostCode");<BR> Address.insert
("NameBer","31");<BR> Address.insert ("line4","East
Sussex");<BR> theObject.insert (Address); </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> theObject.set
("Address.PostCode","TN6 3LW");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>// Uncomment the next two lines to see the
formatted XML Object after being having the additional bits
added.<BR>// System.out.println("\nThe NEW serialized & formatted
XmlObject - ");<BR>// System.out.println
(theObject.asXml());<BR> <BR> if (
theObject.contains("UserId"))<BR> {<BR> System.out.println
( "UserId = " +
theObject.get("UserId").asXml());<BR> System.out.println (
"User name = " +
theObject.get("UserName").asXml());<BR> if (
theObject.contains("ProductList"))<BR> {<BR>
System.out.println ("List of products -
");<BR> int n = 1;</FONT></DIV>
<DIV><FONT face=Arial size=2> // This bit pulls out a
copy of the subsection ( class ) held under productlist
<BR> XmlObject ListOfProducts =
theObject.get("ProductList");</FONT></DIV>
<DIV><FONT face=Arial size=2> // build a cursor on
the enclosed attributes<BR> XCursor cursor
= new XCursor
(ListOfProducts);<BR> <BR> while
(cursor.hasMoreElements())<BR> {<BR> XmlObject
listObject =
(XmlObject)cursor.nextElement();<BR> System.out.println
(n++ + " " + listObject.get("name").asXml());<BR> }
<BR> }<BR> else
if (
theObject.contains("Product"))<BR> {<BR> System.out.println
(theObject.get("Product.name").asXml());<BR> }<BR> }<BR> }<BR> <BR> catch
( Throwable exception )<BR> {<BR> System.out.println
("Exception........." + exception.getMessage());<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> }</FONT></DIV>
<DIV> </DIV></BODY></HTML>