1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using XML in Java

Discussion in 'Win32' started by Roman2, Dec 27, 2010.

  1. Roman2

    Roman2 New Member

    Joined:
    Nov 18, 2010
    Messages:
    8
    Likes Received:
    1
    Trophy Points:
    0
    Please tell me how it realized.
     
  2. charlesth

    charlesth New Member

    Joined:
    Aug 6, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    In Java JDK there are two built-in XML parsers. In Java, it's still simpler than that due to Java's tough Unicode support. You don't want to know any particular APIs like DOM or SAX or JDOM. All you have to be recognizable with how to System.out. println(). If you want to pile up your XML document in a file, you can use the FileOutputStream class instead.

    Here I am showing the A program that calculates the Fibonacci numbers using the XML with Java.
    Code:
    import java.math.BigInteger;
    
    public class FibonacciNumbers {
    
      public static void main(String[] args) {
      
        BigInteger low  = BigInteger.ONE;
        BigInteger high = BigInteger.ONE;
        for (int i = 1; i <= 10; i++) {
          System.out.println(low);
          BigInteger temp = high;
          high = high.add(low);
          low = temp;
        }
        
      }
    
    }
    
    I realized that XML with Java is not complicated but it is useful for developing such kind of Program.
     

Share This Page