mattt/Ono

firstChildWithTag: does not work with 'text'

rhodgkins opened this issue · 1 comments

Hi,

When trying to parse the following:

<elementType>
    <multiCheckBox>
        <checkBoxes>
            <checkBox>
                <text>Text 0</text>
                <answerCode>Code 0</answerCode>
            </checkBox>
        </checkBoxes>
    </multiCheckBox>
</elementType>

Using:

    NSString *XPath = @"/elementType/multiCheckBox/checkBoxes/checkBox";
    ONOXMLElement *checkBoxElement = [self.document firstChildWithXPath:XPath];
    ONOXMLElement *textElement = [checkBoxElement firstChildWithTag:@"text"];
    ONOXMLElement *answerCodeElement = [checkBoxElement firstChildWithTag:@"answerCode"];

textElement is nil, but answerCodeElement is not nil!

However using firstChildWithXPath: instead of firstChildWithTag: works!

Bit of a weird issue! I've created a few failing test cases the in the associated pull request...

Any ideas? I've gotten around it for now using firstChildWithXPath:, but I can't see anything going wrong :(

Cheers,

Rich

Moving discussion over to #22.