473,395 Members | 1,941 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,395 software developers and data experts.

First approach to xml

Hallo All,
I'm approaching xml for the first time.
My first example is this source code:
<?xml version="1.0"?>

<!DOCTYPE EMAIL [
<!ELEMENT EMAIL (TO, FROM, CC, SUBJECT, BODY)>
<!ELEMENT TO (#PCDATA)>
<!ELEMENT FROM (#PCDATA)>
<!ELEMENT SUBJECT (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
]>

<EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>

but executing this code the result is bad:
<?xml version="1.0" ?>
<!DOCTYPE EMAIL (View Source for full doctype...)>
- <EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>

What do you think I need or I havn't understood ?
Thanks in advice.

Marco.

Jul 20 '05 #1
4 1624
What result would you like to have?
The result is exactly right for the input.

rok

"Marco Garutti" <ma***********@tecnoform.com> schrieb im Newsbeitrag
news:bi**********@news2.isdnet.net...
Hallo All,
I'm approaching xml for the first time.
My first example is this source code:
<?xml version="1.0"?>

<!DOCTYPE EMAIL [
<!ELEMENT EMAIL (TO, FROM, CC, SUBJECT, BODY)>
<!ELEMENT TO (#PCDATA)>
<!ELEMENT FROM (#PCDATA)>
<!ELEMENT SUBJECT (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
]>

<EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>

but executing this code the result is bad:
<?xml version="1.0" ?>
<!DOCTYPE EMAIL (View Source for full doctype...)>
- <EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>

What do you think I need or I havn't understood ?
Thanks in advice.

Marco.

Jul 20 '05 #2
Marco Garutti wrote:
Hallo All,
I'm approaching xml for the first time.
My first example is this source code:
<?xml version="1.0"?>

<!DOCTYPE EMAIL [
<!ELEMENT EMAIL (TO, FROM, CC, SUBJECT, BODY)>
<!ELEMENT TO (#PCDATA)>
<!ELEMENT FROM (#PCDATA)>
<!ELEMENT SUBJECT (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
]>

<EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>

but executing this code the result is bad:
<?xml version="1.0" ?>
<!DOCTYPE EMAIL (View Source for full doctype...)>
- <EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>

What do you think I need or I havn't understood ?
Thanks in advice.


Being a bit of a beginner myself, I'm not sure what you mean by "executing
this code". Perhaps you could explain what you mean by that phrase?

Anyway, I can see a (possibly the) problem: your DOCTYPE says an EMAIL must
have a TO, followed by a FROM, followed by a CC, followed by a SUBJECT,
followed by a BODY. Your data's EMAIL doesn't have a CC, so it's rejected
as invalid. Presumably you meant to make the CC optional?

Jul 20 '05 #3
Hi Derek,
I've tried to add CC but I haven't find differences.
When I say <execute the source code> I mean that it's no clear in my mind
who process the
XML code.
When you double click on a XML page what happens ?
1) Internet explorer process the page with an interpreter inside ?
2) Is it necessary that the page is on a server with particular
configurations for XML (enabling somethng on Apache, for example) or you can
put the page on the desktop of your Win2000 and just double click on it ?
3) What else to understand architecture

Thanks in advice, Marco.
Being a bit of a beginner myself, I'm not sure what you mean by "executing
this code". Perhaps you could explain what you mean by that phrase?

Anyway, I can see a (possibly the) problem: your DOCTYPE says an EMAIL must have a TO, followed by a FROM, followed by a CC, followed by a SUBJECT,
followed by a BODY. Your data's EMAIL doesn't have a CC, so it's rejected
as invalid. Presumably you meant to make the CC optional?

Jul 20 '05 #4
> I've tried to add CC but I haven't find differences.

I changed the DTD line to read this:

<!ELEMENT EMAIL (TO, FROM, CC?, SUBJECT, BODY)>

and it parses correctly on my machine. You need to add a definition of CC if
you actually want to use one:

<?xml version="1.0"?>

<!DOCTYPE EMAIL [
<!ELEMENT EMAIL (TO, FROM, CC?, SUBJECT, BODY)>
<!ELEMENT TO (#PCDATA)>
<!ELEMENT FROM (#PCDATA)>
<!ELEMENT CC (#PCDATA)>
<!ELEMENT SUBJECT (#PCDATA)>
<!ELEMENT BODY (#PCDATA)>
]>

<EMAIL>
<TO>m.*@try.com</TO>
<FROM>m.*@try.com</FROM>
<CC>me@nowhere.com</CC>
<SUBJECT>My first DTD</SUBJECT>
<BODY>Hello, World</BODY>
</EMAIL>
When I say <execute the source code> I mean that it's no clear in my mind
who process the
XML code.
When you double click on a XML page what happens ?
I don't know. It depends how you've got your machine set up. I use Linux for
the most part, so I'm probably not the person to ask. Maybe IE will open
and try to display it? Maybe an editor will open so you can edit it?
1) Internet explorer process the page with an interpreter inside ?
IE will do its best to show you the XML is a very general way. It doesn't,
as far as I know, "process" it other than parsing it in order to display
it.
2) Is it necessary that the page is on a server with particular
configurations for XML (enabling somethng on Apache, for example) or you
can put the page on the desktop of your Win2000 and just double click on
it ?
No, no server software is needed. Leaving the file somewhere on your disk
and pointing an XML processor of some sort at it is enough.
3) What else to understand architecture


XML is a language for describing data. The data, by itself, isn't much use.
The best you can do is check that the data is valid; i.e. that the data
matches the DTD description of what the data should look like.

Something needs to process that data, either to display it, or in some way
work with it in order to get something done.

Your XML describes an email. OK, fine. But what do you want to do with that
information? Display it in some way? Use it to send the described email?
There isn't much point in just having a bit of XML data sitting on your
disk. What do you intend to do with it, and how do you intend to do that?
Jul 20 '05 #5

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

Similar topics

20
by: MickeyBob | last post by:
How does one detect the EOF gracefully? Assuming I have a pickle file containing an unknown number of objects, how can I read (i.e., pickle.load()) until the EOF is encountered without generating...
7
by: Chinook | last post by:
OO approach to decision sequence? --------------------------------- In a recent thread (Cause for using objects?), Chris Smith replied with (in part): > If your table of photo data has...
10
by: Lyn | last post by:
I have a form set to Single Form mode with which I can cycle through the records in a table via Next and Previous buttons. To avoid users pressing the Previous button on the first record and the...
36
by: invni | last post by:
I have a nested while. How do I go from the inner while to the beginning of the outer while? Can this be done without using goto? while_1() { some codes here while_2() { if true go to the...
5
by: Jim Heimer | last post by:
When I use the dataview.rowfilter and I try to display the field value of the first row, the code doesn't seem to show the first row AFTER the rowfilter. This is my code: DataView...
16
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a...
26
by: Martin R | last post by:
Hi, How to find first not null value in column whitout chacking whole table (if there is a not null value then show me it and stop searching, the table is quite big)? thx, Martin *** Sent...
2
by: bwhite | last post by:
I have an access database application that is used to calculate landed costs for foreign goods imported into vartious countries. I am trying to determine an approach so that a user will be...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
8
by: Mike Silva | last post by:
Hello all, I'm a longtime programmer (embedded with a smattering of desktop stuff as well) who knows very little about web programming. Right now I am developing the prototype of a multi-user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
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
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
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...

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.