com.imsweb.validation.internal.xml.TestsXmlDriver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of validation Show documentation
Show all versions of validation Show documentation
This framework allows edits to be defined in Groovy and to be executed on various data types.
/*
* Copyright (C) 2021 Information Management Services, Inc.
*/
package com.imsweb.validation.internal.xml;
import java.io.Writer;
import org.xmlpull.v1.XmlPullParser;
import com.thoughtworks.xstream.core.util.QuickWriter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.xml.AbstractXppDriver;
import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
import io.github.xstream.mxparser.MXParser;
public class TestsXmlDriver extends AbstractXppDriver {
/**
* Construct.
*/
public TestsXmlDriver() {
super(new XmlFriendlyNameCoder());
}
@Override
protected XmlPullParser createParser() {
return new MXParser();
}
@Override
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out, " ") {
boolean _cdata = false;
@Override
public void startNode(String name) {
super.startNode(name);
_cdata = "script".equals(name);
}
@Override
protected void writeText(QuickWriter writer, String text) {
if (_cdata) {
writer.write("");
}
else
super.writeText(writer, text);
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy