import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
public class BasicDom {
public static void main(String[] args) {
Document doc = parseXmlFile(”infilename.xml”, false);
}
// Parses an XML file and returns a DOM document.
// If validating is true, the contents is validated against the DTD
// specified in the file.
public static Document parseXmlFile(String filename, boolean validating) {
try {
// Create […]
Entries Tagged as 'Source Code'
Building DOM tree by reading an xml file in Java
December 19th, 2007 · No Comments · Java, Source Code
Tags:
Bubble Sort
April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code
The source code for bubble sort.
#include
#define NUM 6
void swap(int arr[], int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
main() {
int arr[NUM],i,j;
// start reading nums
for(i=0;i
Tags:
Shell Sort
April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code
Source code for shell sort is provided below.
#include
#define NUM 6
main() {
int arr[NUM],i,j, incr=2;
// start reading nums
for(i=0;i
Tags:
Insertion Sort
April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code
Source code for Insertion sort in C language.
#include
#define NUM 6
main() {
int arr[NUM],i,j;
// start reading nums
for(i=0;i
Tags:
Selection Sort
April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code
The code for the selection sort in C lang is provided below.
#include
#define NUM 6
void swap(int arr[], int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
main() {
int arr[NUM],i,j;
// start reading nums
for(i=0;i arr[j])
swap(arr,i,j);
// print sorted arr
for(i=0;i
Please point your web link to this page if you are using this code for any purposes.
Bookmark it!
These icons […]
Tags:
File upload code in Jsp : using apache’s commons-upload.jar
April 13th, 2007 · 4 Comments · Jsp/servlets, Source Code
Please follow the below steps before coding the upload script in jsp.
1. Download the commons-upload.jar from Apache’s website.
2. Put that jar file into the classpath, i.e in WEB-INF/lib/ directory.
3. Then create a jsp file with the following code and any static HTML page for initial page.
The code here goes:
<%@ page import=”org.apache.commons.fileupload.*,
org.apache.commons.fileupload.servlet.ServletFileUpload,
org.apache.commons.fileupload.disk.DiskFileItemFactory,
org.apache.commons.io.FilenameUtils,
java.util.*,
java.io.File,
java.lang.Exception,
java.io.*,
java.net.*,
org.apache.poi.hssf.usermodel.*” %>
<h1>Data Received at the […]
Tags:















