本文整理汇总了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());
}
}
示例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()));
}
示例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());
}
示例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);
}
}
示例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()));
}
示例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()));
}
示例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);
}
示例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());
}
示例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()));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}