Looking into it. I suspect it might be caused by copy().
Yup. I just stepped through copy() Sample project: <?xml version="1.0" encoding="utf-8"?> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:js="library://ns.apache.org/royale/basic" applicationComplete="onComplete()"> <fx:Script> <![CDATA[ private function onComplete():void{ var xml:XML = <foo baz=""/>; trace(xml.toXMLString()); var xml2:XML = xml.copy(); trace(xml2.toXMLString()); } ]]> </fx:Script> <js:valuesImpl> <js:SimpleCSSValuesImpl /> </js:valuesImpl> <js:initialView> <js:View> <js:Label text="Hi!"/> </js:View> </js:initialView> </js:Application> xml.toXMLString() is correct. <foo baz="”/> after: xml2 = data.copy(); <foo baz="null”/> I believe there’s two problems: 1. XML.toString() blindly returns _value for attributes even though they can be undefined. Leaving them undefined saves memory. 2. XML.escapeAttributeValue uses String(value) which can result in “undefined”. Both issues can be fixed in XML, but it’s an indication of a wider problem IMO. I wonder if Language.string() should return “” for undefined. It currently returns null. I think “” would generally be a more expected result. Thoughts? > On Nov 12, 2021, at 9:14 AM, Edward Stangler <estang...@bradmark.com> wrote: > > > How are you creating the XML object and converting it back to a string, > exactly? > > I just tested doing this: > > var x:XML = new XML("<foo baz=\"\"><bar /></foo>"); > l.text = "XML = " + x.toString(); > > And it works fine. (But note that <foo baz=""/> makes x.toString() == > "", because root tag <foo> doesn't have a child.) > > Doing "<myxml><foo baz=\"\"/></myxml>" also works fine. > > > On 11/11/2021 10:31 AM, Harbs wrote: >> I have XML which had <foo baz=“”/> and after reading it into an XML object >> and writing it back I get <foo baz=“null”/> >> >> I have not yet investigated at which point it becomes “null”. >> >>> On Nov 11, 2021, at 5:11 PM, Edward Stangler <estang...@bradmark.com> wrote: >>> >>> >>> In what context? Like an example. >>> >>> >>> On 11/11/2021 3:40 AM, Harbs wrote: >>>> At some point (not sure when), it seems like when writing xml, empty >>>> string attributes became “null” instead of “”. >>>> >>>> Any ideas when/how that happened? >>> >> >