473,385 Members | 1,958 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.

Tags v.s. Attributes

I'm fairly new to using XML and I tend to be quite verbose when
writting files.

Is there any disadvantage of writting:

<person>
<name first="Carlos" second="" />
<lastname first="Obregon" second="Jimenez" />
<id type="CC" number="79879389" />
<birthday day="17" month="02" year="1979" />
<member day="01" month="06" year="2007" />
<adress id="Evegreen Cr. 1234" />
<telephone number="555-123456" />
<email user="me" domain="home.com" />
</person>

Intead of:

<person>
<name>
<first>Carlos</first>
<second></second>
</name>
<lastname>
<first>Obregon</first>
<second>Jimenez</second>
</lastname>
<id>
<type>CC</type>
<number>79879389</number>
</id>
<birthday>
<day>17</day>
<month>02</month>
<year>1979</year>
</birthday>
<member>
<day>01</day>
<month>06</month>
<year>2008</year>
</member>
<adress>Evegreen Cr. 1234</adress>
<telephone>555-123456</telephone>
<email>
<user>me</user>
<domain>home.com</domain>
</email>
</person>

Thanks.
Jul 8 '08 #1
5 1501
I think this article should be good read,
http://www.ibm.com/developerworks/xm.../x-eleatt.html ..
Jul 9 '08 #2
gaijinco wrote:
I'm fairly new to using XML and I tend to be quite verbose when
writting files.
FAQ. See http://xml.silmaril.ie/developers/attributes/

///Peter
Jul 13 '08 #3
Stefan Ram wrote:
Peter Flynn <pe********@m.silmaril.iewrites:
>Again, not true. <rose owner="Jack Jill Stefan"/is the normal solution
to multiple parallel values, where owner is declared as IDREFS or ENTITIES.

Thank you, I was not aware of IDREFS or ENTITIES yet.
So, there is limited support for parallel values in XML.

One might say for »parallel /references/« (to ids or entities).
It seems as if it can not be used when the values are literals
(not references) such as numerals (numbers), for example.
That's correct. XML is based on SGML DTDs, and was aimed at the document
publishing field. There are many things that users of rectangular data
would like to see allowed, but for that you need another syntax.

///Peter

Jul 26 '08 #4
Stefan Ram wrote:
Peter Flynn <pe********@m.silmaril.iewrites:
>Again, not true. <rose owner="Jack Jill Stefan"/is the normal solution
to multiple parallel values, where owner is declared as IDREFS or ENTITIES.

Thank you, I was not aware of IDREFS or ENTITIES yet.
So, there is limited support for parallel values in XML.

One might say for »parallel /references/« (to ids or entities).
It seems as if it can not be used when the values are literals
(not references) such as numerals (numbers), for example.
That though is a restriction of DTD rather than of XML itself. Other XML
validation languages such as XSD or Relax NG Schema, or schematron for
exampes can all easily be used to constrain an attribute to be (for
example) a white space separated list of integer values.

David

--
http://dpcarlisle.blogspot.com
Jul 26 '08 #5
Stefan Ram wrote:
David Carlisle <da********@dcarlisle.demon.co.ukwrites:
>That though is a restriction of DTD rather than of XML itself. Other XML
validation languages such as XSD or Relax NG Schema, or schematron for
exampes can all easily be used to constrain an attribute to be (for
example) a white space separated list of integer values.

You can also create a validation language that can be used to
constrain an attribute to be a valid Java program.

However, the structure of such an attribute is not being
described by the XML language anymore. The XML TR does not
describe the Java syntax. So it is not provided by the XML TR.

The XML TR describes a document made of elements and possibly
attributes. It provides rules and names for these structural parts.

XML provides rules and names for a list of IDREFs within an
attribute, so this still »is« XML.

But the XML TR does not provide rules and syntactical names
(nonterminal symbols) for a list of integer numerals (integer
literals) within an attribut.

This is another language. It might be call »Relax-XML« or so.

Such a valid Relax-XML document also can be a valid XML document.
Insofar it »is« XML. But XML does not describe a special
syntax for integer numerals within an attribute value. To XML,
this is just an opaque attribute value. Interpreting this as a
list of integers is not backed by the XML TR anymore, this needs
the additional Relax specification.
there are lots of things the XML spec doesn't secify, but to say XML
encoding lists of numbers (an SVG path attribute for example) isn't XML
is a rather strange conclusion to draw. For a start a lot (quite
possibly a majority) of XML is "just" well formed and not validated at
all so the relative expressive strengths of validation languages are
irrelevant. For documents that are to be validated, it's issentially
irrelevant to the end user, the internal organisation and timing of the
various working groups that mean that xml is split across a range of
specifications, xml itself, xml names, sax, dom, xsd etc. If you just go
by what's in the XML rec without relying on anything else, you can not
even use any standard parsing model, so use fo XML woul dbe rather hard,
or you may decide it's legal to use names like <a:b:c/but then find
that the vast majority of current xml tools follow the additinal
constraints in the namespace spec and would reject such an element.

Actually even by your definition XML can do more than you imply: IDREFS
isn't the only list type NMTOKENS for example would allow you to specify
an attribute is a white space list of something, even if you can't, in
DTD, restrict the tokens further to be just digits. But to say XML with
lists of integers in an attribute isn't really XML because DTD can't
validate the XML is just like saying that an XMl document containing
english text isn't really XML because DTD can't enforce spell checking.
By that definition, what can XML be used for?

David

--
http://dpcarlisle.blogspot.com
Jul 29 '08 #6

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

Similar topics

4
by: Brian | last post by:
Hi, I'm trying to use standard meta tags in an xsl doc and using cocoon as my processor. The problem is that cocoon changes for example: <meta name="keywords" content="test, test, test" /> ...
5
by: Donald Firesmith | last post by:
Are html tags allowed within meta tags? Specifically, if I have html tags within a <definition> tag within XML, can I use the definition as the content within the <meta content="description> tag? ...
8
by: Ike | last post by:
I am hoping someone can help me with the proper syntax for this. I have an attribute, called, say "name," such that: <set name="something">thename</set> However, the value for name, is...
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
12
by: Oberon | last post by:
I have a large HTML document. It has hundreds of <span>s which have no attributes so these <span>s are redundant. How can I remove these tags automatically? The document also has <span>s with...
1
by: Randall Parker | last post by:
I'm wondering if there are general rules for the use of HTML attributes with ASP tags? For example, one can set an id for an asp:DataGrid and it will show up as the id for the resulting HTML...
1
by: Heron | last post by:
Hi, I'm new to regular expressions and having troubles recreating one that would match tags with there attribute and content. Example on which i'm doing the match: protected void...
5
by: fjanon | last post by:
Hi, I went through the HTML spec without finding the description of what the browsers behavior should/must be regarding tags or attributes they don't understand. I did a quick experiment like...
2
by: Phil Galey | last post by:
I'm using the followg code to add the attribute overwrite='true" to a select list of XML tags in an XML document. The document is loaded from a file and just the tags with names matching what's in...
10
by: Andy Fish | last post by:
Hi, I would like to include extra "hidden" information in a generated HTML page that can be used by javascript functions. I realise that most browsers seem to ignore any tags and attributes...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.