Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I need to design an XML file that would map fields and field values of two objects, say A and B. Fields are mapped one-to-one and values - many-to-one.

So far I could think of this design:

<obj_mapping>
    <field>
        <A_field>A_field_name</A_field>
        <B_field>B_field_name</B_field>
        <value_mapping>
            <A_value name="A_value">
                <B_value>B_value_1<B_value>
                <B_value>B_value_2<B_value>
                ...
            </A_value>
            ...
        </value_mapping>
    </field>
    ...
</obj_mapping>

Do you feel like this is good enough?

share|improve this question
    
any reason you have name="A_value"? –  ArsenMkrt Dec 27 '12 at 13:20
    
Any reason for keeping A_field and A_value in separate branches? Maybe simple <A_values name="A_field_name"><A_value name="A_value"><B_values name="B_field_name"><B_value>B_value_1</B_value><B_value>B_value_2</B_value></B_‌​values></A_value>? –  ony Dec 27 '12 at 13:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.