What are XML namespaces for?

They’re for allowing multiple markup languages to be combined, without having to worry about conflicts of element and attribute names. For example, look at any bit of XSLT code, and then think what would happen if you didn’t use namespaces and were trying to write an XSLT where the output has to contain “template”, “for-each”, … Read more

targetNamespace and xmlns without prefix, what is the difference?

targetNamespace is an XML Schema “artifact”; its purpose: to indicate what particular XML namespace the schema file describes. xmlns – because the XML Schema is an XML document, it is then possible to define a default XML namespace for the XML file itself (this is what xmlns attribute does); the implications are multiple: authoring, and … Read more

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

Namespace related attributes in XML and XML Schema (XSD) xmlns is part of the W3C Namespaces in XML Recommendation: The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. In your example, it declares that http://maven.apache.org/POM/4.0.0 is the default namespace for the elements in your … Read more

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

@skyl practically provoked me to write this answer so please mind the redundancy. NCName stands for “non-colonized name”. NCName can be defined as an XML Schema regular expression [\i-[:]][\c-[:]]* …and what does that regex mean? \i and \c are multi-character escapes defined in XML Schema definition. http://www.w3.org/TR/xmlschema-2/#dt-ccesN \i is the escape for the set of … Read more

What does elementFormDefault do in XSD?

ElementFormDefault has nothing to do with namespace of the types in the schema, it’s about the namespaces of the elements in XML documents which comply with the schema. Here’s the relevent section of the spec: Element Declaration Schema Component Property {target namespace} Representation If form is present and its ·actual value· is qualified, or if … Read more