XmlListModel Retrive content:encoded data
-
I am creating an RSS feed with Qt 6.9 QML. The XML data I retrieve contains a content:encoded part, but I am unable to retrieve this section; it returns empty. What is the reason for this, and how can I fix it?
XmlListModel { source: "/rss" query: "/rss/channel/item" XmlListModelRole {name: "newsTitle"; elementName: "title"} // Work XmlListModelRole {name: "newsImage"; elementName: "enclosure"; attributeName: "url"} // Work XmlListModelRole {name: "newsDetail"; elementName: "description"} // Work XmlListModelRole {name: "newsCategory"; elementName: "category" } // Work XmlListModelRole {name: "newsDate"; elementName: "pubDate" } // Work XmlListModelRole {name: "newsContent"; elementName: "content:encoded"} // Not Work }
// XML Area <description> </description> <content:encoded> </content:encoded>
-
I am creating an RSS feed with Qt 6.9 QML. The XML data I retrieve contains a content:encoded part, but I am unable to retrieve this section; it returns empty. What is the reason for this, and how can I fix it?
XmlListModel { source: "/rss" query: "/rss/channel/item" XmlListModelRole {name: "newsTitle"; elementName: "title"} // Work XmlListModelRole {name: "newsImage"; elementName: "enclosure"; attributeName: "url"} // Work XmlListModelRole {name: "newsDetail"; elementName: "description"} // Work XmlListModelRole {name: "newsCategory"; elementName: "category" } // Work XmlListModelRole {name: "newsDate"; elementName: "pubDate" } // Work XmlListModelRole {name: "newsContent"; elementName: "content:encoded"} // Not Work }
// XML Area <description> </description> <content:encoded> </content:encoded>
@omerfurkan
Iscontent:encoded
anencoded
element in acontent
namespace, or is it something you made up? Assuming the former, don't you have to do something like pass thecontent
separately as a namespace from theencoded
as an element name in whatever you do, such as reading it? I know nothing about QML, only XML. -
@omerfurkan
Iscontent:encoded
anencoded
element in acontent
namespace, or is it something you made up? Assuming the former, don't you have to do something like pass thecontent
separately as a namespace from theencoded
as an element name in whatever you do, such as reading it? I know nothing about QML, only XML.@JonB said in XmlListModel Retrive content:encoded data:
Is content:encoded an encoded element in a content namespace, or is it something you made up? Assuming the former, don't you have to do something like pass the content separately as a namespace from the encoded as an element name in whatever you do, such as reading it? I know nothing about QML, only XML.
Yes, content:encoded is a content element. From what I've researched, in Qt 5, we could achieve this with namespaces, but I believe namespaces have been removed in Qt 6.