473,399 Members | 4,254 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,399 software developers and data experts.

Is this valid or not?

I'm just learning XML and am struggling with an example of an ELEMENT
definition at http://www.xmlfiles.com/dtd/dtd_elements.asp.
Specifically, the following is shown

<!ELEMENT note (to+,from,header,message*,#PCDATA)>

I do not believe that this is valid (by reading the spec at w3c.org),
and if I create a DTD/XML instance that uses it, it neither validates
using xmllint nor the online validator at
http://www.stg.brown.edu/service/xmlvalid/ (which apparently uses Xmlparse).

Would someone confirm for me that this is an invalid example or explain
why not?

Thanks!

Bo
Jul 20 '05 #1
6 1288
Would someone confirm for me that this is an invalid example or explain
why not?


It's invalid: #PCDATA has to come first and can only be used in a |
choice list not a , list the list must be used with a * occurrence
indiator.
(#PCDATA|aaa|bbb|ccc)*

There are other errors:
<!ELEMENT to (#CDATA)>
There is no #CDATA element content in XML. This should be #PCDATA.
David
Jul 20 '05 #2

"bo gusman" <bo@bogusville.us> wrote in message
news:cu**********@nnrp.atgi.net...
I'm just learning XML and am struggling with an example of an ELEMENT
definition at http://www.xmlfiles.com/dtd/dtd_elements.asp.
This sites' examples are full of errors, actually too many - they can't be
typos etc.
I wonder what has happened but certainly examples aren't well-formed
XML element declarations.

Mr. Carlisle pointed out some errors but there's just too many like:

<!ELEMENT element-name (ANY)>

this one for example could be XML DTD trick question since it's
well-formed but I doubt it's what the writer intended to demonstrate.
Specifically, the following is shown

<!ELEMENT note (to+,from,header,message*,#PCDATA)>

I do not believe that this is valid (by reading the spec at w3c.org), and
if I create a DTD/XML instance that uses it, it neither validates using
xmllint nor the online validator at
http://www.stg.brown.edu/service/xmlvalid/ (which apparently uses
Xmlparse).

Would someone confirm for me that this is an invalid example or explain
why not?


with respect,
Toni Uusitalo
Jul 20 '05 #3

"Toni Uusitalo" <to**************@pandot.nu> wrote in message
news:wz***************@read3.inet.fi...

<!ELEMENT element-name (ANY)>

this one for example could be XML DTD trick question since it's
well-formed but I doubt it's what the writer intended to demonstrate.


under that example the page says:
"The keyword ANY declares an element with any content."
so it ISN'T what the writer tries to demonstrate.

ps. see http://www.zvon.org for good XML tutorials.

with respect,
Toni Uusitalo
Jul 20 '05 #4
/Toni Uusitalo/:
<!ELEMENT element-name (ANY)>

this one for example could be XML DTD trick question since it's
well-formed but I doubt it's what the writer intended to demonstrate.


It is not well-formed, nor

<!ELEMENT element-name (EMPTY)>

is. Both 'ANY' and 'EMPTY' (w/o the quotes) must appear without the
parentheses.

http://www.w3.org/TR/REC-xml/#IDAN43S

--
Stanimir
Jul 20 '05 #5

"Stanimir Stamenkov" <s7****@netscape.net> wrote in message
news:37*************@individual.net...
/Toni Uusitalo/:
<!ELEMENT element-name (ANY)>

this one for example could be XML DTD trick question since it's
well-formed but I doubt it's what the writer intended to demonstrate.


It is not well-formed, nor

<!ELEMENT element-name (EMPTY)>

is. Both 'ANY' and 'EMPTY' (w/o the quotes) must appear without the
parentheses.

http://www.w3.org/TR/REC-xml/#IDAN43S


Both are well-formed, for example this is well-formed (and valid too):
<!DOCTYPE doc [
<!ELEMENT doc (EMPTY)>
<!ELEMENT EMPTY EMPTY>
]>
<doc><EMPTY/></doc>

That's the trick thing I mentioned. Not suitable for tutorial though ;-)

with respect,
Toni Uusitalo
Jul 20 '05 #6
/Toni Uusitalo/:
Both are well-formed, for example this is well-formed (and valid too):
<!DOCTYPE doc [
<!ELEMENT doc (EMPTY)>
<!ELEMENT EMPTY EMPTY>
]>
<doc><EMPTY/></doc>

That's the trick thing I mentioned. Not suitable for tutorial though ;-)


Ops - missed that one. You're absolutely right! :-)

--
Best Regards,
Stanimir
Jul 20 '05 #7

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

Similar topics

12
by: lawrence | last post by:
I have a string which I want to send to eval(). How can I test it ahead of time to make sure it is valid code? I don't want to send it to eval and get parse errors. I want to do something like...
16
by: siliconmike | last post by:
Hi, I'm looking for a reliable script that would connect to a host and somehow determine whether an email address is valid. since getmxrr() only gets the mx records.. Links/pointers ? Mike
1
by: Anna | last post by:
Hi all. I have probably a rather stupid question. If there is an HTML document, XML-formed using JTidy, is there any tool to convert it to valid XHTML? I.e. so that all the tags and attribute...
7
by: JR | last post by:
Hey all, I have read part seven of the FAQ and searched for an answer but can not seem to find one. I am trying to do the all too common verify the data type with CIN. The code from the FAQ...
23
by: James Aguilar | last post by:
Someone showed me something today that I didn't understand. This doesn't seem like it should be valid C++. Specifically, I don't understand how the commas are accepted after the function...
3
by: Chris | last post by:
Hi, In C# I tried to save a file from a generated file name. Just before launching the dialog I check for a valid file name to be sure. There for I used the method ValidateNames from the save...
0
by: QA | last post by:
I am using a Business Scorecard Accelarator in a Sharepoint Portal 2003 using SQL Server 2005 I am getting the following error: Error,5/7/2005 10:50:14 AM,580,AUE1\Administrator,"Specified cast is...
1
by: Robert Morgan | last post by:
|I'm trying to run a query on a database using php and postgres functions ||<?php db_connect(); $stat = pg_exec($connstr,"SELECT WSID from tblWorkstation "); while ($row = pg_fetch_rows($stat))...
1
by: illegal.prime | last post by:
Hey all, I have an app, that could take two numbers of any type of numerical type int, long, double, float, uint, ulong, etc. I want to check that the numbers are part of a range that I consider...
10
by: SpreadTooThin | last post by:
Hi I'm writing a python script that creates directories from user input. Sometimes the user inputs characters that aren't valid characters for a file or directory name. Here are the characters...
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: 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?
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...
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...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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,...
0
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...

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.