Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. App.Config with xi:include

App.Config with xi:include

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpapachedotnethardwarexml
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K L K
    wrote on last edited by
    #1

    Hi, I have several related applications that all use Apache's log4net logging package. This package can use an XML configuration file to configure options. Furthermore, this configuration file can be embedded into the application's general App.config file by doing the following:

    Now, I don't want to have to copy the log4net.config file contents into each of the App.config files, as it is large and would make things more difficult to maintain. I found that XML has an XInclude extension (see http://www.w3.org/TR/2003/WD-xinclude-20031110) If I did my googling right, this means that an XML document can specify the content of another XML document to be embedded within it. Therefore, I could theoretically use XInclude to include the contents of my log4net.config file in each App.config file. Below is my attempt:

    However, this does not work - when the code is run the log4net configurator very obviously does not find the embedded content. Does anyone have any suggestions for how to format the xml file to make this work? Is this even possible within .NET framework? -klk

    K 1 Reply Last reply
    0
    • K K L K

      Hi, I have several related applications that all use Apache's log4net logging package. This package can use an XML configuration file to configure options. Furthermore, this configuration file can be embedded into the application's general App.config file by doing the following:

      Now, I don't want to have to copy the log4net.config file contents into each of the App.config files, as it is large and would make things more difficult to maintain. I found that XML has an XInclude extension (see http://www.w3.org/TR/2003/WD-xinclude-20031110) If I did my googling right, this means that an XML document can specify the content of another XML document to be embedded within it. Therefore, I could theoretically use XInclude to include the contents of my log4net.config file in each App.config file. Below is my attempt:

      However, this does not work - when the code is run the log4net configurator very obviously does not find the embedded content. Does anyone have any suggestions for how to format the xml file to make this work? Is this even possible within .NET framework? -klk

      K Offline
      K Offline
      K L K
      wrote on last edited by
      #2

      I should mention that viewing the generated config file in Internet Explorer does not do any XInclude processing. In other words, the XML displayed is exactly that of the .config input file. Am currently trying a solution using ENTITY, will post fix if I find.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups