Moved and renamed SAX3 classes to own x4o module
This commit is contained in:
parent
d61ce42576
commit
74b8540fd3
|
@ -44,7 +44,6 @@ import org.apache.metamodel.schema.Column;
|
|||
import org.apache.metamodel.schema.Relationship;
|
||||
import org.apache.metamodel.schema.Table;
|
||||
import org.apache.metamodel.schema.TableType;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
|
@ -52,6 +51,7 @@ import org.x4o.o2o.tdoc.dom.ApiDocIndexItem;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
public class DocModelWriterTable {
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ import java.io.Writer;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.x4o.o2o.io.sax3.xdbx.XDBXReaderXml;
|
||||
import org.x4o.o2o.io.sax3.xdbx.XDBXWriterXml;
|
||||
import org.x4o.o2o.io.tlv.TLVChainOctalSex;
|
||||
import org.x4o.o2o.io.tlv.TLVChainSexTeenBit;
|
||||
import org.x4o.sax3.io.xdbx.XDBXReaderXml;
|
||||
import org.x4o.sax3.io.xdbx.XDBXWriterXml;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18;
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.io.OutputStream;
|
|||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.o2o.io.sax3.xdbx.XDBXConstants;
|
||||
import org.x4o.sax3.io.xdbx.XDBXConstants;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.io.InputStreamReader;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestContent;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.scopic.ScopicManifestException;
|
||||
|
@ -228,7 +228,7 @@ public class ScopicIniContentReader {
|
|||
result.appendCodePoint(':');
|
||||
continue;
|
||||
}
|
||||
if (c2 != XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
|
||||
if (c2 != SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
|
||||
throw new ScopicManifestException("Illegal body escape found: " + value);
|
||||
}
|
||||
StringBuilder charRef = new StringBuilder(16);
|
||||
|
|
|
@ -29,8 +29,8 @@ package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf;
|
|||
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
/// Stroboscopic manifest 1 and 2 constants.
|
||||
///
|
||||
|
@ -127,11 +127,11 @@ public enum ScopicManifestConstants {
|
|||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (isV1HeaderChar(c) == false) {
|
||||
result.appendCodePoint(XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE);
|
||||
result.appendCodePoint(XMLConstants.CODE_POINT_ENTIY_REF_NUMBER);
|
||||
result.appendCodePoint(XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX);
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE);
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER);
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX);
|
||||
result.append(Integer.toHexString(c).toUpperCase());
|
||||
result.appendCodePoint(XMLConstants.CODE_POINT_ENTIY_REF_TERMINATOR);
|
||||
result.appendCodePoint(SAX3XMLConstants.CODE_POINT_ENTIY_REF_TERMINATOR);
|
||||
} else {
|
||||
result.appendCodePoint(c);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.Optional;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8HeaderField;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
|
@ -179,24 +179,24 @@ public class ScopicManifestContentReader {
|
|||
PrimitiveIterator.OfInt iterator = value.codePoints().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
int c = iterator.nextInt();
|
||||
if (c != XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE) {
|
||||
if (c != SAX3XMLConstants.CODE_POINT_ENTIY_REF_ESCAPE) {
|
||||
result.appendCodePoint(c);
|
||||
} else {
|
||||
StringBuilder charRef = new StringBuilder(16);
|
||||
int c2 = iterator.nextInt();
|
||||
if (c2 != XMLConstants.CODE_POINT_ENTIY_REF_NUMBER) {
|
||||
if (c2 != SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER) {
|
||||
throw new ScopicManifestException("Illegal lonely amp sign found: " + value);
|
||||
}
|
||||
int c3 = iterator.nextInt();
|
||||
boolean isHex = false;
|
||||
if (c3 == XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
|
||||
if (c3 == SAX3XMLConstants.CODE_POINT_ENTIY_REF_NUMBER_HEX) {
|
||||
isHex = true;
|
||||
} else {
|
||||
charRef.appendCodePoint(c3);
|
||||
}
|
||||
while (iterator.hasNext()) {
|
||||
int charRefCodePoint = iterator.nextInt();
|
||||
if (charRefCodePoint == XMLConstants.CODE_POINT_ENTIY_REF_TERMINATOR) {
|
||||
if (charRefCodePoint == SAX3XMLConstants.CODE_POINT_ENTIY_REF_TERMINATOR) {
|
||||
break;
|
||||
}
|
||||
charRef.appendCodePoint(charRefCodePoint);
|
||||
|
|
|
@ -30,8 +30,8 @@ package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriterAdapter;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.ContentWriterAdapter;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -92,17 +92,17 @@ public class ScopicManifest5ContentParser extends ContentWriterAdapter {
|
|||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
||||
if (ScopicManifest5FrameTag.ATTRIBUTE.name().equals(localName)) {
|
||||
attrName = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.ATTRIBUTE_NAME);
|
||||
attrName = attributes.getValue(SAX3XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.ATTRIBUTE_NAME);
|
||||
return;
|
||||
}
|
||||
if (ScopicManifest5FrameTag.SECTION.name().equals(localName)) {
|
||||
attrMain = false;
|
||||
String sectionName = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.SECTION_NAME);
|
||||
String sectionName = attributes.getValue(SAX3XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.SECTION_NAME);
|
||||
handler.strobeSectionHeader(sectionName);
|
||||
return;
|
||||
}
|
||||
if (ScopicManifest5FrameTag.MANIFEST.name().equals(localName)) {
|
||||
String version = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.MANIFEST_VERSION);
|
||||
String version = attributes.getValue(SAX3XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.MANIFEST_VERSION);
|
||||
handler.strobeManifestDeclaration(version);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
|
||||
import org.x4o.sax3.SAX3WriterEnum;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
|
@ -46,12 +46,12 @@ import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestCo
|
|||
/// @version ©Δ∞ 仙上主天
|
||||
public class ScopicManifest5ContentWriter implements ScopicManifestContent<String> {
|
||||
|
||||
private final ContentWriterTagWrapper<ScopicManifest5FrameTag, ContentWriter> writer;
|
||||
private final SAX3WriterEnum<ScopicManifest5FrameTag, ContentWriter> writer;
|
||||
private final ScopicManifestDuplicateDetector<String> duplicateDetector;
|
||||
private boolean openSection = false;
|
||||
|
||||
public ScopicManifest5ContentWriter(ContentWriter writerXml) {
|
||||
this.writer = new ContentWriterTagWrapper<>(writerXml);
|
||||
this.writer = new SAX3WriterEnum<>(writerXml);
|
||||
this.duplicateDetector = new ScopicManifestDuplicateDetector<>(v -> v.length());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.io.StringWriter;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX0TheVersion;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
|
@ -210,7 +210,7 @@ public class WarpManifestChinaTest {
|
|||
|
||||
WarpManifestX8 manifestV5 = WarpManifestorDriver.readV5Array(outputV5);
|
||||
StringWriter outputXml = new StringWriter();
|
||||
ContentWriterXml writerXml = new ContentWriterXml(outputXml);
|
||||
SAX3WriterXml writerXml = new SAX3WriterXml(outputXml);
|
||||
ScopicManifest5ContentWriter writer = new ScopicManifest5ContentWriter(writerXml);
|
||||
ScopicManifestContentPulser.strobelight(manifestV5, writer, WarpManifestX0TheVersion.VERSION_5_0.getQName());
|
||||
Assertions.assertTrue(outputXml.toString().contains("<!-- 同義詞 乞丐歌集 -->"));
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
</parent>
|
||||
<artifactId>nx01-x4o-driver</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-x4o-sax3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-x4o-fc18</artifactId>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
package org.x4o.xml.eld.doc;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
import org.x4o.xml.lang.task.AbstractX4OLanguageTask;
|
||||
|
@ -48,7 +48,7 @@ public class EldDocLanguageTask extends AbstractX4OLanguageTask {
|
|||
/**
|
||||
* Executes this language task.
|
||||
*/
|
||||
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final PropertyConfig config) {
|
||||
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final SAX3PropertyConfig config) {
|
||||
return new X4OLanguageTaskExecutor() {
|
||||
public void execute(X4OLanguage language) throws X4OLanguageTaskException {
|
||||
try {
|
||||
|
|
|
@ -29,9 +29,6 @@ import java.util.Calendar;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.tdoc.ApiDocGenerator;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterHelp;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterIndexAll;
|
||||
|
@ -40,6 +37,9 @@ import org.x4o.o2o.tdoc.dom.ApiDoc;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocRemoteClass;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.xml.element.ElementNamespaceAttribute;
|
||||
import org.x4o.xml.element.ElementBindingHandler;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
|
@ -79,8 +79,8 @@ public class EldDocWriter {
|
|||
private static final String[] CC_CONFIGURATOR_G = {"configurator-global","ConfiguratorGlobal","The global configurator.","The global configurator."};
|
||||
private static final String[] CC_BINDING = {"binding","Binding","The element binding.","The element binding."};
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"eld-doc/";
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"eld-doc/";
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
|
||||
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
||||
public final static String DOC_NAME = PROPERTY_CONTEXT_PREFIX+"doc/name";
|
||||
|
@ -99,7 +99,7 @@ public class EldDocWriter {
|
|||
public final static String PAGE_PRINT_HELP = PROPERTY_CONTEXT_PREFIX+"page/print-help";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,ContentWriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,SAX3WriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(true,OUTPUT_PATH,File.class),
|
||||
new PropertyConfigItem(false,DOC_NAME,String.class),
|
||||
new PropertyConfigItem(false,DOC_DESCRIPTION,String.class),
|
||||
|
@ -119,7 +119,7 @@ public class EldDocWriter {
|
|||
}
|
||||
|
||||
/** The config of this writer. */
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
/** The language to write doc over. */
|
||||
private final X4OLanguage language;
|
||||
|
@ -128,9 +128,9 @@ public class EldDocWriter {
|
|||
* Creates an EldDocGenerator for this langauge context.
|
||||
* @param language The language to generate doc for.
|
||||
*/
|
||||
public EldDocWriter(X4OLanguage language,PropertyConfig parentConfig) {
|
||||
public EldDocWriter(X4OLanguage language,SAX3PropertyConfig parentConfig) {
|
||||
this.language=language;
|
||||
this.propertyConfig=new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig.copyParentProperties(parentConfig);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ package org.x4o.xml.eld.doc;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentPrinter;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeDataConfiguratorMethod;
|
||||
|
@ -35,6 +34,7 @@ import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeData;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.xml.eld.doc.EldDocXTreePageWriter.TreeNode;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
import org.x4o.xml.element.ElementClassAttribute;
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterTree;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDoc;
|
||||
|
@ -36,6 +35,7 @@ import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.xml.element.ElementBindingHandler;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
import org.x4o.xml.element.ElementInterface;
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.x4o.xml.eld.xsd;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
import org.x4o.xml.lang.task.AbstractX4OLanguageTask;
|
||||
import org.x4o.xml.lang.task.X4OLanguageTaskException;
|
||||
|
@ -50,7 +50,7 @@ public class EldXsdLanguageTask extends AbstractX4OLanguageTask {
|
|||
/**
|
||||
* Executes this language task.
|
||||
*/
|
||||
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final PropertyConfig config) {
|
||||
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final SAX3PropertyConfig config) {
|
||||
return new X4OLanguageTaskExecutor() {
|
||||
public void execute(X4OLanguage language) throws X4OLanguageTaskException {
|
||||
try {
|
||||
|
|
|
@ -28,10 +28,10 @@ import java.io.IOException;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.o2o.io.ContentWriterXsd;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXsd;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
import org.x4o.xml.element.ElementNamespace;
|
||||
import org.x4o.xml.lang.X4OLanguageModule;
|
||||
|
@ -46,8 +46,8 @@ import org.xml.sax.SAXException;
|
|||
*/
|
||||
public class EldXsdWriter {
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"eld-xsd/";
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"eld-xsd/";
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
|
||||
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
||||
public final static String OUTPUT_DOCUMENTATION = PROPERTY_CONTEXT_PREFIX+"output/documentation";
|
||||
|
@ -64,7 +64,7 @@ public class EldXsdWriter {
|
|||
private static final String DEFAULT_PROLOG_SEPERATOR = " ===================================================================== ";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,ContentWriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,SAX3WriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(true,OUTPUT_PATH, File.class ),
|
||||
new PropertyConfigItem(OUTPUT_DOCUMENTATION, Boolean.class, true),
|
||||
new PropertyConfigItem(FILTER_NAMESPACE, String.class ),
|
||||
|
@ -80,11 +80,11 @@ public class EldXsdWriter {
|
|||
}
|
||||
|
||||
private final X4OLanguage language;
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
public EldXsdWriter(X4OLanguage language,PropertyConfig parentConfig) {
|
||||
public EldXsdWriter(X4OLanguage language,SAX3PropertyConfig parentConfig) {
|
||||
this.language=language;
|
||||
this.propertyConfig=new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig.copyParentProperties(parentConfig);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class EldXsdWriter {
|
|||
|
||||
public void writeSchema() throws SAXException, IOException {
|
||||
File basePath = propertyConfig.getPropertyFile(OUTPUT_PATH);
|
||||
String encoding = propertyConfig.getPropertyString(ContentWriterXml.OUTPUT_ENCODING);
|
||||
String encoding = propertyConfig.getPropertyString(SAX3WriterXml.OUTPUT_ENCODING);
|
||||
String namespace = propertyConfig.getPropertyString(FILTER_NAMESPACE);
|
||||
if (basePath==null) {
|
||||
throw new NullPointerException("Can't write schema to null output path.");
|
||||
|
@ -116,7 +116,7 @@ public class EldXsdWriter {
|
|||
File outputFile = new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource());
|
||||
Writer wr = new OutputStreamWriter(new FileOutputStream(outputFile), encoding);
|
||||
try {
|
||||
ContentWriterXsd xsdWriter = new ContentWriterXsd(wr,encoding);
|
||||
SAX3WriterXsd xsdWriter = new SAX3WriterXsd(wr,encoding);
|
||||
xsdWriter.getPropertyConfig().copyParentProperties(propertyConfig);
|
||||
generateSchema(ns.getUri(), xsdWriter);
|
||||
} finally {
|
||||
|
@ -130,7 +130,7 @@ public class EldXsdWriter {
|
|||
File outputFile = new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource());
|
||||
Writer wr = new OutputStreamWriter(new FileOutputStream(outputFile), encoding);
|
||||
try {
|
||||
ContentWriterXsd xsdWriter = new ContentWriterXsd(wr,encoding);
|
||||
SAX3WriterXsd xsdWriter = new SAX3WriterXsd(wr,encoding);
|
||||
xsdWriter.getPropertyConfig().copyParentProperties(propertyConfig);
|
||||
generateSchema(ns.getUri(), xsdWriter);
|
||||
} finally {
|
||||
|
@ -140,7 +140,7 @@ public class EldXsdWriter {
|
|||
}
|
||||
}
|
||||
|
||||
private void generateSchema(String namespaceUri,ContentWriterXsd xsdWriter) throws IOException {
|
||||
private void generateSchema(String namespaceUri,SAX3WriterXsd xsdWriter) throws IOException {
|
||||
ElementNamespace ns = language.findElementNamespace(namespaceUri);
|
||||
if (ns==null) {
|
||||
throw new NullPointerException("Could not find namespace: "+namespaceUri);
|
||||
|
|
|
@ -33,11 +33,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.io.ContentWriterXsd;
|
||||
import org.x4o.o2o.io.ContentWriterXsd.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXsd;
|
||||
import org.x4o.sax3.SAX3WriterXsd.Tag;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.x4o.xml.element.ElementBindingHandler;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
import org.x4o.xml.element.ElementClassAttribute;
|
||||
|
@ -60,13 +60,13 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
*/
|
||||
public class EldXsdWriterElement {
|
||||
|
||||
private PropertyConfig propertyConfig;
|
||||
private SAX3PropertyConfig propertyConfig;
|
||||
protected X4OLanguage language = null;
|
||||
protected ContentWriterXsd xsdWriter = null;
|
||||
protected SAX3WriterXsd xsdWriter = null;
|
||||
protected String writeNamespace = null;
|
||||
protected Map<String, String> namespaces = null;
|
||||
|
||||
public EldXsdWriterElement(ContentWriterXsd xsdWriter,X4OLanguage language,PropertyConfig propertyConfig) {
|
||||
public EldXsdWriterElement(SAX3WriterXsd xsdWriter,X4OLanguage language,SAX3PropertyConfig propertyConfig) {
|
||||
this.xsdWriter=xsdWriter;
|
||||
this.language=language;
|
||||
this.propertyConfig=propertyConfig;
|
||||
|
@ -156,8 +156,8 @@ public class EldXsdWriterElement {
|
|||
if (!propertyConfig.getPropertyBoolean(EldXsdWriter.PROLOG_GENERATED_ENABLE)) {
|
||||
return;
|
||||
}
|
||||
String chEnter = propertyConfig.getPropertyString(ContentWriterXml.OUTPUT_CHAR_NEWLINE);
|
||||
String chTab = propertyConfig.getPropertyString(ContentWriterXml.OUTPUT_CHAR_TAB);
|
||||
String chEnter = propertyConfig.getPropertyString(SAX3WriterXml.OUTPUT_CHAR_NEWLINE);
|
||||
String chTab = propertyConfig.getPropertyString(SAX3WriterXml.OUTPUT_CHAR_TAB);
|
||||
String generatedBy = propertyConfig.getPropertyString(EldXsdWriter.PROLOG_GENERATED_BY, EldXsdWriter.class.getSimpleName());
|
||||
String generatedVersion = propertyConfig.getPropertyString(EldXsdWriter.PROLOG_GENERATED_VERSION);
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
@ -173,8 +173,8 @@ public class EldXsdWriterElement {
|
|||
}
|
||||
|
||||
private void prologWriteNSMeta(ElementNamespace ns) throws IOException {
|
||||
String chEnter = propertyConfig.getPropertyString(ContentWriterXml.OUTPUT_CHAR_NEWLINE);
|
||||
String chTab = propertyConfig.getPropertyString(ContentWriterXml.OUTPUT_CHAR_TAB);
|
||||
String chEnter = propertyConfig.getPropertyString(SAX3WriterXml.OUTPUT_CHAR_NEWLINE);
|
||||
String chTab = propertyConfig.getPropertyString(SAX3WriterXml.OUTPUT_CHAR_TAB);
|
||||
if (propertyConfig.getPropertyBoolean(EldXsdWriter.PROLOG_XMLNS_INFO_ENABLE)) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(chEnter + chTab + String.format(COMMENT_FORMAT,"NSId:",ns.getId()));
|
||||
|
@ -242,7 +242,7 @@ public class EldXsdWriterElement {
|
|||
public void endSchema() throws IOException {
|
||||
xsdWriter.printTagEnd(Tag.schema);
|
||||
try {
|
||||
xsdWriter.getContentWriterWrapped().ignorableWhitespace(XMLConstants.CHAR_NEWLINE);
|
||||
xsdWriter.getContentWriterWrapped().ignorableWhitespace(SAX3XMLConstants.CHAR_NEWLINE);
|
||||
} catch (SAXException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ public abstract class AbstractX4OConnection extends AbstractX4OConnectionDebug {
|
|||
return language;
|
||||
}
|
||||
|
||||
abstract PropertyConfig getPropertyConfig();
|
||||
abstract SAX3PropertyConfig getPropertyConfig();
|
||||
|
||||
/**
|
||||
* Sets an X4O Language property.
|
||||
|
|
|
@ -28,8 +28,8 @@ import java.io.PrintWriter;
|
|||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.lang.X4OLanguageSessionLocal;
|
||||
import org.x4o.xml.lang.phase.X4OPhase;
|
||||
|
@ -64,7 +64,7 @@ public abstract class AbstractX4OConnectionDebug implements X4OConnection {
|
|||
xmlDebugWriter = (ContentWriter)debugOutputHandler;
|
||||
} else if (debugOutputStream instanceof OutputStream) {
|
||||
debugCloseOutputStream = (OutputStream)debugOutputStream;
|
||||
xmlDebugWriter = new ContentWriterXml(debugCloseOutputStream);
|
||||
xmlDebugWriter = new SAX3WriterXml(debugCloseOutputStream);
|
||||
}
|
||||
if (xmlDebugWriter!=null) {
|
||||
xmlDebugWriter.startDocument();
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.xml.sax.SAXException;
|
||||
|
@ -67,7 +67,7 @@ public abstract class AbstractX4OWriterSession<T> extends AbstractX4OConnection
|
|||
public String writeStringSession(X4OLanguageSession languageSession) throws X4OConnectionException,SAXException,IOException {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
|
||||
writeSession(languageSession, out);
|
||||
String encoding = (String)getProperty(ContentWriterXml.OUTPUT_ENCODING);
|
||||
String encoding = (String)getProperty(SAX3WriterXml.OUTPUT_ENCODING);
|
||||
return out.toString(encoding);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ import java.net.URL;
|
|||
import javax.el.ValueExpression;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.x4o.xml.lang.X4OLanguageSessionLocal;
|
||||
|
@ -55,11 +55,11 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
|||
|
||||
private X4OLanguageSession languageSession = null;
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/";
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/";
|
||||
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
public final static String SAX_ERROR_HANDLER = PROPERTY_CONTEXT_PREFIX + "sax/error-handler";
|
||||
public final static String SAX_ENTITY_RESOLVER = PROPERTY_CONTEXT_PREFIX + "sax/entity-resolver";
|
||||
public final static String DOC_EMPTY_NAMESPACE_URI = PROPERTY_CONTEXT_PREFIX + "doc/empty-namespace-uri";
|
||||
|
@ -78,13 +78,13 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
|||
public final static String DEBUG_OUTPUT_STREAM_CLOSE = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_STREAM_CLOSE;
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(SAX_ERROR_HANDLER,ErrorHandler.class),
|
||||
new PropertyConfigItem(SAX_ENTITY_RESOLVER,EntityResolver.class),
|
||||
new PropertyConfigItem(DOC_EMPTY_NAMESPACE_URI,String.class),
|
||||
new PropertyConfigItem(DOC_BUFFER_SIZE,Integer.class,4096*2),
|
||||
new PropertyConfigItem(INPUT_STREAM,InputStream.class),
|
||||
new PropertyConfigItem(INPUT_ENCODING,String.class,XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(INPUT_ENCODING,String.class,SAX3XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(INPUT_SOURCE,InputSource.class),
|
||||
new PropertyConfigItem(true,INPUT_SYSTEM_ID,String.class),
|
||||
new PropertyConfigItem(true,INPUT_BASE_PATH,URL.class),
|
||||
|
@ -101,11 +101,11 @@ public class DefaultX4OReader<T> extends AbstractX4OReader<T> {
|
|||
public DefaultX4OReader(X4OLanguage language) {
|
||||
super(language);
|
||||
languageSession = language.createLanguageSession();
|
||||
propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
propertyConfig = new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
}
|
||||
|
||||
@Override
|
||||
PropertyConfig getPropertyConfig() {
|
||||
SAX3PropertyConfig getPropertyConfig() {
|
||||
return propertyConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.o2o.io.sax3.xdbx.XDBXWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.sax3.io.xdbx.XDBXWriterXml;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementClass;
|
||||
import org.x4o.xml.element.ElementClassAttribute;
|
||||
|
@ -62,11 +62,11 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
*/
|
||||
public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"writer/x4o/";
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"writer/x4o/";
|
||||
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
|
||||
public final static String OUTPUT_STREAM = PROPERTY_CONTEXT_PREFIX+"output/stream";
|
||||
public final static String OUTPUT_XDBX = PROPERTY_CONTEXT_PREFIX+"output/xdbx";
|
||||
|
@ -77,7 +77,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
|||
public final static String DEBUG_OUTPUT_STREAM_CLOSE = PROPERTY_CONTEXT_PREFIX + ABSTRACT_DEBUG_OUTPUT_STREAM_CLOSE;
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,ContentWriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,SAX3WriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(true,OUTPUT_STREAM,OutputStream.class),
|
||||
new PropertyConfigItem(OUTPUT_XDBX,Boolean.class,false),
|
||||
new PropertyConfigItem(SCHEMA_PRINT,Boolean.class,true),
|
||||
|
@ -94,13 +94,13 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
|||
*/
|
||||
public DefaultX4OWriter(X4OLanguage language) {
|
||||
super(language);
|
||||
propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
propertyConfig = new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.io.AbstractX4OConnection#getPropertyConfig()
|
||||
*/
|
||||
public PropertyConfig getPropertyConfig() {
|
||||
public SAX3PropertyConfig getPropertyConfig() {
|
||||
return propertyConfig;
|
||||
}
|
||||
|
||||
|
@ -130,10 +130,10 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
|||
private void runWrite(X4OLanguageSession languageSession) throws X4OConnectionException {
|
||||
OutputStream out = (OutputStream)getProperty(OUTPUT_STREAM);
|
||||
try {
|
||||
String encoding = getPropertyConfig().getPropertyString(ContentWriterXml.OUTPUT_ENCODING);
|
||||
String encoding = getPropertyConfig().getPropertyString(SAX3WriterXml.OUTPUT_ENCODING);
|
||||
schemaUriPrint = getPropertyConfig().getPropertyBoolean(SCHEMA_PRINT);
|
||||
schemaUriRoot = getPropertyConfig().getPropertyString(SCHEMA_ROOT_URI);
|
||||
if (encoding==null) { encoding = XMLConstants.XML_DEFAULT_ENCODING; }
|
||||
if (encoding==null) { encoding = SAX3XMLConstants.XML_DEFAULT_ENCODING; }
|
||||
|
||||
Element root = languageSession.getRootElement();
|
||||
if (schemaUriRoot==null) {
|
||||
|
@ -146,7 +146,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
|||
boolean useXDBX = getPropertyConfig().getPropertyBoolean(OUTPUT_XDBX);
|
||||
ContentWriter writer = null;
|
||||
if (!useXDBX) {
|
||||
ContentWriterXml writerXML = new ContentWriterXml(out,encoding);
|
||||
SAX3WriterXml writerXML = new SAX3WriterXml(out,encoding);
|
||||
writerXML.getPropertyConfig().copyParentProperties(getPropertyConfig());
|
||||
writer = writerXML;
|
||||
} else {
|
||||
|
@ -289,7 +289,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
|||
AttributesImpl atts = new AttributesImpl();
|
||||
if (isRoot && schemaUriPrint) {
|
||||
String rootUri = findElementUri(element);
|
||||
writer.startPrefixMapping("xsi", XMLConstants.XML_SCHEMA_INSTANCE_NS_URI);
|
||||
writer.startPrefixMapping("xsi", SAX3XMLConstants.XML_SCHEMA_INSTANCE_NS_URI);
|
||||
atts.addAttribute ("xsi", "schemaLocation", "", "", rootUri+" "+schemaUriRoot);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
*/
|
||||
package org.x4o.xml.io;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.io.sax3.AttributeMap;
|
||||
import org.x4o.sax3.io.AttributeMap;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.Element.ElementType;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
|
@ -68,13 +68,13 @@ public class X4OContentHandler extends DefaultHandler2 {
|
|||
/** Store the override element handler */
|
||||
private DefaultHandler2 overrideSaxHandler = null;
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
/**
|
||||
* Creates an X4OTagHandler
|
||||
* which can receice sax xml events and converts them into the Element* interfaces events.
|
||||
*/
|
||||
public X4OContentHandler(X4OLanguageSession elementLanguage,PropertyConfig propertyConfig) {
|
||||
public X4OContentHandler(X4OLanguageSession elementLanguage,SAX3PropertyConfig propertyConfig) {
|
||||
logger = Logger.getLogger(X4OContentHandler.class.getName());
|
||||
loggerFinest = logger.isLoggable(Level.FINEST);
|
||||
elementStack = new Stack<Element>();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
package org.x4o.xml.io;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.eld.EldDriver;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
|
@ -46,13 +46,13 @@ import java.util.Map;
|
|||
*/
|
||||
public class X4OContentParser {
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
public X4OContentParser(PropertyConfig propertyConfig) {
|
||||
public X4OContentParser(SAX3PropertyConfig propertyConfig) {
|
||||
this.propertyConfig=propertyConfig;
|
||||
}
|
||||
|
||||
private PropertyConfig getPropertyConfig() {
|
||||
private SAX3PropertyConfig getPropertyConfig() {
|
||||
return propertyConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.SAX3WriterEnum;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.x4o.xml.conv.ObjectConverter;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementNamespaceAttribute;
|
||||
|
@ -65,10 +65,10 @@ public class X4ODebugWriter {
|
|||
|
||||
static public final String DEBUG_URI = "http://language.x4o.org/xml/ns/debug-output";
|
||||
|
||||
protected ContentWriterTagWrapper<Tag,ContentWriter> contentWriter = null;
|
||||
protected SAX3WriterEnum<Tag,ContentWriter> contentWriter = null;
|
||||
|
||||
public X4ODebugWriter(ContentWriter debugWriter) {
|
||||
this.contentWriter=new ContentWriterTagWrapper<Tag,ContentWriter>(debugWriter,DEBUG_URI,XMLConstants.NULL_NS_URI);
|
||||
this.contentWriter=new SAX3WriterEnum<Tag,ContentWriter>(debugWriter,DEBUG_URI,SAX3XMLConstants.NULL_NS_URI);
|
||||
}
|
||||
|
||||
public ContentWriter getContentWriter() {
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.element.ElementNamespace;
|
||||
import org.x4o.xml.lang.X4OLanguageModule;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
|
@ -57,13 +57,13 @@ public class X4OEntityResolver implements EntityResolver {
|
|||
private URL basePath = null;
|
||||
private Map<String,String> schemaResources = null;
|
||||
private Map<String,String> schemaPathResources = null;
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
/**
|
||||
* Creates an X4OEntityResolver for a language.
|
||||
* @param elementContext The x4o language to resolve entities for.
|
||||
*/
|
||||
public X4OEntityResolver(X4OLanguageSession elementContext,PropertyConfig propertyConfig) {
|
||||
public X4OEntityResolver(X4OLanguageSession elementContext,SAX3PropertyConfig propertyConfig) {
|
||||
if (elementContext==null) {
|
||||
throw new NullPointerException("Can't provide entities with null elementContext.");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
package org.x4o.xml.io;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
|
@ -44,7 +44,7 @@ public class X4OErrorHandler implements ErrorHandler {
|
|||
* Construct a new SAXErrorPrinter
|
||||
* @param languageSession The language to get errors to.
|
||||
*/
|
||||
public X4OErrorHandler(X4OLanguageSession languageSession,PropertyConfig propertyConfig) {
|
||||
public X4OErrorHandler(X4OLanguageSession languageSession,SAX3PropertyConfig propertyConfig) {
|
||||
if (languageSession==null) {
|
||||
throw new NullPointerException("Can't debug and proxy errors with null languageSession.");
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.x4o.xml.lang.task;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
|
||||
/**
|
||||
* AbstractX4OLanguageTask holds the language task meta info.
|
||||
|
@ -37,29 +37,29 @@ public abstract class AbstractX4OLanguageTask implements X4OLanguageTask {
|
|||
private final String id;
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
public AbstractX4OLanguageTask(String id,PropertyConfig propertyConfig) {
|
||||
public AbstractX4OLanguageTask(String id,SAX3PropertyConfig propertyConfig) {
|
||||
this(id,id,id,propertyConfig);
|
||||
}
|
||||
|
||||
public AbstractX4OLanguageTask(String id,String name,String description,PropertyConfig propertyConfig) {
|
||||
public AbstractX4OLanguageTask(String id,String name,String description,SAX3PropertyConfig propertyConfig) {
|
||||
this.id=id;
|
||||
this.name=name;
|
||||
this.description=description;
|
||||
this.propertyConfig=propertyConfig;
|
||||
}
|
||||
|
||||
protected abstract X4OLanguageTaskExecutor createTaskExecutorChecked(PropertyConfig config);
|
||||
protected abstract X4OLanguageTaskExecutor createTaskExecutorChecked(SAX3PropertyConfig config);
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.lang.task.X4OLanguageTask#createTaskExecutor(org.x4o.o2o.PropertyConfig)
|
||||
* @see org.x4o.xml.lang.task.X4OLanguageTask#createTaskExecutor(org.x4o.sax3.io.SAX3PropertyConfig)
|
||||
*/
|
||||
public X4OLanguageTaskExecutor createTaskExecutor(PropertyConfig config) {
|
||||
public X4OLanguageTaskExecutor createTaskExecutor(SAX3PropertyConfig config) {
|
||||
return createTaskExecutorChecked(checkConfig(config));
|
||||
}
|
||||
|
||||
private PropertyConfig checkConfig(PropertyConfig config) {
|
||||
private SAX3PropertyConfig checkConfig(SAX3PropertyConfig config) {
|
||||
List<String> keys = config.getPropertyKeysRequiredValues();
|
||||
if (keys.isEmpty()) {
|
||||
return config;
|
||||
|
@ -81,7 +81,7 @@ public abstract class AbstractX4OLanguageTask implements X4OLanguageTask {
|
|||
/**
|
||||
* @see org.x4o.xml.lang.task.X4OLanguageTask#createTaskConfig()
|
||||
*/
|
||||
public PropertyConfig createTaskConfig() {
|
||||
public SAX3PropertyConfig createTaskConfig() {
|
||||
return propertyConfig.clone();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
package org.x4o.xml.lang.task;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
|
||||
/**
|
||||
* X4OLanguageTask runs a task for a language.
|
||||
|
@ -50,11 +50,11 @@ public interface X4OLanguageTask {
|
|||
/**
|
||||
* @return Returns newly created PropertyConfig for configuring this task.
|
||||
*/
|
||||
PropertyConfig createTaskConfig();
|
||||
SAX3PropertyConfig createTaskConfig();
|
||||
|
||||
/**
|
||||
* @param config The config with which the task will be runned.
|
||||
* @return The task executor for running the task.
|
||||
*/
|
||||
X4OLanguageTaskExecutor createTaskExecutor(PropertyConfig config);
|
||||
X4OLanguageTaskExecutor createTaskExecutor(SAX3PropertyConfig config);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
package org.x4o.xml.lang.task;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
|
||||
/**
|
||||
* X4OLanguageTaskException addes the property config to the exception.
|
||||
|
@ -33,19 +33,19 @@ import org.x4o.o2o.PropertyConfig;
|
|||
public class X4OLanguageTaskException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 8490969221732950292L;
|
||||
private PropertyConfig propertyConfig = null;
|
||||
private SAX3PropertyConfig propertyConfig = null;
|
||||
|
||||
public X4OLanguageTaskException(PropertyConfig propertyConfig,String message) {
|
||||
public X4OLanguageTaskException(SAX3PropertyConfig propertyConfig,String message) {
|
||||
super(message);
|
||||
this.propertyConfig=propertyConfig;
|
||||
}
|
||||
|
||||
public X4OLanguageTaskException(PropertyConfig propertyConfig,String message,Exception exception) {
|
||||
public X4OLanguageTaskException(SAX3PropertyConfig propertyConfig,String message,Exception exception) {
|
||||
super(message,exception);
|
||||
this.propertyConfig=propertyConfig;
|
||||
}
|
||||
|
||||
public PropertyConfig getPropertyConfig() {
|
||||
public SAX3PropertyConfig getPropertyConfig() {
|
||||
return propertyConfig;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.x4o.xml.lang.task;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class X4OStaticLanguageTask extends AbstractX4OLanguageTask {
|
|||
/**
|
||||
* Executes this language task.
|
||||
*/
|
||||
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final PropertyConfig config) {
|
||||
protected X4OLanguageTaskExecutor createTaskExecutorChecked(final SAX3PropertyConfig config) {
|
||||
return new X4OLanguageTaskExecutor() {
|
||||
public void execute(X4OLanguage language) throws X4OLanguageTaskException {
|
||||
try {
|
||||
|
|
|
@ -28,8 +28,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -41,23 +41,23 @@ import org.xml.sax.SAXException;
|
|||
*/
|
||||
public class X4OStaticWriter {
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"x4o-static/";
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"x4o-static/";
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
|
||||
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
||||
public final static String OUTPUT_OASIS_XMLNS_CATALOG = PROPERTY_CONTEXT_PREFIX+"output/oasis-xml-catalog";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(true,OUTPUT_PATH, File.class ),
|
||||
new PropertyConfigItem(OUTPUT_OASIS_XMLNS_CATALOG, Boolean.class, false)
|
||||
);
|
||||
}
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
public X4OStaticWriter(PropertyConfig parentConfig) {
|
||||
this.propertyConfig=new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
public X4OStaticWriter(SAX3PropertyConfig parentConfig) {
|
||||
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig.copyParentProperties(parentConfig);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
|
@ -50,7 +50,7 @@ public class X4OTaskCommandLine {
|
|||
|
||||
private X4ODriver<?> driver = null;
|
||||
private X4OLanguageTask task = null;
|
||||
private PropertyConfig config = null;
|
||||
private SAX3PropertyConfig config = null;
|
||||
|
||||
public static void main(String[] argu) {
|
||||
X4OTaskCommandLine cmd = new X4OTaskCommandLine();
|
||||
|
@ -175,7 +175,7 @@ public class X4OTaskCommandLine {
|
|||
String arg = arguIterator.next();
|
||||
if ("-list-keys".equals(arg) || "-lk".equals(arg)) {
|
||||
System.out.println(task.getName()+" config keys;");
|
||||
PropertyConfig config = task.createTaskConfig();
|
||||
SAX3PropertyConfig config = task.createTaskConfig();
|
||||
for (String key:config.getPropertyKeys()) {
|
||||
Class<?> keyType = config.getPropertyType(key);
|
||||
Object valueDefault = config.getPropertyDefault(key);
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.x4o.xml.lang.task.run;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.lang.X4OLanguage;
|
||||
|
@ -46,7 +46,7 @@ public final class X4OTaskRunner {
|
|||
if (task==null) {
|
||||
throw new NullPointerException("Could not find x4o task with id; "+taskId);
|
||||
}
|
||||
PropertyConfig config = task.createTaskConfig();
|
||||
SAX3PropertyConfig config = task.createTaskConfig();
|
||||
for (X4OTaskProperty prop:props) {
|
||||
String key = prop.getKey();
|
||||
String value = prop.getValue();
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.io.IOException;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.eld.CelDriver;
|
||||
import org.x4o.xml.io.DefaultX4OReader;
|
||||
|
@ -86,7 +86,7 @@ public class X4OEntityResolverTest {
|
|||
public void testResolveProperty() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||
X4OLanguageSession language = driver.createLanguage().createLanguageSession();
|
||||
PropertyConfig conf = new PropertyConfig(DefaultX4OReader.DEFAULT_PROPERTY_CONFIG,PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/");
|
||||
SAX3PropertyConfig conf = new SAX3PropertyConfig(DefaultX4OReader.DEFAULT_PROPERTY_CONFIG,SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/");
|
||||
conf.setProperty(DefaultX4OReader.SAX_ENTITY_RESOLVER, new TestEntityResolver());
|
||||
X4OEntityResolver resolver = new X4OEntityResolver(language,conf);
|
||||
Exception e = null;
|
||||
|
@ -104,7 +104,7 @@ public class X4OEntityResolverTest {
|
|||
public void testResolvePropertyNull() throws Exception {
|
||||
X4ODriver<TestObjectRoot> driver = new TestDriver();
|
||||
X4OLanguageSession language = driver.createLanguage().createLanguageSession();
|
||||
PropertyConfig conf = new PropertyConfig(DefaultX4OReader.DEFAULT_PROPERTY_CONFIG,PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/");
|
||||
SAX3PropertyConfig conf = new SAX3PropertyConfig(DefaultX4OReader.DEFAULT_PROPERTY_CONFIG,SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"reader/x4o/");
|
||||
conf.setProperty(DefaultX4OReader.SAX_ENTITY_RESOLVER, new TestEntityResolver());
|
||||
X4OEntityResolver resolver = new X4OEntityResolver(language,conf);
|
||||
Exception e = null;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.io.File;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.eld.CelDriver;
|
||||
|
@ -53,7 +53,7 @@ public class X4OWriteLanguageDocExecutorTest {
|
|||
public void testDoc(String language,String outputPostfix) throws Exception {
|
||||
X4ODriver<?> driver = X4ODriverManager.getX4ODriver(language);
|
||||
X4OLanguageTask task = driver.getLanguageTask(EldDocLanguageTask.TASK_ID);
|
||||
PropertyConfig config = task.createTaskConfig();
|
||||
SAX3PropertyConfig config = task.createTaskConfig();
|
||||
File outputPath = createOutputPath(outputPostfix);
|
||||
config.setProperty(EldDocWriter.OUTPUT_PATH,outputPath);
|
||||
task.createTaskExecutor(config).execute(driver.createLanguage());
|
||||
|
|
|
@ -28,8 +28,8 @@ import java.util.Map;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.xml.X4ODriver;
|
||||
import org.x4o.xml.X4ODriverManager;
|
||||
import org.x4o.xml.eld.CelDriver;
|
||||
|
@ -59,12 +59,12 @@ public class EldXsdLanguageTaskTest {
|
|||
private File testSchema(String language,String outputPostfix,Map<String,Object> props) throws Exception {
|
||||
X4ODriver<?> driver = X4ODriverManager.getX4ODriver(language);
|
||||
X4OLanguageTask task = driver.getLanguageTask(EldXsdLanguageTask.TASK_ID);
|
||||
PropertyConfig config = task.createTaskConfig();
|
||||
SAX3PropertyConfig config = task.createTaskConfig();
|
||||
File outputPath = createOutputPath(outputPostfix);
|
||||
config.setProperty(EldXsdWriter.OUTPUT_PATH,outputPath);
|
||||
config.setProperty(EldXsdWriter.OUTPUT_DOCUMENTATION,false);
|
||||
config.setProperty(ContentWriterXml.PROLOG_LICENCE_FILE,new File("../licence.txt"));
|
||||
config.setProperty(ContentWriterXml.PROLOG_USER_COMMENT,"Generated by junit-test-run in class: "+this.getClass().getSimpleName());
|
||||
config.setProperty(SAX3WriterXml.PROLOG_LICENCE_FILE,new File("../licence.txt"));
|
||||
config.setProperty(SAX3WriterXml.PROLOG_USER_COMMENT,"Generated by junit-test-run in class: "+this.getClass().getSimpleName());
|
||||
if (props!=null) {
|
||||
for (String key:props.keySet()) {
|
||||
Object value = props.get(key);
|
||||
|
@ -110,7 +110,7 @@ public class EldXsdLanguageTaskTest {
|
|||
props.put(EldXsdWriter.FILTER_ELEMENT, "elementInterface");
|
||||
props.put(EldXsdWriter.PROLOG_GENERATED_ENABLE, false);
|
||||
props.put(EldXsdWriter.PROLOG_XMLNS_INFO_ENABLE, false);
|
||||
props.put(ContentWriterXml.PROLOG_LICENCE_ENABLE,false);
|
||||
props.put(SAX3WriterXml.PROLOG_LICENCE_ENABLE,false);
|
||||
File outputPath = testSchema(CelDriver.LANGUAGE_NAME,"junit-one-element",props);
|
||||
Assertions.assertTrue(outputPath.list().length==1);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.x4o.xml.test.element;
|
|||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.xml.element.AbstractElement;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class InlinePropertiesElement extends AbstractElement {
|
|||
@Override
|
||||
public void doElementStart() throws ElementException {
|
||||
StringWriter xmlString = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(xmlString);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(xmlString);
|
||||
setElementObject(writer);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,41 @@ package org.x4o.fc18.zion7;
|
|||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 11, 2025
|
||||
public interface FourCornerZion7TempleScrolls extends FourCornerZion7Candlelier {
|
||||
/*
|
||||
DOCUMENT_END(FCDotCDC1604DashP6.NX27_AMPERSAND),
|
||||
ELEMENT_END(FCDotCDC1604DashP6.NX26_Z),
|
||||
|
||||
//void strobeElementStart(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord tag);
|
||||
ELEMENT_II(FCDotCDC1604DashP6.NX05_E),
|
||||
ELEMENT_SI(FCDotCDC1604DashP6.NX24_X),
|
||||
|
||||
//void strobeElementEnd();
|
||||
ATTRIBUTE_II(FCDotCDC1604DashP6.NX01_A),
|
||||
ATTRIBUTE_SI(FCDotCDC1604DashP6.NX02_B),
|
||||
|
||||
NS_DECL_II(FCDotCDC1604DashP6.NX13_M),
|
||||
NS_SCHEMA_SI(FCDotCDC1604DashP6.NX14_N),
|
||||
|
||||
CHARACTERS(FCDotCDC1604DashP6.NX20_T),
|
||||
COMMENT(FCDotCDC1604DashP6.NX03_C),
|
||||
|
||||
STRING_ID(FCDotCDC1604DashP6.NX09_I),
|
||||
*/
|
||||
/*
|
||||
void strobeDocumentStart();
|
||||
|
||||
void strobeDocumentEnd();
|
||||
|
||||
void strobeElementStart(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord tag);
|
||||
|
||||
void strobeElementEnd();
|
||||
|
||||
void strobeAttribute(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord name, PrimordialOctalOrangeJuiceCord value);
|
||||
|
||||
void strobeNamespace(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord prefix);
|
||||
|
||||
void strobeNamespaceSchema(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord location);
|
||||
|
||||
void strobeCharacters(PrimordialOctalOrangeJuiceCord text);
|
||||
|
||||
void strobeComment(PrimordialOctalOrangeJuiceCord text);
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import org.x4o.fc18.FourCornerUnicodeDisplay;
|
|||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
|
||||
/**
|
||||
* Cake doc muffin page writer.
|
||||
|
|
|
@ -33,13 +33,13 @@ import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7C;
|
|||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7D;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7E;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7F;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
|
||||
/**
|
||||
* Cake doc muffin page writer.
|
||||
|
|
|
@ -27,10 +27,10 @@ import java.util.function.Function;
|
|||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,8 +29,6 @@ import java.util.Optional;
|
|||
import java.util.Set;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
|
@ -38,6 +36,8 @@ import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
|
||||
/**
|
||||
* Cake doc slice writer.
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
|
@ -34,6 +33,7 @@ import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
|
||||
/**
|
||||
* Cake doc segment slice writer.
|
||||
|
|
|
@ -36,13 +36,13 @@ import org.x4o.fc18.cake2.FourCornerX18CakePointDotName;
|
|||
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX21CodePointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX00PetitVide;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* Cake doc word writer.
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
</parent>
|
||||
<artifactId>nx01-x4o-o2o</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-x4o-sax3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object two object input output structure support.
|
||||
*
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
package org.x4o.o2o.io;
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax4;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuice;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeSexWord;
|
||||
|
||||
/**
|
||||
* Handle streaming XML4 content.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 25, 2024
|
||||
*/
|
||||
public enum X4ContentFrameTag {
|
||||
/*
|
||||
DOCUMENT_END(FCDotCDC1604DashP6.NX27_AMPERSAND),
|
||||
ELEMENT_END(FCDotCDC1604DashP6.NX26_Z),
|
||||
|
||||
ELEMENT_II(FCDotCDC1604DashP6.NX05_E),
|
||||
ELEMENT_SI(FCDotCDC1604DashP6.NX24_X),
|
||||
|
||||
ATTRIBUTE_II(FCDotCDC1604DashP6.NX01_A),
|
||||
ATTRIBUTE_SI(FCDotCDC1604DashP6.NX02_B),
|
||||
|
||||
NS_DECL_II(FCDotCDC1604DashP6.NX13_M),
|
||||
NS_SCHEMA_SI(FCDotCDC1604DashP6.NX14_N),
|
||||
|
||||
CHARACTERS(FCDotCDC1604DashP6.NX20_T),
|
||||
COMMENT(FCDotCDC1604DashP6.NX03_C),
|
||||
|
||||
STRING_ID(FCDotCDC1604DashP6.NX09_I),
|
||||
*/
|
||||
;
|
||||
|
||||
private final PrimordialOctalOrangeJuice tagNumber;
|
||||
|
||||
// private X4ContentFrameTag(FCDotCDC1604DashP6 tag) {
|
||||
// this(PrimordialOctalOrangeSexWord.valueOfSmurf(tag.ordinal()));
|
||||
// }
|
||||
|
||||
private X4ContentFrameTag(PrimordialOctalOrangeJuice tagNumber) {
|
||||
this.tagNumber = Objects.requireNonNull(tagNumber);
|
||||
}
|
||||
|
||||
public PrimordialOctalOrangeJuice getTagNumber() {
|
||||
return tagNumber;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax4;
|
||||
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||
|
||||
/**
|
||||
* Handle streaming XML4 content.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 25, 2024
|
||||
*/
|
||||
public interface X4ContentHandler {
|
||||
|
||||
void strobeDocumentStart();
|
||||
|
||||
void strobeDocumentEnd();
|
||||
|
||||
void strobeElementStart(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord tag);
|
||||
|
||||
void strobeElementEnd();
|
||||
|
||||
void strobeAttribute(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord name, PrimordialOctalOrangeJuiceCord value);
|
||||
|
||||
void strobeNamespace(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord prefix);
|
||||
|
||||
void strobeNamespaceSchema(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord location);
|
||||
|
||||
void strobeCharacters(PrimordialOctalOrangeJuiceCord text);
|
||||
|
||||
void strobeComment(PrimordialOctalOrangeJuiceCord text);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object two object SAX and binary and octal support classes.
|
||||
*
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
package org.x4o.o2o;
|
|
@ -28,8 +28,8 @@ import java.io.Writer;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.sax3.SAX3WriterHtml;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 30, 2013
|
||||
*/
|
||||
public class ApiDocContentWriter extends ContentWriterHtml {
|
||||
public class ApiDocContentWriter extends SAX3WriterHtml {
|
||||
|
||||
private boolean isRowAlt = false;
|
||||
|
||||
|
|
|
@ -40,10 +40,6 @@ import java.util.Comparator;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.DocType;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDoc;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNavLink;
|
||||
|
@ -55,6 +51,10 @@ import org.x4o.o2o.tdoc.dom.ApiDocNodeWriter;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.SAX3WriterHtml.DocType;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
|
@ -453,12 +453,12 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
|
|||
}
|
||||
|
||||
private ApiDocContentWriter createContentWriter(File outputFile) throws IOException {
|
||||
String encoding = XMLConstants.XML_DEFAULT_ENCODING;
|
||||
String encoding = SAX3XMLConstants.XML_DEFAULT_ENCODING;
|
||||
try {
|
||||
Writer out = new OutputStreamWriter(new FileOutputStream(outputFile), encoding);
|
||||
ApiDocContentWriter result = new ApiDocContentWriter(out,encoding);
|
||||
result.getPropertyConfig().setProperty(ContentWriterXml.OUTPUT_CHAR_NEWLINE, XMLConstants.CHAR_NEWLINE+"");
|
||||
result.getPropertyConfig().setProperty(ContentWriterXml.OUTPUT_CHAR_TAB, " ");
|
||||
result.getPropertyConfig().setProperty(SAX3WriterXml.OUTPUT_CHAR_NEWLINE, SAX3XMLConstants.CHAR_NEWLINE+"");
|
||||
result.getPropertyConfig().setProperty(SAX3WriterXml.OUTPUT_CHAR_TAB, " ");
|
||||
return result;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new IOException(e);
|
||||
|
|
|
@ -29,9 +29,6 @@ import java.util.Calendar;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.tdoc.ApiDocGenerator;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterHelp;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterIndexAll;
|
||||
|
@ -40,6 +37,9 @@ import org.x4o.o2o.tdoc.dom.ApiDoc;
|
|||
import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocRemoteClass;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
|
@ -53,8 +53,8 @@ public class ApiDocWriter {
|
|||
|
||||
// NOTE: this class is unused, and is waiting for ApiDocProject code and replaces most code in EldDocWriter to here.
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"api-doc/";
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"api-doc/";
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
|
||||
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
||||
public final static String DOC_NAME = PROPERTY_CONTEXT_PREFIX+"doc/name";
|
||||
|
@ -74,7 +74,7 @@ public class ApiDocWriter {
|
|||
public final static String PAGE_PRINT_HELP = PROPERTY_CONTEXT_PREFIX+"page/print-help";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,ContentWriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,SAX3WriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(true,OUTPUT_PATH,File.class),
|
||||
new PropertyConfigItem(DOC_NAME,String.class,"X4O API DOC"),
|
||||
new PropertyConfigItem(DOC_DESCRIPTION,String.class,"X4O API Documentation."),
|
||||
|
@ -95,10 +95,10 @@ public class ApiDocWriter {
|
|||
}
|
||||
|
||||
/** The config of this writer. */
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
public ApiDocWriter(PropertyConfig parentConfig) {
|
||||
this.propertyConfig=new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
public ApiDocWriter(SAX3PropertyConfig parentConfig) {
|
||||
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig.copyParentProperties(parentConfig);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ package org.x4o.o2o.tdoc;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDoc;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* DefaultPageWriterHelp creates the help page content.
|
||||
|
|
|
@ -24,10 +24,10 @@ package org.x4o.o2o.tdoc;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* DefaultPageWriterIndexAll creates the index-all page content.
|
||||
|
|
|
@ -24,12 +24,12 @@ package org.x4o.o2o.tdoc;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDoc;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* DefaultPageWriterTree creates the default tree overview page content.
|
||||
|
|
17
nx01-x4o-sax3/pom.xml
Normal file
17
nx01-x4o-sax3/pom.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01</artifactId>
|
||||
<version>〇一。壬寅。一〄-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>nx01-x4o-sax3</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -20,12 +20,15 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
@ -36,18 +39,18 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2013
|
||||
*/
|
||||
public class ContentWriterTagWrapper<TAG extends Enum<?>,TAG_WRITER extends ContentWriter> implements ContentWriterTag<TAG>, Closeable {
|
||||
public class SAX3WriterEnum<TAG extends Enum<?>,TAG_WRITER extends ContentWriter> implements SAX3WriterEnumHammer<TAG>, Closeable {
|
||||
|
||||
private final Attributes EMPTY_ATTRIBUTES = new AttributesImpl();
|
||||
private final TAG_WRITER contentWriter;
|
||||
private final String tagNamespaceUri;
|
||||
private final String tagNamespacePrefix;
|
||||
|
||||
public ContentWriterTagWrapper(TAG_WRITER contentWriter) {
|
||||
this(contentWriter, XMLConstants.NULL_NS_URI, XMLConstants.NULL_NS_URI);
|
||||
public SAX3WriterEnum(TAG_WRITER contentWriter) {
|
||||
this(contentWriter, SAX3XMLConstants.NULL_NS_URI, SAX3XMLConstants.NULL_NS_URI);
|
||||
}
|
||||
|
||||
public ContentWriterTagWrapper(TAG_WRITER contentWriter, String tagNamespaceUri, String tagNamespacePrefix) {
|
||||
public SAX3WriterEnum(TAG_WRITER contentWriter, String tagNamespaceUri, String tagNamespacePrefix) {
|
||||
this.contentWriter = Objects.requireNonNull(contentWriter, "Can't create wrapper on null ContentWriter");
|
||||
this.tagNamespaceUri = Objects.requireNonNull(tagNamespaceUri, "Can't create wrapper with null tagNamespaceUri");
|
||||
this.tagNamespacePrefix = Objects.requireNonNull(tagNamespacePrefix, "Can't create wrapper with null tagNamespacePrefix");
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -32,7 +32,7 @@ import org.xml.sax.Attributes;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2013
|
||||
*/
|
||||
public interface ContentWriterTag<TAG extends Enum<?>> {
|
||||
public interface SAX3WriterEnumHammer<TAG extends Enum<?>> {
|
||||
|
||||
String getTagNamespaceUri();
|
||||
|
|
@ -20,17 +20,15 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io;
|
||||
package org.x4o.sax3;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.io.sax3.ContentCloseable;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
|
@ -40,13 +38,13 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 30, 2013
|
||||
*/
|
||||
public class ContentWriterHtml extends ContentWriterTagWrapper<ContentWriterHtml.Tag,ContentWriterXml> {
|
||||
public class SAX3WriterHtml extends SAX3WriterEnum<SAX3WriterHtml.Tag,SAX3WriterXml> {
|
||||
|
||||
public ContentWriterHtml(Writer out,String encoding) {
|
||||
super(new ContentWriterXml(out, encoding), "", XMLConstants.NULL_NS_URI);
|
||||
public SAX3WriterHtml(Writer out,String encoding) {
|
||||
super(new SAX3WriterXml(out, encoding), "", SAX3XMLConstants.NULL_NS_URI);
|
||||
}
|
||||
|
||||
public PropertyConfig getPropertyConfig() {
|
||||
public SAX3PropertyConfig getPropertyConfig() {
|
||||
return getContentWriterWrapped().getPropertyConfig();
|
||||
}
|
||||
|
||||
|
@ -83,7 +81,7 @@ public class ContentWriterHtml extends ContentWriterTagWrapper<ContentWriterHtml
|
|||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute("", "http-equiv", "", "", "Content-Type");
|
||||
atts.addAttribute("", "content", "", "", "text/html");
|
||||
atts.addAttribute("", "charset", "", "", getPropertyConfig().getPropertyString(ContentWriterXml.OUTPUT_ENCODING));
|
||||
atts.addAttribute("", "charset", "", "", getPropertyConfig().getPropertyString(SAX3WriterXml.OUTPUT_ENCODING));
|
||||
printTagStartEnd(Tag.meta, atts);
|
||||
}
|
||||
|
|
@ -20,26 +20,29 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.x4o.sax3.io.AbstractContentWriter;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
|
||||
/**
|
||||
* ContentWriterXml writes SAX content handler events to XML.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 17, 2005
|
||||
*/
|
||||
public class ContentWriterXml extends AbstractContentWriter {
|
||||
public class SAX3WriterXml extends AbstractContentWriter {
|
||||
|
||||
/**
|
||||
* Creates XmlWriter which prints to the Writer interface.
|
||||
* @param out The writer to print the xml to.
|
||||
*/
|
||||
public ContentWriterXml(Writer out,String encoding) {
|
||||
public SAX3WriterXml(Writer out,String encoding) {
|
||||
super(out);
|
||||
getPropertyConfig().setProperty(OUTPUT_ENCODING, encoding);
|
||||
}
|
||||
|
@ -48,7 +51,7 @@ public class ContentWriterXml extends AbstractContentWriter {
|
|||
* Creates XmlWriter which prints to the Writer interface.
|
||||
* @param out The writer to print the xml to.
|
||||
*/
|
||||
public ContentWriterXml(Writer out) {
|
||||
public SAX3WriterXml(Writer out) {
|
||||
this(out,null);
|
||||
}
|
||||
|
||||
|
@ -57,8 +60,8 @@ public class ContentWriterXml extends AbstractContentWriter {
|
|||
* @param out The OutputStream to write to.
|
||||
* @throws UnsupportedEncodingException Is thrown when UTF-8 can't we printed.
|
||||
*/
|
||||
public ContentWriterXml(OutputStream out) throws UnsupportedEncodingException {
|
||||
this(new OutputStreamWriter(out, XMLConstants.XML_DEFAULT_ENCODING),XMLConstants.XML_DEFAULT_ENCODING);
|
||||
public SAX3WriterXml(OutputStream out) throws UnsupportedEncodingException {
|
||||
this(new OutputStreamWriter(out, SAX3XMLConstants.XML_DEFAULT_ENCODING),SAX3XMLConstants.XML_DEFAULT_ENCODING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,7 +70,7 @@ public class ContentWriterXml extends AbstractContentWriter {
|
|||
* @param encoding The OutputStream encoding.
|
||||
* @throws UnsupportedEncodingException Is thrown when UTF-8 can't we printed.
|
||||
*/
|
||||
public ContentWriterXml(OutputStream out,String encoding) throws UnsupportedEncodingException {
|
||||
public SAX3WriterXml(OutputStream out,String encoding) throws UnsupportedEncodingException {
|
||||
this(new OutputStreamWriter(out, encoding),encoding);
|
||||
}
|
||||
}
|
|
@ -20,15 +20,13 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io;
|
||||
package org.x4o.sax3;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
|
@ -37,13 +35,13 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2013
|
||||
*/
|
||||
public class ContentWriterXsd extends ContentWriterTagWrapper<ContentWriterXsd.Tag,ContentWriterXml> {
|
||||
public class SAX3WriterXsd extends SAX3WriterEnum<SAX3WriterXsd.Tag,SAX3WriterXml> {
|
||||
|
||||
public ContentWriterXsd(Writer out,String encoding) {
|
||||
super(new ContentWriterXml(out, encoding),XMLConstants.XML_SCHEMA_NS_URI, XMLConstants.NULL_NS_URI);
|
||||
public SAX3WriterXsd(Writer out,String encoding) {
|
||||
super(new SAX3WriterXml(out, encoding),SAX3XMLConstants.XML_SCHEMA_NS_URI, SAX3XMLConstants.NULL_NS_URI);
|
||||
}
|
||||
|
||||
public PropertyConfig getPropertyConfig() {
|
||||
public SAX3PropertyConfig getPropertyConfig() {
|
||||
return getContentWriterWrapped().getPropertyConfig();
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public abstract class AbstractContentWriter extends AbstractContentWriterLexical
|
|||
|
||||
/**
|
||||
* Starts and end then element.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#startElementEnd(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
|
||||
* @see org.x4o.sax3.io.ContentWriter#startElementEnd(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
|
||||
*/
|
||||
public void startElementEnd(String uri, String localName, String name, Attributes atts) throws SAXException {
|
||||
startElement(uri,localName,name, atts);
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
|
@ -41,8 +41,7 @@ import java.util.PrimitiveIterator;
|
|||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
|
@ -56,7 +55,7 @@ import org.xml.sax.SAXException;
|
|||
*/
|
||||
public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
private final Writer out;
|
||||
private int indent = 0;
|
||||
private Map<String,String> prefixMapping = null;
|
||||
|
@ -66,8 +65,8 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
private String lastElement = null;
|
||||
private Stack<String> elements = null;
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"content/"; // TODO: change to "writer/xml"
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"content/"; // TODO: change to "writer/xml"
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
public final static String OUTPUT_ENCODING = PROPERTY_CONTEXT_PREFIX+"output/encoding";
|
||||
public final static String OUTPUT_CHAR_TAB = PROPERTY_CONTEXT_PREFIX+"output/char-tab";
|
||||
public final static String OUTPUT_CHAR_NEWLINE = PROPERTY_CONTEXT_PREFIX+"output/char-newline";
|
||||
|
@ -86,16 +85,16 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
public final static String ROOT_START_NAMESPACE_ALL = PROPERTY_CONTEXT_PREFIX+"root/start-namespace-all";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(OUTPUT_ENCODING, String.class, XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(OUTPUT_CHAR_TAB, String.class, XMLConstants.CHAR_TAB+""),
|
||||
new PropertyConfigItem(OUTPUT_CHAR_NEWLINE, String.class, XMLConstants.CHAR_NEWLINE+""),
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(OUTPUT_ENCODING, String.class, SAX3XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(OUTPUT_CHAR_TAB, String.class, SAX3XMLConstants.CHAR_TAB+""),
|
||||
new PropertyConfigItem(OUTPUT_CHAR_NEWLINE, String.class, SAX3XMLConstants.CHAR_NEWLINE+""),
|
||||
new PropertyConfigItem(OUTPUT_CHAR_NULL, String.class, "NULL"),
|
||||
new PropertyConfigItem(OUTPUT_COMMENT_ENABLE, Boolean.class, true),
|
||||
new PropertyConfigItem(OUTPUT_COMMENT_AUTO_SPACE, Boolean.class, true),
|
||||
new PropertyConfigItem(OUTPUT_LINE_BREAK_WIDTH, Integer.class, -1),
|
||||
new PropertyConfigItem(OUTPUT_LINE_PER_ATTRIBUTE, Boolean.class, false),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_ENCODING, String.class, XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_ENCODING, String.class, SAX3XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_FILE, File.class ),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_RESOURCE, String.class ),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_ENABLE, Boolean.class, true),
|
||||
|
@ -115,10 +114,10 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
this.prefixMapping = new HashMap<String,String>(15);
|
||||
this.printedMappings = new ArrayList<String>(15);
|
||||
this.elements = new Stack<String>();
|
||||
this.propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig = new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
}
|
||||
|
||||
public PropertyConfig getPropertyConfig() {
|
||||
public SAX3PropertyConfig getPropertyConfig() {
|
||||
return propertyConfig;
|
||||
}
|
||||
|
||||
|
@ -132,7 +131,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
*/
|
||||
public void startDocument() throws SAXException {
|
||||
indent = 0;
|
||||
write(XMLConstants.getDocumentDeclaration(getPropertyConfig().getPropertyString(OUTPUT_ENCODING)));
|
||||
write(SAX3XMLConstants.getDocumentDeclaration(getPropertyConfig().getPropertyString(OUTPUT_ENCODING)));
|
||||
prologWriteLicence();
|
||||
prologWriteUserComment();
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
|
||||
private String readLicenceStream(InputStream inputStream, String encoding) throws IOException {
|
||||
if (encoding==null) {
|
||||
encoding = XMLConstants.XML_DEFAULT_ENCODING;
|
||||
encoding = SAX3XMLConstants.XML_DEFAULT_ENCODING;
|
||||
}
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream,Charset.forName(encoding)));
|
||||
try {
|
||||
|
@ -238,7 +237,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
if (localName==null) {
|
||||
throw new SAXException("LocalName may not be null.");
|
||||
}
|
||||
if (XMLConstants.isNameString(localName)==false) {
|
||||
if (SAX3XMLConstants.isNameString(localName)==false) {
|
||||
throw new SAXException("LocalName of element is not valid in xml; '"+localName+"'");
|
||||
}
|
||||
for (int i=0;i<atts.getLength();i++) {
|
||||
|
@ -252,11 +251,11 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
int c = iterator.nextInt();
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
if (!XMLConstants.isNameStartChar(attrLocalName.codePoints().findFirst().getAsInt())) {
|
||||
if (!SAX3XMLConstants.isNameStartChar(attrLocalName.codePoints().findFirst().getAsInt())) {
|
||||
throw new SAXException("LocalAttributeName has illegal start character: " + attrLocalName);
|
||||
}
|
||||
}
|
||||
if (!XMLConstants.isNameChar(c)) {
|
||||
if (!SAX3XMLConstants.isNameChar(c)) {
|
||||
throw new SAXException("LocalAttributeName has illegal name character: " + attrLocalName);
|
||||
}
|
||||
}
|
||||
|
@ -267,29 +266,29 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
for (int i = 0; i < indent; i++) {
|
||||
startElement.append(getPropertyConfig().getPropertyString(OUTPUT_CHAR_TAB));
|
||||
}
|
||||
startElement.append(XMLConstants.TAG_OPEN);
|
||||
startElement.append(SAX3XMLConstants.TAG_OPEN);
|
||||
|
||||
startElementTag(uri,localName);
|
||||
startElementNamespace(uri);
|
||||
startElementNamespaceAll();
|
||||
startElementAttributes(atts);
|
||||
startElement.append(XMLConstants.TAG_CLOSE);
|
||||
startElement.append(SAX3XMLConstants.TAG_CLOSE);
|
||||
indent++;
|
||||
lastElement = localName;
|
||||
elements.push(localName);
|
||||
}
|
||||
|
||||
public void startElementTag(String uri, String localName) throws SAXException {
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
startElement.append(localName);
|
||||
} else {
|
||||
String prefix = prefixMapping.get(uri);
|
||||
if (prefix==null) {
|
||||
throw new SAXException("preFixUri: "+uri+" is not started.");
|
||||
}
|
||||
if (XMLConstants.NULL_NS_URI.equals(prefix)==false) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(prefix)==false) {
|
||||
startElement.append(prefix);
|
||||
startElement.append(XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(SAX3XMLConstants.XMLNS_ASSIGN);
|
||||
}
|
||||
startElement.append(localName);
|
||||
}
|
||||
|
@ -299,7 +298,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
if (uri == null) {
|
||||
return;
|
||||
}
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri)) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri)) {
|
||||
return;
|
||||
}
|
||||
if (printedMappings.contains(uri)) {
|
||||
|
@ -312,9 +311,9 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
printedMappings.add(uri);
|
||||
|
||||
startElement.append(' ');
|
||||
startElement.append(XMLConstants.XMLNS_ATTRIBUTE);
|
||||
startElement.append(SAX3XMLConstants.XMLNS_ATTRIBUTE);
|
||||
if ("".equals(prefix)==false) {
|
||||
startElement.append(XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(SAX3XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(prefix);
|
||||
}
|
||||
startElement.append("=\"");
|
||||
|
@ -337,7 +336,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
throw new SAXException("preFixUri: "+uri2+" is not started.");
|
||||
}
|
||||
printedMappings.add(uri2);
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri2)) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri2)) {
|
||||
continue; // don't print empty namespace uri location
|
||||
}
|
||||
|
||||
|
@ -347,9 +346,9 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
}
|
||||
|
||||
startElement.append(' ');
|
||||
startElement.append(XMLConstants.XMLNS_ATTRIBUTE);
|
||||
startElement.append(SAX3XMLConstants.XMLNS_ATTRIBUTE);
|
||||
if ("".equals(prefix)==false) {
|
||||
startElement.append(XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(SAX3XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(prefix);
|
||||
}
|
||||
startElement.append("=\"");
|
||||
|
@ -360,7 +359,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
}
|
||||
|
||||
private void printElementAttributeNewLineSpace() {
|
||||
startElement.append(XMLConstants.CHAR_NEWLINE);
|
||||
startElement.append(SAX3XMLConstants.CHAR_NEWLINE);
|
||||
for (int ii = 0; ii < indent+1; ii++) {
|
||||
startElement.append(getPropertyConfig().getPropertyString(OUTPUT_CHAR_TAB));
|
||||
}
|
||||
|
@ -375,7 +374,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
if (attributeValue==null) {
|
||||
attributeValue = propertyConfig.getPropertyString(OUTPUT_CHAR_NULL);
|
||||
}
|
||||
String attributeValueSafe = XMLConstants.escapeAttributeValue(attributeValue);
|
||||
String attributeValueSafe = SAX3XMLConstants.escapeAttributeValue(attributeValue);
|
||||
|
||||
if (propertyConfig.getPropertyBoolean(OUTPUT_LINE_PER_ATTRIBUTE)) {
|
||||
if (i==0) {
|
||||
|
@ -385,11 +384,11 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
startElement.append(' ');
|
||||
}
|
||||
|
||||
if (XMLConstants.NULL_NS_URI.equals(attributeUri) | attributeUri ==null) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(attributeUri) | attributeUri ==null) {
|
||||
startElement.append(attributeName);
|
||||
} else {
|
||||
startElement.append(attributeUri);
|
||||
startElement.append(XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(SAX3XMLConstants.XMLNS_ASSIGN);
|
||||
startElement.append(attributeName);
|
||||
}
|
||||
startElement.append("=\"");
|
||||
|
@ -430,7 +429,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
if (startElement!=null) {
|
||||
String tag = startElement.toString();
|
||||
write(tag.substring(0,tag.length()-1));// rm normal close
|
||||
write(XMLConstants.TAG_CLOSE_EMPTY);
|
||||
write(SAX3XMLConstants.TAG_CLOSE_EMPTY);
|
||||
startElement=null;
|
||||
indent--;
|
||||
return;
|
||||
|
@ -447,23 +446,23 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
localName = "null";
|
||||
}
|
||||
|
||||
write(XMLConstants.TAG_OPEN_END);
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
write(SAX3XMLConstants.TAG_OPEN_END);
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
write(localName);
|
||||
} else {
|
||||
String prefix = prefixMapping.get(uri);
|
||||
if (prefix==null) {
|
||||
throw new SAXException("preFixUri: "+uri+" is not started.");
|
||||
}
|
||||
if (XMLConstants.NULL_NS_URI.equals(prefix)==false) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(prefix)==false) {
|
||||
write(prefix);
|
||||
write(XMLConstants.XMLNS_ASSIGN);
|
||||
write(SAX3XMLConstants.XMLNS_ASSIGN);
|
||||
}
|
||||
write(localName);
|
||||
}
|
||||
write(XMLConstants.TAG_CLOSE);
|
||||
write(SAX3XMLConstants.TAG_CLOSE);
|
||||
if (elements.isEmpty() && propertyConfig.getPropertyBoolean(ROOT_END_APPEND_NEWLINE)) {
|
||||
ignorableWhitespace(XMLConstants.CHAR_NEWLINE);
|
||||
ignorableWhitespace(SAX3XMLConstants.CHAR_NEWLINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,13 +514,13 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
* Escape and prints xml characters.
|
||||
* @param text The text to write.
|
||||
* @throws SAXException When IOException has happend while printing.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#characters(java.lang.String)
|
||||
* @see org.x4o.sax3.io.ContentWriter#characters(java.lang.String)
|
||||
*/
|
||||
public void characters(String text) throws SAXException {
|
||||
if (text==null) {
|
||||
return;
|
||||
}
|
||||
charactersRaw(XMLConstants.escapeCharacters(text));
|
||||
charactersRaw(SAX3XMLConstants.escapeCharacters(text));
|
||||
}
|
||||
|
||||
public void characters(char c) throws SAXException {
|
||||
|
@ -556,7 +555,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
*
|
||||
* @param text The text to print.
|
||||
* @throws SAXException When IOException has happend while printing.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#ignorableWhitespace(java.lang.String)
|
||||
* @see org.x4o.sax3.io.ContentWriter#ignorableWhitespace(java.lang.String)
|
||||
*/
|
||||
public void ignorableWhitespace(String text) throws SAXException {
|
||||
if (text==null) {
|
||||
|
@ -585,23 +584,23 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
*/
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
String targetLow = target.toLowerCase();
|
||||
if (targetLow.startsWith(XMLConstants.XML)) {
|
||||
if (targetLow.startsWith(SAX3XMLConstants.XML)) {
|
||||
throw new SAXException("Processing instruction may not start with xml.");
|
||||
}
|
||||
if (XMLConstants.isNameString(target)==false) {
|
||||
if (SAX3XMLConstants.isNameString(target)==false) {
|
||||
throw new SAXException("Processing instruction target is invalid name; '"+target+"'");
|
||||
}
|
||||
if (XMLConstants.isCharString(data)==false) {
|
||||
if (SAX3XMLConstants.isCharString(data)==false) {
|
||||
throw new SAXException("Processing instruction data is invalid char; '"+data+"'");
|
||||
}
|
||||
autoCloseStartElement();
|
||||
write(getPropertyConfig().getPropertyString(OUTPUT_CHAR_NEWLINE));
|
||||
writeIndent();
|
||||
write(XMLConstants.PROCESS_START);
|
||||
write(SAX3XMLConstants.PROCESS_START);
|
||||
write(target);
|
||||
write(' ');
|
||||
write(data);
|
||||
write(XMLConstants.PROCESS_END);
|
||||
write(SAX3XMLConstants.PROCESS_END);
|
||||
writeFlush();
|
||||
printReturn = true;
|
||||
}
|
||||
|
@ -643,7 +642,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
*
|
||||
* @param text The text to write.
|
||||
* @throws SAXException When IOException has happend while printing.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#comment(java.lang.String)
|
||||
* @see org.x4o.sax3.io.ContentWriter#comment(java.lang.String)
|
||||
*/
|
||||
public void comment(String text) throws SAXException {
|
||||
if (text==null) {
|
||||
|
@ -666,9 +665,9 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
checkPrintedReturn(text);
|
||||
write(getPropertyConfig().getPropertyString(OUTPUT_CHAR_NEWLINE));
|
||||
writeIndent();
|
||||
write(XMLConstants.COMMENT_START);
|
||||
write(XMLConstants.escapeCharactersComment(text,getPropertyConfig().getPropertyString(OUTPUT_CHAR_TAB),indent));
|
||||
write(XMLConstants.COMMENT_END);
|
||||
write(SAX3XMLConstants.COMMENT_START);
|
||||
write(SAX3XMLConstants.escapeCharactersComment(text,getPropertyConfig().getPropertyString(OUTPUT_CHAR_TAB),indent));
|
||||
write(SAX3XMLConstants.COMMENT_END);
|
||||
printReturn = true;
|
||||
}
|
||||
|
||||
|
@ -678,7 +677,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
|
|||
* @param value The value to check.
|
||||
*/
|
||||
private void checkPrintedReturn(String value) {
|
||||
if (value.indexOf(XMLConstants.CHAR_NEWLINE)>0) {
|
||||
if (value.indexOf(SAX3XMLConstants.CHAR_NEWLINE)>0) {
|
||||
printReturn = true;
|
||||
} else {
|
||||
printReturn = false;
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public abstract class AbstractContentWriterLexical extends AbstractContentWriter
|
|||
*/
|
||||
public void startCDATA() throws SAXException {
|
||||
autoCloseStartElement();
|
||||
charactersRaw(XMLConstants.CDATA_START);
|
||||
charactersRaw(SAX3XMLConstants.CDATA_START);
|
||||
printCDATA = true;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public abstract class AbstractContentWriterLexical extends AbstractContentWriter
|
|||
* @see org.xml.sax.ext.LexicalHandler#endCDATA()
|
||||
*/
|
||||
public void endCDATA() throws SAXException {
|
||||
charactersRaw(XMLConstants.CDATA_END);
|
||||
charactersRaw(SAX3XMLConstants.CDATA_END);
|
||||
printCDATA = false;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public abstract class AbstractContentWriterLexical extends AbstractContentWriter
|
|||
* @see org.xml.sax.ext.LexicalHandler#startDTD(java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void startDTD(String name, String publicId, String systemId) throws SAXException {
|
||||
charactersRaw(XMLConstants.XML_DOCTYPE_TAG_OPEN);
|
||||
charactersRaw(SAX3XMLConstants.XML_DOCTYPE_TAG_OPEN);
|
||||
charactersRaw(" ");
|
||||
charactersRaw(name);
|
||||
if (publicId!=null) {
|
||||
|
@ -78,7 +78,7 @@ public abstract class AbstractContentWriterLexical extends AbstractContentWriter
|
|||
charactersRaw(systemId);
|
||||
charactersRaw("\"");
|
||||
}
|
||||
charactersRaw(XMLConstants.TAG_CLOSE);
|
||||
charactersRaw(SAX3XMLConstants.TAG_CLOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ public abstract class AbstractContentWriterLexical extends AbstractContentWriter
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.o2o.io.sax3.AbstractContentWriterHandler#characters(char[], int, int)
|
||||
* @see org.x4o.sax3.io.AbstractContentWriterHandler#characters(char[], int, int)
|
||||
*/
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
|
@ -109,12 +109,12 @@ public abstract class AbstractContentWriterLexical extends AbstractContentWriter
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.o2o.io.sax3.AbstractContentWriterHandler#characters(java.lang.String)
|
||||
* @see org.x4o.sax3.io.AbstractContentWriterHandler#characters(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void characters(String text) throws SAXException {
|
||||
if (printCDATA) {
|
||||
charactersRaw(XMLConstants.escapeCharactersCdata(text,"",""));
|
||||
charactersRaw(SAX3XMLConstants.escapeCharactersCdata(text,"",""));
|
||||
} else {
|
||||
super.characters(text);
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import java.util.ArrayList;
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.Locator;
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,31 +30,28 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeString;
|
||||
|
||||
/**
|
||||
* ContentConfig Defines checked config options.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 1, 2013
|
||||
*/
|
||||
public final class PropertyConfig implements Cloneable {
|
||||
public final class SAX3PropertyConfig implements Cloneable {
|
||||
|
||||
public final static String X4O_PROPERTIES_PREFIX = "http://x4o.org/properties/";
|
||||
private final Map<String,PropertyConfigItem> items;
|
||||
private final boolean readOnly;
|
||||
private final String keyPrefix;
|
||||
|
||||
public PropertyConfig(String keyPrefix,PropertyConfigItem...items) {
|
||||
public SAX3PropertyConfig(String keyPrefix,PropertyConfigItem...items) {
|
||||
this(false,null,keyPrefix,items);
|
||||
}
|
||||
|
||||
public PropertyConfig(PropertyConfig parentPropertyConfig,String keyPrefix,PropertyConfigItem...items) {
|
||||
public SAX3PropertyConfig(SAX3PropertyConfig parentPropertyConfig,String keyPrefix,PropertyConfigItem...items) {
|
||||
this(false,parentPropertyConfig,keyPrefix,items);
|
||||
}
|
||||
|
||||
public PropertyConfig(boolean readOnly,PropertyConfig parentPropertyConfig,String keyPrefix,PropertyConfigItem...itemConfig) {
|
||||
public SAX3PropertyConfig(boolean readOnly,SAX3PropertyConfig parentPropertyConfig,String keyPrefix,PropertyConfigItem...itemConfig) {
|
||||
if (keyPrefix==null) {
|
||||
throw new NullPointerException("Can't create PropertyConfig with null keyPrefix.");
|
||||
}
|
||||
|
@ -89,7 +86,7 @@ public final class PropertyConfig implements Cloneable {
|
|||
}
|
||||
}
|
||||
|
||||
private final void copyParentPropertyConfig(Map<String,PropertyConfigItem> fillItems,PropertyConfig parentPropertyConfig) {
|
||||
private final void copyParentPropertyConfig(Map<String,PropertyConfigItem> fillItems,SAX3PropertyConfig parentPropertyConfig) {
|
||||
if (parentPropertyConfig==null) {
|
||||
return;
|
||||
}
|
||||
|
@ -393,35 +390,7 @@ public final class PropertyConfig implements Cloneable {
|
|||
return defaultValue.get();
|
||||
}
|
||||
|
||||
public final PrimordialOctalOrangeJuiceCord getPropertyString18(String key) {
|
||||
Object value = getProperty(key);
|
||||
if (value instanceof PrimordialOctalOrangeJuiceCord) {
|
||||
return (PrimordialOctalOrangeJuiceCord)value;
|
||||
}
|
||||
if (value==null) {
|
||||
return null;
|
||||
}
|
||||
throw new IllegalStateException("Wrong value type: "+value.getClass()+" for key: "+key);
|
||||
}
|
||||
|
||||
public final PrimordialOctalOrangeJuiceCord getPropertyString18(String key,PrimordialOctalOrangeJuiceCord defaultValue) {
|
||||
PrimordialOctalOrangeJuiceCord propertyValue = getPropertyString18(key);
|
||||
if (propertyValue==null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return propertyValue;
|
||||
}
|
||||
}
|
||||
|
||||
public final PrimordialOctalOrangeJuiceCord getPropertyString18(String key,Supplier<PrimordialOctalOrangeJuiceCord> defaultValue) {
|
||||
PrimordialOctalOrangeJuiceCord result = getPropertyString18(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
return defaultValue.get();
|
||||
}
|
||||
|
||||
public final void copyParentProperties(PropertyConfig config) {
|
||||
public final void copyParentProperties(SAX3PropertyConfig config) {
|
||||
for (String key:getPropertyKeys()) {
|
||||
Object value = config.getProperty(key);
|
||||
if (value==null) {
|
||||
|
@ -486,10 +455,6 @@ public final class PropertyConfig implements Cloneable {
|
|||
result.put(mKey, mValue);
|
||||
return;
|
||||
}
|
||||
if (PrimordialOctalOrangeJuiceCord.class.equals(valueType)) {
|
||||
setProperty(key, PrimordialOctalOrangeString.valueOfHinari(value));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -497,8 +462,8 @@ public final class PropertyConfig implements Cloneable {
|
|||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
public PropertyConfig clone() {
|
||||
PropertyConfig clone = new PropertyConfig(this,this.keyPrefix);
|
||||
public SAX3PropertyConfig clone() {
|
||||
SAX3PropertyConfig clone = new SAX3PropertyConfig(this,this.keyPrefix);
|
||||
clone.copyParentProperties(this);
|
||||
return clone;
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
|
@ -30,7 +30,7 @@ import java.util.PrimitiveIterator;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mrt 31, 2012
|
||||
*/
|
||||
public final class XMLConstants {
|
||||
public final class SAX3XMLConstants {
|
||||
|
||||
/**
|
||||
* Lowcase xml.
|
|
@ -22,8 +22,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The SAX4 18 bit binary XML support.
|
||||
* The SAX 3-Extended classes and interfaces.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
package org.x4o.o2o.io.sax4;
|
||||
package org.x4o.sax3.io;
|
|
@ -20,11 +20,11 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -46,7 +46,7 @@ public abstract class AbstractXDBXWriter extends AbstractXDBXWriterLexical imple
|
|||
|
||||
/**
|
||||
* Starts and end then element.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#startElementEnd(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
|
||||
* @see org.x4o.sax3.io.ContentWriter#startElementEnd(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
|
||||
*/
|
||||
public void startElementEnd(String uri, String localName, String name, Attributes atts) throws SAXException {
|
||||
startElement(uri,localName,name, atts);
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
|
@ -42,9 +42,9 @@ import java.util.PrimitiveIterator;
|
|||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.x4o.o2o.PropertyConfig;
|
||||
import org.x4o.o2o.PropertyConfig.PropertyConfigItem;
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
|
@ -58,15 +58,15 @@ import org.xml.sax.SAXException;
|
|||
*/
|
||||
public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
||||
|
||||
private final PropertyConfig propertyConfig;
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
private final OutputStream out;
|
||||
private Map<String,String> prefixMapping = null;
|
||||
private List<String> printedMappings = null;
|
||||
private Stack<String> elements = null;
|
||||
private Map<String,Integer> stringIdx = null;
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = PropertyConfig.X4O_PROPERTIES_PREFIX+"writer/xdbx/";
|
||||
public final static PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"writer/xdbx/";
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
public final static String OUTPUT_DECLARATION = PROPERTY_CONTEXT_PREFIX+"output/declaration";
|
||||
public final static String OUTPUT_CHAR_NULL = PROPERTY_CONTEXT_PREFIX+"output/char-null";
|
||||
public final static String OUTPUT_COMMENT_ENABLE = PROPERTY_CONTEXT_PREFIX+"output/comment-enable";
|
||||
|
@ -80,12 +80,12 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
public final static String ROOT_START_NAMESPACE_ALL = PROPERTY_CONTEXT_PREFIX+"root/start-namespace-all";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,null,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(OUTPUT_DECLARATION, Boolean.class, true),
|
||||
new PropertyConfigItem(OUTPUT_CHAR_NULL, String.class, "NULL"),
|
||||
new PropertyConfigItem(OUTPUT_COMMENT_ENABLE, Boolean.class, true),
|
||||
new PropertyConfigItem(OUTPUT_COMMENT_AUTO_SPACE, Boolean.class, true),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_ENCODING, String.class, XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_ENCODING, String.class, SAX3XMLConstants.XML_DEFAULT_ENCODING),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_FILE, File.class ),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_RESOURCE, String.class ),
|
||||
new PropertyConfigItem(PROLOG_LICENCE_ENABLE, Boolean.class, true),
|
||||
|
@ -104,11 +104,11 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
this.prefixMapping = new HashMap<String,String>(15);
|
||||
this.printedMappings = new ArrayList<String>(15);
|
||||
this.elements = new Stack<String>();
|
||||
this.propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig = new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.stringIdx = new HashMap<>();
|
||||
}
|
||||
|
||||
public PropertyConfig getPropertyConfig() {
|
||||
public SAX3PropertyConfig getPropertyConfig() {
|
||||
return propertyConfig;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
|
||||
private String readLicenceStream(InputStream inputStream,String encoding) throws IOException {
|
||||
if (encoding==null) {
|
||||
encoding = XMLConstants.XML_DEFAULT_ENCODING;
|
||||
encoding = SAX3XMLConstants.XML_DEFAULT_ENCODING;
|
||||
}
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream,Charset.forName(encoding)));
|
||||
try {
|
||||
|
@ -256,7 +256,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
if (localName==null) {
|
||||
throw new SAXException("LocalName may not be null.");
|
||||
}
|
||||
if (XMLConstants.isNameString(localName)==false) {
|
||||
if (SAX3XMLConstants.isNameString(localName)==false) {
|
||||
throw new SAXException("LocalName of element is not valid in xml; '"+localName+"'");
|
||||
}
|
||||
for (int i=0;i<atts.getLength();i++) {
|
||||
|
@ -270,11 +270,11 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
int c = iterator.nextInt();
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
if (!XMLConstants.isNameStartChar(attrLocalName.codePoints().findFirst().getAsInt())) {
|
||||
if (!SAX3XMLConstants.isNameStartChar(attrLocalName.codePoints().findFirst().getAsInt())) {
|
||||
throw new SAXException("LocalAttributeName has illegal start character: " + attrLocalName);
|
||||
}
|
||||
}
|
||||
if (!XMLConstants.isNameChar(c)) {
|
||||
if (!SAX3XMLConstants.isNameChar(c)) {
|
||||
throw new SAXException("LocalAttributeName has illegal name character: " + attrLocalName);
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
startElementTag(uri,localName,name);
|
||||
startElementNamespace(uri);
|
||||
startElementAttributes(atts);
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
elements.push(localName);
|
||||
} else {
|
||||
elements.push(uri + ":" + name);
|
||||
|
@ -291,7 +291,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
|
||||
public void startElementTag(String uri, String localName,String name) throws SAXException {
|
||||
boolean localNameIdx = xdbxStringId(localName);
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
if (localNameIdx) {
|
||||
writeTag(XDBXContentTag.ELEMENT_I);
|
||||
writeVariableInteger(xdbxStringStore(localName));
|
||||
|
@ -320,7 +320,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
}
|
||||
|
||||
public void startElementNamespace(String uri) throws SAXException {
|
||||
if ((uri!=null & XMLConstants.NULL_NS_URI.equals(uri)==false) && printedMappings.contains(uri)==false) {
|
||||
if ((uri!=null & SAX3XMLConstants.NULL_NS_URI.equals(uri)==false) && printedMappings.contains(uri)==false) {
|
||||
String prefix = prefixMapping.get(uri);
|
||||
if (prefix==null) {
|
||||
throw new SAXException("preFixUri: "+uri+" is not started.");
|
||||
|
@ -362,11 +362,11 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
if (attributeValue==null) {
|
||||
attributeValue = propertyConfig.getPropertyString(OUTPUT_CHAR_NULL);
|
||||
}
|
||||
String attributeValueSafe = XMLConstants.escapeAttributeValue(attributeValue);
|
||||
String attributeValueSafe = SAX3XMLConstants.escapeAttributeValue(attributeValue);
|
||||
boolean attributeValueSimple = attributeValue.equals(attributeValueSafe);
|
||||
boolean attributeNameIdx = xdbxStringId(attributeName);
|
||||
|
||||
if (XMLConstants.NULL_NS_URI.equals(attributeUri) | attributeUri ==null) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(attributeUri) | attributeUri ==null) {
|
||||
if (attributeNameIdx) {
|
||||
writeTag(XDBXContentTag.ATTRIBUTE_I);
|
||||
writeVariableInteger(xdbxStringStore(attributeName));
|
||||
|
@ -407,7 +407,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void endElement(String uri, String localName, String name) throws SAXException {
|
||||
if (XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
|
||||
if (elements.size()>0 && elements.peek().equals(localName)==false) {
|
||||
throw new SAXException("Unexpected end tag: "+localName+" should be: "+elements.peek());
|
||||
}
|
||||
|
@ -482,13 +482,13 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
* Escape and prints xml characters.
|
||||
* @param text The text to write.
|
||||
* @throws SAXException When IOException has happend while printing.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#characters(java.lang.String)
|
||||
* @see org.x4o.sax3.io.ContentWriter#characters(java.lang.String)
|
||||
*/
|
||||
public void characters(String text) throws SAXException {
|
||||
if (text==null) {
|
||||
return;
|
||||
}
|
||||
charactersRaw(XMLConstants.escapeCharacters(text));
|
||||
charactersRaw(SAX3XMLConstants.escapeCharacters(text));
|
||||
}
|
||||
|
||||
public void characters(char c) throws SAXException {
|
||||
|
@ -521,7 +521,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
*
|
||||
* @param text The text to print.
|
||||
* @throws SAXException When IOException has happend while printing.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#ignorableWhitespace(java.lang.String)
|
||||
* @see org.x4o.sax3.io.ContentWriter#ignorableWhitespace(java.lang.String)
|
||||
*/
|
||||
public void ignorableWhitespace(String text) throws SAXException {
|
||||
if (text==null) {
|
||||
|
@ -549,13 +549,13 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
*/
|
||||
public void processingInstruction(String target, String data) throws SAXException {
|
||||
String targetLow = target.toLowerCase();
|
||||
if (targetLow.startsWith(XMLConstants.XML)) {
|
||||
if (targetLow.startsWith(SAX3XMLConstants.XML)) {
|
||||
throw new SAXException("Processing instruction may not start with xml.");
|
||||
}
|
||||
if (XMLConstants.isNameString(target)==false) {
|
||||
if (SAX3XMLConstants.isNameString(target)==false) {
|
||||
throw new SAXException("Processing instruction target is invalid name; '"+target+"'");
|
||||
}
|
||||
if (XMLConstants.isCharString(data)==false) {
|
||||
if (SAX3XMLConstants.isCharString(data)==false) {
|
||||
throw new SAXException("Processing instruction data is invalid char; '"+data+"'");
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
*
|
||||
* @param text The text to write.
|
||||
* @throws SAXException When IOException has happend while printing.
|
||||
* @see org.x4o.o2o.io.sax3.ContentWriter#comment(java.lang.String)
|
||||
* @see org.x4o.sax3.io.ContentWriter#comment(java.lang.String)
|
||||
*/
|
||||
public void comment(String text) throws SAXException {
|
||||
if (text==null) {
|
||||
|
@ -628,7 +628,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
|
|||
text = text + " ";
|
||||
}
|
||||
}
|
||||
writeTagLengthValue(XDBXContentTag.COMMENT, XMLConstants.escapeCharactersComment(text,"", 0));
|
||||
writeTagLengthValue(XDBXContentTag.COMMENT, SAX3XMLConstants.escapeCharactersComment(text,"", 0));
|
||||
}
|
||||
|
||||
protected void writeFlush() throws SAXException {
|
|
@ -20,11 +20,11 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.x4o.o2o.io.sax3.XMLConstants;
|
||||
import org.x4o.sax3.io.SAX3XMLConstants;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.ext.LexicalHandler;
|
||||
|
||||
|
@ -86,7 +86,7 @@ public abstract class AbstractXDBXWriterLexical extends AbstractXDBXWriterHandle
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.o2o.io.sax3.AbstractContentWriterHandler#characters(char[], int, int)
|
||||
* @see org.x4o.sax3.io.AbstractContentWriterHandler#characters(char[], int, int)
|
||||
*/
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
|
@ -94,12 +94,12 @@ public abstract class AbstractXDBXWriterLexical extends AbstractXDBXWriterHandle
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.o2o.io.sax3.AbstractContentWriterHandler#characters(java.lang.String)
|
||||
* @see org.x4o.sax3.io.AbstractContentWriterHandler#characters(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void characters(String text) throws SAXException {
|
||||
if (printCDATA) {
|
||||
String textSafe = XMLConstants.escapeCharactersCdata(text,"","");
|
||||
String textSafe = SAX3XMLConstants.escapeCharactersCdata(text,"","");
|
||||
writeTagLengthValue(XDBXContentTag.TEXT_CDATA, textSafe);
|
||||
} else {
|
||||
super.characters(text);
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
/**
|
||||
* XDBXConstants for writing binary XML.
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
/**
|
||||
* XDBXContentTag indicate the binary tag of the XDBX stream.
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -29,7 +29,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriter;
|
||||
import org.x4o.sax3.io.ContentWriter;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
|
@ -26,4 +26,4 @@
|
|||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
|
@ -22,8 +22,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The SAX Extended classes and interfaces.
|
||||
* X4O SAX 3 and binary XML support classes.
|
||||
*
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3;
|
|
@ -20,9 +20,10 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
|
@ -33,6 +34,7 @@ import javax.xml.parsers.SAXParserFactory;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
@ -44,19 +46,18 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 S 17, 2012
|
||||
*/
|
||||
public class ContentWriterXmlAttributeTest {
|
||||
public class SAX3WriterXmlAttributeTest {
|
||||
|
||||
@Test
|
||||
public void testAttributeNormal() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "attr", "", "", "foobar");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "attr", "", "", "foobar");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -66,14 +67,13 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeEscape() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "attr", "", "", "<test/> & 'foobar' is \"quoted\"!");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "attr", "", "", "<test/> & 'foobar' is \"quoted\"!");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -83,7 +83,7 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeWhiteSpace() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
writer.startDocument();
|
||||
|
||||
Assertions.assertThrows(SAXException.class, () -> {
|
||||
|
@ -121,14 +121,13 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeChinees() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "仙上主天", "", "", "仙上主天");
|
||||
writer.startElementEnd("", "chinees", "", atts);
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "仙上主天", "", "", "仙上主天");
|
||||
writer.startElementEnd("", "chinees", "", atts);
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -144,16 +143,15 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeBrahmi() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
// Legal by spec, but not in JVM SAX Reader
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕", "", "", "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕");
|
||||
atts.addAttribute ("", "ᒡᒢᑊᒻᒻᓫᔿ", "", "", "ᒡᒢᑊᒻᒻᓫᔿ");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
// Legal by spec, but not in JVM SAX Reader
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕", "", "", "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕");
|
||||
atts.addAttribute ("", "ᒡᒢᑊᒻᒻᓫᔿ", "", "", "ᒡᒢᑊᒻᒻᓫᔿ");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -168,29 +166,28 @@ public class ContentWriterXmlAttributeTest {
|
|||
});
|
||||
}
|
||||
|
||||
private String createLongAttribute(Map<String,Object> para) throws SAXException {
|
||||
private String createLongAttribute(Map<String,Object> para) throws SAXException, IOException {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
for (String key:para.keySet()) {
|
||||
Object value = para.get(key);
|
||||
writer.getPropertyConfig().setProperty(key, value);
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
for (String key:para.keySet()) {
|
||||
Object value = para.get(key);
|
||||
writer.getPropertyConfig().setProperty(key, value);
|
||||
}
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
String data = "_FOR_FOO_BAR";
|
||||
String dataValue = "LOOP";
|
||||
for (int i=0;i<15;i++) {
|
||||
atts.addAttribute("", "attr"+i, "", "", dataValue+=data);
|
||||
}
|
||||
writer.startDocument();
|
||||
writer.startElement("", "test", "", atts);
|
||||
writer.startElement("", "testNode", "", new AttributesImpl());
|
||||
writer.endElement("", "testNode", "");
|
||||
writer.endElement("", "test", "");
|
||||
writer.endDocument();
|
||||
}
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
String data = "_FOR_FOO_BAR";
|
||||
String dataValue = "LOOP";
|
||||
for (int i=0;i<15;i++) {
|
||||
atts.addAttribute("", "attr"+i, "", "", dataValue+=data);
|
||||
}
|
||||
writer.startDocument();
|
||||
writer.startElement("", "test", "", atts);
|
||||
writer.startElement("", "testNode", "", new AttributesImpl());
|
||||
writer.endElement("", "testNode", "");
|
||||
writer.endElement("", "test", "");
|
||||
writer.endDocument();
|
||||
|
||||
String output = outputWriter.toString();
|
||||
return output;
|
||||
return outputWriter.toString();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -205,7 +202,7 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeLongPerLine() throws Exception {
|
||||
Map<String,Object> para = new HashMap<String,Object>();
|
||||
para.put(ContentWriterXml.OUTPUT_LINE_PER_ATTRIBUTE, true);
|
||||
para.put(SAX3WriterXml.OUTPUT_LINE_PER_ATTRIBUTE, true);
|
||||
String output = createLongAttribute(para);
|
||||
int newlines = output.split("\n").length;
|
||||
Assertions.assertNotNull(output);
|
||||
|
@ -215,7 +212,7 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeLongSplit80() throws Exception {
|
||||
Map<String,Object> para = new HashMap<String,Object>();
|
||||
para.put(ContentWriterXml.OUTPUT_LINE_BREAK_WIDTH, 80);
|
||||
para.put(SAX3WriterXml.OUTPUT_LINE_BREAK_WIDTH, 80);
|
||||
String output = createLongAttribute(para);
|
||||
int newlines = output.split("\n").length;
|
||||
Assertions.assertNotNull(output);
|
||||
|
@ -225,7 +222,7 @@ public class ContentWriterXmlAttributeTest {
|
|||
@Test
|
||||
public void testAttributeLongSplit180() throws Exception {
|
||||
Map<String,Object> para = new HashMap<String,Object>();
|
||||
para.put(ContentWriterXml.OUTPUT_LINE_BREAK_WIDTH, 180);
|
||||
para.put(SAX3WriterXml.OUTPUT_LINE_BREAK_WIDTH, 180);
|
||||
String output = createLongAttribute(para);
|
||||
int newlines = output.split("\n").length;
|
||||
Assertions.assertNotNull(output);
|
|
@ -20,12 +20,13 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
|
||||
/**
|
||||
* ContentWriterXmlCDataTest tests cdata xml escaping.
|
||||
|
@ -33,17 +34,16 @@ import org.junit.jupiter.api.Test;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 17, 2013
|
||||
*/
|
||||
public class ContentWriterXmlCDataTest {
|
||||
public class SAX3WriterXmlCDataTest {
|
||||
|
||||
@Test
|
||||
public void testCDATANone() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.characters("foobar");
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.characters("foobar");
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -53,12 +53,11 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATANoneTagEscape() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.characters("foobar<test/>");
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.characters("foobar<test/>");
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -68,14 +67,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATANormal() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("foobar");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("foobar");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -85,14 +83,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATAEscapeTag() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("foobar<test/>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("foobar<test/>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -102,14 +99,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATAEscapeStart() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("<![CDATA[foobar");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("<![CDATA[foobar");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -119,14 +115,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATAEscapeEnd() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("foobar]]>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("foobar]]>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -136,14 +131,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATAEscapeEndEskimo() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("ᒡᒢᑊᒻ]]>ᒻᓫᔿ");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("ᒡᒢᑊᒻ]]>ᒻᓫᔿ");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -153,14 +147,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATAEscapeInvalid() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("<![CDATA[tokens like ']]>' are <invalid>]]>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("<![CDATA[tokens like ']]>' are <invalid>]]>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -170,14 +163,13 @@ public class ContentWriterXmlCDataTest {
|
|||
@Test
|
||||
public void testCDATAEscapeValid() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("<![CDATA[tokens like ']]]]><![CDATA[>' are <valid>]]>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.startCDATA();
|
||||
writer.characters("<![CDATA[tokens like ']]]]><![CDATA[>' are <valid>]]>");
|
||||
writer.endCDATA();
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
|
@ -20,12 +20,13 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3;
|
||||
package org.x4o.sax3.io;
|
||||
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
|
@ -35,17 +36,16 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 26, 2012
|
||||
*/
|
||||
public class ContentWriterXmlTest {
|
||||
public class SAX3WriterXmlTest {
|
||||
|
||||
@Test
|
||||
public void testCharactersNormal() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.characters("test is foobar!");
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.characters("test is foobar!");
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -55,12 +55,11 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testCharactersEscape() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.characters("<test/> & 'foobar' is \"quoted\"!");
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.characters("<test/> & 'foobar' is \"quoted\"!");
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -70,12 +69,11 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testCommentNormal() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.comment("foobar");
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.comment("foobar");
|
||||
writer.endDocument();
|
||||
}
|
||||
String output = outputWriter.toString();
|
||||
Assertions.assertNotNull(output);
|
||||
Assertions.assertTrue(output.length()>0);
|
||||
|
@ -85,12 +83,11 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testCommentEscape() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
|
||||
writer.startDocument();
|
||||
writer.comment("<!-- foobar -->");
|
||||
writer.endDocument();
|
||||
|
||||
try (SAX3WriterXml writer = new SAX3WriterXml(outputWriter)) {
|
||||
writer.startDocument();
|
||||
writer.comment("<!-- foobar -->");
|
||||
writer.endDocument();
|
||||
}
|
||||
// note two space because auto-space is before escaping and places spaces over comment tags.
|
||||
// 1) "<!-- foobar -->" - argu
|
||||
// 2) " <!-- foobar --> " - auto-space (default enabled)
|
||||
|
@ -106,7 +103,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testXmlInvalid() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
|
||||
Exception e = null;
|
||||
|
@ -128,7 +125,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testXmlInvalidEnd() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
|
||||
Exception e = null;
|
||||
|
@ -150,7 +147,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testProcessingInstruction() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
|
||||
Exception e = null;
|
||||
|
@ -173,7 +170,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testProcessingInstructionInline() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
|
||||
Exception e = null;
|
||||
|
@ -197,7 +194,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testProcessingInstructionTargetXmlPrefix() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
Exception e = null;
|
||||
try {
|
||||
writer.startDocument();
|
||||
|
@ -214,7 +211,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testProcessingInstructionTargetNoneNameChar() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
Exception e = null;
|
||||
try {
|
||||
writer.startDocument();
|
||||
|
@ -232,7 +229,7 @@ public class ContentWriterXmlTest {
|
|||
@Test
|
||||
public void testProcessingInstructionDataNoneChar() throws Exception {
|
||||
StringWriter outputWriter = new StringWriter();
|
||||
ContentWriterXml writer = new ContentWriterXml(outputWriter);
|
||||
SAX3WriterXml writer = new SAX3WriterXml(outputWriter);
|
||||
Exception e = null;
|
||||
try {
|
||||
writer.startDocument();
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -33,7 +33,7 @@ import javax.xml.parsers.SAXParserFactory;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
@ -49,16 +49,16 @@ public class XDBXReaderXmlTest {
|
|||
@Test
|
||||
public void testReadWrite() throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
XDBXWriterXml writer = new XDBXWriterXml(baos);
|
||||
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "attr", "", "", "foobar");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
try (XDBXWriterXml writer = new XDBXWriterXml(baos)) {
|
||||
writer.startDocument();
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "attr", "", "", "foobar");
|
||||
writer.startElementEnd("", "test", "", atts);
|
||||
writer.endDocument();
|
||||
}
|
||||
|
||||
StringWriter outputXmlStr = new StringWriter();
|
||||
ContentWriterXml outputXml = new ContentWriterXml(outputXmlStr);
|
||||
SAX3WriterXml outputXml = new SAX3WriterXml(outputXmlStr);
|
||||
XDBXReaderXml reader = new XDBXReaderXml(outputXml);
|
||||
byte[] writeData = baos.toByteArray();
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(writeData);
|
||||
|
@ -84,7 +84,7 @@ public class XDBXReaderXmlTest {
|
|||
saxReader.parse(new InputSource(new FileInputStream(new File("../pom.xml"))));
|
||||
|
||||
StringWriter outputXmlStr = new StringWriter();
|
||||
ContentWriterXml outputXml = new ContentWriterXml(outputXmlStr);
|
||||
SAX3WriterXml outputXml = new SAX3WriterXml(outputXmlStr);
|
||||
XDBXReaderXml reader = new XDBXReaderXml(outputXml);
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
|
||||
reader.parse(bais);
|
|
@ -20,7 +20,7 @@
|
|||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.o2o.io.sax3.xdbx;
|
||||
package org.x4o.sax3.io.xdbx;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -28,7 +28,7 @@ import java.io.StringWriter;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
|
@ -42,27 +42,28 @@ public class XDBXWriterXmlTest {
|
|||
@Test
|
||||
public void testExample1DefaultEncoding() throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
XDBXWriterXml writer = new XDBXWriterXml(baos);
|
||||
writer.getPropertyConfig().setProperty(XDBXWriterXml.OUTPUT_DECLARATION, false);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startElement("", "root", "", new AttributesImpl());
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "mgr", "", "", "NO");
|
||||
writer.startElement("", "name", "", atts);
|
||||
writer.characters("Joe");
|
||||
writer.endElement("", "name", "");
|
||||
|
||||
writer.startElement("", "name", "", new AttributesImpl());
|
||||
writer.characters("Susan");
|
||||
writer.endElement("", "name", "");
|
||||
writer.startElement("", "name", "", new AttributesImpl());
|
||||
writer.characters("Bill");
|
||||
writer.endElement("", "name", "");
|
||||
|
||||
writer.endElement("", "root", "");
|
||||
writer.endDocument();
|
||||
try (XDBXWriterXml writer = new XDBXWriterXml(baos)) {
|
||||
writer.getPropertyConfig().setProperty(XDBXWriterXml.OUTPUT_DECLARATION, false);
|
||||
|
||||
writer.startDocument();
|
||||
writer.startElement("", "root", "", new AttributesImpl());
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "mgr", "", "", "NO");
|
||||
writer.startElement("", "name", "", atts);
|
||||
writer.characters("Joe");
|
||||
writer.endElement("", "name", "");
|
||||
|
||||
writer.startElement("", "name", "", new AttributesImpl());
|
||||
writer.characters("Susan");
|
||||
writer.endElement("", "name", "");
|
||||
writer.startElement("", "name", "", new AttributesImpl());
|
||||
writer.characters("Bill");
|
||||
writer.endElement("", "name", "");
|
||||
|
||||
writer.endElement("", "root", "");
|
||||
writer.endDocument();
|
||||
}
|
||||
|
||||
byte[] output = baos.toByteArray();
|
||||
int outIdx = 8;
|
||||
|
@ -139,38 +140,39 @@ public class XDBXWriterXmlTest {
|
|||
@Test
|
||||
public void testExample3StringIds() throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
XDBXWriterXml writer = new XDBXWriterXml(baos);
|
||||
writer.getPropertyConfig().setProperty(XDBXWriterXml.OUTPUT_DECLARATION, false);
|
||||
AttributesImpl atts;
|
||||
|
||||
writer.startDocument();
|
||||
writer.startPrefixMapping("foo", "bar");
|
||||
writer.startElement("", "root", "", new AttributesImpl());
|
||||
|
||||
writer.startElement("", "Person", "", new AttributesImpl());
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "mgr", "", "", "NO");
|
||||
writer.startElement("", "name", "", atts);
|
||||
writer.characters("Bill");
|
||||
writer.endElement("", "name", "");
|
||||
writer.startElement("bar", "age", "age", new AttributesImpl());
|
||||
writer.characters("35");
|
||||
writer.endElement("bar", "age", "age");
|
||||
writer.endElement("", "Person", "");
|
||||
|
||||
writer.startElement("", "Person", "", new AttributesImpl());
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "mgr", "", "", "NO");
|
||||
writer.startElement("", "name", "", atts);
|
||||
writer.characters("Joe");
|
||||
writer.endElement("", "name", "");
|
||||
writer.startElement("bar", "age", "age", new AttributesImpl());
|
||||
writer.characters("45");
|
||||
writer.endElement("bar", "age", "age");
|
||||
writer.endElement("", "Person", "");
|
||||
|
||||
writer.endElement("", "root", "");
|
||||
writer.endDocument();
|
||||
try (XDBXWriterXml writer = new XDBXWriterXml(baos)) {
|
||||
writer.getPropertyConfig().setProperty(XDBXWriterXml.OUTPUT_DECLARATION, false);
|
||||
AttributesImpl atts;
|
||||
|
||||
writer.startDocument();
|
||||
writer.startPrefixMapping("foo", "bar");
|
||||
writer.startElement("", "root", "", new AttributesImpl());
|
||||
|
||||
writer.startElement("", "Person", "", new AttributesImpl());
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "mgr", "", "", "NO");
|
||||
writer.startElement("", "name", "", atts);
|
||||
writer.characters("Bill");
|
||||
writer.endElement("", "name", "");
|
||||
writer.startElement("bar", "age", "age", new AttributesImpl());
|
||||
writer.characters("35");
|
||||
writer.endElement("bar", "age", "age");
|
||||
writer.endElement("", "Person", "");
|
||||
|
||||
writer.startElement("", "Person", "", new AttributesImpl());
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "mgr", "", "", "NO");
|
||||
writer.startElement("", "name", "", atts);
|
||||
writer.characters("Joe");
|
||||
writer.endElement("", "name", "");
|
||||
writer.startElement("bar", "age", "age", new AttributesImpl());
|
||||
writer.characters("45");
|
||||
writer.endElement("bar", "age", "age");
|
||||
writer.endElement("", "Person", "");
|
||||
|
||||
writer.endElement("", "root", "");
|
||||
writer.endDocument();
|
||||
}
|
||||
|
||||
byte[] output = baos.toByteArray();
|
||||
int outIdx = 8;
|
||||
|
@ -290,7 +292,7 @@ public class XDBXWriterXmlTest {
|
|||
Assertions.assertEquals((byte)'Z', output[outIdx++]);
|
||||
|
||||
StringWriter outputXmlStr = new StringWriter();
|
||||
ContentWriterXml outputXml = new ContentWriterXml(outputXmlStr);
|
||||
SAX3WriterXml outputXml = new SAX3WriterXml(outputXmlStr);
|
||||
XDBXReaderXml reader = new XDBXReaderXml(outputXml);
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(output);
|
||||
reader.parse(bais);
|
|
@ -31,9 +31,9 @@ import java.io.BufferedWriter;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
|
||||
import org.x4o.o2o.io.sax3.ContentWriterXml;
|
||||
import org.x4o.o2o.io.sax3.xdbx.XDBXWriterXml;
|
||||
import org.x4o.sax3.SAX3WriterEnum;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.xdbx.XDBXWriterXml;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
|
@ -56,7 +56,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
|
|||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
if ("true".equalsIgnoreCase(request.getParameter("___xdbx"))) {
|
||||
response.setContentType("application/octet-stream");
|
||||
try (ContentWriterTagWrapper<Tag,?> writer = new ContentWriterTagWrapper<Tag,XDBXWriterXml>(new XDBXWriterXml(response.getOutputStream()))) {
|
||||
try (SAX3WriterEnum<Tag,?> writer = new SAX3WriterEnum<Tag,XDBXWriterXml>(new XDBXWriterXml(response.getOutputStream()))) {
|
||||
printReport(writer, request);
|
||||
}
|
||||
return;
|
||||
|
@ -64,13 +64,13 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
|
|||
response.setContentType("text/xml");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
BufferedWriter out = new BufferedWriter(response.getWriter());
|
||||
try (ContentWriterTagWrapper<Tag,?> writer = new ContentWriterTagWrapper<Tag,ContentWriterXml>(new ContentWriterXml(out, response.getCharacterEncoding()))) {
|
||||
try (SAX3WriterEnum<Tag,?> writer = new SAX3WriterEnum<Tag,SAX3WriterXml>(new SAX3WriterXml(out, response.getCharacterEncoding()))) {
|
||||
printReport(writer, request);
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
private void printReport(ContentWriterTagWrapper<Tag,?> writer, HttpServletRequest request) {
|
||||
private void printReport(SAX3WriterEnum<Tag,?> writer, HttpServletRequest request) {
|
||||
WarpCoreReactor reactor = ZeroFungus.INSTANCE.getWarpCore();
|
||||
List<WarpReactPlasma> slots = reactor.listChilds(null);
|
||||
try {
|
||||
|
@ -94,7 +94,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
private void printSlotContract(ContentWriterTagWrapper<Tag,?> writer, WarpCorePlasmaIntermixChamber contract) throws IOException {
|
||||
private void printSlotContract(SAX3WriterEnum<Tag,?> writer, WarpCorePlasmaIntermixChamber contract) throws IOException {
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
atts.addAttribute("", "path", "", "", contract.getSlot().getSlotPath());
|
||||
writer.printTagStart(Tag.slot, atts);
|
||||
|
@ -105,7 +105,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
|
|||
writer.printTagEnd(Tag.slot);
|
||||
}
|
||||
|
||||
private void printClaims(ContentWriterTagWrapper<Tag,?> writer, Tag tag, List<Class<?>> clazzes) throws IOException {
|
||||
private void printClaims(SAX3WriterEnum<Tag,?> writer, Tag tag, List<Class<?>> clazzes) throws IOException {
|
||||
if (clazzes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
|
|||
writer.printTagEnd(tag);
|
||||
}
|
||||
|
||||
private void printRequireServices(ContentWriterTagWrapper<Tag,?> writer, List<Class<?>> clazzes) throws IOException {
|
||||
private void printRequireServices(SAX3WriterEnum<Tag,?> writer, List<Class<?>> clazzes) throws IOException {
|
||||
if (clazzes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
|
|||
writer.printTagEnd(Tag.requireServices);
|
||||
}
|
||||
|
||||
private void printRequireSlots(ContentWriterTagWrapper<Tag,?> writer, List<WarpReactPlasma> slots) throws IOException {
|
||||
private void printRequireSlots(SAX3WriterEnum<Tag,?> writer, List<WarpReactPlasma> slots) throws IOException {
|
||||
if (slots.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -53,6 +53,7 @@
|
|||
<module>nx01-x4o-tool-ant-plugin</module>
|
||||
<module>nx01-x4o-tool-maven-plugin</module>
|
||||
<module>nx01-zerofungus-server</module>
|
||||
<module>nx01-x4o-sax3</module>
|
||||
</modules>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
@ -393,6 +394,11 @@
|
|||
<artifactId>nx01-x4o-o2o</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-x4o-sax3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-x4o-tool-ant-plugin</artifactId>
|
||||
|
|
Loading…
Reference in a new issue