SUP/SUB tag in XML
Can i use Superscript and Subscript tags in XML file?
I tried copy pasting,using <SUP>
tags but it is giving error .I have also searched a lot,but could not get pr开发者_开发知识库oper solution.
Could anyone please suggest me solution?
There is nothing in the XML standard that precludes SUP
or SUB
elements.
However, they don't have any specific meaning in XML either.
If you expect them to show up as super and sub scripts, this will not happen.
You can use any tags you like in XML, that's the whole point of it.
Please never use the phrase "I tried it and it gave me an error" without telling us what the error was. We like to be helpful but we can't explain an error for you without seeing the error message. It's like telling your doctor you don't feel well without telling him the symptoms.
This XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>name</key>
<string>title</string>
<key>subchapters</key>
<string>name</string>
</dict>
</array>
</plist>
has reference to DTD in which element sub
is not defined. This DTD is located http://www.apple.com/DTDs/PropertyList-1.0.dtd
I think you can omit DTD validation in your XML parser.
You can wrap your text in a CDATA tag, like so:
<![CDATA[ <string>haii</string> ]]>
The XML parser will not try to parse the content inside, but interpret it as a literal, which will solve your problem.
精彩评论