public static string ToXml(BatchRequest batch) { CimXmlWriter cxw = new CimXmlWriter(); if (batch.Count > 1) cxw.WriteMultiReqElement(); foreach (SingleRequest curOp in batch) { CimName tmpNameSpace = string.Empty; // Namespace if (curOp.Namespace == null) tmpNameSpace = batch.DefaultNamespace; else tmpNameSpace = curOp.Namespace; cxw.WriteSimpleReqElement(); switch (curOp.ReqType) { case SingleRequest.RequestType.GetClass: GetClass(cxw, (GetClassOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.GetInstance: GetInstance(cxw, (GetInstanceOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.DeleteClass: DeleteClass(cxw, (DeleteClassOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.DeleteInstance: DeleteInstance(cxw, (DeleteInstanceOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.CreateClass: CreateClass(cxw, (CreateClassOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.ModifyClass: ModifyClass(cxw, (ModifyClassOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.ModifyInstance: ModifyInstance(cxw, (ModifyInstanceOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.EnumerateClasses: EnumerateClasses(cxw, (EnumerateClassesOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.EnumerateClassNames: EnumerateClassNames(cxw, (EnumerateClassNamesOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.EnumerateInstances: EnumerateInstances(cxw, (EnumerateInstancesOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.EnumerateInstanceNames: EnumerateInstanceNames(cxw, (EnumerateInstanceNamesOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.CreateInstance: CreateInstance(cxw, (CreateInstanceOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.GetProperty: GetProperty(cxw, (GetPropertyOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.InvokeMethod: InvokeMethod(cxw, (InvokeMethodOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.SetProperty: SetProperty(cxw, (SetPropertyOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.GetQualifier: GetQualifier(cxw, (GetQualifierOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.SetQualifier: SetQualifier(cxw, (SetQualifierOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.DeleteQualifier: DeleteQualifier(cxw, (DeleteQualifierOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.EnumerateQualifiers: EnumerateQualifiers(cxw, (EnumerateQualifierOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.ExecuteQuery: ExecuteQuery(cxw, (ExecuteQueryOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.ExecQuery: ExecQuery(cxw, (ExecQueryOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.Associators: Associators(cxw, (AssociatorsOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.AssociatorNames: AssociatorNames(cxw, (AssociatorNamesOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.References: References(cxw, (ReferencesOpSettings)curOp, tmpNameSpace); break; case SingleRequest.RequestType.ReferenceNames: ReferenceNames(cxw, (ReferenceNamesOpSettings)curOp, tmpNameSpace); break; default: throw (new Exception("Not Implemented Yet")); } //</SIMPLEREQ> cxw.WriteEndElement(); } if (batch.Count > 1) cxw.WriteEndElement(); // </MULTIREQ> return cxw.ToString(); }