Introduction to o:XML
Object oriented programming is facilitated by o:XML while being a markup language. o:XML is an object oriented programming language and also a markup language. With the o:XML you can create program codes easily with the objected oriented features. The paradigms of object orientation are also present in this programming language. In case you need to purchase college research papers or want to get some kind of assistance with the programming, reach us via contact form or email.
Let us look at a simple program in o:XML which will give you an idea about programming in o:XML.
In the above program you can see that the structure of the program is the same as an XML document. The root node for this program is the element <o:program>. Classes of objects in o:XML are called Types. These Types are nodes in o:XML. In the above example you can see a Type identified by “MyProgram”. Since ‘Types’ are classes you need to create an instance of the class before you can work on it. To create an instance you can use the element <o:set> as given in the above example. The line of code “<o:set instMP="MyProgram()"/>” creates an instance of Type MyProgram called “instMP”. Like you have methods within classes you can have functions within Types. A function named “DisplayText” is given in the above example which is used to display the text “Hi, this is my first program in oXML”. The line of code in the program, <o:eval select="$instMP.DisplayText()"/>, is used to call the function DisplayText to display the text. Within the function “DisplayText”, an <o:do> element is used to perform some action. In this example we are just using the element <o:return> to return the text that needs to the displayed.
We have already said that the output of an o:XML program is in the form of an XML document, you can use this output to produce any type of content for display using a transformation engine. Let us see an example to produce an XML node from o:XML. Suppose you want to create an XML node with some attribute like,
<book author=”Peter” price=”340”>
The code for creating the above XML node in o:XML would be something like,
The element <o:element> is used in o:XML to create elements in the output of the program. The element <o:attribute> is used to create the attributes for the elements created. You may note that the attributes are created in two different ways. You can use the ‘select’ attribute of the element <o:attribute> to assign a value to the attribute of the output XML. It is also possible to enclose the value of the attribute using the <o:attribute>’s opening and closing tags.
All the programming features of other languages along with object orientation paradigms are possible in o:XML. Conditional looping or display of values are done using the elements like <o:if>, <o:choose>, and <o:while>. Consider the statements given below:
The <o:choose element of the o:XML programming language is similar to the ‘Select’, ‘Case’, ‘End Select’ statement for conditional processing of statements in other programming languages. In the example given above the condition is checked using the <o:when> element. If the condition is True the statement enclosed within that <o:when> element is executed otherwise the next is statement is checked. The conditions are checked until the first True condition is encountered. If none of the conditions are True then the statement within the <o:otherwise> element is executed. The <o:log> element is used to log messages during program execution. The o:XML engine ObjectBox has features to log messages during runtime.
Exception handling is one of the important features of object oriented programming that is necessary for efficient programming. This feature is supported in o:XML by the elements, <o:throw> and <o:catch>. Upon checking a condition or state the <o:throw> element is used to throw an exception and that exception is caught by the <o:catch> element.
For applications to perform efficiently concurrent executions using threads are done. Threads are supported by o:XML using the element <o:thread>. The element <o:set> is used to initiate a thread and to pass on execution to other statements.
The above statement initiates a function called ‘SomeFunction’ as a thread and the execution goes to the next statement. There are many other programming statements in o:XML as found in other Object Oriented Programming languages. You can refer to the url http://www.o-xml.org/ for more details of the o:XML programming language. With its functionality and ease of use we can expect that the o:XML as a markup language and programming language would take XML programming to higher levels in the future.
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”Copyright - © 2004 - 2019 - All Rights Reserved.