users@jaxb.java.net

Re: DTD generation of (#PCDATA | field)*

From: M.Ismail <mohammed.hany_at_gmail.com>
Date: Wed, 23 Jun 2010 05:55:46 -0700 (PDT)

Hi,

I just want to try custom binding but I don't know what to search for to do
the following:

<application>
<request>cmd -i 1 -p 1 -s -a
<field name="phone">255685082753</field>
<application>

notice that the request element has both a #PCDATA and a request element
value. How to define this in custom jaxb binding? I've tried customizing the
type using javaType to Object but it didn't work.

thanks





M.Ismail wrote:
>
> Hi,
>
> I have a DTD schema that is defined as:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!ELEMENT application (request | response)>
> <!ELEMENT request (#PCDATA | field)*>
> <!ELEMENT field (#PCDATA)>
> <!ATTLIST field
> name CDATA #REQUIRED
>>
> <!ELEMENT response (number? | record* | error?)>
> <!ELEMENT number (#PCDATA)>
> <!ELEMENT record (field)+>
> <!ELEMENT error (#PCDATA)>
>
>
> I want to generate the following xml for example:
> <application>
> <request>cmd -i 1 -p 1 -s -a
> <field name="phone">255685082753</field>
> <field name="username">user</field>
>
> </request>
> </application>
>
> However I'm having trouble dealing with the element: <!ELEMENT request
> (#PCDATA | field)*>
>
> because the signature of the request.setValue is:
> public void setvalue(String value) {
> this.value = value;
> }
>
> How can I set its value to both a PCDATA and multiple fields?
>
> Thanks,
>

-- 
View this message in context: http://old.nabble.com/DTD-generation-of-%28-PCDATA-%7C-field%29*-tp28916598p28971440.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.