ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiran vuppla <kirankumar_vup...@yahoo.com>
Subject Reading xml file
Date Mon, 14 Apr 2008 14:09:57 GMT

I have an xml file and want to store in to an IBatis object. Please let me know if any one
has any solution to write the SQL.

XML FILE:

<content>
  <talent>
    <image>/images/test1.gif</image>
    <imageAltText>testImageAltText</imageAltText>
    <links>
    <link>/urls/link1.html</link>
    <text>link1</text>
    </links>
    <links>
    <link>/urls/link2.html</link>
    <text>link2</text>
    </links>
   </talent>
  <talent>
    <image>/images/test2.gif</image>
    <imageAltText>testImageAltText2</imageAltText>
    <links>
    <link>/urls/link3.html</link>
    <text>link3</text>
    </links>
    <links>
    <link>/urls/link4.html</link>
    <text>link4</text>
    </links>
   </talent>
  </content>

IBATIS RESULT MUST BE:

   <resultMap class="com.test.domain.MainModule" id="MainModuleResultObject" groupBy="id">
    <result property="modules" resultMap="module.ModuleResults"/>
   </resultMap>

   <resultMap class="com.test.domain.Module" id="ModuleResults" groupBy="id">
      <result property="id" column="ID"/>
       <result property="titleImageURL" column="IMG_URL"/>
       <result property="titleImageAltText" column="IMG_ALT_TEXT"/>
       <result property="moduleElements" resultMap="module.ModuleElementResult"/>  
    
    </resultMap>

   <resultMap class="com.test.domain.ModuleElement" id="ModuleElementResult">
            <result property="link" column="LINK"/>
            <result property="text" column="TEXT"/>
    </resultMap>

 If some one can help me out in writing SQL to return the result in the above format that
would be grateful.

 Thanks in advance for your time.
 Kiran
 
        
Mime
View raw message