private string GenerateAlmaRecord(string s, string id = "") { //We need to extract the record part (not the collection part) System.Xml.XmlTextReader rd; string sRec = ""; try { rd = new System.Xml.XmlTextReader(s, System.Xml.XmlNodeType.Document, null); //rd = new System.Xml.XmlTextReader(prawXML, System.Xml.XmlNodeType.Document, null); } catch (System.Exception pp) { //System.Windows.Forms.MessageBox.Show(pp.ToString()); return(""); } try { //System.Windows.Forms.MessageBox.Show("here"); while (rd.Read()) { //This is where we find the head of the record, //then process the values within the record. //We also need to do character encoding here if necessary. if (rd.NodeType == System.Xml.XmlNodeType.Element) { //System.Windows.Forms.MessageBox.Show(rd.LocalName); if (rd.LocalName == "record") { sRec = rd.ReadOuterXml(); break; } } } rd.Close(); sRec = sRec.Replace("marc:", ""); string sidtag = ""; if (!string.IsNullOrEmpty(id)) { sidtag = "<mms_id>" + id + "</mms_id>"; } sRec = "<bib>" + sidtag + "<record_format>marc21</record_format><suppress_from_publishing>false</suppress_from_publishing>" + sRec + "</bib>"; return(sRec); } catch (System.Exception ppp) { //System.Windows.Forms.MessageBox.Show(ppp.ToString()); return(""); } }
/// <summary> /// Occurs before a form is displayed for the first time. /// Contains code to update read an XML file and update /// the text of some form controls. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An EventArgs that contains the event data.</param> private void Form1_Load(object sender, System.EventArgs e) { // Set the default fonts for the header and text. headerFont = new Font("Arial", 14); bodyFont = new Font("Arial", 10); // Update the form controls to display the default font settings. headerFontDefinition.Text = headerFont.ToString(); bodyFontDefinition.Text = bodyFont.ToString(); // Perform the reading of the data file within a try block in case // the data file doesn't exist or an error is encountered reading the file. try { // The XmlTextReader reads the specified XML file and provides a way to // scroll through the data elements. xmlReader = new System.Xml.XmlTextReader("..\\..\\..\\Misc\\ReportData.xml"); // Call the Read method in order to position the reader at the // first element. xmlReader.Read(); // Show the entire contents of the data file in // a textbox for comparison to the printed report. reportData.Text = xmlReader.ReadOuterXml(); // Closes the XmlReader. xmlReader.Close(); } catch (Exception ex) { // An error was encountered opening or reading the data file. // Display an appropriate message to the user. MessageBox.Show("Error opening file: \r\n" + ex.Message); // Close the form since a report can't be printed without access // to the data file. this.Close(); } }
public ListIdentifier ListIdentifiers(string sPrefix, string sset, string sfrom, string suntil, ResumptionToken objToken) { System.IO.Stream objStream; ListIdentifier objList = new ListIdentifier(); Identifiers objRecord; ResumptionToken myToken; string tmp = ""; System.Net.HttpWebRequest wr; System.Xml.XmlTextReader rd; if (sPrefix.Length == 0) { sPrefix = "oai_dc"; } if (objToken == null) { if (sset.Length != 0) { sset = "&set=" + sset; } if (sfrom.Length != 0) { sfrom = "&from=" + sfrom; } if (suntil.Length != 0) { suntil = "&until=" + suntil; } prequestURL = baseURL + "?verb=ListIdentifiers&metadataPrefix=" + sPrefix + sset + sfrom + suntil; } else { prequestURL = baseURL + "?verb=ListIdentifiers&resumptionToken=" + objToken.resumptionToken; //This is where we handle the resumptionToken } //====================================================== // If you wanted to support additional metadata formats, // you would just need to have additional handlers. //====================================================== //Console.Write(sURL); try { wr = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(prequestURL); wr.UserAgent = cUserAgent; System.Net.WebResponse response = wr.GetResponse(); objStream = response.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(objStream); prawXML = reader.ReadToEnd(); reader.Close(); rd = new System.Xml.XmlTextReader(prawXML, System.Xml.XmlNodeType.Document, null); } catch (Exception e) { error.errorName = "badConnection"; error.errorDescription = e.Message + "<br>Unable to connect to " + baseURL; return null; } while (rd.Read()) { if (rd.NodeType == System.Xml.XmlNodeType.Element) { if (rd.Name == "responseDate") { presponseDate = rd.ReadString(); } else if (rd.Name == "ListIdentifiers") { do { if (rd.Name == "header") { tmp = rd.ReadOuterXml(); //tmp += ParseOAIContainer(ref rd, "header", true); //Console.WriteLine("In the Function: " + tmp); objRecord = new Identifiers(tmp); objList.record.Add(objRecord); //return objRecord; } else if (rd.Name == "resumptionToken") { tmp = rd.ReadOuterXml(); myToken = new ResumptionToken(tmp); objList.token = myToken; } else rd.Read(); // Added the Read() and will never occur with the ReadInnerXml() } while (rd.Name != "ListIdentifiers"); // loop } else if (rd.Name == "error") { error.errorName = rd.GetAttribute("code"); error.errorDescription = rd.ReadString(); rd.Close(); return null; } } } rd.Close(); return objList; }
public ListSet ListSets(ResumptionToken objToken, ref Object objHandler) { System.IO.Stream objStream; OAI_LIST objRecord; ListSet objList = new ListSet(); ResumptionToken myToken; string tmp = ""; System.Net.HttpWebRequest wr; System.Xml.XmlTextReader rd; if (objToken == null) { prequestURL = baseURL + "?verb=ListSets"; } else { prequestURL = baseURL + "?verb=ListSets&resumptionToken=" + objToken.resumptionToken; //This is where we handle the resumptionToken } //====================================================== // If you wanted to support additional metadata formats, // you would just need to have additional handlers. //====================================================== try { wr = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(prequestURL); wr.UserAgent = cUserAgent; System.Net.WebResponse response = wr.GetResponse(); objStream = response.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(objStream); prawXML = reader.ReadToEnd(); reader.Close(); rd = new System.Xml.XmlTextReader(prawXML, System.Xml.XmlNodeType.Document, null); } catch (Exception e) { error.errorName = e.ToString(); error.errorDescription = e.Message + "\n<br>Unable to connect to " + baseURL; return null; } while (rd.Read()) { if (rd.NodeType == System.Xml.XmlNodeType.Element) { if (rd.Name == "responseDate") { presponseDate = rd.ReadString(); } else if (rd.Name == "ListSets") { //while (rd.Read()) do { if (rd.Name == "set") { objRecord = new OAI_LIST(rd.ReadInnerXml(), ref objHandler); objList.listset.Add(objRecord); //return objRecord; } else if (rd.Name == "resumptionToken") { tmp = rd.ReadOuterXml(); myToken = new ResumptionToken(tmp); objList.token = myToken; } else rd.Read(); // Added the Read() and will never occur with the ReadInnerXml() } while (rd.Name != "ListSets"); // loop } else if (rd.Name == "error") { error.errorName = rd.GetAttribute("code"); error.errorDescription = rd.ReadString(); return null; } } } rd.Close(); return objList; }
internal static DataBroadCastHandler ParseAndGet_DataBroadCastHandler_FromXMLDataString(string XMLDataString) { System.IO.StringReader sr = null; System.Xml.XmlTextReader m_xmlr = null; try { sr = new System.IO.StringReader(XMLDataString); m_xmlr = new System.Xml.XmlTextReader(sr); m_xmlr.WhitespaceHandling = System.Xml.WhitespaceHandling.None; } catch (System.Xml.XmlException) { string msg; msg = "Error trying to get XML format from broadcasted data string [" + XMLDataString + "]"; } catch (Exception ex) { string msg = ""; msg = "Error trying to parse broadcasted XML string : " + ex.Message; throw (new Exception(msg)); } m_xmlr.Read(); string HeaderIdentifier = m_xmlr.Name; if (HeaderIdentifier != "BROADCAST_HANDLER") { throw (new System.Xml.XmlException("Invalid data header " + HeaderIdentifier + ". Must be \'BROADCAST_HANDLER\'")); } else { //read the mode attribute from the current section "BROADCAST_HANDLER" BroadCastMode mode = default(BroadCastMode); string modeStr = m_xmlr.GetAttribute("broadcastMode"); switch (modeStr) { case "BroadCasterIsWaitingReply": mode = BroadCastMode.BroadCasterIsWaitingReply; break; case "BroadCasterIsNotWaitingReply": mode = BroadCastMode.BroadCasterIsNotWaitingReply; break; default: mode = BroadCastMode.undefined; break; } string broadCastIDName = ""; broadCastIDName = m_xmlr.GetAttribute("broadcastIDName"); if (broadCastIDName == null) { throw (new Exception("No attribute \'broadcastIDName\' in XML data string [" + XMLDataString + "]")); } //retrieves all the xml string of the broadcastable data section m_xmlr.Read(); string broadCastedXMLString = m_xmlr.ReadOuterXml(); BroadcastableData data = BroadcastableData.ParseAndGet_BroadcastableData_FromXMLDataString(broadCastedXMLString); DataBroadCastHandler handler = new DataBroadCastHandler(mode, broadCastIDName, data); return(handler); } }
internal static P2PData ParseAndGet_P2PData_FromXMLDataString(string XMLString) { System.IO.StringReader sr = null; System.Xml.XmlTextReader m_xmlr = null; try { sr = new System.IO.StringReader(XMLString); m_xmlr = new System.Xml.XmlTextReader(sr); m_xmlr.WhitespaceHandling = System.Xml.WhitespaceHandling.None; } catch (System.Xml.XmlException) { string msg; msg = "Error trying to get XML format from P2P Data string [" + XMLString + "]"; } catch (Exception ex) { string msg = ""; msg = "Error trying to parse P2P socket XML string : " + ex.Message; throw (new Exception(msg)); } m_xmlr.Read(); string HeaderIdentifier = m_xmlr.Name; if (HeaderIdentifier != "P2P_DATA") { throw (new System.Xml.XmlException("Invalid P2P data header " + HeaderIdentifier + ". Must be \'P2P_DATA\'")); } else { //********************************************************** //retrieves the data operation type //********************************************************** string operationID = ""; operationID = m_xmlr.GetAttribute("P2PDataOperationID"); if (operationID == null) { operationID = Guid.NewGuid().ToString(); } //********************************************************** //retrieves the data itself //********************************************************** m_xmlr.Read(); string dataSectionName = m_xmlr.Name; DataVariable variable = default(DataVariable); if (dataSectionName == "DATA") { string variableXMLstring = m_xmlr.ReadOuterXml(); variable = XMLDataFormatting.RetrieveDataVariableFromXMLString(variableXMLstring); } else { throw (new Exception("Invalid data XML section name \'" + dataSectionName + "\'. Is expected to be \'DATA\'")); } //********************************************************** //retrieves the attributes table and its XML attributes //********************************************************** string dataAttributesSectionName = m_xmlr.Name; P2PDataAttributesTable attrTAble = null; int AttrCount = 0; if (dataAttributesSectionName == "DATA_ATTRIBUTES") { string attributesCount = m_xmlr.GetAttribute("DataAttrCount"); if (!(attributesCount == null)) { AttrCount = System.Convert.ToInt32(attributesCount); if (AttrCount > 0) { string attrTableXMLString = m_xmlr.ReadInnerXml(); DataVariable tableVar = default(DataVariable); tableVar = XMLDataFormatting.RetrieveDataVariableFromXMLString(attrTableXMLString); attrTAble = new P2PDataAttributesTable((CustomHashTable)tableVar.Data); } } else { throw (new Exception("The parameter \'AttrCount\' is missing on the XML string in te section \'DATA_ATTRIBUTES\'")); } } else { throw (new Exception("Invalid data attributes XML section name \'" + dataSectionName + "\'. Is expected to be \'DATA_ATTRIBUTES\'")); } P2PData data = default(P2PData); data = new P2PData(operationID, System.Convert.ToString(variable.Name), variable.Data); if (AttrCount > 0) { data.AttachAttributesTable(attrTAble); } return(data); } }
public static SocketData ParseAndGet_SocketData_FromXMLDataString(string XMLString) { System.IO.StringReader sr = null; System.Xml.XmlTextReader m_xmlr = null; try { sr = new System.IO.StringReader(XMLString); m_xmlr = new System.Xml.XmlTextReader(sr); m_xmlr.WhitespaceHandling = System.Xml.WhitespaceHandling.None; } catch (System.Xml.XmlException) { string msg; msg = "Error trying to get XML format from data socket data string [" + XMLString + "]"; } catch (Exception ex) { string msg = ""; msg = "Error trying to parse data socket XML string : " + ex.Message; throw (new Exception(msg)); } m_xmlr.Read(); string HeaderIdentifier = m_xmlr.Name; if (HeaderIdentifier != "SD") { throw (new System.Xml.XmlException("Invalid data socket header " + HeaderIdentifier + ". Must be \'SD\'")); } else { //********************************************************** //retrieves the data transported on the XML //********************************************************** m_xmlr.Read(); string dataSectionName = m_xmlr.Name; DataVariable variable = default(DataVariable); if (dataSectionName == "DATA") { string variableXMLstring = m_xmlr.ReadOuterXml(); variable = XMLDataFormatting.RetrieveDataVariableFromXMLString(variableXMLstring); } else { throw (new Exception("Invalid data XML section name \'" + dataSectionName + "\'. Is expected to be \'DATA\'")); } //********************************************************** //retrieves the attributes table and its XML attributes //********************************************************** string dataAttributesSectionName = m_xmlr.Name; AttributesTable attributesTable = null; int AttrCount = 0; if (dataAttributesSectionName == "SDAS") { string attributesCount = m_xmlr.GetAttribute("cn"); if (!(attributesCount == null)) { AttrCount = System.Convert.ToInt32(attributesCount); if (AttrCount > 0) { string attrTableXMLString = m_xmlr.ReadInnerXml(); DataVariable tableVar = default(DataVariable); tableVar = XMLDataFormatting.RetrieveDataVariableFromXMLString(attrTableXMLString); CustomHashTable table = default(CustomHashTable); table = (CustomHashTable)tableVar.Data; attributesTable = new AttributesTable(table); } } else { throw (new Exception("The parameter \'cn\' is missing on the XML string in te section \'SDAS\'")); } } else { throw (new Exception("Invalid data attributes XML section name \'" + dataSectionName + "\'. Is expected to be \'SD_ATTRS\'")); } SocketData data = default(SocketData); data = new SocketData(System.Convert.ToString(variable.Name), variable.Data); if (AttrCount > 0) { data.AttachAttributesTable(attributesTable); } return(data); } }
public ListRecord ListRecords(string sPrefix, string sset, string sfrom, string suntil, ResumptionToken objToken, ref Object objHandler) { int fail = 0; Restart: System.IO.Stream objStream; ListRecord objList = new ListRecord(); Record objRecord; ResumptionToken myToken; string tmp = ""; System.Net.HttpWebRequest wr = null; System.Xml.XmlTextReader rd = null; if (sPrefix.Length==0) { sPrefix = "oai_dc"; } if (objToken==null) { if (sset.Length!=0) { sset = "&set=" + sset; } if (sfrom.Length!=0) { sfrom = "&from=" + sfrom; } if (suntil.Length!=0) { suntil = "&until=" + suntil; } prequestURL = baseURL + "?verb=ListRecords&metadataPrefix=" + sPrefix + sset + sfrom + suntil; } else { //This is where we handle the resumptionToken - McCown prequestURL = baseURL + "?verb=ListRecords&resumptionToken=" + objToken.resumptionToken; } //====================================================== // If you wanted to support additional metadata formats, // you would just need to have additional handlers. //====================================================== try { wr = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(prequestURL); //wr.Headers.Add("Host:" + System.Net.Dns.GetHostName()); wr.UserAgent = cUserAgent + DateTime.Now.ToString(); if (this.Timeout <= 0) { this.Timeout = 100000; } wr.Timeout = this.Timeout; System.Net.WebResponse response = wr.GetResponse(); objStream = response.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(objStream); prawXML = reader.ReadToEnd(); //System.Windows.Forms.MessageBox.Show(prawXML); reader.Close(); response.Close(); rd = new System.Xml.XmlTextReader(prawXML, System.Xml.XmlNodeType.Document, null); rd.Normalization = true; } catch (System.Net.WebException ee) { int sleepval = 3000; fail++; //System.Windows.Forms.MessageBox.Show(tt.ToString()); //System.Windows.Forms.MessageBox.Show(ee.ToString()); if (ee.Status == System.Net.WebExceptionStatus.ProtocolError) { var response = ee.Response as System.Net.HttpWebResponse; if (response != null) { if ((int)response.StatusCode == 503) { string retryafter = response.Headers["Retry-After"]; if (retryafter != null && IsNumeric(retryafter) == true) { { sleepval = System.Convert.ToInt32(retryafter) * 1000; } } } } if (fail <= 4) { //System.Windows.Forms.MessageBox.Show(sleepval.ToString()); System.Threading.Thread.Sleep(sleepval); goto Restart; } else { wr.Abort(); error.errorName = ee.ToString(); error.errorDescription = ee.Message + "\n<br>Unable to connect to " + baseURL; return null; } } } catch (Exception e) { // System.Windows.Forms.MessageBox.Show("2"); if (wr != null) { wr.Abort(); } error.errorName = e.ToString(); error.errorDescription = e.Message + "\n<br>Unable to connect to " + baseURL; return null; } fail = 0; while (rd.Read()) { if (rd.NodeType == System.Xml.XmlNodeType.Element) { if (rd.Name == "responseDate") { presponseDate = rd.ReadString(); } else if (rd.Name=="ListRecords") { do { if (rd.Name=="record") { tmp = ParseOAIContainer(ref rd, "record"); objRecord = new Record(tmp,ref objHandler); objList.record.Add(objRecord); //return objRecord; } else if (rd.Name=="resumptionToken") { tmp=rd.ReadOuterXml(); myToken = new ResumptionToken(tmp); objList.token = myToken; } //else if (rd.Name.ToLower() == "OAI-PMH".ToLower()) //{ // break; //} else if (rd.EOF == true) { error.errorName = "Empty ListRecords Request"; error.errorDescription = "No data was returned in the ListRecords Element. This is likely an error."; return null; } else rd.Read(); // Added the Read() and will never occur with the ReadInnerXml() } while (rd.Name!="ListRecords"); // loop } else if (rd.Name=="error") { error.errorName = rd.GetAttribute("code"); error.errorDescription = rd.ReadString(); return null; } } } return objList; }
internal static P2PDataDeliveryResult ParseAndGet_P2PDataDeliveryResult_FromXMLDataString(string XMLString) { System.IO.StringReader sr = null; System.Xml.XmlTextReader m_xmlr = null; try { sr = new System.IO.StringReader(XMLString); m_xmlr = new System.Xml.XmlTextReader(sr); m_xmlr.WhitespaceHandling = System.Xml.WhitespaceHandling.None; } catch (System.Xml.XmlException) { string msg; msg = "Error trying to get XML format from P2P Data string [" + XMLString + "]"; } catch (Exception ex) { string msg = ""; msg = "Error trying to parse P2P socket XML string : " + ex.Message; throw (new Exception(msg)); } m_xmlr.Read(); string HeaderIdentifier = m_xmlr.Name; if (HeaderIdentifier != "P2P_DATA_DELIVERY_RESULT") { throw (new System.Xml.XmlException("Invalid data header " + HeaderIdentifier + ". It was expected to be \'P2P_DATA_DELIVERY_RESULT\'")); } else { //********************************************************** //retrieves the data operation type //********************************************************** string P2PDataOperationID = ""; P2PDataOperationID = m_xmlr.GetAttribute("P2PDataOperationID"); if (P2PDataOperationID == null) { P2PDataOperationID = Guid.NewGuid().ToString(); } string DeliveryResultType = ""; DeliveryResultType = m_xmlr.GetAttribute("DeliveryResultType"); if (DeliveryResultType == null) { DeliveryResultType = "DeliverySucceed"; } //********************************************************** //retrieves the data itself //********************************************************** m_xmlr.Read(); string dataSectionName = m_xmlr.Name; DataVariable variable; if (dataSectionName == "DATA") { string variableXMLstring = m_xmlr.ReadOuterXml(); variable = XMLDataFormatting.RetrieveDataVariableFromXMLString(variableXMLstring); } else { throw (new Exception("Invalid data XML section name \'" + dataSectionName + "\'. Is expected to be \'DATA\'")); } string errorMEssage = System.Convert.ToString(variable.Data); P2PDataDeliveryResult result = null; switch (DeliveryResultType) { case "DeliveryFailure": result = P2PDataDeliveryResult.GetFailureDeliveryResult(P2PDataOperationID, errorMEssage); break; case "DeliverySucceed": result = P2PDataDeliveryResult.GetSucceedDeliveryResult(P2PDataOperationID); break; } return(result); } }
internal static P2PDataRequestFailure ParseAndGet_P2PDataRequestFailure_FromXMLDataString(string XMLString) { System.IO.StringReader sr = null; System.Xml.XmlTextReader m_xmlr = null; try { sr = new System.IO.StringReader(XMLString); m_xmlr = new System.Xml.XmlTextReader(sr); m_xmlr.WhitespaceHandling = System.Xml.WhitespaceHandling.None; } catch (System.Xml.XmlException) { string msg; msg = "Error trying to get XML format from P2PDataRequest Data string [" + XMLString + "]"; } catch (Exception ex) { string msg = ""; msg = "Error trying to parse P2PDataRequest XML string : " + ex.Message; throw (new Exception(msg)); } m_xmlr.Read(); string HeaderIdentifier = m_xmlr.Name; if (HeaderIdentifier != "P2P_DATA_REQUEST_FAILURE") { throw (new System.Xml.XmlException("Invalid P2PDataRequestFailure header \'" + HeaderIdentifier + "\'. It was expected to be \'P2P_DATA_REQUEST_FAILURE\'")); } else { //********************************************************** //retrieves the data operation type //********************************************************** string P2PDataOperationID = ""; P2PDataOperationID = m_xmlr.GetAttribute("P2PDataOperationID"); if (P2PDataOperationID == null) { P2PDataOperationID = Guid.NewGuid().ToString(); } //********************************************************** //retrieves the data that holds the error message //********************************************************** m_xmlr.Read(); string dataSectionName = m_xmlr.Name; DataVariable variable = default(DataVariable); if (dataSectionName == "DATA") { string variableXMLstring = m_xmlr.ReadOuterXml(); variable = XMLDataFormatting.RetrieveDataVariableFromXMLString(variableXMLstring); } else { throw (new Exception("Invalid data XML section name \'" + dataSectionName + "\'. Is expected to be \'DATA\'")); } string errorMEssage = System.Convert.ToString(variable.Data); //creates the object to return to caller P2PDataRequestFailure reqFailure = new P2PDataRequestFailure(P2PDataOperationID, errorMEssage); return(reqFailure); } }
internal static BroadcastableData ParseAndGet_BroadcastableData_FromXMLDataString(string XMLDataString) { System.IO.StringReader sr = null; System.Xml.XmlTextReader m_xmlr = null; string broadCasterName = ""; string broadCasterHost = ""; int broadCasterListeningPort = 0; try { sr = new System.IO.StringReader(XMLDataString); m_xmlr = new System.Xml.XmlTextReader(sr); m_xmlr.WhitespaceHandling = System.Xml.WhitespaceHandling.None; } catch (System.Xml.XmlException) { string msg; msg = "Error trying to get XML format from broadcasted data string [" + XMLDataString + "]"; } catch (Exception ex) { string msg = ""; msg = "Error trying to parse broadcasted XML string : " + ex.Message; throw (new Exception(msg)); } m_xmlr.Read(); string HeaderIdentifier = m_xmlr.Name; if (HeaderIdentifier != "BROADCASTED_DATA") { throw (new System.Xml.XmlException("Invalid data header " + HeaderIdentifier + ". Must be \'BROADCASTED_DATA\'")); } else { m_xmlr.Read(); string broadCasterHeader = m_xmlr.Name; if (broadCasterHeader != "BROADCASTER_INFO") { throw (new System.Xml.XmlException("Invalid XML structure was expected a <BROADCASTER_INFO> and was found " + broadCasterHeader)); } else { //******************************************************* //gets the data broadcaster information //******************************************************* broadCasterName = m_xmlr.GetAttribute("name"); if (broadCasterName == null) { throw (new Exception("Can\'t determine the attribute NAME of the section <BROADCASTER_INFO> from XML String [" + XMLDataString + "]")); } broadCasterHost = m_xmlr.GetAttribute("host"); if (broadCasterHost == null) { throw (new Exception("Can\'t determine the attribute HOST of the section <BROADCASTER_INFO> from XML String [" + XMLDataString + "]")); } string PORT = m_xmlr.GetAttribute("listeningPort"); if (PORT == null) { throw (new Exception("Can\'t determine the attribute LISTENINGPORT of the section <BROADCASTER_INFO> from XML String [" + XMLDataString + "]")); } broadCasterListeningPort = System.Convert.ToInt32(PORT); //******************************************************* //gets the data from the XML string //******************************************************* string dataValueAsString = ""; m_xmlr.Read(); m_xmlr.Read(); dataValueAsString = m_xmlr.ReadOuterXml(); DataVariable var = XMLDataFormatting.RetrieveDataVariableFromXMLString(dataValueAsString); BroadcastableData broadCastedData = new BroadcastableData(broadCasterName, broadCasterHost, broadCasterListeningPort, System.Convert.ToString(var.Name), var.Data); return(broadCastedData); } } }