|
-
Aug 28th, 2004, 08:34 AM
#1
Thread Starter
Member
What is this??
Ok brace yourselfs this might very well be the dumbest question. Ok here it goes, what is XML? I heard that XML does absolutely nothing and is more of a format than a language. Is this true???
do you have to compile XML programs like in java or is XML similar to HTML where you can just write it in NotePad?
Also, can XML be used in C++, Java, and HTML
thanks
-
Aug 28th, 2004, 07:05 PM
#2
Yes, you could say that XML "does absolutely nothing and is more of a format than a language". However, it is a structured, standardized, format and the big advantage of that is that data in the file can be passed between different applications (you can also of course just use it a single app) and both applications will be understand and easily parse the data using MSXML. You could also think of it as a text database.
-
Aug 30th, 2004, 09:53 AM
#3
Frenzied Member
It really is for structuring data... Martin mentioned MSXML, but there are other XML readers out there - and you could make your own if you wanted. It's basically a standard for holding data, that's also why everyone who makes webpages are encouraged to move to XHTML 1.1 Strict, where the content is XML and the layot is CSS2, thereby seperating content from design, and making it much easier to work with.
If you want to read up on XML, I suggest you go here - www.w3schools.com and take their tutorial. You could also visit the World Wide Web Consortiums own webpage, they have a technical specification of the language, this is a bit harder to understand though: www.w3c.org
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Aug 30th, 2004, 05:13 PM
#4
Thread Starter
Member
-
Aug 30th, 2004, 06:03 PM
#5
No you don't have to download anything because you probably have MSXML2 or 3 on your PC. If you don't (or even if you do)then you should download MSXML4. MSXML will give you the tools you need to read and write XML files.
XML files are just text files so they can be used anyplace that you can use text files.
-
Sep 1st, 2004, 04:46 PM
#6
I don't know how they do it but M$'s XML parsers, DOM and SAX, are incredibly fast. About 200-300% faster than parsing with VB code.
That basically the nuts and bolts of XML , it allows you to retrive info at a very fast rate. So say you had a webpage that needed continually updating, then store, or save to, your data to an XML file then display that data on the web page using CSS, XSL to make it all nice and readable.
Its very similar to HTML though there are a few syntax differences such as you need to have a pair of tags around each XML element.
-
Sep 2nd, 2004, 09:00 AM
#7
Frenzied Member
Originally posted by Jmacp
I don't know how they do it but M$'s XML parsers, DOM and SAX, are incredibly fast. About 200-300% faster than parsing with VB code.
Assuming the guy would use VB - but that really isn't good for anything that needs to be fast so... He mentioned Java, I assumed he wanted to use it in conjunction(the word i need?) with that...
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
-
Sep 2nd, 2004, 11:30 AM
#8
XML is, as has been said, a standard for structuring data and attaching semantic meaning to it. Let's look at your example:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
If there were no XML tags, what would this possibly look like?
Code:
Tove
Reminder
Don't forget me this weekend!
Jani
Very well. In all likelyhood, you will be able to get that Tove is the receiver, Jani the sender, Reminder the heading and the rest the body, and that all of it is a note. But the computer stands a far worse chance at correctly guessing this.
The XML snippet, however, attaches meaning to the text. It tells everyone, including computers, that the thing is a note and what each part is for.
Now, that's all very nice, but there should be a way of telling the reader very quickly what the whole document is and what tags thus are allowed. The answer is the DOCTYPE declaration.
<!DOCTYPE note PUBLIC "-//Company//Identifier//Language" "URI://to/dtd">
The DTD (Document Type Declaration) is a special file that contains a list of valid tags, attributes and nestings. The other, more advanced way of specifying this is the XML Schema.
An XML language is a markup language that is based on the XML syntax but has further meaning. Such languages include XHTML (hypertext markup), MathML (mathematical formulas) and SVG (vector graphics). All of these have specifications that define how the tags are to be interpreted.
Very well. So far we have only text files with tags in them. To do something with them, we need an application that reads this document and actually knows what to do with the tags. A web browser for example: Mozilla can read and interpret XHTML, MathML, SVG (in custom versions), XUL, XSLT and more. Of these, IE only supports XSLT. (Yes, you read that right: IE doesn't really support XHTML, it only looks that way. If you don't believe me, visit my web page. IE is unable to display it, although the page is perfectly standards conformant.)
If you want your custom application that uses XML, you need a parser. You can write your own - have fun! A very basic parser is simple, a complicated one, supporting all those standards, is a nightmare.
Popular parsers for various languages are Xerces (C++, Java)(Apache Foundation, Open Source), Crimson (Java)(unknown, unknown, comes with Java 1.4), Expat (C, C++, Java)(Open Source), libxml (C, C++)(GNU or Gnome Foundation, Open Source, MSXML (C, C++, VB, VB.Net, C#)(Microsoft, Proprietary) and a few others I can't think of right now. You can use any of these to read the XML files and communicate them to your application via the standard interfaces SAX or DOM.
Your application can then for example store data in an XML format. It is advisable always to look for an existing format that can be used first; that way, your application can better interoperate with others.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|