[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EDUML sample
> <ADDRESS phone="xxxxxx" fax="xxxxx" email="xxxxx" snail="xxxx" uri="xxxx">
...
> <ADDRESS>
> address: xxxx
> phone: xxxx fax: xxxx
> email: xxxx uri: xxxx
> </ADDRESS>
...
> <ADDRESS> address 123-1231243 asdf@asdf.asdf http://www.what.org </ADDRESS>
How about
<ADDRESS>
<PHONE>xxxxx</PHONE>
<EMAIL>xxxxx</EMAIL>
...
</ADDRESS>
That way you can still generate your automatic phone lists - it's just a
matter of saying getAddress().getPhone() rather than getPhone(). But, since
schools, students and teachers probably all have their own address block,
then when it came time to write a UI for this thing, you could write the
address handling piece once to handle an <ADDRESS> object (i.e. a hypercard
object), and then just throw any given entity's address at it.
It also makes your DTD easier, since
you define address once and then just say it's an optional element of these
other entities, rather than having to constantly repeat to yourself that
fields (snail, email, phone, address...) are optional for each. Because
in the latter case, what happens when for a future version of the dtd
someone says "Instead of just 'address', could we please break it up into
'street' and 'city'?" With one address definition, you only need to change
that in one spot. If you have to change it in more than one place, you run
the risk of getting out of sync. (Now that I think of it, I'd probably make
address a required element, but have everything inside of it optional. That
way you'd know you could do getAddress() on everybody, and then handle the
null cases inside the address handler itself.)
At least, that was my thinking.
Duane
>
> Have I missed any other options? From what I have studied about XML, the
> recommended approach is to use separate tags for separate functionality,
> though. What do you think?
>
> Bruno