473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

dtd design heuristics?

Hi!
I'm pretty new to all this XML/SGML stuff and I'd like to know how you
decide, what values go in an attribute and what values in the text part of a node.
Consider a point, which has an x value an y value and a z value.
I see several possibilities:

<point x=1, y=2, z=3 />

<point>
<xkoord>1</xkoord>
<ykoord>2</ykoord>
<zkoord>3</zkoord>
</point>

<point>
<koord axis=x>1</koord>
...
</point>

<point>
<koord axis=x value=1 />
...
</point>

What do you think is best?
Generally, how does one decide which values to put in a sub node and which one into an attribute?

Lots of Greetings!
Volker
--
For email replies, please substitute the obvious.
Aug 23 '06 #1
3 1054
Volker Hetzer wrote:
Hi!
I'm pretty new to all this XML/SGML stuff and I'd like to know how you
decide, what values go in an attribute and what values in the text part
of a node.
Consider a point, which has an x value an y value and a z value.
I see several possibilities:
In either case, in XML you will need to quote (' or ") your attribute
values.
<point x=1, y=2, z=3 />
-- and no commas between the attrubutes ;)

In DTD you can data-type your attribute values but not text nodes. I
can't remember if there is an integer data type.

If you upgrade to XML Schema, there definitily are some numeral data
types, and you can use them on both attribute values and text nodes.
<point>
<xkoord>1</xkoord>
<ykoord>2</ykoord>
<zkoord>3</zkoord>
</point>
In DTD, all you can do is to allow SOME text to appear in <xkoordetc.
elements.
<point>
<koord axis=x>1</koord>
...
</point>

<point>
<koord axis=x value=1 />
...
</point>
In DTD, you can define an enumeration of x, y, z for the attribute
value. That is a nice way to go, if you want separate koord elements.
What do you think is best?
If you are sure to stay in 3D, and that the coordinates are always named
x, y, z, I would go for the first one. Others would not.
Generally, how does one decide which values to put in a sub node and
which one into an attribute?
There is no conclusion to that. Some people think attributes are for
metedata, and text nodes are for other data.

If you change your mind about your design, there is a nice transform
language called xslt that can transform from either of your formats to
any of the other.

Søren
Aug 23 '06 #2
Volker Hetzer wrote:
Hi!
I'm pretty new to all this XML/SGML stuff and I'd like to know how you
decide, what values go in an attribute and what values in the text part
of a node.
FAQ. See http://xml.silmaril.ie/developers/attributes/

///Peter
Aug 23 '06 #3
Soren Kuula schrieb:
Volker Hetzer wrote:
If you are sure to stay in 3D, and that the coordinates are always named
x, y, z, I would go for the first one.
Ok, so will I. The typing is nice.
>
>Generally, how does one decide which values to put in a sub node and
which one into an attribute?

There is no conclusion to that. Some people think attributes are for
metedata, and text nodes are for other data.

If you change your mind about your design, there is a nice transform
language called xslt that can transform from either of your formats to
any of the other.
Ok.

Thanks a lot to all who responded!
Volker
--
For email replies, please substitute the obvious.
Aug 24 '06 #4

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

Similar topics

3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
0
by: Edward Diener | last post by:
In Borland's VCL it was possible to divide a component into design time and run time DLLs. The design time DLL would only be necessary when the programmer was setting a component's properties or...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
2
by: Paul Cheetham | last post by:
Hi, I have moved an application from VS2003 to VS2005, and I am now unable to view most of my forms in the designer. The majority of the forms in my project are derived from class PACForm,...
5
by: Ludwig Wittgenstein | last post by:
Other than the Design Patterns book, which book(s) is/are the best to learn object-oriented software design/architecture from ?
23
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
19
by: neelsmail | last post by:
Hi, I have been working on C++ for some time now, and I think I have a flair for design (which just might be only my imagination over- stretched.. :) ). So, I tried to find a design...
14
by: v4vijayakumar | last post by:
In computer based, two player, board games, how to make computer play? Are there any formal ways to _teach_ computer, to choose best possible move? I know this is kind of off-topic here. Please...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.