Write_Metadata() public method

Writes the formatted metadata from the provided item to a TextWriter (usually to an output stream)
OPTIONS: Accepts 'METS_File_ReaderWriter:METS_Writing_Profile', otherwise the default METS writing profile is utilized.
public Write_Metadata ( TextWriter Output_Stream, SobekCM_Item Item_To_Save, object>.Dictionary Options, string &Error_Message ) : bool
Output_Stream System.IO.TextWriter
Item_To_Save SobekCM_Item Package with all the metadata to save
Options object>.Dictionary Dictionary of any options which this metadata reader/writer may utilize
Error_Message string [OUTPUT] Explanation of the error, if an error occurs during write
return bool
 /// <summary> Saves this resource as a SobekCM Service METS file </summary>
 /// <remarks> The SobekCM Service METS file tries to keep the file size as small as possible and also includes service information (image properties) that the standard SobekCM METS file does not include </remarks>
 public void Save_SobekCM_METS()
 {
     // Save this to the METS file format
     METS_File_ReaderWriter writer = new METS_File_ReaderWriter();
     string Error_Message;
     writer.Write_Metadata( Source_Directory + "\\" + BibID + "_" + VID + ".mets.xml", this, null, out Error_Message);
 }
        /// <summary> Save this resource as a METS file </summary>
        /// <remarks>Will use either the default namespace, or the same namespace which was used
        /// in any previously read METS files.</remarks>
        public void Save_METS(bool include_daitss)
        {
            METS_Header.ObjectID = BibID + "_" + VID;

            string FileName = Source_Directory + "/" + BibID + "_" + VID + ".mets";

            // If this is juat a project XML, do this differently
            if (Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Project)
            {
                Bib_Info.Main_Title.Title = "Project level metadata for '" + BibID + "'";
                FileName = Source_Directory + "/" + BibID + ".pmets";
                METS_Header.ObjectID = BibID;
            }

            // If there is an interview date, use that to calculate the sort safe date
            // Ensure this metadata module extension exists and has data
            Oral_Interview_Info oralInfo = Get_Metadata_Module("OralInterview") as Oral_Interview_Info;
            if ((oralInfo != null) && (oralInfo.Interview_Date.Length > 0) && (BIBInfo.SortDate > 0))
            {
                BIBInfo.SortDate = BIBInfo.SortSafeDate(oralInfo.Interview_Date);
            }

            // Save this to the METS file format
            METS_File_ReaderWriter writer = new METS_File_ReaderWriter();
            string Error_Message;
            writer.Write_Metadata(FileName, this, null, out Error_Message);
        }
        /// <summary> Save this resource as a METS file </summary>
        /// <remarks>Will use either the default namespace, or the same namespace which was used
        /// in any previously read METS files.</remarks>
        public void Save_METS(string Destination_File)
        {
            METS_Header.ObjectID = BibID + "_" + VID;

            // If there is an interview date, use that to calculate the sort safe date
            // Ensure this metadata module extension exists and has data
            Oral_Interview_Info oralInfo = Get_Metadata_Module("OralInterview") as Oral_Interview_Info;
            if ((oralInfo != null) && (oralInfo.Interview_Date.Length > 0) && (BIBInfo.SortDate > 0))
            {
                BIBInfo.SortDate = BIBInfo.SortSafeDate(oralInfo.Interview_Date);
            }

            // Save this to the METS file format
            METS_File_ReaderWriter writer = new METS_File_ReaderWriter();
            string Error_Message;
            writer.Write_Metadata(Destination_File, this, null, out Error_Message);
        }
        private void show_preview(TextWriter Output, string Preview_Mode, Custom_Tracer Tracer)
        {
            Tracer.Add_Trace("Edit_Item_Metadata_MySobekViewer.show_preview", String.Empty);

            Output.WriteLine("<script language=\"JavaScript\">");

            // Get the URL to use for forwarding
            string current_submode = currentMode.My_Sobek_SubMode;
            currentMode.My_Sobek_SubMode = "ZZZZZ";
            string redirect_url = currentMode.Redirect_URL();
            currentMode.My_Sobek_SubMode = current_submode;

            Output.WriteLine("  function preview1() {if (document.itemNavForm.pickme) location='" + redirect_url.Replace("ZZZZZ", "preview") + "#template'}");
            Output.WriteLine("  function preview2() {if (document.itemNavForm.pickme) location='" + redirect_url.Replace("ZZZZZ", "marc") + "#template'}");
            Output.WriteLine("  function preview3() {if (document.itemNavForm.pickme) location='" + redirect_url.Replace("ZZZZZ", "mets") + "#template'}");
            Output.WriteLine("</script>");

            Output.WriteLine("<center>");
            Output.WriteLine(Preview_Mode == "preview"
                                 ? "<input type=\"radio\" name=\"sbkPreviewType\" id=\"sbkTypeOfPreview\" checked=\"checked\" /><label for=\"sbkTypeOfPreview\">Standard View</label> &nbsp; &nbsp; "
                                 : "<input type=\"radio\" name=\"sbkPreviewType\" id=\"sbkTypeOfPreview\" onchange=\"location='" + redirect_url.Replace("ZZZZZ", "preview") + "#template';\" /><label for=\"sbkTypeOfPreview\">Standard View</label> &nbsp; &nbsp; ");

            Output.WriteLine(Preview_Mode == "marc"
                                 ? "<input type=\"radio\" name=\"sbkPreviewType\" id=\"sbkTypeOfMarc\" checked=\"checked\" /><label for=\"sbkTypeOfMarc\">MARC View</label> &nbsp; &nbsp; "
                                 : "<input TYPE=\"radio\" name=\"sbkPreviewType\" id=\"sbkTypeOfMarc\" onchange=\"location='" + redirect_url.Replace("ZZZZZ", "marc") + "#template';\" /><label for=\"sbkTypeOfMarc\">MARC View</label> &nbsp; &nbsp; ");

            Output.WriteLine(Preview_Mode == "mets"
                                 ? "<input type=\"radio\" name=\"sbkPreviewType\" id=\"sbkTypeOfMets\" checked=\"checked\" /><label for=\"sbkTypeOfMets\">METS View</label>"
                                 : "<input type=\"radio\" name=\"sbkPreviewType\" id=\"sbkTypeOfMets\" onchange=\"location='" + redirect_url.Replace("ZZZZZ", "mets") + "#template';\" /><label for=\"sbkTypeOfMets\">METS View</label>");

            Output.WriteLine("</center>");
            Output.WriteLine("<br />");

            switch (Preview_Mode)
            {
                case "marc":
                    Output.WriteLine("<div class=\"sbkEimv_Citation\">");
                    Citation_ItemViewer marcViewer = new Citation_ItemViewer(Translator, codeManager, false)
                                                         {CurrentItem = item, CurrentMode = currentMode};
                    Output.WriteLine(marcViewer.MARC_String("735px", Tracer));
                    break;

                case "mets":
                    Output.WriteLine("<div class=\"sbkEimv_Citation\" >");
                  //  Output.WriteLine("<table width=\"950px\"><tr><td width=\"950px\">");
                    StringBuilder mets_builder = new StringBuilder(2000);
                    StringWriter mets_output = new StringWriter(mets_builder);

                    METS_File_ReaderWriter metsWriter = new METS_File_ReaderWriter();

                    string errorMessage;
                    metsWriter.Write_Metadata(mets_output, item, null, out errorMessage);
                    string mets_string = mets_builder.ToString();
                    string header = mets_string.Substring(0, mets_string.IndexOf("<METS:mets"));
                    string remainder = mets_string.Substring(header.Length);
                    Output.WriteLine(header.Replace("<?", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&lt?").Replace("?>", "?&gt;&AAA;/span&ZZZ;").Replace("<!--", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&lt!--&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Gray;&QQQ;&ZZZ;").Replace("-->", "&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;--&gt;&AAA;/span&ZZZ;").Replace("\r", "<br />").Replace("&AAA;", "<").Replace("&ZZZ;", ">").Replace("&QQQ;", "\""));
                    Output.WriteLine(remainder.Replace("<?", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&lt?").Replace("?>", "?&gt;&AAA;/span&ZZZ;").Replace("<!--", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&lt!--&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Gray;&QQQ;&ZZZ;").Replace("-->", "&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;--&gt;&AAA;/span&ZZZ;").Replace("</", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&lt;/&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Maroon;&QQQ;&ZZZ;").Replace("<", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&lt;&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Maroon;&QQQ;&ZZZ;").Replace("=\"", "&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;=&quot;&AAA;/span&ZZZ;").Replace("\">", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&quot;&gt;&AAA;/span&ZZZ;").Replace("\"", "&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&quot;&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Maroon;&QQQ;&ZZZ;").Replace("/>", "&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;/&gt;&AAA;/span&ZZZ;").Replace(">", "&AAA;/span&ZZZ;&AAA;span style=&QQQ;color:Blue;&QQQ;&ZZZ;&gt;&AAA;/span&ZZZ;").Replace("\r", "<br />").Replace("&AAA;", "<").Replace("&ZZZ;", ">").Replace("&QQQ;", "\""));
                 //   Output.WriteLine("</td></tr></table>");
                    break;

                default:
                    Output.WriteLine("<div class=\"sbkEimv_Citation\">");
                    Citation_ItemViewer citationViewer = new Citation_ItemViewer(Translator, codeManager, false)
                                                             {CurrentItem = item, CurrentMode = currentMode};
                    Output.WriteLine(citationViewer.Standard_Citation_String(false, Tracer));
                    break;

            }
            Output.WriteLine("</div><br />");
        }