本文整理汇总了Java中javax.xml.namespace.QName.getLocalPart方法的典型用法代码示例。如果您正苦于以下问题:Java QName.getLocalPart方法的具体用法?Java QName.getLocalPart怎么用?Java QName.getLocalPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.namespace.QName
的用法示例。
在下文中一共展示了QName.getLocalPart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributeByName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private Attribute getAttributeByName(final StartElement element,
final QName attributeName) {
// call standard API method to retrieve the attribute by name
Attribute attribute = element.getAttributeByName(attributeName);
// try to find the attribute without a prefix.
if (attribute == null) {
final String localAttributeName = attributeName.getLocalPart();
final Iterator iterator = element.getAttributes();
while (iterator.hasNext()) {
final Attribute nextAttribute = (Attribute) iterator.next();
final QName aName = nextAttribute.getName();
final boolean attributeFoundByWorkaround = aName.equals(attributeName) || (aName.getLocalPart().equals(localAttributeName) && (aName.getPrefix() == null || "".equals(aName.getPrefix())));
if (attributeFoundByWorkaround) {
attribute = nextAttribute;
break;
}
}
}
return attribute;
}
示例2: handleEndElement
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private void handleEndElement(EndElement event) throws SAXException {
if(!seenText && predictor.expectText()) {
visitor.text("");
}
// fire endElement
QName qName = event.getName();
tagName.uri = fixNull(qName.getNamespaceURI());
tagName.local = qName.getLocalPart();
visitor.endElement(tagName);
// end namespace bindings
for( Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) {
String prefix = fixNull(i.next().getPrefix()); // be defensive
visitor.endPrefixMapping(prefix);
}
seenText = false;
}
示例3: setElementQName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public SOAPElement setElementQName(QName newName) throws SOAPException {
log.log(Level.SEVERE,
"SAAJ0146.impl.invalid.name.change.requested",
new Object[] {elementQName.getLocalPart(),
newName.getLocalPart()});
throw new SOAPException("Cannot change name for "
+ elementQName.getLocalPart() + " to "
+ newName.getLocalPart());
}
示例4: setElementQName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
@Override
public SOAPElement setElementQName(QName newName) throws SOAPException {
log.log(Level.SEVERE,
"SAAJ0146.impl.invalid.name.change.requested",
new Object[] {elementQName.getLocalPart(),
newName.getLocalPart()});
throw new SOAPException("Cannot change name for "
+ elementQName.getLocalPart() + " to "
+ newName.getLocalPart());
}
示例5: _printQName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public static String _printQName(QName val, NamespaceContext nsc) {
// Double-check
String qname;
String prefix = nsc.getPrefix(val.getNamespaceURI());
String localPart = val.getLocalPart();
if (prefix == null || prefix.length() == 0) { // be defensive
qname = localPart;
} else {
qname = prefix + ':' + localPart;
}
return qname;
}
示例6: create
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public WSDLComponent create(WSDLComponent parent, QName qName) {
String q = qName.getPrefix();
if (q == null || q.length() == 0) {
q = qName.getLocalPart();
} else {
q = q + ":" + qName.getLocalPart();
}
ElementFactory factory = ElementFactoryRegistry.getDefault().get(qName);
Element element = model.getDocument().createElementNS(qName.getNamespaceURI(), q);
return create(factory, element, parent);
}
示例7: setElementQName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
@Override
public SOAPElement setElementQName(QName newName) throws SOAPException {
log.log(Level.SEVERE,
"SAAJ0146.impl.invalid.name.change.requested",
new Object[] {elementQName.getLocalPart(),
newName.getLocalPart()});
throw new SOAPException("Cannot change name for "
+ elementQName.getLocalPart() + " to "
+ newName.getLocalPart());
}
示例8: Operation
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public Operation(QName name, Entity entity) {
super(entity);
_name = name;
_uniqueName = name.getLocalPart();
_faultNames = new HashSet<String>();
_faults = new HashSet<Fault>();
}
示例9: handleStartElement
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private void handleStartElement() throws XMLStreamException {
try {
// start namespace bindings
int nsCount = staxStreamReader.getNamespaceCount();
for (int i = 0; i < nsCount; i++) {
saxHandler.startPrefixMapping(
fixNull(staxStreamReader.getNamespacePrefix(i)),
fixNull(staxStreamReader.getNamespaceURI(i)));
}
// fire startElement
QName qName = staxStreamReader.getName();
String prefix = qName.getPrefix();
String rawname;
if(prefix==null || prefix.length()==0)
rawname = qName.getLocalPart();
else
rawname = prefix + ':' + qName.getLocalPart();
Attributes attrs = getAttributes();
saxHandler.startElement(
qName.getNamespaceURI(),
qName.getLocalPart(),
rawname,
attrs);
} catch (SAXException e) {
throw new XMLStreamException2(e);
}
}
示例10: 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);
}
示例11: getTypesListFromXsd
import javax.xml.namespace.QName; //导入方法依赖的package包/类
private ArrayList<String> getTypesListFromXsd() {
ArrayList<String> types = new ArrayList<String>();
try {
String tns = transaction.getProject().getTargetNamespace();
String projectName = transaction.getProject().getName();
XmlSchema schema = Engine.theApp.schemaManager.getSchemaForProject(projectName);
QName responseTypeQName = new QName(tns, transaction.getXsdResponseTypeName());
XmlSchemaComplexType xmlSchemaType = (XmlSchemaComplexType) schema.getTypeByName(responseTypeQName);
XmlSchemaParticle xmlSchemaParticle = xmlSchemaType.getParticle();
if (xmlSchemaParticle != null && xmlSchemaParticle instanceof XmlSchemaSequence) {
XmlSchemaObjectCollection xmlSchemaObjectCollection = ((XmlSchemaSequence)xmlSchemaParticle).getItems();
for (int i=0;i<xmlSchemaObjectCollection.getCount();i++) {
XmlSchemaObject xso = xmlSchemaObjectCollection.getItem(i);
if (xso instanceof XmlSchemaElement) {
XmlSchemaElement xmlSchemaElement = (XmlSchemaElement)xso;
String elName = xmlSchemaElement.getName();
QName elType = xmlSchemaElement.getSchemaTypeName();
String value = "<xsd:element name=\""+elName+"\" type=\""+elType.getPrefix()+":"+elType.getLocalPart()+"\"/>";
types.add(value);
}
}
}
}
catch (Exception e) {
}
return types;
}
示例12: JAXBHeader
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public JAXBHeader(XMLBridge bridge, Object jaxbObject) {
this.jaxbObject = jaxbObject;
this.bridge = bridge;
QName tagName = bridge.getTypeInfo().tagName;
this.nsUri = tagName.getNamespaceURI();
this.localName = tagName.getLocalPart();
}
示例13: parseServiceName
import javax.xml.namespace.QName; //导入方法依赖的package包/类
public static String parseServiceName(SOAPMessageContext context) {
String serviceName = "";
QName serviceQName = (QName) context.get(MessageContext.WSDL_SERVICE);
if (serviceQName != null) {
serviceName = serviceQName.getLocalPart();
}
return serviceName;
}
示例14: 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);
}
}
示例15: 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();
}