/** * Gets a new Document read from the indicated uri * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri) throws ParserConfigurationException, SAXException, IOException { // call the authenticated version as there might be // username/password info embeded in the uri. return XMLUtils.newDocument(uri, null, null); }
/** * Gets a new Document read from the indicated uri * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri) throws ParserConfigurationException, SAXException, IOException { // call the authenticated version as there might be // username/password info embeded in the uri. return XMLUtils.newDocument(uri, null, null); }
/** * Gets a new Document read from the input stream * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(InputStream inp) throws ParserConfigurationException, SAXException, IOException { return XMLUtils.newDocument(new InputSource(inp)); }
/** * Gets a new Document read from the input stream * * @return Returns Document. * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(InputStream inp) throws ParserConfigurationException, SAXException, IOException { return XMLUtils.newDocument(new InputSource(inp)); }
/** * Creates a new document from the given URI. Uses the username and password * if the URI requires authentication. * * @param uri the resource to get * @param username basic auth username * @param password basic auth password * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri, String username, String password) throws ParserConfigurationException, SAXException, IOException { InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password); Document doc = XMLUtils.newDocument(ins); // Close the Stream if (ins.getByteStream() != null) { ins.getByteStream().close(); } else if (ins.getCharacterStream() != null) { ins.getCharacterStream().close(); } return doc; }
/** * Creates a new document from the given URI. Uses the username and password * if the URI requires authentication. * * @param uri the resource to get * @param username basic auth username * @param password basic auth password * @throws ParserConfigurationException if construction problems occur * @throws SAXException if the document has xml sax problems * @throws IOException if i/o exceptions occur */ public static Document newDocument(String uri, String username, String password) throws ParserConfigurationException, SAXException, IOException { InputSource ins = XMLUtils.getInputSourceFromURI(uri, username, password); Document doc = XMLUtils.newDocument(ins); // Close the Stream if (ins.getByteStream() != null) { ins.getByteStream().close(); } else if (ins.getCharacterStream() != null) { ins.getCharacterStream().close(); } return doc; }
private static void registerNamespace(SchemaCompiler sc, String namespace, String pkgName) throws Exception { Document doc = XMLUtils.newDocument(); Element rootElement = doc.createElement("schema"); rootElement.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema");
private static void registerNamespace(SchemaCompiler sc, String namespace, String pkgName) throws Exception { Document doc = XMLUtils.newDocument(); Element rootElement = doc.createElement("schema"); rootElement.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema"); rootElement.setAttribute("xmlns:jaxb", "http://java.sun.com/xml/ns/jaxb"); rootElement.setAttribute("jaxb:version", "2.0"); rootElement.setAttribute("targetNamespace", namespace); Element annoElement = doc.createElement("annotation"); Element appInfo = doc.createElement("appinfo"); Element schemaBindings = doc.createElement("jaxb:schemaBindings"); Element pkgElement = doc.createElement("jaxb:package"); pkgElement.setAttribute("name", pkgName); annoElement.appendChild(appInfo); appInfo.appendChild(schemaBindings); schemaBindings.appendChild(pkgElement); rootElement.appendChild(annoElement); MemoryBlob blob = Blobs.createMemoryBlob(); OutputStream stream = blob.getOutputStream(); Result result = new StreamResult(stream); Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.transform(new DOMSource(rootElement), result); stream.close(); InputSource ins = new InputSource(blob.getInputStream()); ins.setSystemId("urn:" + UUID.randomUUID()); sc.parseSchema(ins); }
public HandlerChainsType loadHandlerChains(InputStream in) throws Exception { Document document = XMLUtils.newDocument(in); Element el = document.getDocumentElement(); if (!JAVA_EE_NS.equals(el.getNamespaceURI()) || !"handler-chains".equals(el.getLocalName())) { throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAINS + " element"); } HandlerChainsType handlerChains = new HandlerChainsType(); Node node = el.getFirstChild(); while (node != null) { if (node instanceof Element) { el = (Element)node; if (!JAVA_EE_NS.equals(el.getNamespaceURI()) || !el.getLocalName().equals("handler-chain")) { throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAIN + " element"); } handlerChains.getHandlerChain().add(processHandlerChainElement(el)); } node = node.getNextSibling(); } return handlerChains; }
public HandlerChainsType loadHandlerChains(InputStream in) throws Exception { Document document = XMLUtils.newDocument(in); Element el = document.getDocumentElement(); if (!JAVA_EE_NS.equals(el.getNamespaceURI()) || !"handler-chains".equals(el.getLocalName())) { throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAINS + " element"); } HandlerChainsType handlerChains = new HandlerChainsType(); Node node = el.getFirstChild(); while (node != null) { if (node instanceof Element) { el = (Element)node; if (!JAVA_EE_NS.equals(el.getNamespaceURI()) || !el.getLocalName().equals("handler-chain")) { throw new WebServiceException("Unexpected element {" + el.getNamespaceURI() + "}" + el.getLocalName() + ". Expected " + QNAME_HANDLER_CHAIN + " element"); } handlerChains.getHandlerChain().add(processHandlerChainElement(el)); } node = node.getNextSibling(); } return handlerChains; }
try { InputStream in = wsdlURL.openConnection().getInputStream(); Document doc = XMLUtils.newDocument(in); String namespaceURI = doc.getDocumentElement().getNamespaceURI(); if (Constants.NS_URI_WSDL11.equals(namespaceURI)) {
try { InputStream in = wsdlURL.openConnection().getInputStream(); Document doc = XMLUtils.newDocument(in); String namespaceURI = doc.getDocumentElement().getNamespaceURI(); if (Constants.NS_URI_WSDL11.equals(namespaceURI)) {
Document doc = null; try { doc = XMLUtils.newDocument(inputSource); } catch (ParserConfigurationException e) { handleException("Parser Configuration Error", e);
Document doc = null; try { doc = XMLUtils.newDocument(inputSource); } catch (ParserConfigurationException e) { handleException("Parser Configuration Error", e);
Document doc; try { doc = XMLUtils.newDocument(in); } catch (ParserConfigurationException e) { throw new WSDLException(WSDLException.PARSER_ERROR,
Document doc; try { doc = XMLUtils.newDocument(in); } catch (ParserConfigurationException e) { throw new WSDLException(WSDLException.PARSER_ERROR,