本文整理匯總了Java中javax.xml.stream.XMLStreamReader.getAttributeNamespace方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLStreamReader.getAttributeNamespace方法的具體用法?Java XMLStreamReader.getAttributeNamespace怎麽用?Java XMLStreamReader.getAttributeNamespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.stream.XMLStreamReader
的用法示例。
在下文中一共展示了XMLStreamReader.getAttributeNamespace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseAttributes
import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
/**
* We don't really expect this to be used, but just to satisfy
* the {@link Header} contract.
*
* So this is rather slow.
*/
private void parseAttributes() {
try {
XMLStreamReader reader = readHeader();
attributes = new FinalArrayList<Attribute>();
for (int i = 0; i < reader.getAttributeCount(); i++) {
final String localName = reader.getAttributeLocalName(i);
final String namespaceURI = reader.getAttributeNamespace(i);
final String value = reader.getAttributeValue(i);
attributes.add(new Attribute(namespaceURI,localName,value));
}
} catch (XMLStreamException e) {
throw new WebServiceException("Unable to read the attributes for {"+nsUri+"}"+localName+" header",e);
}
}
示例2: parseAttributes
import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
/**
* We don't really expect this to be used, but just to satisfy
* the {@link Header} contract.
*
* So this is rather slow.
*/
private void parseAttributes() {
try {
XMLStreamReader reader = readHeader();
reader.nextTag(); // move to the first element, which is the header element
attributes = new FinalArrayList<Attribute>();
boolean refParamAttrWritten = false;
for (int i = 0; i < reader.getAttributeCount(); i++) {
final String attrLocalName = reader.getAttributeLocalName(i);
final String namespaceURI = reader.getAttributeNamespace(i);
final String value = reader.getAttributeValue(i);
if (namespaceURI.equals(AddressingVersion.W3C.nsUri)&& attrLocalName.equals("IS_REFERENCE_PARAMETER")) {
refParamAttrWritten = true;
}
attributes.add(new Attribute(namespaceURI,attrLocalName,value));
}
// we are adding one more attribute "wsa:IsReferenceParameter", if its not alrady there
if (!refParamAttrWritten) {
attributes.add(new Attribute(AddressingVersion.W3C.nsUri,IS_REFERENCE_PARAMETER,TRUE_VALUE));
}
} catch (XMLStreamException e) {
throw new WebServiceException("Unable to read the attributes for {"+nsUri+"}"+localName+" header",e);
}
}
示例3: processHeaderAttributes
import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
protected final FinalArrayList<Attribute> processHeaderAttributes(XMLStreamReader reader) {
FinalArrayList<Attribute> atts = null;
_role = SOAPConstants.URI_SOAP_ACTOR_NEXT;
for (int i = 0; i < reader.getAttributeCount(); i++) {
final String localName = reader.getAttributeLocalName(i);
final String namespaceURI = reader.getAttributeNamespace(i);
final String value = reader.getAttributeValue(i);
if (SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(namespaceURI)) {
if (SOAP_1_1_MUST_UNDERSTAND.equals(localName)) {
_isMustUnderstand = Util.parseBool(value);
} else if (SOAP_1_1_ROLE.equals(localName)) {
if (value != null && value.length() > 0) {
_role = value;
}
}
}
if(atts==null) {
atts = new FinalArrayList<Attribute>();
}
atts.add(new Attribute(namespaceURI,localName,value));
}
return atts;
}
示例4: processHeaderAttributes
import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
protected final FinalArrayList<Attribute> processHeaderAttributes(XMLStreamReader reader) {
FinalArrayList<Attribute> atts = null;
_role = SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER;
for (int i = 0; i < reader.getAttributeCount(); i++) {
final String localName = reader.getAttributeLocalName(i);
final String namespaceURI = reader.getAttributeNamespace(i);
final String value = reader.getAttributeValue(i);
if (SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(namespaceURI)) {
if (SOAP_1_2_MUST_UNDERSTAND.equals(localName)) {
_isMustUnderstand = Util.parseBool(value);
} else if (SOAP_1_2_ROLE.equals(localName)) {
if (value != null && value.length() > 0) {
_role = value;
}
} else if (SOAP_1_2_RELAY.equals(localName)) {
_isRelay = Util.parseBool(value);
}
}
if(atts==null) {
atts = new FinalArrayList<Attribute>();
}
atts.add(new Attribute(namespaceURI,localName,value));
}
return atts;
}
示例5: printAttribute
import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
protected static void printAttribute(XMLStreamReader xmlr, int index) {
String prefix = xmlr.getAttributePrefix(index);
String namespace = xmlr.getAttributeNamespace(index);
String localName = xmlr.getAttributeLocalName(index);
String value = xmlr.getAttributeValue(index);
System.out.print(" ");
printName(prefix, namespace, localName);
System.out.print("='" + value + "'");
}