Renamed and cleaned manifest V5 XML tag enum

This commit is contained in:
Willem Cazander 2024-12-27 19:07:51 +01:00
parent 5104767aa1
commit 05f977e3ca
3 changed files with 20 additions and 34 deletions

View file

@ -92,18 +92,18 @@ public class ScopicManifest5ContentParser extends ContentWriterAdapter {
@Override @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (ScopicManifest5FrameElement.ATTRIBUTE.name().equals(localName)) { if (ScopicManifest5FrameTag.ATTRIBUTE.name().equals(localName)) {
attrName = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameElement.ATTRIBUTE_NAME); attrName = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.ATTRIBUTE_NAME);
return; return;
} }
if (ScopicManifest5FrameElement.SECTION.name().equals(localName)) { if (ScopicManifest5FrameTag.SECTION.name().equals(localName)) {
attrMain = false; attrMain = false;
String sectionName = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameElement.SECTION_NAME); String sectionName = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.SECTION_NAME);
handler.strobeSectionHeader(sectionName); handler.strobeSectionHeader(sectionName);
return; return;
} }
if (ScopicManifest5FrameElement.MANIFEST.name().equals(localName)) { if (ScopicManifest5FrameTag.MANIFEST.name().equals(localName)) {
String version = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameElement.MANIFEST_VERSION); String version = attributes.getValue(XMLConstants.NULL_NS_URI, ScopicManifest5FrameTag.MANIFEST_VERSION);
handler.strobeManifestDeclaration(version); handler.strobeManifestDeclaration(version);
return; return;
} }
@ -112,7 +112,7 @@ public class ScopicManifest5ContentParser extends ContentWriterAdapter {
@Override @Override
public void endElement(String uri, String localName, String qName) throws SAXException { public void endElement(String uri, String localName, String qName) throws SAXException {
if (ScopicManifest5FrameElement.ATTRIBUTE.name().equals(localName)) { if (ScopicManifest5FrameTag.ATTRIBUTE.name().equals(localName)) {
if (attrMain) { if (attrMain) {
handler.strobeMainAttribute(attrName, attrValue.toString()); handler.strobeMainAttribute(attrName, attrValue.toString());
} else { } else {
@ -121,7 +121,7 @@ public class ScopicManifest5ContentParser extends ContentWriterAdapter {
attrValue = new StringBuilder(); attrValue = new StringBuilder();
return; return;
} }
if (ScopicManifest5FrameElement.SECTION.name().equals(localName)) { if (ScopicManifest5FrameTag.SECTION.name().equals(localName)) {
attrMain = true; // Support normal xml tree layout attrMain = true; // Support normal xml tree layout
return; return;
} }

View file

@ -45,7 +45,7 @@ import love.distributedrebirth.nx01.warp.manifestor.scopic.iomf.ScopicManifestCo
/// @version ©Δ 仙上主天 /// @version ©Δ 仙上主天
public class ScopicManifest5ContentWriter implements ScopicManifestContent<String> { public class ScopicManifest5ContentWriter implements ScopicManifestContent<String> {
private final ContentWriterTagWrapper<ScopicManifest5FrameElement, ContentWriter> writer; private final ContentWriterTagWrapper<ScopicManifest5FrameTag, ContentWriter> writer;
private final ScopicManifestDuplicateDetector<String> duplicateDetector; private final ScopicManifestDuplicateDetector<String> duplicateDetector;
private boolean openSection = false; private boolean openSection = false;
@ -70,8 +70,8 @@ public class ScopicManifest5ContentWriter implements ScopicManifestContent<Strin
} }
try { try {
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", ScopicManifest5FrameElement.MANIFEST_VERSION, "", "", WarpManifestX0TheVersion.VERSION_5_0.getQName()); atts.addAttribute ("", ScopicManifest5FrameTag.MANIFEST_VERSION, "", "", WarpManifestX0TheVersion.VERSION_5_0.getQName());
writer.printTagStart(ScopicManifest5FrameElement.MANIFEST, atts); writer.printTagStart(ScopicManifest5FrameTag.MANIFEST, atts);
} catch (SAXException e) { } catch (SAXException e) {
throw new ScopicManifestException(e); throw new ScopicManifestException(e);
} }
@ -89,11 +89,11 @@ public class ScopicManifest5ContentWriter implements ScopicManifestContent<Strin
duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE); duplicateDetector.clearPart(ScopicManifestDuplicatePart.SECTION_ATTRIBUTE);
try { try {
if (openSection) { if (openSection) {
writer.printTagEnd(ScopicManifest5FrameElement.SECTION); writer.printTagEnd(ScopicManifest5FrameTag.SECTION);
} }
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", ScopicManifest5FrameElement.SECTION_NAME, "", "", sectionName); atts.addAttribute ("", ScopicManifest5FrameTag.SECTION_NAME, "", "", sectionName);
writer.printTagStart(ScopicManifest5FrameElement.SECTION, atts); writer.printTagStart(ScopicManifest5FrameTag.SECTION, atts);
openSection = true; openSection = true;
} catch (SAXException e) { } catch (SAXException e) {
throw new ScopicManifestException(e); throw new ScopicManifestException(e);
@ -120,10 +120,10 @@ public class ScopicManifest5ContentWriter implements ScopicManifestContent<Strin
duplicateDetector.clearAll(); duplicateDetector.clearAll();
try { try {
if (openSection) { if (openSection) {
writer.printTagEnd(ScopicManifest5FrameElement.SECTION); writer.printTagEnd(ScopicManifest5FrameTag.SECTION);
openSection = false; openSection = false;
} }
writer.printTagEnd(ScopicManifest5FrameElement.MANIFEST); writer.printTagEnd(ScopicManifest5FrameTag.MANIFEST);
writer.endDocument(); writer.endDocument();
} catch (SAXException e) { } catch (SAXException e) {
throw new ScopicManifestException(e); throw new ScopicManifestException(e);
@ -136,10 +136,10 @@ public class ScopicManifest5ContentWriter implements ScopicManifestContent<Strin
} }
try { try {
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", ScopicManifest5FrameElement.ATTRIBUTE_NAME, "", "", name); atts.addAttribute ("", ScopicManifest5FrameTag.ATTRIBUTE_NAME, "", "", name);
writer.printTagStart(ScopicManifest5FrameElement.ATTRIBUTE, atts); writer.printTagStart(ScopicManifest5FrameTag.ATTRIBUTE, atts);
writer.printCharacters(value); writer.printCharacters(value);
writer.printTagEnd(ScopicManifest5FrameElement.ATTRIBUTE); writer.printTagEnd(ScopicManifest5FrameTag.ATTRIBUTE);
} catch (SAXException e) { } catch (SAXException e) {
throw new ScopicManifestException(e); throw new ScopicManifestException(e);
} }

View file

@ -27,27 +27,13 @@
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5; package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
import org.x4o.o2o.io.tlv.TLVChainSexTeenBitFrameType;
/// @author للَّٰهِilLצسُو /// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天 /// @version ©Δ 仙上主天
public enum ScopicManifest5FrameElement { public enum ScopicManifest5FrameTag {
MANIFEST, MANIFEST,
ATTRIBUTE, ATTRIBUTE,
SECTION, SECTION,
/*
META_DECLARATION_VERSION (22), // SYN Synchronize
META_REMARK_CONTENT (7), // BEL Bell
MAIN_ATTRIBUTE_NAME (2), // STX Start of Text
MAIN_ATTRIBUTE_BODY (3), // ETX End of Text
SECTION_HEADER_NAME (1), // SOH Start of Heading
SECTION_ATTRIBUTE_NAME (5), // ENQ Enquiry
SECTION_ATTRIBUTE_BODY (6), // ACK Acknowledge
*/
; ;
static public final String MANIFEST_VERSION = "VERSION"; static public final String MANIFEST_VERSION = "VERSION";