' xs:group'第21行第4位的开始标记与' xr:group'的结束标记不匹配

时间:2014-04-09 07:58:59

标签: xml linq asp.net-mvc-3

我正在使用MVC3项目,当部署到生产时我得到了这个错误

The 'xs:group' start tag on line 21 position 4 does not match the end tag of 'xr:group'. Line 30, position 5.

下面的Stacktrace

    at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
   at System.Xml.XmlTextReaderImpl.ParseEndElement()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler)
   at System.Data.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
   at System.Data.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.ComputeSchemaSet(SchemaDataModelOption dataModel)
   at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
   at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
   at System.Data.EntityModel.SchemaObjectModel.Schema.Parse(XmlReader sourceReader, String sourceLocation)
   at System.Data.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification, ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection)
   at System.Data.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError)
   at System.Data.Metadata.Edm.EdmItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError)
   at System.Data.Metadata.Edm.MetadataCache.EdmMetadataEntry.LoadEdmItemCollection(MetadataArtifactLoader loader)
   at System.Data.Metadata.Edm.MetadataCache.LoadItemCollection[T](IItemCollectionLoader`1 itemCollectionLoader, T entry)
   at System.Data.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection(String cacheKey, MetadataArtifactLoader loader, Object& entryToken)
   at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
   at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
   at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.Join[TOuter,TInner,TKey,TResult](IQueryable`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector)
   at FRMobileApplication.Controllers.PreScreenController.GetClientDetails(String jobCode) in C:\Users\AAM\Documents\Choy Projects\FRMobile\FRMobileApplication\FRMobileApplication\Controllers\PreScreenController.cs:line 492
   at FRMobileApplication.Controllers.PreScreenController.PreScreen() in C:\Users\AAM\Documents\Choy Projects\FRMobile\FRMobileApplication\FRMobileApplication\Controllers\PreScreenController.cs:line 30
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)

此页面适用于其他域。还尝试添加System.Xml.Linq但仍然没有运气。 提前谢谢。

我有这个方法GetClientDetails()执行LINQ,似乎错误是由LINQ引起的,我使用的是EF4。

using (frEntities db = new frEntities())
{
    var client = (from c in db.CLIENTs
                  join p in db.POSITIONs on c.CLIENT_ID equals p.CLIENT_ID
                  join cf in db.Client_Features on c.CLIENT_ID equals cf.Client_ID
                  where p.POSITION_JobCode == jobCode
                  select new{
                      c.CLIENT_ID,
                      p.POSITIONTYPE_ID
                  }).FirstOrDefault();
 }

回复更新

我完成了它,我们刚刚将EF4更新为EF6.1并修复了一些参考文献。

2 个答案:

答案 0 :(得分:0)

我认为这个错误恰恰意味着它所说的内容。

&#39; xs:group&#39;第21行第4位的开始标记与&#39; xr:group&#39;的结束标记不匹配。第30行,第5位。

第21行你会找到

   <xs:group>

在第30行你会找到

   </xr:group>

因此您的XML格式不正确。没有XML解析器应该允许这样做而没有错误。

答案 1 :(得分:0)

我得到了它的工作,我们刚刚将EF4更新为EF6.1并修复了一些引用。