List Info

Thread: ConfigLoader : access to attributes




ConfigLoader : access to attributes
user name
2007-04-19 08:10:57
Hi list,
I'm new to Pixlib and I'm trying to access to the data I have in the attributes of an XML config file. I use this code :
       
        var libs:LibStack = new LibStack();
        libs.setAntiCache(true);
 ;     
        // -- xml
   ;     libs.enqueue( new ConfigLoader(), "formation", "xml/formation1.xml");
        libs.addEventListener( LibStack.onLoadProgressEVENT, this );
 ;       libs.addEventListener( LibStack.onLoadCompleteEVENT, this, _onConfigLoaded );
        libs.execute();


Unfortunatly, if I try to get a log on my load object (Debug.INFO( Config.getInstance());) I get an object in witch I find my nodes' content but not the content of my attributes. I've been trying to use XmlToObjectDeserialiser but I'm not too sure how to use it...

Please help !
--
Xavier
Re: ConfigLoader : access to attributes
user name
2007-04-19 09:33:28
Xavier,

Do a search here http://www.archivesat.com/pixlib/ for configloader. I had the same problem when I started using the framework.

I'd be very cautious in using the XmlToObjectDeserialiser as it's not just a xml parser and work in a very strict way. For parsing your xml I would use the BasicXmlToObjectDeserialiser which is a lot more flexible.

In one of the post I provided a little mofidication for the BasicXmlToObjectDeserialiser so that you can parse attribute and data conatined in a same node which i beleive it didn't do previously.

once you start with pixlib it's pretty full on coz of the lack of documentation but once you start using it and understnd how it works it's a time saver + it allows to architect you project in a very neat way

hope that helps

Good luck
Seb


On 4/19/07, Xavier Roussel < roussel.xaviergmail.com">roussel.xaviergmail.com > wrote:
Hi list,
I'm new to Pixlib and I'm trying to access to the data I have in the attributes of an XML config file. I use this code :
 &nbsp; &nbsp; &nbsp; 
 &nbsp; &nbsp; &nbsp;  var libs:LibStack = new LibStack();
 &nbsp;   &nbsp;  libs.setAntiCache(true);
 ; &nbsp;  &nbsp;
 &nbsp;   &nbsp;  // -- xml
   ;  &nbsp;  libs.enqueue( new ConfigLoader(), "formation", "xml/formation1.xml");
 &nbsp;   &nbsp;  libs.addEventListener( LibStack.onLoadProgressEVENT , this );
 ; &nbsp;  &nbsp;  libs.addEventListener( LibStack.onLoadCompleteEVENT, this, _onConfigLoaded );
 &nbsp;   &nbsp;  libs.execute();


Unfortunatly, if I try to get a log on my load object (Debug.INFO( Config.getInstance());) I get an object in witch I find my nodes' content but not the content of my attributes. I've been trying to use XmlToObjectDeserialiser but I'm not too sure how to use it...

Please help !
--
Xavier
_______________________________________________
Pixlib mailing list
osflash.org">Pixlibosflash.org
http://osflash.org/mailman/listinfo/pixlib_osflash.org


Re: ConfigLoader : access to attributes
user name
2007-04-19 09:56:38
Parsing of attributes is include in last rev.

Use the static property DESERIALIZE_ATTRIBUTES if you use the XmlToObjectDeserializer (it is include by default in the Basic one) you can change the name of the property where attributes are put with the ATTRIBUTE_TARGETED_PROPERTY_NAME. If this one is undefined attribute are pushed in the decorated object.

Flapflap
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )