xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Wygand <...@wygand.com>
Subject Re: Attribute and Element
Date Thu, 18 May 2000 22:07:04 GMT
This is a cause of much debate and consternation for me. What I've
generally decided is that the relationship come down to IS A and HAS A.
If the thing in question is an integral part of the object represented
by the parent, then make it an attribute. However, if it's another
seperate 'object' and the parent known owns it, then I make it a child
node.

This is all still highly subjective, but I always try to think how I'd
model this in an RDBMS and then use a similar scheme.

An example is...

<EmailMessage>
  <Headers From="rob@wygand.com" 
           To="foo@bar.com" 
           Date="10-10-10T10:10:10Z"
           Subjec"Hello, there foo"/>
  <Body content_type="text/plain" content_encoding="7bit">
     Test message!
  </Body>
  <Attachment content_type="image/gif" name="myhouse.jpg"
content_encoding="base64">
 
AAlLJSLKFJLKFJSLJFLKSJFLSKJFLSKJFLKFJSLDJFLSJDFLKSJFLSJFLKSDJFSLKFJLFJSDLKJLSJFLS
 
LJSLKFJLKFJSLJFLKSJFLSKJFLSKJFLKFJSLDJFLSJDFLKSJFLSJFLKSDJFSLKFJLFJSDLKJLSJFLSAA0
                                                                     
[... etc ...]
  </Attachment>
</EmailMessage>


Cheun N Chong wrote:
>         The confusion I am having now is, should I put the Price (or
> ValidBefore) as an attribute of the Ticket or put it as an element under
> the Ticket. What is the difference, and what is the benefits?
>

Mime
View raw message