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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:23:25+00:00 2026-05-29T22:23:25+00:00

I have an xml file with a parent child structure such as : <geometry

  • 0

I have an xml file with a parent child structure such as :

<geometry id="001-mesh" name="001">
  <mesh>
    <source id="001-mesh-positions">
      <float_array id="001-mesh-positions-array" count="228">

I am able to parse the data successfully using NSXMLParser. However the problem is I want to store the child information in relation to the parent – for example when a geometry id is detected, I then want to store the associated source id and float_array id.

Can anyone suggest a way I could this ? The below code will detect when a given element is found during parsing, but I’m not sure how to then store the values.

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName 
attributes:(NSDictionary *)attributeDict {

// NSLog(@"Parse Started");
//NSLog(@"Element Name is %@", elementName);

if([elementName isEqualToString:@"geometry"]) { 
    NSLog(@"Object Detected");
    NSString *name = [attributeDict objectForKey:@"name"];

NSLog(@"Name is %@",name);
}

if ([elementName isEqualToString:@"float_array"]) {
    NSLog(@"Vertices Detected");
    NSString * vertices = [attributeDict objectForKey:@"count"];

    NSLog(@"Vertices are %@", vertices);
}

}
  • 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-05-29T22:23:26+00:00Added an answer on May 29, 2026 at 10:23 pm

    At the time when the parser detects the geometry tag, the source id and float_array id are not available: they have not been parsed yet. The usual trick is to wait for the child element, and do the processing when it becomes available. You can do it by creating a new Geometry object (or whatever corresponds to XML’s geometry tag in your model), and make it available to the didStartElement:...: method, for example by setting it into an ivar called myGeometry. Once you detect float_array element, parse its id, and call

    [myGeometry setId:floatArrayId];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file similar in structure to the following: <Parent> <Child>5</Child> <Child>3</Child>
To start off, I have this XML file that contains recursive parent-child elements. Here
I have an XML file that starts like this: <Elements name=Entities xmlns=XS-GenerationToolElements> I'll have
I have an xml file like this: <root> <item> <name>one</name> <status>good</status> </item> <item> <name>two</name>
I have a xml file, and i need to append a child to it
I have an XML file <PARENT > <TAG string1=asdf string2=asdf > </TAG > </PARENT>
I have a xml file name list_row.xml, this was load in a listView: <?xml
I have an XML file with the following structure: <tu> <tuv xml:lang=EN> <seg>XXX</seg> </tuv>
I have the following TextView in my XML layout file:- <TextView android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/autolink_test
What is the easiest way to convert xml to html? I have xml file

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.