Hello all,

I just would like to say castor is really cool, thanks for all your hard
work. I am trying to map some xml formats from DAS servers to object in my
program...

Okay first off my xml document:

<?xml version="1.0" standalone="no"?>
     <!DOCTYPE DASDNA SYSTEM "http://www.biodas.org/dtd/dasdna.dtd";>
     <DASDNA>
       <SEQUENCE id="id" start="start" stop="stop" version="X.XX">
         <DNA length="NNNN">
           atttcttggcgtaaataagagtctcaatgagactctcagaagaaaattgataaatattat
           taatgatataataataatcttgttgatccgttctatctccagacgattttcctagtctcc
           agtcgattttgcgctgaaaatgggatatttaatggaattgtttttgtttttattaataaa
           taggaataaatttacgaaaatcacaaaattttcaataaaaaacaccaaaaaaaagagaaa
         </DNA>
       </SEQUENCE>
     </DASDNA>


Okay so this is my xml, now I need to convert this into a DNA object ...

the DNA object looks like this:


public class DNA implements Sequence
{
    private String id;
    private Range range;
    private long length;
    private String version;
    private String value;
    private String type;


   public String getID() ...
   ...
}

My mapping:


<mapping>

    <class name="edu.mit.wi.omnigene.omnidas.DASDNA">
        <map-to xml="DASDNA"/>

        <field name="DNAs"
                type="edu.mit.wi.omnigene.omnidas.DNA" collection="array">
            <bind-xml name="SEQUENCE"/>
        </field>
    </class>


    <class name="edu.mit.wi.omnigene.omnidas.DNA">
        <map-to xml="SEQUENCE"/>

        <!-- XXX
                How do I deal with this?
                making a range object from two
                attributes in the SEQUENCE tag, how? impossible?
        <field name="Range" type="edu.mit.wi.omnigene.omnidas.RangeImpl">
            <bind-xml name="stop" node="attribute"/>
        </field>

        <field name="Range" type="edu.mit.wi.omnigene.omnidas.RangeImpl">
            <bind-xml name="start" node="attribute"/>
        </field> -->

        <field name="ID" type="java.lang.String">
            <bind-xml name="id" node="attribute"/>
        </field>

        <!-- XXX This needs to be in the DNA element to get this
                attribute, dang, any ideas?
        <field name="Length" type="long">
            <bind-xml name="length" node="attribute"/>
        </field>

        -->

        <field name="SequenceValue" type="java.lang.String" >
            <bind-xml name="DNA" node="element"/>
        </field>

    </class>

</mapping>


the DNA class is mapped to the SEQUENCE tag.  Now if I already mapped
the SEQUENCE tag to a DNA object, can i map it to a Range object as well
so I can access the start and stop attributes? Also is there a way to
access the length attribute of the DNA tag?

Thanks in advance,

Mike Stoppelman
omnigene.sourceforge.net

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to