1 55 package org.jboss.axis.types; 56 57 import org.jboss.axis.utils.Messages; 58 59 67 public class Token extends NormalizedString 68 { 69 70 public Token() 71 { 72 super(); 73 } 74 75 80 public Token(String stValue) throws IllegalArgumentException 81 { 82 try 83 { 84 setValue(stValue); 85 } 86 catch (IllegalArgumentException e) 87 { 88 throw new IllegalArgumentException (Messages.getMessage("badToken00") + "data=[" + 90 stValue + "]"); 91 } 92 } 93 94 106 public boolean isValid(String stValue) 107 { 108 int scan; 109 if ((stValue == null) || (stValue.length() == 0)) 111 return true; 112 113 if (stValue.charAt(0) == 0x20) 115 return false; 116 117 if (stValue.charAt(stValue.length() - 1) == 0x20) 119 return false; 120 121 for (scan = 0; scan < stValue.length(); scan++) 122 { 123 char cDigit = stValue.charAt(scan); 124 switch (cDigit) 125 { 126 case 0x09: 127 case 0x0A: 128 return false; 129 case 0x20: 130 if (scan + 1 < stValue.length()) 132 if (stValue.charAt(scan + 1) == 0x20) 133 { 134 return false; 135 } 136 default: 137 break; 138 } 139 } 140 return true; 141 } 142 } 143 | Popular Tags |