473,498 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grouping of elements?

The following show two examples, which one is better you think?

<report>
<minScore></minScore>
<maxScore></maxScore>

.... other stuffs
</report>

or

<report>
<score>
<maxScore></maxScore>
<minScore></minScore>
</score>
...
</report>

Sep 16 '07 #1
6 1669
howa wrote:
The following show two examples, which one is better you think?

<report>
<minScore></minScore>
<maxScore></maxScore>

... other stuffs
</report>

or

<report>
<score>
<maxScore></maxScore>
<minScore></minScore>
</score>
...
</report>
If the scores are textual, then the redundancy is unnecessary:

<report>
<scores>
<min></min>
<max></max>
</scores>
....
</report>

If the scores are numeric or categorical, attributes are more common:

<report>
<score min="34" max="57"/>
....
</report>

///Peter
Sep 16 '07 #2
As with other data structures, this depends on how you're going to use
the data now and in the future. If you will eventually be making "score"
more complicated, having it be a separate element may make sense. If min
and max score are really just part of the report, the extra level of
hierarchy may not make sense.

Why do you want the <scoreelement? If you can't explain that (to
yourself), you probably don't want it.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 17 '07 #3
Hello all,

One of my concern is: If I parse the XML into DOM, will attribute or
new element using more memory at runtime?
On 9 17 , 8 12 , Joe Kesselman <keshlam-nos...@comcast.netwrote:
As with other data structures, this depends on how you're going to use
the data now and in the future. If you will eventually be making "score"
more complicated, having it be a separate element may make sense. If min
and max score are really just part of the report, the extra level of
hierarchy may not make sense.

Why do you want the <scoreelement? If you can't explain that (to
yourself), you probably don't want it.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry

Sep 17 '07 #4
Elements will occupy more memory than attributes.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Sep 17 '07 #5
Maybe it will be better if

<report maxScore="34" maxScore="57">

....

?

Personally, I don't like empty element with attributes.

Or is it the common way to do in this way?

Thanks.
>
If the scores are numeric or categorical, attributes are more common:

<report>
<score min="34" max="57"/>
...
</report>

///Peter

Sep 17 '07 #6
howa wrote:
<report maxScore="34" maxScore="57">
That would be my own inclination.
Personally, I don't like empty element with attributes.
As I said: The question is how much structure you think you might add in
the future. Attributes can't have XML substructure, so if things
eventually get more complicated you will have to either add more
attributes, more children, or a more complicated syntax for your
attribute values.

Very much a matter of taste and style. Do whatever makes most sense for
the markup language you're working with and the applications that will
manipulate it.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 17 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1798
by: Graham | last post by:
Hi, I am having trouble getting XSL to count the members of a group. What I am trying to do is group by <objectid.Contactid> and count the number of <activityid>'s for each <objectid.contactid>....
5
1590
by: Mike King | last post by:
I don't know how to group the following data in the way I want it. I want the output of the transformation to be "5678". Does anyone know what I am doing worry? <?xml version="1.0"?> <data>...
5
2150
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at...
2
10593
by: Chris Beach | last post by:
Hi there. I'd like to be able to group together inputs on an HTML form inside, say, a <div> or <fieldset> and then use javascript to iterate through the controls in the group and disable them....
3
3996
by: _DD | last post by:
I believe Balena's Best Practices book suggests grouping quite a few classes into each namespace. I don't remember a number, but this has me curious about how other programmers handle this. If...
1
1667
by: lennyw | last post by:
Hi I'm trying to use XSLT to do an xml to xml transformation where the output xml contains summary data on the information in the input xml. I've succesfully done a Muenchian grouping of the...
6
1593
by: jkoufala | last post by:
Hi I am new to XSLT and i have a problem with grouping. What im trying to do is group using two elements as a unique identifier. This is output from another program which outputs the same element...
2
3265
by: =?Utf-8?B?YmVuamk=?= | last post by:
Hi, I'm investigating the new listview control. The grouping functionality is very cool, but I don't want to simply group every x elements; i'd like to do custom grouping (I want to say, start a...
0
1511
by: Hvid Hat | last post by:
Hi At first, I thought I could only solve my problem with a C# method inside my XSLT but I'm beginning to think it might be possible with XSLT only. So I'm trying, but I need help :-) How can I...
0
1745
by: Leira | last post by:
Hi, I have a problem with grouping. My source XML has <record> elements that have a @name and a @group attribute. It looks something like this: <root> <result> <record name="test1"...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.