/** * calls getInstance(URI,Level) with Level.WARNING * * @param desiredDocument * @param hints May be null. * @return Object * @throws SAXException * @see DocumentFactory#getInstance(URI, Map, Level) */ public static Object getInstance(URI desiredDocument, Map<String, Object> hints) throws SAXException { return getInstance(desiredDocument, hints, Level.WARNING); }
/** * Parses the instance data provided. This method assumes that the XML document is fully * described using XML Schemas. Failure to be fully described as Schemas will result in errors, * as opposed to a vid parse. * * @param is * @param hints May be null. * @param level * @return Object * @throws SAXException * @see DocumentFactory#getInstance(InputStream, Map, Level, boolean) */ public static Object getInstance(InputStream is, Map<String, Object> hints, Level level) throws SAXException { SAXParser parser = getParser(hints); XMLSAXHandler xmlContentHandler = new XMLSAXHandler(hints); XMLSAXHandler.setLogLevel(level); try { parser.parse(is, xmlContentHandler); } catch (IOException e) { XMLSAXHandler.logger.warning(e.toString()); throw new SAXException(e); } return xmlContentHandler.getDocument(); }
public DescribeLayerResponse(HTTPResponse httpResponse, Map<String, Object> hints) throws IOException, ServiceException { super(httpResponse); try { hints = hints == null ? new HashMap<>() : new HashMap<>(hints); hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WMSSchema.getInstance()); Object object; InputStream inputStream = null; try { inputStream = getInputStream(); object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING); } catch (SAXException e) { throw (IOException) new IOException().initCause(e); } finally { IOUtils.closeQuietly(inputStream); } layerDescs = (LayerDescription[]) object; } finally { dispose(); } }
/** * Parses the instance data provided. This method assumes that the XML document is fully * described using XML Schemas. Failure to be fully described as Schemas will result in errors, * as opposed to a vid parse. * * @param desiredDocument * @param hints May be null. * @param level * @return Object * @throws SAXException * @see DocumentFactory#getInstance(URI, Map, Level, boolean) */ public static Object getInstance( URI desiredDocument, @SuppressWarnings("rawtypes") Map hints, Level level) throws SAXException { @SuppressWarnings("unchecked") SAXParser parser = getParser(hints); XMLSAXHandler xmlContentHandler = new XMLSAXHandler(desiredDocument, hints); XMLSAXHandler.setLogLevel(level); try { parser.parse(desiredDocument.toString(), xmlContentHandler); } catch (IOException e) { throw new SAXException(e); } return xmlContentHandler.getDocument(); }
try { inputStream = response.getResponseStream(); object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING); } catch (SAXException e) { throw (ServiceException)
/** @see java.lang.Runnable#run() */ public void run() { XMLHandlerHints hints = new XMLHandlerHints(); initHints(hints); try { DocumentFactory.getInstance(document, hints); // start parsing until buffer part full, then yield(); } catch (StopException e) { exception = e; state = STOP; yield(); } catch (SAXException e) { exception = e; state = STOP; yield(); } }
/** * @param contentType * @param inputStream * @throws ServiceException * @throws SAXException */ public DescribeLayerResponse( String contentType, InputStream inputStream ) throws IOException, ServiceException { super(contentType, inputStream); try { Map hints = new HashMap(); hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WMSSchema.getInstance()); Object object; try { object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING); } catch (SAXException e) { throw (IOException) new IOException().initCause(e); } layerDescs = (LayerDescription[]) object; } finally { inputStream.close(); } }
protected WFSCapabilities parseCapabilities(InputStream capabilitiesReader) throws IOException { // TODO: move to some 1.0.0 specific class Map<String,Object> hints = new HashMap<String,Object>(); hints.put(DocumentFactory.VALIDATION_HINT, Boolean.FALSE); Object parsed; try { parsed = DocumentFactory.getInstance(capabilitiesReader, hints, LOGGER.getLevel()); } catch (SAXException e) { throw new DataSourceException("Error parsing WFS 1.0.0 capabilities", e); } if (parsed instanceof WFSCapabilities) { return (WFSCapabilities) parsed; } else { throw new DataSourceException( "The specified URL Should have returned a 'WFSCapabilities' object. Returned a " + ((parsed == null) ? "null value." : (parsed.getClass().getName() + " instance."))); } }
public WMSGetCapabilitiesResponse(String contentType, InputStream inputStream) throws ServiceException, IOException { super(contentType, inputStream); try { Map hints = new HashMap(); hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WMSSchema.getInstance()); hints.put(DocumentFactory.VALIDATION_HINT, Boolean.FALSE); Object object; try { object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING); } catch (SAXException e) { throw (ServiceException) new ServiceException("Error while parsing XML.").initCause(e); } if (object instanceof ServiceException) { throw (ServiceException) object; } this.capabilities = (Capabilities)object; } finally { inputStream.close(); } }
public DescribeLayerResponse(HTTPResponse httpResponse, Map<String, Object> hints) throws IOException, ServiceException { super(httpResponse); try { hints = hints == null ? new HashMap<>() : new HashMap<>(hints); hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WMSSchema.getInstance()); Object object; InputStream inputStream = null; try { inputStream = getInputStream(); object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING); } catch (SAXException e) { throw (IOException) new IOException().initCause(e); } finally { IOUtils.closeQuietly(inputStream); } layerDescs = (LayerDescription[]) object; } finally { dispose(); } }
try { inputStream = response.getResponseStream(); object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING); } catch (SAXException e) { throw (ServiceException)
DocumentFactory.getInstance(is, hints, logger.getLevel()); is.close();
TransactionResult ft = (TransactionResult) DocumentFactory.getInstance(is, hints, Level.WARNING); return ft;