[flexcoders] Namespace hell

2006-06-06 Thread ben.clinkinbeard
OK, I have posted several times now about problems caused by having
namespaces in XML in Flex (specifically Beta 3), and have gotten
virtually no responses. Please, someone respond, even if to say I
have the same problem or this can't be done. I am beginning to
think that Flex is simply not very capable in this area. I seriously
hope this is not the case.

Default namespaces seem to be the most problematic, as they seem to
prevent the XML from even being used as a DataProvider. Take this
simple setup.

===
var entries:XML = 
rootNode xmlns=http://site.com/Back/DocMetadata;
Entry
  CreateDate5/5/2006 9:56:30 AM/CreateDate
  DocumentTypeRPR/DocumentType
/Entry
Entry
  CreateDate5/3/2006 3:07:27 PM/CreateDate
  DocumentTypeRPR/DocumentType
/Entry
/rootNode;

namespace d = http://site.com/Back/DocMetadata;;
var list:XMLListCollection = new XMLListCollection(entries.d::Entry);
myDataGrid.dataProvider = list;

mx:DataGrid id=myDataGrid x=10 y=247 width=536 height=230
mx:columns
mx:DataGridColumn headerText=Column 1 
dataField=CreateDate/
mx:DataGridColumn headerText=Column 2 
dataField=DocumentType/
/mx:columns
/mx:DataGrid
===

This results in the DataGrid being populated with 2 items, but there
is no text displayed. You simply have empty rollovers. However, if you
remove the namespace from the xml and update the AS accordingly,
everything works correctly, with text being displayed as expected. Is
this really a shortcoming of Flex or am I missing something really simple?

Thanks,
Ben





 Yahoo! Groups Sponsor ~-- 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




RE: [flexcoders] Namespace hell

2006-06-06 Thread Tobias Patton










Hi Ben;



You can get this to work using the
labelFunction property of the DataGridColumn.



?xml
version=1.0 encoding=utf-8?

mx:Application
xmlns:mx=http://www.adobe.com/2006/mxml
layout=absolute



 mx:Script

 ![CDATA[

 import
mx.controls.dataGridClasses.DataGridColumn;

 import
mx.collections.XMLListCollection;

 [
Bindable ]

 public
var entries:XML = 

 rootNode
xmlns=http://site.com/Back/DocMetadata

 Entry

 CreateDate5/5/2006
9:56:30 AM/CreateDate

 DocumentTypeRPR/DocumentType

 /Entry

 Entry

 CreateDate5/3/2006 3:07:27
PM/CreateDate

 DocumentTypeRPR/DocumentType

 /Entry

 /rootNode; 

 

 public
var ns : Namespace = new Namespace(
http://site.com/Back/DocMetadata );

 

 public
function LabelFunctionDate( item : Object, column : DataGridColumn ) : String

 {

 return
XML( item ).ns::CreateDate[ 0 ].toString();

 }

 

 public
function LabelFunctionType( item : Object, column : DataGridColumn ) : String

 {

 return
XML( item ).ns::DocumentType[ 0 ].toString();

 }

 

 ]]

 /mx:Script



 mx:DataGrid
id=myDataGrid x=10 y=247
width=536 height=230

 dataProvider={entries.ns::Entry} 

 mx:columns

 mx:DataGridColumn
headerText=Column 1
labelFunction=LabelFunctionDate/

 mx:DataGridColumn
headerText=Column 2
labelFunction=LabelFunctionType/

 /mx:columns

 /mx:DataGrid



/mx:Application











From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard
Sent: Tuesday, June 06, 2006 10:43
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Namespace
hell











OK, I have posted several times now about problems
caused by having
namespaces in XML in Flex (specifically Beta 3), and have gotten
virtually no responses. Please, someone respond, even if to say I
have the same problem or this can't be done. I am beginning
to
think that Flex is simply not very capable in this area. I seriously
hope this is not the case.

Default namespaces seem to be the most problematic, as they seem to
prevent the XML from even being used as a DataProvider. Take this
simple setup.

===
var entries:XML = 
rootNode xmlns=http://site.com/Back/DocMetadata
Entry
CreateDate5/5/2006 9:56:30 AM/CreateDate
DocumentTypeRPR/DocumentType
/Entry
Entry
CreateDate5/3/2006 3:07:27 PM/CreateDate
DocumentTypeRPR/DocumentType
/Entry
/rootNode;

namespace d = http://site.com/Back/DocMetadata;
var list:XMLListCollection = new XMLListCollection(entries.d::Entry);
myDataGrid.dataProvider = list;

mx:DataGrid id=myDataGrid x=10 y=247
width=536 height=230
mx:columns
mx:DataGridColumn headerText=Column 1
dataField=CreateDate/
mx:DataGridColumn headerText=Column 2
dataField=DocumentType/
/mx:columns
/mx:DataGrid
===

This results in the DataGrid being populated with 2 items, but there
is no text displayed. You simply have empty rollovers. However, if you
remove the namespace from the xml and update the AS accordingly,
everything works correctly, with text being displayed as expected. Is
this really a shortcoming of Flex or am I missing something really simple?

Thanks,
Ben






__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___