Giter Site home page Giter Site logo

not work with ![CDATA[xxxx]] about ono HOT 8 CLOSED

mattt avatar mattt commented on May 13, 2024
not work with ![CDATA[xxxx]]

from ono.

Comments (8)

zhuhejin avatar zhuhejin commented on May 13, 2024

use like [[[aElement childrenWithTag:@"text"] firstObject] stringValue] can fix this bug

from ono.

cezheng avatar cezheng commented on May 13, 2024

@zhuhejin Would you mind sharing an example(code & relevant XML)?

from ono.

zhuhejin avatar zhuhejin commented on May 13, 2024

@cezheng
self. commentText =[[aElement firstChildWithTag:@"text"] stringValue]; //return nil;
self.commentText=[[[aElement childrenWithTag:@"text"] firstObject] stringValue]; // return correct;

from ono.

gcox avatar gcox commented on May 13, 2024

@cezheng Here's an example tag whose stringValue returns @"" for me. @zhuhejin's suggested workaround does not work for this case and also returns @"".

<link>
    <![CDATA[http://www.earwolf.com/show/comedy-bang-bang/]]>
</link>

Other tags containing text wrapped in parses without a problem.

from ono.

cezheng avatar cezheng commented on May 13, 2024

@gcox I found that if you read the document as HTML, then CDATA won't be recognized, you have to treat it as an XML document

from ono.

gcox avatar gcox commented on May 13, 2024

@cezheng I'm not sure what you mean, the NSData object I'm using to load the ONXMLDocument is downloaded from a server returning application/rss+xml. Is -[ONXMLElement firstChildWithTag:] meant to be used against HTML documents only?

I did find that grabbing the ONOXMLElement from the result of -[ONOXMLDocument XPath:] got me an ONXMLElement object that returns the correct stringValue.

from ono.

gcox avatar gcox commented on May 13, 2024

@cezheng I figured out the problem...it's my fault. There was another 'link' tag with a namespace, I incorrectly assumed firstChildWithTag:@"link" would consider <atom:link to be a match. There is of course no string value for the atom:link tag.

from ono.

mattt avatar mattt commented on May 13, 2024

Apologies for not responding to this sooner, @zhuhejin. If this is still an issue for you, please let me know, and I'll reopen. Thanks!

from ono.

Related Issues (20)

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.