本文整理汇总了Java中javax.xml.namespace.QName.getNamespaceURI方法的典型用法代码示例。如果您正苦于以下问题:Java QName.getNamespaceURI方法的具体用法?Java QName.getNamespaceURI怎么用?Java QName.getNamespaceURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.namespace.QName
的用法示例。
在下文中一共展示了QName.getNamespaceURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: addDependencyTo
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private void addDependencyTo(@Nullable QName qname) {
// even though the Element interface says getElementName() returns non-null,
// ClassInfo always implements Element (even if an instance of ClassInfo might not be an Element).
// so this check is still necessary
if (qname==null) {
return;
}
String nsUri = qname.getNamespaceURI();
if (nsUri.equals(XML_SCHEMA)) {
// no need to explicitly refer to XSD namespace
return;
}
if (nsUri.equals(uri)) {
selfReference = true;
return;
}
// found a type in a foreign namespace, so make sure we generate an import for it
depends.add(getNamespace(nsUri));
}
示例3: bodyParamNS
import javax.xml.namespace.QName; //导入方法依赖的package包/类
protected String bodyParamNS(ParameterImpl p) {
String nsToImport = null;
TypeInfo typeInfo = p.getItemType();
if (typeInfo == null) typeInfo = p.getTypeInfo();
QName type = model.getBindingContext().getTypeName(typeInfo);
if (type != null) {
nsToImport = type.getNamespaceURI();
} else {
if (typeInfo.type instanceof Class) {
try {
QName elemRef = model.getBindingContext().getElementName((Class)typeInfo.type);
if (elemRef != null) nsToImport = elemRef.getNamespaceURI();
} catch (JAXBException je) {
throw new WebServiceException(je.getMessage(), je);
}
}
}
return nsToImport;
}
示例4: writeWsdliLocation
import javax.xml.namespace.QName; //导入方法依赖的package包/类
/**
* @param writer the writer should be at the start of element.
* @param service Namespace URI of servcie is used as targetNamespace of wsdl if wsdlTargetNamespace is not null
* @param wsdlAddress wsdl location
* @param wsdlTargetNamespace targetnamespace of wsdl to be put in wsdliLocation
*
*/
private static void writeWsdliLocation(StreamWriterBufferCreator writer, QName service,String wsdlAddress,String wsdlTargetNamespace) throws XMLStreamException {
String wsdliLocation = "";
if(wsdlTargetNamespace != null) {
wsdliLocation = wsdlTargetNamespace + " ";
} else if (service != null) {
wsdliLocation = service.getNamespaceURI() + " ";
} else {
throw new WebServiceException("WSDL target Namespace cannot be resolved");
}
wsdliLocation += wsdlAddress;
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_PREFIX,
W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_NAMESPACE);
writer.writeAttribute(W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_PREFIX,
W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_NAMESPACE,
W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_LOCALNAME,
wsdliLocation);
}
示例5: attWildcardAsURIs
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public void attWildcardAsURIs(Map<QName,String> attributes, String fieldName) {
if(attributes==null) return;
for( Map.Entry<QName,String> e : attributes.entrySet() ) {
QName n = e.getKey();
String nsUri = n.getNamespaceURI();
if(nsUri.length()>0) {
String p = n.getPrefix();
if(p.length()==0) p=null;
nsContext.declareNsUri(nsUri, p, true);
}
}
}
示例6: JAXBMessage
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
super(soapVer);
// TODO: think about a better way to handle BridgeContext
this.bridge = bridge;
this.rawContext = null;
this.jaxbObject = jaxbObject;
QName tagName = bridge.getTypeInfo().tagName;
this.nsUri = tagName.getNamespaceURI();
this.localName = tagName.getLocalPart();
this.attachmentSet = new AttachmentSetImpl();
}
示例7: calcArrayTypeName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
/**
* Computes the type name of the array from that of the item type.
*/
public static QName calcArrayTypeName(QName n) {
String uri;
if(n.getNamespaceURI().equals(WellKnownNamespace.XML_SCHEMA)) {
TODO.checkSpec("this URI");
uri = "http://jaxb.dev.java.net/array";
} else
uri = n.getNamespaceURI();
return new QName(uri,n.getLocalPart()+"Array");
}
示例8: qualifyWrappeeIfNeeded
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private QName qualifyWrappeeIfNeeded(QName resultQName, String ns) {
Object o = config.properties().get(DocWrappeeNamespapceQualified);
boolean qualified = (o!= null && o instanceof Boolean) ? ((Boolean) o) : false;
if (qualified) {
if (resultQName.getNamespaceURI() == null || "".equals(resultQName.getNamespaceURI())) {
return new QName(ns, resultQName.getLocalPart());
}
}
return resultQName;
}
示例9: countURI
import javax.xml.namespace.QName; //导入方法依赖的package包/类
/**
* pull the uri out of the specified QName and keep track of it in the
* specified hash map
*
* @param qname
*/
private void countURI(HashMap<String, Integer> map, QName qname) {
if (qname == null) return;
String uri = qname.getNamespaceURI();
if (map.containsKey(uri)) {
map.put(uri, map.get(uri) + 1);
} else {
map.put(uri, 1);
}
}
示例10: appendFaultSubcode
import javax.xml.namespace.QName; //导入方法依赖的package包/类
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());
}
示例11: writeTypeName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private void writeTypeName(QName typeName, XmlTypeWriter xtw, String mostUsedNamespaceURI) {
if (typeName == null) {
xtw.name("");
} else {
xtw.name(typeName.getLocalPart());
final String typeNameURI = typeName.getNamespaceURI();
if (!typeNameURI.equals(mostUsedNamespaceURI)) // only generate if necessary
{
xtw.namespace(typeNameURI);
}
}
}
示例12: annotateAttribute
import javax.xml.namespace.QName; //导入方法依赖的package包/类
/**
* Annotate the attribute property 'field'
*/
private void annotateAttribute(JAnnotatable field) {
CAttributePropertyInfo ap = (CAttributePropertyInfo) prop;
QName attName = ap.getXmlName();
// [RESULT]
// @XmlAttribute(name="foo", required=true, namespace="bar://baz")
XmlAttributeWriter xaw = field.annotate2(XmlAttributeWriter.class);
final String generatedName = attName.getLocalPart();
final String generatedNS = attName.getNamespaceURI();
// Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
// generate name property?
if(!generatedName.equals(ap.getName(false)) || !generatedName.equals(ap.getName(true)) || (outline.parent().getModel().getNameConverter() != NameConverter.standard)) {
xaw.name(generatedName);
}
// generate namespace property?
if(!generatedNS.equals("")) { // assume attributeFormDefault == unqualified
xaw.namespace(generatedNS);
}
// generate required property?
if(ap.isRequired()) {
xaw.required(true);
}
}
示例13: addToNameTable
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private void addToNameTable(QName n, QualifiedNameArray a,
boolean isAttribute,
StringIntMap prefixMap, StringIntMap namespaceNameMap,
StringIntMap localNameMap) {
int namespaceURIIndex = -1;
int prefixIndex = -1;
if (n.getNamespaceURI().length() > 0) {
namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
namespaceURIIndex = namespaceName.getSize();
namespaceName.add(n.getNamespaceURI());
}
if (n.getPrefix().length() > 0) {
prefixIndex = prefixMap.obtainIndex(n.getPrefix());
if (prefixIndex == KeyIntMap.NOT_PRESENT) {
prefixIndex = prefix.getSize();
prefix.add(n.getPrefix());
}
}
}
int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
if (localNameIndex == KeyIntMap.NOT_PRESENT) {
localNameIndex = localName.getSize();
localName.add(n.getLocalPart());
}
QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
a.getSize(),
prefixIndex, namespaceURIIndex, localNameIndex);
if (isAttribute) {
name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
}
a.add(name);
}
示例14: ElementImpl
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) {
super(
ownerDoc,
name.getNamespaceURI(),
getQualifiedName(name),
name.getLocalPart());
elementQName = name;
}
示例15: processClass
import javax.xml.namespace.QName; //导入方法依赖的package包/类
void processClass(Class clazz) {
classUsesWebMethod = new HashSet<Class>();
determineWebMethodUse(clazz);
WebService webService = getAnnotation(clazz, WebService.class);
QName portTypeName = getPortTypeName(clazz, targetNamespace, metadataReader);
// String portTypeLocalName = clazz.getSimpleName();
// if (webService.name().length() >0)
// portTypeLocalName = webService.name();
//
// targetNamespace = webService.targetNamespace();
packageName = "";
if (clazz.getPackage() != null)
packageName = clazz.getPackage().getName();
// if (targetNamespace.length() == 0) {
// targetNamespace = getNamespace(packageName);
// }
// model.setTargetNamespace(targetNamespace);
// QName portTypeName = new QName(targetNamespace, portTypeLocalName);
targetNamespace = portTypeName.getNamespaceURI();
model.setPortTypeName(portTypeName);
model.setTargetNamespace(targetNamespace);
model.defaultSchemaNamespaceSuffix = config.getMappingInfo().getDefaultSchemaNamespaceSuffix();
model.setWSDLLocation(webService.wsdlLocation());
SOAPBinding soapBinding = getAnnotation(clazz, SOAPBinding.class);
if (soapBinding != null) {
if (soapBinding.style() == SOAPBinding.Style.RPC && soapBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE) {
throw new RuntimeModelerException("runtime.modeler.invalid.soapbinding.parameterstyle",
soapBinding, clazz);
}
isWrapped = soapBinding.parameterStyle()== WRAPPED;
}
defaultBinding = createBinding(soapBinding);
/*
* if clazz != portClass then there is an SEI. If there is an
* SEI, then all methods should be processed. However, if there is
* no SEI, and the implementation class uses at least one
* WebMethod annotation, then only methods with this annotation
* will be processed.
*/
/* if (clazz == portClass) {
WebMethod webMethod;
for (Method method : clazz.getMethods()) {
webMethod = getPrivMethodAnnotation(method, WebMethod.class);
if (webMethod != null &&
!webMethod.exclude()) {
usesWebMethod = true;
break;
}
}
}*/
for (Method method : clazz.getMethods()) {
if (!clazz.isInterface()) { // if clazz is SEI, then all methods are web methods
if (method.getDeclaringClass() == Object.class) continue;
if (!getBooleanSystemProperty("com.sun.xml.internal.ws.legacyWebMethod")) { // legacy webMethod computation behaviour to be used
if (!isWebMethodBySpec(method, clazz))
continue;
} else {
if (!isWebMethod(method))
continue;
}
}
// TODO: binding can be null. We need to figure out how to post-process
// RuntimeModel to link to WSDLModel
processMethod(method);
}
//Add additional jaxb classes referenced by {@link XmlSeeAlso}
XmlSeeAlso xmlSeeAlso = getAnnotation(clazz, XmlSeeAlso.class);
if(xmlSeeAlso != null)
model.addAdditionalClasses(xmlSeeAlso.value());
}