4

I am an experienced programmer, but have very little experience of parsing/validating XML documents. I am trying to learn it. Can someone please tell me what the difference is between an "XML schema" and an "XML namespace"?

According to my limited knowledge, I guess both of them define the tags that an XML document can have and define the data type/validation rules for them. But I am confused whether or not both of them do the same things? And if not, what is the difference?

Bart
  • 19,692
  • 7
  • 68
  • 77
user2755525
  • 219
  • 2
  • 3
  • 14
  • Some of the material I posted in this answer may help: http://stackoverflow.com/questions/4908861/any-xml-xsd-tutorials-for-the-novice/4908929#4908929 – Kris C Sep 06 '13 at 19:42
  • 2
    This question appears to be off-topic because it is not a programming question in accordance with the guidelines in the [help]. It's also information that is readily available via a simple Google or Bing search. – Ken White Sep 06 '13 at 22:20

2 Answers2

2

what is the difference between an "XML schema" and an "XML namespace".

XML namespaces are used for providing uniquely named elements and attributes in an XML document.

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

Do check out this and this

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • Ok, can you also tell what is the relationship between them? for example can one namespace contain many schemas, or can one schema contain many namespaces?, how we define the relationships? and, can an element in an XML instance document inherit from both a schema and a namespace? or from only one of them? Thanks in advance. – user2755525 Oct 24 '13 at 14:44
2

No, a schema describes the structure of the XML: tag names, parent/child relationships, cardinality, types, restrictions, etc.

Namespaces are more like packages in Java: They give you a way to distinguish your tags from others.

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

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • can someone please tell me how can i reply to a post. I have been trying to find a "Reply" link or button to the above posts, but I didn't find it yet. This is why I am using "add comment" link to reply to other users! its strange! why there is no "Reply" link? or if it there, why it is easily visible? – user2755525 Oct 24 '13 at 14:53
  • Correction: why it is NOT easily visible? – user2755525 Oct 24 '13 at 14:54