JSON
JSON
About XML 2
XML
XML (ang:eXtensible Markup Language). Just like HTML, XML uses tags ( '<' and '>'),
and attributes (name="value").
Extensible means that it can be customized
to your needs XML document is a text le.
XML was designed to transport the data (not XML Independent of programming language.
the format)
XML is a markup language much like HTML.
3
In XML tags are not prede ned, you can
de ne them yourself.
Tags
<title lang="en">Visuality</title>
Visuality - Content
<to>Students</to>
<body>Hello.</body>
</note>
</notes>
XML Structure
Rules:
An element name can contain any alphanumeric characters. The only punctuation marks allowed
in names are the hyphen (-), under-score (_) and period (.). Names must begin with a letter
character.
An element, which is a container, can contain text or elements as seen in the above example.
Names are case sensitive. For example, Address, address, and ADDRESS are di erent names.
7
Opening and closing tags of an element must be identical.
XML document validation
The easiest way to check the syntax is to open In case of an error, we will be informed about it:
the xml le in a browser (e.g. Firefox).
8
XML Documents Usage
XML Usage
• XML can be used to exchange the information between organizations and systems.
• Maven uses XML in con g les (settings.xml; pro les.xml; pom.xml).
• XML can be used to store and arrange the data, which can customize your data handling needs.
• XML can easily be merged with style sheets to create almost any desired output.
9
Task
Using any notebook (Notepad, Notepad ++, Sublime Text, etc.) prepare an XML document that will
describe your home library. The bookcase should contain 4 books. Each book should contain the
author (tag: author), title (tag: title) and publication date (tag: year): For example:
• "Refactoring" Martin Fowler, 2016
•
10
"The Phoenix Project" Gene Kim, 2018
• "The Clean Code" Robert C.Martin, 2017
• "Never Split the Di erence", Chris Voss, 2015
13
XML / JSON
<to>Students</to> "from":"Mentor",
<body>Hello.</body> "to":"Students",
</note> "body":"Hello.",
</notes> },
]
}
}
THE END 15
Go to the next presentation