You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Gr...@MDSUK.COM on 2005/03/15 12:44:24 UTC
invalid character exception when returning an XML result object
I'm new to this, so please forgive me if this is a daft question
I'm trying to return an XML result object using a resultMap and I'm
getting the following exception
Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or
illegal XML character is specified.
my sql map includes:
<resultMap id="user-result-xml" class="xml" xmlName="outermost element">
<result property="password" column="PASSWORD" javaType="java.lang.String"/>
</resultMap>
<select id="getXMLPasswordUsingUserId" parameterClass="java.lang.String"
resultMap="user-result-xml" >
SELECT
ut.password as PASSWORD
FROM use_table ut
WHERE
user_id = #userId#
</select>
I've tried without the resultMap, ie by setting resultClass as "xml" in
the <select> element,
and it works fine. I just can't get it working using the result map
Thanks
Greg Peace
Re: invalid character exception when returning an XML result object
Posted by Clinton Begin <cl...@gmail.com>.
"outermost element" is not a valid element name, you can't have spaces
in element names.
Clinton
On Tue, 15 Mar 2005 11:44:24 +0000, Greg.Peace@mdsuk.com
<Gr...@mdsuk.com> wrote:
>
> I'm new to this, so please forgive me if this is a daft question
>
> I'm trying to return an XML result object using a resultMap and I'm getting
> the following exception
>
> Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or
> illegal XML character is specified.
>
> my sql map includes:
>
> <resultMap id="user-result-xml" class="xml" xmlName="outermost element">
> <result property="password" column="PASSWORD" javaType="java.lang.String"/>
> </resultMap>
>
> <select id="getXMLPasswordUsingUserId" parameterClass="java.lang.String"
> resultMap="user-result-xml" >
> SELECT
> ut.password as PASSWORD
> FROM use_table ut
> WHERE
> user_id = #userId#
> </select>
>
> I've tried without the resultMap, ie by setting resultClass as "xml" in the
> <select> element,
> and it works fine. I just can't get it working using the result map
>
> Thanks
>
> Greg Peace