Thursday, October 25, 2007

XML Interview Question Part4


50. How to transform an XML document to an HTML document?

To perform the transformation, you need to obtain an XSLT transformer and use it to apply the style sheet to the XML data. The following code fragment obtains a transformer by instantiating a TransformerFactory object, reading in the style sheet and XML files, creating a file for the HTML output, and then finally obtaining the Transformer object transformer from the TransformerFactory object tFactory.

TransformerFactory tFactory = TransformerFactory.newInstance();



String stylesheet = "xxx.xsl";

String sourceId = "newXML.xml";



File yyyHTML = new File("yyyHTML.html");

FileOutputStream os = new FileOutputStream(yyyHTML);



Transformer transformer = tFactory.newTransformer(new StreamSource(stylesheet));

transformer.transform(new StreamSource(sourceId), new StreamResult(os));

51. What are major subcomponents of XSL?

The XML Stylesheet Language (XSL) has three major subcomponents:

1. XSL-FO -- The largest subcomponent. It describes font sizes, page layouts, and how information "flows" from one page to another.

2. XSLT -- A transformation language that lets you define a transformation from XML into some other format. Like producing HTML, a different XML structure, a plain text or other document format.

3. XPath -- A specification that lets you specify a path to an element.

52. What is transformation language in XSL?

Extensible Styles Language(XSL) has two parts:

a transformation language(XSLT) and a formatting language.

The transformation language lets you transform documents into different forms, while the formatting language actually formats and styles documents in various ways.

53. What is JAX-RPC?

JAX-RPC stands for Java API for XML-based RPC(Remote Procedure Call). It is an API for building Web services and clients that use RPC and XML.

In JAX-RPC, a remote procedure call is represented by an XML-based protocol such as SOAP. The SOAP specification defines the envelope structure, encoding rules, and convention for representing remote procedure calls and responses. These calls and responses are transmitted as SOAP messages (XML files) over HTTP.

With JAX-RPC, the developer does not generate or parse SOAP messages. It is the JAX-RPC runtime system that converts the API calls and responses to and from SOAP messages.

54. What is value type?

A value type is a class whose state may be passed between a client and remote service as a method parameter or return value. For example, an account class may have account number, account owner and amount field. These information may be passed between client and server as a method deposit parameter and a return value of method account query.

55. What kind of rules do the value type must follow?

To be supported by JAX-RPC, a value type must conform to the following rules:

o It must have a public default constructor.

o It must not implement (either directly or indirectly) the java.rmi.Remote interface.

o Its fields must be supported JAX-RPC types.

o The value type may contain public, private, or protected fields. The field of a value type must meet these requirements:

 A public field cannot be final or transient.

 A non-public field must have corresponding getter and setter methods.

Return to top

________________________________________

56. What is SAAJ?

SAAJ stands for SOAP(Simple Object Access Protocal) with Attachments API for Java. SAAJ is used mainly for the SOAP messaging that goes on behind the scenes in JAX-RPC and JAXR implementations.

Secondarily, it is an API that developers can use when they choose to write SOAP messaging applications directly rather than using JAX-RPC.

57. What is XML Registry?

An XML registry is an infrastructure that enables the building, deployment, and discovery of Web services. It is a neutral third party that facilitates dynamic and loosely coupled business-to-business (B2B) interactions. A registry is available to organizations as a shared resource, often in the form of a Web-based service.

There are many kinds of specifications for XML registries, including ebXML Registry and Repository and The Universal Description, Discovery, and Integration (UDDI).

58. What is JAXR?

JAXR stands for Java API for XML Registries. It enables Java software programmers to use an API to access a variety of XML registries. The current version of the JAXR specification can be found at http://java.sun.com/xml/downloads/jaxr.html

59. What is XHTML?

XHTML is an application of XML that tries to make XML documents look and act like HTML documents. The XHTML specification is a reformulation of HTML 4.0 into XML. The following is code of XHTML.

1.

2.
3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

4.

5. Welcome to see xhtml

6.

7.

Welcome to XHTML!



8.

9.

The following is the display on your browser.

________________________________________

0 comments:

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com