XML Questions  
Author Message
Jo





PostPosted: 2004-4-9 17:04:00 Top

java-programmer, XML Questions I have a very simple XML document for settings in an program I have written.
I want to be able to read in and update these settings.

- Would I be better using DOM or SAX?
- What would be the best parser for me?

Also, as I'm new to XML in Java (and also fairly new to Java) I'm still
unsure on what effect exactly implementing XML in my program will have. It's
a very simple program (the java files are 35kb in total) - it appears to me
that if I use XML then I'll have to include a comparatively huge XML parser
with my program when distributing it - I've just downloaded the IBM one and
it's 2.6MB. Is this true or am I misunderstanding something fundamental
here?

TIA.


 
Steve W. Jackson





PostPosted: 2004-4-10 2:33:00 Top

java-programmer >> XML Questions In article <email***@***.com>,
"Bryce (Work)" <email***@***.com> wrote:

>:On Fri, 9 Apr 2004 10:03:36 +0100, "Jo" <email***@***.com> wrote:
>:
>:>I have a very simple XML document for settings in an program I have written.
>:>I want to be able to read in and update these settings.
>:>
>:>- Would I be better using DOM or SAX?
>:>- What would be the best parser for me?
>:>
>:>Also, as I'm new to XML in Java (and also fairly new to Java) I'm still
>:>unsure on what effect exactly implementing XML in my program will have. It's
>:>a very simple program (the java files are 35kb in total) - it appears to me
>:>that if I use XML then I'll have to include a comparatively huge XML parser
>:>with my program when distributing it - I've just downloaded the IBM one and
>:>it's 2.6MB. Is this true or am I misunderstanding something fundamental
>:>here?
>:
>:A lot depends on your requirements.
>:
>:If using XML, it really depends on several things.
>:
>:Realize that when using DOM, you are loading the entire document,
>:which can impact memory consumption (if its a large document), time to
>:process, etc. Not much of an issue if its a small document. You might
>:also want to look at JDOM.
>:
>:SAX is good for large documents, a bit faster.
>:
>:If the document is simple, then you might want to consider using a
>:.properties file. Built in functions in java to handle the files,
>:etc...
>:
>:--
>:now with more cowbell

Good advice, but it's lacking a fundamental point. If you use a recent
Java version (as of about 1.3, if memory serves), there's no need for
any additional software. Skip JDOM, Xerces, IBM, all the rest. As a
matter of fact, a major part of Xerces is what's now included in Java
(see the javax.xml, org.xml.sax and org.w3c packages in the API). You
can do both DOM and SAX parsing, and manipulate DOM documents all you
like, all without anything that's not already included in 1.3 and later.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
 
Josef Garvi





PostPosted: 2004-4-12 3:36:00 Top

java-programmer >> XML Questions Jo wrote:

> I have a very simple XML document for settings in an program I have written.
> I want to be able to read in and update these settings.
>
> - Would I be better using DOM or SAX?

Use DOM.

> - What would be the best parser for me?

Use the Xerces-version that is built into the JDK.


> Also, as I'm new to XML in Java (and also fairly new to Java) I'm still
> unsure on what effect exactly implementing XML in my program will have. It's
> a very simple program (the java files are 35kb in total) - it appears to me
> that if I use XML then I'll have to include a comparatively huge XML parser
> with my program when distributing it - I've just downloaded the IBM one and
> it's 2.6MB. Is this true or am I misunderstanding something fundamental
> here?

I'm not an expert at this, but I guess that if you use the libraries that
are in the JDK, your program will not grow from it in size.


--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty
 
 
Dale King





PostPosted: 2004-4-13 4:45:00 Top

java-programmer >> XML Questions "Bryce (Work)" <email***@***.com> wrote in message
news:email***@***.com...
> On Fri, 9 Apr 2004 10:03:36 +0100, "Jo" <email***@***.com> wrote:
>
> >I have a very simple XML document for settings in an program I have
written.
> >I want to be able to read in and update these settings.
> >
> >- Would I be better using DOM or SAX?
> >- What would be the best parser for me?
> >
> >Also, as I'm new to XML in Java (and also fairly new to Java) I'm still
> >unsure on what effect exactly implementing XML in my program will have.
It's
> >a very simple program (the java files are 35kb in total) - it appears to
me
> >that if I use XML then I'll have to include a comparatively huge XML
parser
> >with my program when distributing it - I've just downloaded the IBM one
and
> >it's 2.6MB. Is this true or am I misunderstanding something fundamental
> >here?
>
> A lot depends on your requirements.
>
> If using XML, it really depends on several things.
>
> Realize that when using DOM, you are loading the entire document,
> which can impact memory consumption (if its a large document), time to
> process, etc. Not much of an issue if its a small document. You might
> also want to look at JDOM.

I suggest XOM as a replacement for DOM/JDOM. It is Elliotte Rusty Harold's
answer to the shortcomings of both:

http://www.cafeconleche.org/XOM/

I've been using it and like it a lot. It is a very clean design.


 
 
Juha Laiho





PostPosted: 2004-4-25 17:08:00 Top

java-programmer >> XML Questions "Steve W. Jackson" <email***@***.com> said:
>Good advice, but it's lacking a fundamental point. If you use a recent
>Java version (as of about 1.3, if memory serves), there's no need for
>any additional software.

As long as your XML data is US-ASCII. It seems that the XML parser
versions distributed with Sun JDK are very bad at handling non-US-ASCII
data (yes, there was a proper character set declaration in the XML data).
Switching to a recent version of Xalan fixed the problem.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
 
jamesblock69





PostPosted: 2004-4-26 6:14:00 Top

java-programmer >> XML Questions Josef Garvi <email***@***.com> wrote in message news:<c5c6kj$3psk$email***@***.com>...
> Jo wrote:
>
> > I have a very simple XML document for settings in an program I have written.
> > I want to be able to read in and update these settings.
> >
> > - Would I be better using DOM or SAX?
>
> Use DOM.
>
> > - What would be the best parser for me?
>
> Use the Xerces-version that is built into the JDK.
>
>
> > Also, as I'm new to XML in Java (and also fairly new to Java) I'm still
> > unsure on what effect exactly implementing XML in my program will have. It's
> > a very simple program (the java files are 35kb in total) - it appears to me
> > that if I use XML then I'll have to include a comparatively huge XML parser
> > with my program when distributing it - I've just downloaded the IBM one and
> > it's 2.6MB. Is this true or am I misunderstanding something fundamental
> > here?
>
> I'm not an expert at this, but I guess that if you use the libraries that
> are in the JDK, your program will not grow from it in size.

bb
 
 
Josef Garvi





PostPosted: 2004-4-26 14:26:00 Top

java-programmer >> XML Questions Icemerth wrote:
>
> bb

What does "bb" mean?

--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty
 
 
Andrew Thompson





PostPosted: 2004-4-27 13:14:00 Top

java-programmer >> XML Questions On Mon, 26 Apr 2004 08:26:07 +0200, Josef Garvi wrote:

> Icemerth wrote:
>>
>> bb
>
> What does "bb" mean?

Who cares?
<http://google.com/groups?th=f181c012b3a2e5ba#link7>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology