Click to See Complete Forum and Search --> : how to create attributes without value


dimamo1983
09-10-2003, 09:49 PM
I was wondering if there is a way to create a valueless attribute in xml.
I know they say all the time that every XHTML attribute must have a value, even if it does not have to have one under HTML. In this case it will be something like attribute="attribute" (I don't remember the exact example all the books use).
And I'm fine with having that (attribute="attribute") in my xml document. My question is how do I create a schema for this attribute? Any ideas?

thanks
dima
ps. let me know if you have trouble understanding what I'm talking about and I will try to give you more info, just don't want to throw all the ideas I have at you from the start...

dimamo1983
09-10-2003, 10:10 PM
here's an example of the use:

<quote science="science" funny="funny">I'm astounded by people who want to 'know' the universe when it's hard enough to find your way around Chinatown.</quote>

lillu
09-24-2003, 02:14 AM
Hi,

There are great tutorials here in this subject at http://www.thescarms.com/

The following extract is from here:
http://www.thescarms.com/XML/SchemaTutorial.asp

Attributes
Attributes are different than elements and the rules that apply to elements do not apply to attributes. Also, different element types can have attributes with the same name but the attributes are independent and unrelated.

You can specify whether an attribute is required or optional and you can limit its value to a small set of strings. You can also indicate a default value to be used if the attribute is omitted from an element.


'Make the attribute required.
<AttributeType name="shipTo" dt:type="idref" required="yes"/>

'Limit the attribute's values to high, medium and low
<AttributeType name="priority" dt:type="enumeration" dt:values="high medium low" />

'Provide a default value of 1
<AttributeType name="quantity" dt:type="int">
<attribute type="quantity" default="1"/>