2011-09-08 2 views
0

要件は です。フレックスのHttpServiceタグから受け取ったXML文書があります。コンボボックスにxml docのIDコンテンツを挿入する必要があります。コンボボックスとxml docをロードするときの問題

<head> 
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> 
<title>JSP Page</title> 
</head> 
<body> 
<h2>Directory Service WP</h2> 
<h3>Starting DS Service</h3> 
<hr/> 
SSL hostname verified. 
<hr/> 
Request sent. 
<hr/> 
<message> 
    <params> 
    <IncidendID> 
     <ID>Incident-140c169f-1cd6-4ec5-a5d0-0aff303bbfec</ID> 
    <ID>Incident-fff5ba34-6b42-4feb-859e-0bafbdf1c542</ID> 
    <ID>Incident-87fcf355-4d00-4743-bc29-999aef8c8386</ID> 
    <ID>Incident-c3f89a1b-7791-4405-a20f-f33239cb4773</ID> 
    <ID>Incident-ac4a5fec-6414-444c-bad7-be43350d7d0a</ID> 
    <ID>Incident-87b71101-ace3-425e-806c-ba4fc6271571</ID> 
    <ID>Incident-19865863-6882-4669-bbd7-263c32ea01f8</ID> 
    <ID>Incident-c08be10a-9b99-4819-9132-1f18a271d278</ID> 
    <ID>Incident-913112c8-414b-41f8-ba1d-fadb7ed97e80</ID> 
    <ID>Incident-5c3ba408-0138-49b7-9fac-410aa709baa4</ID> 
    <ID>Incident-40fa5264-ae1a-42fd-8cdf-20f69c5eaa80</ID> 
    <ID>Incident-85333369-195c-4359-af65-045d072be377</ID> 
    <ID>Incident-fcfd1385-ac64-40b2-8d26-66e6a23d07e3</ID> 
    <ID>Incident-d255929d-0bcf-4a1c-9abf-7c2e4804fa74</ID> 
    <ID>Incident-de2f591e-982a-434d-ab60-8170bacdddbd</ID> 
    <ID>Incident-f33de939-a025-4033-9486-90f2916021f1</ID> 
    <ID>Incident-53b5822a-7663-4c94-8014-ace38b634ad3</ID> 
    <ID>Incident-8a3d83fe-5e01-401d-8a2a-e1f495ef7fbd</ID> 
    <ID>Incident-1ef1694a-ed7a-4ac8-a422-55ca806a1169</ID> 
    <ID>Incident-9003c195-ad83-4cc7-9f43-dab11b360d8a</ID> 
    <ID>Incident-767e2afb-d17e-455c-a3b6-a83ec547bd67</ID> 
    <ID>Incident-515a009b-edaa-402c-a920-0f968e7c9099</ID> 
    <ID>Incident-a01e1da2-a59c-4b18-a6c1-a8e82cdc7296</ID> 
    <ID>Incident-3e2f8957-ee24-4b4f-b76e-6039936c5e31</ID> 
    <ID>Incident-7f1c3b5a-fa7d-4a74-8deb-a5affb043691</ID> 
    </IncidendID> 
    </params> 
</message> 
</body> 

とフレックスコードは次のとおりです: XMLドキュメントがある

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
      xmlns:maps="com.google.maps.*" 
      viewSourceURL="srcview/index.html"> 

<mx:Script source="Assets/getInZip.as" />    

<mx:states> 
    <mx:State name="loading"> 
     <mx:AddChild relativeTo="{this}" position="lastChild"> 
      <mx:ProgressBar id="loadProgress" width="100%" /> 
     </mx:AddChild>   
    </mx:State> 
    <mx:State name="error"> 
     <mx:AddChild relativeTo="{this}" position="lastChild"> 
      <mx:Label id="errorLabel" /> 
     </mx:AddChild> 
    </mx:State> 
</mx:states> 
<mx:HTTPService id="httpA" result="ResultFn(event)" url="http://localhost:8084/GetIncidentId/getIncidents.jsp" resultFormat="xml"/> 
<mx:Button id="bttnHttpA" label="Get Data" click="httpA.send()"/> 
<mx:ComboBox id="IncCbx"></mx:ComboBox> 
    <mx:Script> 
    <![CDATA[ 
       all imports 
     private function ResultFn(event:ResultEvent):void 
     { 

       Alert.show("Hey... event form HTTP 1"); 
       //IncIdArr = XMLListCollection(event.result); 
       //Alert.show("IncIdArr" + IncIdArr); 
       var retxml:XML = XML(event.result); 
       Alert.show("list: " + retxml.children());  

       //Alert.show("Result:" + retxml); 
       IncCbx.dataProvider = retxml.children(); 
      } 

これで助けが必要。

ありがとうございました。

答えて

0

ID要素が表示しようとしている場合は、ID要素を分離する必要があります。試してみよう:

private function ResultFn(event:ResultEvent):void { 
    var retxml:XML = MXL(event.result); 
    IncCbx.dataProvider = new XMLListCollection(retxml.body.message.params.IncidendID.ID); 
} 
関連する問題