0

在 XML 中,名为“DocumentIdentification”的第三个元素也是 XML 的文件名。当数组将三个项目读出到 datagridview 时,我如何将该数字添加到下面代码中的每一行。我在实施部分有点迷茫。一些 XML 文档在“FilingLeadDocument”中有“DocumentIdentification”,但有些没有。任何可能有用的想法,同时仍然只应用下面的代码,因为它按设计运行。

C#代码:

private void button1_Click(object sender, EventArgs e)
{
    var documentsData = GetDocumentsData(@"\\DIS2\EFilingXML\Test");
    var receivedFilesDataTable = new DataTable("ReceivedFiles");

    receivedFilesDataTable.Columns.Add(new DataColumn("Received On", typeof(DateTime)));
    receivedFilesDataTable.Columns.Add(new DataColumn("Description", typeof(string)));
    receivedFilesDataTable.Columns.Add(new DataColumn("Register Action", typeof(string)));

    foreach (var dataPiece in documentsData)
    {
        var row = receivedFilesDataTable.NewRow();
        row.ItemArray = dataPiece;
        receivedFilesDataTable.Rows.Add(row);
    }

    dataGridView2.DataSource = receivedFilesDataTable;
}

private static IEnumerable<object[]> GetDocumentsData(string folderPath = @"\\DIS2        \EFilingXML\Test")
{
    var filingMessageNamespace = XNamespace.Get("urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CoreFilingMessage-4.0");
    var ncNamespace = XNamespace.Get("http://niem.gov/niem/niem-core/2.0");
    var ecfNamespace = XNamespace.Get("urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CommonTypes-4.0");
    var jNamespace = XNamespace.Get("http://niem.gov/niem/domains/jxdm/4.0");

    return Directory
      .GetFiles(folderPath, "*.xml")
      .Select(XDocument.Load)
      .SelectMany(file => file.Descendants(filingMessageNamespace + "FilingLeadDocument").Concat(file.Descendants(filingMessageNamespace + "FilingConnectedDocument")))
      .Select(documentNode =>
                    new object[]
                    {
                        //documentNode.Element(ncNamespace + "DocumentIdentification").Element(ncNamespace + "IdentificationID").Value.Trim(),
                        DateTime.Parse(documentNode.Element(ncNamespace + "DocumentReceivedDate").Element(ncNamespace + "DateTime").Value),
                        documentNode.Element(ncNamespace + "DocumentDescriptionText").Value.Trim(),
                        documentNode.Element(ecfNamespace + "DocumentMetadata").Element(jNamespace + "RegisterActionDescriptionText").Value.Trim(),
                    }).ToArray();
}

XML 格式:

    <?xml version="1.0"?>
<RecordFilingRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:oasis:names:tc:legalxml-courtfiling:wsdl:WebServiceMessagingProfile-Definitions-4.0">
  <RecordFilingRequestMessage xmlns:fsrsp="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:FilingStatusResponseMessage-4.0" xmlns:ecf="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CommonTypes-4.0" xmlns:j="http://niem.gov/niem/domains/jxdm/4.0" xmlns:juvenile="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:JuvenileCase-4.0" xmlns:niem-xsd="http://niem.gov/niem/proxy/xsd/2.0" xmlns:domestic="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:DomesticCase-4.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:criminal="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CriminalCase-4.0" xmlns:amcadext="http://www.amcad.com/NiemEcf/extensions/1.0" xmlns:i="http://niem.gov/niem/appinfo/2.0" xmlns:appellate="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:AppellateCase-4.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" xmlns:citation="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CitationCase-4.0" xmlns:reviewcb="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:ReviewFilingCallbackMessage-4.0" xmlns:civil="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CivilCase-4.0">
    <nc:DocumentDescriptionText s:id="ReviewWorkQueueId">476</nc:DocumentDescriptionText>
    <nc:DocumentDescriptionText s:id="ReviewWorkQueue">Circuit Criminal Existing Cases</nc:DocumentDescriptionText>
    <nc:DocumentIdentification>
      <nc:IdentificationID>6379325</nc:IdentificationID>
    </nc:DocumentIdentification>
    <nc:DocumentPostDate>
      <nc:DateTime>2013-10-14T16:56:14.290623-04:00</nc:DateTime>
    </nc:DocumentPostDate>
    <nc:DocumentSubmitter>
      <ecf:EntityPerson s:id="REVIEWER">
        <nc:PersonName>
          <nc:PersonGivenName></nc:PersonGivenName>
          <nc:PersonSurName></nc:PersonSurName>
          <nc:PersonFullName></nc:PersonFullName>
        </nc:PersonName>
        <nc:PersonOtherIdentification>
          <nc:IdentificationID>27404</nc:IdentificationID>
          <nc:IdentificationCategoryText>FLEPORTAL</nc:IdentificationCategoryText>
        </nc:PersonOtherIdentification>
        <nc:PersonOtherIdentification>
          <nc:IdentificationID></nc:IdentificationID>
          <nc:IdentificationCategoryText>FLEPORTAL_LOGONNAME</nc:IdentificationCategoryText>
        </nc:PersonOtherIdentification>
        <ecf:PersonAugmentation>
          <nc:ContactInformation>
            <nc:ContactEmailID></nc:ContactEmailID>
          </nc:ContactInformation>
        </ecf:PersonAugmentation>
      </ecf:EntityPerson>
    </nc:DocumentSubmitter>
    <ecf:SendingMDELocationID>
      <nc:IdentificationID>Filing Review MDE</nc:IdentificationID>
    </ecf:SendingMDELocationID>
    <ecf:SendingMDEProfileCode>urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:WebServicesMessaging-2.0</ecf:SendingMDEProfileCode>
    <CoreFilingMessage xmlns="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CoreFilingMessage-4.0">
      <nc:DocumentEffectiveDate>
        <nc:DateTime>2013-10-14T16:11:45.677-04:00</nc:DateTime>
      </nc:DocumentEffectiveDate>
      <nc:DocumentIdentification>
        <nc:IdentificationID>6379325</nc:IdentificationID>
      </nc:DocumentIdentification>
      <nc:DocumentInformationCutOffDate>
        <nc:DateTime>2013-10-14T16:11:45.677-04:00</nc:DateTime>
      </nc:DocumentInformationCutOffDate>
      <nc:DocumentPostDate>
        <nc:DateTime>2013-10-14T16:11:45-04:00</nc:DateTime>
      </nc:DocumentPostDate>
      <nc:DocumentReceivedDate>
        <nc:DateTime>2013-10-14T16:11:45.677-04:00</nc:DateTime>
      </nc:DocumentReceivedDate>
      <nc:DocumentSubmitter>
        <ecf:EntityPerson s:id="FILER">
          <nc:PersonName>
            <nc:PersonGivenName></nc:PersonGivenName>
            <nc:PersonSurName></nc:PersonSurName>
            <nc:PersonNameSuffixText s:metadata="III">III</nc:PersonNameSuffixText>
            <nc:PersonFullName></nc:PersonFullName>
          </nc:PersonName>
          <nc:PersonOtherIdentification>
            <nc:IdentificationID>24759</nc:IdentificationID>
            <nc:IdentificationCategoryText>FLEPORTAL</nc:IdentificationCategoryText>
          </nc:PersonOtherIdentification>
          <nc:PersonOtherIdentification>
            <nc:IdentificationID>STB</nc:IdentificationID>
            <nc:IdentificationCategoryText>FLEPORTAL_LOGONNAME</nc:IdentificationCategoryText>
          </nc:PersonOtherIdentification>
          <nc:PersonOtherIdentification>
            <nc:IdentificationID>128820FL</nc:IdentificationID>
            <nc:IdentificationCategoryText>BAR_NUMBER</nc:IdentificationCategoryText>
          </nc:PersonOtherIdentification>
          <nc:PersonOtherIdentification>
            <nc:IdentificationID></nc:IdentificationID>
            <nc:IdentificationCategoryText>EMPLOYER</nc:IdentificationCategoryText>
          </nc:PersonOtherIdentification>
          <ecf:PersonAugmentation>
            <nc:ContactInformation>
              <nc:ContactEmailID></nc:ContactEmailID>
              <nc:ContactMailingAddress>
                <nc:StructuredAddress>
                  <nc:AddressDeliveryPointText></nc:AddressDeliveryPointText>
                  <nc:LocationCityName></nc:LocationCityName>
                  <nc:LocationStateUSPostalServiceCode>FL</nc:LocationStateUSPostalServiceCode>
                  <nc:LocationStateName></nc:LocationStateName>
                  <nc:LocationPostalCode></nc:LocationPostalCode>
                </nc:StructuredAddress>
                <nc:AddressFullText></nc:AddressFullText>
              </nc:ContactMailingAddress>
              <nc:ContactTelephoneNumber s:id="PRIMARYPHONE">
                <nc:FullTelephoneNumber>
                  <nc:TelephoneNumberFullID></nc:TelephoneNumberFullID>
                </nc:FullTelephoneNumber>
              </nc:ContactTelephoneNumber>
            </nc:ContactInformation>
          </ecf:PersonAugmentation>
        </ecf:EntityPerson>
      </nc:DocumentSubmitter>
      <ecf:SendingMDELocationID s:id="Filing Assembly MDE">
        <nc:IdentificationID>http://www.myflcourtaccess.com/Courts/UIPages/SimpleEFileFees.aspx?organizationId=5</nc:IdentificationID>
        <nc:IdentificationID>209.16.117.2</nc:IdentificationID>
        <nc:IdentificationCategoryText>FLEPORTAL</nc:IdentificationCategoryText>
      </ecf:SendingMDELocationID>
      <ecf:SendingMDEProfileCode>urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:WebServicesMessaging-2.0</ecf:SendingMDEProfileCode>
      <ecf:ElectronicServiceInformation s:id="1">
        <ecf:ServiceRecipientID s:id="24759" s:metadata="Samuel Bookhardt III">
          <nc:IdentificationID>;</nc:IdentificationID>
          <nc:IdentificationCategoryText>Electronic</nc:IdentificationCategoryText>
        </ecf:ServiceRecipientID>
      </ecf:ElectronicServiceInformation>
      <ecf:ElectronicServiceInformation s:id="2">
        <ecf:ServiceRecipientID s:id="-1" s:metadata="Phil Archer, State Attorney">
          <nc:IdentificationID>;;</nc:IdentificationID>
          <nc:IdentificationCategoryText>Electronic</nc:IdentificationCategoryText>
        </ecf:ServiceRecipientID>
      </ecf:ElectronicServiceInformation>
      <criminal:Case>
        <nc:ActivityDescriptionText s:id="Circuit Criminal">Other Crimes Against Persons</nc:ActivityDescriptionText>
        <nc:ActivityStatus>
          <nc:StatusText>ORIGINAL PEND                           </nc:StatusText>
          <nc:StatusDate>
            <nc:DateTime>2013-10-14T00:00:00-04:00</nc:DateTime>
          </nc:StatusDate>
        </nc:ActivityStatus>
        <nc:CaseTitleText></nc:CaseTitleText>
        <nc:CaseCategoryText s:id="40781916530">904</nc:CaseCategoryText>
        <nc:CaseTrackingID></nc:CaseTrackingID>
        <nc:CaseTrackingID s:id="ucn"></nc:CaseTrackingID>
        <j:CaseAugmentation>
          <j:CaseCourt>
            <nc:OrganizationIdentification>
              <nc:IdentificationID>5</nc:IdentificationID>
              <nc:IdentificationCategoryText>FLEPORTAL_ORGANIZATION</nc:IdentificationCategoryText>
            </nc:OrganizationIdentification>
            <nc:OrganizationIdentification>
              <nc:IdentificationID>2</nc:IdentificationID>
              <nc:IdentificationCategoryText>FLEPORTAL_ORGANIZATION_UNIT</nc:IdentificationCategoryText>
            </nc:OrganizationIdentification>
            <nc:OrganizationIdentification>
              <nc:IdentificationID>Trial</nc:IdentificationID>
              <nc:IdentificationCategoryText>COURT_TYPE</nc:IdentificationCategoryText>
            </nc:OrganizationIdentification>
            <nc:OrganizationIdentification>
              <nc:IdentificationID>Eighteenth Circuit</nc:IdentificationID>
              <nc:IdentificationCategoryText>JUDICIAL_CIRCUIT_ID</nc:IdentificationCategoryText>
            </nc:OrganizationIdentification>
            <nc:OrganizationName></nc:OrganizationName>
            <nc:OrganizationUnitName>Circuit </nc:OrganizationUnitName>
            <j:CourtName></j:CourtName>
          </j:CaseCourt>
        </j:CaseAugmentation>
        <ecf:CaseAugmentation>
          <nc:LanguageCode xsi:nil="true" />
        </ecf:CaseAugmentation>
      </criminal:Case>
      <FilingConfidentialityIndicator>false</FilingConfidentialityIndicator>
      <FilingLeadDocument s:id="DOC00001" s:metadata="# Pages=3">
        <nc:DocumentApplicationName>application/pdf</nc:DocumentApplicationName>
        <nc:DocumentDescriptionText s:id="Motions">Motion to Set Bond</nc:DocumentDescriptionText>
        <nc:DocumentFileControlID s:id="FileInputId">101</nc:DocumentFileControlID>
        <nc:DocumentFileControlID s:id="Rule6PublicAnswer">-1</nc:DocumentFileControlID>
        <nc:DocumentFileControlID s:id="Rule6ConfidentialAnswer">-1</nc:DocumentFileControlID>
        <nc:DocumentFileControlID s:id="TypeOfConfidentialDocument">-1</nc:DocumentFileControlID>
        <nc:DocumentPostDate>
          <nc:DateTime>2013-10-14T16:11:45-04:00</nc:DateTime>
        </nc:DocumentPostDate>
        <nc:DocumentReceivedDate>
          <nc:DateTime>2013-10-14T16:11:45.677-04:00</nc:DateTime>
        </nc:DocumentReceivedDate>
        <nc:DocumentSequenceID>1</nc:DocumentSequenceID>
        <ecf:DocumentMetadata>
          <j:RegisterActionDescriptionText s:id="2089067143">3022      </j:RegisterActionDescriptionText>
          <ecf:FilingPartyID>
            <nc:IdentificationID>24759</nc:IdentificationID>
            <nc:IdentificationCategoryText>FLEPORTAL</nc:IdentificationCategoryText>
          </ecf:FilingPartyID>
          <ecf:SpecialHandlingInstructions />
        </ecf:DocumentMetadata>
        <ecf:DocumentRendition>
          <ecf:DocumentRenditionMetadata>
            <nc:DocumentApplicationName>application/pdf</nc:DocumentApplicationName>
            <nc:DocumentFileControlID>bond jeremey carmichael.pdf</nc:DocumentFileControlID>
            <ecf:DocumentAttachment s:id="ATT00001">
              <nc:BinaryBase64Object></nc:BinaryBase64Object>
              <nc:BinarySizeValue>12862</nc:BinarySizeValue>
              <ecf:AttachmentSequenceID>1</ecf:AttachmentSequenceID>
            </ecf:DocumentAttachment>
          </ecf:DocumentRenditionMetadata>
        </ecf:DocumentRendition>
      </FilingLeadDocument>
      <FilingConnectedDocument s:id="DOC00002" s:metadata="# Pages=1">
        <nc:DocumentApplicationName>application/pdf</nc:DocumentApplicationName>
        <nc:DocumentDescriptionText s:id="Notices">Notice of Hearing</nc:DocumentDescriptionText>
        <nc:DocumentFileControlID s:id="FileInputId">102</nc:DocumentFileControlID>
        <nc:DocumentFileControlID s:id="Rule6PublicAnswer">-1</nc:DocumentFileControlID>
        <nc:DocumentFileControlID s:id="Rule6ConfidentialAnswer">-1</nc:DocumentFileControlID>
        <nc:DocumentFileControlID s:id="TypeOfConfidentialDocument">-1</nc:DocumentFileControlID>
        <nc:DocumentPostDate>
          <nc:DateTime>2013-10-14T16:11:45-04:00</nc:DateTime>
        </nc:DocumentPostDate>
        <nc:DocumentReceivedDate>
          <nc:DateTime>2013-10-14T16:11:45.677-04:00</nc:DateTime>
        </nc:DocumentReceivedDate>
        <nc:DocumentSequenceID>2</nc:DocumentSequenceID>
        <ecf:DocumentMetadata>
          <j:RegisterActionDescriptionText s:id="2089067191">6724      </j:RegisterActionDescriptionText>
          <ecf:FilingPartyID>
            <nc:IdentificationID>24759</nc:IdentificationID>
            <nc:IdentificationCategoryText>FLEPORTAL</nc:IdentificationCategoryText>
          </ecf:FilingPartyID>
        </ecf:DocumentMetadata>
        <ecf:DocumentRendition>
          <ecf:DocumentRenditionMetadata>
            <nc:DocumentApplicationName>application/pdf</nc:DocumentApplicationName>
            <nc:DocumentFileControlID>NOH Bond Nebbia 10.11.13.pdf</nc:DocumentFileControlID>
            <ecf:DocumentAttachment s:id="ATT00002">
              <nc:BinaryBase64Object></nc:BinaryBase64Object>
              <nc:BinarySizeValue>8812</nc:BinarySizeValue>
              <ecf:AttachmentSequenceID>2</ecf:AttachmentSequenceID>
            </ecf:DocumentAttachment>
          </ecf:DocumentRenditionMetadata>
        </ecf:DocumentRendition>
      </FilingConnectedDocument>
    </CoreFilingMessage>
    <RecordDocketingMessage xmlns="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:RecordDocketingMessage-4.0">
      <nc:DocumentIdentification>
        <nc:IdentificationID>6379325</nc:IdentificationID>
      </nc:DocumentIdentification>
      <nc:DocumentPostDate>
        <nc:DateTime>2013-10-14T16:56:14.290623-04:00</nc:DateTime>
      </nc:DocumentPostDate>
      <nc:DocumentSubmitter>
        <ecf:EntityPerson s:id="REVIEWER">
          <nc:PersonName>
            <nc:PersonGivenName></nc:PersonGivenName>
            <nc:PersonSurName></nc:PersonSurName>
            <nc:PersonFullName></nc:PersonFullName>
          </nc:PersonName>
          <nc:PersonOtherIdentification>
            <nc:IdentificationID>27404</nc:IdentificationID>
            <nc:IdentificationCategoryText>FLEPORTAL</nc:IdentificationCategoryText>
          </nc:PersonOtherIdentification>
          <nc:PersonOtherIdentification>
            <nc:IdentificationID></nc:IdentificationID>
            <nc:IdentificationCategoryText>FLEPORTAL_LOGONNAME</nc:IdentificationCategoryText>
          </nc:PersonOtherIdentification>
          <ecf:PersonAugmentation>
            <nc:ContactInformation>
              <nc:ContactEmailID></nc:ContactEmailID>
            </nc:ContactInformation>
          </ecf:PersonAugmentation>
        </ecf:EntityPerson>
      </nc:DocumentSubmitter>
      <ecf:SendingMDELocationID>
        <nc:IdentificationID>Filing Review MDE</nc:IdentificationID>
      </ecf:SendingMDELocationID>
      <ecf:SendingMDEProfileCode>urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:WebServicesMessaging-2.0</ecf:SendingMDEProfileCode>
      <j:CaseCourt>
        <nc:OrganizationIdentification>
          <nc:IdentificationID>5</nc:IdentificationID>
          <nc:IdentificationCategoryText>FLEPORTAL_ORGANIZATION</nc:IdentificationCategoryText>
        </nc:OrganizationIdentification>
        <nc:OrganizationIdentification>
          <nc:IdentificationID>2</nc:IdentificationID>
          <nc:IdentificationCategoryText>FLEPORTAL_ORGANIZATION_UNIT</nc:IdentificationCategoryText>
        </nc:OrganizationIdentification>
        <nc:OrganizationIdentification>
          <nc:IdentificationID>Trial</nc:IdentificationID>
          <nc:IdentificationCategoryText>COURT_TYPE</nc:IdentificationCategoryText>
        </nc:OrganizationIdentification>
        <nc:OrganizationIdentification>
          <nc:IdentificationID>Eighteenth Circuit</nc:IdentificationID>
          <nc:IdentificationCategoryText>JUDICIAL_CIRCUIT_ID</nc:IdentificationCategoryText>
        </nc:OrganizationIdentification>
        <nc:OrganizationName>Brevard</nc:OrganizationName>
        <nc:OrganizationUnitName>Circuit Criminal</nc:OrganizationUnitName>
        <j:CourtName>Brevard Circuit Criminal</j:CourtName>
      </j:CaseCourt>
      <nc:CaseTrackingID>052013CF050219AXXXXX</nc:CaseTrackingID>
      <ecf:ReviewedLeadDocument s:id="REVIEWEDDOC00001">
        <nc:DocumentFiledDate>
          <nc:DateTime>2013-10-14T00:00:00</nc:DateTime>
        </nc:DocumentFiledDate>
        <nc:DocumentPostDate>
          <nc:DateTime>2013-10-14T16:11:45</nc:DateTime>
        </nc:DocumentPostDate>
        <nc:DocumentReceivedDate>
          <nc:DateTime>2013-10-14T16:11:45.677</nc:DateTime>
        </nc:DocumentReceivedDate>
        <nc:DocumentSequenceID>1</nc:DocumentSequenceID>
        <nc:DocumentStatus>
          <nc:StatusText>ACCEPTED</nc:StatusText>
        </nc:DocumentStatus>
        <ecf:DocumentMetadata>
          <j:RegisterActionDescriptionText s:id="2089067143">3022      </j:RegisterActionDescriptionText>
          <ecf:ParentDocumentReference s:ref="DOC00001" />
        </ecf:DocumentMetadata>
        <ecf:DocumentRendition>
          <ecf:DocumentRenditionMetadata s:metadata="3" />
        </ecf:DocumentRendition>
      </ecf:ReviewedLeadDocument>
      <ecf:ReviewedConnectedDocument s:id="REVIEWEDDOC00002">
        <nc:DocumentFiledDate>
          <nc:DateTime>2013-10-14T00:00:00</nc:DateTime>
        </nc:DocumentFiledDate>
        <nc:DocumentPostDate>
          <nc:DateTime>2013-10-14T16:11:45</nc:DateTime>
        </nc:DocumentPostDate>
        <nc:DocumentReceivedDate>
          <nc:DateTime>2013-10-14T16:11:45.677</nc:DateTime>
        </nc:DocumentReceivedDate>
        <nc:DocumentSequenceID>2</nc:DocumentSequenceID>
        <nc:DocumentStatus>
          <nc:StatusText>ACCEPTED</nc:StatusText>
        </nc:DocumentStatus>
        <ecf:DocumentMetadata>
          <j:RegisterActionDescriptionText s:id="2089067191">6724      </j:RegisterActionDescriptionText>
          <ecf:ParentDocumentReference s:ref="DOC00002" />
        </ecf:DocumentMetadata>
        <ecf:DocumentRendition>
          <ecf:DocumentRenditionMetadata s:metadata="1" />
        </ecf:DocumentRendition>
      </ecf:ReviewedConnectedDocument>
    </RecordDocketingMessage>
    <payment:PaymentMessage xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-1.0" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0" xmlns:receipt="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:PaymentReceiptMessage-4.0" xmlns:payment="urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:PaymentMessage-4.0">
      <payment:PayerName></payment:PayerName>
      <cac:AllowanceCharge>
        <cac:ID identificationSchemeID="NA" identificationSchemeName="Filing fee" identificationSchemeAgencyID="-1">NA</cac:ID>
        <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
        <cbc:PrepaidIndicator>false</cbc:PrepaidIndicator>
        <cbc:SequenceNumeric>1</cbc:SequenceNumeric>
        <cbc:Amount amountCurrencyID="USD">0</cbc:Amount>
        <cac:Reason>Filing fee</cac:Reason>
      </cac:AllowanceCharge>
      <cac:AllowanceCharge>
        <cac:ID identificationSchemeID="NA" identificationSchemeName="Motions Motion to Set Bond" identificationSchemeAgencyID="101">NA</cac:ID>
        <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
        <cbc:PrepaidIndicator>false</cbc:PrepaidIndicator>
        <cbc:SequenceNumeric>2</cbc:SequenceNumeric>
        <cbc:Amount amountCurrencyID="USD">0</cbc:Amount>
        <cac:Reason>Motions Motion to Set Bond</cac:Reason>
      </cac:AllowanceCharge>
      <cac:AllowanceCharge>
        <cac:ID identificationSchemeID="NA" identificationSchemeName="Notices Notice of Hearing" identificationSchemeAgencyID="102">NA</cac:ID>
        <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
        <cbc:PrepaidIndicator>false</cbc:PrepaidIndicator>
        <cbc:SequenceNumeric>3</cbc:SequenceNumeric>
        <cbc:Amount amountCurrencyID="USD">0</cbc:Amount>
        <cac:Reason>Notices Notice of Hearing</cac:Reason>
      </cac:AllowanceCharge>
      <cac:Address>
        <cac:AddressLine>
          <cbc:Line>1980 Michigan Ave.</cbc:Line>
          <cbc:Line />
          <cbc:Line>Cocoa</cbc:Line>
          <cbc:Line>FL</cbc:Line>
          <cbc:Line>32922</cbc:Line>
        </cac:AddressLine>
      </cac:Address>
    </payment:PaymentMessage>
  </RecordFilingRequestMessage>
</RecordFilingRequest>
4

1 回答 1

2

您可以使用Parent属性来获取DocumentIdentificationxml 文档的顶部。

(string)documentNode.Parent.Parent.Element(ncNamespace + "DocumentIdentification")

然后您的代码将如下所示:

return Directory
         .GetFiles(folderPath, "*.xml")
         .Select(XDocument.Load)
         .SelectMany(file => file.Descendants(filingMessageNamespace + "FilingLeadDocument").Concat(file.Descendants(filingMessageNamespace + "FilingConnectedDocument")))
         .Select(documentNode =>
                 new object[]
                 {
                    (string)documentNode.Parent.Parent.Element(ncNamespace + "DocumentIdentification"),
                    DateTime.Parse(documentNode.Element(ncNamespace + "DocumentReceivedDate").Element(ncNamespace + "DateTime").Value),
                    documentNode.Element(ncNamespace + "DocumentDescriptionText").Value.Trim(),
                    documentNode.Element(ecfNamespace + "DocumentMetadata").Element(jNamespace + "RegisterActionDescriptionText").Value.Trim(),
                    }).ToArray();
于 2013-10-25T12:38:29.180 回答