My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Architecture  
FlexXB 1.x architecture
Phase-Implementation, Phase-Design
Updated Jan 5, 2011 by alex.id....@gmail.com
Comment by thipa...@gmail.com, Mar 29, 2009

Hi,

I have a question (probably a non-expert one). I looked at the coded sample Department, Person model example that comes in the zip library file

Is it possible/worthy to remove fully the AS tags, eg [XmlAttribute(alias="ID")], supposing that the object fully map the XML structure, having for example a function which parse both XML structure and corresponding object, a bit like the function serializeToVO(collection:Object, claz:Class):ArrayCollection? described here : http://corlan.org/2008/07/29/how-to-create-a-generic-function-for-parsing-an-xml-into-an-array-collection-of-objects-of-a-certain-type/

This may add perhaps a bit more constrainsts on the XML file and corresponding classes ... for example the exact match of the name.

What do you think?

Comment by project member alex.id....@gmail.com, Mar 29, 2009

Not sure I understand your question.

FlexXB only uses in the serialization process fields decorated with those anotations. This is because, like in the projects I'm working on, the model objects will often have more fields than those exclusive to serialization, that is, they will also hold some client logic that doesn't need to be sent to the server and back. If your object does not have anotations, it won't have its fields serialized. One thing I'd like to do is to provide a way for the mappings to be specified in a config file to tackle teh case in which, for some reason, the model classes are not accesible for being decorated with annotations.

You can have custom serialization for a specific object type by implementing the IXmlSerializable interface. Thus you will manually convert object to xml and viceversa, if you need some special ways of parsing that are not natively supported by FlexXB.

Does this answer your question?

Alex

Comment by thipa...@gmail.com, May 10, 2009

Hi, yes it answer to my question. Thanks.

Another one: The XML mapping is done against public instance properties. Have you thought about a mapping against the constructor itself. Thanks

Comment by project member alex.id....@gmail.com, May 10, 2009

Hmmm... You mean like to have a way to call the constructor with some parameters from the FlexXB Engine? That is interesting... It would be nice if you could provide a real life example to see if I'm thinking at the same thing :D

Alex

Comment by elifery...@gmail.com, Dec 27, 2010

Hi,I have a problem about XmlArray?.My XmlArray? element is an ArrayCollection? and it has also xmlElements in it.When I want to construct an xml,this causes to the duplication of the tags.How can I fix this? e.g: [XmlArray(alias="Variable")] public var variable : ArrayCollection?;

Somewhere in the code,I add the var element which is the Variable object itself to the variable above. var is an object with [XmlClass(alias="Variable")]. It duplicates the tags such that:

<Variable>

<Variable type="w" name="w">
....
</Variable> <Variable type="q" name="t">
....
</Variable>

</Variable>

At the end,I do not want to write the tags for xmlArray which is the first Variable above.

Comment by project member alex.id....@gmail.com, Dec 28, 2010

You should set the alias of the array collection to ""

Comment by elifery...@gmail.com, Dec 28, 2010

When I set the alias to "",this time it writes the name of the arraycollection.I do not want either this case.

Thank you for suggestion...

Comment by project member alex.id....@gmail.com, Dec 28, 2010

No, set the alias to star ().

Comment by elifery...@gmail.com, Dec 29, 2010

Unfortunetely,the problem is not solved...

Comment by project member alex.id....@gmail.com, Dec 29, 2010

Hmmm.... well, it should have worked. Are you experiencing the same problem even though the XmlArray? alias is set to star? Could you please move this thread on the discussion group to escape all the wiki syntax issues? We can see this further there.

Comment by elifery...@gmail.com, Dec 29, 2010

Sorry, the problem is solved by setting the alias to star after clearing the cache of the browser.

Thanks...

Powered by Google Project Hosting