Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
lawdawg123
Posts: 5
Registered: ‎12-11-2012
My Device: Curve 9360
My Carrier: Att

Parse xml doc in QML with javascript

I have a simple list in an xml data type. Is there a way to make that xml doc available to javascript in QML so that I can parse it. I want to display one item or more items for the list based on user input. Is this possible with an XML data model? 

 

/// xml doc 

 

<root>

   <item title="apple"/>

   <item title="banana"/>

  <item title="pear"/>

</root>

 

/// QML page

 

//....Container etc

TextField{

id:userInput

}

ListView{

   rootPathIndex[x]      //x might be where the output of a function controls what is displayed

  dataModel:XmlDataModel

 function xmlparser( y) // y is where an xml array or object would be delivered to a javascript function

}

Please use plain text.
Developer
i68040
Posts: 59
Registered: ‎02-05-2012
My Device: Q10
My Carrier: T-Mobile

Re: Parse xml doc in QML with javascript

Hi,

 

I recently answered a question about how to parse XML Data and get it to QML in this thread. I provide a Sample project which includes an XML Parser Class (C++) and shows how to retrieve XML Data with it from QML.

Please use plain text.