internal bool ContainsIdAttribute(bool findAll) { int idCount = 0; foreach (XmlSchemaAttribute?attribute in this.AttributeUses.Values) { if (attribute !.Use != XmlSchemaUse.Prohibited) { XmlSchemaDatatype?datatype = attribute.Datatype; if (datatype != null && datatype.TypeCode == XmlTypeCode.Id) { idCount++; if (idCount > 1) { //two or more attributes is error break; } } } } return(findAll ? (idCount > 1) : (idCount > 0)); }
// Returns typed value of the current node (based on the type specified by schema) public object?ReadTypedValue() { if (_validationType == ValidationType.None) { return(null); } switch (_outerReader.NodeType) { case XmlNodeType.Attribute: return(_coreReaderImpl.InternalTypedValue); case XmlNodeType.Element: if (SchemaType == null) { return(null); } XmlSchemaDatatype?dtype = (SchemaType is XmlSchemaDatatype) ? (XmlSchemaDatatype)SchemaType : ((XmlSchemaType)SchemaType).Datatype; if (dtype != null) { if (!_outerReader.IsEmptyElement) { while (true) { if (!_outerReader.Read()) { throw new InvalidOperationException(SR.Xml_InvalidOperation); } XmlNodeType type = _outerReader.NodeType; if (type != XmlNodeType.CDATA && type != XmlNodeType.Text && type != XmlNodeType.Whitespace && type != XmlNodeType.SignificantWhitespace && type != XmlNodeType.Comment && type != XmlNodeType.ProcessingInstruction) { break; } } if (_outerReader.NodeType != XmlNodeType.EndElement) { throw new XmlException(SR.Xml_InvalidNodeType, _outerReader.NodeType.ToString()); } } return(_coreReaderImpl.InternalTypedValue); } return(null); case XmlNodeType.EndElement: return(null); default: if (_coreReaderImpl.V1Compat) { //If v1 XmlValidatingReader return null return(null); } else { return(Value); } } }
internal void SetDatatype(XmlSchemaDatatype?value) { _datatype = value; }