Java 8 QName - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 QName class.

This code example shows how to use the following methods:
                "</server>"; 
        final XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
        final StandaloneXml parser = new StandaloneXml(null, null, null);
        final List<ModelNode> operationList = new ArrayList<ModelNode>();
        final XMLMapper mapper = XMLMapper.Factory.create();
        mapper.registerRootElement(new QName(namespace, "server"), parser);
        mapper.parseDocument(operationList, reader);
        final ModelNode content = operationList.get(1).get("content");
        assertArrayEquals(new byte[] { 0x12, 0x34 }, content.get(0).get("hash").asBytes());
    } 
 
    @Test 
    public void testFSArchive() throws Exception { 
        final String xml = "<?xml version='1.0' encoding='UTF-8'?>" +
                "<server name=\"example\" xmlns=\"urn:jboss:domain:1.0\">" + 
                "    <deployments>" + 
                "        <deployment name=\"test.war\" runtime-name=\"test-run.war\">" + 
                "            <fs-archive path=\"${jboss.home}/content/welcome.jar\"/>" + 
                "        </deployment>" + 
                "    </deployments>" + 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLocalPart, getPrefix
 
    public void update(String uri, String localName, String qName) {
        QName qn = null;
        if (uri.equals("http://schemas.openxmlformats.org/spreadsheetml/2006/main")) {
        	// Avoid using the default namespace 
        	qn = new QName(uri,localName, "s");
        	qName = qn.getPrefix() + ":" + qn.getLocalPart();
        	if (!qn.getPrefix().equals("s")) { // only a problem with MOXy
            	log.debug("ignoring requested prefix!");        		 
        	} 
        } else { 
//        	log.debug("'" + uri +"'"); 
        	qn = new QName(uri,localName);
        } 
        Integer v = occurrence.get(qn);
        if(v==null) {
        	v=1;
        } else { 
        	v++;
        } 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getNamespaceURI
        String xpath;
 
        xpath = "/";
        assertEquals(1, XPathUtil.steps(descriptor, xpath, namespaces).size());
        XPathUtil.Step step = (XPathUtil.Step) XPathUtil.steps(descriptor, xpath, namespaces).get(0);
        QName rootQName = new QName(name.getNamespaceURI(), name.getLocalPart());
        assertEquals(rootQName, step.getName());
 
        expected = Collections.singletonList(new XPathUtil.Step(rootQName, 1));
        xpath = "wq_plus";
        assertEquals(expected, XPathUtil.steps(descriptor, xpath, namespaces));
 
        expected = Collections.singletonList(new XPathUtil.Step(rootQName, 1));
        xpath = "/wq_plus";
        assertEquals(expected, XPathUtil.steps(descriptor, xpath, namespaces));
 
        expected = Collections.singletonList(new XPathUtil.Step(rootQName, 1));
        xpath = "wq_plus/measurement/result/../../measurement/determinand_description/../..";
        assertEquals(expected, XPathUtil.steps(descriptor, xpath, namespaces));
 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLocalPart
		return this.name;
	} 
 
	@Override 
	public String getName() {
		return this.name.getLocalPart();
	} 
 
	@Override 
	public Serializable getValue() {
		return this.value;
	} 
 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return war;
    } 
 
    @Test 
    public void testEJB3Endpoint() throws Exception { 
        final QName serviceName = new QName("org.jboss.as.test.integration.ws.context.as1605", "EJB3EndpointService");
        final URL wsdlURL = new URL(baseUrl, "/as1605-customized/EJB3Endpoint?wsdl");
        final Service service = Service.create(wsdlURL, serviceName);
        final EndpointIface port = service.getPort(EndpointIface.class);
        final String result = port.echo("hello");
        Assert.assertEquals("EJB3 hello", result);
    } 
 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLocalPart, getNamespaceURI
    } 
 
    private void parseEntryMember(final XMLStreamReader reader, final QName memberName,
            final Entry entry) throws XMLStreamException {
 
        reader.require(START_ELEMENT, memberName.getNamespaceURI(), memberName.getLocalPart());
        if (ATOM.id.equals(memberName)) {
 
            String id = text(reader);
            entry.setId(id);
        } else if (ATOM.link.equals(memberName)) {
 
            String uri = text(reader);
            URI link;
            try { 
                link = new URI(uri);
                entry.setLink(link);
            } catch (URISyntaxException e) {
                logger.info("Feed contains illegal 'link' element content:" + uri);
            } 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getLocalPart
        return new PostDiffResponseType(); 
    } 
     
    @Override 
    public Object getProperty(Object object, QName name) throws Exception {
        if("success".equals(name.getLocalPart())) {
            return true; 
        } 
        return super.getProperty(object, name);
    } 
 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
        final URL wsdlLocation = new URL(deploymentUrl + "/" + NAME + "?wsdl"); 
 
        LOG.debug("wsdlLocation for service: " + wsdlLocation); 
 
        final QName serviceName = new QName(TARGET_NAMESPACE, SERVICE_NAME); 
        final QName portName = new QName(TARGET_NAMESPACE, PORT_NAME); 
 
        final Service service = Service.create(wsdlLocation, serviceName); 
        final CompensatableService compensatableService = service.getPort(portName, CompensatableService.class); 
 
        return compensatableService; 
    } 
 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return war;
    } 
 
    @Test 
    public void encryptedAndSignedRequest() throws Exception { 
        QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EncryptSecurityService");
        URL wsdlURL = new URL(baseUrl.toString() + "EncryptSecurityService?wsdl");
 
        Service service = Service.create(wsdlURL, serviceName);
        ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
        setupWsse(proxy);
 
        Assert.assertEquals("Secure Hello World!", proxy.sayHello());
    } 
 
    private void setupWsse(ServiceIface proxy) throws MalformedURLException {
        ((BindingProvider) proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,      new KeystorePasswordCallback());
        ((BindingProvider) proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,  "org/jboss/as/test/integration/ws/wsse/alice.properties");
        ((BindingProvider) proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,    "org/jboss/as/test/integration/ws/wsse/alice.properties");
        ((BindingProvider) proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME,    "alice");
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getPrefix
	 * prefix is set, or just {@code localName} if not. 
	 * @param qName the {@code QName} 
	 * @return the qualified name 
	 */ 
	protected String toQualifiedName(QName qName) {
		String prefix = qName.getPrefix();
		if (!StringUtils.hasLength(prefix)) {
			return qName.getLocalPart();
		} 
		else { 
			return prefix + ":" + qName.getLocalPart();
		} 
	} 
 
 
	/** 
	 * Parse the StAX XML reader passed at construction-time. 
	 * <p><b>NOTE:</b>: The given {@code InputSource} is not read, but ignored. 
	 * @param ignored is ignored 
	 * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 QName Questions & Answers:

See Code Examples for Java 8 QName Methods: