简体   繁体   中英

Is there an open-source implementation of an XPathNavigator for POCOs?

I would like to enable XPath navigation over my POCOs (ie "plain old CLR objects"). From a brief search, I have found several options:

  1. Use ObjectXPathNavigator .NET 1.0 implementation . However, since it was written against .NET 1.0, I have concerns about potential issues with generics (and whatever else that wasn't supported back then).
  2. Implementing my own XPathNavigator by extending the .NET XPathNavigator class .

The second option appears to be what I want. However, I don't have the time to write my own -- especially since I expect that someone else has already implemented it and made it open source. I just have a difficult time finding this elusive PocoXPathNavigator implementation!

Thanks.

The best approach, it seems, is to use ObjectXPathNavigator (option 1) since it's open source. I plan to extend it to support generics and whatever else I need.

You can serialize your objects as xml string into memory and then use the standard XPathNavigator to search in it. There are also some native XML database systems which you may use to serialize your objects into.

The question is, why do you need an XPathNavigator to search in objects? If you have a large objects graph you may consider using some kind of graph db / nosql db .

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