What is the difference between an "XML Schema" and an "XML Namespace"?

I am an experienced programmer, but I have very little experience parsing / validating XML documents. I'm trying to learn this. Can someone please tell me what is the difference between an "XML Schema" and an "XML Namespace"?

According to my limited knowledge, I think that both of them define tags that an XML document can have, and they define data type / validation rules for them. But I'm confused, are they both doing the same thing? And if not, what's the difference?

+4
source share
2 answers

what is the difference between an "XML Schema" and an "XML Namespace".

XML namespaces are used to provide uniquely named elements and attributes in an XML document.

XML Schema is an alternative to XML-based DTD. It describes the structure of an XML document.

Do this and this

+2
source

No, the schema describes the structure of XML names: tags, relationships between parents and children, power, types, constraints, etc.

Namespaces are more like Java packages: they give you the ability to distinguish your tags from others.

You can combine XML streams together. If you and someone have a <name> , you can have a foo namespace, someone can have a bar namespace, and you can tell the difference with <foo:name> and <bar:name> .

+2
source

Source: https://habr.com/ru/post/1500994/


All Articles