Another way to do it:

<apn value="foo">
  <plan type="prepaid"/>
  <plan type="postpaid"/>
  <usage type="internet"/>
  <usage type="wap"/>
</apn>

That way, the plan types and the usage types can still be declared as
enumerations.

Eric


On Fri, Jul 29, 2011 at 8:39 AM, Marius Kotsbak <marius.kots...@gmail.com>wrote:

> Den 29. juli 2011 13:35, skrev Oleg Zhurakivskyy:
>
>  Hello everyone,
>>
>> On 07/28/2011 06:51 PM, Dan Williams wrote:
>>
>>> On Thu, 2011-07-28 at 10:59 -0400, Eric Shienbrood wrote:
>>>
>>>> I think the only way to allow multiple tokens in an attribute is by
>>>> declaring the type to be NMTOKENS. But if you do that, then it can't
>>>> be an enumeration, so you lose the validation that that provides. If
>>>> you want to use an enumeration, then you'll have to allow for multiple
>>>> 'plan' or 'type' elements.
>>>>
>>>
>>> Hmm, oh well... maybe we need to do that then.  I think having multiple
>>> plan and type tokens is the best way to do this ATM so maybe we do have
>>> to put these into the body of the APN.
>>>
>>
>> So, there are multiple choices:
>>
>> 1. Multiple values for the "type" and "plan" attributes:
>>
>> <apn value="foobar" type="internet wap" plan="prepaid postpaid">
>>    ...
>> </apn>
>>
>
> Easy to read and edit.
>
>
>
>> This isn't possible to validate since XML doesn't allow multiple tokens
>> for the attribute.
>>
>> 2. Multiple attributes with the same name:
>>
>> <apn value="foobar" type="internet" type="wap" plan="prepaid"
>> plan="postpaid">
>>    ...
>> </apn>
>>
>
> Ugly to read and write.
>
>
>> XML doesn't allow this either?
>>
>> 3. To put the "type" and "plan" into the body and use them as elements,
>> i.e:
>>
>> <apn value="foo">
>> <type>internet</type>
>> <type>wap</type>
>> <plan>prepaid</plan>
>> <plan>postpaid</plan>
>>    ...
>> </apn>
>>
>
> Easy to read and write.
>
>
>> But, here the same problem again, i.e. the content of the element can't be
>> restricted with the enumeration, right?
>>
>>
> But does not validate fully. It is possible using XML schema instead of
> DTD: 
> http://en.wikipedia.org/wiki/**XML_Schema_(W3C)#Example<http://en.wikipedia.org/wiki/XML_Schema_(W3C)#Example>
>
> Maybe this way it is possible with DTD:
>
>
> <apn value="foo">
> <type>
> <internet/>
> <wap/>
> </type>
>
> <plan>
> <prepaid/>
> <postpaid/>
> </plan>
> </apn>
>
>  4. How about using attributes this way?
>>
>> <apn value="foobar" internet="yes" prepaid="yes" postpaid="yes">
>>    ...
>> </apn>
>>
>
> Not so bad if they are optional.
>
> --
> Marius
>
>
> ______________________________**_________________
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> http://mail.gnome.org/mailman/**listinfo/networkmanager-list<http://mail.gnome.org/mailman/listinfo/networkmanager-list>
>
_______________________________________________
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to