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


Java XMLStreamReader.isEndElement方法代码示例

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


在下文中一共展示了XMLStreamReader.isEndElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseXmlTestResults

import javax.xml.stream.XMLStreamReader; //导入方法依赖的package包/类
/**
 * Parses Xml file entry and public test results.
 * @param xmlEntry Xml file entry
 * @param testSuiteName name of test suite
 */
private void parseXmlTestResults(@NotNull final String xmlEntry, @NotNull final String testSuiteName){
  Boolean isTestXml = false;
  try {
    final XMLInputFactory f = XMLInputFactory.newInstance();
    final XMLStreamReader reader = f.createXMLStreamReader(new StringReader(xmlEntry));
    String testResult = null;
    String testName = null;
    String tempTag = "";
    String testOutput = "";
    while (reader.hasNext()){
      if (!isTestXml && reader.hasName()){
        if (!reader.getLocalName().equalsIgnoreCase("testsuite")){
          break;
        }
        isTestXml = true;
        if (myTestsReporter != null) {
          myTestsReporter.publicTestSuiteStarted(testSuiteName);
        }
      }
      if (reader.isStartElement() && reader.hasName() && reader.getLocalName().equalsIgnoreCase("test")){
        testResult = null;
        testName = null;
      }
      if (reader.isEndElement() && reader.hasName() && reader.getLocalName().equalsIgnoreCase("test")){
        myTestsCount += testResult != null && testName != null ? 1 : 0;
        if (myTestsReporter != null && testResult != null && testName != null){
          myTestsReporter.publicTestCaseInfo(testName, testResult, testOutput);
        }
      }

      if (reader.hasName()){
        tempTag = reader.getLocalName();
      }
      if (reader.hasText()){
        if (tempTag.equalsIgnoreCase("result")){
          testResult = reader.getText();
        }
        else {
          if (tempTag.equalsIgnoreCase("name")) {
            testName = reader.getText();
          } else if (tempTag.equalsIgnoreCase("output")) {
            testOutput = reader.getText();
          }
        }
      }
      reader.next();
    }
    reader.close();
  } catch (final XMLStreamException e) {
    myTestsCount = 0;
    if (myTestsReporter != null) {
      myTestsReporter.reportWarning("DejagnuTestsXMLParser:" + e.getMessage());
    }
    else{
      System.out.println("DejagnuTestsXMLParser: " + e.getMessage());
    }
  }
  finally {
      if (isTestXml && myTestsReporter != null){
      myTestsReporter.publicTestSuiteFinished(testSuiteName);
    }
  }
}
 
开发者ID:unix-junkie,项目名称:teamcity-autotools-plugin,代码行数:69,代码来源:DejagnuTestsXMLParser.java

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


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