javolution.xml.stream.XMLStreamReader.getLocation()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中javolution.xml.stream.XMLStreamReader.getLocation()方法的一些代码示例,展示了XMLStreamReader.getLocation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLStreamReader.getLocation()方法的具体详情如下:
包路径:javolution.xml.stream.XMLStreamReader
类名称:XMLStreamReader
方法名:getLocation

XMLStreamReader.getLocation介绍

[英]Return the current location of the processor. If the Location is unknown the processor should return an implementation of Location that returns -1 for the location and null for the publicId and systemId. The location information is only valid until next() is called.
[中]返回处理器的当前位置。如果位置未知,处理器应该返回一个位置实现,该位置返回-1,publicId和systemId返回null。位置信息仅在调用next()之前有效。

代码示例

代码示例来源: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: 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: 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;
}

相关文章