惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
D
Docker
WordPress大学
WordPress大学
罗磊的独立博客
J
Java Code Geeks
博客园 - 【当耐特】
博客园 - 司徒正美
雷峰网
雷峰网
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
T
Tailwind CSS Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
B
Blog

博客园 - yysun

Active Record Pattern 和 ORM 看看 EJB 3.0 的 O/R Mapping Unit Test : MVP vs PM - yysun Refactor CAB Smart Part Quick Start Project to "Presentation Model" test P&P OB CAB EntLib SQL/e WB Editor 2.5 is in beta - yysun 把图片存到 Flickr 与 Biztalk 搏斗 Manage Plug-ins 申请 WB Editor 2 注册码 SharpReader Plug-in AJAX WB Editor 2 的口号[yysun] 用 XSL 生成 HTML 日历[yysun] 用 XSL 重命名 XML tag name[yysun] XPathDocument 与 XmlDocument 结合使用[yysun] 用 WB Editor 连接 cnblogs.com 的全攻略[yysun]
再谈 JXPath 与 ObjectXPathNavigator[yysun]
yysun · 2004-11-02 · via 博客园 - yysun

一年多前写了 JXPath -ObjectXPathNavigator ,当时想当然地以为 ObjectXPathNavigator 已经达到了 JXPath 那样的对对象的支持程度。直到最近要用到这种功能的时候才发现ObjectXPathNavigator 差得相当的远呢。

ObjectXPathNavigator 是建立在 XPathNavigator 基础上的。XPathNavigator本身是个挺酷的东西,它提供了 DOM, SAX, Pull (Reader) 以外的另外一种 XML (只读和随机的) 处理方式。是对 XSLT 引擎与数据源之间的一个抽象层。

XSLT 引擎 - XPathNavigator - 数据源
XSLT 引擎 - XPathDocument - XML

TheServerSide.NET- .NET Custom XPathNavigator/XmlReader ... 用扩充 XPathNavigator的办法来实现用 XPath 语法来检索:文件系统、注册表、.NET 可执行文件 Code DOM。

ObjectXPathNavigator 是试图扩充 XPathNavigator 到对象容器上,例如 ArrayList,以便用 XPath 语法来检索对象。

美好的设想,可是目前 XPathNavigator 似乎主要是字符串处理,而没有对象的支持。XPathNavigator.Value 属性只能返回 string。

因此想要得到 JXPath 那样的对象是不可能的了。

Address address = (Address) JXPathContext.newContext(vendor).getValue("locations[address/zipCode='90210']/address"); 

这里, JXPath 中JXPathContext.getCurrent 返回的是对象。

ObjectXPathNavigator 只能检索一层对象容器,而不能检索嵌套对象。这是非常遗憾的。