使用svcutil从简单的xml文件生成C#类

时间:2018-07-20 18:48:06

标签: c# xml

我有以下XML。我正在尝试使用svcutil生成C#类。我知道还有其他工具(例如Visual Studio Paste Special和XML2CSharp)–但我需要了解svcutil是如何生成的。

<?xml version="1.0"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" templateId="2.16.840.1.113883.3.27.1776">
    <title>Gc test Consultation Note</title>
    <effectiveTime value="20000407"/>
    <component>
        <StructuredBody>
            <component>
                <section>
                    <code code="10164-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
                    <title>History of Present Illness</title>
                    <text>Test patient is a 67 year old male referred for further asthma management. Onset of asthma in his 
                <content revised="delete">twenties</content>
                <content revised="insert">teens</content>.
                He was hospitalized twice last year, and already twice this year. He has not been able to be weaned off steroids for the past several months. 
                        </text>
                </section>
            </component>
        </StructuredBody>
    </component>
</ClinicalDocument>

我使用了svcutil文章,并使用了以下命令-但它发出警告,表明未生成任何代码。

   svcutil.exe /target:code /dataContractOnly /serializer:XmlSerializer /importXmlTypes /collectionType:System.Collections.Generic.List`1 hl7sample.xml

enter image description here

如何使用svcutil从此XML生成C#类?

0 个答案:

没有答案