add translated file

This commit is contained in:
Serban Constantin 2015-09-30 20:53:45 +03:00
parent 1b799a7299
commit 66f7710f6f

View File

@ -8,122 +8,126 @@ translators:
lang: ro-ro
---
XML is a markup language designed to store and transport data.
XML este un limbaj de markup ce are ca scop stocarea si transportul de date.
Unlike HTML, XML does not specify how to display or to format data, just carry it.
Spre deosebire de HTML, XML nu specifica cum sa fie afisata sau formatata
informatia, ci doar o transporta.
* XML Syntax
* Sintaxa XML
```xml
<!-- Comments in XML are like this -->
<!-- Comentariile in XML arata asa -->
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
<librarie>
<carte categorie="GATIT">
<titlu limba="ro">Mancaruri italiene</titlu>
<autor>Giada De Laurentiis</autor>
<an>2005</an>
<pret>30.00</pret>
</carte>
<carte categorie="COPII">
<titlu limba="ro">Harry Potter</titlu>
<autor>J K. Rowling</autor>
<an>2005</an>
<pret>29.99</pret>
</carte>
<carte categorie="WEB">
<titlu limba="ro">Invata XML</titlu>
<autor>Erik T. Ray</autor>
<an>2003</an>
<pret>39.95</pret>
</carte>
</librarie>
<!-- Above is a typical XML file.
It starts with a declaration, informing some metadata (optional).
<!-- Deasupra este un fisier XML obisnuit.
Incepe cu o declaratie ce adauga niste metadata (optional).
XML uses a tree structure. Above, the root node is 'bookstore', which has
three child nodes, all 'books'. Those nodes has more child nodes, and so on...
Nodes are created using open/close tags, and childs are just nodes between
the open and close tags.-->
XML foloseste o structura arborescenta. Deasupra, nodul de baza este
'librarie', care are trei noduri copil, toate 'carti'. Acele noduri au la
randul lor noduri copii si asa mai departe...
Nodurile sunt create folosind taguri deschise/inchise, iar copii sunt doar
noduri intre tagurile de deschis si inchis.-->
<!-- XML carries two kind of data:
1 - Attributes -> That's metadata about a node.
Usually, the XML parser uses this information to store the data properly.
It is characterized by appearing in parenthesis within the opening tag
2 - Elements -> That's pure data.
That's what the parser will retrieve from the XML file.
Elements appear between the open and close tags, without parenthesis. -->
<!-- XML transporta doua tipuri de date:
1 - Atribute -> Metadata despre un nod.
In general, parserul XML foloseste aceasta informatie sa stocheze
proprietatile datelor.
Este caracterizat de aparitia in paranteze in cadrul tagului deschis
2 - Elemente -> Date pure.
Asta este ceea ce parserul va extrage din documentul XML.
Elementele apar intre tagurile deschis si inchis, fara paranteze. -->
<!-- Below, an element with two attributes -->
<!-- Dedesubt, un element cu doua atribute -->
<file type="gif" id="4293">computer.gif</file>
```
* Well-Formated Document x Validation
* Document bine formatat x Validare
A XML document is well-formated if it is syntactically correct.
However, it is possible to inject more constraints in the document,
using document definitions, such as DTD and XML Schema.
Un document XML este bine formatat daca este corect sintactic.
Cu toate astea este posibil sa injectam mai multe constrangeri in document
folosind definitii precum DTD si XML Schema.
A XML document which follows a document definition is called valid,
regarding that document.
Un document XML ce foloseste o definitie de document este numit valid in
contextul documentului.
With this tool, you can check the XML data outside the application logic.
Cu acest tool poti verifica datele XML in afara codului aplicatiei.
```xml
<!-- Below, you can see an simplified version of bookstore document,
with the addition of DTD definition.-->
<!-- Dedesubt este o versiune simplificata a documentului librarie,
cu aditia definitiei DTD.-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note SYSTEM "Bookstore.dtd">
<bookstore>
<book category="COOKING">
<title >Everyday Italian</title>
<price>30.00</price>
</book>
</bookstore>
<!DOCTYPE note SYSTEM "Librarie.dtd">
<librarie>
<carte categorie="GATIT">
<titlu >Everyday Italian</titlu>
<pret>30.00</pret>
</carte>
</librarie>
<!-- This DTD could be something like:-->
<!-- DTD-ul poate fi ceva similar cu:-->
<!DOCTYPE note
[
<!ELEMENT bookstore (book+)>
<!ELEMENT book (title,price)>
<!ATTLIST book category CDATA "Literature">
<!ELEMENT title (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT librarie (carte+)>
<!ELEMENT carte (titlu,pret)>
<!ATTLIST carte categorie CDATA "Literatura">
<!ELEMENT titlu (#PCDATA)>
<!ELEMENT pret (#PCDATA)>
]>
<!-- The DTD starts with a declaration.
Following, the root node is declared, requiring 1 or more child nodes 'book'.
Each 'book' should contain exactly one 'title' and 'price' and an attribute
called 'category', with "Literature" as its default value.
The 'title' and 'price' nodes contain a parsed character data.-->
<!-- DTD-ul incepe cu o declaratie.
Dupa, nodul de baza este declarat, cerand unul sau mai multe noduri copii
de tipul 'carte'.
Fiecare 'carte' trebuie sa contina exact un 'titlu' si 'pret' si un atribut
numit 'categorie', cu "Literatura" ca valoare implicita.
Nodurile 'titlu' si 'pret' contin parsed character data.-->
<!-- The DTD could be declared inside the XML file itself.-->
<!-- DTD-ul poate fi declara si in interiorul fisierului XML.-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note
[
<!ELEMENT bookstore (book+)>
<!ELEMENT book (title,price)>
<!ATTLIST book category CDATA "Literature">
<!ELEMENT title (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT librarie (carte+)>
<!ELEMENT carte (titlu,pret)>
<!ATTLIST carte categorie CDATA "Literatura">
<!ELEMENT titlu (#PCDATA)>
<!ELEMENT pret (#PCDATA)>
]>
<bookstore>
<book category="COOKING">
<title >Everyday Italian</title>
<price>30.00</price>
</book>
</bookstore>
<librarie>
<carte categorie="GATIT">
<titlu >Everyday Italian</titlu>
<pret>30.00</pret>
</carte>
</librarie>
```