XDocument:您可以跳过加载 For Each file In My.Computer.FileSystem.GetFiles(inputFolder)
doc = XDocument.Load(file)
Next
这会因“'['是一个意外的标记。Blah,blah,blah”而崩溃,
第一行显然令人窒息,这是......
<!DOCTYPE RCWChapter PUBLIC "-//LSC//DTD RCW Chapter for Authoring//EN" [] >
第一,这是无效的XML吗?为什么它挂在“[”上?
2、我可以以某种方式加载 XML 文档,但跳过 DOCTYPE 吗?我应该将其作为流加载吗?字符串.替换它吗?
For Each file In My.Computer.FileSystem.GetFiles(inputFolder)
doc = XDocument.Load(file)
Next
This crashes with a "'[' is an unexpected token. Blah,blah,blah"
It's obviously choking on the first line which is....
<!DOCTYPE RCWChapter PUBLIC "-//LSC//DTD RCW Chapter for Authoring//EN" [] >
1st, is that INVALID XML? Why is it hanging on the "[" ?
2nd, Can I somehow load the XML document, but skip the DOCTYPE? Should I load it as a stream? string.replace it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
For Each file In My.Computer.FileSystem.GetFiles(inputFolder)
doc = XDocument.Load(file)
Next
这会因“'['是一个意外的标记。Blah,blah,blah”而崩溃,
第一行显然令人窒息,这是......
<!DOCTYPE RCWChapter PUBLIC "-//LSC//DTD RCW Chapter for Authoring//EN" [] >
第一,这是无效的XML吗?为什么它挂在“[”上?
2、我可以以某种方式加载 XML 文档,但跳过 DOCTYPE 吗?我应该将其作为流加载吗?字符串.替换它吗?
For Each file In My.Computer.FileSystem.GetFiles(inputFolder)
doc = XDocument.Load(file)
Next
This crashes with a "'[' is an unexpected token. Blah,blah,blah"
It's obviously choking on the first line which is....
<!DOCTYPE RCWChapter PUBLIC "-//LSC//DTD RCW Chapter for Authoring//EN" [] >
1st, is that INVALID XML? Why is it hanging on the "[" ?
2nd, Can I somehow load the XML document, but skip the DOCTYPE? Should I load it as a stream? string.replace it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:您可以通过将
XDocumentType.InternalSubset
属性设置为 null 从 DTD 中删除内部子集Try This : you can remove the internal subset from the DTD by setting the
XDocumentType.InternalSubset
property to null