Hi,

Is there a way to display new line (<br/>, \n, &#xA; ), read from an xml file, using the Text QML Element?

Currently, I have this xml file:
Qt Code:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <story>
  3. <pages>
  4. <text>The </text>
  5. <text>quick </text>
  6. <text>brown </text>
  7. <text>fox<![CDATA[<br/>]]></text>
  8. <text>jumps </text>
  9. <text>over </text>
  10. <text>the </text>
  11. <text>lazy </text>
  12. <text>dog.</text>
  13. </pages>
  14. </story>
To copy to clipboard, switch view to plain text mode 


And I have this qml file to read and display the text read from the xml file

Qt Code:
  1. Rectangle {
  2. id: appWindow
  3. width: 300; height: 300
  4. color: "pink"
  5.  
  6. XmlListModel{
  7. id: xmlmodel
  8. source: "sample.xml"
  9. query: "/story/pages/text"
  10.  
  11. XmlRole { name: "content"; query: "string()" }
  12. }
  13.  
  14. Component {
  15. id: itemdelegate
  16. Item {
  17. id: wrapper
  18. width: contentText.width
  19. height: contentText.height
  20. Row {
  21. Text{ id: contentText; text: content; textFormat: Text.PlainText }
  22. }
  23. }
  24. }
  25.  
  26. Component {
  27. id: highlighter
  28. Rectangle{
  29. color: "yellow"
  30. }
  31. }
  32.  
  33. ListView {
  34. id: listView
  35. width: 200
  36. height: 20
  37. model: lmodel
  38. delegate: itemdelegate
  39. highlight:highlighter
  40. highlightFollowsCurrentItem: true
  41. orientation: "Horizontal"
  42. }
  43. }
To copy to clipboard, switch view to plain text mode 

The result only gave me:
The quick brown fox<br/>jumps over the lazy dog.

I have tried using Text.RichText, Text.AutoText, Text.StyledText for the textFormat, but all of them either give me <br/> or did not display at all.

I also tried using only <br/>, instead of enclosing it in CDATA, but i got the same result.

Is there a way to make <br/>, or \n work as it should?

It is imperative that I use an xml file because the texts can be in different languages.

Thank you very much! I hope someone has the answer.