Could not find schema information for the element

Discussion in 'ASP .Net' started by Jeff, Mar 4, 2008.

  1. Jeff

    Jeff Guest

    Hi

    asp.net 3.5

    I'm trying to add a custom section to web.config, but get many messages when
    I compile the code:

    I get 5 messages about "could not find schema":
    Could not find schema information for the element 'testgroup'.
    Could not find schema information for the element 'testsystem'.
    Could not find schema information for the attribute
    'defaultConnectionStringName'.
    Could not find schema information for the element 'test'.

    <configuration>
    <configSections>
    <sectionGroup name="testgroup">
    <section name="testsystem" type="AH.Test.TestSection"/>
    </sectionGroup>
    </configSections>

    <testgroup>
    <testsystem defaultConnectionStringName="LocalSqlServer">
    <test providerType="AH.Test.DAL.Sql2005Express.TestProvider" />
    </testsystem>
    </testgroup>

    namespace AH.Test
    {
    public class TestSection : ConfigurationSection
    {
    [ConfigurationProperty("defaultConnectionStringName", DefaultValue =
    "LocalSqlServer")]
    public string DefaultConnectionStringName
    {
    get { return (string)base["defaultConnectionStringName"]; }
    set { base["defaultConnectionStringName"] = value; }
    }


    [ConfigurationProperty("test", IsRequired = true)]
    public TestElement Test
    {
    get { return (TestElement)base["test"]; }
    }
    }

    public class TestElement : ConfigurationElement
    {
    public TestElement() { }

    [ConfigurationProperty("connectionStringName")]
    public string ConnectionStringName
    {
    get { return (string)base["connectionStringName"]; }
    set { base["connectionStringName"] = value; }
    }

    public string ConnectionString
    {
    get
    {
    string connStringName =
    (string.IsNullOrEmpty(this.ConnectionStringName) ?
    Globals.Settings.DefaultConnectionStringName :
    this.ConnectionStringName);
    return
    WebConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
    }
    }
    }
    }

    any suggestion?
     
    Jeff, Mar 4, 2008
    #1
    1. Advertising

  2. All these <testxxx> elements are apparently made by you. And you didn't
    include them in the schema used for validation, did you? Obviously, you
    can't expect VS to validate the xml after this. Just ignore these messages.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "Jeff" <no_email_address> wrote in message
    news:...
    > Hi
    >
    > asp.net 3.5
    >
    > I'm trying to add a custom section to web.config, but get many messages
    > when I compile the code:
    >
    > I get 5 messages about "could not find schema":
    > Could not find schema information for the element 'testgroup'.
    > Could not find schema information for the element 'testsystem'.
    > Could not find schema information for the attribute
    > 'defaultConnectionStringName'.
    > Could not find schema information for the element 'test'.
    >
    > <configuration>
    > <configSections>
    > <sectionGroup name="testgroup">
    > <section name="testsystem" type="AH.Test.TestSection"/>
    > </sectionGroup>
    > </configSections>
    >
    > <testgroup>
    > <testsystem defaultConnectionStringName="LocalSqlServer">
    > <test providerType="AH.Test.DAL.Sql2005Express.TestProvider" />
    > </testsystem>
    > </testgroup>
    >
    > namespace AH.Test
    > {
    > public class TestSection : ConfigurationSection
    > {
    > [ConfigurationProperty("defaultConnectionStringName", DefaultValue
    > = "LocalSqlServer")]
    > public string DefaultConnectionStringName
    > {
    > get { return (string)base["defaultConnectionStringName"]; }
    > set { base["defaultConnectionStringName"] = value; }
    > }
    >
    >
    > [ConfigurationProperty("test", IsRequired = true)]
    > public TestElement Test
    > {
    > get { return (TestElement)base["test"]; }
    > }
    > }
    >
    > public class TestElement : ConfigurationElement
    > {
    > public TestElement() { }
    >
    > [ConfigurationProperty("connectionStringName")]
    > public string ConnectionStringName
    > {
    > get { return (string)base["connectionStringName"]; }
    > set { base["connectionStringName"] = value; }
    > }
    >
    > public string ConnectionString
    > {
    > get
    > {
    > string connStringName =
    > (string.IsNullOrEmpty(this.ConnectionStringName) ?
    > Globals.Settings.DefaultConnectionStringName :
    > this.ConnectionStringName);
    > return
    > WebConfigurationManager.ConnectionStrings[connStringName].ConnectionString;
    > }
    > }
    > }
    > }
    >
    > any suggestion?
    >
     
    Eliyahu Goldin, Mar 5, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John A Grandy
    Replies:
    1
    Views:
    5,650
  2. =?Utf-8?B?RGVyZWs=?=

    Could not find schema information

    =?Utf-8?B?RGVyZWs=?=, Mar 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    4,207
    =?Utf-8?B?RGVyZWs=?=
    Mar 14, 2006
  3. Markus
    Replies:
    1
    Views:
    1,613
    Markus
    Nov 23, 2005
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,296
    Stanimir Stamenkov
    Apr 25, 2005
  5. amir
    Replies:
    1
    Views:
    3,305
Loading...

Share This Page