[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] More than one value for an attribute.
On 2/1/2011 6:43 PM, Kate.Wringe@sybase.com wrote: > Is there a way to define an attribute so that the writer can select more > than one choice for its value (i.e., can an attribute be set to a > delimited list of values)? > > For example: vendor= "Windows XP, Windows 2008, Linux, Unix, Mac, iOS". I guess if an attribute is defined as text, you could put a lot of stuff in there. The question is whether you want to. The issue, I think, would be with other applications that will be using this XML. I could for example imagine some application which tests whether your attr value matches some desired string, say "Unix". If that application does no processing of the attr value (or even if it just trims whitespace at each end), it won't find an exact match on the above attr. Even substring matching can be insecure; imagine a 'role' attr that can contain the strings 'men' or 'women' (I'm treading on dangerous ground here...). If the application writer tested for a substring match to 'men', there could be bad repercussions. Of course you could perform some kind of tokenization (maybe on commas in your example), but things are getting complex. If on the other hand 'vendors' were an element, and it could take one or more other elements as daughters, you might have a structure like <vendors> <vendor name="Windows XP"/> <vendor name="Linux"/> <vendors> and then testing for identity would be straightforward. Of course, if you're using someone else's schema, you can't control how these kinds of things are required to be represented, unless you override them with customizations. -- Mike Maxwell maxwell@umiacs.umd.edu "A library is the best possible imitation, by human beings, of a divine mind, where the whole universe is viewed and understood at the same time... we have invented libraries because we know that we do not have divine powers, but we try to do our best to imitate them." --Umberto Eco
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]