Load XML into Java

M

Mr. x

Hello,

Is there any protocol or program, that can save all the java applet into a
file (xml), and can load the java applet from file (xml) ?

How can I load XML into Java, and vice versa ?

Thanks :)
 
M

Miguel De Anda

Mr. x said:
Hello,

Is there any protocol or program, that can save all the java applet into a
file (xml), and can load the java applet from file (xml) ?

How can I load XML into Java, and vice versa ?

Thanks :)


To put it quite frankly, I don't understand why people are trying to do
everything XML? What is the purpose of converting a class file to XML? Its
only making things slower. I guess you can convert the class file to
base64 and just put it in a node. I think its a little silly, but I guess.

I think doing the base64 will make the file about 33% larger and putting it
in XML will make it 10%-100% larger. I hope you weren't trying to compress
it.

Probably another way to do it would be to extract each "line" and interpret
the bytecodes to something in your XML file and then map it back. So
something like: 0x32 0x53 0xa3 ... would become....

<node id="23">push ax</node>
<node id="24">pop ax</node>
.....



This would make the file about 5000% larger. (Almost at the M$ level of
bloat)
 
M

Mr. x

For the speed, I don't really care, since the XML was build in old fashion
manner programs,
so in first time for about 20,000 screens I need to do something that is
readable for the first time.
Though I think that there must be a way that in "transform layer" there is a
technic that can compress the data automatically, without any intervantion
of my program - Is there any compression method I can declare for
transferring the data ?

Thanks :)
 
S

SPC

You could try

java.beans.XMLDecoder and java.beans.XMLEncoder.

The requirements are that your classes have default constructors and
that variables are either public or have appropriate acessors. I've
used them for saving configuration object hierarchies and had no
problems. Like everything java, until hotspot has kicked in the
serialization can be slow(ish), but after that it's pretty quick.

The code only saves values that are different from the defaults in the
objects, so XML files can be quite small. The system is resilient to
object changes without having to use something like a serial version
Id.

There's more information on the sun web site. Other than that, there
are plenty of other alternatives out there for serializing as XML.

HTH

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top