本文整理了Java中javolution.xml.stream.XMLStreamReader.getAttributeValue()
方法的一些代码示例,展示了XMLStreamReader.getAttributeValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLStreamReader.getAttributeValue()
方法的具体详情如下:
包路径:javolution.xml.stream.XMLStreamReader
类名称:XMLStreamReader
方法名:getAttributeValue
[英]Returns the value of the attribute at the index.
[中]返回索引处的属性值。
代码示例来源:origin: io.github.msdk/msdk-io-mzml
/**
* <p>
* Call this method when the <code>xmlStreamReader</code> enters <code><cvParam></code> tag
* </p>
*
* @param xmlStreamReader an instance of {@link javolution.xml.internal.stream.XMLStreamReaderImpl
* XMLStreamReaderImpl
* @return {@link io.github.msdk.io.mzml.data.MzMLCVParam MzMLCVParam} object notation of the
* <code><cvParam></code> entered
*/
private MzMLCVParam createMzMLCVParam(XMLStreamReader xmlStreamReader) {
CharArray accession = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_ACCESSION);
CharArray value = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_VALUE);
CharArray name = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_NAME);
CharArray unitAccession = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_UNIT_ACCESSION);
// accession is a required attribute
if (accession == null) {
throw new IllegalStateException("Any cvParam must have an accession.");
}
// these attributes are optional
String valueStr = value == null ? null : value.toString();
String nameStr = name == null ? null : name.toString();
String unitAccessionStr = unitAccession == null ? null : unitAccession.toString();
return new MzMLCVParam(accession.toString(), valueStr, nameStr, unitAccessionStr);
}
代码示例来源:origin: msdk/msdk
/**
* <p>
* Call this method when the <code>xmlStreamReader</code> enters <code><cvParam></code> tag
* </p>
*
* @param xmlStreamReader an instance of {@link javolution.xml.internal.stream.XMLStreamReaderImpl
* XMLStreamReaderImpl
* @return {@link io.github.msdk.io.mzml.data.MzMLCVParam MzMLCVParam} object notation of the
* <code><cvParam></code> entered
*/
private MzMLCVParam createMzMLCVParam(XMLStreamReader xmlStreamReader) {
CharArray accession = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_ACCESSION);
CharArray value = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_VALUE);
CharArray name = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_NAME);
CharArray unitAccession = xmlStreamReader.getAttributeValue(null, MzMLTags.ATTR_UNIT_ACCESSION);
// accession is a required attribute
if (accession == null) {
throw new IllegalStateException("Any cvParam must have an accession.");
}
// these attributes are optional
String valueStr = value == null ? null : value.toString();
String nameStr = name == null ? null : name.toString();
String unitAccessionStr = unitAccession == null ? null : unitAccession.toString();
return new MzMLCVParam(accession.toString(), valueStr, nameStr, unitAccessionStr);
}
代码示例来源:origin: io.github.msdk/msdk-io-mzml
/**
* <p>
* Gets the required attribute from xmlStreamReader, throws an exception if the attribute is not
* found
* </p>
*
* @param xmlStreamReader XMLStreamReader instance used to parse
* @param attr Attribute's value to be found
* @return a CharArray containing the value of the attribute.
*/
public CharArray getRequiredAttribute(XMLStreamReader xmlStreamReader, String attr) {
CharArray attrValue = xmlStreamReader.getAttributeValue(null, attr);
if (attrValue == null)
throw new IllegalStateException("Tag " + xmlStreamReader.getLocalName() + " must provide an `"
+ attr + "`attribute (Line " + xmlStreamReader.getLocation().getLineNumber() + ")");
return attrValue;
}
代码示例来源:origin: io.github.msdk/msdk-io-mzxml
/**
* <p>
* Gets the required attribute from xmlStreamReader, throws an exception of the attribute is not
* found
* </p>
*
* @return a CharArray containing the value of the attribute.
* @param xmlStreamReader a {@link javolution.xml.stream.XMLStreamReader} object.
* @param attr a {@link java.lang.String} object.
*/
public CharArray getRequiredAttribute(XMLStreamReader xmlStreamReader, String attr) {
CharArray attrValue = xmlStreamReader.getAttributeValue(null, attr);
if (attrValue == null)
throw new IllegalStateException("Tag " + xmlStreamReader.getLocalName() + " must provide an `"
+ attr + "`attribute (Line " + xmlStreamReader.getLocation().getLineNumber() + ")");
return attrValue;
}
代码示例来源:origin: msdk/msdk
/**
* <p>
* Gets the required attribute from xmlStreamReader, throws an exception if the attribute is not
* found
* </p>
*
* @param xmlStreamReader XMLStreamReader instance used to parse
* @param attr Attribute's value to be found
* @return a CharArray containing the value of the attribute.
*/
public CharArray getRequiredAttribute(XMLStreamReader xmlStreamReader, String attr) {
CharArray attrValue = xmlStreamReader.getAttributeValue(null, attr);
if (attrValue == null)
throw new IllegalStateException("Tag " + xmlStreamReader.getLocalName() + " must provide an `"
+ attr + "`attribute (Line " + xmlStreamReader.getLocation().getLineNumber() + ")");
return attrValue;
}
代码示例来源:origin: msdk/msdk
/**
* <p>
* Gets the required attribute from xmlStreamReader, throws an exception of the attribute is not
* found
* </p>
*
* @return a CharArray containing the value of the attribute.
* @param xmlStreamReader a {@link javolution.xml.stream.XMLStreamReader} object.
* @param attr a {@link java.lang.String} object.
*/
public CharArray getRequiredAttribute(XMLStreamReader xmlStreamReader, String attr) {
CharArray attrValue = xmlStreamReader.getAttributeValue(null, attr);
if (attrValue == null)
throw new IllegalStateException("Tag " + xmlStreamReader.getLocalName() + " must provide an `"
+ attr + "`attribute (Line " + xmlStreamReader.getLocation().getLineNumber() + ")");
return attrValue;
}
代码示例来源:origin: javolution/javolution
+ xml.getAttributeLocalName(i) + "("
+ xml.getAttributeNamespace(i) + "), Value: "
+ xml.getAttributeValue(i));
代码示例来源:origin: org.javolution/javolution-core-java
+ xml.getAttributeLocalName(i) + "("
+ xml.getAttributeNamespace(i) + "), Value: "
+ xml.getAttributeValue(i));
代码示例来源:origin: org.javolution/javolution-core-java
throw new XMLStreamException(
"Binding has no class attribute defined, cannot retrieve class");
classQName = QName.valueOf(reader.getAttributeValue(
_classAttribute.getNamespaceURI(),
_classAttribute.getLocalName()));
代码示例来源:origin: javolution/javolution
throw new XMLStreamException(
"Binding has no class attribute defined, cannot retrieve class");
classQName = QName.valueOf(reader.getAttributeValue(_classAttribute
.getNamespaceURI(), _classAttribute.getLocalName()));
if (classQName == null)
内容来源于网络,如有侵权,请联系作者删除!