EclipseLink MOXy @XmlPath 支持轴/父 [英] EclipseLink MOXy @XmlPath support for axes/parent

查看:26
本文介绍了EclipseLink MOXy @XmlPath 支持轴/父的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以接受以下任何 XPath 表达式?使用 eclipselink 2.3.1 版

Are any of the following XPath expressions acceptable? Using version 2.3.1 of eclipselink

@XmlPath("../header/@type")
@XmlPath("/root/header/@type")
@XmlPath("parent::*/header/@type")

基本上这是在 XML 文档 (/root/tag) 中重复的类中,如果不清楚,我会详细说明.

Basically this is in a class which repeats within the XML document (/root/tag), if that isn't clear I'll elaborate.

我正在尝试向上遍历而不是向下遍历.我的其他 @XmlPath 注释工作正常.

I'm trying to traverse up the tree rather than down. My other @XmlPath annotations are working fine.

推荐答案

EclipseLink JAXB (MOXy) 目前不支持轴/父.如果您对此类支持感兴趣,请输入增强请求:

EclipseLink JAXB (MOXy) does currently not support axes/parent. If you are interested in this kind of support please enter an enhancement request:

它确实支持 XPath,例如:

It does support XPath like:

  • @XmlPath(".")//映射到自节点,当两个对象映射到同一个元素时很有用
  • @XmlPath("@foo")//映射到属性
  • @XmlPath("foo")//映射到元素
  • @XmlPath("foo[2]")//映射到
  • 的第二次出现
  • @XmlPath("foo[@bar='Hello World']")//映射到具有值为Hello World"的 bar 属性的 foo 元素
  • @XmlPath("ns1:foo/ns2:@bar")//映射到命名空间限定节点

了解更多信息

这篇关于EclipseLink MOXy @XmlPath 支持轴/父的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆