feat(serialize-xml): use name encoding for values
This commit is contained in:
parent
dc48cc436c
commit
fcc3d97150
@ -13,7 +13,7 @@ import java.util.Objects;
|
||||
import static io.gitlab.jfronny.commons.serialize.xml.impl.WrapperScope.*;
|
||||
|
||||
public class XmlWriter extends SerializeWriter<IOException, XmlWriter> implements Closeable {
|
||||
private NativeXmlWriter writer;
|
||||
private final NativeXmlWriter writer;
|
||||
private int[] stack = new int[32];
|
||||
private int stackSize = 0;
|
||||
private String[] pathNames = new String[32];
|
||||
@ -169,9 +169,9 @@ public class XmlWriter extends SerializeWriter<IOException, XmlWriter> implement
|
||||
beforeValue();
|
||||
String name = consumeName();
|
||||
if (pathIndices[stackSize - 1] == 0 && heuristics.shouldUseAttribute(name)) {
|
||||
writer.attribute(name, null);
|
||||
writer.attribute(nameEncoding.encode(name), null);
|
||||
} else {
|
||||
writer.beginTag(name);
|
||||
writer.beginTag(nameEncoding.encode(name));
|
||||
writer.endTag();
|
||||
}
|
||||
return this;
|
||||
@ -184,11 +184,11 @@ public class XmlWriter extends SerializeWriter<IOException, XmlWriter> implement
|
||||
if (pathIndices[stackSize - 1] == 0 && heuristics.shouldUseAttribute(name)) {
|
||||
writer.attribute(name, value);
|
||||
} else if (heuristics.shouldUseCData(value, name)) {
|
||||
writer.beginTag(name);
|
||||
writer.beginTag(nameEncoding.encode(name));
|
||||
writer.cdata(value);
|
||||
writer.endTag();
|
||||
} else {
|
||||
writer.beginTag(name);
|
||||
writer.beginTag(nameEncoding.encode(name));
|
||||
writer.text(value);
|
||||
writer.endTag();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user