来自XSD的XML奇怪值

时间:2017-12-03 09:04:07

标签: c# xml xsd xsd2code

我有一个XSD文件,我使用xsd 2代码工具生成此XSD的代码。 当XML文件首次创建时(在我给出值之前),它包含一些元素和值。 我的问题是这些价值来自何处,我怎样才能从空元素开始。

这是代码

  private void XMLEF15ItemClick(object sender, ItemClickEventArgs e)
    {
        try
        {
            SaveFileDialog saveFile = new SaveFileDialog
            {
                FileName = "EF15 " + DefkCurrent.ArithmosAnaforas_7,
                Filter = "XML (*.xml)|*.xml",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };

            EmcsMessage ecs = new EmcsMessage(DefkCurrent);
            EF15 ef15Msg = ecs.CreateEF15();

            if (saveFile.ShowDialog(this).Equals(DialogResult.OK))
            {
                ef15Msg.SaveToFile(saveFile.FileName);

                MessageSuccess("ΔΕΦΚ - EF15");
            }
        }
        catch (CreateMessageException ex)
        {
            using (DiskErrorsForm diskErrorsForm = new DiskErrorsForm(ex.Errors))
            {
                diskErrorsForm.ShowDialog(this);
            }
        }
    }

这是EF15

  private Defk DefkCurrent { get; set; }
    private StringBuilder ErrorBuilder { get; set; }
    private EF15AType MessageIF15 { get; set; }

    public EF15(Defk defk)
    {
        DefkCurrent = defk;
        MessageIF15 = new EF15AType();
        LengthWarn.WarnBuilder = new StringBuilder();
    }

  public EF15.EF15 CreateEF15()
    {
        EF15.EF15 message = new EF15.EF15(DefkCurrent);

        message.Create();

        return message;
    }

以下是XSD生成的代码的一部分(IT非常大,可以粘贴所有代码,大约9000行)

  public EF15AType() {
        this.bodyField = new BodyType();
        this.headerField = new HeaderType();
    }

当代码到达EF15.EF15消息=新EF15.EF15(DefkCurrent); 它已经用这个内容创建了XML的一部分(我没有给出任何值)

{<?xml version="1.0" encoding="utf-8"?>

<Header>
    <DateOfPreparation xmlns="http://www.icisnet.gr/emcs/v1.03/tms">0001-01-01</DateOfPreparation>
    <TimeOfPreparation xmlns="http://www.icisnet.gr/emcs/v1.03/tms">00:00:00.0000000+02:00</TimeOfPreparation>
</Header>
<Body>
    <DeclarationOfExciseTaxesRegistration>
        <SubmittingOperator />
        <ExciseTaxesDeclaration>
            <Fallbackflag>0</Fallbackflag>
            <DocumentState>0</DocumentState>
            <PaymentMethodCode>A</PaymentMethodCode>
            <DeclarationTypeCode>30</DeclarationTypeCode>
            <GeneralChemistryDetails />
            <DeliveryDetails />
            <ClearingAgent>
                <ClearingAgentType>1</ClearingAgentType>
            </ClearingAgent>
        </ExciseTaxesDeclaration>
        <ExciseTaxesDeclarationConsignor>
            <ExciseTaxesDeclarationConsignorType>0</ExciseTaxesDeclarationConsignorType>
        </ExciseTaxesDeclarationConsignor>
        <ExciseTaxesObligee>
            <ObligeeType>1</ObligeeType>
            <ContactDetails />
        </ExciseTaxesObligee>
        <ExciseTaxesDeclarationConsignee>
            <ConsigneeType>0</ConsigneeType>
            <ConsigneeIdentificationType>1</ConsigneeIdentificationType>
            <ContactDetails />
            <SpecialConsignee>
                <SpecialConsigneeLicenseType>1</SpecialConsigneeLicenseType>
            </SpecialConsignee>
            <VesselRegistrationDetails>
                <VesselRegistrationType>1</VesselRegistrationType>
            </VesselRegistrationDetails>
        </ExciseTaxesDeclarationConsignee>
    </DeclarationOfExciseTaxesRegistration>
</Body>

}

如果有人可以帮助我或需要更多代码,请告诉我。 提前完成。

0 个答案:

没有答案