WML SCRIPT is part of the WAP application layer of the unlimited application protocol. It can be used to add client processing logic to the WML card set and card. The latest version is version 1.1. WML Script1.1 is specified based on the ECMAScript script language developed by the European Computer Manufacturers Association, modified and optimized. It can better support high-bandwidth communication devices such as mobile phones. Using WML Script in WML programming can effectively enhance the flexibility of client applications. Moreover, we can also use WML Script as a tool to develop functions. Powerful WAP network application and unlimited web pages. In this chapter, we will explain in detail the basic pre-legalization of WML Script1.1 programming, such as basic rules, variable pre-data types, operation assignment expressions, etc. For simplicity of description, we will refer to "WML Script1.1" as "WMLScript" from now on.
4.1 Calling WML Script functions in WML programs
After studying the first two chapters, readers who are familiar with C language may realize that WML’s function functions, logical operation functions, etc. are very limited. WMLScript provides rich function functions. We can use WMLScript to enhance WML programming in WAP application development. Therefore, WMLScript has become the main development tool for extending WML programming capabilities.
4.2 The main advantages of WMLScript and its bytecode interpreter
WMLScript has a set of defined bytecodes and an interpreter reference structure. WMLScript data in wireless network transmission is transmitted in binary format, so users can use a wide-bandwidth communication channel, thereby keeping the client mobile phone requiring only minimal memory. WMLScript obtained after modifying ECMAScript can compile programs into bytecode faster, smaller, and easier. All these features mean that WMLScript has many advantages and functions that WML cannot have.
4.2.1 The main advantages of using WMLScript
The design purpose of WMLScript is to provide general script processing capabilities for the WMLScript system. Using WMLScript we can further supplement the programming functions of the XML-based WML language and develop a wide-bandwidth network Applications and content, such as text, images, selection lists, etc., we can use simple formats to write more flexible and readable user interfaces. WMLScript has advantages and functions that WML cannot have, mainly including the following aspects:
(1) Check the legality of user input:
(2) Extend the functions of the user's browser, such as allowing programmers to develop Make phone calls on mobile phones, send text messages, store phone numbers, manage phone books or SIM cards, etc.;
(3) Generate confirmation, prompts, warning messages or operation dialog boxes on the client side and quickly display them on the browser ;
(4) After the user's browser is changed, the browser-side software and parameters can be expanded and configured;
(5) Overcome the client's bandwidth communication connection limit to the greatest extent, and provide a rich program Function;
(6) Supplement WML and enable it to implement a variety of services for micro mobile terminal devices, such as supporting advanced user interfaces, increasing client intelligence, providing access capabilities to user browser peripheral functions, and connecting servers and The client browses and transmits data to reduce bandwidth usage, etc.
4.2.2 WMLScript bytecode interpreter
Before being interpreted by the WMLScript bytecode interpreter, text format programs written in the WMLScript language will first be compiled into binary format codes. When compiling, the compiler usually divides the WMLScript program into several editing units. Each unit of the program contains a certain number of statement lines and WMLScript functions. Then, the WMLScript compiler will take the WMLScript program as input one by one according to these compilation units. content, and use the corresponding bytecode as the output content. When the user calls the WMLScript program through the WAP mobile phone, the encoding function of the compiler is activated and executed.
4.3 Basic rules of WMLScript
WMLScript follows the practice of WML in many basic rules. However, since WMLScript is specified based on the C language, its syntax features are very similar to the C language. If you are familiar with C language, it should be relatively easy to learn and master this part of the content.
4.3.1 WMLScript and URL
Like WML, WMLScript also follows the URL, HTTP and other specifications of WWW and HTML for accessing resources, and expands the scope of URL usage. In WMLScript, not only hyperlinks and file paths, that is, file names, can be processed as URLs, but external functions, Access Control information, etc. can also be processed as URLs.
To this end, WMLScript adopts a WML workaround, which is to improve the way HTML names resources as values, and uses the form of program segment anchors (Fragment Anchor) to handle resource positioning. The program segment anchor point is defined according to the document URL rules and written with a pound sign (#) before the program segment identifier. Using program segment anchors, a WMLScript program can specify any function within the WMLScript compilation unit and pass the required parameters when calling the function.
4.3.2 Lexical structure
The lexical structure in WMLScript programming is not complicated. We will explain the relevant specific rules in terms of case sensitivity, spaces, line breaks, comments, etc. below.
(1) Content type. The content type of WMLScript mainly targets two situations: file form and binary form. The type structure can be specified on the server side. The specific form is:
Text form: text/vnd.wap.wmlscript;
Binary form: application/ vnd.wap.wmlscriptc.
We have introduced the specific designation method in Chapter 4 and will not repeat it here.
(2) Case sensitive. WMLScript1.1 is a case-sensitive scripting language. The various keywords, variables, and function names it designs must be case-sensitive.
(3) Spaces and line breaks. Normally, WMLScript program value forms will ignore all spaces, tabs, newlines, etc. But if these special characters are expressed through code or processed as strings, WMLScript will no longer ignore them. For example, if the string "Oct 28,2001" contains spaces, the spaces will not be ignored during execution. It is different from the string "Oct28,2001" without spaces.
(4) Comments. Like WML programming, comments can also be added to WMLScript scripts. Comment content is not executed by the program, and comments cannot be nested. There are two ways to comment in WMLScript:
One is line comments. That is, use a double slash (//) to introduce a line of content, and the entire content of this line will be used as comment content. For example:
//This is a line comment, starting from the double slash and ending with the comment.
Second, block selection. That is, everything starting with the symbol "/*" and ending with the symbol "/*" is comment content. For example:
/*This is a block comment, and the content added in the middle is the comment content*/
(5) Data type and direct encoding. WMLScript allows 4 types of data to be directly encoded and nested and can be embedded in the program. The four data types directly encoded are: integers, floating point numbers, strings and Boolean values. In addition, the "invalidity" value can also be directly encoded" 1. Integer. When using integers in decimal, hexadecimal or octal mode, such integers can be directly encoded.
When programming, decimal numbers None start with 0, and only contain numerical strings from 0 to 9; hexadecimal data starts with OX or Ox, and only contains strings from 0 to 9, a~f, or A~F; octal numbers all start with 0 At the beginning, it only contains digit strings from 0 to 7.
2. Floating point numbers are usually defined as numbers that contain a decimal point and can contain decimal and exponent parts. There are many forms of floating point numbers, which can be decimal integers or floating point numbers. A point can be a fraction or an exponent; but a floating point number must have at least one number.
The exponent starts with e or E, followed by an integer. For example: e0 is 10. The zero power, for example: when e0 is the other power of 10, the set of negative 2 powers of 10 when e-2 is equal to 0.01. The exponent can be signed, exactly (+) or minus sign (-), which respectively represent a positive exponent. and negative exponent.
3. String refers to the content defined between pairs of double quotation marks ("") or single quotation marks (' ') Since WMLScript only allows the use of pairs. Double quotation marks or single quotation marks are used to define a string, so a compilation error will occur when a single quotation mark or a double quotation mark is used in the program.
Considering that some special characters cannot be directly displayed in the string, WMLScript provides translation. Sequence to represent these special characters. 4. Boolean type. It is just two values of true and false, used to represent "true value" or "false value" in WMLScript. Boolean type data can participate in XOR, OR and other operations. We will introduce the specific rules later.
5. Invalid type. It is a quantity supported by WMLScript that represents an invalid value. It is similar to NULL in C language. ## 4. Reserved words. There is a set of reserved words defined in WMLScript, which contain some words with special meanings that cannot be defined separately and cannot be used as other identifiers. The reserved words in WMLScript are as follows:
acces http agent if. break isvalid continue meta header
p name p= path domain return else typeof while
equiv url extern use for user function var
In addition, WMLScript also reserves some reserved words for future versions, mainly including:
case finally catch import class private const public debugger
sizeof default struct do super enum switch export throw
extends try
WMLScript also has some unused reserved words:
delete null in this lib void new with
7.Identifier. WMLScript identifiers can specify or name three types of elements: variables, functions, and annotations. The identifier cannot start with a number, but it can start with an underscore (-). Moreover, the identifier cannot be a reserved word of WMLScript. For example, timeOfDay, speed, quality, HOME_ADDRESS, _myName, varO, etc. are all legal identifiers; while strings starting with numbers or special symbols other than short underscores, as well as reserved words, etc., are illegal identifiers, such as while, for, if, my~name, $sys, 123, 3pieces, take.this, etc.
Since WMLScript is strictly case-sensitive, identifiers with the same letters but different capitalization are not the same identifier. For example, Work and work are different identifiers.
8. Name space. WMLScript provides a relatively free name space, and the same identifier can be used for different purposes at the same time. For example, as an identifier of a certain function name, it can also be used as variable name, function parameter, program annotation, etc. Their attributes or values do not affect each other when used. . In the following simple routine, the identifier myTest is used not only as a function name, but also as a variable name, function parameter name, function parameter name, and constant name. Obviously, this feature of WMLScript provides great convenience for us to write programs.
Current 1/2 page 12Read the full text on the next page
The above is the detailed content of Wireless Markup Language (WML) Basics WMLScript Basics. For more information, please follow other related articles on the PHP Chinese website!

RSS documents work by publishing content updates through XML files, and users subscribe and receive notifications through RSS readers. 1. Content publisher creates and updates RSS documents. 2. The RSS reader regularly accesses and parses XML files. 3. Users browse and read updated content. Example of usage: Subscribe to TechCrunch's RSS feed, just copy the link to the RSS reader.

The steps to build an RSSfeed using XML are as follows: 1. Create the root element and set the version; 2. Add the channel element and its basic information; 3. Add the entry element, including the title, link and description; 4. Convert the XML structure to a string and output it. With these steps, you can create a valid RSSfeed from scratch and enhance its functionality by adding additional elements such as release date and author information.

The steps to create an RSS document are as follows: 1. Write in XML format, with the root element, including the elements. 2. Add, etc. elements to describe channel information. 3. Add elements, each representing a content entry, including,,,,,,,,,,,. 4. Optionally add and elements to enrich the content. 5. Ensure the XML format is correct, use online tools to verify, optimize performance and keep content updated.

The core role of XML in RSS is to provide a standardized and flexible data format. 1. The structure and markup language characteristics of XML make it suitable for data exchange and storage. 2. RSS uses XML to create a standardized format to facilitate content sharing. 3. The application of XML in RSS includes elements that define feed content, such as title and release date. 4. Advantages include standardization and scalability, and challenges include document verbose and strict syntax requirements. 5. Best practices include validating XML validity, keeping it simple, using CDATA, and regularly updating.

RSSfeedsareXMLdocumentsusedforcontentaggregationanddistribution.Totransformthemintoreadablecontent:1)ParsetheXMLusinglibrarieslikefeedparserinPython.2)HandledifferentRSSversionsandpotentialparsingerrors.3)Transformthedataintouser-friendlyformatsliket

JSONFeed is a JSON-based RSS alternative that has its advantages simplicity and ease of use. 1) JSONFeed uses JSON format, which is easy to generate and parse. 2) It supports dynamic generation and is suitable for modern web development. 3) Using JSONFeed can improve content management efficiency and user experience.

How to build, validate and publish RSSfeeds? 1. Build: Use Python scripts to generate RSSfeed, including title, link, description and release date. 2. Verification: Use FeedValidator.org or Python script to check whether RSSfeed complies with RSS2.0 standards. 3. Publish: Upload RSS files to the server, or use Flask to generate and publish RSSfeed dynamically. Through these steps, you can effectively manage and share content.

Methods to ensure the security of XML/RSSfeeds include: 1. Data verification, 2. Encrypted transmission, 3. Access control, 4. Logs and monitoring. These measures protect the integrity and confidentiality of data through network security protocols, data encryption algorithms and access control mechanisms.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.