gov.nist.toolkit.utilities.xml.Util.parse_xml()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(157)

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

Util.parse_xml介绍

暂无

代码示例

代码示例来源:origin: usnistgov/iheos-toolkit2

public OMFormatter(String xml) throws XdsInternalException, FactoryConfigurationError {
  if (xml == null || xml.equals(""))
    ele = null;
  else
    ele = Util.parse_xml(xml);
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public static OMElement parse_xml(Object o) throws FactoryConfigurationError, XdsInternalException {
  if (o instanceof String)
    return parse_xml((String) o);
  if (o instanceof InputStream)
    return parse_xml((InputStream) o);
  if (o instanceof File)
    return parse_xml((File) o);
  if (o instanceof OMElement)
    return (OMElement) o;
  throw new XdsInternalException("Util.parse_xml(): do not understand input format " + o.getClass().getName());
}

代码示例来源:origin: usnistgov/iheos-toolkit2

static public Metadata parse(String metadata) throws XdsInternalException, MetadataException {
    OMElement ele = Util.parse_xml(metadata);
    return parse(ele);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public Metadata(File metadata_file) throws XdsInternalException,
    MetadataException, MetadataValidationException {
  metadata = Util.parse_xml(metadata_file);
  runParser();
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public LogFileContentDTO build(OMElement testresults, boolean incompleteOk) throws Exception {
  log = Util.parse_xml(testresults);
  init(incompleteOk);
  return c;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public LogFileContentDTO build(File logfile, boolean incompleteOk) throws Exception {
//        c.setInputFile(logfile);
    FileInputStream fis = new FileInputStream(logfile);
    if (fis != null) {
      log = Util.parse_xml(fis);
      init(false);
      fis.close();
    }
    return c;
  }

代码示例来源:origin: usnistgov/iheos-toolkit2

/**
* get parsed log.xml file for desired test step.
* @param test_dir String path of test step we want log from, relative to
* this test step. For example, "../12029/submit".
* @return parsed log.xml file root element.
* @throws FactoryConfigurationError if your xml parser is really messed up.
* @throws XdsInternalException if the log.xml file is missing or messed up.
*/
public OMElement getLogContents(String test_dir) throws FactoryConfigurationError, XdsInternalException {
 if (debug) logger.info("Load LogFile " + getLogFileName(test_dir));
 return Util.parse_xml(new File(getLogFileName(test_dir)));
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public SectionDefinitionDAO getSection(String sectionName) throws XdsInternalException {
  if (sectionName == null) {
    return parseTestPlan(Util.parse_xml(new File(testDir, "testplan.xml")), sectionName);
  }
  try {
    return parseTestPlan(Util.parse_xml(new File(new File(testDir, sectionName), "testplan.xml")), sectionName);
  } catch (Exception e) {
    throw new XdsInternalException("Unable to load test definition for test " + getId() + " section " + sectionName, e);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public AllCodes load(File codesFile)  {
  try {
    OMElement rawCodes = Util.parse_xml(codesFile);
    return new CodesParser().parse(rawCodes);
  } catch (Exception e) {
    throw new RuntimeException("Cannot load codes file <" + codesFile + ">.");
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

static public void main(String[] args) {
    OMElement ele;
    try {
      ele = Util.parse_xml(new File(args[0]));
      System.out.println(new OMFormatter(ele).toString());
    } catch (Exception e) {
      System.out.println(ExceptionUtil.exception_details(e));
    } 
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public XdstestLog(File logfile) throws XdsInternalException, FactoryConfigurationError {
  OMElement log = Util.parse_xml(logfile);
  List<OMElement> stepLst = XmlUtil.childrenWithLocalName(log, "TestStep");
  for (OMElement stp : stepLst) {
    String id = stp.getAttributeValue(MetadataSupport.id_qname);
    steps.put(id, stp);
  }
  status = "Pass".equals((log.getAttributeValue(new QName("status"))));
}

代码示例来源:origin: usnistgov/iheos-toolkit2

static void test1() throws XdsInternalException, FactoryConfigurationError {
  String x = "<foo/>";
  OMElement x_ele = Util.parse_xml(x);
  OMElement y_ele = Util.deep_copy(x_ele);
  if (!y_ele.getLocalName().equals("foo"))
    System.out.println("test1 fails, name is " + y_ele.getLocalName());
  OMElement z_ele = Util.parse_xml("<z/>");
  z_ele.addChild(y_ele);
  System.out.println("test1: " + z_ele.toString());
}

代码示例来源:origin: usnistgov/iheos-toolkit2

static void test2() throws XdsInternalException, FactoryConfigurationError {
  String x = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <foo/>";
  OMElement x_ele = Util.parse_xml(x);
  OMElement y_ele = Util.deep_copy(x_ele);
  if (!y_ele.getLocalName().equals("foo"))
    System.out.println("test2 fails, name is " + y_ele.getLocalName());
  OMElement z_ele = Util.parse_xml("<z/>");
  z_ele.addChild(y_ele);
  System.out.println("test2: " + z_ele.toString());
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public static OMElement deep_copy(OMElement in) throws XdsInternalException {
    String str = new OMFormatter(in).toString();
//        String str = in.toString();
    OMElement res = parse_xml(str);
    return res;
  }

代码示例来源:origin: usnistgov/iheos-toolkit2

public Validator(File test_assertion_file, String subset_name) throws XdsInternalException {
  test_assertions = Util.parse_xml(test_assertion_file);
  if (subset_name != null) {
    test_assertions = XmlUtil.firstChildWithLocalName(test_assertions, subset_name);
    if ( test_assertions == null)
      throw new XdsInternalException("Validator: assertion subset " + subset_name + " not found in file " + test_assertion_file);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

void walkTestPlan(File testPlanFile) throws FactoryConfigurationError, Exception {
  OMElement testplanEle = Util.parse_xml(testPlanFile);
  List<OMElement> steps = XmlUtil.childrenWithLocalName(testplanEle, "TestStep");
  for(int i=0; i<steps.size(); i++) {
    OMElement stepEle = steps.get(i);
    doStep(stepEle.getLocalName());
  }
}
protected String join(String[] parts, int first, int last, String separator) {

代码示例来源:origin: usnistgov/iheos-toolkit2

OMElement sign(OMElement element) throws XdsInternalException {
  byte[] in = element.toString().getBytes();
  XMLDSigProcessor dsig = new XMLDSigProcessor();
  try {
    byte[] out = dsig.signSAMLAssertionsEnveloped(in);
    OMElement outEle = Util.parse_xml(new ByteArrayInputStream(out));
    return outEle;
  } catch (Exception e) {
    throw new XdsInternalException(e.getMessage(), e);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public void findBadCodesTest() throws XdsInternalException, FactoryConfigurationError {
  OMElement rawCode = Util.parse_xml(classificationsString);
  CodeUpdater engine = new CodeUpdater();
  engine.init(codesFile);
  List<OMElement> badCodes = engine.nonConformingCodes(rawCode);
  assertEquals(1, badCodes.size());
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public void codeFromClassificationTest() throws XdsInternalException, FactoryConfigurationError {
  OMElement rawCode = Util.parse_xml(classificationString);
  CodeUpdater engine = new CodeUpdater();
  Code code = engine.code(rawCode);
  assertTrue("DEMO-Procedure".equals(code.getCode()));
  assertTrue("Procedure".equals(code.getDisplay()));
  assertTrue("1.3.6.1.4.1.21367.100.1".equals(code.getScheme()));
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public void updateCodeTest() throws XdsInternalException, FactoryConfigurationError {
  OMElement rawCode = Util.parse_xml(classificationString);
  CodeUpdater engine = new CodeUpdater();
  Code code = new Code("MyCode", "MyScheme", "MyDisplay");
  engine.updateClassification(rawCode, code);
  Code code2 = engine.code(rawCode);
  assertTrue(code.equals(code2));
}

相关文章