generating xsd import attribute using C# gives schema location by default

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt H<span style="line-height:120%; color:black; font-size:10.5pt i,
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt I am trying to add a xsd:import element to a schema and i do not specify the schema location. when i see the output the schema location is generated
by default.<span style="line-height:120%; color:black; font-size:10.5pt
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt Find my code below :
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:blue; font-size:10.5pt if<span style="line-height:120%; color:black; font-size:10.5pt (schema.TargetNamespace.Equals(<span style="line-height:120%; color:#a31515; font-size:10.5pt "http://rajesh.com/"<span style="line-height:120%; color:black; font-size:10.5pt ))
<span style="line-height:120%; color:blue; font-size:10.5pt
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt {
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:#2b91af; font-size:10.5pt <span>
<span style="line-height:120%; color:#2b91af; font-size:10.5pt XmlSchemaImport<span style="line-height:120%; color:black; font-size:10.5pt x =
<span style="line-height:120%; color:blue; font-size:10.5pt new<span style="line-height:120%; color:#2b91af; font-size:10.5pt XmlSchemaImport<span style="line-height:120%; color:black; font-size:10.5pt ();
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt <span>
<span style="line-height:120%; color:black; font-size:10.5pt x.Namespace =<span style="line-height:120%; color:#a31515; font-size:10.5pt "http://schemas.microsoft.com/2003/10/Serialization/"<span style="line-height:120%; color:black; font-size:10.5pt ;
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt <span>
<span style="line-height:120%; color:black; font-size:10.5pt x.SchemaLocation =<span style="line-height:120%; color:#2b91af; font-size:10.5pt
<span style="line-height:120%; color:#2b91af; font-size:10.5pt String<span style="line-height:120%; color:black; font-size:10.5pt .Empty;

<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt <span>
<span style="line-height:120%; color:black; font-size:10.5pt schema.Includes.Add(x);

<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt }
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt I just want to add the namespace attribute and nothing else to the element. The reason i dont want to specify the schema location is i do have the schema
in the same file and its just more to do with importing the namespace in of the other schema in the same file.<span style="line-height:120%; color:black; font-size:10.5pt
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt Regards
<p style="line-height:120%; margin-bottom:0pt <span style="line-height:120%; color:black; font-size:10.5pt Rajesh



View the full article
 
Back
Top