1 16 package org.apache.axis.types; 17 18 19 import org.apache.axis.utils.Messages; 20 import org.apache.axis.utils.XMLChar; 21 22 31 public class Name extends Token { 32 33 public Name() { 34 super(); 35 } 36 37 41 public Name(String stValue) throws IllegalArgumentException { 42 try { 43 setValue(stValue); 44 } 45 catch (IllegalArgumentException e) { 46 throw new IllegalArgumentException ( 48 Messages.getMessage("badNameType00") + "data=[" + 49 stValue + "]"); 50 } 51 } 52 53 59 public void setValue(String stValue) throws IllegalArgumentException { 60 if (Name.isValid(stValue) == false) 61 throw new IllegalArgumentException ( 62 Messages.getMessage("badNameType00") + 63 " data=[" + stValue + "]"); 64 m_value = stValue; 65 } 66 67 73 public static boolean isValid(String stValue) { 74 int scan; 75 boolean bValid = true; 76 77 for (scan=0; scan < stValue.length(); scan++) { 78 if (scan == 0) 79 bValid = XMLChar.isNameStart(stValue.charAt(scan)); 80 else 81 bValid = XMLChar.isName(stValue.charAt(scan)); 82 if (bValid == false) 83 break; 84 } 85 86 return bValid; 87 } 88 } 89 | Popular Tags |