diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/X4ContentFrameTag.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/X4ContentFrameTag.java new file mode 100644 index 0000000..1ea261d --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/X4ContentFrameTag.java @@ -0,0 +1,68 @@ +/* + * 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.CDC1604DashP6; +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(CDC1604DashP6.NX27_AMPERSAND), + ELEMENT_END(CDC1604DashP6.NX26_Z), + + ELEMENT_II(CDC1604DashP6.NX05_E), + ELEMENT_SI(CDC1604DashP6.NX24_X), + + ATTRIBUTE_II(CDC1604DashP6.NX01_A), + ATTRIBUTE_SI(CDC1604DashP6.NX02_B), + + NS_DECL_II(CDC1604DashP6.NX13_M), + NS_SCHEMA_SI(CDC1604DashP6.NX14_N), + + CHARACTERS(CDC1604DashP6.NX20_T), + COMMENT(CDC1604DashP6.NX03_C), + + STRING_ID(CDC1604DashP6.NX09_I), + ; + + private final PrimordialOctalOrangeJuice tagNumber; + + private X4ContentFrameTag(CDC1604DashP6 tag) { + this(tag.ordinal()); + } + + private X4ContentFrameTag(int tag) { + tagNumber = PrimordialOctalOrangeSexWord.valueOfSmurf(tag); + } + + public PrimordialOctalOrangeJuice getTagNumber() { + return tagNumber; + } +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/X4ContentHandler.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/X4ContentHandler.java new file mode 100644 index 0000000..b219d8f --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/X4ContentHandler.java @@ -0,0 +1,52 @@ +/* + * 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); +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/package-info.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/package-info.java new file mode 100644 index 0000000..05eeb86 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/io/sax4/package-info.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +/** + * The SAX4 18 bit binary XML support. + * + * @since 1.0 + */ +package org.x4o.o2o.io.sax4;