使用具有查找XML文件中ID的基本XML文件创建多个文件

时间:2018-08-08 19:33:10

标签: c# xml

我在两个文件中都有ID为基本属性的基本文件和查找文件。     我想编写C#代码以读取具有ID的基本文件,并根据订阅者查找文件,创建2个XML文件,文件名分别为_USA和_CAD

基本文件:

Base File Name : Base_File.xml
<?xml version="1.0" encoding="utf-8"?>
<Publication >
    <Payload >
        <BaseList >
<Base>
  <Custom>
    <CustomE>
      <ML_BUY_SELL_FLAG>false</ML_BUY_SELL_FLAG>
      <ID_BB_GLOBAL_PARENT_COMPANY_NAME>First Trust /USA</ID_BB_GLOBAL_PARENT_COMPANY_NAME>
    </CustomE>
  </Custom>
  <Identifier>
    <ID>10072271</ID>
  </Identifier>
  </Base>
  <Base>
  <Custom>
    <CustomE>
      <ML_BUY_SELL_FLAG>false</ML_BUY_SELL_FLAG>
      <ID_BB_GLOBAL_PARENT_COMPANY_NAME>First Trust /CAD</ID_BB_GLOBAL_PARENT_COMPANY_NAME>
    </CustomE>
  </Custom>
  <Identifier>
    <ID>10072272</ID>
  </Identifier>
  </Base>
  </BaseList>
  </Payload>
</Publication>

查找文件:

Look-Up File Name: LookUp.xml
<?xml version="1.0" encoding="utf-8"?>
<Publication >
    <Payload >
        <SubsList >
            <Subscription>
                <ID>10072271</ID>
                <Subscribers>
                    <Subscriber>USA</Subscriber>
                  </Subscribers>
                  </Subscription>
                <Subscription>
                <ID>10072272</ID>
                <Subscribers>
                    <Subscriber>CAD</Subscriber>
                    </Subscribers>
            </Subscription>      
        </SubsList>
    </Payload>
</Publication>

0 个答案:

没有答案