Exemple #1
0
        /// <summary>Method to load the resource file.</summary>
        /// <remarks>
        /// Method to load the resource file.
        /// generates the root.
        /// </remarks>
        /// <param name="resourceInput">InputStream that provides the XML to parse</param>
        /// <returns/>
        /// <exception cref="Javax.Xml.Parsers.ParserConfigurationException"/>
        /// <exception cref="Org.Xml.Sax.SAXException"/>
        /// <exception cref="System.IO.IOException"/>
        protected internal virtual Queue LoadResource(InputStream resourceInput)
        {
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.NewInstance();

            //ignore all comments inside the xml file
            docBuilderFactory.SetIgnoringComments(true);
            //allow includes in the xml file
            docBuilderFactory.SetNamespaceAware(true);
            try
            {
                docBuilderFactory.SetXIncludeAware(true);
            }
            catch (NotSupportedException e)
            {
                Log.Info("Failed to set setXIncludeAware(true) for parser " + docBuilderFactory +
                         NameSeparator + e);
            }
            DocumentBuilder builder    = docBuilderFactory.NewDocumentBuilder();
            Document        doc        = null;
            Element         queuesNode = null;

            doc        = builder.Parse(resourceInput);
            queuesNode = doc.GetDocumentElement();
            return(this.ParseResource(queuesNode));
        }