Example usage for javax.xml.namespace QName toString

List of usage examples for javax.xml.namespace QName toString

Introduction

In this page you can find the example usage for javax.xml.namespace QName toString.

Prototype

public String toString() 

Source Link

Document

<p><code>String</code> representation of this <code>QName</code>.</p> <p>The commonly accepted way of representing a <code>QName</code> as a <code>String</code> was <a href="http://jclark.com/xml/xmlns.htm">defined</a> by James Clark.

Usage

From source file:HTTPChunkLocator.java

private static String get(final StartElement element, final QName name) throws IOException {
    final Attribute attributeByName = element.getAttributeByName(name);
    if (attributeByName == null) {
        throw new IOException("missing attribute " + name.toString());
    }/*  w ww.  ja v  a 2s .  com*/
    return attributeByName.getValue();
}

From source file:Main.java

private static void printAttributes(XMLStreamReader xmlr) {
    if (xmlr.getAttributeCount() > 0) {
        System.out.println("\nHAS ATTRIBUTES: ");

        int count = xmlr.getAttributeCount();

        for (int i = 0; i < count; i++) {
            QName name = xmlr.getAttributeName(i);
            String namespace = xmlr.getAttributeNamespace(i);
            String type = xmlr.getAttributeType(i);
            String prefix = xmlr.getAttributePrefix(i);
            String value = xmlr.getAttributeValue(i);

            System.out.println("ATTRIBUTE-PREFIX: " + prefix);
            System.out.println("ATTRIBUTE-NAMESP: " + namespace);
            System.out.println("ATTRIBUTE-NAME:   " + name.toString());
            System.out.println("ATTRIBUTE-VALUE:  " + value);
            System.out.println("ATTRIBUTE-TYPE:  " + type);
        }/*from  w  w  w  .j a v a 2  s .c  o m*/
    } else {
        System.out.println("HAS NO ATTRIBUTES");
    }
}

From source file:eu.stork.peps.auth.engine.SAMLEngineUtils.java

/**
 * Creates the SAML object.//from  w ww  .j  ava  2  s .c  om
 * 
 * @param qname the QName
 * 
 * @return the XML object
 */
public static XMLObject createSamlObject(final QName qname) {
    if (qname.toString().endsWith(CustomAttributeQuery.DEFAULT_ELEMENT_LOCAL_NAME)) {
        CustomAttributeQueryBuilder builder = new CustomAttributeQueryBuilder();
        return builder.buildObject(qname);
    } else {
        return Configuration.getBuilderFactory().getBuilder(qname).buildObject(qname);
    }
}

From source file:com.vmware.eucenablement.saml.impl.SAMLUtil.java

/**
 * Generate SAML object according to the element name.
 *
 * @param name//from   w w w  . j  av  a  2 s .c  om
 *            element name
 * @return SAML object; This function will return null if cannot build SAML
 *         object
 */
private static <T extends XMLObject> T buildSAMLObject(@Nonnull final QName name) {
    T object = null;
    if (name == null) {
        log.error("Failed to build SAML Object: QName is null!");
        return null;
    }

    try {

        @SuppressWarnings("unchecked")
        XMLObjectBuilder<T> builder = (XMLObjectBuilder<T>) builderFactory.getBuilder(name);

        if (builder != null) {
            object = builder.buildObject(name);
        } else {
            log.error("XMLObject for " + name.toString() + " is null!");
        }
    } catch (Exception e) {
        log.error("Build SAML Object failed", e);
        object = null;
    }

    return object;
}

From source file:org.kuali.rice.core.framework.resourceloader.BeanFactoryResourceLoader.java

protected String translateBeanName(QName serviceName) {
    return serviceName.toString();
}

From source file:ca.sqlpower.dao.session.QNameConverter.java

@Override
public String convertToSimpleType(QName convertFrom, Object... additionalInfo) {
    return convertFrom.toString();
}

From source file:org.eclipse.winery.repository.Utils.java

public static ArtifactTemplateId createArtifactTemplate(InputStream uploadedInputStream,
        FormDataContentDisposition fileDetail, FormDataBodyPart body, QName artifactType, UriInfo uriInfo) {

    ArtifactTemplatesResource templateResource = new ArtifactTemplatesResource();
    templateResource.onPost("http://opentosca.org/xaaspackager", "xaasPackager_" + fileDetail.getFileName(),
            artifactType.toString());

    ArtifactTemplateId artifactTemplateId = new ArtifactTemplateId("http://opentosca.org/xaaspackager",
            "xaasPackager_" + fileDetail.getFileName(), false);

    ArtifactTemplateResource atRes = new ArtifactTemplateResource(artifactTemplateId);
    atRes.getFilesResource().onPost(uploadedInputStream, fileDetail, body, uriInfo);

    return artifactTemplateId;
}

From source file:org.codehaus.groovy.grails.plugins.spring.ws.ReloadablePayloadRootQNameEndpointMapping.java

protected final String getLookupKeyForMessage(MessageContext messageContext) throws Exception {
    QName qName = resolveQName(messageContext);
    return qName != null ? qName.toString() : null;
}

From source file:com.centeractive.ws.builder.core.WsdlParser.java

public void printBindings() {
    System.out.println(wsdlUrl);//  w  w  w .  j a  v a 2s .c o  m
    for (QName bindingName : soapFacade.getBindingNames()) {
        System.out.println("\t" + bindingName.toString());
    }
}

From source file:com.mirth.connect.connectors.ws.WebServiceConnectorService.java

public Object invoke(String method, Object object, String sessionsId) throws Exception {
    if (method.equals("cacheWsdlFromUrl")) {
        Map<String, String> params = (Map<String, String>) object;
        String wsdlUrl = params.get("wsdlUrl");
        URI wsdlUri = new URI(wsdlUrl);
        String username = params.get("username");
        String password = params.get("password");
        wsdlInterfaceCache.put(wsdlUrl, getWsdlInterface(wsdlUri, username, password));
    } else if (method.equals("isWsdlCached")) {
        String id = (String) object;
        return (wsdlInterfaceCache.get(id) != null);
    } else if (method.equals("getOperations")) {
        String id = (String) object;
        WsdlInterface wsdlInterface = wsdlInterfaceCache.get(id);
        return getOperations(wsdlInterface);
    } else if (method.equals("getService")) {
        String id = (String) object;
        WsdlInterface wsdlInterface = wsdlInterfaceCache.get(id);

        if (MapUtils.isNotEmpty(wsdlInterface.getWsdlContext().getDefinition().getServices())) {
            Service service = (Service) wsdlInterface.getWsdlContext().getDefinition().getServices().values()
                    .iterator().next();/*www. j  a  v  a2  s.  c  om*/
            return service.getQName().toString();
        }
    } else if (method.equals("getPort")) {
        String id = (String) object;
        WsdlInterface wsdlInterface = wsdlInterfaceCache.get(id);

        if (MapUtils.isNotEmpty(wsdlInterface.getWsdlContext().getDefinition().getServices())) {
            Service service = (Service) wsdlInterface.getWsdlContext().getDefinition().getServices().values()
                    .iterator().next();
            Port port = (Port) service.getPorts().values().iterator().next();
            QName qName = new QName(service.getQName().getNamespaceURI(), port.getName());
            return qName.toString();
        }
    } else if (method.equals("generateEnvelope")) {
        Map<String, String> params = (Map<String, String>) object;
        String id = params.get("id");
        String operationName = params.get("operation");
        WsdlInterface wsdlInterface = wsdlInterfaceCache.get(id);
        return buildEnvelope(wsdlInterface, operationName);
    } else if (method.equals("getSoapAction")) {
        Map<String, String> params = (Map<String, String>) object;
        String id = params.get("id");
        String operationName = params.get("operation");
        WsdlInterface wsdlInterface = wsdlInterfaceCache.get(id);
        return wsdlInterface.getOperationByName(operationName).getAction();
    }

    return null;
}