XHTML

>> Monday, August 3, 2009

The Extensible Hypertext Markup Language, or XHTML, is a markup language that has the same depth of expression as HTML, but also conforms to XML syntax.
While HTML prior to HTML 5 was defined as an application of Standard Generalized Markup Language (SGML), a very flexible markup language, XHTML is an application of XML, a more restrictive subset of SGML. Because they need to be well-formed, true XHTML documents allow for automated processing to be performed using standard XML tools—unlike HTML, which requires a relatively complex, lenient, and generally custom parser. XHTML can be thought of as the intersection of HTML and XML in many respects, since it is a reformulation of HTML in XML. XHTML 1.0 became a World Wide Web Consortium (W3C) Recommendation on January 26, 2000. XHTML 1.1 became a W3C Recommendation on May 31, 2001.
Overview
XHTML is "a reformulation of the three HTML 4 document types as applications of XML 1.0".The W3C also continues to maintain the HTML 4.01 Recommendation and the specifications for HTML 5 and XHTML 5 are being actively developed. In the current XHTML 1.0 Recommendation document, as published and revised to August 2002, the W3C comments that, "The XHTML family is the next step in the evolution of the Internet. By migrating to XHTML today, content developers can enter the XML world with all of its attendant benefits, while still remaining confident in their content's backward and future compatibility."
Motivation
In the late 1990s, many considered that the future of HTML lay in the creation of a version adhering to the syntax rules of XML. The then current version of HTML, HTML 4, was ostensibly an application of Standard Generalized Markup Language (SGML); however the specification for SGML was complex, and neither web browsers nor the HTML 4 Recommendation were fully conformant with it. By shifting the underlying base from SGML to the simpler XML, HTML would become compatible with common XML tools; servers and proxies would be able to transform content, as necessary, for constrained devices such as mobile phones.
Another key advantage was extensibility. By utilising namespaces, XHTML documents could include fragments from other XML-based languages such as Scalable Vector Graphics and MathML. Finally, the renewed work would provide an opportunity to divide HTML into reusable components (XHTML Modularization) and clean up untidy parts of the language.
Relationship to HTML
HTML is the antecedent technology to XHTML. The changes from HTML to first-generation XHTML 1.0 are minor and are mainly to achieve conformance with XML. The most important change is the requirement that the document must be well-formed and that all elements must be explicitly closed as required in XML. In XML, all element and attribute names are case-sensitive, so the XHTML approach has been to define all tag names to be lowercase.
This contrasts with some earlier established traditions that began around the time of HTML 2.0, when many used uppercase tags. In XHTML, all attribute values must be enclosed by quotes; either single (') or double (") quotes may be used. In contrast, this was sometimes optional in SGML-based HTML, where attributes can omit quotes in certain cases. All elements must also be explicitly closed, including empty (aka singleton) elements such as img and br. This can be done by adding a closing slash to the start tag, e. g., and
. Attribute minimization (e. g.,

Read more...

Template (programming)

Templates are a feature of the C++ programming language that allow functions and classes to operate with generic types. This allows a function or class to work on many different data types without being rewritten for each one.
Templates are of great utility to programmers in C++, especially when combined with multiple inheritance and operator overloading. The C++ Standard Library provides many useful functions within a framework of connected templates.
Technical overview
There are two kinds of templates: function templates and class templates.
Function templates
A function template behaves like a function that can accept arguments of many different types. In other words, a function template represents a family of functions.
Class Templates
Simple Class templates
A function template provides a specification for generating template functions, based on some parameters, which all share the same name and are treated as a unit (meaning that, for instance, the programmer just calls max with some arguments, and the appropriate instance of the template materializes).
Similarly, a class template provides a specification for generating classes based on parameters. The previous section shows an advance use of class templates to perform compile-type computation on types. A more common use for class templates, is the definition of polymorphic classes, such as containers.
For example, the C++ standard library has a list container called list, which is a template. The statement list designates or instantiates a linked-list of type int. The statement list designates or instantiates a linked-list of type string. The template has some additional parameters, which take default values if they are not specified. For example, the programmer can write a custom class that provides memory allocation services, and that class can be specified as an argument to the list template, to instantiate a list container that is tightly coupled to this custom allocator (at compile time).
A class template usually defines a set of generic functions that operate on the type specified for each instance of the class (i.e., the parameter between the angle brackets, as shown above). The compiler will generate the appropriate function code at compile-time for the parameter type that appears between the brackets.
Template specialization
The programmer may decide to implement a special version of a function (or class) for a certain type which is called template specialization. If a class template is specialized by a subset of its parameters it is called partial template specialization. If all of the parameters are specialized it is an explicit specialization or full specialization. Function templates cannot be partially specialized.
Specialization is used when the behavior of a function or class for particular choices of the template parameters must deviate from the generic behavior: that is, from the code generated by the main template, or templates.
For example, consider the max function again. Suppose that the programmer has a class for representing mathematical vectors called vec. This vector class has a member function called norm which returns the length of a vector. The programmer wants to be able to use the max template function over two vec objects, with the semantics that it returns the vector which has the greater norm of the two.
The regular max template does not necessarily work. It wants to compare objects using the greater-than operator:
template
typename promote::type max(const L &left, const R &right)
{
// requires "::operator > (L, R)" or "L::operator > (R)"
return left > right ? left : right;
}
One obvious way to solve the problem is to make the greater-than operator work for vec objects using their norm, so that this template is then applicable. However, here is how it can be solved with a template specialization for max:
template<>
typename promote::type max(const vec &left, const vec &right)
{
return left.norm() > right.norm() ? left : right;
}
The template specialization provides custom behavior for this combination of types; the norm member function is called on both vectors to retrieve their lengths, and it is their lengths (assumed to be some scalar numeric type) which are then compared with the greater-than operator.
Also, the previous section Class Templates demonstrates a use of template specialization over class templates to write the base rules for type promotion for two-valued arithmetic operation.
Advantages and disadvantages
Some uses of templates, such as the maximum() function, were previously fulfilled by function-like preprocessor macros. For example, the following is a C++ maximum() macro:
#define maximum(a,b) ((a) < (b) ? (b) : (a))
Both macros and templates are expanded at compile-time. Macros are always expanded inline, whereas templates are only expanded inline when the compiler deems it appropriate. When expanded inline, macro functions and template functions have no extraneous run-time overhead. However, template functions will have run-time overhead when they are not expanded inline.
Templates are considered "type-safe", that is, they require type-checking at compile-time. Hence, the compiler can determine at compile-time whether or not the type associated with a template definition can perform all of the functions required by that template definition.
By design, templates can be utilized in very complex problem spaces, whereas macros are substantially more limited.
There are fundamental drawbacks to the use of templates:
Historically, some compilers exhibited poor support for templates. So, the use of templates could decrease code portability.
Many compilers lack clear instructions when they detect a template definition error. This can increase the effort of developing templates, and has prompted the inclusion of Concepts in the next C++ standard.
Since the compiler generates additional code for each template type, indiscriminate use of templates can lead to code bloat, resulting in larger executables.
Because a template by its nature exposes its implementation, injudicious use in large systems can lead to longer build times.
Additionally, the use of the "less-than" and "greater-than" signs as delimiters is problematic for tools (such as text editors) which analyse source code syntactically. It is difficult, or maybe impossible, for such tools to determine whether a use of these tokens is as comparison operators or template delimiters. For example, this line of code:
foo (a < b, c > d) ;
may be a function call with two integer parameters, each a comparison expression. Alternatively, it could be a declaration of a constructor for class foo taking one parameter, "d", whose type is the parametrised "a < b, c >".
Generic programming features in other languages
Initially, the concept of templates was not included in some languages, such as Java and C# 1.0. Java's adoption of generics mimics the behavior of templates, but is technically different. C# added generics (parameterized types) in .NET 2.0. The generics in Ada predate C++ templates.
Although C++ templates, Java generics, and .NET generics are often considered similar, generics only mimic the basic behavior of C++ templates. Some of the advanced template features utilized by libraries such as Boost and STLSoft, and implementations of the STL itself, for template metaprogramming (explicit or partial specialization, default template arguments, template non-type arguments, template template arguments, ...) are not available with generics.
The D programming language attempts to build on C++ by creating an even more powerful template system. A significant addition is the inclusion of the static if statement, which allows conditional compilation of code based on any information known at compile time.
This function will work for any number of arguments, with the foreach iteration over the tuple of arguments expanded at compile time.
In C++ templates, the compile-time cases are performed by pattern matching over the template arguments, so the Factorial template's base cases are implemented by matching 0 and 1 rather than with an inequality test, which is unavailable:

Read more...

JHTML

JHTML stands for Java HTML. This is a page authoring system developed at Art Technology Group (ATG). Files with a ".jhtml" filename extension contain standard HTML tags in addition to proprietary tags that reference Java objects running on a special server setup to handle requests for pages of this sort.
When a request is made for a JHTML page, e.g. "index.jhtml", the request for this page is forwarded from the HTTP server to another system running a Java application server. The JHTML page is compiled first into a .java file and then into a Java .class file. The application server runs the code in the .class file as a servlet whose sole function is to emit a stream of standard HTTP and HTML data back to the HTTP server and on back to the client software (the web browser, usually) that originally requested the document. The principal benefit of this system is that it allows logic running in Java on the application server to generate the HTML dynamically. Often a database is queried to accumulate the specific data needed in the page.
JHTML
The system is derivative of earlier forms of CGI programming that allow a program running on a web server to generate HTML dynamically. With JHTML, you can author standard HTML and just insert a few extra tags that represent the pieces of the HTML page data that Java should be used to create. JHTML is a proprietary technology of ATG. Sun Microsystems licensed parts of this technology and developed the JSP system from the ATG page compilation system. Even though many popular sites are still using JHTML, the JSP standard has largely superseded it.

Read more...

Dynamic HTML

Dynamic HTML, or DHTML, is a collection of technologies used together to create interactive and animated web sites by using a combination of a static markup language (such as HTML), a client-side scripting language (such as JavaScript), a presentation definition language (such as CSS), and the Document Object Model.
DHTML allows scripting languages to change variables in a web page's definition language, which in turn affects the look and function of otherwise "static" HTML page content, after the page has been fully loaded and during the viewing process. Thus the dynamic characteristic of DHTML is the way it functions while a page is viewed, not in its ability to generate a unique page with each page load.
By contrast, a dynamic web page is a broader concept — any web page generated differently for each user, load occurrence, or specific variable values. This includes pages created by client-side scripting, and ones created by server-side scripting (such as PHP or Perl) where the web server generates content before sending it to the client.
Uses
DHTML is often used to make rollover buttons or drop-down menus on a web page and interactive web pages.
A less common use is to create browser-based action games. During the late 1990s and early 2000s, a number of games were created using DHTML, such as Kingdom of Loathing, but differences between browsers made this difficult: many techniques had to be implemented in code to enable the games to work on multiple platforms. Recently browsers have been converging towards the web standards, which has made the design of DHTML games more viable. Those games can be played on all major browsers and they can also be ported to Widgets for Mac OS X and Gadgets for Windows Vista, which are based on DHTML code.
The term has fallen out of use in recent years, as DHTML scripts often tended to not work well between various web browsers. DHTML may now be referred to as unobtrusive JavaScript coding (DOM Scripting), in an effort to place an emphasis on agreed-upon best practices while allowing similar effects in an accessible, standards-compliant way.
Some disadvantages of DHTML are that it is difficult to develop and debug due to varying degrees of support among web browsers of the technologies involved, and that the variety of screen sizes means the end look can only be fine-tuned on a limited number of browser and screen-size combinations. Development for relatively recent browsers, such as Internet Explorer 5.0+, Mozilla Firefox 2.0+, and Opera 7.0+, is aided by a shared Document Object Model. Basic DHTML support was introduced with Internet Explorer 4.0, although there was a basic dynamic system with Netscape Navigator 4.0.

Read more...

  © Blogger templates Palm by Ourblogtemplates.com 2008

Back to TOP