本文整理汇总了Java中com.thoughtworks.xstream.io.HierarchicalStreamReader.getNodeName方法的典型用法代码示例。如果您正苦于以下问题:Java HierarchicalStreamReader.getNodeName方法的具体用法?Java HierarchicalStreamReader.getNodeName怎么用?Java HierarchicalStreamReader.getNodeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.xstream.io.HierarchicalStreamReader
的用法示例。
在下文中一共展示了HierarchicalStreamReader.getNodeName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
/**
* reads a <code>VariableNodeForSummary</code> from the XML file specified through
* <code>reader</code>
*
* @pre <code>reader</code> leads to a valid <code>Operation</code>
* @post the <code>VariableNodeForSummary</code> is read from the XML file and returned
* @param reader stream to read through
* @param context <code>UnmarshallingContext</code> used to store generic
* data
* @return <code>VariableNodeForSummary</code> - <code>VariableNodeForSummary</code> read from file
* specified by <code>reader</code>
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
ExpressionTreeInterface variable = null;
String variableType = reader.getNodeName();
reader.moveDown();
String variableName = reader.getValue();
reader.moveUp();
switch (variableType) {
case "VariableNodeForSummary":
variable = new VariableNodeForSummary(variableName);
break;
case "VariableNodeForPerSpotTaskExpressions":
variable = new VariableNodeForPerSpotTaskExpressions(variableName);
break;
case "VariableNodeForIsotopicRatios":
variable = new VariableNodeForIsotopicRatios(variableName);
break;
}
return variable;
}
示例2: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@SuppressWarnings("nls")
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
MetadataFormat format = new MetadataFormat();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
String value = reader.getValue();
if( name.equals("oai:metadataPrefix") || name.equals("metadataPrefix") )
{
format.setMetadataPrefix(value);
}
else if( name.equals("oai:schema") || name.equals("schema") )
{
format.setSchema(value);
}
else if( name.equals("oai:metadataNamespace") || name.equals("metadataNamespace") )
{
format.setMetadataNamespace(value);
}
}
return format;
}
示例3: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Record record = new Record();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
if( name.equals("metadata") )
{
reader.moveDown();
Object object = new OAIDOMConverter().unmarshal(reader, context);
record.setMetadata(object);
reader.moveUp();
}
else if( name.equals("header") )
{
Header header = (Header) convert(name, context);
record.setHeader(header);
}
}
return record;
}
示例4: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
/**
* The unmarshal method reads through a Definition to parse the ID and the
* Name of a Definition. The ID and name of a definition are set and the
* type of the Definition is set using the suffix of the ID/ Name.
*/
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
final Definition definition = new Definition();
String id = null, name = null;
while (reader.hasMoreChildren()) {
reader.moveDown();
final String nodeName = reader.getNodeName();
String value = reader.getValue();
value = value == null ? "" : value;
if (nodeName.equalsIgnoreCase("ID")) {
id = reader.getValue();
} else if (nodeName.equalsIgnoreCase("NAME")) {
name = reader.getValue();
}
definition.setId(id != null && !id.isEmpty() ? id : name);
reader.moveUp();
}
definition.setType(DefinitionType.getDefinitionType(definition.getId()));
return definition;
}
示例5: parseSubTree2
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
private Element parseSubTree2(HierarchicalStreamReader reader, Document doc)
{
String qname = reader.getNodeName();
Element parent = doc.createElement(qname);
Iterator i = reader.getAttributeNames();
while( i.hasNext() )
{
String aname = i.next().toString();
String value = reader.getAttribute(aname);
parent.setAttribute(aname, value);
}
String text = reader.getValue();
if( text.trim().length() != 0 )
{
Text textEl = doc.createTextNode(text);
parent.appendChild(textEl);
}
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
Element child = parseSubTree2(reader, doc);
parent.appendChild(child);
}
return parent;
}
示例6: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
DublinCore response = new DublinCore();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
String value = reader.getValue();
if( name.endsWith("title") )
{
response.addTitle(value);
}
else if( name.endsWith("creator") )
{
response.addCreator(value);
}
else if( name.endsWith("subject") )
{
response.addSubject(value);
}
else if( name.endsWith("description") )
{
response.addDescription(value);
}
else if( name.endsWith("date") )
{
response.addDate(value);
}
else if( name.endsWith("identifier") )
{
response.addIdentifier(value);
}
}
return response;
}
示例7: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Set set = new Set();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
String value = reader.getValue();
if( name.equals("setSpec") )
{
set.setSpec(value);
}
else if( name.equals("setName") )
{
set.setName(value);
}
else if( name.equals("setDescription") )
{
reader.moveDown();
Object object = new OAIDOMConverter().unmarshal(reader, context);
set.setDescription(object);
reader.moveUp();
}
}
return set;
}
示例8: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Header header = new Header();
String status = reader.getAttribute("status");
header.setStatus(status);
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
String value = reader.getValue();
if( name.equals("identifier") )
{
header.setIdentifier(value);
}
else if( name.equals("datestamp") )
{
header.setDatestamp(value);
}
else if( name.equals("setSpec") )
{
header.addSpec(value);
}
}
return header;
}
示例9: parseSubTree2
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
private Element parseSubTree2(HierarchicalStreamReader reader, Document doc)
{
String qname = reader.getNodeName();
Element parent = doc.createElement(qname);
// Iterator i = reader.getAttributeNames();
int count = reader.getAttributeCount();
for( int i = 0; i < count; i++ )
{
String aname = reader.getAttributeName(i);
String value = reader.getAttribute(i);
parent.setAttribute(aname, value);
}
String text = reader.getValue();
if( text.trim().length() != 0 )
{
Text textEl = doc.createTextNode(text);
parent.appendChild(textEl);
}
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
Element child = parseSubTree2(reader, doc);
parent.appendChild(child);
}
return parent;
}
示例10: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
/**
* Method is used unmarshal XML of any type of component which contains a
* List<String> where the string elements would appear within <ID> tags.
* E.g. the List<String> of inputRoutes and outputRoutes in
* CommunicationPoint.
*
* @return a List<String> of all IDs.
*/
@Override
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
final List<String> IdList = new ArrayList<String>();
while (reader.hasMoreChildren()) {
reader.moveDown();
final String nodeName = reader.getNodeName();
final String value = reader.getValue();
if (nodeName.equalsIgnoreCase("ID")) {
IdList.add(value);
}
reader.moveUp();
}
return IdList;
}
示例11: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
Map<String, String> map = new HashMap<>();
while(reader.hasMoreChildren()) {
reader.moveDown();
String key = reader.getNodeName(); // nodeName aka element's name
String value = reader.getValue();
map.put(key, value);
reader.moveUp();
}
return map;
}
示例12: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Repository rep = new Repository();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
String value = reader.getValue();
if( name.equals(BASEURL) )
{
rep.setBaseURL(value);
}
else if( name.equals(PROTOCOLVERSION) )
{
rep.setProtocolVersion(value);
}
else if( name.equals(EARLIESTDATESTAMP) )
{
rep.setEarliestDatestamp(value);
}
else if( name.equals(DELETEDRECORD) )
{
rep.setDeletedRecord(value);
}
else if( name.equals(ADMINEMAIL) )
{
rep.addAdminEmail(value);
}
else if( name.equals(GRANULARITY) )
{
rep.setGranularity(value);
}
else if( name.equals(REPOSITORYNAME) )
{
rep.setName(value);
}
}
return rep;
}
示例13: unmarshal
import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context)
{
Response rep = new Response();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
String name = reader.getNodeName();
if( name.equals("responseDate") )
{
String value = reader.getValue();
rep.setResponseDate(value);
}
else if( name.equals("error") )
{
rep.setError((OAIError) convert(name, context));
}
else if( name.equals("request") )
{
rep.setRequest((Request) convert(name, context));
}
else if( name.equals("GetRecord") )
{
rep.setMessageNodeName(name);
reader.moveDown();
rep.setMessage(convert(reader.getNodeName(), context));
reader.moveUp();
}
else if( name.equals("Identify") )
{
rep.setMessageNodeName(name);
rep.setMessage(convert(name, context));
}
else
{
List list = new List();
for( ; reader.hasMoreChildren(); reader.moveUp() )
{
reader.moveDown();
Object o = convert(reader.getNodeName(), context);
list.add(o);
}
rep.setMessage(list);
}
}
return rep;
}