Are XPath expressions such as the following supported in MOXy?
field[XMLtag!='identifier']
Basically I've got XML like this
<demographics>
<field>
<value>12345</value>
<XMLtag>identifier</XMLtag>
</field>
<field>
<value>somename</value>
<XMLtag>name</XMLtag>
</field>
</demographics>
I'm trying to get a List to populate with but exclude the field which is for identifier.
This will work but gives me all field elements (2) in the List ( correctly )
@XmlElement( name = "field" )
public List<Field2> fieldList;
This will not, I get an empty List
@XmlPath( "field[XMLtag!='identifier']" )
public List<Field2> fieldList;
Should the above work, or are expressions like that not supported by MOXy? I can't seem to find any information about them.
I've not included my Field2 class as it's very simple and obviously works okay as I can unmarshall to list if using @XmlElement annotation. Let me know if you'd like to see it.
EclipseLink JAXB (MOXy)'s
@XmlPathannotation supports a subset of the XPath specification. The XPath handling is done by MOXy itself. The following concepts are supported:@idaddressaddress[1]address[@type='mailing']name/text()text().personal-info/name[2]/text()For namespace qualified nodes, the prefixes defined in the
@XmlNsannotations can be used to qualify the XPath fragments. Unqualified fragments will assumed to be in the namespace specified using@XmlSchema.