■
MSXML で以下のような XML を読み込もうとするとエラーになる。
要素 'aho:root' は使用されていますが、DTD またはスキーマでは宣言されていません。
MSDNによれば、これは次のエラーに相当するようだ。
XML_ELEMENT_UNDECLARED | 0xC00CE00D | The element '%1' is used but not declared in the DTD or schema. |
うーむ、バグだろうか。
<!DOCTYPE aho:root [ <!ENTITY foo "FOO"> ]> <aho:root xmlns:aho="http://www.example.com/aho"> &foo; </aho:root>
追記: ドキュメントのバリデーションを止めると問題なくなりました。
var dom = new ActiveXObject("Msxml2.DOMDocument.6.0"); dom.setProperty('ProhibitDTD', false); dom.setProperty('ValidateOnParse', false);
こんな感じで。DTDが存在するときは (Element宣言などがないときも) 常にvalidateするというのもどうかと思うが。