The problem is that your example isn't valid XML as JiBX knows it. JiBX
assumes you have predefined all the tag names. You either need to know
the complete list of customers ahead of time or the use the structure as
<customers>
<customer name="john"> <age>27</age> </customer>
<customer name="bill"> <age>29</age> </customer>
</customers>
--
Thomas Jones-Low Softstart Services Inc.
[EMAIL PROTECTED] JobScheduler for Oracle
Ph: 802-398-1012 http://www.softstart.com
jamesavery22 wrote:
> Thanks for the reply. My problem is I'll never be able to put <structure
> name="John"... because "John" will never be known. Its a value in some
> class not the name of the instance of that class.
>
>
> gka wrote:
>> the binding XML will be
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <binding value-style="attribute">
>> <mapping class="Customer" name="Customer" >
>> <structure name="John" map-as="commonTag"/>
>> <structure name="bill" map-as="commonTag"/>
>> </mapping>
>> <mapping type-name="commonTag" class="commonTag" abstract="true">
>> <value style="attribute" name= "age" field= "age" usage="optional"/>
>> <value style="attribute" name= "age" field= "age" usage="optional"/>
>> </mapping>
>> </binding>
>>
>> You class definition is wrong.
>> You will have to have a class definition like this
>>
>> public class Customer {
>> commonTag john ;
>> commonTag bill ;
>> }
>>
>> public class commonTag{
>> string name;
>> string age;
>> }
>>
>>
>>
>>
>>
>>
>>
>> jamesavery22 wrote:
>>> The xml I want looks like this:
>>>
>>> <customers>
>>> <john>
>>> <age>27</age>
>>> </john>
>>> <bill>
>>> <age>29</age>
>>> </bill>
>>> </customers>
>>>
>>>
>>> and the class is like this:
>>>
>>> public class Customer {
>>> private string name;
>>> private string age;
>>> }
>>>
>>>
>>> How can I just get the structure name to be based on the field "name?"
>>>
>>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users