2004年9月17日
Java | XMLのコメントが
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setIgnoringComments(false); dbf.setCoalescing(true); dbf.setIgnoringElementContentWhitespace(true); dbf.setValidating(true); DocumentBuilder db = dbf.newDocumentBuilder();上記のようなコードで、XMLパースの設定をしているのだけど、ignoringCommentsをfalseにしているにも関わらずパース結果のDocumentではコメントが削除されたり、残っていたり。trueにしても同様に削除されたり、残っていたり。
AというXMLファイルは常にコメントが削除され、BというXMLファイルは常にコメントが残る。同一のXMLファイルでコメントが削除されたり、残っていたりというブレはない。
HELP!!
Comment