当前位置: 首页>>代码示例>>Java>>正文


Java XMLStreamReader.getAttributeLocalName方法代码示例

本文整理汇总了Java中javax.xml.stream.XMLStreamReader.getAttributeLocalName方法的典型用法代码示例。如果您正苦于以下问题:Java XMLStreamReader.getAttributeLocalName方法的具体用法?Java XMLStreamReader.getAttributeLocalName怎么用?Java XMLStreamReader.getAttributeLocalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.stream.XMLStreamReader的用法示例。


在下文中一共展示了XMLStreamReader.getAttributeLocalName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:OutboundStreamHeader.java

示例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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:OutboundReferenceParameterHeader.java

示例3: readKey

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private void readKey(XMLStreamReader xmlReader) {
	/*
	 * Currently, the attributes defined in GraphML for data types are not
	 * useful.
	 */
	String attrName, attrType, attrFor, attrId;

	for (int i = 0; i < xmlReader.getAttributeCount(); ++i) {
		String attr = xmlReader.getAttributeLocalName(i);

		if (attr.equalsIgnoreCase(ATTR_NAME)) {
			attrName = xmlReader.getAttributeValue(i);
		} else if (attr.equalsIgnoreCase(ATTR_TYPE)) {
			attrType = xmlReader.getAttributeValue(i);
		} else if (attr.equalsIgnoreCase(ATTR_FOR)) {
			attrFor = xmlReader.getAttributeValue(i);
		} else if (attr.equalsIgnoreCase(ATTR_ID)) {
			attrId = xmlReader.getAttributeValue(i);
		}
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:23,代码来源:GraphMLImporter.java

示例4: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:StreamHeader11.java

示例5: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:StreamHeader12.java

示例6: 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 + "'");
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:10,代码来源:XMLStreamHelper.java

示例7: readGraph

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
private void readGraph(XMLStreamReader xmlReader) {
	String edgeDefault = "";

	for (int i = 0; i < xmlReader.getAttributeCount(); ++i) {
		String attr = xmlReader.getAttributeLocalName(i);

		if (attr.equalsIgnoreCase(GRAPH_EDGEDEFAULT)) {
			edgeDefault = xmlReader.getAttributeValue(i);
		}
	}

	network.setDirected(edgeDefault.equalsIgnoreCase(EDGE_DIRECTED));
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:14,代码来源:GraphMLImporter.java

示例8: readNode

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
private void readNode(XMLStreamReader xmlReader) throws XMLStreamException {
	int attrId = 0;
	Vertex v = null;

	for (int i = 0; i < xmlReader.getAttributeCount(); ++i) {
		String attr = xmlReader.getAttributeLocalName(i);

		if (attr.equalsIgnoreCase(NODE_ID)) {
			attrId = Integer.parseInt(xmlReader.getAttributeValue(i));
		}
	}

	v = new Vertex(attrId);

	boolean elemEnd = false;

	while (xmlReader.hasNext() && !elemEnd) {
		int event = xmlReader.next();

		if (event == XMLEvent.START_ELEMENT) {
			if (xmlReader.getLocalName().equalsIgnoreCase(DATA)) {
				readNodeData(xmlReader, v);
			}

		} else if (event == XMLEvent.END_ELEMENT) {
			if (xmlReader.getLocalName().equalsIgnoreCase(NODE)) {
				elemEnd = true;
			}
		}
	}

	network.addVertex(v);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:34,代码来源:GraphMLImporter.java

示例9: readNodeData

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
private void readNodeData(XMLStreamReader xmlReader, Vertex v)
		throws XMLStreamException {
	String key = "", value = "";

	for (int i = 0; i < xmlReader.getAttributeCount(); ++i) {
		String attr = xmlReader.getAttributeLocalName(i);

		if (attr.equalsIgnoreCase(KEY)) {
			key = xmlReader.getAttributeValue(i);
		}
	}

	value = xmlReader.getElementText();
	double x = v.getPosition() != null ? v.getPosition().getX() : 0;
	double y = v.getPosition() != null ? v.getPosition().getY() : 0;
	int r = v.getFillColor().getRed(), g = v.getFillColor().getGreen(), b = v
			.getFillColor().getBlue();

	if (!value.isEmpty()) {
		if (key.equalsIgnoreCase(NODE_LABEL)) {
			v.setLabel(value);
		} else if (key.equalsIgnoreCase(NODE_X)) {
			v.setPosition(Double.parseDouble(value), y);
		} else if (key.equalsIgnoreCase(NODE_Y)) {
			v.setPosition(x, Double.parseDouble(value));
		} else if (key.equalsIgnoreCase(NODE_SIZE)) {
			v.setSize(Double.parseDouble(value));
		} else if (key.equalsIgnoreCase(NODE_R)) {
			r = Integer.parseInt(value);
			v.setFillColor(new Color(r, g, b));
		} else if (key.equalsIgnoreCase(NODE_G)) {
			g = Integer.parseInt(value);
			v.setFillColor(new Color(r, g, b));
		} else if (key.equalsIgnoreCase(NODE_B)) {
			b = Integer.parseInt(value);
			v.setFillColor(new Color(r, g, b));
		}
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:40,代码来源:GraphMLImporter.java

示例10: readEdgeData

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
private void readEdgeData(XMLStreamReader xmlReader, Edge e)
		throws XMLStreamException {
	String key = "", value = "";

	for (int i = 0; i < xmlReader.getAttributeCount(); ++i) {
		String attr = xmlReader.getAttributeLocalName(i);

		if (attr.equalsIgnoreCase(KEY)) {
			key = xmlReader.getAttributeValue(i);
		}
	}

	value = xmlReader.getElementText();
	int r = e.getColor().getRed(), g = e.getColor().getGreen(), b = e
			.getColor().getBlue();

	if (!value.isEmpty()) {
		if (key.equalsIgnoreCase(EDGE_LABEL)) {
			e.setLabel(value);
		} else if (key.equalsIgnoreCase(EDGE_WIDTH)) {
			e.setWidth(Double.parseDouble(value));
		} else if (key.equalsIgnoreCase(EDGE_WEIGHT)) {
			e.setWeight(Double.parseDouble(value));
		} else if (key.equalsIgnoreCase(EDGE_R)) {
			r = Integer.parseInt(value);
			e.setColor(new Color(r, g, b));
		} else if (key.equalsIgnoreCase(EDGE_G)) {
			g = Integer.parseInt(value);
			e.setColor(new Color(r, g, b));
		} else if (key.equalsIgnoreCase(EDGE_B)) {
			b = Integer.parseInt(value);
			e.setColor(new Color(r, g, b));
		}
	}

}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:37,代码来源:GraphMLImporter.java

示例11: readEdge

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
private void readEdge(XMLStreamReader xmlReader) throws XMLStreamException {
	int src = 0, dest = 0;
	boolean directed = false;
	boolean elemEnd = false;
	Edge e = null;

	for (int i = 0; i < xmlReader.getAttributeCount(); ++i) {
		String attr = xmlReader.getAttributeLocalName(i);

		if (attr.equalsIgnoreCase(EDGE_SRC)) {
			src = Integer.parseInt(xmlReader.getAttributeValue(i));
		} else if (attr.equalsIgnoreCase(EDGE_DEST)) {
			dest = Integer.parseInt(xmlReader.getAttributeValue(i));
		} else if (attr.equalsIgnoreCase(EDGE_DIRECTED)) {
			directed = Boolean.parseBoolean(xmlReader.getAttributeValue(i));
		}
	}

	e = new Edge();
	Vertex vs = null, vt = null;

	for (Vertex v : network.getVertices()) {
		if (v.getId() == src)
			vs = v;
		if (v.getId() == dest)
			vt = v;

		if (vs != null && vt != null)
			break;
	}

	while (xmlReader.hasNext() && !elemEnd) {
		int event = xmlReader.next();

		if (event == XMLEvent.START_ELEMENT) {
			if (xmlReader.getLocalName().equalsIgnoreCase(DATA)) {
				readEdgeData(xmlReader, e);
			}

		} else if (event == XMLEvent.END_ELEMENT) {
			if (xmlReader.getLocalName().equalsIgnoreCase(EDGE)) {
				elemEnd = true;
			}
		}
	}

	network.addEdge(e, vs, vt, (directed ? EdgeType.DIRECTED
			: EdgeType.UNDIRECTED));
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:50,代码来源:GraphMLImporter.java


注:本文中的javax.xml.stream.XMLStreamReader.getAttributeLocalName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。