Questions tagged [xml-namespaces]

According to the standard, "XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI references."

According to the standard,

XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI references.

Please note that, although many XML namespaces take the form of a URL, they do not necessarily refer to a location on the Internet.

See also: What are XML Namespaces for?

2420 questions
494
votes
6 answers

What does "xmlns" in XML mean?

I saw the following line in an XML file: xmlns:android="http://schemas.android.com/apk/res/android" I have also seen xmlns in many other XML files that I've come across. What is it?
user88637
  • 11,790
  • 9
  • 37
  • 36
195
votes
7 answers

Parsing XML with namespace in Python via 'ElementTree'

I have the following XML which I want to parse using Python's ElementTree:
Sudar
  • 18,954
  • 30
  • 85
  • 131
181
votes
13 answers

Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?

Why is this line needed in xml layout file? xmlns:android="http://schemas.android.com/apk/res/android"
Hitesh Dhamshaniya
  • 2,886
  • 3
  • 24
  • 31
177
votes
2 answers

What is the 'app' Android XML namespace?

Here is an example of the app namespace that I've seen from a res/menu/main.xml file
137
votes
5 answers

how to ignore namespaces with XPath

My goal is to extract certain nodes from multiple XML files with multiple namespaces using XPath. Everything works fine as long as I know the namespace URIs. The namespace name itself remains constant, but the Schemas (XSD) are sometimes…
kostja
  • 60,521
  • 48
  • 179
  • 224
135
votes
5 answers

Open Graph namespace declaration: HTML with XMLNS or head prefix?

I have seen conflicting information on how to best implement Open Graph namespaces. Specifically, the Open Graph website uses a few different methods, and the Facebook Open Graph examples use other methods. Open Graph website example (using HTML…
Matt Beckman
  • 5,022
  • 4
  • 29
  • 42
128
votes
7 answers

How to prevent blank xmlns attributes in output from .NET's XmlDocument?

When generating XML from XmlDocument in .NET, a blank xmlns attribute appears the first time an element without an associated namespace is inserted; how can this be prevented? Example: XmlDocument xml = new…
Neil C. Obremski
  • 18,696
  • 24
  • 83
  • 112
122
votes
6 answers

How to serialize an object to XML without getting xmlns="..."?

Is there a way for me to serialize an object in .NET without the XML Namespaces automatically serializing also? It seems that by default .NET believes the XSI and XSD namespaces should be included, but I don't want them there.
Wes P
  • 9,622
  • 14
  • 41
  • 48
121
votes
5 answers

Xml Namespace breaking my xpath!

I have the following XML: This is a slimmed down version of XML being returned from a SharePoint web service. I also have the following…
Abe Miessler
  • 82,532
  • 99
  • 305
  • 486
109
votes
6 answers

What does elementFormDefault do in XSD?

What does elementFormDefault do, and when should it be used? So I found some definitions for elementFormDefault values: qualified - elements and attributes are in the targetNamespace of the schema unqualified - elements and attributes do not…
Levi
  • 12,214
  • 14
  • 43
  • 47
106
votes
4 answers

What is an xs:NCName type and when should it be used?

I ran one of my xml files through a schema generator and everything generated was what was expected, with the exception of one node: What exactly is xs:NCName? And why would one use it, rather…
user189320
86
votes
2 answers

xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?

For the following XML fragment:
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
83
votes
6 answers

targetNamespace and xmlns without prefix, what is the difference?

In an xml schema document, if I have both the targetNamespace and the xmlns without a prefix. What is the exact…
Abe
  • 8,623
  • 10
  • 50
  • 74
78
votes
10 answers

What are XML namespaces for?

This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML…
Doron Yaacoby
  • 9,412
  • 8
  • 48
  • 59
76
votes
6 answers

Why is XmlNamespaceManager necessary?

I've come up kinda dry as to why -- at least in the .Net Framework -- it is necessary to use an XmlNamespaceManager in order to handle namespaces (or the rather clunky and verbose [local-name()=... XPath predicate/function/whatever) when performing…
Code Jockey
  • 6,611
  • 6
  • 33
  • 45
1
2 3
99 100