예제 #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;
		}