Why use XML as a storage format?

Possible duplicate:
When can I use an XML file to save information?

What is all using XML as the storage format for such configuration files? I ask because the [name retraced] structure has an XML configuration file for storing database credentials, and a particular application built on the basis of the framework has some menus that are stored as an XML fragment in the database ... it is not as if we were sharing database credentials or a menu structure with others, or even data that would be consumed by several services. All this is internally / specific to this application. An employee said that XML is an easy-to-read format for people ... but I don't think it's true. password foobar123 in the INI file is easier for a person to read than <password> foobar123 </password>. Then he talked about parsing, but INI files have been around for ages, so I'm surethat there is a library or two for parsing them. I saw the logic of using it as a method of exporting data, because then everything that the application does can be used by other services in a simple way, but for internal things, I just do not understand. Someone please enlighten me.

+3
source share
8 answers

The reasons for how they should be:

  • compatibility (almost everything XML can say, but in a closed system this is debatable, right up to that day, another application should be able to read it)
  • validation (XSD, etc.)
  • hierarchical

Actual reason:

  • The manager likes the buzz word and requires it to work with XML.
  • There were so many happy people who claimed that “it works with XML” that actual developers thought it was good.

Again, formats such as JSON, YAML, csv or standard .ini have their place.

+2
source

I will not solve my general question (I'm not a big fan of XML myself), but I will comment on your comparison of INI and XML files.

XML ( ..). INI ( , ). , , XML , .

+5

, , " " . , XML (, ..) XML HTML, , XML .

+3

, XML , .

, XML- , TreeView , " " / .

XML , XML , , , API .., .

, XML XSLT, , -, RSS, ..

XML, , , , , / XML .

+2

, , , "" . , java XML - . javascript JSON - // .

PHP .

, PHP, var_export, require, . , - , . , . , ( ) XML, YAML, JSON, .

config.php

<?
return array( "db_name" => ..., "db_user" => ... );
?>

config.php

<?
$db_configure = require( "config.php" );
//do stuff with $db_configure
?>
0

- . .ini eclipse.

-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx256m

, . , - :

<showsplash>org.eclipse.platform</showsplash>
<launcher-param>
    <param-name>XXMaxPermSize</param-name>
    <param-value>256m</param-value>
</launcher-param>
<vmargs>
    <arg>-Xms40m</arg>
    <arg>-Xmx256m</arg>
</vmargs>

, , , ini. -, , org.eclipse.platform showplash.

, XML .

0

XML, - du-jour. , XML.

, , -.

0

, .
XML , - .
, - .
.

XML - - /. , PHP ini.style(param = value), : . XML. , , XML - . PHP: , , - .

0

Source: https://habr.com/ru/post/1755408/


All Articles