简体   繁体   中英

Editor control that manipulates XElement objects rather than XML text

I have a program that configures itself from an XML file, but whenever that configuration changes I have to re-read the XML file and re-build the program's state from scratch.

However, I could also write it to simply subscribe to each XElement.Changed event, so the configuration can be changed at runtime without forcing me to ditch the state and re-create it again.

Is there an XML editor control (for WPF or Mono, preferably) that manipulates the instances of XElement rather than treating and manipulating the document as one big string?

There's something missing in you logic.

  • If whole configuration file is important ? If so - you solution is right - you should reload the whole XML file
  • If something (3d party app ?) changed XML - how do you know about it ? May be the same program can kick some event and notice about changes ?

For XML using: the best method is using XPath and extract XmlElement or even collection of elements from whole XML. I don't think that there's a method to know if part of XML changed or get Event about it. To know that something changed you should check it with original copy of document - but I understand that another app changing it so....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM