开发者

How to show custom xml text contents in tree

开发者 https://www.devze.com 2023-03-09 22:02 出处:网络
I have an xml file it\'s structure like down below : <Bookmark> <Title Action=\"GoTo\" Page=\"14 FitH 670\" >1. internal diseases

I have an xml file it's structure like down below :

<Bookmark>
  <Title Action="GoTo" Page="14 FitH 670" >1. internal diseases
    <Title Action="GoTo" Page="14 FitH 463" >gastroesophageal reflu
</Title>
    <Title Action="GoTo" Page="15 FitH 600" >gastritis
</Title>
    <Title Action="GoTo" Page="15 FitH 215" >peptic ulcer
</Title>...

I looked for couple of examples It uses Xml attributes to shows as tree components' labels. But I want to show these xml text contents in tree component. But i couldn't find an example how to show a开发者_如何学编程s label these xml text contents. Hope you can help me out to find a solution thanks.


To get the contents of an XML node, navigate to the desired node using the E4X standards built in to as3. A great resource for this is the following site: http://dispatchevent.org/roger/as3-e4x-rundown/

The following is an example of how to trace the contents of the <Title> node with the attribute "15 FitF 600":

var xml:XML = 
<Bookmark>
  <Title Action="GoTo" Page="14 FitH 670" >1. internal diseases</Title>
  <Title Action="GoTo" Page="14 FitH 463" >gastroesophageal reflu</Title>
  <Title Action="GoTo" Page="15 FitH 600" >gastritis</Title>
  <Title Action="GoTo" Page="15 FitH 215" >peptic ulcer</Title>
</Bookmark>

trace (xml.Title.(@Page == "15 FitH 600")); //gastritis
trace (xml.Title.(@Page == "15 FitH 600").toString()); //gastritis
trace (xml.Title.(@Page == "15 FitH 600").valueOf()); //gastritis
trace (xml.Title.(@Page == "15 FitH 600").toXMLString()); //<Title Action="GoTo" Page="15 FitH 600">gastritis</Title>
0

精彩评论

暂无评论...
验证码 换一张
取 消