示例#1
0
        public XmlReader CreateReader(ReaderOptions readerOptions)
        {
            var r = new XNodeReader(this);

            if ((readerOptions & ReaderOptions.OmitDuplicateNamespaces) != 0)
            {
                r.OmitDuplicateNamespaces = true;
            }

            return(r);
        }
示例#2
0
文件: Extensions.cs 项目: nobled/mono
		public static void Validate (this XDocument source, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler, bool addSchemaInfo)
		{
			if (source == null)
				throw new ArgumentNullException ("source");
			if (schemas == null)
				throw new ArgumentNullException ("schemas");
			var xrs = new XmlReaderSettings () { ValidationType = ValidationType.Schema };
			xrs.Schemas = schemas;
			xrs.ValidationEventHandler += validationEventHandler;
			var xsource = new XNodeReader (source);
			var xr = XmlReader.Create (xsource, xrs);
			while (xr.Read ()) {
				if (addSchemaInfo) {
					if (xr.NodeType == XmlNodeType.Element) {
						xsource.CurrentNode.AddAnnotation (xr.SchemaInfo);
						while (xr.MoveToNextAttribute ())
							if (xr.NamespaceURI != XUtil.XmlnsNamespace)
								xsource.GetCurrentAttribute ().AddAnnotation (xr.SchemaInfo);
						xr.MoveToElement ();
					}
				}
			}
		}
示例#3
0
文件: XNode.cs 项目: user277/mono
		public XmlReader CreateReader (ReaderOptions readerOptions)
		{
			var r = new XNodeReader (this);
			if ((readerOptions & ReaderOptions.OmitDuplicateNamespaces) != 0)
				r.OmitDuplicateNamespaces = true;
			
			return r;
		}