Skip to main content

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

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? </quiz>

In this example  < uiz> tag is being used to describe the type of content and the answer attribute  specifies the answer for this question.

To start using XML effectively you need to learn about the terminology used in XML and understand the structure of a XML file.  Consider following example:

<catalog> 
<movie>
   <title>Jung</title> 
   <duration>3 hrs</duration> 
 </movie> 
</catalog>

As you can see XML files are hierarchical in structure with each tag defining an element. All elements need to have an opening and a closing tag.  E.g. has opening as well as closing tag. Some of the elements are self-contained and you do not need to enclose any information in them. These tags can be considered empty element and can be made self-closing by adding "/>" at the end of the opening tag. The hierarchical structure enables easy parsing of the document. As in above example catalogue contains information about movie which ultimately contains detail about title and duration of the movie.

 

XML Syntax


Consider the following example:

Line 1:              <?xml version="1.0" ?>
Line 2:              <library>
Line 3:              <book type="Operational Research" year="1992">
Line 4:              <book1>Linear Programming
>
Line 5:              <book2>Non Linear Programming
>
Line 6:              <book3>Mathematical Programming
>
Line 7:              </book>
Line 8:              </library>

The first line is a processing Instruction. It defines the XML version of the document. In this case the document conforms to the 1.0 specification of XML:
<?xml version=”1.0”?> 
Line 2 defines the first element of the document which is the root element:
<library> 
The next lines define child elements of the root i.e. Book which further has child elements (book1, book2, book3).

 

You can see that an XML documents use a self-describing and simple syntax.  Before you read further about xml scripting you need to be aware of the major components of an xml document. XML mark-up document can be broadly divided into a set of components which describe the makeup of a XML document. These components can be defined as follows:


1. Element Tag:  An element can be understood as a piece of information that corresponds to a tag or a set of tags in a XML document. In other words element can be understood as a logical piece of markup that is represented as a tag in a XML document. E.g. In above example ‘quiz’ is an element which has been used as tag in the document.  Note that an element need to have both starting and ending tags like ,…
or a simple empty tag like . While coding in HTML empty tag
do not need to have end tag. However with XML be careful you need to close every tag.

2. Processing Instruction: Apart from markup and content you will find processing instructions written in a XML document which is the first statement in the document.  A processing instruction can be understood as a special command passed along to the program which will process the document. Processing instruction written in <?.....?>.
E.g.
               <?xml version="1.0"?>
 
 This processing instruction is the first statement of a XML document.  You               will find that the processing instruction is similar to a tag. It includes name              and attribute/value pair. This processing instruction tells that the document              adheres to the standard of xml version 1.0.         

3. Comments in XML:

In a XML document comments can be written using following syntax:

            <!-- In  this document you are learning about xml -->

Note: Writing comments in XML is similar to that of HTML.

4. Document Type Declaration: Document Type Declaration is used to describe the structure of an XML document.  It identifies the external DTD that defines the structure of an xml document. The external DTD, DTD stands for Document type definition, describes the structure of the xml document. You need to put the ‘Document Type declaration’ always on the top of the xml document just below the processing instruction. Its use is to perform three basic tasks:

1. Identifies the root element of the document. In an xml document there is a root element such that all other elements are the children of the root element.

2. Identifies the external DTD of the file. An xml file according to the document structure defined in the DTD.   

  E.g.     Check out the XML below which describes audio/video collection

<? xml version="1.0"?>
<!DOCTYPE entertainment SYSTEM entertainment.dtd>
<entertainment>
 <Audio>
       <track1>Tara Rampam</track1>
       <track2>Let's go for party</track2>
</Audio>
<Video>
        <track1> Jumanji </track1>
       <track2> Home Alome </track2>
</Video>
</entertainment>
 
In above example first line is a processing instruction which shows that this document should be processed according to the xml version 1.0 standards. In second line <  DOCTYPE…> is the document type declaration which states that the root element for this xml file is ‘entertainment’. Further it identifies that the document need to be verified according to the external DTD namely “entertainment.dtd”. While processing this file browser needs to look for “entertainment.dtd” and then validate the document structure according to this file.

Comments

Popular posts from this blog

Advantages and Disadvantages of EIS Advantages of EIS Easy for upper-level executives to use, extensive computer experience is not required in operations Provides timely delivery of company summary information Information that is provided is better understood Filters data for management Improves to tracking information Offers efficiency to decision makers Disadvantages of EIS System dependent Limited functionality, by design Information overload for some managers Benefits hard to quantify High implementation costs System may become slow, large, and hard to manage Need good internal processes for data management May lead to less reliable and less secure data

Inter-Organizational Value Chain

The value chain of   a company is part of over all value chain. The over all competitive advantage of an organization is not just dependent on the quality and efficiency of the company and quality of products but also upon the that of its suppliers and wholesalers and retailers it may use. The analysis of overall supply chain is called the value system. Different parts of the value chain 1.  Supplier     2.  Firm       3.   Channel 4 .   Buyer

Big-M Method and Two-Phase Method

Big-M Method The Big-M method of handling instances with artificial  variables is the “commonsense approach”. Essentially, the notion is to make the artificial variables, through their coefficients in the objective function, so costly or unprofitable that any feasible solution to the real problem would be preferred, unless the original instance possessed no feasible solutions at all. But this means that we need to assign, in the objective function, coefficients to the artificial variables that are either very small (maximization problem) or very large (minimization problem); whatever this value,let us call it Big M . In fact, this notion is an old trick in optimization in general; we  simply associate a penalty value with variables that we do not want to be part of an ultimate solution(unless such an outcome is unavoidable). Indeed, the penalty is so costly that unless any of the  respective variables' inclusion is warranted algorithmically, such variables will ...