internal void AddError( ErrorCode errorCode, EdmSchemaErrorSeverity severity, XmlReader reader, object message) { int lineNumber; int linePosition; SchemaElement.GetPositionInfo(reader, out lineNumber, out linePosition); this.AddError(errorCode, severity, this.SchemaLocation, lineNumber, linePosition, message); }
private bool AddOtherContent(XmlReader reader) { int lineNumber; int linePosition; SchemaElement.GetPositionInfo(reader, out lineNumber, out linePosition); MetadataProperty property; if (reader.NodeType == XmlNodeType.Element) { if (this._schema.SchemaVersion == 1.0 || this._schema.SchemaVersion == 1.1) { return(true); } if (this._schema.SchemaVersion >= 2.0 && reader.NamespaceURI == "http://schemas.microsoft.com/ado/2006/04/codegeneration") { this.AddError(ErrorCode.NoCodeGenNamespaceInStructuralAnnotation, EdmSchemaErrorSeverity.Error, lineNumber, linePosition, (object)Strings.NoCodeGenNamespaceInStructuralAnnotation((object)"http://schemas.microsoft.com/ado/2006/04/codegeneration")); return(true); } using (XmlReader xmlReader = reader.ReadSubtree()) { xmlReader.Read(); using (StringReader stringReader = new StringReader(xmlReader.ReadOuterXml())) { XElement xelement = XElement.Load((TextReader)stringReader); property = SchemaElement.CreateMetadataPropertyFromXmlElement(xelement.Name.NamespaceName, xelement.Name.LocalName, xelement); } } } else { if (reader.NamespaceURI == "http://www.w3.org/2000/xmlns/") { return(true); } property = this.CreateMetadataPropertyFromXmlAttribute(reader.NamespaceURI, reader.LocalName, reader.Value); } if (!this.OtherContent.Exists((Predicate <MetadataProperty>)(mp => mp.Identity == property.Identity))) { this.OtherContent.Add(property); } else { this.AddError(ErrorCode.AlreadyDefined, EdmSchemaErrorSeverity.Error, lineNumber, linePosition, (object)Strings.DuplicateAnnotation((object)property.Identity, (object)this.FQName)); } return(false); }
internal void GetPositionInfo(XmlReader reader) { SchemaElement.GetPositionInfo(reader, out this._lineNumber, out this._linePosition); }