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


Java XMLStreamReader.getAttributeValue方法代码示例

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


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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:StreamHeader11.java

示例7: AttributesImpl

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public AttributesImpl(XMLStreamReader reader) {
    if (reader == null) {

        // this is the case when we call getAttributes() on the
        // reader when it is not on a start tag
        atInfos = new AttributeInfo[0];
    } else {

        // this is the normal case
        int index = 0;
        int namespaceCount = reader.getNamespaceCount();
        int attributeCount = reader.getAttributeCount();
        atInfos = new AttributeInfo[namespaceCount + attributeCount];
        for (int i=0; i<namespaceCount; i++) {
            String namespacePrefix = reader.getNamespacePrefix(i);

            // will be null if default prefix. QName can't take null
            if (namespacePrefix == null) {
                namespacePrefix = "";
            }
            atInfos[index++] = new AttributeInfo(
                new QName(XMLNS_NAMESPACE_URI,
                    namespacePrefix,
                    "xmlns"),
                reader.getNamespaceURI(i));
        }
        for (int i=0; i<attributeCount; i++) {
            atInfos[index++] = new AttributeInfo(
                reader.getAttributeName(i),
                reader.getAttributeValue(i));
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XMLStreamReaderUtil.java

示例8: addressibleElement

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.W3C.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new AddressingFeature(true, Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:W3CAddressingWSDLParserExtension.java

示例9: readOptionalIntegerAttribute

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public static Integer readOptionalIntegerAttribute(XMLStreamReader reader, String attributeName) {
    String attributeValue = reader.getAttributeValue(null, attributeName);
    return attributeValue != null ? Integer.valueOf(attributeValue) : null;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:5,代码来源:XmlUtil.java

示例10: readOptionalFloatAttribute

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public static float readOptionalFloatAttribute(XMLStreamReader reader, String attributeName, float defaultValue) {
    String attributeValue = reader.getAttributeValue(null, attributeName);
    return attributeValue != null ? Float.valueOf(attributeValue) : defaultValue;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:5,代码来源:XmlUtil.java

示例11: fromXml

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public static List<SecurityIndex> fromXml(String contingencyId, Reader reader) {
    List<SecurityIndex> indexes = new ArrayList<>();
    try {
        XMLStreamReader xmlsr = XML_INPUT_FACTORY_SUPPLIER.get().createXMLStreamReader(reader);
        while (xmlsr.hasNext()) {
            int eventType = xmlsr.next();
            switch (eventType) {
                case XMLEvent.START_ELEMENT:
                    switch (xmlsr.getLocalName()) {
                        case "index":
                            switch (xmlsr.getAttributeValue(null, "name")) {
                                case OverloadSecurityIndex.XML_NAME:
                                    indexes.add(OverloadSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case UnderOverVoltageSecurityIndex.XML_NAME:
                                    indexes.add(UnderOverVoltageSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case SmallSignalSecurityIndex.XML_NAME:
                                    indexes.add(SmallSignalSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TransientSecurityIndex.XML_NAME:
                                    indexes.add(TransientSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoOverloadSecurityIndex.XML_NAME:
                                    indexes.add(TsoOverloadSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoOvervoltageSecurityIndex.XML_NAME:
                                    indexes.add(TsoOvervoltageSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoUndervoltageSecurityIndex.XML_NAME:
                                    indexes.add(TsoUndervoltageSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoFrequencySecurityIndex.XML_NAME:
                                    indexes.add(TsoFrequencySecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoSynchroLossSecurityIndex.XML_NAME:
                                    indexes.add(TsoSynchroLossSecurityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoGeneratorVoltageAutomaton.XML_NAME:
                                    indexes.add(TsoGeneratorVoltageAutomaton.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoGeneratorSpeedAutomaton.XML_NAME:
                                    indexes.add(TsoGeneratorSpeedAutomaton.fromXml(contingencyId, xmlsr));
                                    break;
                                case TsoDisconnectedGenerator.XML_NAME:
                                    indexes.add(TsoDisconnectedGenerator.fromXml(contingencyId, xmlsr));
                                    break;
                                case MultiCriteriaVoltageStabilityIndex.XML_NAME:
                                    indexes.add(MultiCriteriaVoltageStabilityIndex.fromXml(contingencyId, xmlsr));
                                    break;
                                case MultiCriteriaVoltageStabilityIndex2.XML_NAME:
                                    indexes.add(MultiCriteriaVoltageStabilityIndex2.fromXml(contingencyId, xmlsr));
                                    break;
                                default:
                                    throw new AssertionError("Unexpected attribute value: " + xmlsr.getAttributeValue(null, "name"));
                            }
                            break;

                        default:
                            throw new AssertionError("Unexpected element: " + xmlsr.getLocalName());
                    }
                    break;

                default:
                    break;
            }
        }
    } catch (XMLStreamException e) {
        throw new UncheckedXmlStreamException(e);
    }
    return indexes;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:73,代码来源:SecurityIndexParser.java

示例12: getRawGaze

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public NewRawGaze getRawGaze(XMLStreamReader reader) throws XMLStreamException {
	String file = reader.getAttributeValue(0);
	String type = reader.getAttributeValue(1);
	double x = Double.parseDouble(reader.getAttributeValue(2));
	double y = Double.parseDouble(reader.getAttributeValue(3));
	double leftValidity = Double.parseDouble(reader.getAttributeValue(4));
	double rightValidity = Double.parseDouble(reader.getAttributeValue(5));
	double leftPupilDiam = Double.parseDouble(reader.getAttributeValue(6));
	double rightPupilDiam = Double.parseDouble(reader.getAttributeValue(7));
	long trackerTime = Long.parseLong(reader.getAttributeValue(8));
	long systemTime = Long.parseLong(reader.getAttributeValue(9));
	long nanoTime = Long.parseLong(reader.getAttributeValue(10));
	String path = reader.getAttributeValue(11);
	int lineHeight = Integer.parseInt(reader.getAttributeValue(12));
	int fontHeight = Integer.parseInt(reader.getAttributeValue(13));
	int line = Integer.parseInt(reader.getAttributeValue(14));
	int col = Integer.parseInt(reader.getAttributeValue(15));
	int lineBaseX = Integer.parseInt(reader.getAttributeValue(16));
	int lineBaseY = Integer.parseInt(reader.getAttributeValue(17));
	ArrayList<SourceCodeEntity> sces = new ArrayList<SourceCodeEntity>();
	
	reader.next();
	reader.next();
	while(!reader.isEndElement()) {
		String name = reader.getAttributeValue(0);
		String Type = reader.getAttributeValue(1);
		String how = reader.getAttributeValue(2);
		int length = Integer.parseInt(reader.getAttributeValue(3));
		int startLine = Integer.parseInt(reader.getAttributeValue(4));
		int endLine = Integer.parseInt(reader.getAttributeValue(5));
		int startCol = Integer.parseInt(reader.getAttributeValue(6));
		int endCol = Integer.parseInt(reader.getAttributeValue(7));
		
		sces.add(new SourceCodeEntity(name, Type, how, length,
				startLine, endLine, startCol, endCol));
		reader.next();
		reader.next();
	}
	
	return new NewRawGaze(file, type, x, y, leftValidity, rightValidity,
			leftPupilDiam, rightPupilDiam, trackerTime, systemTime,
			nanoTime, path, lineHeight, fontHeight, lineBaseX, line,
			col, lineBaseY, sces);
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:45,代码来源:XMLBasicFixationFilter.java

示例13: getAttribute

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public static String getAttribute(XMLStreamReader reader, String name) {
    return reader.getAttributeValue(null, name);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ParserUtil.java

示例14: getAttribute

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public static String getAttribute(XMLStreamReader reader, QName name) {
    return reader.getAttributeValue(name.getNamespaceURI(), name.getLocalPart());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:ParserUtil.java

示例15: SpectrumIndexer

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
public SpectrumIndexer(XMLStreamReader xr) {
	this.name = xr.getAttributeValue(null, "name");
	this.idToOffsets = new HashMap<String, Long>();
	this.offsets = new ArrayList<Long>();
}
 
开发者ID:digitalproteomics,项目名称:dp-mzml,代码行数:6,代码来源:SpectrumIndexer.java


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