Giter VIP home page Giter VIP logo

tbxml's Introduction

TBXML (mmasashi)

Added the following feature to TBXML.

Example

  • sample1.xml
<root>
  first text node text
  <child>first child node text</child>
  second text node text
  <child>second child node text</child>
  third text node text
</root>
  • Sample Code
    TBXML *tbxml = [TBXML tbxmlWithXMLFile:@"sample1" fileExtension:@"xml"];
    TBXMLElement *root = tbxml.rootXMLElement;
    
    if (root) {
      TBXMLElement *element = root->firstChild;
      while (element) {
        NSLog(@"name->%s text->%s", element->name, element->text);
        element = element->nextSibling;
      }
      
      TBXMLElement *firstTextElement = [TBXML childElementNamed:TBXML_TEXT_ELEMENT_NAME
                                                  parentElement:root];
      if (firstTextElement) {
        NSLog(@"firstTextElement name->%s text->%s", firstTextElement->name, firstTextElement->text);
      }
    }
  • textForElement:root does'nt return the text that you want, because I don't know what is the best way to concat multiple child text elements. You can implement textForElement: method easily in your way, If you need the fixed method, .

  • Result (console)

2011-10-13 01:24:17.039 TBXMLDemo[4455:207] name-> text text->first text node text
2011-10-13 01:24:17.045 TBXMLDemo[4455:207] name->child text->first child node text
2011-10-13 01:24:17.047 TBXMLDemo[4455:207] name-> text text->second text node text
2011-10-13 01:24:17.048 TBXMLDemo[4455:207] name->child text->second child node text
2011-10-13 01:24:17.049 TBXMLDemo[4455:207] name-> text text->third text node text
2011-10-13 01:24:17.049 TBXMLDemo[4455:207] firstTextElement name-> text text->first text node text

License

TBXML is a light-weight XML document parser written in Objective-C designed for use on Apple iPad, iPhone & iPod Touch devices. TBXML aims to provide the fastest possible XML parsing whilst utilising the fewest resources. This requirement for absolute efficiency is achieved at the expense of XML validation and modification. It is not possible to modify and generate valid XML from a TBXML object and no validation is performed whatsoever whilst importing and parsing an XML document.

http://www.tbxml.co.uk/TBXML/TBXML_Free.html

tbxml's People

Contributors

mmasashi avatar nverinaud avatar steipete avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.