You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2024/07/11 13:17:23 UTC

(xalan-java) branch xalan-j_xslt3.0 updated: committing implementation of various new xs:integer subtypes

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
     new 1f745b353 committing implementation of various new xs:integer subtypes
1f745b353 is described below

commit 1f745b3532bf476eefcf2eca0c17d62d04777d54
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Thu Jul 11 18:47:11 2024 +0530

    committing implementation of various new xs:integer subtypes
---
 src/org/apache/xalan/templates/ElemFunction.java   |  20 ++++
 .../xalan/templates/XSConstructorFunctionUtil.java |  55 +++++++++
 src/org/apache/xpath/compiler/Keywords.java        |  15 +++
 src/org/apache/xpath/compiler/XPathParser.java     |  64 +++++++++-
 .../xpath/composite/SequenceTypeSupport.java       | 133 +++++++++++++++------
 src/org/apache/xpath/objects/XObject.java          |  15 +++
 src/org/apache/xpath/operations/InstanceOf.java    |  25 ++++
 .../xpath/types/{XSShort.java => XSByte.java}      |  40 +++----
 src/org/apache/xpath/types/XSShort.java            |  21 ++--
 src/org/apache/xpath/types/XSUnsignedByte.java     |  90 ++++++++++++++
 src/org/apache/xpath/types/XSUnsignedInt.java      |  90 ++++++++++++++
 src/org/apache/xpath/types/XSUnsignedLong.java     |  90 ++++++++++++++
 src/org/apache/xpath/types/XSUnsignedShort.java    |  90 ++++++++++++++
 13 files changed, 675 insertions(+), 73 deletions(-)

diff --git a/src/org/apache/xalan/templates/ElemFunction.java b/src/org/apache/xalan/templates/ElemFunction.java
index 4514f5c15..f9577581f 100644
--- a/src/org/apache/xalan/templates/ElemFunction.java
+++ b/src/org/apache/xalan/templates/ElemFunction.java
@@ -40,11 +40,16 @@ import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNodeSetForDOM;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.objects.XRTreeFrag;
+import org.apache.xpath.types.XSByte;
 import org.apache.xpath.types.XSNegativeInteger;
 import org.apache.xpath.types.XSNonNegativeInteger;
 import org.apache.xpath.types.XSNonPositiveInteger;
 import org.apache.xpath.types.XSPositiveInteger;
 import org.apache.xpath.types.XSShort;
+import org.apache.xpath.types.XSUnsignedByte;
+import org.apache.xpath.types.XSUnsignedInt;
+import org.apache.xpath.types.XSUnsignedLong;
+import org.apache.xpath.types.XSUnsignedShort;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
@@ -471,6 +476,21 @@ public class ElemFunction extends ElemTemplate
       else if (sequenceType == SequenceTypeSupport.XS_SHORT) {
          result = new XSShort(strVal); 
       }
+      else if (sequenceType == SequenceTypeSupport.XS_BYTE) {
+         result = new XSByte(strVal); 
+      }
+      else if (sequenceType == SequenceTypeSupport.XS_UNSIGNED_LONG) {
+         result = new XSUnsignedLong(strVal); 
+      }
+      else if (sequenceType == SequenceTypeSupport.XS_UNSIGNED_INT) {
+         result = new XSUnsignedInt(strVal); 
+      }
+      else if (sequenceType == SequenceTypeSupport.XS_UNSIGNED_SHORT) {
+         result = new XSUnsignedShort(strVal); 
+      }
+      else if (sequenceType == SequenceTypeSupport.XS_UNSIGNED_BYTE) {
+          result = new XSUnsignedByte(strVal); 
+      }
       else if (sequenceType == SequenceTypeSupport.XS_NON_NEGATIVE_INTEGER) {
          result = new XSNonNegativeInteger(strVal); 
       }
diff --git a/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java b/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
index db427e905..39747834b 100644
--- a/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
+++ b/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
@@ -43,11 +43,16 @@ import org.apache.xpath.compiler.Keywords;
 import org.apache.xpath.functions.FuncExtFunction;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XObject;
+import org.apache.xpath.types.XSByte;
 import org.apache.xpath.types.XSNegativeInteger;
 import org.apache.xpath.types.XSNonNegativeInteger;
 import org.apache.xpath.types.XSNonPositiveInteger;
 import org.apache.xpath.types.XSPositiveInteger;
 import org.apache.xpath.types.XSShort;
+import org.apache.xpath.types.XSUnsignedByte;
+import org.apache.xpath.types.XSUnsignedInt;
+import org.apache.xpath.types.XSUnsignedLong;
+import org.apache.xpath.types.XSUnsignedShort;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -306,6 +311,56 @@ public class XSConstructorFunctionUtil {
 	                        evalResultSequence = (new XSShort()).constructor(argSequence);
 	                        evalResult = evalResultSequence.item(0);
 	                        
+	                        break;
+	                    case Keywords.XS_BYTE :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSByte(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSByte()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_UNSIGNED_LONG :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSUnsignedLong(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSUnsignedLong()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_UNSIGNED_INT :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSUnsignedInt(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSUnsignedInt()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_UNSIGNED_SHORT :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSUnsignedShort(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSUnsignedShort()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
+	                        break;
+	                    case Keywords.XS_UNSIGNED_BYTE :
+	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
+	                            XObject argVal = (funcExtFunction.getArg(idx)).execute(xctxt);
+	                            argSequence.add(new XSUnsignedByte(XslTransformEvaluationHelper.getStrVal(argVal)));
+	                        }
+	    
+	                        evalResultSequence = (new XSUnsignedByte()).constructor(argSequence);
+	                        evalResult = evalResultSequence.item(0);
+	                        
 	                        break;
 	                    case Keywords.FUNC_BOOLEAN_STRING :
 	                        for (int idx = 0; idx < funcExtFunction.getArgCount(); idx++) {
diff --git a/src/org/apache/xpath/compiler/Keywords.java b/src/org/apache/xpath/compiler/Keywords.java
index cd8932eba..88aa3a651 100644
--- a/src/org/apache/xpath/compiler/Keywords.java
+++ b/src/org/apache/xpath/compiler/Keywords.java
@@ -419,6 +419,21 @@ public class Keywords
   /** xs:short data type string. */
   public static final String XS_SHORT = "short";
   
+  /** xs:short data type string. */
+  public static final String XS_BYTE = "byte";
+  
+  /** xs:short data type string. */
+  public static final String XS_UNSIGNED_LONG = "unsignedLong";
+  
+  /** xs:short data type string. */
+  public static final String XS_UNSIGNED_INT = "unsignedInt";
+  
+  /** xs:short data type string. */
+  public static final String XS_UNSIGNED_SHORT = "unsignedShort";
+  
+  /** xs:short data type string. */
+  public static final String XS_UNSIGNED_BYTE = "unsignedByte";
+  
   /** xs:date data type string. */
   public static final String XS_DATE = "date";
   
diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index b9221f790..a9226944f 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -4976,12 +4976,27 @@ public class XPathParser
 	     case Keywords.XS_SHORT :
 		    xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_SHORT);
 		    break;
+	     case Keywords.XS_BYTE :
+			xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_BYTE);
+			break;
+	     case Keywords.XS_UNSIGNED_LONG :
+			xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_LONG);
+			break;
+	     case Keywords.XS_UNSIGNED_INT :
+			xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_INT);
+			break;
+	     case Keywords.XS_UNSIGNED_SHORT :
+			xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_SHORT);
+			break;
+	     case Keywords.XS_UNSIGNED_BYTE :
+			xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_BYTE);
+			break;
 	     case Keywords.XS_DATE :
 	        xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_DATE);
 	        break;
 	     case Keywords.XS_DATETIME :
-	         xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_DATETIME);
-	         break;
+	        xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_DATETIME);
+	        break;
 	     case Keywords.XS_DURATION :
 	        xpathSequenceTypeExpr.setSequenceType(SequenceTypeSupport.XS_DURATION);
 	        break;
@@ -5096,6 +5111,21 @@ public class XPathParser
 		            case Keywords.XS_SHORT :
 		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_SHORT);
 		                break;
+		            case Keywords.XS_BYTE :
+		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_BYTE);
+		                break;
+		            case Keywords.XS_UNSIGNED_LONG :
+		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_LONG);
+		                break;
+		            case Keywords.XS_UNSIGNED_INT :
+		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_INT);
+		                break;
+		            case Keywords.XS_UNSIGNED_SHORT :
+		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_SHORT);
+		                break;
+		            case Keywords.XS_UNSIGNED_BYTE :
+		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_BYTE);
+		                break;
 		            case Keywords.XS_DATE :
 		            	arrayItemSequenceType.setSequenceType(SequenceTypeSupport.XS_DATE);
 		                break;
@@ -5222,6 +5252,21 @@ public class XPathParser
 		            case Keywords.XS_SHORT :
 		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_SHORT);
 		                break;
+		            case Keywords.XS_BYTE :
+		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_BYTE);
+		                break;
+		            case Keywords.XS_UNSIGNED_LONG :
+		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_LONG);
+		                break;
+		            case Keywords.XS_UNSIGNED_INT :
+		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_INT);
+		                break;
+		            case Keywords.XS_UNSIGNED_SHORT :
+		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_SHORT);
+		                break;
+		            case Keywords.XS_UNSIGNED_BYTE :
+		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_BYTE);
+		                break;
 		            case Keywords.XS_DATE :
 		            	keySequenceTypeData.setSequenceType(SequenceTypeSupport.XS_DATE);
 		                break;
@@ -5317,6 +5362,21 @@ public class XPathParser
 		            case Keywords.XS_SHORT :
 		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_SHORT);
 		                break;
+		            case Keywords.XS_BYTE :
+		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_BYTE);
+		                break;
+		            case Keywords.XS_UNSIGNED_LONG :
+		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_LONG);
+		                break;
+		            case Keywords.XS_UNSIGNED_INT :
+		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_INT);
+		                break;
+		            case Keywords.XS_UNSIGNED_SHORT :
+		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_SHORT);
+		                break;
+		            case Keywords.XS_UNSIGNED_BYTE :
+		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_UNSIGNED_BYTE);
+		                break;
 		            case Keywords.XS_DATE :
 		            	valueSequenceTypeData.setSequenceType(SequenceTypeSupport.XS_DATE);
 		                break;
diff --git a/src/org/apache/xpath/composite/SequenceTypeSupport.java b/src/org/apache/xpath/composite/SequenceTypeSupport.java
index e0520156d..485ebe864 100644
--- a/src/org/apache/xpath/composite/SequenceTypeSupport.java
+++ b/src/org/apache/xpath/composite/SequenceTypeSupport.java
@@ -16,7 +16,6 @@
  */
 package org.apache.xpath.composite;
 
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -34,7 +33,6 @@ import org.apache.xml.dtm.DTMManager;
 import org.apache.xml.dtm.ref.DTMNodeList;
 import org.apache.xpath.XPath;
 import org.apache.xpath.XPathContext;
-import org.apache.xpath.objects.XPathInlineFunction;
 import org.apache.xpath.objects.InlineFunctionParameter;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XBoolean;
@@ -43,13 +41,19 @@ import org.apache.xpath.objects.XNodeSetForDOM;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.objects.XPathArray;
+import org.apache.xpath.objects.XPathInlineFunction;
 import org.apache.xpath.objects.XPathMap;
 import org.apache.xpath.objects.XString;
+import org.apache.xpath.types.XSByte;
 import org.apache.xpath.types.XSNegativeInteger;
 import org.apache.xpath.types.XSNonNegativeInteger;
 import org.apache.xpath.types.XSNonPositiveInteger;
 import org.apache.xpath.types.XSPositiveInteger;
 import org.apache.xpath.types.XSShort;
+import org.apache.xpath.types.XSUnsignedByte;
+import org.apache.xpath.types.XSUnsignedInt;
+import org.apache.xpath.types.XSUnsignedLong;
+import org.apache.xpath.types.XSUnsignedShort;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -146,6 +150,16 @@ public class SequenceTypeSupport {
     
     public static int XS_SHORT = 55;
     
+    public static int XS_BYTE = 56;
+    
+    public static int XS_UNSIGNED_LONG = 57;
+    
+    public static int XS_UNSIGNED_INT = 58;
+    
+    public static int XS_UNSIGNED_SHORT = 59;
+    
+    public static int XS_UNSIGNED_BYTE = 60;
+    
     /** 
      * Following are constant int values denoting XPath 3.1 sequence
      * type KindTest expressions.
@@ -185,68 +199,68 @@ public class SequenceTypeSupport {
     private static List<XMLNSDecl> fPrefixTable;
     
     /**
-     * This class specifies min and max value ranges, for XML Schema 
-     * built-in types derived from type xs:integer as defined by 
+     * This class specifies min and max value ranges for XML Schema 
+     * built-in types derived from type xs:integer, as defined by 
      * XML Schema specification.
      * 
      * @author Mukul Gandhi <mu...@apache.org>
      */
-    public static class XmlSchemaBuiltInNumericTypeRange {
+    public static class XmlSchemaBuiltinNumericType {
     	
-    	public class LONG {
-    	   public long minInclusive = -9223372036854775808l;
-    	   public long maxInclusive = 9223372036854775807l;
+    	public static class Long {
+    	   public static long MIN_INCLUSIVE = -9223372036854775808l;
+    	   public static long MAX_INCLUSIVE = 9223372036854775807l;
     	}
     	
-    	public class INT {
-     	   public int minInclusive = -2147483648;
-     	   public int maxInclusive = 2147483647;
+    	public static class Int {
+     	   public static int MIN_INCLUSIVE = -2147483648;
+     	   public static int MAX_INCLUSIVE = 2147483647;
      	}
     	
-    	public class SHORT {
-      	   public short minInclusive = -32768;
-      	   public short maxInclusive = 32767;
+    	public static class Short {
+      	   public static short MIN_INCLUSIVE = -32768;
+      	   public static short MAX_INCLUSIVE = 32767;
       	}
     	
-    	public class BYTE {
-       	   public byte minInclusive = -128;
-       	   public byte maxInclusive = 127;
+    	public static class Byte {
+       	   public static byte MIN_INCLUSIVE = -128;
+       	   public static byte MAX_INCLUSIVE = 127;
        	}
     	
-    	public class NON_NEGATIVE_INTEGER {
-           public byte minInclusive = 0;
+    	public static class NonNegativeInteger {
+           public static byte MIN_INCLUSIVE = 0;
         }
     	
-    	public class POSITIVE_INTEGER {
-           public byte minInclusive = 1;
+    	public static class PositiveInteger {
+           public static byte MIN_INCLUSIVE = 1;
         }
     	
-    	public class NON_POSITIVE_INTEGER {
-           public byte maxInclusive = 0;
+    	public static class NonPositiveInteger {
+           public static byte maxInclusive = 0;
         }
     	
-    	public class NEGATIVE_INTEGER {
-           public byte maxInclusive = -1;
+    	public static class NegativeInteger {
+           public static byte MAX_INCLUSIVE = -1;
         }
     	
-    	public class UNSIGNED_LONG {
-    	   public long minInclusive = 0;
-           public BigInteger maxInclusive = new BigInteger("18446744073709551615");
+    	public static class UnsignedLong {
+    	   public static long MIN_INCLUSIVE = 0;
+           public static String MAX_INCLUSIVE = new String("18446744073709551615");
         }
     	
-    	public class UNSIGNED_INT {
-     	   public int minInclusive = 0;
-           public long maxInclusive = 4294967295l;
+    	public static class UnsignedInt {
+     	   public static int MIN_INCLUSIVE = 0;
+           public static long MAX_INCLUSIVE = 4294967295l;
         }
     	
-    	public class UNSIGNED_SHORT {
-      	   public int minInclusive = 0;
-           public int maxInclusive = 65535;
+    	public static class UnsignedShort {
+      	   public static int MIN_INCLUSIVE = 0;
+           public static int MAX_INCLUSIVE = 65535;
         }
     	
-    	public class UNSIGNED_BYTE {
-       	   public int minInclusive = 0;
-           public int maxInclusive = 255;
+    	public static class UnsignedByte {
+       	   public static int MIN_INCLUSIVE = 0;
+           public static int MAX_INCLUSIVE = 255;
         }
     }
     
@@ -762,6 +776,21 @@ public class SequenceTypeSupport {
             else if (expectedType == XS_SHORT) {
                result = new XSShort(srcStrVal);
             }
+            else if (expectedType == XS_BYTE) {
+               result = new XSByte(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_LONG) {
+               result = new XSUnsignedLong(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_INT) {
+               result = new XSUnsignedInt(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_SHORT) {
+               result = new XSUnsignedShort(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_BYTE) {
+               result = new XSUnsignedByte(srcStrVal);
+            }
             else if (expectedType == XS_DOUBLE) {
                result = new XSDouble(srcStrVal); 
             }
@@ -827,6 +856,21 @@ public class SequenceTypeSupport {
             else if (expectedType == XS_SHORT) {
                 result = new XSShort(srcStrVal);
             }
+            else if (expectedType == XS_BYTE) {
+                result = new XSByte(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_LONG) {
+                result = new XSUnsignedLong(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_INT) {
+                result = new XSUnsignedInt(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_SHORT) {
+                result = new XSUnsignedShort(srcStrVal);
+            }
+            else if (expectedType == XS_UNSIGNED_BYTE) {
+                result = new XSUnsignedByte(srcStrVal);
+            }
             else if (expectedType == XS_LONG) {
                 result = new XSLong(srcStrVal); 
             }
@@ -954,6 +998,21 @@ public class SequenceTypeSupport {
        else if (sequenceType == XS_SHORT) {
           dataTypeName = "xs:short"; 
        }
+       else if (sequenceType == XS_BYTE) {
+          dataTypeName = "xs:byte"; 
+       }
+       else if (sequenceType == XS_UNSIGNED_LONG) {
+          dataTypeName = "xs:unsignedLong"; 
+       }
+       else if (sequenceType == XS_UNSIGNED_INT) {
+          dataTypeName = "xs:unsignedInt"; 
+       }
+       else if (sequenceType == XS_UNSIGNED_SHORT) {
+          dataTypeName = "xs:unsignedShort"; 
+       }
+       else if (sequenceType == XS_UNSIGNED_BYTE) {
+          dataTypeName = "xs:unsignedByte"; 
+       }
        else if (sequenceType == XS_DOUBLE) {
           dataTypeName = "xs:double"; 
        }
diff --git a/src/org/apache/xpath/objects/XObject.java b/src/org/apache/xpath/objects/XObject.java
index 9d3d22eba..d61a3b97c 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -298,6 +298,21 @@ public class XObject extends Expression implements Serializable, Cloneable
   
   /** Constant for XPath 3.1 xs:short object type */
   public static final int CLASS_SHORT = 31;
+  
+  /** Constant for XPath 3.1 xs:byte object type */
+  public static final int CLASS_BYTE = 32;
+  
+  /** Constant for XPath 3.1 xs:unsignedLong object type */
+  public static final int CLASS_UNSIGNED_LONG = 33;
+  
+  /** Constant for XPath 3.1 xs:unsignedInt object type */
+  public static final int CLASS_UNSIGNED_INT = 34;
+  
+  /** Constant for XPath 3.1 xs:unsignedShort object type */
+  public static final int CLASS_UNSIGNED_SHORT = 35;
+  
+  /** Constant for XPath 3.1 xs:unsignedByte object type */
+  public static final int CLASS_UNSIGNED_BYTE = 36;
 
   /** Represents an unresolved variable type as an integer. */
   public static final int CLASS_UNRESOLVEDVARIABLE = 600;    
diff --git a/src/org/apache/xpath/operations/InstanceOf.java b/src/org/apache/xpath/operations/InstanceOf.java
index 44191295b..b1f86c253 100644
--- a/src/org/apache/xpath/operations/InstanceOf.java
+++ b/src/org/apache/xpath/operations/InstanceOf.java
@@ -42,11 +42,16 @@ import org.apache.xpath.objects.XObject;
 import org.apache.xpath.objects.XPathArray;
 import org.apache.xpath.objects.XPathMap;
 import org.apache.xpath.objects.XString;
+import org.apache.xpath.types.XSByte;
 import org.apache.xpath.types.XSNegativeInteger;
 import org.apache.xpath.types.XSNonNegativeInteger;
 import org.apache.xpath.types.XSNonPositiveInteger;
 import org.apache.xpath.types.XSPositiveInteger;
 import org.apache.xpath.types.XSShort;
+import org.apache.xpath.types.XSUnsignedByte;
+import org.apache.xpath.types.XSUnsignedInt;
+import org.apache.xpath.types.XSUnsignedLong;
+import org.apache.xpath.types.XSUnsignedShort;
 
 import xml.xpath31.processor.types.XSAnyURI;
 import xml.xpath31.processor.types.XSBoolean;
@@ -195,6 +200,26 @@ public class InstanceOf extends Operation
                                                  (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {
           isInstanceOf = true;
       }
+      else if ((xdmValue instanceof XSByte) && ((seqTypeData.getSequenceType() == SequenceTypeSupport.XS_BYTE) || 
+                                                (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {
+          isInstanceOf = true;
+      }
+      else if ((xdmValue instanceof XSUnsignedLong) && ((seqTypeData.getSequenceType() == SequenceTypeSupport.XS_UNSIGNED_LONG) || 
+                                                        (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {
+          isInstanceOf = true;
+      }
+      else if ((xdmValue instanceof XSUnsignedInt) && ((seqTypeData.getSequenceType() == SequenceTypeSupport.XS_UNSIGNED_INT) || 
+                                                       (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {
+          isInstanceOf = true;
+      }
+      else if ((xdmValue instanceof XSUnsignedShort) && ((seqTypeData.getSequenceType() == SequenceTypeSupport.XS_UNSIGNED_SHORT) || 
+                                                         (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {
+          isInstanceOf = true;
+      }
+      else if ((xdmValue instanceof XSUnsignedByte) && ((seqTypeData.getSequenceType() == SequenceTypeSupport.XS_UNSIGNED_BYTE) || 
+                                                        (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {
+          isInstanceOf = true;
+      }
       else if (((xdmValue instanceof XSNonNegativeInteger) || (xdmValue instanceof XSPositiveInteger)) && 
     		                                                   ((seqTypeData.getSequenceType() == SequenceTypeSupport.XS_NON_NEGATIVE_INTEGER) || 
                                                                 (seqTypeData.getSequenceType() == SequenceTypeSupport.XS_ANY_ATOMIC_TYPE))) {    	  
diff --git a/src/org/apache/xpath/types/XSShort.java b/src/org/apache/xpath/types/XSByte.java
similarity index 68%
copy from src/org/apache/xpath/types/XSShort.java
copy to src/org/apache/xpath/types/XSByte.java
index b9a5f4c1d..0dc9bea74 100644
--- a/src/org/apache/xpath/types/XSShort.java
+++ b/src/org/apache/xpath/types/XSByte.java
@@ -21,57 +21,53 @@ import java.math.BigInteger;
 import javax.xml.transform.TransformerException;
 
 import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.composite.SequenceTypeSupport.XmlSchemaBuiltinNumericType;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XObject;
 
 import xml.xpath31.processor.types.XSDouble;
-import xml.xpath31.processor.types.XSInt;
 import xml.xpath31.processor.types.XSNumericType;
 
 /**
- * Implementation of XML Schema data type xs:short.
+ * Implementation of XML Schema data type xs:byte.
  * 
  * @author : Mukul Gandhi <mu...@apache.org>
  */
-public class XSShort extends XSInt {
+public class XSByte extends XSShort {
 
-	private static final long serialVersionUID = -4155842894636269334L;
-	
-	private static final int MIN_INCLUSIVE = -32768;
-	
-	private static final int MAX_INCLUSIVE = 32767;
+	private static final long serialVersionUID = 6792786954418596442L;
 
 	/**
 	 * Class constructor.
 	 */
-	public XSShort() {
+	public XSByte() {
 	   // NO OP	
 	}
 	
 	/**
 	 * Class constructor.
 	 */
-	public XSShort(BigInteger val) throws TransformerException {
+	public XSByte(BigInteger val) throws TransformerException {
 	   super(val);
-	   int cmprResult1 = val.compareTo(BigInteger.valueOf(MIN_INCLUSIVE));
-	   int cmprResult2 = val.compareTo(BigInteger.valueOf(MAX_INCLUSIVE));
+	   int cmprResult1 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Byte.MIN_INCLUSIVE));
+	   int cmprResult2 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Byte.MAX_INCLUSIVE));
 	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
-		  throw new TransformerException("FOCA0003 : An xs:short value's numeric range is [" + MIN_INCLUSIVE + 
-				                                                     ", " + MAX_INCLUSIVE + "] with both inclusive.");  
+		  throw new TransformerException("FOCA0003 : An xs:byte value's numeric range is [" + XmlSchemaBuiltinNumericType.Byte.MIN_INCLUSIVE + 
+				                                              ", " + XmlSchemaBuiltinNumericType.Byte.MAX_INCLUSIVE + "] with both inclusive.");  
 	   }			   	
 	}
 	
 	/**
 	 * Class constructor.
 	 */
-	public XSShort(String val) throws TransformerException {
+	public XSByte(String val) throws TransformerException {
 	   super(val);
 	   BigInteger bigInt = (getValue()).toBigInteger(); 
-	   int cmprResult1 = bigInt.compareTo(BigInteger.valueOf(MIN_INCLUSIVE));
-	   int cmprResult2 = bigInt.compareTo(BigInteger.valueOf(MAX_INCLUSIVE));
+	   int cmprResult1 = bigInt.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Byte.MIN_INCLUSIVE));
+	   int cmprResult2 = bigInt.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Byte.MAX_INCLUSIVE));
 	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
-		  throw new TransformerException("FOCA0003 : An xs:short value's numeric range is [" + MIN_INCLUSIVE + 
-				                                                     ", " + MAX_INCLUSIVE + "] with both inclusive.");  
+		  throw new TransformerException("FOCA0003 : An xs:byte value's numeric range is [" + XmlSchemaBuiltinNumericType.Byte.MIN_INCLUSIVE + 
+				                                              ", " + XmlSchemaBuiltinNumericType.Byte.MAX_INCLUSIVE + "] with both inclusive.");  
 	   }
 	}
 	
@@ -81,8 +77,8 @@ public class XSShort extends XSInt {
 		XObject xObj = seq.item(0);
 		String strVal = XslTransformEvaluationHelper.getStrVal(xObj);
 		try {
-			XSShort xsShort = new XSShort(strVal);
-			result.add(xsShort);
+			XSByte xsByte = new XSByte(strVal);
+			result.add(xsByte);
 		} catch (TransformerException ex) {
 			// NO OP
 		}
@@ -132,7 +128,7 @@ public class XSShort extends XSInt {
 	}
 		
     public int getType() {
-		return CLASS_SHORT;
+		return CLASS_BYTE;
 	}
 		
     /**
diff --git a/src/org/apache/xpath/types/XSShort.java b/src/org/apache/xpath/types/XSShort.java
index b9a5f4c1d..8b7061515 100644
--- a/src/org/apache/xpath/types/XSShort.java
+++ b/src/org/apache/xpath/types/XSShort.java
@@ -21,6 +21,7 @@ import java.math.BigInteger;
 import javax.xml.transform.TransformerException;
 
 import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.composite.SequenceTypeSupport.XmlSchemaBuiltinNumericType;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XObject;
 
@@ -36,10 +37,6 @@ import xml.xpath31.processor.types.XSNumericType;
 public class XSShort extends XSInt {
 
 	private static final long serialVersionUID = -4155842894636269334L;
-	
-	private static final int MIN_INCLUSIVE = -32768;
-	
-	private static final int MAX_INCLUSIVE = 32767;
 
 	/**
 	 * Class constructor.
@@ -53,11 +50,11 @@ public class XSShort extends XSInt {
 	 */
 	public XSShort(BigInteger val) throws TransformerException {
 	   super(val);
-	   int cmprResult1 = val.compareTo(BigInteger.valueOf(MIN_INCLUSIVE));
-	   int cmprResult2 = val.compareTo(BigInteger.valueOf(MAX_INCLUSIVE));
+	   int cmprResult1 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Long.MIN_INCLUSIVE));
+	   int cmprResult2 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Long.MAX_INCLUSIVE));
 	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
-		  throw new TransformerException("FOCA0003 : An xs:short value's numeric range is [" + MIN_INCLUSIVE + 
-				                                                     ", " + MAX_INCLUSIVE + "] with both inclusive.");  
+		  throw new TransformerException("FOCA0003 : An xs:short value's numeric range is [" + XmlSchemaBuiltinNumericType.Long.MIN_INCLUSIVE + 
+				                                              ", " + XmlSchemaBuiltinNumericType.Long.MAX_INCLUSIVE + "] with both inclusive.");  
 	   }			   	
 	}
 	
@@ -67,11 +64,11 @@ public class XSShort extends XSInt {
 	public XSShort(String val) throws TransformerException {
 	   super(val);
 	   BigInteger bigInt = (getValue()).toBigInteger(); 
-	   int cmprResult1 = bigInt.compareTo(BigInteger.valueOf(MIN_INCLUSIVE));
-	   int cmprResult2 = bigInt.compareTo(BigInteger.valueOf(MAX_INCLUSIVE));
+	   int cmprResult1 = bigInt.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Long.MIN_INCLUSIVE));
+	   int cmprResult2 = bigInt.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.Long.MAX_INCLUSIVE));
 	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
-		  throw new TransformerException("FOCA0003 : An xs:short value's numeric range is [" + MIN_INCLUSIVE + 
-				                                                     ", " + MAX_INCLUSIVE + "] with both inclusive.");  
+		  throw new TransformerException("FOCA0003 : An xs:short value's numeric range is [" + XmlSchemaBuiltinNumericType.Long.MIN_INCLUSIVE + 
+				                                              ", " + XmlSchemaBuiltinNumericType.Long.MAX_INCLUSIVE + "] with both inclusive.");  
 	   }
 	}
 	
diff --git a/src/org/apache/xpath/types/XSUnsignedByte.java b/src/org/apache/xpath/types/XSUnsignedByte.java
new file mode 100644
index 000000000..e02126b7f
--- /dev/null
+++ b/src/org/apache/xpath/types/XSUnsignedByte.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xpath.types;
+
+import java.math.BigInteger;
+
+import javax.xml.transform.TransformerException;
+
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.composite.SequenceTypeSupport.XmlSchemaBuiltinNumericType;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of XML Schema data type xs:unsignedByte.
+ * 
+ * @author : Mukul Gandhi <mu...@apache.org>
+ */
+public class XSUnsignedByte extends XSUnsignedShort {
+
+	private static final long serialVersionUID = 1353695667026655427L;
+
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedByte() {
+	   // NO OP	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedByte(BigInteger val) throws TransformerException {
+	   super(val);
+	   int cmprResult1 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedByte.MIN_INCLUSIVE));
+	   int cmprResult2 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedByte.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedByte value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedByte.MIN_INCLUSIVE + 
+				                                                   ", " + XmlSchemaBuiltinNumericType.UnsignedByte.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }			   	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedByte(String val) throws TransformerException {
+	   super(val);
+	   BigInteger bigIntArg = new BigInteger(val);
+	   int cmprResult1 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedByte.MIN_INCLUSIVE));
+	   int cmprResult2 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedByte.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedByte value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedByte.MIN_INCLUSIVE + 
+				                                                   ", " + XmlSchemaBuiltinNumericType.UnsignedByte.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }
+	}
+	
+	public ResultSequence constructor(ResultSequence seq) {
+		ResultSequence result = new ResultSequence();
+		
+		XObject xObj = seq.item(0);
+		String strVal = XslTransformEvaluationHelper.getStrVal(xObj);
+		try {
+			XSUnsignedByte xsUnsignedByte = new XSUnsignedByte(strVal);
+			result.add(xsUnsignedByte);
+		} catch (TransformerException ex) {
+			// NO OP
+		}
+		
+		return result;
+	}	
+	
+	public int getType() {
+	   return CLASS_UNSIGNED_BYTE;
+	}
+
+}
diff --git a/src/org/apache/xpath/types/XSUnsignedInt.java b/src/org/apache/xpath/types/XSUnsignedInt.java
new file mode 100644
index 000000000..9c1c4bcf4
--- /dev/null
+++ b/src/org/apache/xpath/types/XSUnsignedInt.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xpath.types;
+
+import java.math.BigInteger;
+
+import javax.xml.transform.TransformerException;
+
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.composite.SequenceTypeSupport.XmlSchemaBuiltinNumericType;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of XML Schema data type xs:unsignedInt.
+ * 
+ * @author : Mukul Gandhi <mu...@apache.org>
+ */
+public class XSUnsignedInt extends XSUnsignedLong {
+
+	private static final long serialVersionUID = -5195115298409745404L;
+
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedInt() {
+	   // NO OP	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedInt(BigInteger val) throws TransformerException {
+	   super(val);
+	   int cmprResult1 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedInt.MIN_INCLUSIVE));
+	   int cmprResult2 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedInt.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedInt value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedInt.MIN_INCLUSIVE + 
+				                                                   ", " + XmlSchemaBuiltinNumericType.UnsignedInt.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }			   	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedInt(String val) throws TransformerException {
+	   super(val);
+	   BigInteger bigIntArg = new BigInteger(val);
+	   int cmprResult1 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedInt.MIN_INCLUSIVE));
+	   int cmprResult2 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedInt.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedInt value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedInt.MIN_INCLUSIVE + 
+					                                              ", " + XmlSchemaBuiltinNumericType.UnsignedInt.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }
+	}
+	
+	public ResultSequence constructor(ResultSequence seq) {
+		ResultSequence result = new ResultSequence();
+		
+		XObject xObj = seq.item(0);
+		String strVal = XslTransformEvaluationHelper.getStrVal(xObj);
+		try {
+			XSUnsignedInt xsUnsignedInt = new XSUnsignedInt(strVal);
+			result.add(xsUnsignedInt);
+		} catch (TransformerException ex) {
+			// NO OP
+		}
+		
+		return result;
+	}	
+	
+	public int getType() {
+	   return CLASS_UNSIGNED_INT;
+	}
+
+}
diff --git a/src/org/apache/xpath/types/XSUnsignedLong.java b/src/org/apache/xpath/types/XSUnsignedLong.java
new file mode 100644
index 000000000..7ece83317
--- /dev/null
+++ b/src/org/apache/xpath/types/XSUnsignedLong.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xpath.types;
+
+import java.math.BigInteger;
+
+import javax.xml.transform.TransformerException;
+
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.composite.SequenceTypeSupport.XmlSchemaBuiltinNumericType;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of XML Schema data type xs:unsignedLong.
+ * 
+ * @author : Mukul Gandhi <mu...@apache.org>
+ */
+public class XSUnsignedLong extends XSNonNegativeInteger {
+
+	private static final long serialVersionUID = 6358619822263001513L;
+
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedLong() {
+	   // NO OP	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedLong(BigInteger val) throws TransformerException {
+	   super(val);
+	   int cmprResult1 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedLong.MIN_INCLUSIVE));
+	   int cmprResult2 = val.compareTo(new BigInteger(XmlSchemaBuiltinNumericType.UnsignedLong.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedLong value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedLong.MIN_INCLUSIVE + 
+				                                              ", " + XmlSchemaBuiltinNumericType.UnsignedLong.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }			   	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedLong(String val) throws TransformerException {
+	   super(val);
+	   BigInteger bigIntArg = new BigInteger(val);
+	   int cmprResult1 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedLong.MIN_INCLUSIVE));
+	   int cmprResult2 = bigIntArg.compareTo(new BigInteger(XmlSchemaBuiltinNumericType.UnsignedLong.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedLong value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedLong.MIN_INCLUSIVE + 
+				                                              ", " + XmlSchemaBuiltinNumericType.UnsignedLong.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }
+	}
+	
+	public ResultSequence constructor(ResultSequence seq) {
+		ResultSequence result = new ResultSequence();
+		
+		XObject xObj = seq.item(0);
+		String strVal = XslTransformEvaluationHelper.getStrVal(xObj);
+		try {
+			XSUnsignedLong xsUnsignedLong = new XSUnsignedLong(strVal);
+			result.add(xsUnsignedLong);
+		} catch (TransformerException ex) {
+			// NO OP
+		}
+		
+		return result;
+	}	
+	
+	public int getType() {
+	   return CLASS_UNSIGNED_LONG;
+	}
+
+}
diff --git a/src/org/apache/xpath/types/XSUnsignedShort.java b/src/org/apache/xpath/types/XSUnsignedShort.java
new file mode 100644
index 000000000..274cffa1e
--- /dev/null
+++ b/src/org/apache/xpath/types/XSUnsignedShort.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xpath.types;
+
+import java.math.BigInteger;
+
+import javax.xml.transform.TransformerException;
+
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.composite.SequenceTypeSupport.XmlSchemaBuiltinNumericType;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of XML Schema data type xs:unsignedShort.
+ * 
+ * @author : Mukul Gandhi <mu...@apache.org>
+ */
+public class XSUnsignedShort extends XSUnsignedInt {
+
+	private static final long serialVersionUID = -1213732758642714754L;
+
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedShort() {
+	   // NO OP	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedShort(BigInteger val) throws TransformerException {
+	   super(val);
+	   int cmprResult1 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedShort.MIN_INCLUSIVE));
+	   int cmprResult2 = val.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedShort.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedShort value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedShort.MIN_INCLUSIVE + 
+				                                                   ", " + XmlSchemaBuiltinNumericType.UnsignedShort.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }			   	
+	}
+	
+	/**
+	 * Class constructor.
+	 */
+	public XSUnsignedShort(String val) throws TransformerException {
+	   super(val);
+	   BigInteger bigIntArg = new BigInteger(val);
+	   int cmprResult1 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedShort.MIN_INCLUSIVE));
+	   int cmprResult2 = bigIntArg.compareTo(BigInteger.valueOf(XmlSchemaBuiltinNumericType.UnsignedShort.MAX_INCLUSIVE));
+	   if ((cmprResult1 == -1) || (cmprResult2 == 1)) {
+		  throw new TransformerException("FOCA0003 : An xs:unsignedShort value's numeric range is [" + XmlSchemaBuiltinNumericType.UnsignedShort.MIN_INCLUSIVE + 
+				                                                   ", " + XmlSchemaBuiltinNumericType.UnsignedShort.MAX_INCLUSIVE + "] with both inclusive.");  
+	   }
+	}
+	
+	public ResultSequence constructor(ResultSequence seq) {
+		ResultSequence result = new ResultSequence();
+		
+		XObject xObj = seq.item(0);
+		String strVal = XslTransformEvaluationHelper.getStrVal(xObj);
+		try {
+			XSUnsignedShort xsUnsignedShort = new XSUnsignedShort(strVal);
+			result.add(xsUnsignedShort);
+		} catch (TransformerException ex) {
+			// NO OP
+		}
+		
+		return result;
+	}	
+	
+	public int getType() {
+	   return CLASS_UNSIGNED_SHORT;
+	}
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org