當前位置: 首頁>>代碼示例>>Java>>正文


Java QName類代碼示例

本文整理匯總了Java中javax.xml.namespace.QName的典型用法代碼示例。如果您正苦於以下問題:Java QName類的具體用法?Java QName怎麽用?Java QName使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


QName類屬於javax.xml.namespace包,在下文中一共展示了QName類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRoleDescriptors

import javax.xml.namespace.QName; //導入依賴的package包/類
/**
 * Get the list of metadata role descriptors which match the given entityID, role and protocol.
 * 
 * @param entityID entity ID of the credential owner
 * @param role role in which the entity is operating
 * @param protocol protocol over which the entity is operating (may be null)
 * @return a list of role descriptors matching the given parameters, or null
 * @throws SecurityException thrown if there is an error retrieving role descriptors from the metadata provider
 */
protected List<RoleDescriptor> getRoleDescriptors(String entityID, QName role, String protocol)
        throws SecurityException {
    try {
        if (log.isDebugEnabled()) {
            log.debug("Retrieving metadata for entity '{}' in role '{}' for protocol '{}'", 
                    new Object[] {entityID, role, protocol});
        }

        if (DatatypeHelper.isEmpty(protocol)) {
            return metadata.getRole(entityID, role);
        } else {
            RoleDescriptor roleDescriptor = metadata.getRole(entityID, role, protocol);
            if (roleDescriptor == null) {
                return null;
            }
            List<RoleDescriptor> roles = new ArrayList<RoleDescriptor>();
            roles.add(roleDescriptor);
            return roles;
        }
    } catch (MetadataProviderException e) {
        log.error("Unable to read metadata from provider", e);
        throw new SecurityException("Unable to read metadata provider", e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:34,代碼來源:MetadataCredentialResolver.java

示例2: appendFaultSubcode

import javax.xml.namespace.QName; //導入依賴的package包/類
@Override
public void appendFaultSubcode(QName subcode) throws SOAPException {
    if (subcode == null) {
        return;
    }
    if (subcode.getNamespaceURI() == null ||
        "".equals(subcode.getNamespaceURI())) {

        log.severe("SAAJ0432.ver1_2.subcode.not.ns.qualified");
        throw new SOAPExceptionImpl("A Subcode must be namespace-qualified");
    }
    if (innermostSubCodeElement == null) {
        if (faultCodeElement == null)
            findFaultCodeElement();
        innermostSubCodeElement = faultCodeElement;
    }
    String prefix = null;
    if (subcode.getPrefix() == null || "".equals(subcode.getPrefix())) {
        prefix =
            ((ElementImpl) innermostSubCodeElement).getNamespacePrefix(
                subcode.getNamespaceURI());
    } else
        prefix = subcode.getPrefix();
    if (prefix == null || "".equals(prefix)) {
        prefix = "ns1";
    }
    innermostSubCodeElement =
        innermostSubCodeElement.addChildElement(subcodeName);
    SOAPElement subcodeValueElement =
        innermostSubCodeElement.addChildElement(valueName);
    ((ElementImpl) subcodeValueElement).ensureNamespaceIsDeclared(
        prefix,
        subcode.getNamespaceURI());
    subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:Fault1_2Impl.java

示例3: addWsdlPortTypeOperation

import javax.xml.namespace.QName; //導入依賴的package包/類
private static void addWsdlPortTypeOperation(Definition definition, QName portTypeQName, String operationName, String operationComment, QName inputQName, QName ouptutQName) {
Message inputMessage = definition.createMessage();
inputMessage.setQName(inputQName);
Input input = definition.createInput();
input.setMessage(inputMessage);

Message outpuMessage = definition.createMessage();
outpuMessage.setQName(ouptutQName);
Output output = definition.createOutput();
output.setMessage(outpuMessage);

Operation operation = definition.createOperation();
operation.setName(operationName);
operation.setInput(input);
operation.setOutput(output);
operation.setUndefined(false);
addWsdLDocumentation(definition, operation, operationComment);

PortType portType = definition.getPortType(portTypeQName);
portType.addOperation(operation);
  }
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:22,代碼來源:WebServiceServlet.java

示例4: startElement

import javax.xml.namespace.QName; //導入依賴的package包/類
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {

    if (bodyStarted) {
        payloadQName = new QName(uri, localName);
        // we have what we wanted - let's skip rest of parsing ...
        throw new SAXException("Payload element found, interrupting the parsing process.");
    }

    // check for both SOAP 1.1/1.2
    if (equalsQName(uri, localName, SOAPConstants.QNAME_SOAP_BODY) ||
            equalsQName(uri, localName, SOAP12Constants.QNAME_SOAP_BODY)) {
        bodyStarted = true;
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:PayloadElementSniffer.java

示例5: elementDecl

import javax.xml.namespace.QName; //導入依賴的package包/類
public void elementDecl(XSElementDecl decl) {

        QName n = BGMBuilder.getName(decl);
        if(elementNames.add(n)) {
            CElement elementBean = Ring.get(ClassSelector.class).bindToType(decl,null);
            if(elementBean==null)
                refs.add(new XmlTypeRef(decl));
            else {
                // yikes!
                if(elementBean instanceof CClass)
                    refs.add(new CClassRef(decl,(CClass)elementBean));
                else
                    refs.add(new CElementInfoRef(decl,(CElementInfo)elementBean));
            }
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:RawTypeSetBuilder.java

示例6: validateValueContent

import javax.xml.namespace.QName; //導入依賴的package包/類
/**
 * Validates that the status code local name is one of the allowabled values.
 * 
 * @param statusCode the status code to validate
 * 
 * @throws ValidationException thrown if the status code local name is not an allowed value
 */
protected void validateValueContent(StatusCode statusCode) throws ValidationException {
    QName statusValue = statusCode.getValue();

    if (SAMLConstants.SAML10P_NS.equals(statusValue.getNamespaceURI())) {
        if (!(statusValue.equals(StatusCode.SUCCESS) 
                || statusValue.equals(StatusCode.VERSION_MISMATCH)
                || statusValue.equals(StatusCode.REQUESTER) 
                || statusValue.equals(StatusCode.RESPONDER)
                || statusValue.equals(StatusCode.REQUEST_VERSION_TOO_HIGH)
                || statusValue.equals(StatusCode.REQUEST_VERSION_TOO_LOW)
                || statusValue.equals(StatusCode.REQUEST_VERSION_DEPRICATED)
                || statusValue.equals(StatusCode.TOO_MANY_RESPONSES)
                || statusValue.equals(StatusCode.REQUEST_DENIED)
                || statusValue.equals(StatusCode.RESOURCE_NOT_RECOGNIZED))) {
            throw new ValidationException(
                    "Status code value was in the SAML 1 protocol namespace but was not of an allowed value: "
                            + statusValue);
        }
    } else if (SAMLConstants.SAML1_NS.equals(statusValue.getNamespaceURI())) {
        throw new ValidationException(
                "Status code value was in the SAML 1 assertion namespace, no values are allowed in that namespace");
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:31,代碼來源:StatusCodeSchemaValidator.java

示例7: validateReference

import javax.xml.namespace.QName; //導入依賴的package包/類
/**
 * Validate the Element referred to by the KeyInfoReference.
 *
 * @param referentElement
 *
 * @throws XMLSecurityException
 */
private void validateReference(Element referentElement) throws XMLSecurityException {
    if (!XMLUtils.elementIsInSignatureSpace(referentElement, Constants._TAG_KEYINFO)) {
        Object exArgs[] = { new QName(referentElement.getNamespaceURI(), referentElement.getLocalName()) };
        throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.WrongType", exArgs);
    }

    KeyInfo referent = new KeyInfo(referentElement, "");
    if (referent.containsKeyInfoReference()) {
        if (secureValidation) {
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithSecure");
        } else {
            // Don't support chains of references at this time. If do support in the future, this is where the code
            // would go to validate that don't have a cycle, resulting in an infinite loop. This may be unrealistic
            // to implement, and/or very expensive given remote URI references.
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithoutSecure");
        }
    }

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:27,代碼來源:KeyInfoReferenceResolver.java

示例8: mapToClass

import javax.xml.namespace.QName; //導入依賴的package包/類
private void mapToClass(DElementPattern p) {
    NameClass nc = p.getName();
    if(nc.isOpen())
        return;   // infinite name. can't map to a class.

    Set<QName> names = nc.listNames();

    CClassInfo[] types = new CClassInfo[names.size()];
    int i=0;
    for( QName n : names ) {
        // TODO: read class names from customization
        String name = model.getNameConverter().toClassName(n.getLocalPart());

        bindQueue.put(
            types[i++] = new CClassInfo(model,pkg,name,p.getLocation(),null,n,null,null/*TODO*/),
            p.getChild() );
    }

    classes.put(p,types);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:RELAXNGCompiler.java

示例9: createAttribute

import javax.xml.namespace.QName; //導入依賴的package包/類
protected CPropertyInfo createAttribute(
    String elementName, String attributeName, String attributeType,
    String[] enums, short attributeUse, String defaultValue )
        throws SAXException {

    boolean required = attributeUse==USE_REQUIRED;

    // get the attribute-property declaration
    BIElement edecl = bindInfo.element(elementName);
    BIAttribute decl=null;
    if(edecl!=null)     decl=edecl.attribute(attributeName);

    String propName;
    if(decl==null)  propName = model.getNameConverter().toPropertyName(attributeName);
    else            propName = decl.getPropertyName();

    QName qname = new QName("",attributeName);

    // if no declaration is specified, just wrap it by
    // a FieldItem and let the normalizer handle its content.
    TypeUse use;

    if(decl!=null && decl.getConversion()!=null)
        use = decl.getConversion().getTransducer();
    else
        use = builtinConversions.get(attributeType);

    CPropertyInfo r = new CAttributePropertyInfo(
        propName, null,null/*TODO*/, copyLocator(), qname, use, null, required );

    if(defaultValue!=null)
        r.defaultValue = CDefaultValue.create( use, new XmlString(defaultValue) );

    return r;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:TDTDReader.java

示例10: toXMLFormat

import javax.xml.namespace.QName; //導入依賴的package包/類
/**
 * <p>Return the lexical representation of <code>this</code> instance.
 * The format is specified in
 * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">XML Schema 1.0 Part 2, Section 3.2.[7-14].1,
 * <i>Lexical Representation</i>".</a></p>
 *
 * <p>Specific target lexical representation format is determined by
 * {@link #getXMLSchemaType()}.</p>
 *
 * @return XML, as <code>String</code>, representation of this <code>XMLGregorianCalendar</code>
 *
 * @throws java.lang.IllegalStateException if the combination of set fields
 *    does not match one of the eight defined XML Schema builtin date/time datatypes.
 */
public String toXMLFormat() {

    QName typekind = getXMLSchemaType();

    String formatString = null;
    // Fix 4971612: invalid SCCS macro substitution in data string
    //   no %{alpha}% to avoid SCCS macro substitution
    if (typekind == DatatypeConstants.DATETIME) {
        formatString = "%Y-%M-%DT%h:%m:%s" + "%z";
    } else if (typekind == DatatypeConstants.DATE) {
        formatString = "%Y-%M-%D" + "%z";
    } else if (typekind == DatatypeConstants.TIME) {
        formatString = "%h:%m:%s" + "%z";
    } else if (typekind == DatatypeConstants.GMONTH) {
        formatString = "--%M" + "%z";
    } else if (typekind == DatatypeConstants.GDAY) {
        formatString = "---%D" + "%z";
    } else if (typekind == DatatypeConstants.GYEAR) {
        formatString = "%Y" + "%z";
    } else if (typekind == DatatypeConstants.GYEARMONTH) {
        formatString = "%Y-%M" + "%z";
    } else if (typekind == DatatypeConstants.GMONTHDAY) {
        formatString = "--%M-%D" + "%z";
    }
    return format(formatString);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:41,代碼來源:XMLGregorianCalendarImpl.java

示例11: getQuote3

import javax.xml.namespace.QName; //導入依賴的package包/類
/**
 * This method does the same thing that getQuote1 does, but in
 * addition it reuses the Call object to make another call.
 */
public float getQuote3(String args[]) throws Exception {
    Options opts = new Options(args);

    args = opts.getRemainingArgs();

    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }

    /* Define the service QName and port QName */
    /*******************************************/
    QName servQN = new QName("urn:xmltoday-delayed-quotes",
            "GetQuoteService");
    QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");

    /* Now use those QNames as pointers into the WSDL doc */
    /******************************************************/
    Service service = ServiceFactory.newInstance().createService(
            new URL("file:samples/stock/GetQuote.wsdl"), servQN);
    Call call = service.createCall(portQN, "getQuote");

    /* Strange - but allows the user to change just certain portions of */
    /* the URL we're gonna use to invoke the service.  Useful when you  */
    /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
    /********************************************************************/
    opts.setDefaultURL(call.getTargetEndpointAddress());
    call.setTargetEndpointAddress(opts.getURL());

    /* Define some service specific properties */
    /*******************************************/
    call.setProperty(Call.USERNAME_PROPERTY, opts.getUser());
    call.setProperty(Call.PASSWORD_PROPERTY, opts.getPassword());

    /* Get symbol and invoke the service */
    /*************************************/
    Object result = call.invoke(new Object[] {symbol = args[0]});

    /* Reuse the Call object for a different call */
    /**********************************************/
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "test"));
    call.removeAllParameters();
    call.setReturnType(XMLType.XSD_STRING);

    System.out.println(call.invoke(new Object[]{}));
    return ((Float) result).floatValue();
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:52,代碼來源:GetQuote1.java

示例12: verifyTagNSRootElement

import javax.xml.namespace.QName; //導入依賴的package包/類
public static void verifyTagNSRootElement(Element element, QName name) {
    if (!element.getLocalName().equals(name.getLocalPart())
        || (element.getNamespaceURI() != null
            && !element.getNamespaceURI().equals(name.getNamespaceURI())))
        fail(
            "parsing.incorrectRootElement",
            new Object[] {
                element.getTagName(),
                element.getNamespaceURI(),
                name.getLocalPart(),
                name.getNamespaceURI()});
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:Util.java

示例13: getFirstDetailEntryName

import javax.xml.namespace.QName; //導入依賴的package包/類
private static @Nullable QName getFirstDetailEntryName(@Nullable Detail detail) {
    if (detail != null) {
        Iterator<DetailEntry> it = detail.getDetailEntries();
        if (it.hasNext()) {
            DetailEntry entry = it.next();
            return getFirstDetailEntryName(entry);
        }
    }
    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:SOAPFaultBuilder.java

示例14: create

import javax.xml.namespace.QName; //導入依賴的package包/類
@Override
public POMComponent create(Element element, POMComponent context) {
    // return new SCAComponentCreateVisitor().create(element, context);
    QName qName = getQName(element, (POMComponentImpl)context);
    ElementFactory elementFactory = ElementFactoryRegistry.getDefault().get(qName);
    return create(elementFactory, element, context);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:POMComponentFactoryImpl.java

示例15: getBinding

import javax.xml.namespace.QName; //導入依賴的package包/類
private ParameterBinding getBinding(String operation, String part, boolean isHeader, Mode mode){
    if(binding == null){
        if(isHeader)
            return ParameterBinding.HEADER;
        else
            return ParameterBinding.BODY;
    }
    QName opName = new QName(binding.getBinding().getPortType().getName().getNamespaceURI(), operation);
    return binding.getBinding().getBinding(opName, part, mode);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:RuntimeModeler.java


注:本文中的javax.xml.namespace.QName類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。