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


Java OutputNode.setAttribute方法代码示例

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


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

示例1: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void write(OutputNode node, Map map) throws Exception {
   Set keys = map.keySet();
   
   for(Object key : keys) {
      OutputNode next = node.getChild("entry");
      next.setAttribute("key", key.toString());
      OutputNode value = next.getChild("value");
      value.setValue(map.get(key).toString());
   }
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:11,代码来源:ConverterMapTest.java

示例2: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, InetSocketAddress value) throws Exception {
    InetAddress addr = value.getAddress();
    String addrtext = (addr == null) ? value.getHostName() : addr.getHostAddress();
    node.setAttribute(ADDRESS, addrtext);
    node.setAttribute(PORT, String.valueOf(value.getPort()));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:8,代码来源:InetSocketAddressConverter.java

示例3: testQualifier

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void testQualifier() throws Exception {
   NamespaceDecorator global = new NamespaceDecorator();
   NamespaceDecorator qualifier = new NamespaceDecorator();
   NamespaceDecorator attribute = new NamespaceDecorator();
   
   global.add(new MockNamespace("global", "http://www.domain.com/global")); 
   qualifier.add(new MockNamespace("a", "http://www.domain.com/a"));
   qualifier.add(new MockNamespace("b", "http://www.domain.com/b"));
   qualifier.add(new MockNamespace("c", "http://www.domain.com/c"));
   attribute.add(new MockNamespace("d", "http://www.domain.com/d"));
   
   global.set(new MockNamespace("first", "http://www.domain.com/ignore"));
   qualifier.set(new MockNamespace("a", "http://www.domain.com/a"));
   attribute.set(new MockNamespace("b", "http://www.domain.com/b"));

   StringWriter out = new StringWriter(); 
   
   OutputNode top = NodeBuilder.write(out);
   OutputNode root = top.getChild("root");
   
   root.setAttribute("version", "1.0");
   qualifier.decorate(root, global);
   
   OutputNode child = root.getChild("child");
   child.setAttribute("name", "John Doe");
   
   OutputNode name = child.getAttributes().get("name");
   attribute.decorate(name);
   
   OutputNode grandChild = child.getChild("grandChild");
   grandChild.setValue("this is the grand child");
   
   root.commit();
   validate(out.toString());     
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:36,代码来源:NamespaceDecoratorTest.java

示例4: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void write(OutputNode node, Car car) throws Exception {
   Set<String> keys = car.furtherAttributes.keySet();
   
   for(String name : keys) {
      String value = car.furtherAttributes.get(name);
      
      node.setAttribute(name, value);
   }
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:10,代码来源:DynamicMapOfAttributesTest.java

示例5: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, Vector2 value) throws Exception {
    node.setAttribute("x", String.valueOf(value.x()));
    node.setAttribute("y", String.valueOf(value.y()));
}
 
开发者ID:reloZid,项目名称:android-anuto,代码行数:6,代码来源:VectorConverter.java

示例6: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void write(OutputNode node, Dog dog)throws Exception {
   node.setAttribute(ELEMENT_NAME, dog.getName());
   node.setAttribute(ELEMENT_AGE, String.valueOf(dog.getAge()));
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:5,代码来源:ConversionTest.java

示例7: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, HardwareAddress value) throws Exception {
    String addrtext = value.getNativeRepresentation();
    node.setAttribute(ATTRIBUTE, addrtext);
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:HardwareAddressConverter.java

示例8: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void write(OutputNode node, Entry entry) throws Exception {
   node.setAttribute("name", entry.getName());
   node.setAttribute("value", entry.getValue());
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:5,代码来源:ExampleConverters.java

示例9: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void write(OutputNode node, Chicken chicken) throws Exception {
   node.setAttribute("name", chicken.getName());
   node.setAttribute("age", String.valueOf(chicken.getAge()));
   node.setAttribute("legs", String.valueOf(chicken.getLegs()));
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:6,代码来源:AnnotationConverterTest.java

示例10: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, InetAddress value) throws Exception {
    String addrtext = value.getHostAddress();
    node.setAttribute(ATTRIBUTE, addrtext);
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:InetAddressConverter.java

示例11: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, double[] value) throws Exception {
    String data = DoubleArrayTransform.toString(value);
    node.setAttribute(ATTRIBUTE, data);
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:DoubleArrayConverter.java

示例12: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, long[] value) throws Exception {
    String data = LongArrayTransform.toString(value);
    node.setAttribute(ATTRIBUTE, data);
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:LongArrayConverter.java

示例13: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, short[] value) throws Exception {
    String data = ShortArrayTransform.toString(value);
    node.setAttribute(ATTRIBUTE, data);
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:ShortArrayConverter.java

示例14: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
@Override
public void write(OutputNode node, int[] value) throws Exception {
    String data = IntegerArrayTransform.toString(value);
    node.setAttribute(ATTRIBUTE, data);
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:IntegerArrayConverter.java

示例15: write

import org.simpleframework.xml.stream.OutputNode; //导入方法依赖的package包/类
public void write(OutputNode node, ExtendedItem value) throws Exception {
   node.setAttribute("value", String.valueOf(value.getValue()));
   node.setAttribute("type", getClass().getName());
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:5,代码来源:CombinedStrategyTest.java


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