Skip to main content

Posts

XML Attributes

From HTML you will remember this: < IMG SRC="comp.gif" >. The SRC attribute provides additional information about the IMG element. In HTML (and in XML) attributes provide additional information about elements: < img src="computer.gif" > < a href="demo.asp" > Attributes often provide information that is not a part of the data. In the example below, the file type is irrelevant to the data, but important to the software that wants to manipulate the element: < file type="gif" > computer.gif < /file > Students now u know abt basic XML, its scripting rules. Lets understand XML attributes which can be understood as property of an element. Here are simple rules for XML elements Quote Styles, "female" or 'female'? Attribute values must always be enclosed in quotes, but either single or double quotes can be used. For a person's sex, the person tag can be written like this: < person se

Element naming

XML elements must follow these 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, etc) Names cannot contain spaces Take care when you "invent" element names and follow these simple rules: Any name can be used, no words are reserved, but the idea is to make names descriptive. Names with an underscore separator are nice. Examples: < stud_name >, < stud_age > . Avoid "-" and "." in names. For example, if you name something "first-name," it could be a mess if your software tries to subtract name from first. Or if you name something "first.name," your software may think that "name" is a property of the object "first." Element names can be as long as you like, but don't exaggerate. Names should be short and simple, like this: < Thesis_title

XML SCRIPTING

XML Language can be understood as a generic language used to describe other markup languages. You need to understand that XML makes a clear distinction between the markup and the content of the webpage. Here markup implies tags and attributes that are being used in the XML document and content refers to the information being presented in the document. E.g. < p > XML is used to store data in a structured way < /p > In this example < p >…. </p > refers to the markup being used in the document and the text written between these tags refer to the content of the document. You can say that markup is actually used to describe the presentation of the content. This is done using standard tags and attributes that are available in HTML. You will find that the XML markup is generally used to describe the content of the document and is not related with the appearance of the document. E.g. < quiz answer=”Qutab Minar” > Can you name a famous monument in delhi?&l

Difference between HTML and XML

You need to understand that you will not use XML for replacing HTML. Both XML and HTML have been designed for different goals which can be summarized as follows: a. XML is designed specifically for describing and structuring the data where as HTML is used for formatting and displaying the data. b. XML is focused on defining data with its attributes. It basically tells what data is all about. HTML is focused on presentation of data and is used to customize looks of data. c. In case of HTML Document tags to be used and the structure of the documents are predefined. While using HTML you can only use tags which are pre-defined in the HTML standards. In case of XML you can define your own tags and develop your own document structure. d. An XML document is saved with an extension .XML whereas an HTML document is saved as .HTML. E.g. The following example is an e-mail from Ram to Shyam stored as XML < email > < to > Ram </to > < from > Shyam &

CHARACTERISTICS OF XML

XML stands for ‘Extensible Markup Language’. It is a general-purpose specification which is commonly used for creating custom markup languages. It is an extensible language as it provides its users an ability to define their own elements. Thus it enables users to create custom tags that suit their requirement. XML has been primarily developed to information systems share their structured data online. It can be used to encode documents as well as to serialize data so that it can be efficiently used. Some of the features of XML have been summarized below: 1. XML can be understood as an extensible language which is freely available. 2. XML tags are user made tags. They are not predefined tags. In case of HTML predefined tags are used (like < p >, < h1 > etc.). While using XML users can define custom tags and develop document structure as per their requirement. 3. XML is not a replacement for HTML. It is actually a complement to HTML. Both scripting languages have

Introduction to XML

Dear Students In this an subsequent posts we will read about XML. We will be covering following topics in XML. • List the applications and advantages of XML • Create well-formed and valid XML documents. • Make a XHTML document. • Create XM DTD • Use XSL for transforming XML data and display it in a Web browser. • Apply data binding and the Document Object Model for displaying dynamic XML data in a Web browser.