Example #1
0
	    /**
	     * Gets the request.
	     * 
	     * @param input
	     *            the input
	     * @return the request
	     * @throws XMLRealiserException
	     *             the xML realiser exception
	     */
		public static wrapper.RequestType getRequest(StringReader input)
		{
			wrapper.NLGSpec spec = UnWrapper.getNLGSpec(input);
			wrapper.RequestType request = spec.Request;
			if (request == null)
			{
				throw new XMLRealiserException("Must have Request element");
			}

			return request;
		}
Example #2
0
	    /**
	     * Gets the recording.
	     * 
	     * @param input
	     *            the input
	     * @return the recording
	     * @throws XMLRealiserException
	     *             the xML realiser exception
	     */
		public static wrapper.RecordSet getRecording(StringReader input)
		{
			wrapper.NLGSpec spec = UnWrapper.getNLGSpec(input);
			wrapper.RecordSet recording = spec.Recording;
			if (recording == null)
			{
				throw new XMLRealiserException("Must have Recording element");
			}

			return recording;

		}
Example #3
0
        /**
         * Create wrapper objects from xml for a request to realise, or the xml for
         * a recording. Both are elements of NLGSpec.
         *
         * @param xmlReader
         *            the xml reader
         * @return the nLG spec
         * @throws XMLRealiserException
         *             the xML realiser exception
         */
        public static wrapper.NLGSpec getNLGSpec(StringReader xmlReader)
        {
            wrapper.NLGSpec wt = null;
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(wrapper.NLGSpec));
                object        obj        = serializer.Deserialize(xmlReader);

                if (obj is wrapper.NLGSpec)
                {
                    wt = (wrapper.NLGSpec)obj;
                }
            }

            catch (Exception e)
            {
                throw new XMLRealiserException("XML deserialization error", e);
            }

            return(wt);
        }