Questions tagged [xml]

XML (Extensible Markup Language) is a structured document format defining text encoding rules. When using this tag include additional tags such as programming language, tool sets, XML technologies being used, and other tags describing the environment of the problem posted. XML flexibility lends to a wide variety of uses for human and machine data transfer so be specific as to tools and libraries.

Extensible Markup Language

Wikipedia defines XML as follows:

XML (Extensible Markup Language) is a set of rules for encoding documents in both human-readable and machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards.

Extensible - XML is extensible. It lets you define your own tags.

Markup - The most attractive feature of XML has to be its ability to allow its user to create their own tags. The tags that can be created will be similar to tags in HTML. But with XML you are afforded the opportunity to define your own tags.

Language - XML is a language that is very similar to HTML. But it’s much more flexible because it allows creating custom tags. In this way XML acts like a meta-language: a language that allows us to create or define other languages. For example, with XML we can create other languages, such as RSS.

In short, XML:

  • is designed to transport and store data
  • is a flexible and simpler text format derived from SGML (ISO 8879)
  • is a markup language much like HTML
  • was designed to be self-descriptive
  • stands for eXtensible Markup Language
  • is a W3C Recommendation
  • does not DO anything
  • is just information wrapped in tags

The design goals of XML emphasize simplicity, generality, and usability over the Internet. It is a textual data format with strong support via Unicode for the languages of the world. Although the design of XML focuses on documents, it is widely used for the representation of arbitrary data structures – for example in web services, configuration/settings, and GUI, workflow, and task definition.

XML is also used in some protocols for distributed computing and web services such as SOAP and HTML-RPC and REST (see also SOAP vs REST (differences) )

Many application programming interfaces (APIs) have been developed to aid software developers with processing XML data, and several schema languages exist to aid in the definition of XML-based languages. Schemas are usually defined with an external namespace, but XML also allows you to define tags within the document itself.

XML was introduced in 1996 as version 1.0 and has reached version 1.1 in 2004 which has some unique features but isn't very widely spread.


As already stated, the structure of XML is very similar to the structure of HTML. That is, an XML document is a tree structure with the nodes being called tags (similar to HTML elements), and if tag T2 is descendant of tag T1, then T2 is inside T1.

XML Technologies

  • XQuery (the XML Query language) is a language for querying XML documents much like querying relational databases.
  • XPath (the XML Path language) is a language for finding information in an XML document; it is a subset of XQuery.
  • XSLT (eXtensible Stylesheet Language Transformations) is used to transform XML documents.
  • XLink (the XML Linking language) defines methods for creating links within XML documents.
  • XPointer (the XML Pointer language) allows hyperlinks to point to specific parts (fragments) of XML documents.

XML versions

There are currently two versions of XML in use.

XML 1.0 is the original version of XML.

XML 1.1 is currently the newest version. Notable changes from XML 1.0 include:

  • XML 1.0 is forward compatible with the Unicode standard.

  • More freedom with using line breaks.

  • Support for additional control characters.

Example Document

The following text is defined using XHTML and entity references; the text serves as an example of XML syntax and structure:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "" [
  <!ENTITY hello "Hello, World!">
<html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


The following links provide additional information to learn about XML:

Related Tags

213775 questions
31 answers

How do you parse and process HTML/XML in PHP?

How can one parse HTML/XML and extract information from it?
  • 56,863
  • 21
  • 114
  • 161
13 answers

What does in XML mean?

I often find this strange CDATA tag in XML files: I have observed that this CDATA tag always comes at the beginning, and then followed by some stuff. But sometimes it is used, sometimes it is not. I assume it is to mark that…
  • 45,440
  • 50
  • 177
  • 260
20 answers

How to parse XML and get instances of a particular node attribute?

I have many rows in XML and I'm trying to get instances of a particular node attribute. How do I access the values of the attribute foobar? In this example, I want…
  • 47,058
  • 76
  • 251
  • 433
10 answers

What characters do I need to escape in XML documents?

What characters must be escaped in XML documents, or where could I find such a list?
Julius A
  • 38,062
  • 26
  • 74
  • 96
12 answers

What's "tools:context" in Android layout files?

Starting with a recent new version of ADT, I've noticed this new attribute on the layout XML files, for example:
android developer
  • 114,585
  • 152
  • 739
  • 1,270
2 answers

Text editor to open big (giant, huge, large) text files

I mean 100+ MB big; such text files can push the envelope of editors. I need to look through a large XML file, but cannot if the editor is buggy. Any suggestions?
  • 4,447
  • 8
  • 35
  • 42
9 answers

How do I comment out a block of tags in XML?

How do I comment out a block of tags in XML? I.e. How can I comment out and everything inside it, in the code below?
  • 121,568
  • 97
  • 310
  • 388
9 answers

How To Auto-Format / Indent XML/HTML in Notepad++

Is there a way to re-indent a block of code? I'm looking for something similar to Ctrl+Shift+F in Eclipse (Auto-Format/Indent). To be clear, I already know how to format XML outside of Notepad++ (Eclipse works fine, as mentioned) so I don't need a…
  • 8,845
  • 7
  • 28
  • 44
18 answers

How do I align views at the bottom of the screen?

Here's my layout code;
  • 29,022
  • 23
  • 65
  • 90
12 answers

How to pretty print XML from the command line?

Related: How can I pretty-print JSON in (unix) shell script? Is there a (unix) shell script to format XML in human-readable form? Basically, I want it to transform the following: lorem ... into…
  • 13,744
  • 4
  • 33
  • 58
14 answers

How can I save application settings in a Windows Forms application?

What I want to achieve is very simple: I have a Windows Forms (.NET 3.5) application that uses a path for reading information. This path can be modified by the user, by using the options form I provide. Now, I want to save the path value to a file…
  • 8,776
  • 9
  • 29
  • 31
10 answers

java.util.Date to XMLGregorianCalendar

Isn't there a convenient way of getting from a java.util.Date to a XMLGregorianCalendar?
  • 9,885
  • 4
  • 36
  • 51
21 answers

How to make layout with rounded corners..?

How can I make a layout with rounded corners? I want to apply rounded corners to my LinearLayout.
  • 6,363
  • 3
  • 14
  • 13
20 answers

Can the Android layout folder contain subfolders?

Right now, I'm storing every XML layout file inside the 'res/layout' folder, so it is feasible and simple to manage small projects, but when there is a case of large and heavy projects, then there should be a hierarchy and sub-folders needed inside…
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
10 answers

How do I escape ampersands in XML so they are rendered as entities in HTML?

I have some XML text that I wish to render in an HTML page. This text contains an ampersand, which I want to render in its entity representation: &. How do I escape this ampersand in the source XML? I tried &, but this is decoded as the…
  • 32,054
  • 48
  • 155
  • 243
2 3
99 100