/// <summary> /// Process given resource /// </summary> /// <param name="resource">Resource to process</param> /// <returns>Resource processed to an XML node</returns> public XmlNode Process(IResource resource) { try { using (resource) { var doc = new XmlDocument(); using (var stream = resource.GetStreamReader()) { doc.Load(stream); } m_engine.PushResource(resource); var element = Process(doc.DocumentElement); m_engine.PopResource(); return(element); } } catch (ConfigurationProcessingException) { throw; } catch (Exception ex) { var message = string.Format("Error processing node resource {0}", resource); throw new ConfigurationProcessingException(message, ex); } }
public void Test_Embedded4() { var resource = Xml.Embedded("hasResourceIncludes.xml"); var interpreter = new XmlInterpreter(resource); var kernel = new DefaultKernel(); var resourceSubSystem = kernel.GetSubSystem(SubSystemConstants.ResourceKey) as IResourceSubSystem; var processor = new XmlProcessor(null, resourceSubSystem); var assemRes = resource as AssemblyResource; Assert.IsNotNull(assemRes); var doc = new XmlDocument(); using (var stream = resource.GetStreamReader()) { doc.Load(stream); } var engine = new DefaultXmlProcessorEngine(null, resourceSubSystem); engine.PushResource(resource); Assert.AreEqual(doc.DocumentElement.InnerText, ""); var element = processor.Process(doc.DocumentElement); engine.PopResource(); }