Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (806)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
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  
  General Java Questions  (Read 6463 times)
0 Members and 1 Guest are viewing this topic.
Offline syszee
« Posted 2014-11-20 04:13:58 »

Hi there,

Taking a break from game development, I decided to learn more on the side of applications and tools using Java. I have a few questions that a few colleagues and I discussed today.
1.) What are the uses of using xml files with java? Like, the main purposes..
2.) How could you create a serial or ID based xml, that holds information as it is entered. Basically, assigning a callable ID for a profile (with first and last name, address, etc. - for example).
3.) What are some cool things you can do with xml and java?

Thanks!
- A

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1 - Posted 2014-11-20 04:27:40 »

Google. Wikipedia. You will find better answers faster.

Here's a sample of uses:
http://www.informit.com/library/content.aspx?b=STY_XML_21days&seqNum=15
http://webdesign.about.com/od/xml/a/aa060401a.htm

Why such an interest in XML?
Offline syszee
« Reply #2 - Posted 2014-11-20 05:04:36 »

Yea, I've been using Google and have found many answers. This isn't really for an answer, but more opinions.. per se. =)
& I'm not sure really, I just find reading/writing data interesting at the moment. Smiley

Thank you!

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

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2014-11-20 19:52:37 »

then, for the sake of cute fluffy bunnies, focus on a sane, straightforward format like json.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline CopyableCougar4
« Reply #4 - Posted 2014-11-20 21:40:11 »

then, for the sake of cute fluffy bunnies, focus on a sane, straightforward format like json.

I agree JSON is nice, but coming from an HTML background, I think XML is easier to conceptualize Smiley But that's must me Smiley

CopyableCougar4

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Offline Slyth2727
« Reply #5 - Posted 2014-11-21 01:53:10 »

I agree JSON is nice, but coming from an HTML background, I think XML is easier to conceptualize Smiley But that's must me Smiley

CopyableCougar4

The difference between the two is like the difference between C# and Java.
Offline Agro
« Reply #6 - Posted 2014-11-21 01:56:59 »

json is pretty cool because it serializes directly into js Cheesy
i use it for my payload system between frontend and backend apps, and also across backend services

Offline cylab

JGO Kernel


Medals: 195



« Reply #7 - Posted 2014-11-21 07:24:03 »

then, for the sake of cute fluffy bunnies, focus on a sane, straightforward format like json.
For pure human readable data storage and transfer json is great.  As a markup language xml might be better since it allows for mixed content. As a configuration language,  xml also has it's merrits,  because of the widespread completion and documentation support in IDEs based on schemas. Hopefully json-schema catches up there soon...

Mathias - I Know What [you] Did Last Summer!
Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2014-11-21 09:24:38 »

A map in JSON:
1  
2  
3  
4  
5  
{
   water: 'h2o',
   oxygen: 'o2',
   glucose: 'c6h12o6'
}


A map in XML:
1  
2  
3  
4  
5  
<map>
   <entry key="water" value="h2o"/>
   <entry key="oxygen" value="o2"/>
   <entry key="glucose" value="c6h12o6"/>
</map>


A map in XML:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
<map>
   <entry>
      <key>water</key>
      <value>h2o</value>
   </entry>
   <entry>
      <key>oxygen</key>
      <value>o2</value>
   </entry>
   <entry>
      <key>glucose</key>
      <value>c6h12o6</value>
   </entry>
</map>


A map in XML:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
<map>
   <key>water</key>
   <value>h2o</value>

   <key>oxygen</key>
   <value>o2</value>

   <key>glucose</key>
   <value>c6h12o6</value>
</map>


There is a right way to structure your XML graph, but everybody uses their own style, and worse... is inconsistent across documents or in the very same document.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline cylab

JGO Kernel


Medals: 195



« Reply #9 - Posted 2014-11-21 09:54:02 »

A map in JSON:
1  
2  
3  
4  
5  
{
   water: 'h2o',
   oxygen: 'o2',
   glucose: 'c6h12o6'
}


The JSON input is NOT valid according to RFC 4627 (JSON specification). Unexpected token water at position 11.
Tongue

There is a right way to structure your XML graph, but everybody uses their own style, and worse... is inconsistent across documents or in the very same document.

You forgot the "maven-way":
1  
2  
3  
4  
5  
<map>
   <water>h2o</water>
   <oxygen>o2</oxygen>
   <glucose>c6h12o6</glucose>
</map>


But as I said - xml is a markup language and using it as a configuration language only makes sense when paired with a schema to get code-completion and inline-documentation support.

Mathias - I Know What [you] Did Last Summer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #10 - Posted 2014-11-21 10:45:53 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
<map>
  <![CDATA[
  {
     water: 'h2o',
     oxygen: 'o2',
     glucose: 'c6h12o6'
  }
  ]]>
</map>

there is no right way to structure xml. it's either valid or not.
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #11 - Posted 2014-11-21 11:12:13 »

You're being unfair to XML. There is no "right way to structure a map in XML" because XML is not a language, it is a metalanguage for defining new grammars. In many grammars based on XML, there is a "right (and only) way to structure a map".

Quote
there is no right way to structure xml. it's either valid or not.

Correction: XML is either well-formed or not. If a document is valid, that means it conforms to schema of some kind, which will define how to do the map.

And anyway, you can define maps in multiple ways in JSON, just like XML:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
[
    {
        "key": "name",
        "value": "ags"
    },
    {
        "key": "location",
        "value": "earth"
    },
    {
        "key": "nature",
        "value": "nice"
    }
]

Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #12 - Posted 2014-11-21 11:21:22 »

Ofcourse you can abuse JSON, but it's very, very rarely done, as opposed to XML where it's a shitstorm every single day.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #13 - Posted 2014-11-21 11:24:25 »

I know, managing XML schemas is a big part of my day job. I generate them from a DSL to keep them consistent.

Anyway Riven, your JSON example ain't valid :-) You need some irritating quotes around the keys.

Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #14 - Posted 2014-11-21 11:31:54 »

I know, managing XML schemas is a big part of my day job. I generate them from a DSL to keep them consistent.
I hope you love your dayjob, I'd be outader in a split second. Smiley

Anyway Riven, your JSON example ain't valid :-) You need some irritating quotes around the keys.
I know, right? I was lazy. And I prefer parsers/exporters that allow this lenient notation. persecutioncomplex

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #15 - Posted 2014-11-21 11:50:35 »

I just make up the rules and build tools for people so that it's not possible for them to break the rules. Like Newspeak, really.

The fact that you prefer your form of JSON over the form of JSON supported by my parser is exactly why we need XML.

Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #16 - Posted 2014-11-21 18:27:31 »

You seem to compare [XML + schemas] to [JSON], while we're talking about [XML] vs [JSON], throwing syntax rules (quotes or not) into the mix, while that is a totally different issue: standards. Whether something can be parsed or not does not in any way relate to schemas.

Both XML and JSON can have schemas to validate them, or to provide auto-completion.

You don't see JSON schemas in the wild (well, I never heard of them...) and that's mainly because JSONs explicit support for basic primitives (boolean, double), null, strings and data structures (arrays, maps) gently push you a 'common' direction of organizing your data, which means you don't really need schemas so much. But if the need arises, nothing prevents you from slapping a schema on your JSON, or any other format.

Having said that, I think we overstayed our welcome in this thread persecutioncomplex

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (587 views)
2019-09-04 15:33:17

hadezbladez (5529 views)
2018-11-16 13:46:03

hadezbladez (2410 views)
2018-11-16 13:41:33

hadezbladez (5790 views)
2018-11-16 13:35:35

hadezbladez (1233 views)
2018-11-16 13:32:03

EgonOlsen (4669 views)
2018-06-10 19:43:48

EgonOlsen (5688 views)
2018-06-10 19:43:44

EgonOlsen (3205 views)
2018-06-10 19:43:20

DesertCoockie (4104 views)
2018-05-13 18:23:11

nelsongames (5125 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
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!