XmlTypeMapping.XsdTypeNamespace 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
매핑된 개체의 XML 네임스페이스를 가져옵니다.
public:
property System::String ^ XsdTypeNamespace { System::String ^ get(); };
public string? XsdTypeNamespace { get; }
public string XsdTypeNamespace { get; }
member this.XsdTypeNamespace : string
Public ReadOnly Property XsdTypeNamespace As String
속성 값
매핑된 개체의 XML 네임스페이스입니다. 기본값은 빈 문자열("")입니다.
예제
using System;
using System.IO;
using System.Xml.Serialization;
using System.Collections;
using System.Xml;
using System.Text;
namespace Company{
[SoapType("TheGroup", "http://www.cohowinery.com")]
public class Group
{
public string GroupName;
public Thing[] Things;
[SoapElement(DataType = "language")]
public string Lang = "en";
[SoapElement(DataType = "integer")]
public string MyNumber;
[SoapElement(DataType = "duration")]
public string ReDate = "8/31/01";
}
public class Thing{
public string ThingName;
}
public class Test
{
public static void Main()
{
Test t = new Test();
t.GetMap("MyMap.xml");
}
public void GetMap(string filename){
// Create an XmlSerializer instance.
XmlTypeMapping map = new SoapReflectionImporter().ImportTypeMapping(typeof(Group));
Console.WriteLine("ElementName: " + map.ElementName);
Console.WriteLine("Namespace: " + map.Namespace);
Console.WriteLine("TypeFullName: " + map.TypeFullName);
Console.WriteLine("TypeName: " + map.TypeName);
XmlSerializer ser = new XmlSerializer(map);
Group xGroup= new Group();
xGroup.GroupName= "MyCar";
xGroup.MyNumber= 5454.ToString();
xGroup.Things = new Thing[]{new Thing(), new Thing()};
// To write the outer wrapper, use an XmlTextWriter.
XmlTextWriter writer =
new XmlTextWriter(filename, Encoding.UTF8);
writer.Formatting = Formatting.Indented;
writer.WriteStartElement("wrapper");
ser.Serialize(writer, xGroup);
writer.WriteEndElement();
writer.Close();
}
}
}
Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Xml
Imports System.Text
Namespace Company
<SoapType("TheGroup", "http://www.cohowinery.com")> _
Public Class Group
' The SoapElementAttribute specifies that the
' generated XML element name will be "Wheels"
' instead of "Vehicle".
Public GroupName As String
public Things() As Thing
<SoapElement(DataType:= "language")> _
Public Lang As String = "en"
<SoapElement(DataType:= "integer")> _
Public MyNumber As String
<SoapElement(DataType:= "duration")> _
Public ReDate As String = "8/31/01"
End Class
Public Class Thing
Public ThingName As String
End Class
Public Class Test
Shared Sub Main()
Dim t As Test = new Test()
t.GetMap("MyMap.xml")
End Sub
public Sub GetMap(filename As string )
' Create an XmlSerializer instance.
Dim map As XmlTypeMapping = new SoapReflectionImporter().ImportTypeMapping(GetType(Group))
Console.WriteLine("ElementName: " + map.ElementName)
Console.WriteLine("Namespace: " + map.Namespace)
Console.WriteLine("TypeFullName: " + map.TypeFullName)
Console.WriteLine("TypeName: " + map.TypeName)
Dim ser As XmlSerializer= new XmlSerializer(map)
Dim xGroup As Group = new Group()
xGroup.GroupName= "MyCar"
xGroup.MyNumber= 5454.ToString()
xGroup.Things = new Thing(){new Thing(), new Thing()}
' To write the outer wrapper, use an XmlTextWriter.
Dim writer As XmlTextWriter = _
new XmlTextWriter(filename, Encoding.UTF8)
writer.Formatting = Formatting.Indented
writer.WriteStartElement("wrapper")
ser.Serialize(writer, xGroup)
writer.WriteEndElement()
writer.Close()
End Sub
End Class
End namespace
설명
개체의 네임 스페이스 이름을 설정 적용을 SoapTypeAttribute 는 클래스를는 Namespace 속성을 새 값입니다.