Xml - XML NOtes PDF

Title Xml - XML NOtes
Author Seema m
Course Bachelor of computer applications
Institution Bangalore University
Pages 6
File Size 105.9 KB
File Type PDF
Total Downloads 50
Total Views 139

Summary

XML NOtes...


Description

Unit 2: Introduction to XML XML stands for Extensible Markup language. It is called extensible because it is not following a fixed format like HTML. It is designed to transport and store data. It is designed to improve the functionality of the web by providing more flexible and adaptable information identification. It is a language for more structured documents and is very easy to learn. XML is used to describe the data and HTML is used to displaying the data. It is actually known as metalanguage that means a language for describing other languages. It is compatible with both HTML and SGML. XML tags are not predefined. User can create their own tags. XML is developed by W3C. The difference between XML and HTML: XML

HTML

For describing the data

For displaying the data

Tags are not predefined

Tags are predefined

Case sensitive, lowercase , uppercase elements are treated differently

Not a case sensitive

It show the error, if any error is present in the code

It doesn’t show the error, if there is any error in the code

XML was designed to transport and store the data, with focus on what data is concerned.

HTML was designed to display data with focus on how data looks.

Using XML parsers or prolog to execute the program

Nothing required in browser for HTML file.

The difference between XML and SGML: XML

SGML

Xml stands for Extensible markup language

SGML stands for standard Generalized markup language

XML is newer version of SGML and compatible with WML (wireless Markup language) for mobile communication

SGML is older version and compatible with HDML for mobile communication

Underscore and colons are allowed in the name

Underscore and colons are not allowed in the name

The PIC (processing instruction close) delimiter is ?> required.

The PIC is not required in SGML

Names are case sensitive

Names are not case sensitive

Restrictions in XML

1. Entity reference 2. Character reference 3. Entity declarations

4. 5. 6. 7. 8.

Attribute definition list declarations Element type declaration Comments Marked sections other

Structuring DATA: 1. The user will create their tags using XML and XML is used to describe the data structure. 2. These allow the programmer flexibility in describing the data. 3. Tags are used to show the beginning and end of the element. 4. Xml is case sensitive using wrong case for xml tags is a syntax error. 5. The first line lets the parser (a program for processing an xml document) known that a specific version of xml is being used. 6. Version 1.0 of the xml is complete and will not change. 7. Xml is easily learned for manage data. Example:

rama Krishna 22 20/01/2000

Xml is used to create new internet languages: 1. A lot of new internet languages are created with xml. Here are some examples: 2. WAP and WML as markup language for handheld devices. 3. RDF and OWL for describing resource and ontology in semantic web technology 4. WSDL (web script Development language for describing web services 5. XHTML is the latest version of HTML XML document form a tree structure: Xml document must contain a root element. This element is the “parent element” of all other elements. The element s in the xml document forms a document tree. The tree starts with root and branches to the lowest level.

guru 10

Integrating XML with HTML: The xml files can be directly embedded with HTML code. The xml data file can be added directly to html code block using the xml elements and id attribute. We can create a database through xml and integrate the xml file with the html file through DSO(data source object).

Buddy Fran Howdy! Don't forget me this weekend!

This XML data can then be “bound” to HTML elements to display in a web browser by building a table in HTML and populating it with XML elements, For example:



Buddy Fran Howdy! Don't forget me this weekend!



Integration of CSS(cascading style sheet) with XML: CSS stands for cascading style sheet. Styles define how to display html elements. External style sheets are stored in CSS files. Multiple style definitions all cascade into one. We can integrate CSS with XML file. First create a css file and save that file with a filename. The XML and CSS example, Employee { display:block; font-size:24px; color:green; } Address { display:inline; font-size:14px; color:yellow; } The XML file is as follows,

ananya

mangalore 080123456789 [email protected]

XML with DTD: The DTD (Document Type Definition) is set of rules applied by element types that are allowed with in an xml document and specifying the allowed content and attributes of each element type. The document type definition is and XML and SGML description of the content model of a type or class of document. A DTD defines the document structure with a list of legal elements and attributes. A DTD can be declared inside an XML document or as an external file. DTD: A DTD (Document Type Definition) is a mechanism to describe the structure of documents. Specifically,

• • •

Model XML documents express the model in a DTD validate a document against its model The DTD is the original modeling language or schema for XML. There are two types of DTD internal and external. A DTD allows you to specify the basic structure of an XML document.





]> Internal DTD: If a DTD is described by inside the XML file it is known as internal DTD. For example:



]>

my example august 15 Gandhi

India Is My Country

External DTD: If the DTD is defined in external file then these are external DTD file. The file name extension for DTD files are .dtd. The a.dtd file is The xml file is as follows:



my example

august 15

Gandhi

India Is My Country ]>

Building blocks of XML documents: 1 Elements: Elements are the basic building blocks for xml documents. Examples of xml elements could be names with noun and meaning full words. Elements can contain text, other element, or be empty. 2 Attributes: Attributes provides the characteristics about elements. Attributes are always placed inside the opening tag of an element. The following “body” element has additional information about a document file:

3 Entities: Some characters have a special meaning in xml, like the less than sign that defines the start of a start tag. Some of special tags are predefined in XML are, < < $gt;

>

&

&

"



'



4. PCDATA: PCDATA means Parsed Character data Character data as the text found between the start tag and the end tag of an element. Tags inside the text will be treated as markup and entities will be expanded. Parsed character data should not contain any &, < , > characters; these need to represented by the &, < > entities, respectively.

5. CDATA: CDATA stands for character data. the text in an element is called PCDATA, parsed character data. The difference between CDATA and PCDATA is that PCDATA cannot contain markup characters. In a document, a CDATA section instructs the parser to ignore most markup characters. Consider a source code listing in an XML document. It might contain characters that The XML parser would ordinarily recognize as markup (< and &, for example). In order to prevent this, a CDATA section can be used.

Between the start of the section, , all character data is passed directly to the application, without interpretation. Elements, entity references, comments, and processing instructions are all unrecognized and the characters that comprise them are passed literally to the application....


Similar Free PDFs