Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (521)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  XML  (Read 2674 times)
0 Members and 1 Guest are viewing this topic.
Offline nech_neb

Junior Devvie




Java for LIFE !!!


XML
« Posted 2003-11-17 22:40:49 »

I was wondering if some one could point me to
a good tutorial on XML parsing and generating
using the Xerces DOM parser...

I looked a bit through their docs and didn't find
it too helpful.

I'm kinda looking for the crash course of all
XML tutorials on Xerces.

If anyone have a link to one of those handy.

Thanks in advance.
Much appriciated.
Offline Rob Grzywinski

Junior Devvie




Reality Interactive


« Reply #1 - Posted 2003-11-18 02:17:50 »

It depends on what you're trying to do and how newless of a clubie that you are.  If you're not up to speed on DOM's (or SAX for that matter) then do your research on that first.  If you're up to speed on DOM then get the JavaDocs for Xerces and look over them for a few minutes.  You'll see quickly that they parallel the DOM exactly.  If you need more insight, there's some good articles at http://www.javaworld.com (use the search).

If you're XML savvy, you might want to consider using XPath and DOM4J.  XPath takes all of the tediousness out of walking the DOM if you're just looking for certain nodes.  DOM4J is just MUCH easier to use with XPath (and, well, DOM for that matter).
Offline sma

Junior Devvie





« Reply #2 - Posted 2003-11-18 07:59:01 »

I, too, would recommend not to use raw DOM/SAX but some nicer high level API. My favorite is Elliotte Rusty Harold's XOM [1] which provides a clean and simple approach to XML.  There's also a tutorial on its home page.


[1] http://www.cafeconleche.org/XOM/

.: Truth Until Paradox!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #3 - Posted 2003-11-20 00:46:35 »

Well I've found the built-in DOM APIs in Java 1.4 to be very easy to use and straightforward.  I wrote a couple helper methods that build on it to simplify some things.. but that's about it.

Offline tortoise

Junior Devvie




<3 Shmups


« Reply #4 - Posted 2003-11-20 04:13:46 »

I would like to use XML more effectively. Something like castor or, er I dunno. I've found just using DOM to be tedious and there's very little code reuse. I'd love to just run an XML document through a factory and out pops a Java object. But even with that said I'm still not sure castor is exactly what I want.

Oh, and I thought Sun's XML tutorials were pretty good:
http://java.sun.com/xml/tutorial_intro.html
Offline kevglass

« JGO Spiffy Duke »


Medals: 195
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #5 - Posted 2003-11-20 04:46:46 »

JAXB - Java Architecture for XML Binding existed to do exactly this.. pass the XML scheme through a processor and out popped a bunch of parsing objects.

http://java.sun.com/xml/jaxb/

Kev


Offline nech_neb

Junior Devvie




Java for LIFE !!!


« Reply #6 - Posted 2003-11-21 06:02:07 »

Thanks for the replies guys.
I guess for now I know what I'm looking for...
I'm gonna stick to JDOM (http://www.jdom.org/)
Which doesn't seem to be really popular...
although I find it helpful.

I tried the xerces stuff... I don't think they have
really good documentation (as in examples).

And I guess I'm just lazy and didn't want to dig at the JavaDocs ^_^

Is there any shortcomings to JDOM which I
should be aware of? Since I don't see its name
mentioned much...
Offline tortoise

Junior Devvie




<3 Shmups


« Reply #7 - Posted 2003-11-22 00:50:36 »

Your focus on Xerces in particular is misguided. Xerces is just one parser that implements JAXP. What you should be focusing on is learning JAXP. It's like saying you're going to "learn how to operate a toyota" instead of "learn to drive a car".

Did you look at Sun's tutorial on JAXP? It's pretty good.

JDOM is just fine, it's a nice library. It's not as popular because it's proprietary, is not backed by Sun, and is Java only.
Offline Breakfast

Senior Devvie




for great justice!


« Reply #8 - Posted 2003-11-22 20:23:20 »

Doesn't the DOM style of parser load the whole thing into memory in a Tree kind of way while the JAXP type treats it in a more event-based fashion, or did I dream that?

I've used JAXP for years, so I haven't thought about why I chose it for quite a while...
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #9 - Posted 2003-11-22 22:12:35 »

No, you are thinking of DOM vs. SAX.  JAXP has implementations for both DOM and SAX I believe.
DOM does represent the document as a tree of nodes in memory.  SAX is event based and works on the fly as it reads the XML data from the source.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #10 - Posted 2003-11-30 16:24:59 »

For most things Crimson (which is part of the JRE) is just fine.
When you want better validation (schema support) you should look at Xerces. Also, Xerces seems to handle very large XML files better than Crimson (loading a 4Mb XML in a Document object takes ages in Crimson for example).

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xFryIx (57 views)
2014-11-13 12:34:49

digdugdiggy (35 views)
2014-11-12 21:11:50

digdugdiggy (29 views)
2014-11-12 21:10:15

digdugdiggy (23 views)
2014-11-12 21:09:33

kovacsa (46 views)
2014-11-07 19:57:14

TehJavaDev (50 views)
2014-11-03 22:04:50

BurntPizza (50 views)
2014-11-03 18:54:52

moogie (65 views)
2014-11-03 06:22:04

CopyableCougar4 (63 views)
2014-11-01 23:36:41

DarkCart (149 views)
2014-11-01 14:51:03
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!