I have a slightly confusing problem with my Linux query against an XML file. This attribute value is correctly (< Code> GB ). However, when I give a different attribute value, for example: This is my query: Here are some sample XML data: Is there any place that I have done wrong here? Why will it work for The first element of that type will return, and its "regionId" will be examined. Instead, with: Edit: OK, so you wanted matching copied codegax item. I thought that you wanted to bundle the first element with the match. Then the solution is very simple. jE I have no element in a
sequence error, still the element is explicitly in the XML document is present?
Return (n to xml.Descendants ("postalCodeData") where n.Element ("postCodeRegex"). Attribute ("regionId") Select value == iSCode n.Element ("postCodeRegex").). Single (). ToString ();
& lt; PostalCodeData & gt; & Lt; PostCodeRegex regionId = "GB" & gt; GIR []? 0AA | ((BB | BL | BA | Bb | BD | BH | BL | BN | BR | BS | BT | CA | CB | CF | CH | CM | CO | CR | CT | CV | CW | DA | DD | DAY | DG | DH | DL | DN | DT | DY | E | EC | EH | N | Former | FK | Financial Year | G | GL | GY | GU | H | HD | HG | Himachal Pradesh | HR | HS | HU | HX | IG | IM | IP | IV | JE | KA | KT | KW | KY | L | LA | LY | LE | LLLL | LN | Lok Sabha | LU | M | ME | MK | A L | n | ne | ng | nn | np | nr | nw | official language | ox | PA | pe | pH | pl | p | pr | rg | r | rm | s | sa | se | sg | shk | SL | SM | SN | As | SP | SR | SS | Scheduled Tribe | SW | SY | Territorial Army | TD | TF | TamilNadu | TQ | TR | TS | TW | UB | W | Washington | WC | WD | WF | WN | WR | WS | WV | YO | ZE) (\ d [\ dA-Z]? []? \ D [ABD-HJLN-UW-Z] {2})). BFPO []? \ D {1,4} & lt; / PostCodeRegex & gt; & Lt; PostCodeRegex regionId = "JE" & gt; Je \ d [\ dA-Z]? []? \ D [ABD-HJLN-UW-Z] {2} & lt; / PostCodeRegex & gt; & Lt; PostCodeRegex regionId = "GG" & gt; JY \ d [\ dA-Z]? []? \ D [ABD-HJLN-UW-Z] {2} & lt; / PostCodeRegex & gt; & Lt; / PostalCodeData & gt;
GB and for others?
N.Element ("postCodeRegex")
where n.Elements ("postCodeRegex"). Edit any: (element = & gt; element.Attribute ("regionId"). Value == isoCode)
Return (n to xml.Descendants ("postCodeRegex") where n.Attribute ("regionId"). Value == isoCode n.ToString () Select;; < / Pre>
No comments:
Post a Comment