[英]Why does every XML file I create with .net's XMLWriter fail W3C validation?
The W3C validator tells me W3C验证器告诉我
Line 256, Column 12: non SGML character number 0
Both errors occur at the very end of the file. 这两个错误都发生在文件的末尾。
Here is my abbreviated code: 这是我的缩写代码:
dim writer as XmlWriter
dim xmlSettings as new XmlWriterSettings
xmlSettings.Encoding = Encoding.UTF8
xmlSettings.CheckCharacters = true
xmlSettings.ConformanceLevel = ConformanceLevel.Document
xmlSettings.Indent = true
writer = XmlWriter.Create("D:\somedata.xml", xmlSettings)
writer.WriteStartDocument()
writer.WriteStartElement("listings")
while invReader.Read( )
writer.WriteStartElement("listing")
'a bunch of .writeElementString calls here
writer.WriteEndElement()
end while
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Close()
It looks like you are trying to write out a character that the validator thinks is illegal 您似乎正在尝试写出验证者认为非法的字符
Check out this link for an example of your error: 查看此链接以获取错误示例:
http://forums.htmlhelp.com/index.php?showtopic=11270 http://forums.htmlhelp.com/index.php?showtopic=11270
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.