Ejemplo n.º 1
0
        /// <summary>Runs the XML-Parser.</summary>
        /// <param name="source">an <code>InputSource</code></param>
        /// <returns>Returns an XML DOM-Document.</returns>
        /// <exception cref="Com.Adobe.Xmp.XMPException">Wraps parsing and I/O-exceptions into an XMPException.</exception>
        private static XmlDocument ParseInputSource(InputSource source)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(source.GetStream());

                return(doc);
            }
            catch (XmlException e)
            {
                throw new XMPException("XML parsing failure", XMPErrorConstants.Badxml, e);
            }
            catch (IOException e)
            {
                throw new XMPException("Error reading the XML-file", XMPErrorConstants.Badstream, e);
            }
            catch (Exception e)
            {
                throw new XMPException("XML Parser not correctly configured", XMPErrorConstants.Unknown, e);
            }
        }