Extension Function with .NET using Saxon HE 9.4

Help
2012-12-24
2012-12-24
  • Wanderley Melo
    Wanderley Melo
    2012-12-24

    Hi,

    How to get the return type of a function is datetime.
    Using atomictype like that:
    return new XdmSequenceType(XdmAtomicType.BuiltInAtomicType(QName.XS_INTEGER), '?');
    or other type.
    I use this xpath expression "xfi:period-instant(xfi:period($v)) + xs:yearMonthDuration('P2M')". The function xfi:period-instant() must return datetime type.

    thanks.
    Wanderley

     
  • Michael Kay
    Michael Kay
    2012-12-24

    You can use the constructor

    new XdmAtomicValue(string lexicalForm, QName type, Processor processor)

    to construct a dateTime from a string in the form YYYY-MM-DDTHH:MM:SS. The QName should be xs:dateTime.

    I don't think there's any way of doing it from a native .NET date/time object, unless I've overlooked something.

     
  • Wanderley Melo
    Wanderley Melo
    2012-12-24

    Thanks Michael, I got it.