2
votes

I have a problem to understand the part where the schemaLocation is addressed. "http://www.w3schools.com" is my default namespace and http://www.w3.org/2001/XMLSchema-instance is the namespace I can access via the prefix xsi.

But why do I have to use the prefix xsi to address the w3schools Namespace? Is it possible to add/use a third Schema? If so, how would I address that?

<note xmlns="http://www.w3schools.com" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3schools.com note.xsd">

Best regards, Phil

1

1 Answers

1
votes

With xsi:schemaLocation, you are giving a validating XML processor a hint where to find the schema definition for a particular namespace so that it can validate elements/attributes from that namespace. You don't have to provide this hint to have well-formed XML, but if you want a validating parser to validate your document, it will have to have some way of locating the relevant schema document.