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 8229155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:42:14+00:00 2026-06-07T16:42:14+00:00

This is my XML <MyXML ID=tester Server=example.com> <CONF> <MYAPP LOCN=/Application/data/ DATADIR=/tmp/data> .. </CONF> </MyXML>

  • 0

This is my XML

<MyXML ID="tester" Server="example.com">
  <CONF>
    <MYAPP LOCN="/Application/data/" DATADIR="/tmp/data">
     ..
  </CONF>
</MyXML>

This is the Code i’m using

  NSString *xmlFilePath =@"/Applications/conf/MyConf.xml";
  NSLog(@"%@",xmlFilePath);
  NSData *xmlData = [NSData dataWithContentsOfFile:xmlFilePath];
  NSString *xPathQuery =@"/MyXML";
  NSArray *xmlArray = PerformXMLXPathQuery(xmlData,xPathQuery);

It gives me the full XML as NSArray. How to traverse through this NSArray or, how to use XPath to get exactly the Nodes and attributes.
I’ve used

  NSString *xPathQuery =@"/MyXML[@ID]";

but it doesn’t returns the attribute ID, it just returns null.

I think it would be best to traverse through the NSArray, but how to do that(I’m a newbie to Objective C and when i looked for traversing through the NSArray returned by ,i’ve just got examples for HTML NSArray only)

  • 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-07T16:42:16+00:00Added an answer on June 7, 2026 at 4:42 pm

    Take a look at libxml2 wrapper and using libxml2 for XML parsing and XPath queries in Cocoa article.

    NSArray *PerformXMLXPathQuery(NSData *document, NSString *query);
    NSArray *PerformHTMLXPathQuery(NSData *document, NSString *query);
    

    For an entire XML document, contained in the NSData object “document”,
    this function executes the XPath query in the NSString “query” and
    returns an NSArray of NSDictionary node objects for nodes that match
    the query.

    The only difference between the two listed functions is that the the
    first expects proper XML data and the second expects HTML data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have xml files been imported onto an FTP server. This is stored in
in my application i have this code: <Grid Name=BaseGrid> <Grid.Resources> <XmlDataProvider x:Name=ScenesXmlName x:Key=ScenesXml XPath=person
I'm using the following code to get something through XML var myLoader:URLLoader; var myXML:XML;
I have an application that can import an XML file through this terminal command
I am doing this tutorial but with a diferent xml http://blog.insicdesigns.com/2009/03/parsing-xml-file-using-codeigniters-simplexml-library/ , but I
I have this XML (stored in a C# string called myXML ) <?xml version=1.0
I wrote this code to validate my xml file via a xsd def parseAndObjectifyXml(xmlPath,
This is my XML for my check box: <CheckBox android:id=@+id/atm_checkbox android:layout_width=20dp android:layout_height=20dp android:background=@color/input_color />
This is my Xml file.i want to transform this xml file into another customized
This is my xml now. There can be added new item nodes and I

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.