我是一名新的 Objective-C/iPhone 开发人员,想知道是否有任何方法可以将格式化标签嵌入到 plist 中的字符串中?
我有一个 plist,它是一组字典。每个字典都包含一些字符串对象,其中一些我想包含信息列表和段落。
有没有办法嵌入像<<这样的标签?力>< /li>或< b>< /b>转换成可以识别的字符串?如果有办法做到这一点,任何有关接受哪些标签的参考都将不胜感激。
我尝试过将它们嵌入到 xcode plist 编辑器的字符串中,尝试使用 PlistEdit Pro,还尝试编辑 xml,但到目前为止还没有任何运气!
预先感谢您的帮助。
I am a new objective-c/iPhone developer and am wondering if there is any way to embed formatting tags into a string in plist?
I have a plist that is an array of dictionaries. Each dictionary contains a few string objects, some of which I would like to contain lists and paragraphs of information.
Is there any way to embed tags like < li>< /li> or < b>< /b> into an string that will be recognized? If there is a way to do this, any reference to which tags are accepted would be greatly appreciated.
I have tried embedding these into the string from the xcode plist editor, tried using PlistEdit Pro, and also tried editing the xml, but have not had any luck so far!
Thanks in advance for your help.
发布评论
评论(2)
是的;您需要使用 XML 实体:
<li>
等。不过,您应该能够将它们添加到属性列表编辑器中的(原始)中(它们应该保存为它们的实际 XML plist 中的实体)。
Yes; you need to use XML entities:
<li>
, etc.You should be able to add them in (raw) in Property List Editor, though (they should be saved out as their entities in the actual XML plist).
@Wevah 是正确的:您可以通过使用 XML 实体来完成此操作。但是,如果您以编程方式使用内置的 plist 内容(将 plist 对象写入文件,
NSPropertyListSerialization
等),那么它将为您进行 xml 实体转换。@Wevah is correct: you do this by using XML entities. However, if you're programmatically using the built-in plist stuff (writing a plist object to a file,
NSPropertyListSerialization
, etc), then it will do the xml entity conversion for you.