Should i learn xml




















Distinctions are made between the content and the markup. In short, content could be anything, markup is defined. XML Documents are basically made up of elements which can have attributes describing them and may contain some textual content or more elements as its children.

All XML documents must have a root element, which is the ancestor of all the other elements in the document. XML Parsers are designed to be very strict, and will stop parsing malformed documents. This is what makes XML versatile. It is human readable too. The following document tells us that it defines a bookstore which sells three books, one of which is Learning XML by Erik T.

All this without having used an XML Parser yet. For example, you may spend 3 minutes reading these responses. Now I can let my bosses know that, hey, if you ever need some data transported I'm the right guy to ask sorta.

Also it will be helpful to know basics of how it works, advantages and limitations of each. This will certainly help taking some important decisions at the design stage.

But it will not be mandatory to know the low level implementation details. XML is a tool, and like any tool it works better for some purposes than others. There is some debate about whether XML is the best tool for the purposes it's good at. My personal opinion is that JSON and s-expressions are both better alternatives for data interchange.

In any case, knowing about XML as an option is a good thing. It's a format for data exchange thats wildly popular these days. It helps if you know it, certainly, since programs usually need to exchange data among each other. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 10 years, 11 months ago. Active 4 years, 11 months ago.

Viewed 8k times. Improve this question. Add a comment. Active Oldest Votes. Improve this answer. Steven A. Lowe Steven A. Lowe This is true for all the concepts and technologies — Gopi.

Sri: except perhaps not the 'learn it in an hour' part for some things ;- — Steven A. The markup may be a little cryptic, but if it's laid out properly it's pretty easy to follow. That's an important point: The display is browser-independent. If there were a photo of the results of making this recipe and one certainly hopes there isn't , it would show up in a graphical browser but not in a text browser.

There's one major problem with HTML as a data format, however. The meaning of the various pieces of data in the document is lost. Now, the idea of data in an HTML document meaning something may be a bit hard to grasp. Web pages are fine for the human reader, but if a program is going to process a document, it requires unambiguous definitions of what the tags mean.

That's what the tag means, and it doesn't mean anything else. Sure, you could write a program that grabs the headers out of the document, reads the table column headers, figures out the quantities and units of each ingredient, and so on. The problem is, everyone formats recipes differently. What if you're trying to get this information from, say, the Julia Childs Web site, and she keeps messing around with the formatting? If Julia changes the order of the columns or stops using tables, she'll break your program!

Though it has to be said: If Julia starts publishing recipes like this, she may want to think about changing careers. Now, imagine that this recipe page came from data in a database and you'd like to be able to ship this data around. Maybe you'd like to add it to your huge recipe database at home, where you can search and use it however you like.

Unfortunately, your input is HTML, so you'll need a program that can read this HTML, figure out what all the "Ingredients," "Instructions," "Units," and so forth are, and then import them to your database. That's a lot of work. Especially since all of that semantic information -- again, the meaning of the data -- existed in that original database but were obscured in the process of being transformed into HTML.

Now, imagine you could invent your own custom language for describing recipes. Instead of describing how the recipe was to be displayed, you'd describe the information structure in the recipe: how each piece of information would relate to the other pieces. Let's just make up a markup language for describing recipes, and rewrite our recipe in that language, as in Listing 3. It will come as little surprise to you, being the astute reader you are, that this recipe in its new format is actually an XML document.

Maybe the fact that the file started with the odd header. The semantics, or meaning of the information, is maintained in XML because that's what the tag set was designed to do. It's important to get some nomenclature straight. In Figure 1, you see a start tag, which begins an enclosed area of text, known as an Item , according to the tag name.

The Item defined by the tag ends with the end tag. Not every tag encloses text. In XML, such elements aren't allowed. Instead, XML has empty tags, denoted by a slash before the final right-angle bracket in the tag. Figure 2 shows an empty tag from our XML recipe.

Note that empty tags may have attributes. Every XML document must be well-formed. What does that mean? Read on! The concept of well-formedness comes from mathematics: It's possible to write mathematical expressions that don't mean anything. For example, the expression. In other words, the "expression" above isn't well-formed.

Mathematical expressions must be well-formed before you can do anything useful with them, because expressions that aren't well-formed are meaningless. The most important of these rules are as follows:. You can get away with all kinds of wacko stuff in HTML. XML doesn't allow this kind of sloppiness. Every start tag must have a corresponding end tag. This is because part of the information in an XML file has to do with how different elements of information relate to one another, and if the structure is ambiguous, so is the information.

So, XML simply doesn't allow ambiguous structure. This nonambiguous structure also allows XML documents to be processed as data structures trees , as I'll explain shortly in the discussion of the Document Object Model. A tag that opens inside another tag must close before the containing tag closes. For example, the sequence.



0コメント

  • 1000 / 1000