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 "-//L开发者_JAVA百科SC//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?
Try This : you can remove the internal subset from the DTD by setting the XDocumentType.InternalSubset
property to null
XDocument document = ...;
if (document.DocumentType != null)
document.DocumentType.InternalSubset = null;
精彩评论