Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-28828

fx:XMLList initializer destroys text nodes of immediate child elements of contained root elements when those child elements contain children themselves.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Adobe Flex SDK Previous
    • None
    • None
    • Affected OS(s): Windows
      Affected OS(s): Windows 7
      Language Found: English

    Description

      Steps to reproduce:
      1.Create an XMLList using MXML declarative syntax like so:
      <fx:XMLList id="myXML" xmlns="">
      <ElementRoot>
      <ElementChild>Some Text
      <ElementSubChild>Yeah</ElementSubChild>
      </ElementChild>
      </ElementRoot>
      <ElementRoot>
      <ElementChild>More Text
      <ElementSubChild>Yeah Dawg</ElementSubChild>
      </ElementChild>
      </ElementRoot>
      <ElementRoot>
      <ElementChild>Yet More Text</ElementChild>
      </ElementRoot>
      </fx:XMLList>
      2. Attempt to access a text node of any ElementChild element.
      3. For extra profit, attempt to print the list by using toXMLString();

      Actual Results:
      If the ElementChild contains a child node that is an element as well as a text node, the textNode is destroyed or somehow not parsed correctly.

      The above code, when toXMLString() is called, produces the following output: <ElementRoot>
      <ElementChild>
      <ElementSubChild>Yeah</ElementSubChild>
      </ElementChild>
      </ElementRoot>
      <ElementRoot>
      <ElementChild>
      <ElementSubChild>Yeah Dawg</ElementSubChild>
      </ElementChild>
      </ElementRoot>
      <ElementRoot>
      <ElementChild>Yet More Text</ElementChild>
      </ElementRoot>

      The text nodes "Some Text" and "More Text" are missing.

      Expected Results:
      I would expect to see the following output:
      <ElementRoot>
      <ElementChild>Some Text
      <ElementSubChild>Yeah</ElementSubChild>
      </ElementChild>
      </ElementRoot>
      <ElementRoot>
      <ElementChild>More Text
      <ElementSubChild>Yeah Dawg</ElementSubChild>
      </ElementChild>
      </ElementRoot>
      <ElementRoot>
      <ElementChild>Yet More Text</ElementChild>
      </ElementRoot>

      Workaround (if any):
      Instead of using XMLList, roll the XML into an XML object, which parses correctly, and fetch elements via standard e4x. Not really ideal, but passable.

      Attachments

        Activity

          People

            Unassigned Unassigned
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: