Hi,

I have an XML document that I have read in using DOM, I am using
JXPath on the DOM Document as the context. I want to get a Node from
the DOM with JXPath and have it return it as a custom object of my
defining. In effect I am trying to map an XML Node to a custom Object.

I cant seem to get this to work, JXPath seems to always want to return
a String as the Node value. How can I acheive this please???

e.g.

org.e3c.dom.Document doc = ...
JXPathContext context = JXPathContext.newInstance(doc);
ResponseExceptionList exceptionList =
(ResponseExceptionList)context.getValue("/ConditionReportCreateResponse_1/ExceptionList",
ResponseExceptionList.class);


My XML Document looks a bit like this -

<ConditionReportCreateResponse_1>
<ExceptionList>
<Exception>
<ErrorCode>some error code</ErrorCode>
<ErrorMessage>some error message</ErrorMessage>
</Exception>
</ExceptionList>
</ConditionReportCreateResponse_1>

My Java Class looks a bit like this -

public class ResponseExceptionList {
                public class ResponseException {
                        private String errorCode = null;
                        private String errorMessage = null;

                        public ResponseException(String errorCode, String 
errorMessage) {
                                this.errorCode = errorCode;
                                this.errorMessage = errorMessage;
                        }
                }

                private ArrayList<ResponseException> exceptions = new
ArrayList<ResponseException>();
                
                public ResponseExceptionList(ArrayList<ResponseException> 
exceptions) {
                        this.exceptions = exceptions;
                }
        }

-- 
Adam Retter

Software Pimp Extraordinaire

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to