<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Console_Config_User.UserInfo,Console_Config_User" />
</configSections>
<unity>
<NAME>황승재</NAME>
<ADDRESS>염창동</ADDRESS>
<HP>016-647-0678</HP>
</unity>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<unity>
<NAME>황승재</NAME>
<ADDRESS AD1="서울시" AD2="염창동" AD3="동아3차아파트" AD4="307동 1101호" />
<HP>016-647-0678</HP>
</unity>
>xsd.exe unity.xml
>xsd.exe unity.xsd /c
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3082
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=2.0.50727.1432.
//
namespace Console_Config_User
{
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class unity
{
private string nAMEField;
private string hpField;
private unityADDRESS[] aDDRESSField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string NAME
{
get
{
return this.nAMEField;
}
set
{
this.nAMEField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string HP
{
get
{
return this.hpField;
}
set
{
this.hpField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("ADDRESS", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public unityADDRESS[] ADDRESS
{
get
{
return this.aDDRESSField;
}
set
{
this.aDDRESSField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class unityADDRESS
{
private string aD1Field;
private string aD2Field;
private string aD3Field;
private string aD4Field;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string AD1
{
get
{
return this.aD1Field;
}
set
{
this.aD1Field = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string AD2
{
get
{
return this.aD2Field;
}
set
{
this.aD2Field = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string AD3
{
get
{
return this.aD3Field;
}
set
{
this.aD3Field = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string AD4
{
get
{
return this.aD4Field;
}
set
{
this.aD4Field = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class NewDataSet
{
private unity[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("unity")]
public unity[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Xml;
namespace Console_Config_User
{
class UserInfo : System.Configuration.IConfigurationSectionHandler
{
#region IConfigurationSectionHandler 멤버
public object Create(object parent, object configContext, System.Xml.XmlNode section)
{
//throw new NotImplementedException();
XmlDocument doc = new XmlDocument();
doc.LoadXml(section.OuterXml);
Console_Config_User.unity objClass = new unity();
objClass = (unity)xxml.ToInstance(doc, typeof(unity));
return objClass;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Console_Config_User
{
class Program
{
static void Main(string[] args)
{
//object config = ConfigurationManager.GetSection("unity");
unity container = new unity();
container = (unity)ConfigurationManager.GetSection("unity");
}
}
}
'GET > Configuration' 카테고리의 다른 글
[XSD.EXE] XML <->CLASS & Serialization (0) | 2009.09.24 |
---|---|
XML 제어 - 읽기...... (0) | 2009.09.23 |
CONFIG XML 의 Element 와 Attribute 를 XPATH 로 값 가져오는 방법 (0) | 2009.09.23 |
Sample-2 .. 예제파일들과 호출..여러 가지것들 (0) | 2009.09.23 |
사용자가 임의로 만든 any XML configuration file 제어 (1) | 2009.09.23 |