R
Raghuvansh
I am databinding a grid to an XML source (given below).
I am displaying the grid contents inside an
TemplateColumn/ItemTemplate using regular <%#
DataBinder.Eval(Container.DataItem, "Net-Change-Price") %> tags.
My question is:
How can I access/display the attributes of an XML node. More
specifically in the current example, how can I access/display 'symbol'
attribute in the 'equity-quote' node?
Thanks in advance.
Databinding code:
-------
MyStocksDataSet.ReadXml(http://quotes.nasdaq.com/quote.dll?mode=stock&page=xml&symbol=BAESF)
MyStocksDataGrid.DataSource = MyStocksDataSet
MyStocksDataGrid.DataBind()
XML
------
<?xml version="1.0" ?>
<nasdaqamex-dot-com>
<equity-quote symbol="BAESF" ilx-symbol="BAESF"
hyperfeed-symbol="BAESF" telesphere-symbol="BAESF" cusip="G1489618">
<issue-name>BAES SYSTEMS PLC</issue-name>
<market-status>O</market-status>
<market-center-code>Other OTC</market-center-code>
<issue-type-code>Foreign Issue</issue-type-code>
<todays-high-price>0</todays-high-price>
<todays-low-price>0</todays-low-price>
<fifty-two-wk-high-price>3.2</fifty-two-wk-high-price>
<fifty-two-wk-low-price>1.75</fifty-two-wk-low-price>
<last-sale-price>2.925</last-sale-price>
<net-change-price>unch</net-change-price>
<net-change-pct>unch</net-change-pct>
<share-volume-qty>0</share-volume-qty>
<previous-close-price>2.925</previous-close-price>
<current-pe-ratio>N/A</current-pe-ratio>
<total-outstanding-shares-qty>0</total-outstanding-shares-qty>
<current-yield-pct>0.000000</current-yield-pct>
<earnings-actual-eps-amt>0</earnings-actual-eps-amt>
<cash-dividend-amt>0</cash-dividend-amt>
<cash-dividend-ex-date>19691231</cash-dividend-ex-date>
<sp500-beta-num>0.200000</sp500-beta-num>
<trade-datetime>20031217 10:17:24</trade-datetime>
<trading-status>ACTIVE</trading-status>
<market-capitalization-amt>0</market-capitalization-amt>
<option-root-symbol symbol="" />
</equity-quote>
</nasdaqamex-dot-com>
I am displaying the grid contents inside an
TemplateColumn/ItemTemplate using regular <%#
DataBinder.Eval(Container.DataItem, "Net-Change-Price") %> tags.
My question is:
How can I access/display the attributes of an XML node. More
specifically in the current example, how can I access/display 'symbol'
attribute in the 'equity-quote' node?
Thanks in advance.
Databinding code:
-------
MyStocksDataSet.ReadXml(http://quotes.nasdaq.com/quote.dll?mode=stock&page=xml&symbol=BAESF)
MyStocksDataGrid.DataSource = MyStocksDataSet
MyStocksDataGrid.DataBind()
XML
------
<?xml version="1.0" ?>
<nasdaqamex-dot-com>
<equity-quote symbol="BAESF" ilx-symbol="BAESF"
hyperfeed-symbol="BAESF" telesphere-symbol="BAESF" cusip="G1489618">
<issue-name>BAES SYSTEMS PLC</issue-name>
<market-status>O</market-status>
<market-center-code>Other OTC</market-center-code>
<issue-type-code>Foreign Issue</issue-type-code>
<todays-high-price>0</todays-high-price>
<todays-low-price>0</todays-low-price>
<fifty-two-wk-high-price>3.2</fifty-two-wk-high-price>
<fifty-two-wk-low-price>1.75</fifty-two-wk-low-price>
<last-sale-price>2.925</last-sale-price>
<net-change-price>unch</net-change-price>
<net-change-pct>unch</net-change-pct>
<share-volume-qty>0</share-volume-qty>
<previous-close-price>2.925</previous-close-price>
<current-pe-ratio>N/A</current-pe-ratio>
<total-outstanding-shares-qty>0</total-outstanding-shares-qty>
<current-yield-pct>0.000000</current-yield-pct>
<earnings-actual-eps-amt>0</earnings-actual-eps-amt>
<cash-dividend-amt>0</cash-dividend-amt>
<cash-dividend-ex-date>19691231</cash-dividend-ex-date>
<sp500-beta-num>0.200000</sp500-beta-num>
<trade-datetime>20031217 10:17:24</trade-datetime>
<trading-status>ACTIVE</trading-status>
<market-capitalization-amt>0</market-capitalization-amt>
<option-root-symbol symbol="" />
</equity-quote>
</nasdaqamex-dot-com>