Comments (8)
use like [[[aElement childrenWithTag:@"text"] firstObject] stringValue] can fix this bug
from ono.
@zhuhejin Would you mind sharing an example(code & relevant XML)?
from ono.
@cezheng
self. commentText =[[aElement firstChildWithTag:@"text"] stringValue]; //return nil;
self.commentText=[[[aElement childrenWithTag:@"text"] firstObject] stringValue]; // return correct;
from ono.
@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.
@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.
@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.
@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.
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)
- WatchOS HOT 2
- XCode 7.1 "include of non-modular header inside module 'Ono.Ono'" HOT 3
- CSS selector does not work for some queries HOT 3
- Build error in XCode7.1 HOT 5
- Memory leak in firstChildWithXPath/enumerateElementsWithXPath when no element found HOT 3
- compile error on ONOHTMLTests.m with Xcode 7.1.1 HOT 1
- Build fails with Carthage HOT 1
- any plan to add support for tvOS? HOT 2
- How to use it without cocopods
- why textNode isn't child node
- i use Ono Parse the web issues ! HOT 1
- get the absolute path HOT 1
- How can I get value from tags from <dc:title> HOT 1
- 1
- warnings when building with -Weverything HOT 3
- this is a very strange question
- migrate to Swift5 HOT 2
- Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules
- How to use :nth-of-type()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ono.