142 }
143 }
144
145 private static DTMAxisIterator document(String uri, String base,
146 AbstractTranslet translet, DOM dom)
147 throws Exception
148 {
149 return document(uri, base, translet, dom, false);
150 }
151
152 private static DTMAxisIterator document(String uri, String base,
153 AbstractTranslet translet, DOM dom,
154 boolean cacheDOM)
155 throws Exception
156 {
157 try {
158 final String originalUri = uri;
159 MultiDOM multiplexer = (MultiDOM)dom;
160
161 // Prepend URI base to URI (from context)
162 if (base != null && !base.equals("")) {
163 uri = SystemIDResolver.getAbsoluteURI(uri, base);
164 }
165
166 // Return an empty iterator if the URI is clearly invalid
167 // (to prevent some unncessary MalformedURL exceptions).
168 if (uri == null || uri.equals("")) {
169 return(EmptyIterator.getInstance());
170 }
171
172 // Check if this DOM has already been added to the multiplexer
173 int mask = multiplexer.getDocumentMask(uri);
174 if (mask != -1) {
175 DOM newDom = ((DOMAdapter)multiplexer.getDOMAdapter(uri))
176 .getDOMImpl();
177 if (newDom instanceof DOMEnhancedForDTM) {
178 return new SingletonIterator(((DOMEnhancedForDTM)newDom)
179 .getDocument(),
180 true);
181 }
182 }
183
184 // Check if we can get the DOM from a DOMCache
185 DOMCache cache = translet.getDOMCache();
186 DOM newdom;
187
188 mask = multiplexer.nextMask(); // peek
|
142 }
143 }
144
145 private static DTMAxisIterator document(String uri, String base,
146 AbstractTranslet translet, DOM dom)
147 throws Exception
148 {
149 return document(uri, base, translet, dom, false);
150 }
151
152 private static DTMAxisIterator document(String uri, String base,
153 AbstractTranslet translet, DOM dom,
154 boolean cacheDOM)
155 throws Exception
156 {
157 try {
158 final String originalUri = uri;
159 MultiDOM multiplexer = (MultiDOM)dom;
160
161 // Prepend URI base to URI (from context)
162 if (base != null && !base.isEmpty()) {
163 uri = SystemIDResolver.getAbsoluteURI(uri, base);
164 }
165
166 // Return an empty iterator if the URI is clearly invalid
167 // (to prevent some unncessary MalformedURL exceptions).
168 if (uri == null || uri.isEmpty()) {
169 return(EmptyIterator.getInstance());
170 }
171
172 // Check if this DOM has already been added to the multiplexer
173 int mask = multiplexer.getDocumentMask(uri);
174 if (mask != -1) {
175 DOM newDom = ((DOMAdapter)multiplexer.getDOMAdapter(uri))
176 .getDOMImpl();
177 if (newDom instanceof DOMEnhancedForDTM) {
178 return new SingletonIterator(((DOMEnhancedForDTM)newDom)
179 .getDocument(),
180 true);
181 }
182 }
183
184 // Check if we can get the DOM from a DOMCache
185 DOMCache cache = translet.getDOMCache();
186 DOM newdom;
187
188 mask = multiplexer.nextMask(); // peek
|