Reputation: 208
When I generate my C# code I get a namespace with 'AA' when noNamespaceSchemaLocation is defined?
The docs talk about adding a NamespaceAlias to the Default context here: http://www.liquid-technologies.com/Reference/XmlDataBinding/source/HowTo/ChangeNamespaceAliases.htm
But there is no mention of noNamespaceSchemaLocation?
Upvotes: 0
Views: 145
Reputation: 6003
I assume you are trying to create XML that looks a bit like this
<RootElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.foo.com/schemaDirectory/bar.xsd" ...>
But your getting something that looks like this
<RootElement xmlns:AA="http://www.w3.org/2001/XMLSchema-instance" AA:noNamespaceSchemaLocation="http://www.foo.com/schemaDirectory/bar.xsd" ...>
In order to get the namespace alias 'xsi' instead of 'AA' (or similar) you need to define the namespace 'http://www.w3.org/2001/XMLSchema-instance', this can be done like this:-
LiquidTechnologies.Runtime.Net40.XmlSerializationContext.Default.NamespaceAliases.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
Upvotes: 1