S
S
solaris772014-02-28 13:10:03
XML
solaris77, 2014-02-28 13:10:03

Elements or attributes in XML - which is more correct (more logical)?

It is necessary to store and display some dialogs.
For each site, forum and subject are the only ones, and there can be many.
What is the best way to store site, forum and subject - as attributes or elements? It seems to me that it is more logical in the form of attributes, since they are attributes (in the Russian sense of the word, and not in the programmer's) of the topic.
Attributes:

<topic site="site" forum="forum" subject="subject">
        <message>
            <date>date</date>
            <from>from</from>
            <text>text</text>
        </message>
        <message>
            <date>date1</date>
            <from>from1</from>
            <text>text1</text>
        </message>
    </topic>

Elements:
<topic>
        <site>site</site>
        <forum>forum</forum>
        <subject>subject</subject>
        <message>
            <date>date</date>
            <from>from</from>
            <text>text</text>
        </message>
        <message>
            <date>date1</date>
            <from>from1</from>
            <text>text1</text>
        </message>
    </topic>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question