Attributes in closing tags?

I

Ian Partridge

Hello,

I am planning to use XML in a log file for an application I am writing. The
format will be something like:

<task date="2003-10-09" time="12:03:45">
<action type="action1" timetaken="4" />
<action type="action2" timetaken="4" />
<action type="action3" timetaken="4" />
</task duration="12">

Is this legal XML? Are you allowed attributes in closing tags? (the
"duration" attribute for example). If not, how can I produce output similar
to this which is valid XML - bearing in mind that the total time taken for
a "task" will not be known until each "action" has completed. Also, it is
not guaranteed that the task duration will be equal to the sum of the
action durations.

Many thanks in advance,

Ian Partridge
 
K

Kimanzi Mati

Hi Ian,

No, you cannot include any attributes in closing tags unfortunately.
However, since you only know the duration after all the <action>s have been
processed, you could get away with sticking a last <duration> child node
into the <task> node. Without knowing more of the details of what you are
doing, I cannot offer better help. Still, I hope the above helps you get
moving.

Kimanzi Mati
www.emergentlogic.com
 
I

Ian Partridge

Hi,

Yes, of course that would be possible. I feel very stupid now!

Thanks for pointing that out.

Ian
 
K

Kimanzi Mati

Glad to be of service... :)

Ian Partridge said:
Hi,

Yes, of course that would be possible. I feel very stupid now!

Thanks for pointing that out.

Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top