Exemplo n.º 1
0
        internal override XsdNs.AbstractDataComponentType GetObjectForXml_DataRecordField(string idPrefix)
        {
            var retval = new XsdNs.TimeRangeType();

            retval.SetValuesHelper(Start, End); // throws DateTimeException

            // Adding an empty UOM element (the schema requires it although it is obviously needless for timestamps)
            var unitRef = new XsdNs.UnitReference();

            retval.uom = unitRef;

            return(retval);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor. Use this to instantiate an item from XML (data record field).
        /// </summary>
        /// <param name="el">XML contents.</param>
        /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception>
        internal Item_TimeRange(XsdNs.TimeRangeType el) : base(XNeut.Helper.TypeUri_Temporal)
        {
            try
            {
                Start = el.GetStartHelper();
                End   = el.GetEndHelper();

                ValidateStartEnd(Start, End);
            }
            catch (NullReferenceException e)
            {
                throw new XNeut.InvalidMessageException("Failed to read time range (something missing?)", e);
            }
            catch (FormatException e)
            {
                throw new XNeut.InvalidMessageException("Failed to read time range", e);
            }
        }