void Test_XmlImport() { var frame = new EmberSequence(new BerTag(BerClass.Application, 1)); var appDefined1 = EmberApplicationInterface.CreateApplicationDefinedSet(new BerTag(BerClass.ContextSpecific, 444), 1, frame); var appDefined2 = EmberApplicationInterface.CreateApplicationDefinedSequence(new BerTag(BerClass.ContextSpecific, 445), 2, appDefined1); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 1), -1); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 2), true); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 3), false); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 4), 12345.6789); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 5), "wasgehtäb?"); Console.WriteLine("\r\n------------------------ XML Import"); DumpXml(frame); var buffer = new StringBuilder(); using (var writer = XmlWriter.Create(buffer)) XmlExport.Export(frame, writer); using (var stream = new StringReader(buffer.ToString())) using (var reader = new XmlTextReader(stream)) { var root = XmlImport.Import(reader, this); DumpXml(root); } }
void GlowReader_RootReady(object sender, AsyncDomReader.RootReadyArgs e) { var root = e.Root as GlowContainer; if (root != null) { var buffer = new StringBuilder(); var settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, IndentChars = " ", }; // INFO: Think this one prints out the tree using (var writer = XmlWriter.Create(Console.Out, settings)) XmlExport.Export(root, writer); Dispatcher.DispatchGlow(root, this); } else { Debug.WriteLine($"Unexpected Ember Root: Client/GlowReader_RootReady: {e.Root} Type: {e.Root.GetType()}"); Console.WriteLine($"Unexpected Ember Root: Client/GlowReader_RootReady: {e.Root} Type: {e.Root.GetType()}"); } }
protected void OnExportDataClick(object sender, EventArgs e) { var dataXml = default(string); var dataSerializer = new XmlExport(); if (RecordExportOptionSelected.IsBlank()) { dataXml = dataSerializer.CreateBlankXml(ZoneId.Value, ApplicationId, ContentTypeIdSelected); } else { dataXml = dataSerializer.CreateXml(ZoneId.Value, ApplicationId, ContentTypeIdSelected, LanguageSelected, LanguageFallback, Languages, LanguageReferenceOptionSelected, ResourceReferenceOptionSelected); } var fileName = string.Format ( "2sxc {0} {1} {2} {3}.xml", ContentTypeNameSelected.Replace(" ", "-"), LanguageSelected.Replace(" ", "-"), RecordExportOptionSelected.IsBlank() ? "Template" : "Data", DateTime.Now.ToString("yyyyMMddHHmmss") ); Response.Clear(); Response.Write(dataXml); Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", fileName)); Response.AddHeader("Content-Length", dataXml.Length.ToString()); Response.ContentType = "text/xml"; Response.End(); }
static void Main(string[] args) { // Exports saved in PlanetHunters.Export/Export JsonExport.ExportPlanets(); JsonExport.ExportAstronomers(); XmlExport.ExportStars(); }
static void Main(string[] args) { /* NB! Copy EntityFrameworkSQLServer.dll * from Data/bin/Debug to Export/bin/Debug */ JsonExport.ExportPlanetsNotOriginatingAnomalies(); JsonExport.ExportPeopleNotVictimsOfAnomalies(); JsonExport.ExportAnomaliesWithMaxVictims(); XmlExport.ExportAnomaliesAndVictims(); }
string DumpXml(EmberNode node) { var xmlBuffer = new StringBuilder(); var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = true }; using (var writer = XmlWriter.Create(xmlBuffer, xmlSettings)) XmlExport.Export(node, writer); var str = xmlBuffer.ToString(); Console.WriteLine(str); return(str); }
protected void btnExport_Click(object sender, EventArgs e) { pnlChoose.Visible = false; string[] contentTypeIds = txtSelectedContentTypes.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] entityIds = txtSelectedEntities.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] templateIds = txtSelectedTemplates.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var messages = new List <ExportImportMessage>(); var xml = new XmlExport(ZoneId.Value, AppId.Value, false).ExportXml(contentTypeIds, entityIds, templateIds, out messages); Response.Clear(); Response.Write(xml); Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", "SexyContent-Export.xml")); Response.AddHeader("Content-Length", xml.Length.ToString()); Response.ContentType = "text/xml"; Response.End(); }
public void GenerateXmlTest() { if (File.Exists(_saveToFile)) { File.Delete(_saveToFile); } bool value = XmlExport.Generate(_databasePath, _gunId, "7.x", _saveToFile, out _errOut); if (value && File.Exists(_saveToFile)) { TestContext.WriteLine($"File was saved to {_saveToFile}"); } else { TestContext.WriteLine("Unable to save file!"); } General.HasTrueValue(value && File.Exists(_saveToFile), _errOut); }
void GlowReader_RootReady(object sender, AsyncDomReader.RootReadyArgs e) { var root = e.Root as GlowContainer; if (root != null) { var buffer = new StringBuilder(); var settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, IndentChars = " ", }; using (var writer = XmlWriter.Create(Console.Out, settings)) XmlExport.Export(root, writer); Dispatcher.DispatchGlow(root, this); } else { Console.WriteLine("Unexpected Ember Root: {0} ({1})", e.Root, e.Root.GetType()); } }
string GetXml(EmberNode ember) { return(GetXmlBody(writer => XmlExport.Export(ember, writer))); }
public static void Main(string[] args) { JsonExport.ExportPlanets("TRAPPIST"); JsonExport.ExportAstronomers("Alpha Centauri"); XmlExport.ExportStars(); }