0 Replies Latest reply on Oct 4, 2007 4:10 PM by

    Mixing XML namespaces in datagrid

      I'm having a problem when retrieving an XML document containing nodes from multiple namespaces and trying to display the values in a dataGrid. The short code below illustrates the issue by retrieving a document from the web containing a DDI-XML codeBook wrapped in a SRU Retrieve envelope. The wrapping elements belong to the SRU http://www.loc.gov/zing/srw/ namespace and the DDI codebook to the http://www.icpsr.umich.edu/DDI namespace.

      Using the dataGridColum dataField, I'm able to retrieve elements from the root of the ddi::codeBook (@ID attribute) but values from the children elements do not display in the table. I do not have this problem if I tried to access then directly in a mx:Text container.

      I'm using Flex 3 beta 2 and I'm about to report this as a bug but first want to check if anyone has any comment/suggestion on this issue.
      many thanks

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      import mx.controls.Alert;
      import mx.utils.StringUtil;
      public var sru:Namespace = new Namespace(" http://www.loc.gov/zing/srw/");
      public var ddi:Namespace = new Namespace(" http://www.icpsr.umich.edu/DDI");

      private function send_surveys_data():void {

      <mx:HTTPService id="DDISurveys"
      url=" http://www.opendatafoundation.org/bdbxml_catalog/DDICatalogServlet?target=surveys&amp;perp age=2&amp;brief"
      fault="Alert.show(event.fault.faultString), 'Error'"

      <mx:Canvas width="640" height="435">
      <mx:Button click="send_surveys_data()" x="10" y="10" label="Test"/>
      <mx:DataGrid id="surveys" width="620" dataProvider="{DDISurveys.lastResult.sru::records.sru::record.sru::recordData.ddi::codeBo ok}" y="40" x="10" height="233">
      <mx:DataGridColumn id="ID" dataField="@ID" />
      <mx:DataGridColumn id="titl" dataField="ddi::stdyDscr.ddi::citation.ddi::titlStmt.ddi::titl" />
      <mx:DataGridColumn id="version" dataField="ddi::stdyDscr.ddi::citation.ddi::verStmt.ddi::version.@date" />

      <mx:Text text="{DDISurveys.lastResult.sru::records.sru::record.sru::recordData.ddi::codeBook.ddi:: stdyDscr.ddi::citation.ddi::titlStmt.ddi::titl}" x="10" y="281" width="620"/>
      <mx:Text text="{DDISurveys.lastResult.sru::records.sru::record.sru::recordData.ddi::codeBook.ddi:: stdyDscr.ddi::citation.ddi::verStmt.ddi::version.@date}" x="10" y="350" width="620"/>