SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
1
WML and Wap
BT0087 Part-2
By Milan K Antony
2
1. What are the problems in WML?
WML which is infested with myriad problems. They are as follows: (a) it is static in
nature. (b) Even though it has the concept of variables, initializing these variables is not as simple as it
is in any other programming languages. (c) It doesn't support the features that other programming
languages do. As a consequence, you cannot write a code that is dynamic. Dynamic in this context
means, the ability to modify the behavior of the program while it is running. Therefore, WML is similar
to HTML. In both cases, you cannot write programs, which have sufficient inbuilt intelligence.WML
also fails to offer you the requisite level of flexibility.
2. What are the features of WML script Language?
Some basic syntactical features of the language are:
 The smallest unit of execution in WMLScript is a statement and each statement must end with a
semicolon (;).
The following code is taken from the earlier "Hello World" example. You can see that the two
WMLScript statements in this function have been ended with semicolons.
extern function helloWorld()
{
WMLBrowser.setVar("message", "Hello World. Welcome to our WMLScript
tutorial.");
WMLBrowser.refresh();
}
 WMLScript is case-sensitive.
a WMLScript function with the name WMLScript_Function is different from wmlscript_function. So,
be careful of the capitalization when defining or referring to a function or a variable in WMLScript.
 Comments can either be single-line (beginning with //) or multi-line (bracketed by /* and */). This
syntax is identical to both C++ and Java.
There are two types of comments in WMLScript: single-line comment and multi-line comment. To add
a single-line comment, begin a line of text with the // characters. To add a multi-line comment, enclose
the text within /* and */. These rules are the same in WMLScript, JavaScript, Java, and C++. The
WMLScript engine will ignore all comments. The following WMLScript example demonstrates the
use of comments:
extern function helloWorld()
{
// This is a single-line comment.
/* This is a
3
multi-line comment. */
/* A multi-line comment can be placed on a single line.
*/ WMLBrowser.setVar ("message", "Hello World. Welcome to our
WMLScript tutorial.");
WMLBrowser.refresh (); // A comment can be placed at a statement's
end.
}
 A literal character string is defined as any sequence of zero or more characters enclosed within double
("") or single (‘) quotes.
 Boolean literal values correspond to true and false.
 New variables are declared using the var keyword (i.e. var x ;)
3. What is an operator? What are the operators supported by WML Script? Explain with
examples.
An operator is essentially a predefined function that is a part of the WMLScript language.
WMLScript supports a variety of operators that support value assignment operations, arithmetic
operations, logical operations, string operations, comparison operations, and array operations
WML Script offers several ways to assign a value to a variable. The simplest is the regular assignment
(=), but assignments with operations are also supported:
4. What are the Characteristics of the functions?
Characteristics of the functions are The characteristics of the functions in WML Script are
mentioned below
 Function declarations cannot be nested.
 Function names must be unique within one compilation unit.
 All parameters to functions are passed by value.
4
 Function calls must pass exactly the same number of arguments to the called function as specified
in the function declaration.
 Function parameters behave like local variables that have been initialized before the function
body (block of statements) is executed.
 A function always returns a value. By default, it is an empty string (" ").
 However, you can use a return statement to specify other return values. A function in WMLScript is
defined using the following format. The parts enclosed inside brackets [] are optional.
[extern] function function_name ([argument1, argument2...])
{
WMLScript statements here
[return (some_value);]
The extern keyword
The extern keyword is used to specify that a function can be called from both inside and outside of the
WMLScript file, i.e. the function can be called from functions in the same WMLScript file, from
functions in a different WMLScript file, or in a WML file. If you define a function without the extern
keyword, the function can only be called from functions in the same WMLScript file.
WMLScript function Arguments
Arguments are used to pass values into a function. Unlike programming languages like C++ or Java,
WMLScript does not require you to specify the data type of an argument. For example, to pass two
numbers into the WMLScript function wmlscript_function(), you will define something like this:
function wmlscript_function (number1, number2)
5
{
...
}
If a function does not require any arguments, you still need to include the
parentheses (), like this:
unction wmlscript_function ()
{
...
}
The return statement
The "return (some_value);" statement is used to return a value back to the calling function in
WMLScript. For example, the calculateSum() function below returns the sum of two numbers back to
the calling function each time it is executed:
function calculateSum(number1, number2)
{
return (number1 + number2);
6
}
The wmlscript_function() function below calls calculateSum() with two arguments 1 and 2. The value 3
is returned from calculateSum() and is assigned to the sum variable:
function wmlscript_function()
{
...
sum = calculateSum(1, 2);
...
}
It is not compulsory to include a return statement in a WMLScript function. If no return statement is
included, the default value, which is an empty string, will be returned.
5. Which are the library functions that handle absolute URLs? Explain.
Isvalid, getScheme, getHost, getPort, getPath are some of the functions which handles absolute URLs
This library contains a set of functions for handling absolute URLs and
relative URLs. The general URL syntax supported is:
<scheme> ://< host > :< port >/ < path >; < params>? <query >#< fragment>
The following functions: loadString ,unescapeString ,escapingString,
resolve,getRefer ,getBase ,getFragment ,getQuery ,getParameters ,getPath
,getPort ,getHost ,getScheme and isValid which comes under URL Library is discussed in this section
7
isValid
Function : isValid(url)
Description : Returns true if the given url has the right URL syntax,
otherwise returns false.
Both absolute and relative URLs are supported.
Relative URLs are not resolved into absolute URLs.
Parameters : url=String
Return value : Boolean or invalid.
: –
Exceptions
Example : vara=URL.isValid(http://www.webcomtec.com/script#func());
II a = true
var b = URL.isValid("../common#test()");
II b = true
Varc= URL.isValid("experimental?://www.webcomtec.com/pub")
II c = false
getScheme
Function : getScheme (url)
Description : Returns the scheme used in the given url.
Both absolute and relative URLs are supported.
Relative URLs are not resolved into absolute URLs.
Parameters : url=String
8
Return value : String or invalid
Exceptions : if an invalid URL syntax is encountered while extracting the
scheme, an invalid value is returned.
Example : Var a = URL.isValid(http://w.a.com"); //a = "http"
Var b = URL.getScheme("w.a.com"); II b = . ""
getHost
Function : getHost(url)
Description : Returns the host specified in the given url.
Both absolute and relative URLs are supported.
Relative URLs are not resolved into absolute URLs.
Parameters : url=String
Return value : String or invalid
Exceptions : If an invalid URL syntax is encountered while extracting the
host part, an invalid value is returned.
Example : var a= URL.getHost("http://www.webcomtec.com/pub");
II a = "www.webcomtec.com"
var b = URL.getHost(".path#frag") ;
II b = " "
getPort
Function : getPort(url)
Description : Returns the port number specified in the given url.
If no port is specified, an empty string is returned. Both absolute and relative URLs
9
are supported. Relative URLs are not resolved into absolute URLs.
Parameters : url=String
Return value : String invalid
Exceptions : If an invalid URL syntax is encountered while extracting the
port number, an invalid value is returned.
Example : var a = URL.getport(http://www.webcomtec.com:80/path");
II a= "80"
var b = URL.getport("http:/www.webcomtec.com/path");
II b = ""
getPort
Function : getPort(url)
Description : Returns the port number specified in the given url.
If no port is specified, an empty string is returned. Both absolute and relative URLs
are supported. Relative URLs are not resolved into absolute URLs.
Parameters : url=String
Return value : String invalid
Exceptions : If an invalid URL syntax is encountered while extracting the
port number, an invalid value is returned.
Example : var a = URL.getport(http://www.webcomtec.com:80/path");
II a= "80"
var b = URL.getport("http:/www.webcomtec.com/path");
II b = ""
getPath
10
Function : getPath(url)
Description : Returns the path specified in the given url. Both absolute and relative URLs are
supported. Relative URLs are not resolved into absolute URLs.
Parameters : url=String
Return value : String or invalid.
Exceptions : If an invalid URL syntax is encountered while extracting the
path, an invalid value is returned.
Example : var a= URL.getpath(http://w.a.com/home/sub/comp#frag");
II a = "/home/sub/comp"
var b = URL.getPath("../home/sub/comp#frag");
II b = "../home/sub/comp"
getParameters
Function : getParameters(url)
Description : Returns the parameters used in the given url.
If no parameters are specified an empty string is returned.
Both absolute and relative URLs are supported.
Relative URLs are not resolved into absolute URLs.
Parameters : url = String
Return value : String or invalid.
Exceptions : If an invalid URL syntax is encountered while extracting the
parameter, an invalid value is returned.
Example : var a = URL. getParameters("http://w.a.c/scr;3;2?x=1 &
11
y=3");
// a = " 3 ; 2"
var b = URL.getParameters
("../scr;3;2?x=1&y=3") ; II b = "3;2"
getQuery
Function : getQuery(url)
Description : Returns the query part specified in the given url.
If no query part is specified an empty string is returned. Both absolute and relative
URLs are supported. Relative URLs are not resolved into absolute URLs.
Parameters : url = String
Return value : String or invalid
Exceptions : If an invalid URL syntax is encountered while extracting the
query part, an invalid is returned.
Example : var a = URL. getQuery (http://w.a.c/scr;3;2?x=1&y=3");
II a = "x = 1&y = 3"
getFragment
Function : getFragment(url)
Description : Returns the fragment used in the given url.
If no fragment is specified an empty string is returned. Both absolute and relative URLs are
supported.
Relative URLs are not resolved into absolute URLs.
Parameters : url=String
12
Return value : String or invalid
Exceptions : IF an invalid URL syntax is encountered while extracting the
fragment, an invalid value is returned.
Example : vara=URL.getFragment("http://www.webcomtec.com/cont#frag");
II a = "frag"
getBase
Function : getBase(url)
Description : Returns an absolute URL (without the fragment) of the
current WML Script compilation unit.
Parameters : –
Return value : String
: –
Exceptions
Example : var a= URL. GetBase ( );
getRefer
Function : getRefer(url)
Description : Returns the smallest relative URL (relative to the base URL
of the current compilation unit) to the resource that called the current compilation
unit. Local function calls do not change the referer. If the current compilation unit does not have a
referer, an empty string is returned.
13
Parameters : –
Return value : String
–
Exceptions :
Example : var base= URL.getBase( );
//base
="http://www.webcomtec.com/currrent .scr"
var referer = URL.getReferer () ;
//referer = app.wml"
resolve
Function : resolve (baseurl, embedded URL)
Description : Returns an absolute URL from the given base URL and the embedded URL. If the
embedded URL is already an absolute URL, the function returns it without modification.
Parameters : baseUrl=String
Embedded Url=String
Return value : String or invalid
Exceptions : If an invalid URL syntax is encountered as part of the
resolution, invalid value is returned.
Example : var a= URL.resolve
II a= invalid
escapingString
Function : escapeString(url)
14
Description : This function computes a new version of a string value in
which special characters are replaced by a hexadecimal
escape sequence (you must use a two-digit escape
sequence of the form %xx).
Parameters : String=String
Return value : String or invalid
Exceptions : If string contains characters that are not part of the US-
ASCII character set, an invalid is returned.
unescapeString
Function : unescapeString (url)
Description : The unescape function computes a new version of a string value in which each
escape sequence of the sort that might be introduced by the URL.escapeString () function is
replaced by the character it represents. The given string is unescaped as such; no URL parsing is
performed.
Parameters : String=String
Return value : String or Invalid
Exceptions : If string contains characters that are not part of the US-
ASCII character set, an invalid is returned.
loadString
Function : loadString(url,content Type)
Description : Returns the content denoted by the given absolute url and the content Type.
The given content type is erroneous if it does not follow the following rules: You can specify only
15
one content type. The whole string 3 must match with only one content type and you cannot have
any extra leading or trailing spaces. The type must be text, but the subtype can be anything.
The type prefix must be "text/"
The given behaves as follows:
The content with the given content Type and url is loaded. The rest of the attributes needed
for the content load are specified by the default settings of the user agent. If the load is successful or
the returned content type matches the given content Type, the content is converted to a string and
returned. If the load is unsuccessful or the returned content is of the wrong content type, a scheme-
specific error code is returned.
Parameters : url=String
ContentType=String
Return value : String, integer or invalid.
Exceptions : Returns an integer error code that depends on the used URL scheme if the load fails.
If Http or WSP schemes are used, HTTP error codes are returned. If an erroneous content
Type is given, an invalid value is returned.
Example : varmyUrl = http://www.webcomtec.com/vcards/myaddr. vcf;
MyCard = URL.loadString(myUrl, "text/x-vcard");

Mais conteúdo relacionado

Mais procurados

HTML (HyperText Markup Language)
HTML (HyperText Markup Language)HTML (HyperText Markup Language)
HTML (HyperText Markup Language)
Amber Bhaumik
 
Web services
Web servicesWeb services
Web services
aspnet123
 
SOAP:Simple Object Access Protocol -XML-RPC
SOAP:Simple Object Access Protocol-XML-RPCSOAP:Simple Object Access Protocol-XML-RPC
SOAP:Simple Object Access Protocol -XML-RPC
elliando dias
 

Mais procurados (19)

Wsdl
WsdlWsdl
Wsdl
 
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
 
Web Services - WSDL
Web Services - WSDLWeb Services - WSDL
Web Services - WSDL
 
Oracle etl openworld
Oracle etl openworldOracle etl openworld
Oracle etl openworld
 
SOAP - Simple Object Access Protocol
SOAP - Simple Object Access ProtocolSOAP - Simple Object Access Protocol
SOAP - Simple Object Access Protocol
 
Web Service
Web ServiceWeb Service
Web Service
 
HTML (HyperText Markup Language)
HTML (HyperText Markup Language)HTML (HyperText Markup Language)
HTML (HyperText Markup Language)
 
Web service introduction
Web service introductionWeb service introduction
Web service introduction
 
SOAP Overview
SOAP OverviewSOAP Overview
SOAP Overview
 
Web services
Web servicesWeb services
Web services
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Introduction to SOAP
Introduction to SOAPIntroduction to SOAP
Introduction to SOAP
 
WSDL 2.0 and Apache Woden
WSDL 2.0 and Apache WodenWSDL 2.0 and Apache Woden
WSDL 2.0 and Apache Woden
 
SOAP:Simple Object Access Protocol -XML-RPC
SOAP:Simple Object Access Protocol-XML-RPCSOAP:Simple Object Access Protocol-XML-RPC
SOAP:Simple Object Access Protocol -XML-RPC
 
Wsdl
WsdlWsdl
Wsdl
 
WSDL
WSDLWSDL
WSDL
 
Java web services
Java web servicesJava web services
Java web services
 
Simple Object Access Protocol (SOAP)
Simple Object Access Protocol (SOAP)Simple Object Access Protocol (SOAP)
Simple Object Access Protocol (SOAP)
 

Destaque

Destaque (12)

Wireless Markup Language
Wireless Markup LanguageWireless Markup Language
Wireless Markup Language
 
Wap & WML
Wap & WMLWap & WML
Wap & WML
 
Wap
WapWap
Wap
 
Introduction to Mobile Internet
Introduction to Mobile InternetIntroduction to Mobile Internet
Introduction to Mobile Internet
 
Mobile Computing UNIT-8
Mobile Computing UNIT-8Mobile Computing UNIT-8
Mobile Computing UNIT-8
 
Mobile Communication
Mobile CommunicationMobile Communication
Mobile Communication
 
XML Programming WML by Dickson K.W. Chiu PhD, SMIEEE
XML Programming WML by Dickson K.W. Chiu PhD, SMIEEEXML Programming WML by Dickson K.W. Chiu PhD, SMIEEE
XML Programming WML by Dickson K.W. Chiu PhD, SMIEEE
 
Wap wml
Wap wmlWap wml
Wap wml
 
Mobile Computing (Part-2)
Mobile Computing (Part-2)Mobile Computing (Part-2)
Mobile Computing (Part-2)
 
WML BOX
WML BOXWML BOX
WML BOX
 
Wap
WapWap
Wap
 
Wap ppt
Wap pptWap ppt
Wap ppt
 

Semelhante a Bt0087 wml and wap programing2

Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
srikanthbkm
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
Raghu nath
 
Inline function
Inline functionInline function
Inline function
Tech_MX
 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
Ramu Palanki
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
ankush_kumar
 

Semelhante a Bt0087 wml and wap programing2 (20)

Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
 
Inline function
Inline functionInline function
Inline function
 
Web programming
Web programmingWeb programming
Web programming
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra  SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
 
[ITP - Lecture 12] Functions in C/C++
[ITP - Lecture 12] Functions in C/C++[ITP - Lecture 12] Functions in C/C++
[ITP - Lecture 12] Functions in C/C++
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Sqlapi0.1
Sqlapi0.1Sqlapi0.1
Sqlapi0.1
 
Function in C++
Function in C++Function in C++
Function in C++
 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
 
C language 3
C language 3C language 3
C language 3
 
Cordova training : Day 3 - Introduction to Javascript
Cordova training : Day 3 - Introduction to JavascriptCordova training : Day 3 - Introduction to Javascript
Cordova training : Day 3 - Introduction to Javascript
 
CJPCCS BCA VISNAGAR functions in C language
CJPCCS BCA VISNAGAR  functions in C languageCJPCCS BCA VISNAGAR  functions in C language
CJPCCS BCA VISNAGAR functions in C language
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
 
Applicative Functor - Part 2
Applicative Functor - Part 2Applicative Functor - Part 2
Applicative Functor - Part 2
 
Ch3- Java Script.pdf
Ch3- Java Script.pdfCh3- Java Script.pdf
Ch3- Java Script.pdf
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 

Mais de Techglyphs

Mais de Techglyphs (20)

Bt9002 Grid computing 2
Bt9002 Grid computing 2Bt9002 Grid computing 2
Bt9002 Grid computing 2
 
Bt9002 grid computing 1
Bt9002 grid computing 1Bt9002 grid computing 1
Bt9002 grid computing 1
 
Bt8901 objective oriented systems2
Bt8901 objective oriented systems2Bt8901 objective oriented systems2
Bt8901 objective oriented systems2
 
Bt0062 fundamentals of it(1)
Bt0062 fundamentals of it(1)Bt0062 fundamentals of it(1)
Bt0062 fundamentals of it(1)
 
Bt0062 fundamentals of it(2)
Bt0062 fundamentals of it(2)Bt0062 fundamentals of it(2)
Bt0062 fundamentals of it(2)
 
Bt0064 logic design1
Bt0064 logic design1Bt0064 logic design1
Bt0064 logic design1
 
Bt0064 logic design2
Bt0064 logic design2Bt0064 logic design2
Bt0064 logic design2
 
Bt0066 database management system1
Bt0066 database management system1Bt0066 database management system1
Bt0066 database management system1
 
Bt0066 database management system2
Bt0066 database management system2Bt0066 database management system2
Bt0066 database management system2
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2
 
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1
 
Bt0068 computer organization and architecture
Bt0068 computer organization and architecture Bt0068 computer organization and architecture
Bt0068 computer organization and architecture
 
Bt0068 computer organization and architecture 2
Bt0068 computer organization and architecture 2Bt0068 computer organization and architecture 2
Bt0068 computer organization and architecture 2
 
Bt0070 operating systems 1
Bt0070 operating systems  1Bt0070 operating systems  1
Bt0070 operating systems 1
 
Bt0070 operating systems 2
Bt0070 operating systems  2Bt0070 operating systems  2
Bt0070 operating systems 2
 
Bt0072 computer networks 1
Bt0072 computer networks  1Bt0072 computer networks  1
Bt0072 computer networks 1
 
Bt0072 computer networks 2
Bt0072 computer networks  2Bt0072 computer networks  2
Bt0072 computer networks 2
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
 
Bt0074 oops with java
Bt0074 oops with javaBt0074 oops with java
Bt0074 oops with java
 
Bt0075 rdbms with mysql 1
Bt0075 rdbms with mysql 1Bt0075 rdbms with mysql 1
Bt0075 rdbms with mysql 1
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Último (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 

Bt0087 wml and wap programing2

  • 1. 1 WML and Wap BT0087 Part-2 By Milan K Antony
  • 2. 2 1. What are the problems in WML? WML which is infested with myriad problems. They are as follows: (a) it is static in nature. (b) Even though it has the concept of variables, initializing these variables is not as simple as it is in any other programming languages. (c) It doesn't support the features that other programming languages do. As a consequence, you cannot write a code that is dynamic. Dynamic in this context means, the ability to modify the behavior of the program while it is running. Therefore, WML is similar to HTML. In both cases, you cannot write programs, which have sufficient inbuilt intelligence.WML also fails to offer you the requisite level of flexibility. 2. What are the features of WML script Language? Some basic syntactical features of the language are:  The smallest unit of execution in WMLScript is a statement and each statement must end with a semicolon (;). The following code is taken from the earlier "Hello World" example. You can see that the two WMLScript statements in this function have been ended with semicolons. extern function helloWorld() { WMLBrowser.setVar("message", "Hello World. Welcome to our WMLScript tutorial."); WMLBrowser.refresh(); }  WMLScript is case-sensitive. a WMLScript function with the name WMLScript_Function is different from wmlscript_function. So, be careful of the capitalization when defining or referring to a function or a variable in WMLScript.  Comments can either be single-line (beginning with //) or multi-line (bracketed by /* and */). This syntax is identical to both C++ and Java. There are two types of comments in WMLScript: single-line comment and multi-line comment. To add a single-line comment, begin a line of text with the // characters. To add a multi-line comment, enclose the text within /* and */. These rules are the same in WMLScript, JavaScript, Java, and C++. The WMLScript engine will ignore all comments. The following WMLScript example demonstrates the use of comments: extern function helloWorld() { // This is a single-line comment. /* This is a
  • 3. 3 multi-line comment. */ /* A multi-line comment can be placed on a single line. */ WMLBrowser.setVar ("message", "Hello World. Welcome to our WMLScript tutorial."); WMLBrowser.refresh (); // A comment can be placed at a statement's end. }  A literal character string is defined as any sequence of zero or more characters enclosed within double ("") or single (‘) quotes.  Boolean literal values correspond to true and false.  New variables are declared using the var keyword (i.e. var x ;) 3. What is an operator? What are the operators supported by WML Script? Explain with examples. An operator is essentially a predefined function that is a part of the WMLScript language. WMLScript supports a variety of operators that support value assignment operations, arithmetic operations, logical operations, string operations, comparison operations, and array operations WML Script offers several ways to assign a value to a variable. The simplest is the regular assignment (=), but assignments with operations are also supported: 4. What are the Characteristics of the functions? Characteristics of the functions are The characteristics of the functions in WML Script are mentioned below  Function declarations cannot be nested.  Function names must be unique within one compilation unit.  All parameters to functions are passed by value.
  • 4. 4  Function calls must pass exactly the same number of arguments to the called function as specified in the function declaration.  Function parameters behave like local variables that have been initialized before the function body (block of statements) is executed.  A function always returns a value. By default, it is an empty string (" ").  However, you can use a return statement to specify other return values. A function in WMLScript is defined using the following format. The parts enclosed inside brackets [] are optional. [extern] function function_name ([argument1, argument2...]) { WMLScript statements here [return (some_value);] The extern keyword The extern keyword is used to specify that a function can be called from both inside and outside of the WMLScript file, i.e. the function can be called from functions in the same WMLScript file, from functions in a different WMLScript file, or in a WML file. If you define a function without the extern keyword, the function can only be called from functions in the same WMLScript file. WMLScript function Arguments Arguments are used to pass values into a function. Unlike programming languages like C++ or Java, WMLScript does not require you to specify the data type of an argument. For example, to pass two numbers into the WMLScript function wmlscript_function(), you will define something like this: function wmlscript_function (number1, number2)
  • 5. 5 { ... } If a function does not require any arguments, you still need to include the parentheses (), like this: unction wmlscript_function () { ... } The return statement The "return (some_value);" statement is used to return a value back to the calling function in WMLScript. For example, the calculateSum() function below returns the sum of two numbers back to the calling function each time it is executed: function calculateSum(number1, number2) { return (number1 + number2);
  • 6. 6 } The wmlscript_function() function below calls calculateSum() with two arguments 1 and 2. The value 3 is returned from calculateSum() and is assigned to the sum variable: function wmlscript_function() { ... sum = calculateSum(1, 2); ... } It is not compulsory to include a return statement in a WMLScript function. If no return statement is included, the default value, which is an empty string, will be returned. 5. Which are the library functions that handle absolute URLs? Explain. Isvalid, getScheme, getHost, getPort, getPath are some of the functions which handles absolute URLs This library contains a set of functions for handling absolute URLs and relative URLs. The general URL syntax supported is: <scheme> ://< host > :< port >/ < path >; < params>? <query >#< fragment> The following functions: loadString ,unescapeString ,escapingString, resolve,getRefer ,getBase ,getFragment ,getQuery ,getParameters ,getPath ,getPort ,getHost ,getScheme and isValid which comes under URL Library is discussed in this section
  • 7. 7 isValid Function : isValid(url) Description : Returns true if the given url has the right URL syntax, otherwise returns false. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String Return value : Boolean or invalid. : – Exceptions Example : vara=URL.isValid(http://www.webcomtec.com/script#func()); II a = true var b = URL.isValid("../common#test()"); II b = true Varc= URL.isValid("experimental?://www.webcomtec.com/pub") II c = false getScheme Function : getScheme (url) Description : Returns the scheme used in the given url. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String
  • 8. 8 Return value : String or invalid Exceptions : if an invalid URL syntax is encountered while extracting the scheme, an invalid value is returned. Example : Var a = URL.isValid(http://w.a.com"); //a = "http" Var b = URL.getScheme("w.a.com"); II b = . "" getHost Function : getHost(url) Description : Returns the host specified in the given url. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String Return value : String or invalid Exceptions : If an invalid URL syntax is encountered while extracting the host part, an invalid value is returned. Example : var a= URL.getHost("http://www.webcomtec.com/pub"); II a = "www.webcomtec.com" var b = URL.getHost(".path#frag") ; II b = " " getPort Function : getPort(url) Description : Returns the port number specified in the given url. If no port is specified, an empty string is returned. Both absolute and relative URLs
  • 9. 9 are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String Return value : String invalid Exceptions : If an invalid URL syntax is encountered while extracting the port number, an invalid value is returned. Example : var a = URL.getport(http://www.webcomtec.com:80/path"); II a= "80" var b = URL.getport("http:/www.webcomtec.com/path"); II b = "" getPort Function : getPort(url) Description : Returns the port number specified in the given url. If no port is specified, an empty string is returned. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String Return value : String invalid Exceptions : If an invalid URL syntax is encountered while extracting the port number, an invalid value is returned. Example : var a = URL.getport(http://www.webcomtec.com:80/path"); II a= "80" var b = URL.getport("http:/www.webcomtec.com/path"); II b = "" getPath
  • 10. 10 Function : getPath(url) Description : Returns the path specified in the given url. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String Return value : String or invalid. Exceptions : If an invalid URL syntax is encountered while extracting the path, an invalid value is returned. Example : var a= URL.getpath(http://w.a.com/home/sub/comp#frag"); II a = "/home/sub/comp" var b = URL.getPath("../home/sub/comp#frag"); II b = "../home/sub/comp" getParameters Function : getParameters(url) Description : Returns the parameters used in the given url. If no parameters are specified an empty string is returned. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url = String Return value : String or invalid. Exceptions : If an invalid URL syntax is encountered while extracting the parameter, an invalid value is returned. Example : var a = URL. getParameters("http://w.a.c/scr;3;2?x=1 &
  • 11. 11 y=3"); // a = " 3 ; 2" var b = URL.getParameters ("../scr;3;2?x=1&y=3") ; II b = "3;2" getQuery Function : getQuery(url) Description : Returns the query part specified in the given url. If no query part is specified an empty string is returned. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url = String Return value : String or invalid Exceptions : If an invalid URL syntax is encountered while extracting the query part, an invalid is returned. Example : var a = URL. getQuery (http://w.a.c/scr;3;2?x=1&y=3"); II a = "x = 1&y = 3" getFragment Function : getFragment(url) Description : Returns the fragment used in the given url. If no fragment is specified an empty string is returned. Both absolute and relative URLs are supported. Relative URLs are not resolved into absolute URLs. Parameters : url=String
  • 12. 12 Return value : String or invalid Exceptions : IF an invalid URL syntax is encountered while extracting the fragment, an invalid value is returned. Example : vara=URL.getFragment("http://www.webcomtec.com/cont#frag"); II a = "frag" getBase Function : getBase(url) Description : Returns an absolute URL (without the fragment) of the current WML Script compilation unit. Parameters : – Return value : String : – Exceptions Example : var a= URL. GetBase ( ); getRefer Function : getRefer(url) Description : Returns the smallest relative URL (relative to the base URL of the current compilation unit) to the resource that called the current compilation unit. Local function calls do not change the referer. If the current compilation unit does not have a referer, an empty string is returned.
  • 13. 13 Parameters : – Return value : String – Exceptions : Example : var base= URL.getBase( ); //base ="http://www.webcomtec.com/currrent .scr" var referer = URL.getReferer () ; //referer = app.wml" resolve Function : resolve (baseurl, embedded URL) Description : Returns an absolute URL from the given base URL and the embedded URL. If the embedded URL is already an absolute URL, the function returns it without modification. Parameters : baseUrl=String Embedded Url=String Return value : String or invalid Exceptions : If an invalid URL syntax is encountered as part of the resolution, invalid value is returned. Example : var a= URL.resolve II a= invalid escapingString Function : escapeString(url)
  • 14. 14 Description : This function computes a new version of a string value in which special characters are replaced by a hexadecimal escape sequence (you must use a two-digit escape sequence of the form %xx). Parameters : String=String Return value : String or invalid Exceptions : If string contains characters that are not part of the US- ASCII character set, an invalid is returned. unescapeString Function : unescapeString (url) Description : The unescape function computes a new version of a string value in which each escape sequence of the sort that might be introduced by the URL.escapeString () function is replaced by the character it represents. The given string is unescaped as such; no URL parsing is performed. Parameters : String=String Return value : String or Invalid Exceptions : If string contains characters that are not part of the US- ASCII character set, an invalid is returned. loadString Function : loadString(url,content Type) Description : Returns the content denoted by the given absolute url and the content Type. The given content type is erroneous if it does not follow the following rules: You can specify only
  • 15. 15 one content type. The whole string 3 must match with only one content type and you cannot have any extra leading or trailing spaces. The type must be text, but the subtype can be anything. The type prefix must be "text/" The given behaves as follows: The content with the given content Type and url is loaded. The rest of the attributes needed for the content load are specified by the default settings of the user agent. If the load is successful or the returned content type matches the given content Type, the content is converted to a string and returned. If the load is unsuccessful or the returned content is of the wrong content type, a scheme- specific error code is returned. Parameters : url=String ContentType=String Return value : String, integer or invalid. Exceptions : Returns an integer error code that depends on the used URL scheme if the load fails. If Http or WSP schemes are used, HTTP error codes are returned. If an erroneous content Type is given, an invalid value is returned. Example : varmyUrl = http://www.webcomtec.com/vcards/myaddr. vcf; MyCard = URL.loadString(myUrl, "text/x-vcard");