本文整理了Java中gov.nist.toolkit.utilities.xml.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:gov.nist.toolkit.utilities.xml.Util
类名称:Util
暂无
代码示例来源:origin: usnistgov/iheos-toolkit2
public static OMElement parse_xml(String input) throws FactoryConfigurationError, XdsInternalException {
return parse_xml(input, null);
}
代码示例来源: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 static OMElement xmlizeHashMap(HashMap<String, ?> map) {
OMElement map_ele = OMAbstractFactory.getOMFactory().createOMElement("Map", null);
for (Iterator it=map.keySet().iterator(); it.hasNext(); ) {
String key = (String) it.next();
Object value = map.get(key);
OMElement item = mkElement("Item", null, map_ele);
mkElement("Key", key, item);
mkElement("Value", value.toString(), item);
}
return map_ele;
}
代码示例来源: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
@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
private static void removeProcessingInstructions(StringBuffer buf) {
boolean running = true;
while(running) {
while (isWhite(buf.charAt(0)))
buf.deleteCharAt(0);
running = false;
if (buf.length() > 2 && buf.charAt(0) == '<' && buf.charAt(1) == '?') {
int end = buf.indexOf("?>");
buf.delete(0, end+1);
running = true;
}
}
}
代码示例来源: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 OMFormatter(File file) throws XdsInternalException, FactoryConfigurationError {
ele = Util.parse_xml(file);
}
代码示例来源: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 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 OMFormatter(String xml) throws XdsInternalException, FactoryConfigurationError {
if (xml == null || xml.equals(""))
ele = null;
else
ele = Util.parse_xml(xml);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
metadata_ele = metadata;
else
metadata_ele = Util.parse_xml(new File(metadata_filename));
compileUseIdLinkage(m, use_id);
testLog.add_name_value(instruction_output, "InputMetadata", Util.deep_copy(metadata_ele));
代码示例来源: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
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
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
static public Metadata parse(String metadata) throws XdsInternalException, MetadataException {
OMElement ele = Util.parse_xml(metadata);
return parse(ele);
}
}
代码示例来源: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
public LogFileContentDTO build(OMElement testresults, boolean incompleteOk) throws Exception {
log = Util.parse_xml(testresults);
init(incompleteOk);
return c;
}
代码示例来源: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
public Metadata(File metadata_file) throws XdsInternalException,
MetadataException, MetadataValidationException {
metadata = Util.parse_xml(metadata_file);
runParser();
}
内容来源于网络,如有侵权,请联系作者删除!