1 29 30 package com.caucho.xml2; 31 32 import com.caucho.util.L10N; 33 import com.caucho.vfs.ReadStream; 34 import com.caucho.vfs.TempCharBuffer; 35 import com.caucho.vfs.Vfs; 36 import com.caucho.xml.ExtendedLocator; 37 import com.caucho.xml.QName; 38 import com.caucho.xml.XmlChar; 39 40 import org.xml.sax.*; 41 42 import java.io.IOException ; 43 import java.io.InputStream ; 44 import java.io.Reader ; 45 import java.util.HashMap ; 46 47 public final class InternQName { 48 final InternQName _next; 49 50 final char []_buf; 51 final int _colon; 52 53 String _name; 54 String _prefix; 55 String _localName; 56 57 InternQName(InternQName next, 58 char []buf, int offset, int length, 59 int colon) 60 { 61 _next = next; 62 63 _buf = new char[length]; 64 System.arraycopy(buf, offset, _buf, 0, length); 65 66 _colon = colon - offset; 67 } 68 69 public final boolean match(char []buf, int offset, int length) 70 { 71 if (length != _buf.length) 72 return false; 73 74 char []entryBuf = _buf; 75 76 for (length--; length >= 0; length--) { 77 if (entryBuf[length] != buf[offset + length]) 78 return false; 79 } 80 81 return true; 82 } 83 84 public final String getName() 85 { 86 if (_name == null) 87 _name = new String (_buf, 0, _buf.length); 88 89 return _name; 90 } 91 92 public final String getNamespaceURI() 93 { 94 return ""; 95 } 96 97 public final String getLocalName() 98 { 99 if (_localName == null) { 100 if (_colon == 0) 101 _localName = _name; 102 else 103 _localName = new String (_buf, _colon + 1, _buf.length - _colon - 1); 104 } 105 106 return _localName; 107 } 108 } 109 | Popular Tags |