Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » eclipselink moxy xml-path binding file not skipping element(xml-path binding failing with unexpected element)
eclipselink moxy xml-path binding file not skipping element [message #1116914] Thu, 26 September 2013 00:18 Go to next message
Swarup Eda is currently offline Swarup EdaFriend
Messages: 1
Registered: September 2013
Junior Member
I was expecting by using xml-path that it skips elements when required to be ignored, but it doesn't seem to be doing that. Am I missing something?

It should be ignoring the nested element "responseHeader"
Please see below error, binding file, model samples


Caused by: org.xml.sax.SAXParseException: unexpected element (uri:"", local:"responseHeader"). Expected elements are <{}response>
    at org.eclipse.persistence.internal.oxm.record.UnmarshalRecordImpl.startUnmappedElement(
    at org.eclipse.persistence.internal.oxm.record.UnmarshalRecordImpl.startElement(

Here's the xml input

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href=""?>
<response xmlns:xsi=""
<sql>select * from csource_WEEKBOX LIMIT 0,20</sql>
<field type="integer">
<field type="integer">
<field type="integer">
<field type="string">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="integer">
<field type="string">
<field type="date">
<value>2013-09-24 11:08:34</value>

binding file:

<?xml version="1.0"?>
        version="2.1" package-name="com.dao">
        <java-type name="DaoResult">
            <xml-root-element name="response"/>
            <xml-type prop-order="results"/>
                <xml-element java-attribute="results" xml-path="responseBody/record" type="" container-type="java.util.List"/>
                <xml-transient java-attribute="totalCount"/>
                <xml-transient java-attribute="cachedTime"/>
                <xml-transient java-attribute="firstResult"/>
                <xml-transient java-attribute="inputQuery"/>
                <xml-transient java-attribute="paginationHandle"/>

Model class:

public class DaoResult<T>  extends AbstractModel implements Serializable {

    private static final long serialVersionUID = -6369563906973225250L;

    private String inputQuery;

    private Integer count = -1;

    private Integer totalCount;

    private List<T> results;

    private String paginationHandle;

    private Date cachedTime = new Date();
Re: eclipselink moxy xml-path binding file not skipping element [message #1118605 is a reply to message #1116914] Fri, 27 September 2013 15:25 Go to previous message
Denise Smith is currently offline Denise SmithFriend
Messages: 11
Registered: July 2009
Junior Member

Do you possibly have your own ValidationEventHandler specified on the JAXB Unmarshaller? The unmarshal will report errors for unexpected elements but our default event handler ignores those. The only way I could recreate this issue was to specify a custom event handler that fails on these errors (so behaves differently from our default event handler).

Previous Topic:Is it possible to define everything for Composite Persistent Units in one persistence.xml ?
Next Topic:How to use Moxy
Goto Forum:

Current Time: Sat Apr 04 19:40:26 GMT 2020

Powered by FUDForum. Page generated in 0.07238 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top