c# - Read another section of XML without creating new rows in table -


On the code below, I would like to know that I am reviewed by the 'Reviewed Lead Document' / 'Reviewed Connected Document' How to obtain the Sequence ID section without adding new rows in the data table. As of now, I have to use a completely different table to collect this information which is causing a lot of headache. The first sequence listed is being read with 'filing lead document' / 'filing connected document' How to get another "DocumentSequenceID" in the "Reviewed" section?

  Private static IEnumerable & lt; Object [] & gt; GetDocumentsData (string folder path = @ "file path") {return directory.GetFiles (folderpath, "* .xml"). Select (XDocument.Load). SelectMany (file = & gt; file.Descendants (). Where (E => E. Name.LocalName == "Filing Led Document"). Konkat (File. Dissidents). Where (E = & gt; E. Name.LocalName == "Filing Connected Document"). Konkat (File Disconnects). Where (E => E. Name.LocalName == "where (E => E. Name.LocalName == "Connected Document Reviewed")))). Select (documentNode = & gt; {try {var received DatNode = documentNode.Elements ()) .FirstOrDefault (e = & gt; e.phology M == "Document revived data"); Var indexNode = DocumentNode.Allements (). First and Default (E = & gt; E.name.localname == "Document Suitance IDID"); var DescriptionNode = documentNode.Elements (). FirstOr Default (E = & gt; E. Name.LocalName == "DocumentDescriptionText"); var Metadata node = documentNode.Elements () .Firstor Default (E = & gt; E. Name.LocalName == "DocumentMetatadata"); var Register ActionNode = Metadentate.Allements () .firstor Default (E => Name. Name == "Rjistrakshndiskripshntekst"); Return the new object [] {(string) documentNode.Parent.Parent.Elements (). FirstOrDefault (e = & gt; E. Name.LocalName == "Document Documentation"), Sequencenode! = Null? IndexNode.well TRIM (): string. Empty, (DateTime?) Elements (). First or Default (E => E. Name LocalName == "Date Time"), DescriptionNode! = Null? descriptionNode.Value.Trim (): string. Empty, Register ActionNode! = Null? Register ActionNode.Value.Trim (): string.Empty}; } Hold (exception e) {//Log.error (""); Return the new object [] {}; }}) ToArray (); }   

XML snippet to show two places of the sequence ID: (This filing is the associated document section)

   & Lt; nc: DocumentFileControlID s: id = "FileInputId" & gt; 111 & lt; / nc: DocumentFileControlID & gt; & Lt; nc: DocumentFileControlID s: id = "Rule6PublicAnswer" & gt; -1 & lt; / nc: DocumentFileControlID & gt; & Lt; nc: DocumentFileControlID s: id = "Rule6 Confidential Answer" & gt; -1 & lt; / nc: DocumentFileControlID & gt; & Lt; nc: DocumentFileControlID s: id = "TypeOfConfidentialDocument" & gt; -1 & lt; / Nc: DocumentFileControlID & gt; & Lt; nc: DocumentPostDate & gt; & Lt; nc: DATETIME & gt; 2014-04-09T15: 24: 06.8579836-04: 00 & lt; / nc: DATETIME & gt; & Lt; / nc: DocumentPostDate & gt; & Lt; Nc: DocumentReceivedDate & gt; & Lt; nc: DATETIME & gt; 2014-04-09T15: 24: 05.797-04: 00 & lt; / nc: DATETIME & gt; & Lt; / Nc: DocumentReceivedDate & gt; ** & lt; nc: DocumentSequenceID & gt; 10 & lt; / nc: DocumentSequenceID & gt; ** & lt; ecf: DocumentMetadata & gt;   

(this is a shared Connected document section)

  & lt; Ecf: reviewed connected document: id = "REVIEWEDDOC00003" & gt; & Lt; nc: DocumentFiledDate & gt; & Lt; nc: DATETIME & gt; 2014-04-09T00: 00: 00 & lt; / nc: DATETIME & gt; & Lt; / nc: DocumentFiledDate & gt; & Lt; nc: DocumentPostDate & gt; & Lt; nc: DATETIME & gt; 2014-04-09T15: 24: 06.857 & lt; / nc: DATETIME & gt; & Lt; / nc: DocumentPostDate & gt; & Lt; nc: DocumentReceivedDate & gt; & Lt; nc: DATETIME & gt; 2014-04-09T15: 24: 05.7 9 7 & lt; / nc: DATETIME & gt; & Lt; / Nc: DocumentReceivedDate & gt; ** & lt; nc: DocumentSequenceID & gt; 3 & lt; / nc: DocumentSequenceID & gt; ** 

To obtain the sequence ID of the first and second element in your selection, Do the following:

  var match elements = documentNode.Elements (). Where (E = & gt; E. name.localname == "Document Suuvens ID"); Var firstSequenceNode = Mailing Elements. FirstOver Default (); Var second suction node = mailing elements. Element at and default (1);   

I hope what you want.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -