EDN Admin
Well-known member
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal I have following XML,
<pre class="prettyprint" style=" <HotelProduct PricingSource="System" InventorySource="System" ExternalDetailsObtained="false" Code="IAI06" Category="4R" InstantPurchase="false
<Description>Deluxe Guest Room</Description>
<Supplier Type="Hotel" Code="LIAIS" City="WAS"/>
<InventoryDetails Status="Available
<ExtendedInventoryDetails MaximumAvailable="3
<InventoryProduct Code="IAI06" City="WAS"/>
</ExtendedInventoryDetails>
</InventoryDetails>
<PriceDetails PricingDuration="5" Price="765.00" IncludesBonusNights="false"/>
<DescriptiveItineraryText>
<Text Heading="true Check In: 3:00 pm</Text>
<Text/>
<Text>Hotel is situated in the heart of the capital city the hotel is</Text>
<Text>close to all of the citys major attractions. Centrally located</Text>
<Text>on New Jersey Avenue close to nearby dining and shopping.</Text>
</DescriptiveItineraryText>
<DurationDetails MinimumDuration="1" MaximumDuration="99"/>
<DateBands>
<DateBand EffectiveToDate="2012-11-26" EffectiveFromDate="2012-11-16
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
<MealOptions>
<MealOption Code="0
<Description>No Meals Included</Description>
</MealOption>
</MealOptions>
</DateBand>
<DateBand EffectiveToDate="2013-02-10" EffectiveFromDate="2012-11-27
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
<DateBand EffectiveToDate="2013-02-25" EffectiveFromDate="2013-02-11
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
<DateBand EffectiveToDate="2013-02-27" EffectiveFromDate="2013-02-26
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
<DateBand EffectiveToDate="2013-03-17" EffectiveFromDate="2013-02-28
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
</DateBands>
</HotelProduct>[/code]
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal I wanted to get all values of Text in Descriptiveitinerarytext element and create a string builder. <br/>
<br/>
I have tried following query in LINQ,
<pre class="prettyprint" style=" IEnumerable<string> textSegs = from seg in _hotel.Descendants("DescriptiveItineraryText")
from text in seg.Descendants("Text")
select (string)text;
string str = textSegs.Aggregate(new StringBuilder(), (sb, i) => sb.Append(i), sp => sp.ToString());[/code]
<br/>
<span style="color:#222222; font-family:Verdana,sans-serif; font-size:14px; line-height:21px I have declared _hotel as XElement<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal I am not getting expected result. <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal Any suggestion would be helpful. <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal Thanks.<br/>
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<br/>
<br/>
View the full article
<pre class="prettyprint" style=" <HotelProduct PricingSource="System" InventorySource="System" ExternalDetailsObtained="false" Code="IAI06" Category="4R" InstantPurchase="false
<Description>Deluxe Guest Room</Description>
<Supplier Type="Hotel" Code="LIAIS" City="WAS"/>
<InventoryDetails Status="Available
<ExtendedInventoryDetails MaximumAvailable="3
<InventoryProduct Code="IAI06" City="WAS"/>
</ExtendedInventoryDetails>
</InventoryDetails>
<PriceDetails PricingDuration="5" Price="765.00" IncludesBonusNights="false"/>
<DescriptiveItineraryText>
<Text Heading="true Check In: 3:00 pm</Text>
<Text/>
<Text>Hotel is situated in the heart of the capital city the hotel is</Text>
<Text>close to all of the citys major attractions. Centrally located</Text>
<Text>on New Jersey Avenue close to nearby dining and shopping.</Text>
</DescriptiveItineraryText>
<DurationDetails MinimumDuration="1" MaximumDuration="99"/>
<DateBands>
<DateBand EffectiveToDate="2012-11-26" EffectiveFromDate="2012-11-16
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
<MealOptions>
<MealOption Code="0
<Description>No Meals Included</Description>
</MealOption>
</MealOptions>
</DateBand>
<DateBand EffectiveToDate="2013-02-10" EffectiveFromDate="2012-11-27
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
<DateBand EffectiveToDate="2013-02-25" EffectiveFromDate="2013-02-11
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
<DateBand EffectiveToDate="2013-02-27" EffectiveFromDate="2013-02-26
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
<DateBand EffectiveToDate="2013-03-17" EffectiveFromDate="2013-02-28
<Applicability SplitRates="true" BaseRates="false"/>
<CheckOutDetails StandardCheckOutTime="12:00:00"/>
</DateBand>
</DateBands>
</HotelProduct>[/code]
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal I wanted to get all values of Text in Descriptiveitinerarytext element and create a string builder. <br/>
<br/>
I have tried following query in LINQ,
<pre class="prettyprint" style=" IEnumerable<string> textSegs = from seg in _hotel.Descendants("DescriptiveItineraryText")
from text in seg.Descendants("Text")
select (string)text;
string str = textSegs.Aggregate(new StringBuilder(), (sb, i) => sb.Append(i), sp => sp.ToString());[/code]
<br/>
<span style="color:#222222; font-family:Verdana,sans-serif; font-size:14px; line-height:21px I have declared _hotel as XElement<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal I am not getting expected result. <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal Any suggestion would be helpful. <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal <br style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal Thanks.<br/>
<span style="color:#111111; font-family:Segoe UI,Arial,sans-serif; font-size:14px; line-height:normal
<br/>
<br/>
View the full article