Any of those help The Java XML parser that spring uses will read the schemaLocation values and try to load them from the internet, in order to validate the XML file. Spring, in turn, intercepts those load requests and serves up versions from inside its own JAR files. If you omit the schemaLocation, then the XML parser won't know where to get the schema in order to validate the config.
help you fix your problem You ask "Why do I need to use xsi:schemaLocation ...?" Do you? Whether you need to use xsi:schemaLocation or not depends on the validators and other schema-aware processors you are using: xsi:schemaLocation is one way, but not the only way, to bind namespaces to particular schemas.
hop of those help? XSD location hints, schemaLocation and noNamespaceSchemaLocation, are rarely used in production environments (I've never seen it), indeed. I personally see it as a convenience method for tooling used during development phases. It is considered an interoperable way to indicate what XSDs should be used for validation, IntelliSense, etc.
Hope this helps You need to use xmlns XNamespace for all elements, because that is default namespace and it is declared at root level element. Note that descendant elements inherit ancestor default namespace implicitly, unless otherwise specified :
XDocument xmlDocument = new XDocument(
new XElement(xmlns + "MyNode",
new XAttribute(xsi + "schemaLocation", schemaLocation),
new XAttribute(XNamespace.Xmlns + "xsi", xsi),
new XElement(xmlns+"MyNumber", "string1"),
new XElement(xmlns+"MyName", "string2"),
new XElement(xmlns+"MyAddress", "string3")
new XElement(xmlns+"FirstName", "string4")