<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="abc" targetNamespace="http://schemas.businessNameHere.com/SoftwareNameHere"
elementFormDefault="qualified"
xmlns="http://schemas.businessNameHere.com/SoftwareNameHere"
xmlns:mstns="http://schemas.businessNameHere.com/SoftwareNameHere"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="..." type="..." />
<xs:complexType name="...">
I am working on a project using XSD to generate .cs file. My question is concerning the string “http://schemas.businessNameHere.com/SoftwareNameHere” If I change it, it doesn’t work. But the http:// is not a valid one… what is the logic behind and where can I can information about what to put there or how to change it?
XSD namespaces do not have to be valid URI’s. Having a namespace string that is a URL doesn’t mean anything is fetched from the URL, or anything to do with the web at all – it’s simply a string like any other. So although the URL may be invalid from the sense that it doesn’t actually point to anything, it’s still a valid string as a namespace declaration.
You can read up on some of the reasoning behind namespace identifiers being in this format here.
There are several reasons for using URL’s as a namespace identifier, but mainly it is for convenience – it’s a unique identifier that generally has some meaning attached to it for the users, much like the way Java namespaces classically begin with “com”, “org” or “net”.
For the nitty gritty of why namespaces are in URI (technically, IRI) format, you can read the W3C’s standards for XML namespaces. The specify that XML Namespaces are in IRI (International Resource Identifier) format, defined in RFC3986.
For more information on how to properly use namespaces, there are lots of great walkthroughs, like this one. What isn’t working when you change the namespace?