Iphone NSXMLParser问题标记为空

Iphone NSXMLParser问题标记为空,iphone,objective-c,ios,Iphone,Objective C,Ios,这是我的XML文件的示例 <head> <cat>some title here... <info>some info here <summary>bla bla bla</summary> <full> the full text here </full </info> </cat> </he

这是我的XML文件的示例

<head>
    <cat>some title here...
    <info>some info here
        <summary>bla bla bla</summary>
        <full>
        the full text here
        </full
    </info>
    </cat>
</head>
如果具有使用以下函数捕捉当前字符串中所有值的数组:

    -(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
    if (!currentElementValue) {
        // init the ad hoc string with the value     
        currentElementValue = [[[NSMutableString alloc] initWithString:string]autorelease];
    } else {
        // append value to the ad hoc string    
        [currentElementValue setString:string]; //appendString:string];
    }
   NSLog(@"Processing value for : %@", string);

}
由于某种原因,“猫”和“信息”得到了空字符串。。。 我使用了一些NSlogging来解决这个问题,我得到了如下结果:

    -(void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
    if (qName) {
        elementName = qName;
    }

    // If it's the start of the XML, remove everything we've stored so far
    if([elementName isEqualToString:@"head"])
    {
        [self emptyDataContext];
        return;
    }
    else if([elementName isEqualToString:@"bgimage"])
    {
enter code here
    }
    // Create a new Category
    else if ([elementName isEqualToString:@"cat"]) 
    {


//array catching the values 
    }

    else if ([elementName isEqualToString:@"info"])
    {
            [add addObject:currentElementValue];
    } 
    else if([elementName isEqualToString:@"summary"])
    {

    }
    else if([elementName isEqualToString:@"full"])
    {

     }
    else if([elementName isEqualToString:@"quote"])
    {
    }
2011-12-19 00:40:07.557老挝[39912:bc03]的处理值:

2011-12-19 00:40:07.557老挝语[39912:bc03]处理“某些信息标题…”的值

2011-12-19 00:40:07.558老挝[39912:bc03]的处理值:

2011-12-19 00:40:07.559老挝[39912:bc03]的处理值:

2011-12-19 00:40:07.560老挝[39912:bc03]处理“某些信息标题…”的值

2011-12-19 00:40:07.560老挝[39912:bc03]的处理值:“一些汇总联系人在这里…” 2011-12-19 00:40:07.560老挝[39912:bc03]汇总 2011-12-19 00:40:07.561老挝[39912:bc03]的处理值:

????
请帮助

您发布的XML示例不是有效的XML。下面是一个有效的示例XML文档

<head>
    <cat>
        <title>some title here...</title>
        <info>some info here...</info>
        <summary>bla bla bla</summary>
        <full>
            the full text here
        </full>
    </cat>
</head>

这里有一些标题。。。
这里有一些信息。。。
呜呜呜呜
全文在这里
您不能将文本和标记扔进一个XML标记中。对于exmaple,这将不起作用:

<info>Hello, World
    <tag>Hello</tag>
    <tag>World</tag>
</info>
你好,世界
你好
世界
要使其有效,可以执行以下操作:

<info>
    <text>Hello, World</text>
    <tag>Hello</tag>
    <tag>World</tag>
</info>

你好,世界
你好
世界

您提供的XML不正确。您的xml应该具有属性xml或标记xml。