Ejemplo n.º 1
0
        private XmlElement getXmlElementFromBytes(byte[] processDefinitionXml)
        {
            XmlElement xmlElement = null;

            Stream processDefinitionInputStream = new MemoryStream(processDefinitionXml);
            XmlParser xmlParser = new XmlParser(processDefinitionInputStream);
            xmlElement = xmlParser.Parse();
            return xmlElement;
        }
Ejemplo n.º 2
0
		public void TestXmlParser()
		{
			XmlTextReader exampleXml = new XmlTextReader(
				TestHelper.GetExampleDir()+"process\\holiday\\processdefinition.xml");
			XmlParser xmlParser = new XmlParser(exampleXml);
			XmlElement element = xmlParser.Parse();

			XmlElement startstate = element.GetChildElement("start-state");
			Assert.IsNotNull(startstate);
			Assert.IsNotNull(startstate.GetAttribute("name"));

			XmlElement endstate = element.GetChildElement("end-state");
			Assert.IsNotNull(endstate);
			Assert.IsNotNull(endstate.GetAttribute("name"));

			IList pdattr = element.GetChildElements("attribute");
			Assert.IsNotNull(pdattr);
			Assert.IsTrue(pdattr.Count > 1);
		}
Ejemplo n.º 3
0
		private IDictionary ParseConfiguration(DelegationImpl delegationImpl)
		{
			IDictionary parameters = new Hashtable();
			try
			{
				String configuration = delegationImpl.Configuration;
				if ((Object) configuration != null)
				{
					XmlParser xmlParser = new XmlParser(configuration);
					xmlParser.Validation = false;
					XmlElement configurationXmlElement = xmlParser.Parse();
					IList parameterXmlElements = configurationXmlElement.GetChildElements("parameter");
					IEnumerator iter = parameterXmlElements.GetEnumerator();
					while (iter.MoveNext())
					{
						XmlElement parameterXmlElement = (XmlElement) iter.Current;

						String name = parameterXmlElement.GetProperty("name");
						if ((Object) name == null)
						{
							throw new SystemException("invalid delegation-configuration : " + configurationXmlElement);
						}

						parameters[name] = GetObject(parameterXmlElement);
					}
				}
			}
			catch (Exception t)
			{
				log.Error("can't parse configuration : ", t);
				throw new SystemException("can't parse configuration : " + t.Message);
			}

			return parameters;
		}
Ejemplo n.º 4
0
		private XmlElement GetXmlElementForEntry(String entryName, IDictionary entries, CreationContext creationContext)
		{
			XmlElement xmlElement = null;

			byte[] processDefinitionXml = (byte[]) entries[entryName];
			if (processDefinitionXml == null)
			{
				creationContext.AddError("entry '" + entryName + "' found not found in the process archive");
				throw new SystemException("entry '" + entryName + "' found not found in the process archive");
			}

			Stream processDefinitionInputStream = new MemoryStream(processDefinitionXml);
			XmlParser xmlParser = new XmlParser(processDefinitionInputStream);
			xmlElement = xmlParser.Parse();
			return xmlElement;
		}