Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:53:06+00:00 2026-06-11T02:53:06+00:00

I am having the following .xml which i used in my android project.now,am trying

  • 0

I am having the following .xml which i used in my android project.now,am trying to create the same in iPhone using titanium.Can some one tell me how to get this values from the xml file and show them in a table view.? if i give MainCategories the 3 values in it should appear in the table view.Also can some one tell me is there any other better option to achieve this?or can we use plist??thank you.

<string-array name="MainCategories">
    <item>Acceleration</item>
    <item>Angle</item>
    <item>Area</item>
</string-array>


<string-array name="Acceleration_array">
    <item>meter/sq sec</item>
    <item>km/sq sec</item>
    <item>mile/sq sec</item>
    <item>yard/sq sec</item>
</string-array>


<string-array name="Angle_array">
    <item>degree</item>
    <item>radian</item>
    <item>grad</item>
    <item>gon</item>
</string-array>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:53:08+00:00Added an answer on June 11, 2026 at 2:53 am

    Try This.

    var result = [];
    var fileName = ‘arrays1.xml’; //save xml file
    var tableView = Ti.UI.createTableView({ data : result, width : ‘100%’, height : ‘100%’ });

    function readXML(fileName)
    {
    
    var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, fileName); 
    var xmltext = file.read().text; 
    var doc = Ti.XML.parseString(xmltext); 
    
    var parentNodeLength = doc.documentElement.getElementsByTagName('string-array').length; 
    for (var i = 0; i < parentNodeLength; i++) { 
    var attrValue = doc.documentElement.getElementsByTagName('string-array').item(i).attributes.getNamedItem('name').nodeValue;
    if (attrValue === 'Angle_array') {
    
        var parentNode = doc.documentElement.getElementsByTagName('string-array').item(i);
        var subNodeLength = parentNode.getElementsByTagName('item').length;
    
        for (var j = 0; j < subNodeLength; j++) {
    
            var title = parentNode.getElementsByTagName('item').item(j).text;
            var row = Ti.UI.createTableViewRow({
                height : 110
            });
            var label = Ti.UI.createLabel({
                height : Ti.UI.SIZE,
                width : Ti.UI.SIZE,
                text : title
            });
    
            row.add(label);
            result.push(row);
        }
    }
    
    }
    }
    readXML(fileName); 
    tableView.setData(result);
    win1.add(tableView); 
    win1.open();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an XML which will look like following <root> <node> <a1>text</a1> <a2>text</a2> <a3></a3>
I have the following xml document. I am trying to select any child which
having the following XML sample document, I need to issue an XPath/XQuery expression to
I am having xml with following structure <ruleDefinition appId=3 customerId = acf> <node alias=element1
I'm having the following issue - I want to traverse all the xml files
Hi currently I have a nested XMl , having the following Structure : <?xml
I have DB2 table having following structure CREATE TABLE DUMMY ( ID CHARACTER(10) NOT
I am having following class hierarchy - //Abstract Class1 in library1 (Can't modify this)
I am having following peice of code ,where in i am trying to serialize
I'm having the following code which is spitting 'Root Element Missing' during doc.Load() .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.