S
Sudip_inn
Guest
my XML data look like
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfTickerSectionLI xmlns:xsd="XML Schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TickerSectionLI>
<Ticker>AAPL</Ticker>
<Section>Consensus Model</Section>
<LI>Net Sales</LI>
<StandrdFormula />
<StandrdFormulaActual />
<AllowedDecimalPlace>1</AllowedDecimalPlace>
<CurrencySign>$</CurrencySign>
<CurrencyCode>en-US</CurrencyCode>
<AllowPercentageSign>false</AllowPercentageSign>
<AllowComma>true</AllowComma>
<QCCheck>false</QCCheck>
<QCType>SUMQ</QCType>
<BlueMatrix1stElement>Reserved</BlueMatrix1stElement>
<BlueMatrix1stElementFormula />
<ActualProvidedByCompany />
<DevelopmentStage />
<CrossCalc1Q />
<CrossCalc2Q />
<CrossCalc3Q />
<CrossCalc4Q />
<CrossCalcFY />
<LIStatus />
<GrpHeader />
<GH_Font />
<GH_FontStyle>Regular</GH_FontStyle>
<GH_FontStyle />
<GH_Strikeout>false</GH_Strikeout>
<GH_Color />
<SubHeader />
<SubHeaderStyle />
<Font />
<FontStyle>Regular</FontStyle>
<Size />
<Strikeout>false</Strikeout>
<Color />
<SummaryTab>YES</SummaryTab>
</TickerSectionLI>
<TickerSectionLI>
<Ticker>AAPL</Ticker>
<Section>Consensus Model</Section>
<LI>Revenue Growth- Reported</LI>
<StandrdFormula />
<StandrdFormulaActual />
<AllowedDecimalPlace>1</AllowedDecimalPlace>
<CurrencySign>%</CurrencySign>
<CurrencyCode />
<AllowPercentageSign>true</AllowPercentageSign>
<AllowComma>true</AllowComma>
<QCCheck>false</QCCheck>
<QCType />
<BlueMatrix1stElement></BlueMatrix1stElement>
<BlueMatrix1stElementFormula />
<ActualProvidedByCompany />
<DevelopmentStage />
<CrossCalc1Q>"Consensus Model~Net Sales~1Q 2017~9999"/"Consensus Model~Net Sales~1Q 2016~9999"</CrossCalc1Q>
<CrossCalc2Q>"Consensus Model~Net Sales~2Q 2017~9999"/"Consensus Model~Net Sales~2Q 2016~9999"</CrossCalc2Q>
<CrossCalc3Q>"Consensus Model~Net Sales~3Q 2017~9999"/"Consensus Model~Net Sales~3Q 2016~9999"</CrossCalc3Q>
<CrossCalc4Q>"Consensus Model~Net Sales~4Q 2017~9999"/"Consensus Model~Net Sales~4Q 2016~9999"</CrossCalc4Q>
<CrossCalcFY>"Consensus Model~Net Sales~2017 FY~9999"/"Consensus Model~Net Sales~2016 FY~9999"</CrossCalcFY>
<LIStatus />
<GrpHeader />
<GH_Font />
<GH_FontStyle>Regular</GH_FontStyle>
<GH_FontStyle />
<GH_Strikeout>false</GH_Strikeout>
<GH_Color />
<SubHeader />
<SubHeaderStyle />
<Font />
<FontStyle>Regular</FontStyle>
<Size />
<Strikeout>false</Strikeout>
<Color />
<SummaryTab>NO</SummaryTab>
</TickerSectionLI>
</ArrayOfTickerSectionLI>
i query this way
var items = (from item in xmlDoc.Descendants("TickerSectionLI")
where item.Element("TabName").Value.Trim().ToUpper() == "aaa"
&& item.Element("StandardLineItem").Value.Trim().ToUpper() == "bbb"
select item).ToList();
foreach (var item in items)
{
item.Remove();
isdeleted = true;
}
Error message is
An unhandled exception of type 'System.NullReferenceException' occurred in Utility.dll
Additional information: Object reference not set to an instance of an object.
please guide me where i made mistake ? thanks
Continue reading...
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfTickerSectionLI xmlns:xsd="XML Schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TickerSectionLI>
<Ticker>AAPL</Ticker>
<Section>Consensus Model</Section>
<LI>Net Sales</LI>
<StandrdFormula />
<StandrdFormulaActual />
<AllowedDecimalPlace>1</AllowedDecimalPlace>
<CurrencySign>$</CurrencySign>
<CurrencyCode>en-US</CurrencyCode>
<AllowPercentageSign>false</AllowPercentageSign>
<AllowComma>true</AllowComma>
<QCCheck>false</QCCheck>
<QCType>SUMQ</QCType>
<BlueMatrix1stElement>Reserved</BlueMatrix1stElement>
<BlueMatrix1stElementFormula />
<ActualProvidedByCompany />
<DevelopmentStage />
<CrossCalc1Q />
<CrossCalc2Q />
<CrossCalc3Q />
<CrossCalc4Q />
<CrossCalcFY />
<LIStatus />
<GrpHeader />
<GH_Font />
<GH_FontStyle>Regular</GH_FontStyle>
<GH_FontStyle />
<GH_Strikeout>false</GH_Strikeout>
<GH_Color />
<SubHeader />
<SubHeaderStyle />
<Font />
<FontStyle>Regular</FontStyle>
<Size />
<Strikeout>false</Strikeout>
<Color />
<SummaryTab>YES</SummaryTab>
</TickerSectionLI>
<TickerSectionLI>
<Ticker>AAPL</Ticker>
<Section>Consensus Model</Section>
<LI>Revenue Growth- Reported</LI>
<StandrdFormula />
<StandrdFormulaActual />
<AllowedDecimalPlace>1</AllowedDecimalPlace>
<CurrencySign>%</CurrencySign>
<CurrencyCode />
<AllowPercentageSign>true</AllowPercentageSign>
<AllowComma>true</AllowComma>
<QCCheck>false</QCCheck>
<QCType />
<BlueMatrix1stElement></BlueMatrix1stElement>
<BlueMatrix1stElementFormula />
<ActualProvidedByCompany />
<DevelopmentStage />
<CrossCalc1Q>"Consensus Model~Net Sales~1Q 2017~9999"/"Consensus Model~Net Sales~1Q 2016~9999"</CrossCalc1Q>
<CrossCalc2Q>"Consensus Model~Net Sales~2Q 2017~9999"/"Consensus Model~Net Sales~2Q 2016~9999"</CrossCalc2Q>
<CrossCalc3Q>"Consensus Model~Net Sales~3Q 2017~9999"/"Consensus Model~Net Sales~3Q 2016~9999"</CrossCalc3Q>
<CrossCalc4Q>"Consensus Model~Net Sales~4Q 2017~9999"/"Consensus Model~Net Sales~4Q 2016~9999"</CrossCalc4Q>
<CrossCalcFY>"Consensus Model~Net Sales~2017 FY~9999"/"Consensus Model~Net Sales~2016 FY~9999"</CrossCalcFY>
<LIStatus />
<GrpHeader />
<GH_Font />
<GH_FontStyle>Regular</GH_FontStyle>
<GH_FontStyle />
<GH_Strikeout>false</GH_Strikeout>
<GH_Color />
<SubHeader />
<SubHeaderStyle />
<Font />
<FontStyle>Regular</FontStyle>
<Size />
<Strikeout>false</Strikeout>
<Color />
<SummaryTab>NO</SummaryTab>
</TickerSectionLI>
</ArrayOfTickerSectionLI>
i query this way
var items = (from item in xmlDoc.Descendants("TickerSectionLI")
where item.Element("TabName").Value.Trim().ToUpper() == "aaa"
&& item.Element("StandardLineItem").Value.Trim().ToUpper() == "bbb"
select item).ToList();
foreach (var item in items)
{
item.Remove();
isdeleted = true;
}
Error message is
An unhandled exception of type 'System.NullReferenceException' occurred in Utility.dll
Additional information: Object reference not set to an instance of an object.
please guide me where i made mistake ? thanks
Continue reading...