Werner
-----Original Message-----
From: kiran talasila [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 4:23 PM
To: [email protected]
Subject: [castor-user] How to map thisHello All,
I am trying to map the below XML instance to a castor mapping file and parser is complaining on that you can't have duplicate map-to elements.
We are using the binding files rather than creating the java bean classes from the source generator.(we have to use the existing java beans)..
XML instance :
<aoc-doc:SpinoffSearchDocument xmlns:aoc-doc="http://aoc.state.nc.us/jxdm/3.0.2/aoc-document" xmlns:aoc="http://aoc.state.nc.us/jxdm/3.0.2/aoc" xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doj="http://jus.state.nc.us/doj" xsi:schemaLocation="http://aoc.state.nc.us/jxdm/3.0.2/aoc-document document-schema.xsd">
<aoc:SpinoffSearch>
<doj:header>
<doj:messageType>ACSC</doj:messageType>
<doj:messageNumber>321FFFAB</doj:messageNumber>
<doj:originator>0AAAAAAAA</doj:originator>
<doj:destination>0AAAAAAAA</doj:destination>
<doj:correlationId>AAAAAAAbbbbCCCCCC</doj:correlationId>
<doj:userContext></doj:userContext>
<doj:completionCode>AAA000000</doj:completionCode>
</doj:header>
<aoc:SearchRequest>
<j:PersonName>
<j:PersonMiddleName>JAMES</j:PersonMiddleName>
<j:PersonSurName>SMITH</j:PersonSurName>
</j:PersonName>
<j:PersonBirthDate>1962-02-11</j:PersonBirthDate>
</aoc:SearchRequest>
</aoc:SpinoffSearch>
</aoc-doc:SpinoffSearchDocument>
Castor Binding file :
<?xml version="1.0" encoding="UTF-8"?>
<mapping xmlns="http://castor.exolab.org/" xmlns:aoc-doc="http://aoc.state.nc.us/jxdm/3.0.2/aoc-document" xmlns:aoc="http://aoc.state.nc.us/jxdm/3.0.2/aoc" xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doj="http://jus.state.nc.us/doj">
<description>Basic mapping example</description>
<class name="org.nccourts.aware.bean.business.dci.DciPersonSearchBean" auto-complete="false">
<map-to xml="aoc-doc:SpinoffSearchDocument">
<map-to xml="aoc:SpinoffSearch">
<field name="header" type="org.nccourts.aware.bean.business.dci.DojHeaderBean" auto-complete="false">
<bind-xml name="doj:header" />
</field>
<field name="personSearchBean" type="org.nccourts.aware.bean.business.participant.person.PersonSearchBean" auto-complete="false">
<bind-xml name="aoc:SearchRequest" />
</field>
<field name="personSearchResult" collection="collection" type="org.nccourts.aware.bean.business.dci.DciPersonSearchResultBean" auto-complete="false">
<bind-xml name="aoc:SearchResultsReply" />
</field>
</map-to>
</map-to>
</class>
<class name="org.nccourts.aware.bean.business.dci.DojHeaderBean" auto-complete="false">
<map-to xml="doj:header" ns-uri="http://jus.state.nc.us/doj" ns-prefix="doj" />
<field name="messageType">
<bind-xml name="doj:messageType" />
</field>
<field name="messageNumber">
<bind-xml name="doj:messageNumber" />
</field>
<field name="originator">
<bind-xml name="doj:originator" />
</field>
<field name="destination">
<bind-xml name="doj:destination" />
</field>
<field name="correlationId">
<bind-xml name="doj:correlationId" />
</field>
</class>
<class name="org.nccourts.aware.bean.business.participant.person.PersonSearchBean" auto-complete="false">
<map-to xml="aoc:SearchRequest" ns-uri="http://aoc.state.nc.us/jxdm/3.0.2/aoc" ns-prefix="aoc">
<map-to xml="j:PersonName" ns-uri="http://www.it.ojp.gov/jxdm/3.0.2" ns-prefix="j">
<field name="middleName">
<bind-xml name="j:PersonMiddleName" />
</field>
<field name="lastName">
<bind-xml name="j:PersonSurName" />
</field>
<field name="firstName">
<bind-xml name="j:PersonMaidenName" />
</field>
</map-to>
<field name="dateOfBirth">
<bind-xml name="j:PersonBirthDate" />
</field>
<map-to xml="j:DriverLicense" ns-uri="http://www.it.ojp.gov/jxdm/3.0.2" ns-prefix="j">
<map-to xml="j:DriverAuthorizationID.Detailed" ns-uri="http://www.it.ojp.gov/jxdm/3.0.2" ns-prefix="j">
<field name="dmvId">
<bind-xml name="j:ID" />
</field>
<field name="dmvIdStateKey">
<bind-xml name="j:IDJurisdictionCode" />
</field>
</map-to>
</map-to>
</map-to>
</class>
</mapping>
Thanks,
Kiran.
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football

