开发者

string is partially parsed when symbol "&" is present

If I have a string like "Fuel & Additives" when my XML parser goes through it ignores anything BEFORE the "&" symbol, why?

    if ([elementname isEqualToString:@"GLDesc"]) 
{
   currentParsedObjectContainer.GLDesc = currentNodeContent;
       NSLog(@"%@",currentPars开发者_如何学PythonedObjectContainer.GLDesc);
}


The ampersand character (&) and the left angle bracket (<) may appear in their literal form only when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings "&" and "<" respectively.

http://www.w3.org/TR/2000/REC-xml-20001006#syntax

As the above snippet states, you'll need to escape & to the string &amp; before passing it to the XML parser.


I'm going to say it has something to do with character codes (for example &lt). I'm not really familiar with xml though, so I'm not sure. Try &amp?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜