Author Topic: XML_  (Read 662 times)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
XML_
« on: July 30, 2011, 06:17:40 AM »
LOL, I need to make a new topic because the "XML" one make it display as xml not as html :D

I need some simple basic XML reader. But to make my life harder they of course included several :) So, which to choose? (xml, libxml, xmlreader, simplexml)

Offline Marek

  • Level 18
  • *
  • Posts: 177
  • Reputation: +7/-0
  • XHTML, CSS, JS, PHP and MySQL are my pantheon.
    • View Profile
Re: XML_
« Reply #1 on: July 30, 2011, 01:06:53 PM »
What do you need to use it from, PHP?

What are you doing with XML anyway? I would think with your strong opinions about avoiding bloat, you would consider XML to be the devil. :p

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML_
« Reply #2 on: July 30, 2011, 02:18:51 PM »
Yes, PHP. As a pure data storage of text (help, game manual, FAQ). I want something simple and easy to edit, because it will be handed to translators and they will change the english text to their language (this it in addition to standard gettext, it will be used only for larger blocks of texts).

(this does not mean I don't consider XML devil, merely a lesser evil)
« Last Edit: July 30, 2011, 02:20:28 PM by Chris »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML_
« Reply #3 on: August 18, 2011, 05:17:05 AM »
Bump

Anyone? No one used XML from PHP in the past?

Offline lolninja

  • Level 19
  • *
  • Posts: 194
  • Reputation: +5/-0
  • BSc powered Programmer
    • View Profile
    • HTTPmmo
Re: XML_
« Reply #4 on: August 18, 2011, 05:25:14 AM »
Ideally you wouldn't use XML, as XML was designed to transfer data, not store it. If your just doing translations, why not use something like Markdown, its far easier for none techie people to work with, as they don't have to worry about the markup, and it was designed for formatting text.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML_
« Reply #5 on: August 18, 2011, 05:49:14 AM »
Ideally you wouldn't use XML, as XML was designed to transfer data, not store it. If your just doing translations, why not use something like Markdown, its far easier for none techie people to work with, as they don't have to worry about the markup, and it was designed for formatting text.
XML - 1,410,000,000 results
Markdown - 13,000,000 results

There is no way I'm going to use something that niche (there is 2 digits difference). It's incomparably easier to find people who know XML than this "Markdown".

Anyway, I want to try XML no matter what :)
So, which to choose? (xml, libxml, xmlreader, simplexml)

Offline hiigara

  • Level 12
  • *
  • Posts: 85
  • Reputation: +0/-0
    • View Profile
Re: XML_
« Reply #6 on: August 18, 2011, 06:09:31 AM »
XML is not that easy to edit by hand. Special characters need to be escaped and it's easy to forget to close nested tags.
A manual text can be very complex, and in the end you will end up using an XML editor.
I tend to use HEREDOC for those tasks. There is nothing simpler than just including a PHP file.
To structure the text in chapters and sub-chapters, I use nested PHP arrays. They work just like trees.
« Last Edit: August 18, 2011, 06:31:13 AM by hiigara »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: XML_
« Reply #7 on: August 18, 2011, 08:27:16 AM »
I can not allow translators to upload PHP files on the server :) I need XML method that is fully hack safe (I think "simplexml" uses PHP arrays?).

No problem, I can use XML editor :) Any free and simple one you can recommend?

Offline Harkins

  • Level 28
  • **
  • Posts: 424
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: XML_
« Reply #8 on: August 18, 2011, 09:00:42 AM »
XML is awful. If you're not integrating with XML received from some other source and you're just trying to serialize data, YAML is a big, big improvement.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline Anonymous

  • Level 2
  • *
  • Posts: 3
  • Reputation: +0/-0
    • View Profile
Re: XML_
« Reply #9 on: August 18, 2011, 10:41:19 AM »
If it is purely for translation, then the solution would seem a lot simpler; however as you've stated a preference for using XML; sure SimpleXML is easy enough to get to grips with. XML Parser I found to be again a simple enough solution - though I've not run any performance tests so there's no way I can give a definitive "a is better than b" statement.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal