01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/publishing/markups/TKMarkupIdentifierParamClass.java,v 1.5 2000/05/22 15:01:28 careck Exp $
03: *
04: */
05: package com.teamkonzept.publishing.markups;
06:
07: public class TKMarkupIdentifierParamClass extends TKMarkupParamClass {
08:
09: private static final String identifierFirstCodes = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
10: private static final String identifierCodes = identifierFirstCodes
11: + "0123456789";
12:
13: public String checkValue(String raw) {
14:
15: if (raw == null)
16: return raw;
17:
18: String value = raw.trim();
19:
20: int pos = 0;
21: while (pos < value.length()) {
22:
23: char chr = value.charAt(pos++);
24:
25: if (pos == 1) {
26: if (identifierFirstCodes.indexOf(chr) == -1)
27: return null;
28: } else if (identifierCodes.indexOf(chr) == -1)
29: return null;
30: }
31:
32: return value;
33: }
34:
35: public int parseUnquotedValue(String text, int pos,
36: StringBuffer value) throws TKMarkupParserException {
37:
38: if (value != null)
39: value.setLength(0);
40:
41: while (pos < text.length()) {
42:
43: char chr = text.charAt(pos);
44:
45: if ((pos == 0) && (identifierFirstCodes.indexOf(chr) == -1))
46: break;
47: else if ((pos != 0) && (identifierCodes.indexOf(chr) == -1))
48: break;
49:
50: if (value != null)
51: value.append(chr);
52:
53: pos++;
54: }
55:
56: return pos;
57: }
58:
59: public String wrapValue(String value) {
60:
61: return value;
62: }
63: }
|