// Moves to the attribute with the specified LocalName and NamespaceURI public override bool MoveToAttribute(string name, string ns) { //Check atomized local name and ns name = coreReaderNameTable.Get(name); ns = ns != null ? coreReaderNameTable.Get(ns) : string.Empty; if (name == null || ns == null) { //Name or ns not found in the nameTable, then attribute is not found return false; } if (coreReader.MoveToAttribute(name, ns)) { validationState = ValidatingReaderState.OnAttribute; if (inlineSchemaParser == null) { attributePSVI = GetAttributePSVI(name, ns); Debug.Assert(attributePSVI != null); } else { //Parsing inline schema, no PSVI for schema attributes attributePSVI = null; } goto Found; } else { //Default attribute ValidatingReaderNodeData defaultNode = GetDefaultAttribute(name, ns, true); if (defaultNode != null) { attributePSVI = defaultNode.AttInfo; cachedNode = defaultNode; validationState = ValidatingReaderState.OnDefaultAttribute; goto Found; } } return false; Found: if (validationState == ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper.Finish(); validationState = savedState; } return true; }
public override void Skip() { int depth = this.Depth; switch (this.NodeType) { case XmlNodeType.Element: break; case XmlNodeType.Attribute: this.MoveToElement(); break; default: goto Label_0089; } if (!this.coreReader.IsEmptyElement) { bool flag = true; if ((this.xmlSchemaInfo.IsUnionType || this.xmlSchemaInfo.IsDefault) && (this.coreReader is XsdCachingReader)) { flag = false; } this.coreReader.Skip(); this.validationState = ValidatingReaderState.ReadAhead; if (flag) { this.validator.SkipToEndElement(this.xmlSchemaInfo); } } Label_0089: this.Read(); }
private void Init() { validationState = ValidatingReaderState.Init; defaultAttributes = new ArrayList(); currentAttrIndex = -1; attributePSVINodes = new AttributePSVIInfo[InitialAttributeCount]; valueGetter = new XmlValueGetter(GetStringValue); TypeOfString = typeof(System.String); xmlSchemaInfo = new XmlSchemaInfo(); //Add common strings to be compared to NameTable NsXmlNs = coreReaderNameTable.Add(XmlReservedNs.NsXmlNs); NsXs = coreReaderNameTable.Add(XmlReservedNs.NsXs); NsXsi = coreReaderNameTable.Add(XmlReservedNs.NsXsi); XsiType = coreReaderNameTable.Add("type"); XsiNil = coreReaderNameTable.Add("nil"); XsiSchemaLocation = coreReaderNameTable.Add("schemaLocation"); XsiNoNamespaceSchemaLocation = coreReaderNameTable.Add("noNamespaceSchemaLocation"); XsdSchema = coreReaderNameTable.Add("schema"); }
private void ProcessInlineSchema() { Debug.Assert(inlineSchemaParser != null); if (coreReader.Read()) { if (coreReader.NodeType == XmlNodeType.Element) { attributeCount = coreReaderAttributeCount = coreReader.AttributeCount; } else { //Clear attributes info if nodeType is not element ClearAttributesInfo(); } if (!inlineSchemaParser.ParseReaderNode()) { inlineSchemaParser.FinishParsing(); XmlSchema schema = inlineSchemaParser.XmlSchema; validator.AddSchema(schema); inlineSchemaParser = null; validationState = ValidatingReaderState.Read; } } }
// Closes the stream, changes the ReadState to Closed, and sets all the properties back to zero. public override void Close() { coreReader.Close(); validationState = ValidatingReaderState.ReaderClosed; }
// Parses the attribute value into one or more Text and/or EntityReference node types. public override bool ReadAttributeValue() { if (validationState == ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper.Finish(); validationState = savedState; } if (NodeType == XmlNodeType.Attribute) { if (validationState == ValidatingReaderState.OnDefaultAttribute) { cachedNode = CreateDummyTextNode(cachedNode.RawValue, cachedNode.Depth + 1); validationState = ValidatingReaderState.OnReadAttributeValue; return true; } return coreReader.ReadAttributeValue(); } return false; }
public override bool MoveToNextAttribute() { if ((this.currentAttrIndex + 1) < this.coreReaderAttributeCount) { this.coreReader.MoveToNextAttribute(); this.currentAttrIndex++; if (this.inlineSchemaParser == null) { this.attributePSVI = this.attributePSVINodes[this.currentAttrIndex]; } else { this.attributePSVI = null; } this.validationState = ValidatingReaderState.OnAttribute; } else if ((this.currentAttrIndex + 1) < this.attributeCount) { int num = ++this.currentAttrIndex - this.coreReaderAttributeCount; this.cachedNode = (ValidatingReaderNodeData) this.defaultAttributes[num]; this.attributePSVI = this.cachedNode.AttInfo; this.validationState = ValidatingReaderState.OnDefaultAttribute; } else { return false; } if (this.validationState == ValidatingReaderState.OnReadBinaryContent) { this.readBinaryHelper.Finish(); this.validationState = this.savedState; } return true; }
// Moves to the element that contains the current attribute node. public override bool MoveToElement() { if (coreReader.MoveToElement() || (int)validationState < 0) { //states OnDefaultAttribute or OnReadAttributeValue currentAttrIndex = -1; validationState = ValidatingReaderState.ClearAttributes; return true; } return false; }
public override bool MoveToAttribute(string name, string ns) { name = this.coreReaderNameTable.Get(name); ns = (ns != null) ? this.coreReaderNameTable.Get(ns) : string.Empty; if ((name == null) || (ns == null)) { return false; } if (this.coreReader.MoveToAttribute(name, ns)) { this.validationState = ValidatingReaderState.OnAttribute; if (this.inlineSchemaParser == null) { this.attributePSVI = this.GetAttributePSVI(name, ns); } else { this.attributePSVI = null; } } else { ValidatingReaderNodeData data = this.GetDefaultAttribute(name, ns, true); if (data != null) { this.attributePSVI = data.AttInfo; this.cachedNode = data; this.validationState = ValidatingReaderState.OnDefaultAttribute; } else { return false; } } if (this.validationState == ValidatingReaderState.OnReadBinaryContent) { this.readBinaryHelper.Finish(); this.validationState = this.savedState; } return true; }
public override bool MoveToElement() { if (!this.coreReader.MoveToElement() && (this.validationState >= ValidatingReaderState.None)) { return false; } this.currentAttrIndex = -1; this.validationState = ValidatingReaderState.ClearAttributes; return true; }
public override bool MoveToAttribute(string name) { if (this.coreReader.MoveToAttribute(name)) { this.validationState = ValidatingReaderState.OnAttribute; this.attributePSVI = this.GetAttributePSVI(name); } else { if (this.attributeCount > 0) { ValidatingReaderNodeData defaultAttribute = this.GetDefaultAttribute(name, true); if (defaultAttribute != null) { this.validationState = ValidatingReaderState.OnDefaultAttribute; this.attributePSVI = defaultAttribute.AttInfo; this.cachedNode = defaultAttribute; goto Label_0057; } } return false; } Label_0057: if (this.validationState == ValidatingReaderState.OnReadBinaryContent) { this.readBinaryHelper.Finish(); this.validationState = this.savedState; } return true; }
public override void MoveToAttribute(int i) { if ((i < 0) || (i >= this.attributeCount)) { throw new ArgumentOutOfRangeException("i"); } this.currentAttrIndex = i; if (i < this.coreReaderAttributeCount) { this.coreReader.MoveToAttribute(i); if (this.inlineSchemaParser == null) { this.attributePSVI = this.attributePSVINodes[i]; } else { this.attributePSVI = null; } this.validationState = ValidatingReaderState.OnAttribute; } else { int num = i - this.coreReaderAttributeCount; this.cachedNode = (ValidatingReaderNodeData) this.defaultAttributes[num]; this.attributePSVI = this.cachedNode.AttInfo; this.validationState = ValidatingReaderState.OnDefaultAttribute; } if (this.validationState == ValidatingReaderState.OnReadBinaryContent) { this.readBinaryHelper.Finish(); this.validationState = this.savedState; } }
private void Init() { this.validationState = ValidatingReaderState.Init; this.defaultAttributes = new ArrayList(); this.currentAttrIndex = -1; this.attributePSVINodes = new AttributePSVIInfo[8]; this.valueGetter = new XmlValueGetter(this.GetStringValue); TypeOfString = typeof(string); this.xmlSchemaInfo = new XmlSchemaInfo(); this.NsXmlNs = this.coreReaderNameTable.Add("http://www.w3.org/2000/xmlns/"); this.NsXs = this.coreReaderNameTable.Add("http://www.w3.org/2001/XMLSchema"); this.NsXsi = this.coreReaderNameTable.Add("http://www.w3.org/2001/XMLSchema-instance"); this.XsiType = this.coreReaderNameTable.Add("type"); this.XsiNil = this.coreReaderNameTable.Add("nil"); this.XsiSchemaLocation = this.coreReaderNameTable.Add("schemaLocation"); this.XsiNoNamespaceSchemaLocation = this.coreReaderNameTable.Add("noNamespaceSchemaLocation"); this.XsdSchema = this.coreReaderNameTable.Add("schema"); }
// Moves to the first attribute. public override bool MoveToFirstAttribute() { if (coreReader.MoveToFirstAttribute()) { currentAttrIndex = 0; if (inlineSchemaParser == null) { attributePSVI = attributePSVINodes[0]; } else { attributePSVI = null; } validationState = ValidatingReaderState.OnAttribute; goto Found; } else if (defaultAttributes.Count > 0) { //check for default cachedNode = (ValidatingReaderNodeData)defaultAttributes[0]; attributePSVI = cachedNode.AttInfo; currentAttrIndex = 0; validationState = ValidatingReaderState.OnDefaultAttribute; goto Found; } return false; Found: if (validationState == ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper.Finish(); validationState = savedState; } return true; }
private void ProcessElementEvent() { if ((this.processInlineSchema && this.IsXSDRoot(this.coreReader.LocalName, this.coreReader.NamespaceURI)) && (this.coreReader.Depth > 0)) { this.xmlSchemaInfo.Clear(); this.attributeCount = this.coreReaderAttributeCount = this.coreReader.AttributeCount; if (!this.coreReader.IsEmptyElement) { this.inlineSchemaParser = new System.Xml.Schema.Parser(SchemaType.XSD, this.coreReaderNameTable, this.validator.SchemaSet.GetSchemaNames(this.coreReaderNameTable), this.validationEvent); this.inlineSchemaParser.StartParsing(this.coreReader, null); this.inlineSchemaParser.ParseReaderNode(); this.validationState = ValidatingReaderState.ParseInlineSchema; } else { this.validationState = ValidatingReaderState.ClearAttributes; } } else { this.atomicValue = null; this.originalAtomicValueString = null; this.xmlSchemaInfo.Clear(); if (this.manageNamespaces) { this.nsManager.PushScope(); } string xsiSchemaLocation = null; string xsiNoNamespaceSchemaLocation = null; string xsiNil = null; string xsiType = null; if (this.coreReader.MoveToFirstAttribute()) { do { string namespaceURI = this.coreReader.NamespaceURI; string localName = this.coreReader.LocalName; if (Ref.Equal(namespaceURI, this.NsXsi)) { if (Ref.Equal(localName, this.XsiSchemaLocation)) { xsiSchemaLocation = this.coreReader.Value; } else if (Ref.Equal(localName, this.XsiNoNamespaceSchemaLocation)) { xsiNoNamespaceSchemaLocation = this.coreReader.Value; } else if (Ref.Equal(localName, this.XsiType)) { xsiType = this.coreReader.Value; } else if (Ref.Equal(localName, this.XsiNil)) { xsiNil = this.coreReader.Value; } } if (this.manageNamespaces && Ref.Equal(this.coreReader.NamespaceURI, this.NsXmlNs)) { this.nsManager.AddNamespace((this.coreReader.Prefix.Length == 0) ? string.Empty : this.coreReader.LocalName, this.coreReader.Value); } } while (this.coreReader.MoveToNextAttribute()); this.coreReader.MoveToElement(); } this.validator.ValidateElement(this.coreReader.LocalName, this.coreReader.NamespaceURI, this.xmlSchemaInfo, xsiType, xsiNil, xsiSchemaLocation, xsiNoNamespaceSchemaLocation); this.ValidateAttributes(); this.validator.ValidateEndOfAttributes(this.xmlSchemaInfo); if (this.coreReader.IsEmptyElement) { this.ProcessEndElementEvent(); } this.validationState = ValidatingReaderState.ClearAttributes; } }
// Moves to the next attribute. public override bool MoveToNextAttribute() { if (currentAttrIndex + 1 < coreReaderAttributeCount) { bool moveTo = coreReader.MoveToNextAttribute(); Debug.Assert(moveTo); currentAttrIndex++; if (inlineSchemaParser == null) { attributePSVI = attributePSVINodes[currentAttrIndex]; } else { attributePSVI = null; } validationState = ValidatingReaderState.OnAttribute; goto Found; } else if (currentAttrIndex + 1 < attributeCount) { //default attribute int defaultIndex = ++currentAttrIndex - coreReaderAttributeCount; cachedNode = (ValidatingReaderNodeData)defaultAttributes[defaultIndex]; attributePSVI = cachedNode.AttInfo; validationState = ValidatingReaderState.OnDefaultAttribute; goto Found; } return false; Found: if (validationState == ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper.Finish(); validationState = savedState; } return true; }
private void ProcessInlineSchema() { if (this.coreReader.Read()) { if (this.coreReader.NodeType == XmlNodeType.Element) { this.attributeCount = this.coreReaderAttributeCount = this.coreReader.AttributeCount; } else { this.ClearAttributesInfo(); } if (!this.inlineSchemaParser.ParseReaderNode()) { this.inlineSchemaParser.FinishParsing(); XmlSchema xmlSchema = this.inlineSchemaParser.XmlSchema; this.validator.AddSchema(xmlSchema); this.inlineSchemaParser = null; this.validationState = ValidatingReaderState.Read; } } }
// Reads the next node from the stream/TextReader. public override bool Read() { switch (validationState) { case ValidatingReaderState.Read: if (coreReader.Read()) { ProcessReaderEvent(); return true; } else { validator.EndValidation(); if (coreReader.EOF) { validationState = ValidatingReaderState.EOF; } return false; } case ValidatingReaderState.ParseInlineSchema: ProcessInlineSchema(); return true; case ValidatingReaderState.OnAttribute: case ValidatingReaderState.OnDefaultAttribute: case ValidatingReaderState.ClearAttributes: case ValidatingReaderState.OnReadAttributeValue: ClearAttributesInfo(); if (inlineSchemaParser != null) { validationState = ValidatingReaderState.ParseInlineSchema; goto case ValidatingReaderState.ParseInlineSchema; } else { validationState = ValidatingReaderState.Read; goto case ValidatingReaderState.Read; } case ValidatingReaderState.ReadAhead: //Will enter here on calling Skip() ClearAttributesInfo(); ProcessReaderEvent(); validationState = ValidatingReaderState.Read; return true; case ValidatingReaderState.OnReadBinaryContent: validationState = savedState; readBinaryHelper.Finish(); return Read(); case ValidatingReaderState.Init: validationState = ValidatingReaderState.Read; if (coreReader.ReadState == ReadState.Interactive) { //If the underlying reader is already positioned on a ndoe, process it ProcessReaderEvent(); return true; } else { goto case ValidatingReaderState.Read; } case ValidatingReaderState.ReaderClosed: case ValidatingReaderState.EOF: return false; default: return false; } }
public override bool Read() { switch (this.validationState) { case ValidatingReaderState.OnReadAttributeValue: case ValidatingReaderState.OnDefaultAttribute: case ValidatingReaderState.OnAttribute: case ValidatingReaderState.ClearAttributes: this.ClearAttributesInfo(); if (this.inlineSchemaParser == null) { this.validationState = ValidatingReaderState.Read; break; } this.validationState = ValidatingReaderState.ParseInlineSchema; goto Label_007C; case ValidatingReaderState.Init: this.validationState = ValidatingReaderState.Read; if (this.coreReader.ReadState != System.Xml.ReadState.Interactive) { break; } this.ProcessReaderEvent(); return true; case ValidatingReaderState.Read: break; case ValidatingReaderState.ParseInlineSchema: goto Label_007C; case ValidatingReaderState.ReadAhead: this.ClearAttributesInfo(); this.ProcessReaderEvent(); this.validationState = ValidatingReaderState.Read; return true; case ValidatingReaderState.OnReadBinaryContent: this.validationState = this.savedState; this.readBinaryHelper.Finish(); return this.Read(); case ValidatingReaderState.ReaderClosed: case ValidatingReaderState.EOF: return false; default: return false; } if (this.coreReader.Read()) { this.ProcessReaderEvent(); return true; } this.validator.EndValidation(); if (this.coreReader.EOF) { this.validationState = ValidatingReaderState.EOF; } return false; Label_007C: this.ProcessInlineSchema(); return true; }
// Skips to the end tag of the current element. public override void Skip() { int startDepth = Depth; switch (NodeType) { case XmlNodeType.Element: if (coreReader.IsEmptyElement) { break; } bool callSkipToEndElem = true; //If union and unionValue has been parsed till EndElement, then validator.ValidateEndElement has been called //Hence should not call SkipToEndElement as the current context has already been popped in the validator if ((xmlSchemaInfo.IsUnionType || xmlSchemaInfo.IsDefault) && coreReader is XsdCachingReader) { callSkipToEndElem = false; } coreReader.Skip(); validationState = ValidatingReaderState.ReadAhead; if (callSkipToEndElem) { validator.SkipToEndElement(xmlSchemaInfo); } break; case XmlNodeType.Attribute: MoveToElement(); goto case XmlNodeType.Element; } //For all other NodeTypes Skip() same as Read() Read(); return; }
public override bool ReadAttributeValue() { if (this.validationState == ValidatingReaderState.OnReadBinaryContent) { this.readBinaryHelper.Finish(); this.validationState = this.savedState; } if (this.NodeType != XmlNodeType.Attribute) { return false; } if (this.validationState == ValidatingReaderState.OnDefaultAttribute) { this.cachedNode = this.CreateDummyTextNode(this.cachedNode.RawValue, this.cachedNode.Depth + 1); this.validationState = ValidatingReaderState.OnReadAttributeValue; return true; } return this.coreReader.ReadAttributeValue(); }
public override int ReadElementContentAsBinHex(byte[] buffer, int index, int count) { if (ReadState != ReadState.Interactive) { return 0; } // init ReadContentAsBinaryHelper when called first time if (validationState != ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper = ReadContentAsBinaryHelper.CreateOrReset(readBinaryHelper, this); savedState = validationState; } // restore original state in order to have a normal Read() behavior when called from readBinaryHelper validationState = savedState; // call to the helper int readCount = readBinaryHelper.ReadElementContentAsBinHex(buffer, index, count); // set OnReadBinaryContent state again and return savedState = validationState; validationState = ValidatingReaderState.OnReadBinaryContent; return readCount; }
// Moves to the attribute with the specified index public override void MoveToAttribute(int i) { if (i < 0 || i >= _attributeCount) { throw new ArgumentOutOfRangeException(nameof(i)); } _currentAttrIndex = i; if (i < _coreReaderAttributeCount) { //reader attribute _coreReader.MoveToAttribute(i); if (_inlineSchemaParser == null) { _attributePSVI = _attributePSVINodes[i]; } else { _attributePSVI = null; } _validationState = ValidatingReaderState.OnAttribute; } else { //default attribute int defaultIndex = i - _coreReaderAttributeCount; _cachedNode = (ValidatingReaderNodeData)_defaultAttributes[defaultIndex]; _attributePSVI = _cachedNode.AttInfo; _validationState = ValidatingReaderState.OnDefaultAttribute; } if (_validationState == ValidatingReaderState.OnReadBinaryContent) { _readBinaryHelper.Finish(); _validationState = _savedState; } }
private void ProcessElementEvent() { if (this.processInlineSchema && IsXSDRoot(coreReader.LocalName, coreReader.NamespaceURI) && coreReader.Depth > 0) { xmlSchemaInfo.Clear(); attributeCount = coreReaderAttributeCount = coreReader.AttributeCount; if (!coreReader.IsEmptyElement) { //If its not empty schema, then parse else ignore inlineSchemaParser = new Parser(SchemaType.XSD, coreReaderNameTable, validator.SchemaSet.GetSchemaNames(coreReaderNameTable), validationEvent); inlineSchemaParser.StartParsing(coreReader, null); inlineSchemaParser.ParseReaderNode(); validationState = ValidatingReaderState.ParseInlineSchema; } else { validationState = ValidatingReaderState.ClearAttributes; } } else { //Validate element //Clear previous data atomicValue = null; originalAtomicValueString = null; xmlSchemaInfo.Clear(); if (manageNamespaces) { nsManager.PushScope(); } //Find Xsi attributes that need to be processed before validating the element string xsiSchemaLocation = null; string xsiNoNamespaceSL = null; string xsiNil = null; string xsiType = null; if (coreReader.MoveToFirstAttribute()) { do { string objectNs = coreReader.NamespaceURI; string objectName = coreReader.LocalName; if (Ref.Equal(objectNs, NsXsi)) { if (Ref.Equal(objectName, XsiSchemaLocation)) { xsiSchemaLocation = coreReader.Value; } else if (Ref.Equal(objectName, XsiNoNamespaceSchemaLocation)) { xsiNoNamespaceSL = coreReader.Value; } else if (Ref.Equal(objectName, XsiType)) { xsiType = coreReader.Value; } else if (Ref.Equal(objectName, XsiNil)) { xsiNil = coreReader.Value; } } if (manageNamespaces && Ref.Equal(coreReader.NamespaceURI, NsXmlNs)) { nsManager.AddNamespace(coreReader.Prefix.Length == 0 ? string.Empty : coreReader.LocalName, coreReader.Value); } } while (coreReader.MoveToNextAttribute()); coreReader.MoveToElement(); } validator.ValidateElement(coreReader.LocalName, coreReader.NamespaceURI, xmlSchemaInfo, xsiType, xsiNil, xsiSchemaLocation, xsiNoNamespaceSL); ValidateAttributes(); validator.ValidateEndOfAttributes(xmlSchemaInfo); if (coreReader.IsEmptyElement) { ProcessEndElementEvent(); } validationState = ValidatingReaderState.ClearAttributes; } }
// Moves to the first attribute. public override bool MoveToFirstAttribute() { if (_coreReader.MoveToFirstAttribute()) { _currentAttrIndex = 0; if (_inlineSchemaParser == null) { _attributePSVI = _attributePSVINodes[0]; } else { _attributePSVI = null; } _validationState = ValidatingReaderState.OnAttribute; goto Found; } else if (_defaultAttributes.Count > 0) { //check for default _cachedNode = (ValidatingReaderNodeData)_defaultAttributes[0]; _attributePSVI = _cachedNode.AttInfo; _currentAttrIndex = 0; _validationState = ValidatingReaderState.OnDefaultAttribute; goto Found; } return false; Found: if (_validationState == ValidatingReaderState.OnReadBinaryContent) { _readBinaryHelper.Finish(); _validationState = _savedState; } return true; }
// Moves to the attribute with the specified Name public override bool MoveToAttribute(string name) { if (coreReader.MoveToAttribute(name)) { validationState = ValidatingReaderState.OnAttribute; attributePSVI = GetAttributePSVI(name); goto Found; } else if (attributeCount > 0) { //Default attribute ValidatingReaderNodeData defaultNode = GetDefaultAttribute(name, true); if (defaultNode != null) { validationState = ValidatingReaderState.OnDefaultAttribute; attributePSVI = defaultNode.AttInfo; cachedNode = defaultNode; goto Found; } } return false; Found: if (validationState == ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper.Finish(); validationState = savedState; } return true; }
// Moves to the next attribute. public override bool MoveToNextAttribute() { if (_currentAttrIndex + 1 < _coreReaderAttributeCount) { bool moveTo = _coreReader.MoveToNextAttribute(); Debug.Assert(moveTo); _currentAttrIndex++; if (_inlineSchemaParser == null) { _attributePSVI = _attributePSVINodes[_currentAttrIndex]; } else { _attributePSVI = null; } _validationState = ValidatingReaderState.OnAttribute; goto Found; } else if (_currentAttrIndex + 1 < _attributeCount) { //default attribute int defaultIndex = ++_currentAttrIndex - _coreReaderAttributeCount; _cachedNode = (ValidatingReaderNodeData)_defaultAttributes[defaultIndex]; _attributePSVI = _cachedNode.AttInfo; _validationState = ValidatingReaderState.OnDefaultAttribute; goto Found; } return false; Found: if (_validationState == ValidatingReaderState.OnReadBinaryContent) { _readBinaryHelper.Finish(); _validationState = _savedState; } return true; }
// Moves to the attribute with the specified index public override void MoveToAttribute(int i) { if (i < 0 || i >= attributeCount) { throw new ArgumentOutOfRangeException("i"); } currentAttrIndex = i; if (i < coreReaderAttributeCount) { //reader attribute coreReader.MoveToAttribute(i); if (inlineSchemaParser == null) { attributePSVI = attributePSVINodes[i]; } else { attributePSVI = null; } validationState = ValidatingReaderState.OnAttribute; } else { //default attribute int defaultIndex = i - coreReaderAttributeCount; cachedNode = (ValidatingReaderNodeData)defaultAttributes[defaultIndex]; attributePSVI = cachedNode.AttInfo; validationState = ValidatingReaderState.OnDefaultAttribute; } if (validationState == ValidatingReaderState.OnReadBinaryContent) { readBinaryHelper.Finish(); validationState = savedState; } }
public override int ReadElementContentAsBinHex(byte[] buffer, int index, int count) { if (this.ReadState != System.Xml.ReadState.Interactive) { return 0; } if (this.validationState != ValidatingReaderState.OnReadBinaryContent) { this.readBinaryHelper = ReadContentAsBinaryHelper.CreateOrReset(this.readBinaryHelper, this); this.savedState = this.validationState; } this.validationState = this.savedState; int num = this.readBinaryHelper.ReadElementContentAsBinHex(buffer, index, count); this.savedState = this.validationState; this.validationState = ValidatingReaderState.OnReadBinaryContent; return num; }