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

  • Home
  • SEARCH
  • 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 8001915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:13:19+00:00 2026-06-04T16:13:19+00:00

I have an xml file which i create myself. <?xml version=’1.0′ encoding=’utf-8′ ?> <Root>

  • 0

I have an xml file which i create myself.

   <?xml version='1.0' encoding='utf-8' ?>
    <Root>
        <ChildElements>
            <type name='xx' attr='false'>
                <child id='1' regex='^[0-9]{11}$'>
                    <BBB>
                        <node1 name='aaa' regex='\w{5}'/>
                        <node2 name='bbb' regex='\w{3}'/>
                    </BBB>
                </child>
                <child>
                .
                .
                .
               </child>
           </type>
        </ChildElements>
    </Root>

Something like this. I want to parse it to xml document object and iterate through its nodes, I’m using libxml2 for ios.

 NSString *xmlPath = [[NSBundle mainBundle] pathForResource:@"xmlcontent" ofType:@"xml"];
    NSData *xmlData = [NSData dataWithContentsOfFile:xmlPath];
    NSString* xml = [[NSString alloc ] initWithData:xmlData encoding:NSUTF8StringEncoding];
int size=[xml lengthOfBytesUsingEncoding:NSUTF8StringEncoding];    
xmlDocPtr docptr=xmlParseMemory([xml UTF8String], size);

but in docptr object there is only one node, which is Root node, and when I try to get Root node child nodes it returns an empty node which name is @”text”.
NSXMLParser easily parses the same XML, but I don’t know how to create a document and iterate through nodes by using NSXMLParser.

  • 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-04T16:13:21+00:00Added an answer on June 4, 2026 at 4:13 pm

    maybe the error is, that your XML isn’t valide:

    <?xml version='1.0' encoding='utf-8' ?>
    <Root>
        <ChildElements>
            <type name='xx' attr='false' />
                <child id='1' regex='^[0-9]{11}$'>
                    <BBB>
                        <node1 name='aaa' regex='w{5}' />
                        <node2 name='bbb' regex='w{3}' />
                    </BBB>
                </child>
    
        </ChildElements>
    </Root>
    

    you can validate your XML with an online XML Validator

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

Sidebar

Related Questions

I have XML file which looks like this: <?xml version=1.0?> <results> <row id=100><name>name blah</name></row>
I want to create an xml file which have '&' in one of its
I have an XML file which will output a string: <mystring> <manipulate type=caps> <string>Hello
When I have an Eclipse update site project, a site.xml file is created which
I have an XML file which I need to parse using PHP and send
I have an XML file which XML parser choke on. A part of it
I have an XML file which has many section like the one below: <Operations>
I have an XML file which I'd like to parse into a non-XML (text)
I have an XML file which has to be transformed using XSLT, I am
I have written xml file which contains html tags as element like <component> <input

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.