I am still facing one issue on getting actual element names, this time it is
about a particular element name(<id1>).
1. method generated by xmlbean from wsdl
public org.apache.xmlbeans.XmlString xgetId1()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target =
(org.apache.xmlbeans.XmlString)get_store().find_element_user(ID1$10, 0);
return target;
}
}
2.code to get element name
Line 1: XmlString xobj = xparent.xgetId1();
Line 2: TypeStore _textsource = xobj .get_store();
Line 3: SchemaField field = _textsource.get_schema_field();
Line 4: String ElementName = field .getName().getLocalPart();
3.some how the field returned from line 4 is null on element<id1> while same
code works perfectly for any other elements
<id1>600000000005</id1>
<player_name>John</player_name>
<timestamp>20100101111111</timestamp>
can someone help or suggest a different way to get the element name?
Thanks
Jerry
On Wed, Jan 20, 2010 at 3:29 PM, Jerry Wang <[email protected]> wrote:
> you are right, what I am looking for is to use reflection to create (xml
> element)name/value pairs using reflection.
> from the XmlStringImpl returned from xget(), I am able to get the element
> names for most of the regular ones, still working on how to get names for
> those complex types.
> Cheers
> Jerry
>
>
>
> On Wed, Jan 20, 2010 at 2:20 PM, Jacob Danner <[email protected]>wrote:
>
>> So you would use reflection or something like it to infer the name?
>> Seems like you could get this 'actual element name' information from
>> the schematypesystem apis without too much hassle.
>> -jacobd
>>
>> On Wed, Jan 20, 2010 at 10:29 AM, Jerry Wang <[email protected]>
>> wrote:
>> > just want to get original element names from generated classes, so those
>> > names can be passed onto other components.
>> >
>> > On Wed, Jan 20, 2010 at 12:50 PM, Gillen, Paul <[email protected]>
>> > wrote:
>> >>
>> >> Pardon the impertinence, but why?
>> >>
>> >>
>> >>
>> >> ________________________________
>> >>
>> >> Paul
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >>
>> >> From: Jerry Wang [mailto:[email protected]]
>> >> Sent: Wednesday, January 20, 2010 10:26 AM
>> >> To: [email protected]
>> >> Subject: question on code generation with regard to non-alphabetic
>> >> character in xml element name
>> >>
>> >>
>> >>
>> >> I am using xmlbean to generate code from wsdl, the issue I am facing is
>> >> that names of some xml elements have special character like "_"(for
>> example
>> >> <first_name>).
>> >> and the getter generated is getFirstName().
>> >> can I somehow force the method generated to have exact xml tag name
>> like
>> >> getFirst_Name()?
>> >> I really do not want to do mapping,just too much over head.
>> >> Thanks
>> >> Jerry
>> >>
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>