MOXy @XmlPath expressions, are they supported?



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.


No comments:

Post a Comment