示例#1
0
 public static XdmValue ToXdmValue(this Byte value, SaxonItemFactory itemFactory)
 {
     return(ToXdmValue(value, itemFactory));
 }
示例#2
0
 public static XdmValue ToXdmValue(this Single value, SaxonItemFactory itemFactory)
 {
     return(ToXdmValue(value));
 }
示例#3
0
 public SaxonProcessor()
 {
     processor    = new Processor();
     _ItemFactory = new SaxonItemFactory(processor);
     RegisterExtensionFunctions(processor, _ItemFactory);
 }
示例#4
0
 public static XdmValue ToXdmValue(this Boolean value, SaxonItemFactory itemFactory)
 {
     return(ToXdmValue(value));
 }
示例#5
0
 public static XdmAtomicValue ToXdmAtomicValue(this XPathItem value, SaxonItemFactory itemFactory) {
    return ToXdmAtomicValue(value, itemFactory.processor);
 }
示例#6
0
      public static XdmNode ToXdmNode(this IXPathNavigable value, SaxonItemFactory itemFactory) {

         if (value == null) throw new ArgumentNullException("value");

         return ToXdmNode(value.CreateNavigator(), itemFactory);
      }
示例#7
0
      public static XdmItem ToXdmItem(this object value, SaxonItemFactory itemFactory) {

         if (value == null) throw new ArgumentNullException("value");

         var xdmItem = value as XdmItem;

         if (xdmItem != null) {
            return xdmItem;
         }

         var item = value as XPathItem;

         if (item != null) {
            return ToXdmItem(item, itemFactory);
         }

         var nav = value as IXPathNavigable;

         if (nav != null) {
            return ToXdmNode(nav, itemFactory);
         }

         Type type = value.GetType();
         TypeCode typeCode = Type.GetTypeCode(type);

         switch (typeCode) {
            case TypeCode.Boolean:
            case TypeCode.Int16:
            case TypeCode.Int32:
            case TypeCode.Int64:
            case TypeCode.Byte:
            case TypeCode.SByte:
            case TypeCode.UInt16:
            case TypeCode.UInt32:
            case TypeCode.UInt64:
            case TypeCode.Char:
            case TypeCode.String:
            case TypeCode.DateTime:
            case TypeCode.Decimal:
            case TypeCode.Double:
            case TypeCode.Single:
               return ToXdmAtomicValue(value, type, typeCode, itemFactory.processor);

            case TypeCode.DBNull:
            case TypeCode.Empty:
               throw new ArgumentException("value cannot be null or empty.", "value");

            default:
            case TypeCode.Object:
               break;
         }

         if (typeof(Uri).IsAssignableFrom(type)) {
            return ToXdmAtomicValue((Uri)value);
         }

         if (typeof(XmlQualifiedName).IsAssignableFrom(type)) {
            return ToXdmAtomicValue((XmlQualifiedName)value);
         }

         if (typeof(QName).IsAssignableFrom(type)) {
            return ToXdmAtomicValue((QName)value);
         }

         return ToXdmNode(value, itemFactory);
      }
示例#8
0
 public static XdmItem ToXdmItem(this IXPathNavigable value, SaxonItemFactory itemFactory) {
    return ToXdmNode(value, itemFactory);
 }
示例#9
0
 public static XdmValue ToXdmValue(this XPathItem value, SaxonItemFactory itemFactory) {
    return (value != null) ? (XdmValue)ToXdmItem(value, itemFactory) : XdmEmptySequence.INSTANCE;
 }
示例#10
0
 public static XdmValue ToXdmValue(this IEnumerable<string> value, SaxonItemFactory itemFactory) {
    return ToXdmValue(value);
 }
示例#11
0
 public static XdmValue ToXdmValue(this XmlQualifiedName value, SaxonItemFactory itemFactory) {
    return ToXdmValue(value);
 }
示例#12
0
 public static XdmValue ToXdmValue(this QName value, SaxonItemFactory itemFactory) {
    return ToXdmValue(value);
 }
示例#13
0
 public static XdmValue ToXdmValue(this Decimal value, SaxonItemFactory itemFactory) {
    return ToXdmValue(value);
 }