Dennis Sosnoski wrote:
> ...
> ... if you're planning to use the XML with other tools you're probably 
> better off switching to the customer name as an attribute on the fixed 
> "Customer" element name, as Thomas suggested.

Whoops, I see that Thomas *didn't* suggest that. What I meant was 
switching to a format like:

  <customers>
    <customer name="john">
      <age>27</age>
    </customer>
    ...

or, for that matter:

  <customers>
   <customer>
     <name>John</name>
     <age>27</age>
   </customer>
   ...

  - Dennis

>
> Cheers,
>
>  - Dennis
>
> Dennis M. Sosnoski
> SOA and Web Services in Java
> Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
> jamesavery22 wrote:
>> Thanks Thomas
>>
>>
>> Thomas Jones-Low wrote:
>>  
>>>     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
>>>
>>>
>>>     
>>
>>   
>

-------------------------------------------------------------------------
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

Reply via email to