Why are my strings enclosed in double quotes or CDATA in Android XML?

Follow

Comments

3 comments

  • Avatar
    Jessica Coleman (Edited )

    CDATA (Character Data) sections are used to enclose strings that contain characters that might otherwise be interpreted by the XML parser. This includes characters like "<" or "&" which have special meanings in XML. By wrapping the string in CDATA, you ensure these characters are treated literally as part of the string.

    Badland

    0
    Comment actions Permalink
  • Avatar
    mymorri (Edited )

    . I understand that CDATA (Character Data) sections are used to enclose strings that contain characters that might otherwise be interpreted by the XML parser, like "<" or "&". By wrapping the string in CDATA, these characters are treated literally as part of the string. Is that right

     

     

    0
    Comment actions Permalink
  • Avatar
    jeannette9728miller (Edited )

    Strings in the exported Android XML file appear wrapped in double quotes or CDATA sections.
    These quotes or CDATA might have been present in the original imported file. OneSky keeps the formatting consistent during the translation process.
    If the translated string has leading or trailing spaces (spaces at the beginning or end), quotes are added to ensure those spaces are preserved in the final XML file used by your app.
    These quotes or CDATA sections should not appear in your app's code. The Android system handles them during parsing and removes them before using the string values.

    OneSky provides a link to further documentation on XML formatting and styling, which can be helpful for understanding proper XML structure.

    This response effectively addresses the user's concern by explaining the reasons for quotes/CDATA and assuring them that these elements won't affect their app's functionality. It also provides an opportunity for further learning on XML formatting. Maxim Time Clock

    0
    Comment actions Permalink

Please sign in to leave a comment.