Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7934965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:46:46+00:00 2026-06-03T21:46:46+00:00

Here is my xml structure: <reco> <styleSheets> <group> <asset source=~/Script/file1.css/> <asset source=~/Script/file2.css/> <asset source=~/Script/file3.css/>

  • 0

Here is my xml structure:

<reco>
    <styleSheets>
      <group>
        <asset source="~/Script/file1.css"/>
        <asset source="~/Script/file2.css"/>
        <asset source="~/Script/file3.css"/>
    </group>
  </styleSheets>
  <scripts>
    <group>
        <asset source="~/Content/file1.js"/>
        <asset source="~/Content/file1.js"/>
        <asset source="~/Content/file1.js"/>
    </group>
  </scripts>

Here is my code:

public class AssetConfigurationElement : ConfigurationElement
{

    /// <summary>
    /// Gets or sets the source.
    /// </summary>
    /// <value>The source.</value>
    [ConfigurationProperty("source", IsRequired = true, IsKey = true)]
    public string Source
    {
        get
        {
            return (string)this["source"];
        }

        set
        {
            this["source"] = value;
        }
    }
}

public class GroupConfigurationElementCollection : ConfigurationElementCollection
{
    public GroupConfigurationElementCollection()
    {
        AddElementName = "asset";
    }

    /// <summary>
    /// Gets or sets the name.
    /// </summary>
    /// <value>The name.</value>
    [ConfigurationProperty("name", IsRequired = true, IsKey = true, IsDefaultCollection = true)]
    public string Name
    {
        get
        {
            return (string)this["name"];
        }

        set
        {
            this["name"] = value;
        }
    }

    /// <summary>
    /// Gets or sets a value indicating whether this <see cref="WebAssetGroupConfigurationElement"/> is enabled.
    /// </summary>
    /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
    [ConfigurationProperty("enabled", DefaultValue = true)]
    public bool Enabled
    {
        get
        {
            return (bool)this["enabled"];
        }

        set
        {
            this["enabled"] = value;
        }
    }

    /// <summary>
    /// Gets or sets the version.
    /// </summary>
    /// <value>The version.</value>
    [ConfigurationProperty("version")]
    public string Version
    {
        get
        {
            return (string)this["version"];
        }

        set
        {
            this["version"] = value;
        }
    }

    /// <summary>
    /// Gets or sets a value indicating whether this <see cref="WebAssetGroupConfigurationElement"/> is compress.
    /// </summary>
    /// <value><c>true</c> if compress; otherwise, <c>false</c>.</value>
    [ConfigurationProperty("compress", DefaultValue = true)]
    public bool Compress
    {
        get
        {
            return (bool)this["compress"];
        }

        set
        {
            this["compress"] = value;
        }
    }

    /// <summary>
    /// Gets or sets a value indicating whether this <see cref="WebAssetGroupConfigurationElement"/> is combined.
    /// </summary>
    /// <value><c>true</c> if combined; otherwise, <c>false</c>.</value>
    [ConfigurationProperty("combined", DefaultValue = true)]
    public bool Combined
    {
        get
        {
            return (bool)this["combined"];
        }

        set
        {
            this["combined"] = value;
        }
    }


    protected override ConfigurationElement CreateNewElement()
    {
        return new AssetConfigurationElement();
    }

    protected override object GetElementKey(ConfigurationElement element)
    {
        return ((AssetConfigurationElement)element).Source;
    }

}

public class SharedGroupConfigurationSection : ConfigurationSection
{

    /// <summary>
    /// Gets the style sheets.
    /// </summary>
    /// <value>The style sheets.</value>
    [ConfigurationProperty("styleSheets")]
    [ConfigurationCollection(typeof(GroupConfigurationElementCollection), AddItemName = "group")]
    public GroupConfigurationElementCollection StyleSheets
    {
        get
        {
            return (GroupConfigurationElementCollection)base["styleSheets"] ?? new GroupConfigurationElementCollection();
        }
    }

    /// <summary>
    /// Gets the style sheets.
    /// </summary>
    /// <value>The style sheets.</value>
    [ConfigurationProperty("scripts")]
    [ConfigurationCollection(typeof(GroupConfigurationElementCollection), AddItemName = "group")]
    public GroupConfigurationElementCollection Scripts
    {
        get
        {
            return (GroupConfigurationElementCollection)base["scripts"] ?? new GroupConfigurationElementCollection();
        }
    }
}

Is this configuration even possible? If so, what am i doing wrong?

I get this error message when i try to get the section with the configuration manager.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized element ‘asset’.

Source Error:

Line 96:
Line 97:
Line 98:
Line 99:
Line 100:

Source File: D:\ASP.NET Projects\Resource-Compiler\ResourceCompiler\Examples\web.config Line: 98

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:46:47+00:00Added an answer on June 3, 2026 at 9:46 pm

    I was able to get it working. I had to add two new collections for the styleSheet node and the script node. Here is my complete code:

        public class SharedGroupConfigurationSection : ConfigurationSection
    {
    
        /// <summary>
        /// Gets the style sheets.
        /// </summary>
        /// <value>The style sheets.</value>
        [ConfigurationProperty("styleSheets", Options = ConfigurationPropertyOptions.IsRequired)]        
        public StyleSheetConfigurationElementCollection StyleSheets
        {
            get
            {
                return (StyleSheetConfigurationElementCollection)base["styleSheets"] ?? new StyleSheetConfigurationElementCollection();
            }
        }
    
        /// <summary>
        /// Gets the style sheets.
        /// </summary>
        /// <value>The style sheets.</value>
        [ConfigurationProperty("scripts", Options = ConfigurationPropertyOptions.IsRequired)]        
        public ScriptConfigurationElementCollection Scripts
        {
            get
            {
                return (ScriptConfigurationElementCollection)base["scripts"] ?? new ScriptConfigurationElementCollection();
            }
        }
    }
    
    
    [ConfigurationCollection(typeof(GroupConfigurationElementCollection), AddItemName = "group")]
    public class ScriptConfigurationElementCollection : ConfigurationElementCollection
    {
    
        protected override ConfigurationElement CreateNewElement()
        {
            return new GroupConfigurationElementCollection();
        }
    
        protected override object GetElementKey(ConfigurationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException();
            }
    
            return ((GroupConfigurationElementCollection)element).Name;
        }
    }
    
    [ConfigurationCollection(typeof(GroupConfigurationElementCollection), AddItemName="group")]
    public class StyleSheetConfigurationElementCollection : ConfigurationElementCollection
    {
    
        protected override ConfigurationElement CreateNewElement()
        {
            return new GroupConfigurationElementCollection();
        }
    
        protected override object GetElementKey(ConfigurationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException();
            }
    
            return ((GroupConfigurationElementCollection)element).Name;
        }
    }
    
    [ConfigurationCollection(typeof(AssetConfigurationElement), AddItemName = "asset", CollectionType = ConfigurationElementCollectionType.BasicMap)]
    public class GroupConfigurationElementCollection : ConfigurationElementCollection
    {
        public GroupConfigurationElementCollection()
        {
            AddElementName = "asset";
        }
    
        protected override ConfigurationElement CreateNewElement()
        {
            return new AssetConfigurationElement();
        }
    
        protected override object GetElementKey(ConfigurationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException();
            }
    
            return ((AssetConfigurationElement)element).Source;
        }
    
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        [ConfigurationProperty("name", IsRequired = true)]
        public string Name 
        {
            get
            {
                return (string)base["name"];
            }
        }
    
        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="WebAssetGroupConfigurationElement"/> is enabled.
        /// </summary>
        /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
        [ConfigurationProperty("enabled", DefaultValue = true)]
        public bool Enabled
        {
            get
            {
                return (bool)this["enabled"];
            }
    
            set
            {
                this["enabled"] = value;
            }
        }
    
        /// <summary>
        /// Gets or sets the version.
        /// </summary>
        /// <value>The version.</value>
        [ConfigurationProperty("version")]
        public string Version
        {
            get
            {
                return (string)this["version"];
            }
    
            set
            {
                this["version"] = value;
            }
        }
    
        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="WebAssetGroupConfigurationElement"/> is compress.
        /// </summary>
        /// <value><c>true</c> if compress; otherwise, <c>false</c>.</value>
        [ConfigurationProperty("compress", DefaultValue = true)]
        public bool Compress
        {
            get
            {
                return (bool)this["compress"];
            }
    
            set
            {
                this["compress"] = value;
            }
        }
    
        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="WebAssetGroupConfigurationElement"/> is combined.
        /// </summary>
        /// <value><c>true</c> if combined; otherwise, <c>false</c>.</value>
        [ConfigurationProperty("combined", DefaultValue = true)]
        public bool Combined
        {
            get
            {
                return (bool)this["combined"];
            }
    
            set
            {
                this["combined"] = value;
            }
        }
    }
    
    public class AssetConfigurationElement : ConfigurationElement
    {
    
        /// <summary>
        /// Gets or sets the source.
        /// </summary>
        /// <value>The source.</value>
        [ConfigurationProperty("source", IsRequired = false, IsKey = false)]
        public string Source
        {
            get
            {
                return (string)this["source"];
            }
    
            set
            {
                this["source"] = value;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here I had very similar xml structure, but now I have this: <Fields> <Company>My
Ok, here's my basic XML structure: <device name=abc source1=True source2=True ... source19=False source20=False />
I have a shape drawable in the drawable folder. Here is XML structure: <?xml
I have a dataset that I read in from a complex xml structure.... here
Suppose I get the following XML structure: <root> <item> <item1>text1</item1> <item2>text2</item2> more text here
Suppose I have the following XML structure: <root> <item> <item1>some text is <b>here</b></item1> <item2>more
Here's the layout (XML) structure. <RelativeLayout>       <Linearlayout>            < ScrollView >             ...<Linearlayout>...</Linearlayout>           
I'm using: Tomcat 6.0.30 Here's my context.xml and web.xml structure in my web application
Here is my XML <response> <statusCode>200</statusCode> <statusText>OK</statusText> <data> <getAssetResponse> <assetId>89898</assetId> <content> some text with
With glassfish, my persistence.xml is not loaded. my.ear META-INF/persistence.xml lib/entities.jar <!-- no persistence.xml here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.