1 28 29 package com.caucho.xml.stream; 30 31 import java.io.IOException ; 32 import com.caucho.vfs.WriteStream; 33 34 37 final class NamespaceBinding 38 { 39 private String _prefix; 40 41 private String _uri; 42 43 private int _version; 44 45 private boolean _emit = false; 48 49 NamespaceBinding(String prefix, String uri, int version) 50 { 51 _prefix = prefix; 52 _uri = uri; 53 _version = version; 54 } 55 56 String getUri() 57 { 58 return _uri; 59 } 60 61 void setUri(String uri) 62 { 63 _uri = uri; 64 } 65 66 void setVersion(int version) 67 { 68 _version = version; 69 } 70 71 int getVersion() 72 { 73 return _version; 74 } 75 76 String getPrefix() 77 { 78 return _prefix; 79 } 80 81 void setPrefix(String prefix) 82 { 83 _prefix = prefix; 84 } 85 86 void emit(WriteStream ws) 87 throws IOException 88 { 89 if (_emit) { 90 if (_prefix == null) 91 ws.print(" xmlns"); 92 else { 93 ws.print(" xmlns:"); 94 ws.print(Escapifier.escape(_prefix)); 95 } 96 97 ws.print("=\""); 98 ws.print(Escapifier.escape(_uri)); 99 ws.print('"'); 100 101 _emit = false; 102 } 103 } 104 105 void setEmit(boolean emit) 106 { 107 _emit = emit; 108 } 109 110 public String toString() 111 { 112 return "NamespaceBinding[prefix=" + _prefix + 113 ",uri=" + _uri + 114 ",version=" + _version + "]"; 115 } 116 } 117 | Popular Tags |