本文整理汇总了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);
}
}
示例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());
}
示例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);
}
示例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;
}
}
示例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));
}
}
}
示例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");
}
}
示例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");
}
}
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
示例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()});
}
示例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;
}
示例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);
}
示例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);
}