By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,156 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,156 IT Pros & Developers. It's quick & easy.

problems with adding the targetnamespace with the xmlns component in my xsd file

P: n/a

I am trying to add the targetNamespace with the xmlns to my xml schema
file, but I am getting the following

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema attributeFormDefault="unqualified"
targetNamespace="" version="1.0"

The correct schema root is

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema attributeFormDefault="unqualified"
xmlns="" version="1.0"

Here is my code sofar.

public void CreateSchemaRoot(string strNameSpace, bool
bElemFormDefault, bool bAttrForm, string strTargetNamespace)

if (strTargetNamespace.Length > 0)
schema.TargetNamespace = strTargetNamespace;
XmlSerializerNamespaces efilens = new XmlSerializerNamespaces();
efilens.Add("", strTargetNamespace);
schema.Namespaces= efilens;
The error is in this line. It will get overwritten by the last line in
the function. How do I add the targetNamespace xmlns next to the

if (bElemFormDefault)
schema.ElementFormDefault = XmlSchemaForm.Qualified;
schema.ElementFormDefault = XmlSchemaForm.Unqualified;
if (bAttrForm)
schema.AttributeFormDefault = XmlSchemaForm.Qualified;
schema.AttributeFormDefault = XmlSchemaForm.Unqualified;

schema.Version = "1.0";
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add(strNameSpace, schemaNS);
schema.Namespaces = ns;

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.