Beispiel #1
0
 public SepaDocument(SepaMessageInfo aMessageInfo, SepaMessage aMessage)
 {
     this.m_aXmlEncoding = new UTF8Encoding(false);
     if (aMessageInfo == null)
     {
         throw new ArgumentNullException();
     }
     this.m_aMessageInfo = aMessageInfo;
     this.Message        = aMessage;
 }
Beispiel #2
0
        public static SepaDocument NewDocumentXml(XmlReader aXmlReader)
        {
            if (aXmlReader == null)
            {
                throw new ArgumentNullException();
            }
            aXmlReader.MoveToContent();
            if (aXmlReader.Name != "Document")
            {
                throw new XmlException("No SEPA Document", null);
            }
            string namespaceURI = aXmlReader.NamespaceURI;
            string s            = null;

            if ((namespaceURI != null) && (namespaceURI != ""))
            {
                s = aXmlReader.GetAttribute("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance");
                if ((s != null) && (s != ""))
                {
                    string[] strArray = _Split(s);
                    for (int i = 1; i < strArray.Length; i++)
                    {
                        if (strArray[i - 1] == namespaceURI)
                        {
                            s = strArray[i];
                            break;
                        }
                    }
                }
            }
            aXmlReader.ReadStartElement("Document");
            SepaMessageInfo aMessageInfo = SepaMessageInfo.Create(aXmlReader.LocalName, namespaceURI);

            if (aMessageInfo == null)
            {
                throw new NotSupportedException();
            }
            aMessageInfo.XmlSchemaLocation = s;
            SepaMessage aMessage = aMessageInfo.NewMessage();

            aMessage.ReadXml(aXmlReader, aMessageInfo);
            aXmlReader.ReadEndElement();
            return(new SepaDocument(aMessageInfo, aMessage));
        }