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

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

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

Util.deep_copy介绍

暂无

代码示例

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

public void setXML(OMElement xml) throws XdsInternalException {
 // String str = new OMFormatter(xml).toString();
 // String str = in.toString();
 // XPath will search entire tree, even if we give it an intermediate node
 root = Util.deep_copy(xml);
}

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

protected void log_metadata(OMElement submission) throws XdsInternalException {
  testLog.add_name_value(    instruction_output,
      "InputMetadata", Util.deep_copy(submission));
}

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

public void addQueryResults(List<OMElement> metadatas)  throws XdsInternalException {
  OMElement res = getQueryResult();  // used for side effect if v3 and error - must
  // still have empty RegistryObjectList after RegistryErrorList
  if (metadatas != null)
    for (int i=0; i<metadatas.size(); i++) {
      res.addChild(Util.deep_copy((OMElement) metadatas.get(i)));
    }
}

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

public void addQueryResults(OMElement metadata)  throws XdsInternalException {
  OMElement res = getQueryResult();  // used for side effect if v3 and error - must
  // still have empty RegistryObjectList after RegistryErrorList
  if (metadata != null)
    res.addChild(Util.deep_copy(metadata));
}

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

void loadOutHeader() throws XdsInternalException {
  if (serviceClient == null)
    return;
  OperationContext oc = serviceClient.getLastOperationContext();
  if (oc == null)
    return;
  HashMap<String, MessageContext> ocs = oc.getMessageContexts();
  MessageContext out = ocs.get("Out");
  if (out == null)
    return;
  outHeader = Util.deep_copy(out.getEnvelope().getHeader());
}

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

@Override
public void add_name_value(OMElement parent, String name, ArrayList<OMElement> data) {
  for (OMElement ele : data) {
    OMElement elel = MetadataSupport.om_factory.createOMElement(name, null);
    try {
      elel.addChild(Util.deep_copy(ele));
    } catch (XdsInternalException e) {
      e.printStackTrace();
    }
    parent.addChild(elel);
  }
}

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

void loadInHeader() throws XdsInternalException {
  if (serviceClient == null)
    return;
  OperationContext oc = serviceClient.getLastOperationContext();
  if (oc == null)
    return;
  HashMap<String, MessageContext> ocs = oc.getMessageContexts();
  MessageContext in = ocs.get("In");
  if (in == null)
    return;
  if (in.getEnvelope() == null)
    return;
  if (in.getEnvelope().getHeader() == null)
    return;
  inHeader = Util.deep_copy(in.getEnvelope().getHeader());
  logger.info("incoming header loaded");
}

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

public OMElement translate(OMElement ro2, boolean must_dup) throws XdsInternalException {
  if (MetadataSupport.isV2Namespace(ro2.getNamespace()) && !must_dup)
    return Util.deep_copy(ro2);
  return  deep_copy(ro2, MetadataSupport.ebRIMns2);
}

代码示例来源: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 Metadata addToMetadata(OMElement new_metadata,
               boolean discard_duplicates, boolean run_parse)
    throws XdsInternalException, MetadataException,
    MetadataValidationException {
  boolean hasExistingData = false;
  if (wrapper == null) {
    wrapper = mkWrapper();
    metadata = new_metadata;
    if (wrappers == null)
      wrappers = new ArrayList<OMElement>();
    wrappers.add(wrapper);
  } else
    hasExistingData = true;
  wrapper.addChild(Util.deep_copy(new_metadata));
  if (run_parse)
    if (hasExistingData)
      reParse(discard_duplicates);
    else
      parse(discard_duplicates);
  return this;
}

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

public OMElement translate(OMElement ro2, boolean must_dup) throws XdsInternalException {
  if (MetadataSupport.isV3Namespace(ro2.getNamespace()) && !must_dup)
    return Util.deep_copy(ro2);
  m = new Metadata();
  return deep_copy(ro2, MetadataSupport.ebRIMns3);
}

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

data.addChild(wrapper);
if (is_this) wrapper.addChild(Util.deep_copy(file_root));
else wrapper.addChild(file_root);

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

private void parseResult() {
  try {
    OMElement result = XmlUtil.firstDecendentWithLocalName(root, "Result");
    if (result == null) {
      c.setResult("");
      return;
    }
    if (!hasChildElement(result)) {
      String text = result.getText();
      if (text != null) {
        text = text.trim();
        if (text.startsWith("{") || text.startsWith("<"))
          c.setResult(text);
      }
      else
        c.setResult(result.toString()); // Was c.setResult(result.getText());
      return;
    }
    OMElement copy = Util.deep_copy(result.getFirstElement());
    for (OMElement ele : XmlUtil.decendentsWithLocalName(copy, "Document", 4)) {
      String original = ele.getText();
      int size = (original == null || original.equals("")) ? 0 : original.length();
      ele.setText("Base64 contents removed by XDS Toolkit prior to display (" + size + " characters)");
    }
    c.setResult(xmlFormat(copy));
  } catch (Exception e) {
  }
}

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

@Override
  public OMElement add_name_value(OMElement parent, String name, OMElement value) {
    OMNode val = value;
    name = name.replaceAll(":", "");
    OMElement ele = MetadataSupport.om_factory.createOMElement(name, null);
    if (val == null)
      val = MetadataSupport.om_factory.createOMElement("None", null);
    else {
      try {
//                if (name.equals("InputMetadata")) {
//                    System.out.println("InputMetadata:\n" + new OMFormatter(value).toString());
//                }
        val = Util.deep_copy(value);
      } catch (Exception e) {}
    }
    try {
      ele.addChild(val);
    }
    catch (OMException e) {
      Util.mkElement("Exception", "Exception writing log content\n" + OMFormatter.encodeAmp(ExceptionUtil.exception_details(e))
          + "\n" + new OMFormatter(value).toString(), ele);
    }
    parent.addChild(ele);
    return ele;
  }

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

public void addRegistryErrorList(OMElement rel, List<String> errorCodesToFilter, LogMessage log_message) throws XdsInternalException {
  for (Iterator it=rel.getChildElements(); it.hasNext(); ) {
    OMElement registry_error = (OMElement) it.next();
    String code = registry_error.getAttributeValue(MetadataSupport.error_code_qname);
    if (errorCodesToFilter.contains(code))
      continue;
    if (log_message != null) {
      HashMap<String, String> err = getErrorDetails(registry_error);
      try {
        log_message.addErrorParam("Error", err.get("codeContext"));
      } catch (LoggerException e) {
        throw new XdsInternalException(ExceptionUtil.exception_details(e));
      }
    }
    OMElement registry_error_2 = Util.deep_copy(registry_error);
    logger.error("registry_error2 is \n" + registry_error_2.toString());
    if (this.getVersion() == RegistryErrorListGenerator.version_3)
      registry_error_2.setNamespace(MetadataSupport.ebRSns3);
    registryErrorList().addChild(registry_error_2);
    String severity = registry_error.getAttributeValue(MetadataSupport.severity_qname);
    severity = stripNamespace(severity);
    if (severity.equals("Error"))
      has_errors = true;
    else
      has_warnings = true;
  }
}

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

compileUseIdLinkage(m, use_id);
testLog.add_name_value(instruction_output, "InputMetadata", Util.deep_copy(metadata_ele));

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

Util.deep_copy(metadata.getRoot()));

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

Util.deep_copy(metadata.getRoot()));

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

parseIDSEndpoint(repositoryUniqueId, transactionType, testConfig.secure);
testLog.add_name_value(instruction_output, "InputMetadata", Util.deep_copy(request_ele));

相关文章