posted on Friday, August 13, 2004 12:20 PM by anoras

XmlSerializer.js - Source Code

XmlSerializer=function() {
 /// @Version("1.1.0.1")
 /// @Dependency("Reflection.js")
 /// @Dependency("Annotation.js")
 /// @Modifiers(Modifier.public)
 /// @MethodDocumentation(description="Handles serialization of object to and from XML format")
 /// @Returns(type="XmlSerializer");
 Reflection; // <-- Causes undefined error if Reflection library is not included.
}
XmlSerializer.prototype._document=null;
XmlSerializer.prototype.maxDepth=-1;
XmlSerializer.prototype.exclusionList=[window,window.document];
XmlSerializer.prototype.serializePrivateMembers=false;
XmlSerializer.prototype.evaluteGetters=true;
XmlSerializer.prototype.namespaceUri="http://tempuri.org/";
XmlSerializer.prototype._recursedNodes=[];
XmlSerializer.W3C_XML_SCHEMA_2001_URI="http://www.w3.org/2001/XMLSchema";
XmlSerializer.W3C_XML_SCHEMA_INSTANCE_2001="http://www.w3.org/2001/XMLSchema-instance";
XmlSerializer.XMLSOAP_WSDL_URI="http://schemas.xmlsoap.org/wsdl/";
XmlSerializer.XMLSOAP_WSDL_HTTP_URI="http://schemas.xmlsoap.org/wsdl/http/";
XmlSerializer.XMLSOAP_WSDL_SOAP_URI="http://schemas.xmlsoap.org/wsdl/soap/";
XmlSerializer.XMLSOAP_SOAP_URI="http://schemas.xmlsoap.org/soap/encoding/";
XmlSerializer._getTypesInArray=function(array) {
 /// @Modifiers(modifiers=Modifier.static|Modifier.private)
 /// @MethodDocumentation(description="Gets the types of the objects in the specified array.")
 /// @ParameterDocumentation(name="array",type="object[]",description="An array of objects whose types to determine.",required=true)
 /// @Returns(type="string[]",description="An array of strings representing the typenames of the corresponding elements in <I>array</I>.");
 /// @Throws(error="NullArgumentError",condition="<I>array</I> is <B>null</B>.")
 try {
  if (array==null) throw new NullArgumentError("array");
  var retArr=[];
  for (var i=0;i<array.length;i++) {
   var exists=false;
   var an=Reflection.getNamedAnnotation(array[i].constructor,"XmlArrayItem");
   if (an!=null) var type=an.itemName;
   else var type=typeof(array[i]);
   for (var j=0;j<retArr.length;j++) {
    if (type==retArr[j]) {
     exists=true;
     break;
    }
   }
   if (!exists) retArr[retArr.length]=type;
  }
  return retArr;
 } catch (err) {
  try { debug(err.message+" occured in XmlSerializer._getTypesInArray. (Throwing exception)"); } catch (iErr) { }
  throw(err);
 }
}
XmlSerializer.getSchemaTypename=function(obj) {
 /// @Modifiers(modifiers=Modifier.static|Modifier.public)
 /// @MethodDocumentation(description="Gets xml schema typename for a javascript object.")
 /// @ParameterDocumentation(name="obj",type="object",description="The object whose xml schema type to determine.",required=true)
 /// @Returns(type="string",description="The xml schema typename for the object.");
 /// @Throws(error="NullArgumentError",condition="<I>obj</I> is <B>null</B>.")
 try {
  if (obj==null) throw new NullArgumentError("obj");
  switch (Reflection.identifyObjectSignature(obj)) {
   case WellKnownSignature.date:return "dateTime";
   case WellKnownSignature.string:return "string";
   case WellKnownSignature.number:
    if (Math.round(obj)==obj) return "int";
    else return "double";
   case WellKnownSignature.boolean:return "boolean";
   case WellKnownSignature.object:return Reflection.getMethodName(obj.constructor);
   default:return "anyType";
  }
 } catch (err) {
  try { debug(err.message+" occured in XmlSerializer.getSchemaTypename. (Throwing exception)"); } catch (iErr) { }
  throw(err);
 }
}
XmlSerializer._getNamespacePrefix=function(qName) {
 return qName.substr(0,qName.indexOf(':'));
}
XmlSerializer._getNamespaceLocalName=function(qName) {
 return qName.substr(qName.indexOf(':')+1);
}
XmlSerializer.getNamespaceString=function() {
 /// @Modifiers(modifiers=Modifier.static|Modifier.public)
 /// @MethodDocumentation(description="Gets a local or qualified namespace attribute.")
 /// @ParameterDocumentation(name="prefix",type="string",description="The prefix of a qualified name for the namespace..",required=false)
 /// @ParameterDocumentation(name="localname",type="string",description="The localname for the namespace.",required=true)
 /// @ParameterDocumentation(name="uri",type="string",description="The uri for the namespace.",required=true)
 /// @Returns(type="string",description="The xml attribute string.");
 /// @Throws(error="IllegalArgumentError",condition="An illegal number of arguments have been passed.")
 if (arguments.length==3) {
  return arguments[0]+':'+arguments[1]+"=\""+arguments[2]+"\"";
 } else if (arguments.length==2) {
  return arguments[0]+"=\""+arguments[1]+"\"";
 } else throw new IllegalArgumentError("Allowed arguments are (prefix), localname, uri.");
}
XmlSerializer.prototype.serialize=function(obj,maxDepth,serializePrivateMembers,evaluateGetters,exclusionList) {
 /// @Modifiers(Modifier.public)
 /// @MethodDocumentation(description="Serializes an object to XML")
 /// @ParameterDocumentation(name="obj",type="object",description="The object to serialize",required=true)
 /// @ParameterDocumentation(name="maxDepth",type="number",description="The maximum number of child nodes to follow. Use -1 for unlimited.",required=false)
 /// @ParameterDocumentation(name="serializePrivateMembers",type="bool",description="Boolean value indicating whether members marked starting with <B>_</B> or having <B>private</B> as a part of the name.",required=false)
 /// @ParameterDocumentation(name="evaluateGetters",type="bool",description="Getter methods should be called. If set to true all methods starting with get will be called.",required=false)
 /// @ParameterDocumentation(name="exclusionList",type="object[]",description="An array of object references to exclude from serialization. By default <B>window</B> and <B>doucment</B> are excluded.",required=false)
 /// @Throws(error="SerializationError",condition="The seralization failed.");
 if (obj==null) throw new NullArgumentError("obj");
 if (maxDepth!=null&&maxDepth>=-1) this.maxDepth=maxDepth;
 if (serializePrivateMembers!=null) this.serializePrivateMembers=serializePrivateMembers;
 if (evaluateGetters!=null) this.evaluateGetters=evaluateGetters;
 if (exclusionList!=null) this.exclusionList=exclusionList;
 if (this._document!=null) {
  delete(this._document);
  this._document=null;
 }
 this._document=new ActiveXObject("Msxml2.DOMDocument.3.0");
 this._document.async=false;
 this._objectToSerialize=null;
 this._recursedNodes=[];
 var oName=Reflection.getClassName(obj);
 if (oName=="Array") {
  var tsInArr=XmlSerializer._getTypesInArray(obj);
  if (tsInArr.length==1) oName="ArrayOf"+tsInArr[0];
 }
 if (this._document.loadXML('<'+oName+' '+XmlSerializer.getNamespaceString("xmlns","xsd",XmlSerializer.W3C_XML_SCHEMA_2001_URI)+' '+XmlSerializer.getNamespaceString("xmlns","xsi",XmlSerializer.W3C_XML_SCHEMA_INSTANCE_2001)+' '+XmlSerializer.getNamespaceString("xmlns",this.namespaceUri)+'>'+this._serializeToString(obj)+"</"+oName+'>')) return this._document;
 else throw new SerializationError();
}
XmlSerializer.prototype._serializeToString=function(obj) {
 /// @Version("1.0.0.1")
 /// @Modifiers(Modifier.private)
 if (obj==XmlSerializer) throw new Error("The XmlSerializer class cannot be serialize itself.");
 if (typeof(obj.onSerializing)=="function") obj.onSerializing();
 var ret="",level=1;
 if (arguments.length>1&&typeof(arguments[1])=="number") level=arguments[1];
 else this._objectToSerialize=obj;
 if (this.maxDepth!=-1&&level>this.maxDepth) return '';
 if (obj==null) return '';
 switch (Reflection.identifyObjectSignature(obj)) {
  case WellKnownSignature.customFunction :
   if (this.evaluteGetters) return this._serializeToString(obj(),level+1);
   return "";
  case WellKnownSignature.string:return Convert.toXmlEncodedString(obj);
  case WellKnownSignature.boolean:case WellKnownSignature.number:return obj.toString();
  case WellKnownSignature.array:
   try {
    var typesInArr=XmlSerializer._getTypesInArray(obj);
    if (typesInArr.length>1) {
     for (var elm in obj) {
      ret+="<anyType xsi:type=\""+XmlSerializer.getSchemaTypename(obj[elm])+"\">"
      if (typeof(obj[elm])=="object") {
       var oName=Reflection.getMethodName(obj[elm].constructor);
       ret+='<'+oName+'>';
       ret+=this._serializeToString(obj[elm],level+1);
       ret+="</"+oName+'>';
      } else ret+=this._serializeToString(obj[elm],level+1);
      ret+="</anyType>";
     }
    } else for (var elm in obj) ret+='<'+typesInArr[0]+'>'+this._serializeToString(obj[elm],level+1)+"</"+typesInArr[0]+'>';
    return ret;
   } catch (err) {
    throw(err);
   }
  case WellKnownSignature.date:return Convert.toXmlDateTime(obj);
  case WellKnownSignature.enumerator:return "";
  case WellKnownSignature.object:
  default:
   // OBJECT
   for (var itm in obj) {
    var procNode=this._processNode(itm,obj);
    if (procNode) procNode=!isFinite(parseInt(itm));
    if (procNode) {
    // TODO: Fix this bug: Cyclic references get detected when siblings have the same member with the same value. 
    // if (!this._hasCyclicReference(obj[itm])) {
      this._addToRecursionLog(obj[itm]);
      var nodeVal=this._serializeToString(obj[itm],level+1);
      if (nodeVal.length>0) ret+='<'+itm+'>'+nodeVal+"</"+itm+'>';
      else ret+='<'+itm+"/>";
    /* } else {
      ret+='<'+itm+"><!-- Cyclic reference detected! --></"+itm+'>';
     } */
    }
   }
   break;
  }
  if (typeof(obj.onSerialized)=="function") obj.onSerialized();
  return ret;
}
XmlSerializer.prototype._addToRecursionLog=function(obj) {
 /// @Version("1.0.0.1")
 /// @Modifiers(Modifier.private)
 if (typeof(obj)=="object") this._recursedNodes[this._recursedNodes.length]=obj;
}
XmlSerializer.prototype._hasCyclicReference=function(obj) {
 /// @Version("1.0.0.1");
 /// @Modifiers(Modifier.private)
 for (var i=this._recursedNodes.length-1;i>=0;i--) {
  try {
   if (obj==this._recursedNodes[i]) return true;
  } catch (e) {
   return false;
  }
 }
 return false;
}
XmlSerializer.COPY_OF_PREFIX="_____COPY_OF_";
XmlSerializer.prototype._processNode=function(name,obj) {
 /// @Version("1.0.0.1")
 /// @Modifiers(Modifier.private)
 if (name.substr(0,XmlSerializer.COPY_OF_PREFIX.length)==XmlSerializer.COPY_OF_PREFIX) return false;
 if (typeof(obj[name])=="function") return (!this._excludeObject(obj)&&!this._excludePrivateMember(name)&&!this._excludeFunction(name));
 else return !this._excludeObject(obj)&&!this._excludePrivateMember(name);
 
}
XmlSerializer.prototype._excludeFunction=function(name) {
 /// @Version("1.0.0.1")
 /// @Modifiers(Modifier.private)
 return this.evaluteGetters&&(name.toLowerCase().indexOf("get")!=0);
}
XmlSerializer.prototype._excludePrivateMember=function(name) {
 /// @Version("1.0.0.1")
 /// @Modifiers(Modifier.private)
 return this.serializePrivateMembers&&(name.indexOf('_')==0||name.toLowerCase().indexOf("private")==0);
}
XmlSerializer.prototype._excludeObject=function(obj) {
 /// @Version("1.0.0.2")
 /// @Modifiers(Modifier.private)
 if (this.exclusionList==null||this.exclusionList.length==0) return false;
 for (var i=this.exclusionList.length-1;i>=0;i--) if (this.exclusionList[i]==obj) return true;
 return false;
}
XmlSerializer._getWellknownQnames=function(document) {
 var retArr=[];
 var as=document.documentElement.attributes;
 for (var i=as.length-1; i>=0; i--) {
  switch (as[i].nodeValue) {
   case XmlSerializer.W3C_XML_SCHEMA_2001_URI :
    retArr[XmlSerializer.W3C_XML_SCHEMA_2001_URI]=as[i].nodeName;
   break;
   case XmlSerializer.W3C_XML_SCHEMA_INSTANCE_2001 :
    retArr[XmlSerializer.W3C_XML_SCHEMA_INSTANCE_2001]=as[i].nodeName;
   break;
   case XmlSerializer.XMLSOAP_WSDL_URI :
    retArr[XmlSerializer.XMLSOAP_WSDL_URI]=as[i].nodeName;
   break;
   case XmlSerializer.XMLSOAP_WSDL_HTTP_URI :
    retArr[XmlSerializer.XMLSOAP_WSDL_HTTP_URI]=as[i].nodeName;
   break;
   case XmlSerializer.XMLSOAP_WSDL_SOAP_URI :
    retArr[XmlSerializer.XMLSOAP_WSDL_SOAP_URI]=as[i].nodeName;
   break;
   case XmlSerializer.XMLSOAP_SOAP_URI :
    retArr[XmlSerializer.XMLSOAP_SOAP_URI]=as[i].nodeName;
   break;
   case XmlSerializer._deserializingDocTargetSchemaUri :
    retArr[XmlSerializer._deserializingDocTargetSchemaUri]=as[i].nodeName;
   break;
  }
 }
 return retArr;
}
XmlSerializer._getTargetNamespaceUri=function(doc) {
 return doc.documentElement.attributes.getNamedItem("xmlns").nodeValue;
}
XmlSerializer._getSchemaSLocNm=function() {
 if (XmlSerializer._getSchemaSLocNm._cachedValue==null) {
  XmlSerializer._getSchemaSLocNm._cachedValue=XmlSerializer._getNamespaceLocalName(XmlSerializer._deserializingSchemaQnames[XmlSerializer.W3C_XML_SCHEMA_2001_URI]);
 }
 return XmlSerializer._getSchemaSLocNm._cachedValue;
}
XmlSerializer._getSchemaSLocNm._cachedValue=null;
XmlSerializer._getDocXsiLocNm=function() {
 if (XmlSerializer._getDocXsiLocNm._cachedValue==null) {
  XmlSerializer._getDocXsiLocNm._cachedValue=XmlSerializer._getNamespaceLocalName(XmlSerializer._deserializingDocQnames[XmlSerializer.W3C_XML_SCHEMA_INSTANCE_2001]);
 }
 return XmlSerializer._getDocXsiLocNm._cachedValue;
}
XmlSerializer._getDocXsiLocNm._cachedValue=null;
XmlSerializer._deserializingDocQnames=[];
XmlSerializer._deserializingDocTargetSchemaUri=null;
XmlSerializer._deserializingSchemaQnames=[];
XmlSerializer.prototype._docToDeserialize=null;
XmlSerializer.prototype._docToDeserializeQnms=[];
XmlSerializer.prototype._schemaForDeserialization=null;
XmlSerializer.prototype._schemaForDeserializationQnms=null;
XmlSerializer.prototype._s=null;
XmlSerializer.prototype.deserialize=function(document,schema) {
 // @Version("2.1.0.1");
 if (schema.documentElement.attributes.getNamedItem("targetNamespace").nodeValue!=document.documentElement.attributes.getNamedItem("xmlns").nodeValue) throw new SerializationError("Deserialization failed. Document namespace (\""+document.documentElement.attributes.getNamedItem("xmlns").nodeValue+"\") does not match the schema's target (\""+schema.documentElement.attributes.getNamedItem("targetNamespace").nodeValue+"\").");
 this._docToDeserialize=document;
 this._schemaForDeserialization=schema;
 this._cache();
 this._extendSchema();
 return this._buildFromSchema(this._docToDeserialize.documentElement,this._schemaForDeserialization.selectSingleNode("//"+this._s+":complexType[@name=\""+this._docToDeserialize.documentElement.nodeName+"\"]"));
}
XmlSerializer.prototype._cache=function() {
 // @Version("1.0.0.1");
 this._docToDeserializeQnms=XmlSerializer._getWellknownQnames(this._docToDeserialize);
 this._schemaForDeserializationQnms=XmlSerializer._getWellknownQnames(this._schemaForDeserialization);
 this._s=XmlSerializer._getNamespaceLocalName(this._schemaForDeserializationQnms[XmlSerializer.W3C_XML_SCHEMA_2001_URI]);
}
XmlSerializer.prototype._extendSchema=function() {
 try {
  var extCplxTps=this._schemaForDeserialization.documentElement.selectNodes("/definitions/types/"+this._s+":schema/s:complexType[./"+this._s+":complexContent/"+this._s+":extension]");
  for (var i=0; i<extCplxTps.length;i++) {
   var elms=extCplxTps[i].cloneNode(true).selectNodes(this._s+":complexContent/"+this._s+":extension/"+this._s+":sequence/"+this._s+":element");
   var baseSeq=this._schemaForDeserialization.documentElement.selectSingleNode("/definitions/types/"+this._s+":schema/s:complexType[@name=\""+XmlSerializer._getNamespaceLocalName(extCplxTps[i].selectSingleNode(this._s+":complexContent/"+this._s+":extension/@base").nodeValue)+"\"]/"+this._s+":sequence");
   extCplxTps[i].removeChild(extCplxTps[i].firstChild);
   extCplxTps[i].appendChild(baseSeq.cloneNode(true));
   for (var j=0; j<elms.length; j++) extCplxTps[i].firstChild.appendChild(elms[j].cloneNode(false));
  }
 } catch (err) {
  try { debug(err.message+" occured in XmlSerializer._extendSchema. (Throwing exception)"); } catch (iErr) { }
  throw(err);
 }
}
XmlSerializer.prototype._buildFromSchema=function(node,schemaFragment) {
 if (XmlSerializer._getNamespaceLocalName(schemaFragment.firstChild.nodeName)!="sequence") throw new SerializationError("Unsupported schema element ("+XmlSerializer._getNamespaceLocalName(schemaFragment.firstChild.nodeName)+").");
 var elms=schemaFragment.selectNodes(this._s+":sequence/"+this._s+":element");
 var tgt=null;
 if (elms.length==1&&elms[0].attributes.getNamedItem("maxOccurs").nodeValue.toLowerCase()=="unbounded") {
  // ARRAY
  try {
   if (node==null) {
    tgt=[];
   } else tgt=this._bldArr(node,schemaFragment);
  } catch (err) {
   try { debug(err.description+" occured while  creating array in XmlSerializer._buildFromSchema."); } catch (iErr) { }
  }
 } else {
  if (eval("typeof("+node.nodeName+")")=="function") {
   tgt=eval("new "+node.nodeName+"()");
  } else {
   // TODO: Add explict type check
   tgt=new Object();
  }
  for (var i=0; i<elms.length; i++) {
   var mname=elms[i].attributes.getNamedItem("name").nodeValue;
   var type=elms[i].attributes.getNamedItem("type").nodeValue;
   var minOccurs=elms[i].attributes.getNamedItem("minOccurs").nodeValue;
   var maxOccurs=elms[i].attributes.getNamedItem("maxOccurs").nodeValue;
   var valNode=node.selectSingleNode(mname);
   if (type.substring(0,type.indexOf(':'))==this._s) {
    // Simple type
    try {
     if (node.selectSingleNode(mname)!=null) {
      var val=Convert.fromSchemaType(node.selectSingleNode(mname).text,type);
      if (typeof(tgt["set"+mname.substr(0,1).toUpperCase()+mname.substr(1)])=="function") eval("tgt.set"+mname.substr(0,1).toUpperCase()+mname.substr(1)+"(Convert.fromSchemaType(val,type));");
      else tgt[mname]=Convert.fromSchemaType(val,type);
     } else if (minOccurs>0) throw new MissingElementError(mname);
    } catch (err) {
     try { debug(err.message+" occured while handling simple type in XmlSerializer._buildFromSchema. (Throwing exception)"); } catch (iErr) { }
     throw(err);
    }
   } else {
    var tSchFrg=schemaFragment.ownerDocument.documentElement.selectSingleNode("/definitions/types/"+this._s+":schema/s:complexType[@name=\""+XmlSerializer._getNamespaceLocalName(type)+"\"]");
    if (tSchFrg!=null) {
     try {
      if (typeof(tgt["set"+mname.substr(0,1).toUpperCase()+mname.substr(1)])=="function") {
       var setterFn=tgt["set"+mname.substr(0,1).toUpperCase()+mname.substr(1)];
       setterFn(this._buildFromSchema(valNode,tSchFrg));
      } else tgt[mname]=this._buildFromSchema(valNode,tSchFrg);
     } catch (err) {
      tgt[mname]=this._buildFromSchema(valNode,tSchFrg);
     }
    } else {
     // Check for enum
     var val=node.selectSingleNode(mname).text;
     try {
      if (eval("typeof("+XmlSerializer._getNamespaceLocalName(type)+')')!="object") throw new MissingClassError(mname,null,"enum");
      else {
       var en=eval(XmlSerializer._getNamespaceLocalName(type));
       for (var enval in en) {
        if (enval==val) {
         // TODO: Check for setter
         tgt[mname]=en[enval];
         break;
        }
       }
      }
     } catch (err) {
      try { debug(err.message+" occured while handling enum in XmlSerializer._buildFromSchema."); } catch (iErr) { }
     }
    }    
   }
  }
 } 
 return tgt;
}
XmlSerializer.prototype._bldArr=function(node,schemaFragment) {
 var rArr=[];
 var schElm=schemaFragment.selectSingleNode(this._s+":sequence/"+this._s+":element");
 var nm=schElm.attributes.getNamedItem("name").nodeValue;
 var atp=schElm.attributes.getNamedItem("type")!=null?schElm.attributes.getNamedItem("type").nodeValue:"anyType";
 var elms=node.selectNodes(nm);
 if (nm.substring(0,nm.indexOf(':'))!=this._s) {
  for (var i=0; i<elms.length; i++) {
   rArr[i]=this._buildFromSchema(elms[i],schemaFragment.ownerDocument.selectSingleNode("//"+this._s+":complexType[@name=\""+XmlSerializer._getNamespaceLocalName(atp)+"\"]"));
  } 
 } else if (atp=="anyType") {
  for (var i=0; i<elementNodes.length; i++) rArr[i]=Convert.fromSchemaType(elms[i].text,elms[i].attributes.getNamedItem(this._s+":type").nodeValue);
 } else {
  for (var i=0; i<elementNodes.length; i++) rArr[i]=Convert.fromSchemaType(elms[i].text,atp);
 }
 return rArr;
}
/*********************************************************************
 ***                         Helper methods                        ***
 *********************************************************************/
function CheckOverflow(val,minInclusive,maxInclusive,isFloat) {
 /// @Version("1.0.0.4")
 var lVal=(isFloat)?parseFloat(val):parseInt(val,10);
 if (lVal>=(minInclusive!=null?minInclusive:Number.NEGATIVE_INFINITY)&&lVal<=(maxInclusive!=null?maxInclusive:Number.POSITIVE_INFINITY)) return lVal;
 else throw new OverflowError(val,minInclusive,maxInclusive);
}
function PadZeros(value,len) {
 // @Version("1.1.0.0")
 if (value==null) throw new NullArgumentError("value");
 if (len==null) throw new NullArgumentError("len");
 if (value.toString().length<len.toString().length) {
  var ret="";
  for (var i=value.toString().length;i<len.toString().length;i++) ret+="0";
  return ret+value.toString();
 } else return value;
}
Convert={
 toXmlEncodedString:function(value) {
  /// @Modifiers(modifiers=Modifier.static|Modifier.public)
  /// @MethodDocumentation(description="Converts the specified string xml encoded equivalent.")
  /// @ParameterDocumentation(name="value",type="string",description="A string to convert.",required=true)
  /// @Returns(type="string",description="A xml encoded string equivalent to the <I>value</I> string.");
  return value.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");
 },
 toXmlDateTime:function(date) {
  /// @Modifiers(modifiers=Modifier.static|Modifier.public)
  /// @MethodDocumentation(description="Converts the value of a Date instance to a xml string representation of the value.")
  /// @ParameterDocumentation(name="date",type="Date",description="A date to convert.",required=true)
  /// @Returns(type="string",description="A xml encoded string equivalent to the <I>date</I> Date.");
  /// @Throws(error="NullArgumentError",condition="<I>date</I> is <B>null</B>.")
  /// @Throws(error="TypeMismatchError",condition="<I>date</I> is not a Date object.")
  if (date==null) throw new NullArgumentError("date");
  if (Reflection!=null) if (Reflection.identifyObjectSignature(date)!=WellKnownSignature.date) throw new TypeMismatchError("date",typeof(date));
  var utcStr=date.toString().substr(date.toString().indexOf("UTC")+3);
  utcStr=utcStr.substring(0,utcStr.indexOf(' '));
  return date.getFullYear()+'-'+PadZeros(date.getMonth()+1,10)+'-'+PadZeros(date.getDate(),10)+
    'T'+PadZeros(date.getHours(),10)+':'+PadZeros(date.getMinutes(),10)+':'+PadZeros(date.getSeconds(),10)+
    '.'+PadZeros(date.getMilliseconds()*10000,1000000)+utcStr.substr(0,utcStr.length-2)+':'+utcStr.substr(utcStr.length-2);

 },
 fromSchemaType:function(obj,typename) {
  /// @Modifiers(modifiers=Modifier.static|Modifier.public)
  /// @MethodDocumentation(description="Converts the value of a object instance to a javascript type coresponding with the given xml schema type.")
  /// @ParameterDocumentation(name="obj",type="object",description="An object to convert.",required=true)
  /// @ParameterDocumentation(name="typename",type="string",description="A xml schema typename.",required=true)
  /// @Returns(type="object",description="A javascript object of type equivalent to the <I>typename</I> with the value of the <I>obj</I> object.");
  /// @Throws(error="NullArgumentError",condition="<I>obj</I> is <B>null</B>.")
  /// @Throws(error="NullArgumentError",condition="<I>typename</I> is <B>null</B>.")
  /// @Throws(error="IllegalArgumentError",condition="<I>typename</I> is not a predefined xml schema type.")
  if (obj==null) throw new NullArgumentError("obj");
  if (typename==null) throw new NullArgumentError("typename");
  switch (typename.indexOf(':')>-1?typename.substr(typename.indexOf(':')+1):typename) {
   case "QName":
   case "string":
   case "normalizedString" :
    return obj.toString();
   break;
   case "negativeInteger":
    return CheckOverflow(obj,Number.NEGATIVE_INFINITY,-1);
   case "unsignedShort":
    return CheckOverflow(obj,0,65535);
   case "unsignedByte":
     return CheckOverflow(obj,0,255);
   case "unsignedLong":
    return CheckOverflow(obj,0,18446744073709551615);
   case "unsignedInt":
    return CheckOverflow(obj,0,4294967295);
   case "short":
    return CheckOverflow(obj,-32768,32767);
   case "byte":
    return CheckOverflow(obj,-128,127);
   case "long":
    return CheckOverflow(obj,-9223372036854775808,9223372036854775807);
   case "integer":
    return parseInt(obj,10);
   case "int":
    return CheckOverflow(obj,-2147483648,2147483647);
   case "decimal":
    return parseFloat(obj);
   case "double":
    return CheckOverflow(obj,-9007199254740991,9007199254740992,true);
    return parseFloat(obj,10);
   case "float":
    CheckOverflow(obj,-16777215,16777216,true);
   case "dateTime":
    if (Reflection.identifyObjectSignature(obj)==WellKnownSignature.date) return obj;
    else {
     var parts=obj.toString().split('T');
     var dt=new Date(parseInt(parts[0].split('-')[0],10),parseInt(parts[0].split('-')[1],10)-1,parseInt(parts[0].split('-')[2],10),parseInt(parts[1].split(':')[0],10),parseInt(parts[1].split(':')[1],10),parseInt(parts[1].split(':')[2],10),parseInt(parts[1].split('.')[1],10)/10000);
     return dt;
    }
    break;
   case "date":
    return new Date(parseInt(obj.toString().split('-')[0],10),parseInt(obj.toString().split('-')[1],10)-1,parseInt(obj.toString().split('-')[2],10));
   case "time":
    return new Date(1970,0,1,parseInt(obj.toString().split(':')[0],10),parseInt(obj.toString().split(':')[1],10),parseInt(obj.toString().split(':')[2],10),parseInt(obj.toString().split('.')[1],10));
   case "boolean":
    return obj.toString().toLowerCase()=="true";
   case "base64Binary":
   case "base64":
    return obj;
   default:
    throw new IllegalArgumentError("The type \""+typename+"\" is not a predefined xml schema type.");
  }
 }
}
/*********************************************************************
 ***                             Errors                            ***
 *********************************************************************/
function OverflowError(val,minInc,maxInc) {
 /// @Version("1.0.0.1")
 this.message="Value "+val+" caused an overflow error. The type only supports values between "+minInc+" and "+maxInc+".";
 try { debug(Reflection.getMethodName(OverflowError.caller)+" throws OverflowError: "+this.message); } catch (err) {}
}
OverflowError.prototype=new Error();
function IllegalArgumentError(message) {
 /// @Version("1.0.0.1")
 this.message="Illegal argument!"+(message!=null?+'\n'+message:"");
 try { debug(Reflection.getMethodName(IllegalArgumentError.caller)+" throws IllegalArgumentError: "+this.message); } catch (err) {}
}
IllegalArgumentError.prototype=new Error();
function NullArgumentError(argName) {
 /// @Version("1.0.0.1")
 this.message="Argument \""+argName+"\" cannot be null!";
 try { debug(Reflection.getMethodName(NullArgumentError.caller)+" throws NullArgumentError: "+this.message); } catch (err) {}
}
NullArgumentError.prototype=new Error();
function TypeMismatchError(expected,actual) {
 /// @Version("1.0.0.1")
 this.message="Expected \""+expected+"\", but was \""+actual+"\".";
 try { debug(Reflection.getMethodName(TypeMismatchError.caller)+" throws TypeMismatchError: "+this.message); } catch (err) {}
}
TypeMismatchError.prototype=new Error();
function MissingClassError(name,innerError,typeSpec) {
 /// @Version("1.0.0.1")
 this.message="Required class \""+name+"\" "+(typeSpec!=null?'('+typeSpec+')':'')+" was not found. Are you missing a <SCRIPT> statement?";//+(innerError!=null)?("\nInner error:\n"+innerError.message):'';
 try { debug(Reflection.getMethodName(MissingClassError.caller)+" throws MissingClassError: "+this.message); } catch (err) {}
}
MissingClassError.prototype=new Error();
function SerializationError(msg) {
 /// @Version("1.0.0.1")
 this.message="Serialization failed."+(msg!=null)?"\nAdditional information:\n"+msg:"";
}
SerializationError.prototype=new Error();
function MissingElementError(name) {
 /// @Version("1.0.0.1")
 this.message="Required element \""+name+"\" was not found.";
 try { debug(Reflection.getMethodName(MissingClassError.caller)+" throws MissingElementError: "+this.message); } catch (err) {}

}
MissingElementError.prototype=new Error();
/*********************************************************************
 ***                          Annotations                          ***
 *********************************************************************/
 function XmlArrayItem() {
 this.itemName=null;
 }
XmlArrayItem.prototype=new Annotation();

Comments

# milfs @ Sunday, August 05, 2007 1:42 PM

http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=164">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=164 drunk moms gallery amateur [URL=http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=164">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=164]drunk moms gallery[/URL] clips <a href="http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=164">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=164">drunk moms gallery</a> how to give
http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=222">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=222 *** tongue kissing blonde <a href="http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=222">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=222">*** tongue kissing</a> horse [URL=http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=222">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=222]*** tongue kissing[/URL] street
[URL=http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=223">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=223]girl kissing girl[/URL] young <a href="http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=223">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=223">girl kissing girl</a> free http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=223">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=223 girl kissing girl brutal
[URL=http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1446">http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1446]sexy moms[/URL] nudity <a href="http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1446">http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1446">sexy moms</a> cute http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1446">http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1446 sexy moms video
<a href="http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165">male">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165">male orgasm</a> movie http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165 male orgasm brutal [URL=http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=165]male orgasm[/URL] young
[URL=http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=166">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=166]girl masturbation teen[/URL] gay <a href="http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=166">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=166">girl masturbation teen</a> horse http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=166">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=166 girl masturbation teen brutal
<a href="http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167">***">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167">*** kissing</a> free http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167 *** kissing brutal [URL=http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167">http://www.spicygreeniguana.com/forum/topic.asp?TOPIC_ID=167]*** kissing[/URL] clips
<a href="http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219">male">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219">male masturbation techniques</a> free [URL=http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219]male masturbation techniques[/URL] street http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=219 male masturbation techniques black
http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=216">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=216 hot moms pic japanese [URL=http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=216">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=216]hot moms pic[/URL] cat <a href="http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=216">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=216">hot moms pic</a> gallery
http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1449">http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1449 nude male model pic mature [URL=http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1449">http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1449]nude male model pic[/URL] clips <a href="http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1449">http://www.ridleyowners.com/forum/site_code/forum/topic.asp?TOPIC_ID=1449">nude male model pic</a> asian
http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=221">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=221 masturbation tips brutal <a href="http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=221">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=221">masturbation tips</a> free [URL=http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=221">http://www.blackcase.net/bnhp/topic.asp?TOPIC_ID=221]masturbation tips[/URL] street

milfs

# hot @ Thursday, August 23, 2007 5:53 AM

[URL=http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=58870z.txt">http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=58870z.txt]hand job[/URL] street http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=58870z.txt">http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=58870z.txt hand job brutal <a href="http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=58870z.txt">http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=58870z.txt">hand job</a> movie
[URL=http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=48753z.txt">http://wiki.math.ohiou.edu/default/Brazy?action=AttachFile&do=get&target=48753z.txt]hot nude women[/URL] amateur <a href=