1: /*
2: * tag.java 0.1 96/08/01
3: *
4: * Copyright (c) 1996 MARUYAMA Fujio All Rights Reserved.
5: *
6: * Permission to use, copy, modify, and distribute this software
7: * and its documentation for NON-COMMERCIAL purposes and without
8: * fee is hereby granted provided that this copyright notice
9: * appears in all copies.
10: *
11: * Mail : maruyama@wakhok.ac.jp
12: *
13: */
14:
15: class tag {
16: public static void main(String argv[]){
17: String str = "<TITLE>Welcome to Wakkanai!</TITLE>n";
18: str += "<H1><IMG SRC="/hokusei.gif"> <p>n";
19: str += "Wakkanai Hokusei Gakuen Junior College</H1>n";
20: str += "<HR>n";
21: str += "<IMG SRC="/images/greentile.gif">n";
22: str += "<A href="/biblion.html">n";
23: str += " Lecture Texts "Wakkanai Hokusei Biblion"</A>";
24: str += "(in Japanese) <p>";
25:
26: while( str.length() > 0 ){
27: int start = str.indexOf('<');
28: int end = str.indexOf('>');
29: if ( start == -1 || end == -1 ) break ;
30: String tag = str.substring(start, end+1);
31: System.out.println(tag);
32: str = str.substring(end+1);
33: }
34: }
35: }
1: /*
2: * text.java 0.1 96/08/01
3: *
4: * Copyright (c) 1996 MARUYAMA Fujio All Rights Reserved.
5: *
6: * Permission to use, copy, modify, and distribute this software
7: * and its documentation for NON-COMMERCIAL purposes and without
8: * fee is hereby granted provided that this copyright notice
9: * appears in all copies.
10: *
11: * Mail : maruyama@wakhok.ac.jp
12: *
13: */
14:
15: class text {
16: public static void main(String argv[]){
17: String str = "<TITLE>Welcome to Wakkanai!</TITLE>n";
18: str += "<H1><IMG SRC="/hokusei.gif"><p>n";
19: str += "Wakkanai Hokusei Gakuen Junior College</H1>n";
20: str += "<HR>n";
21: str += "<IMG SRC="/images/greentile.gif">n";
22: str += "<A href="/biblion.html">n";
23: str += "Lecture Texts "Wakkanai Hokusei Biblion"</A>";
24: str += "(in Japanese)<p>";
25:
26: int end = 0;
27: while( str.length() > 0 ){
28: int start = str.indexOf('<');
29: if ( start == -1 ) break ;
30: String text = str.substring(end, start);
31: text = text.trim();
32: if ( text.length() != 0 ) {
33: System.out.println(text);
34: }
35: end = str.indexOf('>');
36: if ( end == -1 ) break ;
37: String tag = str.substring(start, end+1);
38: System.out.println(tag);
39: str = str.substring(end+1);
40: end=0;
41: }
42: }
43: }
1: /*
2: * anchor.java 0.1 96/08/01
3: *
4: * Copyright (c) 1996 MARUYAMA Fujio All Rights Reserved.
5: *
6: * Permission to use, copy, modify, and distribute this software
7: * and its documentation for NON-COMMERCIAL purposes and without
8: * fee is hereby granted provided that this copyright notice
9: * appears in all copies.
10: *
11: * Mail : maruyama@wakhok.ac.jp
12: *
13: */
14:
15: class anchor {
16: public static void main(String argv[]){
17: String str = "<TITLE>Welcome to Wakkanai!</TITLE>n";
18: str += "<H1><IMG SRC="/hokusei.gif"><p>n";
19: str += "Wakkanai Hokusei Gakuen Junior College</H1>n";
20: str += "<HR>n";
21: str += "<A href="/biblion.html">n";
22: str += "<IMG SRC="/images/greentile.gif">n";
23: str += "Lecture Texts "Wakkanai Hokusei Biblion"</A>";
24: str += "(in Japanese)<p>";
25:
26: boolean append = false ;
27: String buff = "";
28: int end = 0;
29: while( str.length() > 0 ){
30: int start = str.indexOf('<');
31: if ( start == -1 ) break ;
32: String text = str.substring(end, start);
33: text = text.trim();
34: if ( text.length() != 0 ) {
35: if ( append ) buff += text ;
36: }
37: end = str.indexOf('>');
38: if ( end == -1 ) break ;
39: String tag = str.substring(start, end+1);
40: if ( tag.startsWith("<A ") || tag.startsWith("<a ")){
41: append = true ;
42: } else if ( tag.equalsIgnoreCase("</A>") ){
43: append = false ;
44: System.out.println(buff);
45: buff = "" ;
46: } else {
47: if ( append ) buff += tag ;
48: }
49: str = str.substring(end+1);
50: end=0;
51: }
52: }
53: }