Wednesday, December 12, 2007

Selecting Nodes in XPath

Selecting Nodes
XPath uses path expressions to select nodes in an XML document. The node is selected by following a path or steps. The most useful path expressions are listed below:

nodename --> Selects all child nodes of the named node
/ --> Selects from the root node
// --> Selects nodes in the document from the current node that match the selection no matter where they are
. --> Selects the current node
.. --> Selects the parent of the current node
@ --> Selects attributes

Types of nodes in XPath

In XPath, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes.

XSLT

A good link for XSLT with good examples

http://www.zvon.org/xxl/XSLTutorial/Output/example1_ch1.html

Refer w3schools at http://w3schools.com/xsl/ for theroy

Wednesday, April 04, 2007

Reflection

Heard about reflection and want to know more about it.

Here you go...

http://java.sun.com/developer/technicalArticles/ALT/Reflection/

(Use the below post for knowing what Class.forName("")) does)

Tips:
newInstance() method is used to create a new object for the class.
getDeclaredMethods() is used to retrieve a list of Method objects, one for each method defined in the class. These include public, protected, package, and private methods.
getMethods() is used to obtain information for all public methods, even the inherited methods.
Both the getDeclaredMethods() and getMethods() returns a Method[].
A method can be invoked by calling the following metod passing the arguments as Object[]
invoke(new ClassName(), Object[]).

What is an interface???!!!???

Apt Definition:
An interface defines a protocol of behavior that can be implemented by any class anywhere in the class hierarchy. An interface defines a set of methods but does not implement them. A class that implements the interface agrees to implement all the methods defined in the interface, thereby agreeing to certain behavior.

Example:
java.util.List,
java.util.Collection

Friday, March 30, 2007

Have you ever wondered why String is immutable and StringBuffer has syn methods

If you want to understand what thread safety is?

And the ways to acheive this?

Visit

http://www.javaworld.com/jw-08-1998/jw-08-techniques.html

Servlet Hit Count!

How many of times would we see the line in a website stating

"You are the 120001 user visiting this page."


How do we ever acheive this???


Here you go..

http://www.unix.org.ua/orelly/java-ent/servlet/ch03_01.htm

Inheritance Mystery

1) Consider two methods overloaded as below

public String concatenate(String s)

public String concatenate(Object a)


and a call is made as concetenate(null), which method would be called?

----------------------------------------------

2) Consider two methods overloaded as below, where both Dog and Goat are extended from Object class.

public String concatenate(Dog s)
public String concatenate(Goat a)


and a call is made as concetenate(null), which method would be called?

Thursday, March 29, 2007

How does JVM store classes

How are classes stored in the JVM?

class.forName() in JDBC connection

Are you puzzled what does Class.forName do in JDBC connection?

how is it different from import?

visit

http://xyzws.com/faq.do?cat=faq&article=17

Exception in finalize() method

All,
Tell me what would happen if an exception is thrown in a finalize() method. Would the object be garbage collected or not?

Post your reply

Java Design Techniques

We would have spent lots of time designing our classes and methods. But have we ever spent some time to think of certain good design techniques.

Came across a good article. Here you go!

http://www.artima.com/designtechniques/index.html

Hello World

Java In Depth Welcomes You.

This would be a one place where you could find good links related to Java.

Await great stuff here.