jxpath

How to make jxpath read @xmlelement name attribute instead of actual field name?

為{幸葍}努か 提交于 2019-12-25 01:43:06
问题 I have a class with a field which looks like this @XmlElement(name = "Name", namespace = "a:b:c:1", required = true) protected String firstName I want to use JXPath like this String name = (String) context.getValue("Name"); But it doesn't recognize the XMLElement name attribute. Is there any way to make it do so? 回答1: I don't think you can . JXPath allows navigation of bean hierarchies using the standard bean get/is notation, but doesn't provide a means of accessing annotations on a field. I

Issue with XML parsing using Commons JXPath

随声附和 提交于 2019-12-11 08:42:48
问题 I'm trying to parse a XML using Apache Commons JXPath. But for some reason, its not able to identify the child nodes after the xml is being parsed. Here's the sample code : private static void processUrl(String seed){ String test = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><feed xmlns=\"http://www.w3.org/2005/Atom\" xmlns:media=\"http://search.yahoo.com/mrss/\" xmlns:openSearch=\"http://a9.com/-/spec/opensearchrss/1.0/\" xmlns:gd=\"http://schemas.google.com/g/2005\" xmlns:yt=\"http://gdata