48 lines
1.3 KiB
Java
48 lines
1.3 KiB
Java
package com.thoughtworks.xstream.io.xml;
|
|
|
|
import com.thoughtworks.xstream.io.naming.NameCoder;
|
|
import nu.xom.Attribute;
|
|
import nu.xom.Element;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class XomWriter extends AbstractDocumentWriter {
|
|
public XomWriter() {
|
|
this(null);
|
|
}
|
|
|
|
private Element top() {
|
|
return (Element) getCurrent();
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
|
public void addAttribute(String str, String str2) {
|
|
top().addAttribute(new Attribute(encodeAttribute(str), str2));
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.io.xml.AbstractDocumentWriter
|
|
protected Object createNode(String str) {
|
|
Element element = new Element(encodeNode(str));
|
|
if (top() != null) {
|
|
top().appendChild(element);
|
|
}
|
|
return element;
|
|
}
|
|
|
|
@Override // com.thoughtworks.xstream.io.HierarchicalStreamWriter
|
|
public void setValue(String str) {
|
|
top().appendChild(str);
|
|
}
|
|
|
|
public XomWriter(Element element) {
|
|
this(element, new XmlFriendlyNameCoder());
|
|
}
|
|
|
|
public XomWriter(Element element, NameCoder nameCoder) {
|
|
super(element, nameCoder);
|
|
}
|
|
|
|
public XomWriter(Element element, XmlFriendlyReplacer xmlFriendlyReplacer) {
|
|
this(element, (NameCoder) xmlFriendlyReplacer);
|
|
}
|
|
}
|