Question

I have a chunk of HTML where I try to get all content inside div but I can't retrieve it with [element content] or [element text].

<div class="text_comment" id="xxx">
                    <blockquote><i><i><a>some text</a><br></i></i>
<blockquote>lorem ipsum ...</blockquote>
</blockquote>
<p>some text</p>
<p>lorem ipsum...</p>
<blockquote>another text</blockquote>
</blockquote>
<p>another text</p>             
</div>

I try to retrieve all inside div with tags, like this

   <blockquote><i><i><a>some text</a><br></i></i>
    <blockquote>lorem ipsum ...</blockquote>
    </blockquote>
    <p>some text</p>
    <p>lorem ipsum...</p>
    <blockquote>another text</blockquote>
    </blockquote>
    <p>another text</p>

Can anyone help me please.

Was it helpful?

Solution

Solved, if anyone need this, just do these little changes:

TFHppleElement.h

@property (nonatomic, copy, readonly) NSString *raw;

TFHppleElement.m

- (NSString *)raw
{
    return [node objectForKey:@"raw"];
}

XPathQuery.m

NSDictionary *DictionaryForNode(xmlNodePtr currentNode, NSMutableDictionary *parentResult,BOOL parentContent)
{
    ...
    xmlBufferPtr buffer = xmlBufferCreate();
    xmlNodeDump(buffer, currentNode->doc, currentNode, 0, 0);

    NSString *rawContent = [NSString stringWithCString:(const char *)buffer->content encoding:NSUTF8StringEncoding];
    [resultForNode setObject:rawContent forKey:@"raw"];

    xmlBufferFree(buffer);

  return resultForNode;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top