엔티티를 확장하고 조작하지 않고 XML 문서를 읽으려고 시도하고 확장되지 않은 엔티티를 초기 상태로 다시 저장하려고합니다.XmlTextReader가 엔티티를 확장하지 못하도록 함
XDocument doc = XDocument.Load(file); // <--- Exception
// ... do some manipulation to doc
doc.Save(file2);
는 다음 나는예외 : 참조를 선언되지 않은 엔티티 '엔티티 이름'에
직접하여 XDocument를 사용
, 그것은 예외가 엔티티를 할 unexpanded했다 말해 던지는로드 할 수 없습니다.
XDocument
생성자에
XmlTextReader
를 전달하려고했으나
EntityHandling
속성은 "더 확장"이하지 않습니다 또한
XmlTextReader xmlReader = new XmlTextReader(file));
xmlReader.EntityHandling = EntityHandling.ExpandCharEntities;
XDocument doc = XDocument.Load(xmlReader);
, 나는 XmlReader.Create 기능을 살펴 보았다하지만, MSDN은 "Create 메서드로 만든 독자는 모든 엔터티를 확장합니다"라고 말합니다.
엔티티를 확장하지 않는 엔티티가있는 XDocument가 있거나 확장되지 않은 XmlReader를 만들려면 어떻게해야합니까?
이것은 의미가 없습니다. – harpo