Re: Generating XML

2011-08-22 Thread DarthG
Thank you both for your assistance. I will attempt to use the XStream
library first, but the XML is not intended to to be parsed and objects
re-built from it; rather the information will be used by another
system. Thus, it depends how much I can customise the XStream output
to suit the desired XML format. Karim, upon investigating the JAXB
framework I discovered that this is the standard practise in the
company I work for(student internship, hence why I was unaware) but as
I have stated the simplicity of the objects and resulting XML may suit
a simpler method. I had never considered manipulating the toString
methods to my advantage, so if XStream does not suit then this is the
path I will take.

Thanks again,
Gary

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Generating XML

2011-08-20 Thread karim duran
Hi Gary,

I understand that you want to do. From a java object, you want to produce
XML representation.

Ok, you have many framewoks that do this for you.
The 2 solutions i propose to you :

1) Use a standard way ( good practice and a framework support )
Let see JAXB API on Oracle web site because it's a standard way ( JSR
recommendation if i remember )
http://www.oracle.com/technetwork/articles/javase/index-140168.html.
This operation is called Marshaling e.g transforming a java object in xml.
With JAXB you can fine tune the operation.
Download JAXB and its javadoc, set your Eclipse project to add relative
*.jar and javadoc. Then code

2) If you feel that it's a heavy for what you want to do, just override the
toString() method of your java class, in order to produce xml. Here's a very
simple exemple :

class Personn
{

 private String firstName, lastName;
.../... constructor(s), getters, setters, methods omitted .../

@override
public string toString()
{
 // you can get class fields using introspection if you want to automate the
process
 return firstName + firstName + /firstName + lastName + lastName
+ /lastName;

}


}

 I hope it helps.

Regards.

Karim Duran

2011/8/19 DarthG garyker...@gmail.com

 Part of my application requires an XML file to be generated from an
 object. The XML produced will be small in size and simple in
 structure. I could achieve this using elaborate string manipulation
 but I suspect there is a better way.

 I tried to use the xmlenc (http://xmlenc.sourceforge.net/) library,
 but it requires Writer objects to function, which GWT does not
 support. Is there an accepted way of XML generation for GWT? Or
 perhaps a way to synthesise Writer objects? Initially, I want the XML
 output on the console for testing, but eventually it will be stored on
 a server/database.

 Thanks,
 Gary

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Generating XML

2011-08-19 Thread Gibson
Hi Darth,
Use the Xstream library,http://xstream.codehaus.org/
its a library that serialises objects to xml and back from xml.
use the toXML method and pass it the object.




On Fri, Aug 19, 2011 at 6:42 PM, DarthG garyker...@gmail.com wrote:

 Part of my application requires an XML file to be generated from an
 object. The XML produced will be small in size and simple in
 structure. I could achieve this using elaborate string manipulation
 but I suspect there is a better way.

 I tried to use the xmlenc (http://xmlenc.sourceforge.net/) library,
 but it requires Writer objects to function, which GWT does not
 support. Is there an accepted way of XML generation for GWT? Or
 perhaps a way to synthesise Writer objects? Initially, I want the XML
 output on the console for testing, but eventually it will be stored on
 a server/database.

 Thanks,
 Gary

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-toolkit@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.


-- 
Gibson Wasukira
Making Technology a Business Asset
www.gwasky.wordpress.com
www.thegrid.ug

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.