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
  Advanced search   Search tips   Subscriptions
Issue 61: CDATA for default value fields not handled correctly
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Apr 2012


 
Reported by timo.fie...@web.de, Apr 17, 2012
What steps will reproduce the problem?

Deserializing a node with CDATA tags as default value.


What is the expected output? What do you see instead?

The deserialized string is expected to not contain CDATA tags, but they show up.


What version of the product are you using? On what operating system?

2.3.1 (even though it says 2.3.0 VERSION.as), Windows 7 x64



Please provide any additional information below.

Here's an example, you should see that "root.child.value" will output "<![CDATA[Lorem <b>ipsum</b> dolor <i>sit</i> amet]]>" while "root.anotherChild" gives the expected output "Lorem <b>ipsum</b> dolor <i>sit</i> amet" without the CDATA tags.

---------------------
package  
{
    import com.googlecode.flexxb.annotation.*;
    
    public class RootModel 
    {
        [XmlElement]
        public var child:ChildModel;
        
        [XmlElement]
        public var anotherChild:String;
    }
}

package  
{
    import com.googlecode.flexxb.annotation.*;
    
    [XmlClass(defaultValueField='value')]
    public class ChildModel
    {
        [XmlAttribute]
        public var what:String;
        
        [XmlElement]
        public var value:String;
    }
}


var cdata:XML = new XML('<![CDATA[Lorem <b>ipsum</b> dolor <i>sit</i> amet]]>');

var document:XML =
<root>
    <child>{cdata}</child>
    <anotherChild>{cdata}</anotherChild>
</root>;

var root:RootModel = FxBEngine.instance.getXmlSerializer().deserialize(document, RootModel) as RootModel;
trace(root.child.value);
trace(root.anotherChild);
---------------------


For now i've worked around the problem by directly using

---------------------
return serializer.converterStore.stringToObject(xmlElement.toString(), element.type);
---------------------

instead of

---------------------
for each (var child : XML in xmlElement.children()) {
    if (child.nodeKind() == "text") {
        return serializer.converterStore.stringToObject(child.toXMLString(), element.type);
    }
}
---------------------

in XMLMemberSerializer.as
Apr 18, 2012
Project Member #1 alex.id....@gmail.com
(No comment was entered for this change.)
Status: Fixed
Labels: Milestone-2.4.0

Powered by Google Project Hosting