S
Sudip_inn
Guest
This is my sample xml
<?xml version="1.0" encoding="utf-8"?>
<TickerBrokerStandardDateLineitem>
<Ticker />
<TickerID />
<TickerBrokerStandardDateLineitemValues>
<TickerBrokerStandardDateLineitemValue>
<TabName>Consensus Model</TabName>
<StandardDate>1Q 2010</StandardDate>
<BRTab>Income Statement</BRTab>
<BRLineItem>NET REVENUES</BRLineItem>
<Action>Extracted</Action>
<StandardLineItem>Net Revenue</StandardLineItem>
<StandardValue>329.623</StandardValue>
</TickerBrokerStandardDateLineitemValue>
<TickerBrokerStandardDateLineitemValue>
<TabName>Consensus Model</TabName>
<StandardDate>2Q 2010</StandardDate>
<BRTab>Income Statement</BRTab>
<BRLineItem>NET REVENUES</BRLineItem>
<Action>Extracted</Action>
<StandardLineItem>Net Revenue</StandardLineItem>
<StandardValue>454.776</StandardValue>
</TickerBrokerStandardDateLineitemValue>
</TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>
i want to get only those records whose StandardValue is not empty or null. after apply this filter how can i get filter xml string ?
i did it this way but could not get filtered xml
XDocument doc = XDocument.Load(brokerBogeypath);
var query = from r in doc.Descendants("TickerBrokerStandardDateLineitemValue")
where !string.IsNullOrEmpty((string)r.Element("StandardValue"))
select new
{
TabName = r.Element("TabName").Value,
StandardDate = r.Element("StandardDate").Value,
BRTab = r.Element("BRTab").Value,
BRLineItem = r.Element("BRLineItem").Value,
Action = r.Element("Action").Value,
StandardLineItem = r.Element("StandardLineItem").Value,
StandardValue = r.Element("StandardValue").Value,
};
doc.ToString() giving me whole xml not after applying filter. can i write query.tostring() ? please help.
Continue reading...
<?xml version="1.0" encoding="utf-8"?>
<TickerBrokerStandardDateLineitem>
<Ticker />
<TickerID />
<TickerBrokerStandardDateLineitemValues>
<TickerBrokerStandardDateLineitemValue>
<TabName>Consensus Model</TabName>
<StandardDate>1Q 2010</StandardDate>
<BRTab>Income Statement</BRTab>
<BRLineItem>NET REVENUES</BRLineItem>
<Action>Extracted</Action>
<StandardLineItem>Net Revenue</StandardLineItem>
<StandardValue>329.623</StandardValue>
</TickerBrokerStandardDateLineitemValue>
<TickerBrokerStandardDateLineitemValue>
<TabName>Consensus Model</TabName>
<StandardDate>2Q 2010</StandardDate>
<BRTab>Income Statement</BRTab>
<BRLineItem>NET REVENUES</BRLineItem>
<Action>Extracted</Action>
<StandardLineItem>Net Revenue</StandardLineItem>
<StandardValue>454.776</StandardValue>
</TickerBrokerStandardDateLineitemValue>
</TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>
i want to get only those records whose StandardValue is not empty or null. after apply this filter how can i get filter xml string ?
i did it this way but could not get filtered xml
XDocument doc = XDocument.Load(brokerBogeypath);
var query = from r in doc.Descendants("TickerBrokerStandardDateLineitemValue")
where !string.IsNullOrEmpty((string)r.Element("StandardValue"))
select new
{
TabName = r.Element("TabName").Value,
StandardDate = r.Element("StandardDate").Value,
BRTab = r.Element("BRTab").Value,
BRLineItem = r.Element("BRLineItem").Value,
Action = r.Element("Action").Value,
StandardLineItem = r.Element("StandardLineItem").Value,
StandardValue = r.Element("StandardValue").Value,
};
doc.ToString() giving me whole xml not after applying filter. can i write query.tostring() ? please help.
Continue reading...