Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (511)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
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  
  xsd or no xsd  (Read 2151 times)
0 Members and 1 Guest are viewing this topic.
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Posted 2005-10-17 20:08:13 »

I've been playing around with the controller configuration setup for my current project. The config is stored as XML, and partly as an exercise, I did an XSD for it.

Having pursuaded JDOM and xerces into playing nice, I now have the code. Kev pointed out that JDOM and xercesImpl are quite large. xercesImpl is needed for the xsd, and JDOM is just used for convenience (I've used it before).

The XSD isn't particularly complicated, but as I already have the code in place, I just can't decide wether the XSD is  worth it. Is the extra 1.2 meg of xercesImpl worth it to have an XSD for xml that my own lib will be reading and writing?

Just looking for ideas on how I can go about answering myself.

Endolf

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2005-10-18 07:39:28 »

If your code is the only code writing that xml, I guess there's no need for validation at all.

Erik

Offline kevglass

JGO Kernel


Medals: 186
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2005-10-18 07:57:44 »

IMO, even it is just you reading and writing it, its nice to have some validation just to catch typos etc. However, its a "nice to have" so I stick to whats there for free (i.e. DTDs).

Kev

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

Senior Newbie




Bah.


« Reply #3 - Posted 2005-10-19 03:25:50 »

I thought you were up to J2EE game servers, in which case you don't need to worry about size?

But if it's for a downloadable thing, then perhaps you could just use the XSD when writing the XML.  Or have the XML validated against the XSD as part of your build process.  Then you get the benfits of the XSD without having to deploy big, fat xercesImpl.jar.

There's just this and empty space...
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #4 - Posted 2005-10-19 06:14:50 »

Hi

The plan is to test with J2EE game server yes, but the client will just see it as a socket connection, I'm not planning on using RMI with EJB's from the client. I'm not sure why that means I don't need to worry about size?, the client is still going to need to be downloaded, and sure, most players (if there are ever any) will be on broadband and an extra 1 meg isn't going to make much difference.

One of the XSD's is checking the configuration of the user selected input settings, so I can't just check at compile time.

I could use a DTD as kev suggested as this really is simple XML.

Endolf

Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #5 - Posted 2005-10-21 12:07:39 »

Note to self. If one does a google search, one will find the answer

I'm using features from java 1.5, and a quickish google reveals this. It seems as though I can get rid of jdom and xercesImpl from my webstart as if I convert my calls to this I get xsd for free in 1.5 Smiley

Endolf

Offline dsellars

Junior Duke




Need to write more games


« Reply #6 - Posted 2005-10-21 13:19:07 »

Excellent thanks for posting this little nugget Smiley

It always seemed daft to me that XML schema wasn't supported by deafult.  Now it is Smiley  Looks pretty easy to use too.

Dan.
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #7 - Posted 2005-10-21 21:19:50 »

Yup, seems rather good, if you are using 1.5, I'm now in 2 minds.

If I rely on 1.5 being installed on the game players machine, I can use my xsd for free, generics, and enums.

If I rely on only 1.4 being present, I have to ship jdom/xerces if I want xsd (at ~1.5 meg), and have to write my own enum/list classes as before.

On the other hand, by the time my current project ever gets anyone else using it, this won't be so much of an issue as jdk 432 will be out Wink

Endolf

Offline dsellars

Junior Duke




Need to write more games


« Reply #8 - Posted 2005-10-24 07:47:09 »

I don't think you need jDOM just Xerces (although I know it is still about a meg).

You can set the standard java stuff up to parse using xsd but you need the xerces implementation of the xml parsing stuff.  If I remember correctly it's done through setting some attributes when you set it up.  I'm sure the XML processing bit on the sun website shows an example.

hmm not sure I'm 100% correct there but anyway you can downlod this http://java.sun.com/developer/technicalArticles/xml/jaxp1-3/  it seems to give you the 1.5 stuff with out needing 1.5 so atleast it *might* still be the same interface.  Sorry if you've already seen this.  I know I have set 1.4 up to use xsd before (quite a while ago) and I didn't need jDOM just xerces.  I may have downloaded JAXP though.

Dan.

Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #9 - Posted 2005-10-24 11:27:52 »

Hi

Yeah, JDOM can be dropped at any time. I looked at the JAXP stuff on java.net, but it's 4 meg for some installer. xercesImpl is looking like the best option if I want xsd and 1.4.

The other route is just to say 'you need 1.5' Smiley

Endolf

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.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (56 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
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!