mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 18:51:56 +00:00
Create XFL export with xml writer, currnetly only for PublishSettings.xml
This commit is contained in:
@@ -32,7 +32,6 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
import com.jpexs.decompiler.flash.tags.CSMTextSettingsTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineButtonCxformTag;
|
||||
@@ -112,11 +111,9 @@ import com.jpexs.helpers.SerializableImage;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.awt.Font;
|
||||
import java.awt.Point;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -134,6 +131,7 @@ import java.util.logging.Logger;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
@@ -2258,7 +2256,7 @@ public class XFLConverter {
|
||||
if (ret2.length() > 0) {
|
||||
ret.append("<DOMLayer name=\"Layer ").append(layerIndex).append("\" color=\"").append(randomOutlineColor()).append("\">"
|
||||
+ "<frames>").append(ret2).append("</frames>"
|
||||
+ "</DOMLayer>");
|
||||
+ "</DOMLayer>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2474,9 +2472,11 @@ public class XFLConverter {
|
||||
}
|
||||
ret.append(antiAlias);
|
||||
if (((CharacterTag) tag).getCharacterId() == 650) {
|
||||
// todo: remove
|
||||
System.err.println("=========================AAAAAAAAAAA");
|
||||
}
|
||||
Map<String, Object> attrs = TextTag.getTextRecordsAttributes(textRecords, swf);
|
||||
// todo: remove
|
||||
System.err.println("///////////=============");
|
||||
ret.append(" width=\"").append(tag.getBounds().getWidth() / 2).append("\" height=\"").append(tag.getBounds().getHeight()).append("\" autoExpand=\"true\" isSelectable=\"false\">");
|
||||
ret.append(matStr);
|
||||
@@ -2826,237 +2826,259 @@ public class XFLConverter {
|
||||
|
||||
int flaSwfVersion = swf.version > flaVersion.maxSwfVersion() ? flaVersion.maxSwfVersion() : swf.version;
|
||||
boolean greaterThanCC = flaVersion.ordinal() >= FLAVersion.CC.ordinal();
|
||||
StringBuilder publishSettings = new StringBuilder();
|
||||
publishSettings.append("<flash_profiles>\n");
|
||||
publishSettings.append("<flash_profile version=\"1.0\" name=\"Default\" current=\"true\">\n");
|
||||
publishSettings.append(" <PublishFormatProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <defaultNames>1</defaultNames>\n");
|
||||
publishSettings.append(" <flash>1</flash>\n");
|
||||
publishSettings.append(" <projectorWin>0</projectorWin>\n");
|
||||
publishSettings.append(" <projectorMac>0</projectorMac>\n");
|
||||
publishSettings.append(" <html>1</html>\n");
|
||||
publishSettings.append(" <gif>0</gif>\n");
|
||||
publishSettings.append(" <jpeg>0</jpeg>\n");
|
||||
publishSettings.append(" <png>0</png>\n");
|
||||
publishSettings.append(greaterThanCC ? " <svg>0</svg>\n" : " <qt>0</qt>\n");
|
||||
publishSettings.append(" <rnwk>0</rnwk>\n");
|
||||
publishSettings.append(" <swc>0</swc>\n");
|
||||
publishSettings.append(" <flashDefaultName>1</flashDefaultName>\n");
|
||||
publishSettings.append(" <projectorWinDefaultName>1</projectorWinDefaultName>\n");
|
||||
publishSettings.append(" <projectorMacDefaultName>1</projectorMacDefaultName>\n");
|
||||
publishSettings.append(" <htmlDefaultName>1</htmlDefaultName>\n");
|
||||
publishSettings.append(" <gifDefaultName>1</gifDefaultName>\n");
|
||||
publishSettings.append(" <jpegDefaultName>1</jpegDefaultName>\n");
|
||||
publishSettings.append(" <pngDefaultName>1</pngDefaultName>\n");
|
||||
publishSettings.append(greaterThanCC ? " <svgDefaultName>1</svgDefaultName>\n" : " <qtDefaultName>1</qtDefaultName>\n");
|
||||
publishSettings.append(" <rnwkDefaultName>1</rnwkDefaultName>\n");
|
||||
publishSettings.append(" <swcDefaultName>1</swcDefaultName>\n");
|
||||
publishSettings.append(" <flashFileName>").append(baseName).append(".swf</flashFileName>\n");
|
||||
publishSettings.append(" <projectorWinFileName>").append(baseName).append(".exe</projectorWinFileName>\n");
|
||||
publishSettings.append(" <projectorMacFileName>").append(baseName).append(".app</projectorMacFileName>\n");
|
||||
publishSettings.append(" <htmlFileName>").append(baseName).append(".html</htmlFileName>\n");
|
||||
publishSettings.append(" <gifFileName>").append(baseName).append(".gif</gifFileName>\n");
|
||||
publishSettings.append(" <jpegFileName>").append(baseName).append(".jpg</jpegFileName>\n");
|
||||
publishSettings.append(" <pngFileName>").append(baseName).append(".png</pngFileName>\n");
|
||||
publishSettings.append(greaterThanCC ? " <svgFileName>1</svgFileName>\n" : " <qtFileName>1</qtFileName>\n");
|
||||
publishSettings.append(" <rnwkFileName>").append(baseName).append(".smil</rnwkFileName>\n");
|
||||
publishSettings.append(" <swcFileName>").append(baseName).append(".swc</swcFileName>\n");
|
||||
publishSettings.append(" </PublishFormatProperties>\n");
|
||||
publishSettings.append(" <PublishHtmlProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <VersionDetectionIfAvailable>0</VersionDetectionIfAvailable>\n");
|
||||
publishSettings.append(" <VersionInfo>12,0,0,0;11,2,0,0;11,1,0,0;10,3,0,0;10,2,153,0;10,1,52,0;9,0,124,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1;</VersionInfo>\n");
|
||||
publishSettings.append(" <UsingDefaultContentFilename>1</UsingDefaultContentFilename>\n");
|
||||
publishSettings.append(" <UsingDefaultAlternateFilename>1</UsingDefaultAlternateFilename>\n");
|
||||
publishSettings.append(" <ContentFilename>").append(baseName).append("_content.html</ContentFilename>\n");
|
||||
publishSettings.append(" <AlternateFilename>").append(baseName).append("_alternate.html</AlternateFilename>\n");
|
||||
publishSettings.append(" <UsingOwnAlternateFile>0</UsingOwnAlternateFile>\n");
|
||||
publishSettings.append(" <OwnAlternateFilename></OwnAlternateFilename>\n");
|
||||
publishSettings.append(" <Width>").append(width).append("</Width>\n");
|
||||
publishSettings.append(" <Height>").append(height).append("</Height>\n");
|
||||
publishSettings.append(" <Align>0</Align>\n");
|
||||
publishSettings.append(" <Units>0</Units>\n");
|
||||
publishSettings.append(" <Loop>1</Loop>\n");
|
||||
publishSettings.append(" <StartPaused>0</StartPaused>\n");
|
||||
publishSettings.append(" <Scale>0</Scale>\n");
|
||||
publishSettings.append(" <HorizontalAlignment>1</HorizontalAlignment>\n");
|
||||
publishSettings.append(" <VerticalAlignment>1</VerticalAlignment>\n");
|
||||
publishSettings.append(" <Quality>4</Quality>\n");
|
||||
publishSettings.append(" <DeblockingFilter>0</DeblockingFilter>\n");
|
||||
publishSettings.append(" <WindowMode>0</WindowMode>\n");
|
||||
publishSettings.append(" <DisplayMenu>1</DisplayMenu>\n");
|
||||
publishSettings.append(" <DeviceFont>0</DeviceFont>\n");
|
||||
publishSettings.append(" <TemplateFileName></TemplateFileName>\n");
|
||||
publishSettings.append(" <showTagWarnMsg>1</showTagWarnMsg>\n");
|
||||
publishSettings.append(" </PublishHtmlProperties>\n");
|
||||
publishSettings.append(" <PublishFlashProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <TopDown></TopDown>\n");
|
||||
publishSettings.append(" <FireFox></FireFox>\n");
|
||||
publishSettings.append(" <Report>0</Report>\n");
|
||||
publishSettings.append(" <Protect>0</Protect>\n");
|
||||
publishSettings.append(" <OmitTraceActions>0</OmitTraceActions>\n");
|
||||
publishSettings.append(" <Quality>80</Quality>\n");
|
||||
publishSettings.append(" <DeblockingFilter>0</DeblockingFilter>\n");
|
||||
publishSettings.append(" <StreamFormat>0</StreamFormat>\n");
|
||||
publishSettings.append(" <StreamCompress>7</StreamCompress>\n");
|
||||
publishSettings.append(" <EventFormat>0</EventFormat>\n");
|
||||
publishSettings.append(" <EventCompress>7</EventCompress>\n");
|
||||
publishSettings.append(" <OverrideSounds>0</OverrideSounds>\n");
|
||||
publishSettings.append(" <Version>").append(flaSwfVersion).append("</Version>\n");
|
||||
publishSettings.append(" <ExternalPlayer>").append(FLAVersion.swfVersionToPlayer(flaSwfVersion)).append("</ExternalPlayer>\n");
|
||||
publishSettings.append(" <ActionScriptVersion>").append(useAS3 ? "3" : "2").append("</ActionScriptVersion>\n");
|
||||
publishSettings.append(" <PackageExportFrame>1</PackageExportFrame>\n");
|
||||
publishSettings.append(" <PackagePaths></PackagePaths>\n");
|
||||
publishSettings.append(" <AS3PackagePaths>.</AS3PackagePaths>\n");
|
||||
publishSettings.append(" <AS3ConfigConst>CONFIG::FLASH_AUTHORING="true";</AS3ConfigConst>\n");
|
||||
publishSettings.append(" <DebuggingPermitted>0</DebuggingPermitted>\n");
|
||||
publishSettings.append(" <DebuggingPassword></DebuggingPassword>\n");
|
||||
publishSettings.append(" <CompressMovie>").append(swf.compression == SWFCompression.NONE ? "0" : "1").append("</CompressMovie>\n");
|
||||
publishSettings.append(" <CompressionType>").append(swf.compression == SWFCompression.LZMA ? "1" : "0").append("</CompressionType>\n");
|
||||
publishSettings.append(" <InvisibleLayer>1</InvisibleLayer>\n");
|
||||
publishSettings.append(" <DeviceSound>0</DeviceSound>\n");
|
||||
publishSettings.append(" <StreamUse8kSampleRate>0</StreamUse8kSampleRate>\n");
|
||||
publishSettings.append(" <EventUse8kSampleRate>0</EventUse8kSampleRate>\n");
|
||||
publishSettings.append(" <UseNetwork>").append(useNetwork ? 1 : 0).append("</UseNetwork>\n");
|
||||
publishSettings.append(" <DocumentClass>").append(Helper.escapeHTML(characterClasses.containsKey(0) ? characterClasses.get(0) : "")).append("</DocumentClass>\n");
|
||||
publishSettings.append(" <AS3Strict>2</AS3Strict>\n");
|
||||
publishSettings.append(" <AS3Coach>4</AS3Coach>\n");
|
||||
publishSettings.append(" <AS3AutoDeclare>4096</AS3AutoDeclare>\n");
|
||||
publishSettings.append(" <AS3Dialect>AS3</AS3Dialect>\n");
|
||||
publishSettings.append(" <AS3ExportFrame>1</AS3ExportFrame>\n");
|
||||
publishSettings.append(" <AS3Optimize>1</AS3Optimize>\n");
|
||||
publishSettings.append(" <ExportSwc>0</ExportSwc>\n");
|
||||
publishSettings.append(" <ScriptStuckDelay>15</ScriptStuckDelay>\n");
|
||||
publishSettings.append(" <IncludeXMP>1</IncludeXMP>\n");
|
||||
publishSettings.append(" <HardwareAcceleration>0</HardwareAcceleration>\n");
|
||||
publishSettings.append(" <AS3Flags>4102</AS3Flags>\n");
|
||||
publishSettings.append(" <DefaultLibraryLinkage>rsl</DefaultLibraryLinkage>\n");
|
||||
publishSettings.append(" <RSLPreloaderMethod>wrap</RSLPreloaderMethod>\n");
|
||||
publishSettings.append(" <RSLPreloaderSWF>$(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf</RSLPreloaderSWF>\n");
|
||||
if (greaterThanCC) {
|
||||
publishSettings.append(" <LibraryPath>\n");
|
||||
publishSettings.append(" <library-path-entry>\n");
|
||||
publishSettings.append(" <swc-path>$(AppConfig)/ActionScript 3.0/libs</swc-path>\n");
|
||||
publishSettings.append(" <linkage>merge</linkage>\n");
|
||||
publishSettings.append(" </library-path-entry>\n");
|
||||
publishSettings.append(" <library-path-entry>\n");
|
||||
publishSettings.append(" <swc-path>$(FlexSDK)/frameworks/libs/flex.swc</swc-path>\n");
|
||||
publishSettings.append(" <linkage>merge</linkage>\n");
|
||||
publishSettings.append(" <rsl-url>textLayout_2.0.0.232.swz</rsl-url>\n");
|
||||
publishSettings.append(" </library-path-entry>\n");
|
||||
publishSettings.append(" <library-path-entry>\n");
|
||||
publishSettings.append(" <swc-path>$(FlexSDK)/frameworks/libs/core.swc</swc-path>\n");
|
||||
publishSettings.append(" <linkage>merge</linkage>\n");
|
||||
publishSettings.append(" <rsl-url>textLayout_2.0.0.232.swz</rsl-url>\n");
|
||||
publishSettings.append(" </library-path-entry>\n");
|
||||
publishSettings.append(" </LibraryPath>\n");
|
||||
publishSettings.append(" <LibraryVersions>\n");
|
||||
publishSettings.append(" </LibraryVersions> ");
|
||||
} else {
|
||||
publishSettings.append(" <LibraryPath>\n");
|
||||
publishSettings.append(" <library-path-entry>\n");
|
||||
publishSettings.append(" <swc-path>$(AppConfig)/ActionScript 3.0/libs</swc-path>\n");
|
||||
publishSettings.append(" <linkage>merge</linkage>\n");
|
||||
publishSettings.append(" </library-path-entry>\n");
|
||||
publishSettings.append(" <library-path-entry>\n");
|
||||
publishSettings.append(" <swc-path>$(AppConfig)/ActionScript 3.0/libs/11.0/textLayout.swc</swc-path>\n");
|
||||
publishSettings.append(" <linkage usesDefault=\"true\">rsl</linkage>\n");
|
||||
publishSettings.append(" <rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz</rsl-url>\n");
|
||||
publishSettings.append(" <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>\n");
|
||||
publishSettings.append(" <rsl-url>textLayout_2.0.0.232.swz</rsl-url>\n");
|
||||
publishSettings.append(" </library-path-entry>\n");
|
||||
publishSettings.append(" </LibraryPath>\n");
|
||||
publishSettings.append(" <LibraryVersions>\n");
|
||||
publishSettings.append(" <library-version>\n");
|
||||
publishSettings.append(" <swc-path>$(AppConfig)/ActionScript 3.0/libs/11.0/textLayout.swc</swc-path>\n");
|
||||
publishSettings.append(" <feature name=\"tlfText\" majorVersion=\"2\" minorVersion=\"0\" build=\"232\"/>\n");
|
||||
publishSettings.append(" <rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz</rsl-url>\n");
|
||||
publishSettings.append(" <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>\n");
|
||||
publishSettings.append(" <rsl-url>textLayout_2.0.0.232.swz</rsl-url>\n");
|
||||
publishSettings.append(" </library-version>\n");
|
||||
publishSettings.append(" </LibraryVersions>\n");
|
||||
XFLXmlWriter psXml = new XFLXmlWriter();
|
||||
try {
|
||||
psXml.writeStartElement("flash_profiles");
|
||||
psXml.writeStartElement("flash_profile", new String[]{"version", "1.0", "name", "Default", "current", "true"});
|
||||
|
||||
psXml.writeStartElement("PublishFormatProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("defaultNames", "1");
|
||||
psXml.writeElementValue("flash", "1");
|
||||
psXml.writeElementValue("projectorWin", "0");
|
||||
psXml.writeElementValue("projectorMac", "0");
|
||||
psXml.writeElementValue("html", "1");
|
||||
psXml.writeElementValue("gif", "0");
|
||||
psXml.writeElementValue("jpeg", "0");
|
||||
psXml.writeElementValue("png", "0");
|
||||
psXml.writeElementValue(greaterThanCC ? "svg" : "qt", "0");
|
||||
psXml.writeElementValue("rnwk", "0");
|
||||
psXml.writeElementValue("swc", "0");
|
||||
psXml.writeElementValue("flashDefaultName", "1");
|
||||
psXml.writeElementValue("projectorWinDefaultName", "1");
|
||||
psXml.writeElementValue("projectorMacDefaultName", "1");
|
||||
psXml.writeElementValue("htmlDefaultName", "1");
|
||||
psXml.writeElementValue("gifDefaultName", "1");
|
||||
psXml.writeElementValue("jpegDefaultName", "1");
|
||||
psXml.writeElementValue("pngDefaultName", "1");
|
||||
psXml.writeElementValue(greaterThanCC ? "svgDefaultName" : "qtDefaultName", "1");
|
||||
psXml.writeElementValue("rnwkDefaultName", "1");
|
||||
psXml.writeElementValue("swcDefaultName", "1");
|
||||
psXml.writeElementValue("flashFileName", baseName + ".swf");
|
||||
psXml.writeElementValue("projectorWinFileName", baseName + ".exe");
|
||||
psXml.writeElementValue("projectorMacFileName", baseName + ".app");
|
||||
psXml.writeElementValue("htmlFileName", baseName + ".html");
|
||||
psXml.writeElementValue("gifFileName", baseName + ".gif");
|
||||
psXml.writeElementValue("jpegFileName", baseName + ".jpg");
|
||||
psXml.writeElementValue("pngFileName", baseName + ".png");
|
||||
psXml.writeElementValue(greaterThanCC ? "svgFileName" : "qtFileName", "1");
|
||||
psXml.writeElementValue("rnwkFileName", baseName + ".smil");
|
||||
psXml.writeElementValue("swcFileName", baseName + ".swc");
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("PublishHtmlProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("VersionDetectionIfAvailable", "0");
|
||||
psXml.writeElementValue("VersionInfo", "12,0,0,0;11,2,0,0;11,1,0,0;10,3,0,0;10,2,153,0;10,1,52,0;9,0,124,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1;");
|
||||
psXml.writeElementValue("UsingDefaultContentFilename", "1");
|
||||
psXml.writeElementValue("UsingDefaultAlternateFilename", "1");
|
||||
psXml.writeElementValue("ContentFilename", baseName + "_content.html");
|
||||
psXml.writeElementValue("AlternateFilename", baseName + "_alternate.html");
|
||||
psXml.writeElementValue("UsingOwnAlternateFile", "0");
|
||||
psXml.writeElementValue("OwnAlternateFilename", "");
|
||||
psXml.writeElementValue("Width", width);
|
||||
psXml.writeElementValue("Height", height);
|
||||
psXml.writeElementValue("Align", "0");
|
||||
psXml.writeElementValue("Units", "0");
|
||||
psXml.writeElementValue("Loop", "1");
|
||||
psXml.writeElementValue("StartPaused", "0");
|
||||
psXml.writeElementValue("Scale", "0");
|
||||
psXml.writeElementValue("HorizontalAlignment", "1");
|
||||
psXml.writeElementValue("VerticalAlignment", "1");
|
||||
psXml.writeElementValue("Quality", "4");
|
||||
psXml.writeElementValue("DeblockingFilter", "0");
|
||||
psXml.writeElementValue("WindowMode", "0");
|
||||
psXml.writeElementValue("DisplayMenu", "1");
|
||||
psXml.writeElementValue("DeviceFont", "0");
|
||||
psXml.writeElementValue("TemplateFileName", "");
|
||||
psXml.writeElementValue("showTagWarnMsg", "1");
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("PublishFlashProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("TopDown", "");
|
||||
psXml.writeElementValue("FireFox", "");
|
||||
psXml.writeElementValue("Report", "0");
|
||||
psXml.writeElementValue("Protect", "0");
|
||||
psXml.writeElementValue("OmitTraceActions", "0");
|
||||
psXml.writeElementValue("Quality", "80");
|
||||
psXml.writeElementValue("DeblockingFilter", "0");
|
||||
psXml.writeElementValue("StreamFormat", "0");
|
||||
psXml.writeElementValue("StreamCompress", "7");
|
||||
psXml.writeElementValue("EventFormat", "0");
|
||||
psXml.writeElementValue("EventCompress", "7");
|
||||
psXml.writeElementValue("OverrideSounds", "0");
|
||||
psXml.writeElementValue("Version", flaSwfVersion);
|
||||
psXml.writeElementValue("ExternalPlayer", FLAVersion.swfVersionToPlayer(flaSwfVersion));
|
||||
psXml.writeElementValue("ActionScriptVersion", useAS3 ? "3" : "2");
|
||||
psXml.writeElementValue("PackageExportFrame", "1");
|
||||
psXml.writeElementValue("PackagePaths", "");
|
||||
psXml.writeElementValue("AS3PackagePaths", ".");
|
||||
psXml.writeElementValue("AS3ConfigConst", "CONFIG::FLASH_AUTHORING=\"true\";");
|
||||
psXml.writeElementValue("DebuggingPermitted", "0");
|
||||
psXml.writeElementValue("DebuggingPassword", "");
|
||||
psXml.writeElementValue("CompressMovie", swf.compression == SWFCompression.NONE ? "0" : "1");
|
||||
psXml.writeElementValue("CompressionType", swf.compression == SWFCompression.LZMA ? "1" : "0");
|
||||
psXml.writeElementValue("InvisibleLayer", "1");
|
||||
psXml.writeElementValue("DeviceSound", "0");
|
||||
psXml.writeElementValue("StreamUse8kSampleRate", "0");
|
||||
psXml.writeElementValue("EventUse8kSampleRate", "0");
|
||||
psXml.writeElementValue("UseNetwork", useNetwork ? 1 : 0);
|
||||
psXml.writeElementValue("DocumentClass", characterClasses.containsKey(0) ? characterClasses.get(0) : "");
|
||||
psXml.writeElementValue("AS3Strict", "2");
|
||||
psXml.writeElementValue("AS3Coach", "4");
|
||||
psXml.writeElementValue("AS3AutoDeclare", "4096");
|
||||
psXml.writeElementValue("AS3Dialect", "AS3");
|
||||
psXml.writeElementValue("AS3ExportFrame", "1");
|
||||
psXml.writeElementValue("AS3Optimize", "1");
|
||||
psXml.writeElementValue("ExportSwc", "0");
|
||||
psXml.writeElementValue("ScriptStuckDelay", "15");
|
||||
psXml.writeElementValue("IncludeXMP", "1");
|
||||
psXml.writeElementValue("HardwareAcceleration", "0");
|
||||
psXml.writeElementValue("AS3Flags", "4102");
|
||||
psXml.writeElementValue("DefaultLibraryLinkage", "rsl");
|
||||
psXml.writeElementValue("RSLPreloaderMethod", "wrap");
|
||||
psXml.writeElementValue("RSLPreloaderSWF", "$(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf");
|
||||
if (greaterThanCC) {
|
||||
psXml.writeStartElement("LibraryPath");
|
||||
psXml.writeStartElement("library-path-entry");
|
||||
psXml.writeElementValue("swc-path", "$(AppConfig)/ActionScript 3.0/libs");
|
||||
psXml.writeElementValue("linkage", "merge");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeStartElement("library-path-entry");
|
||||
psXml.writeElementValue("swc-path", "$(FlexSDK)/frameworks/libs/flex.swc");
|
||||
psXml.writeElementValue("linkage", "merge");
|
||||
psXml.writeElementValue("rsl-url", "textLayout_2.0.0.232.swz");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeStartElement("library-path-entry");
|
||||
psXml.writeElementValue("swc-path", "$(FlexSDK)/frameworks/libs/core.swc");
|
||||
psXml.writeElementValue("linkage", "merge");
|
||||
psXml.writeElementValue("rsl-url", "textLayout_2.0.0.232.swz");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeEndElement();
|
||||
psXml.writeElementValueRaw("LibraryVersions", Helper.newLine + " "); // todo: is this really needed or an empty tag is ok?
|
||||
psXml.writeEndElement();
|
||||
} else {
|
||||
psXml.writeStartElement("LibraryPath");
|
||||
psXml.writeStartElement("library-path-entry");
|
||||
psXml.writeElementValue("swc-path", "$(AppConfig)/ActionScript 3.0/libs");
|
||||
psXml.writeElementValue("linkage", "merge");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeStartElement("library-path-entry");
|
||||
psXml.writeElementValue("swc-path", "$(AppConfig)/ActionScript 3.0/libs/11.0/textLayout.swc");
|
||||
psXml.writeElementValue("linkage", "rsl", new String[]{"usesDefault", "true"});
|
||||
psXml.writeElementValue("rsl-url", "http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz");
|
||||
psXml.writeElementValue("policy-file-url", "http://fpdownload.adobe.com/pub/swz/crossdomain.xml");
|
||||
psXml.writeElementValue("rsl-url", "textLayout_2.0.0.232.swz");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeStartElement("library-path-entry");
|
||||
psXml.writeElementValue("swc-path", "$(FlexSDK)/frameworks/libs/core.swc");
|
||||
psXml.writeElementValue("linkage", "merge");
|
||||
psXml.writeElementValue("rsl-url", "textLayout_2.0.0.232.swz");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeEndElement();
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("LibraryVersions");
|
||||
psXml.writeStartElement("library-version");
|
||||
psXml.writeElementValue("swc-path", "$(AppConfig)/ActionScript 3.0/libs/11.0/textLayout.swc");
|
||||
psXml.writeEmptyElement("feature", new String[]{"name", "tlfText", "majorVersion", "2", "minorVersion", "0", "build", "232"});
|
||||
psXml.writeElementValue("rsl-url", "http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz");
|
||||
psXml.writeElementValue("policy-file-url", "http://fpdownload.adobe.com/pub/swz/crossdomain.xml");
|
||||
psXml.writeElementValue("rsl-url", "textLayout_2.0.0.232.swz");
|
||||
psXml.writeEndElement();
|
||||
psXml.writeEndElement();
|
||||
}
|
||||
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("PublishJpegProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("Width", width);
|
||||
psXml.writeElementValue("Height", height);
|
||||
psXml.writeElementValue("Progressive", "0");
|
||||
psXml.writeElementValue("DPI", "4718592");
|
||||
psXml.writeElementValue("Size", "0");
|
||||
psXml.writeElementValue("Quality", "80");
|
||||
psXml.writeElementValue("MatchMovieDim", "1");
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("PublishRNWKProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("exportFlash", "1");
|
||||
psXml.writeElementValue("flashBitRate", "0");
|
||||
psXml.writeElementValue("exportAudio", "1");
|
||||
psXml.writeElementValue("audioFormat", "0");
|
||||
psXml.writeElementValue("singleRateAudio", "0");
|
||||
psXml.writeElementValue("realVideoRate", "100000");
|
||||
psXml.writeElementValue("speed28K", "1");
|
||||
psXml.writeElementValue("speed56K", "1");
|
||||
psXml.writeElementValue("speedSingleISDN", "0");
|
||||
psXml.writeElementValue("speedDualISDN", "0");
|
||||
psXml.writeElementValue("speedCorporateLAN", "0");
|
||||
psXml.writeElementValue("speed256K", "0");
|
||||
psXml.writeElementValue("speed384K", "0");
|
||||
psXml.writeElementValue("speed512K", "0");
|
||||
psXml.writeElementValue("exportSMIL", "1");
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("PublishGifProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("Width", width);
|
||||
psXml.writeElementValue("Height", height);
|
||||
psXml.writeElementValue("Animated", "0");
|
||||
psXml.writeElementValue("MatchMovieDim", "1");
|
||||
psXml.writeElementValue("Loop", "1");
|
||||
psXml.writeElementValue("LoopCount", "");
|
||||
psXml.writeElementValue("OptimizeColors", "1");
|
||||
psXml.writeElementValue("Interlace", "0");
|
||||
psXml.writeElementValue("Smooth", "1");
|
||||
psXml.writeElementValue("DitherSolids", "0");
|
||||
psXml.writeElementValue("RemoveGradients", "0");
|
||||
psXml.writeElementValue("TransparentOption", "");
|
||||
psXml.writeElementValue("TransparentAlpha", "128");
|
||||
psXml.writeElementValue("DitherOption", "");
|
||||
psXml.writeElementValue("PaletteOption", "");
|
||||
psXml.writeElementValue("MaxColors", "255");
|
||||
psXml.writeElementValue("PaletteName", "");
|
||||
psXml.writeEndElement();
|
||||
|
||||
psXml.writeStartElement("PublishPNGProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("Width", width);
|
||||
psXml.writeElementValue("Height", height);
|
||||
psXml.writeElementValue("OptimizeColors", "1");
|
||||
psXml.writeElementValue("Interlace", "0");
|
||||
psXml.writeElementValue("Transparent", "0");
|
||||
psXml.writeElementValue("Smooth", "1");
|
||||
psXml.writeElementValue("DitherSolids", "0");
|
||||
psXml.writeElementValue("RemoveGradients", "0");
|
||||
psXml.writeElementValue("MatchMovieDim", "1");
|
||||
psXml.writeElementValue("DitherOption", "");
|
||||
psXml.writeElementValue("FilterOption", "");
|
||||
psXml.writeElementValue("PaletteOption", "");
|
||||
psXml.writeElementValue("BitDepth", "24-bit with Alpha");
|
||||
psXml.writeElementValue("MaxColors", "255");
|
||||
psXml.writeElementValue("PaletteName", "");
|
||||
psXml.writeEndElement();
|
||||
|
||||
if (!greaterThanCC) {
|
||||
psXml.writeStartElement("PublishQTProperties", new String[]{"enabled", "true"});
|
||||
psXml.writeElementValue("Width", width);
|
||||
psXml.writeElementValue("Height", height);
|
||||
psXml.writeElementValue("MatchMovieDim", "1");
|
||||
psXml.writeElementValue("UseQTSoundCompression", "0");
|
||||
psXml.writeElementValue("AlphaOption", "");
|
||||
psXml.writeElementValue("LayerOption", "");
|
||||
psXml.writeElementValue("QTSndSettings", "00000000");
|
||||
psXml.writeElementValue("ControllerOption", "0");
|
||||
psXml.writeElementValue("Looping", "0");
|
||||
psXml.writeElementValue("PausedAtStart", "0");
|
||||
psXml.writeElementValue("PlayEveryFrame", "0");
|
||||
psXml.writeElementValue("Flatten", "1");
|
||||
psXml.writeEndElement();
|
||||
}
|
||||
|
||||
psXml.writeEndElement();
|
||||
psXml.writeEndElement();
|
||||
} catch (XMLStreamException ex) {
|
||||
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
publishSettings.append(" </PublishFlashProperties>\n");
|
||||
publishSettings.append(" <PublishJpegProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <Width>").append(width).append("</Width>\n");
|
||||
publishSettings.append(" <Height>").append(height).append("</Height>\n");
|
||||
publishSettings.append(" <Progressive>0</Progressive>\n");
|
||||
publishSettings.append(" <DPI>4718592</DPI>\n");
|
||||
publishSettings.append(" <Size>0</Size>\n");
|
||||
publishSettings.append(" <Quality>80</Quality>\n");
|
||||
publishSettings.append(" <MatchMovieDim>1</MatchMovieDim>\n");
|
||||
publishSettings.append(" </PublishJpegProperties>\n");
|
||||
publishSettings.append(" <PublishRNWKProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <exportFlash>1</exportFlash>\n");
|
||||
publishSettings.append(" <flashBitRate>0</flashBitRate>\n");
|
||||
publishSettings.append(" <exportAudio>1</exportAudio>\n");
|
||||
publishSettings.append(" <audioFormat>0</audioFormat>\n");
|
||||
publishSettings.append(" <singleRateAudio>0</singleRateAudio>\n");
|
||||
publishSettings.append(" <realVideoRate>100000</realVideoRate>\n");
|
||||
publishSettings.append(" <speed28K>1</speed28K>\n");
|
||||
publishSettings.append(" <speed56K>1</speed56K>\n");
|
||||
publishSettings.append(" <speedSingleISDN>0</speedSingleISDN>\n");
|
||||
publishSettings.append(" <speedDualISDN>0</speedDualISDN>\n");
|
||||
publishSettings.append(" <speedCorporateLAN>0</speedCorporateLAN>\n");
|
||||
publishSettings.append(" <speed256K>0</speed256K>\n");
|
||||
publishSettings.append(" <speed384K>0</speed384K>\n");
|
||||
publishSettings.append(" <speed512K>0</speed512K>\n");
|
||||
publishSettings.append(" <exportSMIL>1</exportSMIL>\n");
|
||||
publishSettings.append(" </PublishRNWKProperties>\n");
|
||||
publishSettings.append(" <PublishGifProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <Width>").append(width).append("</Width>\n");
|
||||
publishSettings.append(" <Height>").append(height).append("</Height>\n");
|
||||
publishSettings.append(" <Animated>0</Animated>\n");
|
||||
publishSettings.append(" <MatchMovieDim>1</MatchMovieDim>\n");
|
||||
publishSettings.append(" <Loop>1</Loop>\n");
|
||||
publishSettings.append(" <LoopCount></LoopCount>\n");
|
||||
publishSettings.append(" <OptimizeColors>1</OptimizeColors>\n");
|
||||
publishSettings.append(" <Interlace>0</Interlace>\n");
|
||||
publishSettings.append(" <Smooth>1</Smooth>\n");
|
||||
publishSettings.append(" <DitherSolids>0</DitherSolids>\n");
|
||||
publishSettings.append(" <RemoveGradients>0</RemoveGradients>\n");
|
||||
publishSettings.append(" <TransparentOption></TransparentOption>\n");
|
||||
publishSettings.append(" <TransparentAlpha>128</TransparentAlpha>\n");
|
||||
publishSettings.append(" <DitherOption></DitherOption>\n");
|
||||
publishSettings.append(" <PaletteOption></PaletteOption>\n");
|
||||
publishSettings.append(" <MaxColors>255</MaxColors>\n");
|
||||
publishSettings.append(" <PaletteName></PaletteName>\n");
|
||||
publishSettings.append(" </PublishGifProperties>\n");
|
||||
publishSettings.append(" <PublishPNGProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <Width>").append(width).append("</Width>\n");
|
||||
publishSettings.append(" <Height>").append(height).append("</Height>\n");
|
||||
publishSettings.append(" <OptimizeColors>1</OptimizeColors>\n");
|
||||
publishSettings.append(" <Interlace>0</Interlace>\n");
|
||||
publishSettings.append(" <Transparent>0</Transparent>\n");
|
||||
publishSettings.append(" <Smooth>1</Smooth>\n");
|
||||
publishSettings.append(" <DitherSolids>0</DitherSolids>\n");
|
||||
publishSettings.append(" <RemoveGradients>0</RemoveGradients>\n");
|
||||
publishSettings.append(" <MatchMovieDim>1</MatchMovieDim>\n");
|
||||
publishSettings.append(" <DitherOption></DitherOption>\n");
|
||||
publishSettings.append(" <FilterOption></FilterOption>\n");
|
||||
publishSettings.append(" <PaletteOption></PaletteOption>\n");
|
||||
publishSettings.append(" <BitDepth>24-bit with Alpha</BitDepth>\n");
|
||||
publishSettings.append(" <MaxColors>255</MaxColors>\n");
|
||||
publishSettings.append(" <PaletteName></PaletteName>\n");
|
||||
publishSettings.append(" </PublishPNGProperties>\n");
|
||||
if (!greaterThanCC) {
|
||||
publishSettings.append(" <PublishQTProperties enabled=\"true\">\n");
|
||||
publishSettings.append(" <Width>").append(width).append("</Width>\n");
|
||||
publishSettings.append(" <Height>").append(height).append("</Height>\n");
|
||||
publishSettings.append(" <MatchMovieDim>1</MatchMovieDim>\n");
|
||||
publishSettings.append(" <UseQTSoundCompression>0</UseQTSoundCompression>\n");
|
||||
publishSettings.append(" <AlphaOption></AlphaOption>\n");
|
||||
publishSettings.append(" <LayerOption></LayerOption>\n");
|
||||
publishSettings.append(" <QTSndSettings>00000000</QTSndSettings>\n");
|
||||
publishSettings.append(" <ControllerOption>0</ControllerOption>\n");
|
||||
publishSettings.append(" <Looping>0</Looping>\n");
|
||||
publishSettings.append(" <PausedAtStart>0</PausedAtStart>\n");
|
||||
publishSettings.append(" <PlayEveryFrame>0</PlayEveryFrame>\n");
|
||||
publishSettings.append(" <Flatten>1</Flatten>\n");
|
||||
publishSettings.append(" </PublishQTProperties>\n");
|
||||
}
|
||||
publishSettings.append("</flash_profile>\n");
|
||||
publishSettings.append("</flash_profiles>");
|
||||
String publishSettingsStr = publishSettings.toString();
|
||||
|
||||
String publishSettingsStr = psXml.toString();
|
||||
|
||||
if (settings.compressed) {
|
||||
final String domDocumentF = domDocumentStr;
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.xfl;
|
||||
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class XFLXmlWriter implements XMLStreamWriter {
|
||||
|
||||
private boolean newLine = true;
|
||||
|
||||
private boolean newLineNeeded = false;
|
||||
|
||||
private boolean startElementClosed = true;
|
||||
|
||||
private final StringBuilder sb = new StringBuilder();
|
||||
|
||||
private final Map<String, String> namespaces = new HashMap<>();
|
||||
|
||||
private final Stack<String> tagsStack = new Stack<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private XFLXmlWriter append(char character) {
|
||||
sb.append(character);
|
||||
newLine = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private XFLXmlWriter append(String text) {
|
||||
sb.append(text);
|
||||
newLine = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void makeNewLine() {
|
||||
if (!newLine) {
|
||||
sb.append(Helper.newLine);
|
||||
newLine = true;
|
||||
for (int i = 0; i < tagsStack.size(); i++) {
|
||||
sb.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void closeStartElement() {
|
||||
if (!startElementClosed) {
|
||||
append('>');
|
||||
startElementClosed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureStartElementOpen() throws XMLStreamException {
|
||||
if (startElementClosed) {
|
||||
throw new XMLStreamException("Attempted to write attribute out of the start element");
|
||||
}
|
||||
}
|
||||
|
||||
private void closeStartElementNewLine() {
|
||||
closeStartElement();
|
||||
makeNewLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartElement(String localName) throws XMLStreamException {
|
||||
closeStartElementNewLine();
|
||||
append('<').append(localName);
|
||||
tagsStack.add(localName);
|
||||
startElementClosed = false;
|
||||
newLineNeeded = false;
|
||||
}
|
||||
|
||||
public void writeStartElement(String localName, String[] attributes) throws XMLStreamException {
|
||||
writeStartElement(localName);
|
||||
if (attributes.length % 2 != 0) {
|
||||
throw new XMLStreamException("Attribute count should be even");
|
||||
}
|
||||
|
||||
for (int i = 0; i < attributes.length / 2; i++) {
|
||||
writeAttribute(attributes[i * 2], attributes[i * 2 + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException {
|
||||
writeStartElementInternal(getPrefix(namespaceURI), localName, namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
|
||||
setPrefix(prefix, namespaceURI);
|
||||
writeStartElementInternal(prefix, localName, namespaceURI);
|
||||
}
|
||||
|
||||
private void writeStartElementInternal(String prefix, String localName, String namespaceURI) throws XMLStreamException {
|
||||
closeStartElementNewLine();
|
||||
append('<').append(prefix).append(':').append(localName);
|
||||
writeNamespace(prefix, namespaceURI);
|
||||
tagsStack.add(localName);
|
||||
startElementClosed = false;
|
||||
newLineNeeded = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException {
|
||||
writeEmptyElementInternal(getPrefix(namespaceURI), localName, namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException {
|
||||
setPrefix(prefix, namespaceURI);
|
||||
writeEmptyElementInternal(prefix, localName, namespaceURI);
|
||||
}
|
||||
|
||||
private void writeEmptyElementInternal(String prefix, String localName, String namespaceURI) throws XMLStreamException {
|
||||
writeStartElement(prefix, localName, namespaceURI);
|
||||
writeEndElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEmptyElement(String localName) throws XMLStreamException {
|
||||
writeStartElement(localName);
|
||||
writeEndElement();
|
||||
}
|
||||
|
||||
public void writeEmptyElement(String localName, String[] attributes) throws XMLStreamException {
|
||||
writeStartElement(localName, attributes);
|
||||
writeEndElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEndElement() throws XMLStreamException {
|
||||
String localName = tagsStack.pop();
|
||||
if (startElementClosed) {
|
||||
if (newLineNeeded) {
|
||||
makeNewLine();
|
||||
}
|
||||
|
||||
append("</").append(localName).append('>');
|
||||
} else {
|
||||
append(" />");
|
||||
startElementClosed = true;
|
||||
}
|
||||
|
||||
newLineNeeded = true;
|
||||
}
|
||||
|
||||
public void writeElementValue(String localName, String value) throws XMLStreamException {
|
||||
writeStartElement(localName);
|
||||
writeCharacters(value);
|
||||
writeEndElement();
|
||||
}
|
||||
|
||||
public void writeElementValue(String localName, double value) throws XMLStreamException {
|
||||
writeElementValue(localName, Double.toString(value));
|
||||
}
|
||||
|
||||
public void writeElementValue(String localName, int value) throws XMLStreamException {
|
||||
writeElementValue(localName, Integer.toString(value));
|
||||
}
|
||||
|
||||
public void writeElementValueRaw(String localName, String value) throws XMLStreamException {
|
||||
writeStartElement(localName);
|
||||
writeCharactersRaw(value);
|
||||
writeEndElement();
|
||||
}
|
||||
|
||||
public void writeElementValue(String localName, String value, String[] attributes) throws XMLStreamException {
|
||||
writeStartElement(localName, attributes);
|
||||
writeCharacters(value);
|
||||
writeEndElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEndDocument() throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeAttribute(String localName, String value) throws XMLStreamException {
|
||||
ensureStartElementOpen();
|
||||
append(' ').append(localName).append("=\"").append(Helper.escapeHTML(value)).append('"');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException {
|
||||
setPrefix(prefix, namespaceURI);
|
||||
writeAttributeInternal(prefix, localName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
|
||||
writeAttributeInternal(getPrefix(namespaceURI), localName, value);
|
||||
}
|
||||
|
||||
private void writeAttributeInternal(String prefix, String localName, String value) throws XMLStreamException {
|
||||
ensureStartElementOpen();
|
||||
append(' ').append(prefix).append(':').append(localName).append("=\"").append(Helper.escapeHTML(value)).append('"');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException {
|
||||
writeAttribute("xmlns", null, prefix, namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeComment(String data) throws XMLStreamException {
|
||||
closeStartElement();
|
||||
append("<!--").append(data).append("-->");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeProcessingInstruction(String target) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCData(String data) throws XMLStreamException {
|
||||
// todo: split when data cintains "]]>"
|
||||
append("<![CDATA[").append(data).append("]]>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDTD(String dtd) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityRef(String name) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartDocument() throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartDocument(String version) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCharacters(String text) throws XMLStreamException {
|
||||
closeStartElement();
|
||||
append(Helper.escapeHTML(text));
|
||||
}
|
||||
|
||||
public void writeCharactersRaw(String text) throws XMLStreamException {
|
||||
closeStartElement();
|
||||
append(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
|
||||
writeCharacters(new String(text, start, len));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(String uri) throws XMLStreamException {
|
||||
String prefix = namespaces.get(uri);
|
||||
return prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix, String uri) throws XMLStreamException {
|
||||
namespaces.put(prefix, prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultNamespace(String uri) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceContext getNamespaceContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user