




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML does not DO anything XML was not designed to DO anything. XML is used ...
Typology: Study notes
1 / 8
This page cannot be seen from the preview
Don't miss anything!





Introduction to XML XML was designed to describe data and focus on what data is. HTML was designed to display data and focus on how data looks. What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML does not DO anything XML was not designed to DO anything. XML is used to structure, store and to send information.
Tom Jan Reminder Don't forget me this weekend!
The tags used to mark up HTML documents are predefined. The author of HTML documents can only use tags that are defined. (like
,
, etc.). XML tags are not predefined. You must define your own tags. and are not defined in any XML standard! What's the big deal? Example of data transmission. You are trying to transmit the following table:46 25 12 51 48 33 19 36 45 85 14 51 ..... We send this table from one computer to another computer. A transmission error happens. One number gets dropped. (Number 51 in first line). The receiving computer sees this: ID Age HourlyPay RoomNumber 46 25 12 48 33 19 36 45 85 14 51
After the end (hundreds of lines) the computer sees that there is one number missing. It has no idea which one. Now one XML way to send this data:
46 25 12 51
48 33 ETC. ETC.
Note that this is an extremely wasteful representation! (We waste disk space and band-width). And yet it is OK.
Now a more complex example of XML:
New Jersey 1
New York 2
Washington
The very first (and very last) tag become the root of a tree. There MUST BE a root. ONE ROOT.
Opening and closing tags must therefore be written with the same case.
XML elements can have attribute/value pairs just like in HTML. In XML the value must always be quoted with DOUBLE quotes. attribute value | | | | | | V V
There are no rules about when to use attributes, and when to use child elements. You should try to avoid attributes. Example: ..... is almost the same as:
12/11/2002
which is considered better. Rule about attributes has one exception: You may assign ID references to elements. These ID references can be used to access XML elements. Example:
One case when you use attributes is if this is information for the programmer. Example: Author information.
This information (author) is not of interest to the USER of the address book. With XML, the white space in your document SHOULD NOT be truncated. (I found this true when programming, but NOT in the browser.) This is unlike HTML. With HTML, a sentence like this: Hello my name is Tom,
will be displayed like this: Hello my name is Tom, Use Internet Explorer to check. Note: Might have to erase the cache when changing a file. Check public_html/632/test.xml in IE Comments in XML The syntax for writing comments in XML is like HTML.
Another example for purposes of naming:
My First XML
Introduction to XML What is XML
has ELEMENT CONTENT, because it contains other elements (tags). has MIXED CONTENT because it contains both: plain English text and other elements. has SIMPLE CONTENT because it contains only text. has EMPTY CONTENT, because it contains nothing. XML tags must follow these [simplified] naming rules: Names can contain letters, numbers, and other characters. Names must not start with a number or punctuation character. Names must not start with the letters xml (or XML or Xml ..). Names cannot contain spaces. "-" and "." and ":" should not be used in tag names. Names with an underscore separator are nice. Examples: , . this is called camel case A "Well Formed" XML document has correct XML syntax. ("What we learned so far. Almost no constraints."
Declaring mixed content
To load a DTD file you use this command:
NEW EXAMPLES: First note that there were some differences between IE and Mozilla. It's really important to retest all these on IE. Here is an example that is "three level". It does not work in IE. It seemed to work in Mozilla, but I am confused now.
]>
Tove Jani Reminder Don't forget me this weekend!
So in the above "message" itself does not appear, because it is itself replaced by heading and body. The right hand side side is always in (...) but there can be a *,+,? after the (). We stop at DTD attributes. If there is time we do them in the tutorial.