Example #1
0
        public XmlSchema Add(string ns, XmlReader reader, System.Xml.XmlResolver resolver)
        {
            SchemaType type;

            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            XmlNameTable nameTable  = reader.NameTable;
            SchemaInfo   schemaInfo = new SchemaInfo();

            System.Xml.Schema.Parser parser = new System.Xml.Schema.Parser(SchemaType.None, nameTable, this.GetSchemaNames(nameTable), this.validationEventHandler)
            {
                XmlResolver = resolver
            };
            try
            {
                type = parser.Parse(reader, ns);
            }
            catch (XmlSchemaException exception)
            {
                this.SendValidationEvent(exception);
                return(null);
            }
            if (type == SchemaType.XSD)
            {
                schemaInfo.SchemaType = SchemaType.XSD;
                return(this.Add(ns, schemaInfo, parser.XmlSchema, true, resolver));
            }
            SchemaInfo xdrSchema = parser.XdrSchema;

            return(this.Add(ns, parser.XdrSchema, null, true, resolver));
        }
Example #2
0
        internal XmlQueryContext(XmlQueryRuntime runtime, object defaultDataSource, XmlResolver dataSources, XsltArgumentList argList, WhitespaceRuleLookup wsRules) {
            this.runtime = runtime;
            this.dataSources = dataSources;
            this.dataSourceCache = new Hashtable();
            this.argList = argList;
            this.wsRules = wsRules;

            if (defaultDataSource is XmlReader) {
                this.readerSettings = new QueryReaderSettings((XmlReader) defaultDataSource);
            }
            else {
                // Consider allowing users to set DefaultReaderSettings in XsltArgumentList
                // readerSettings = argList.DefaultReaderSettings;
                this.readerSettings = new QueryReaderSettings(new NameTable());
            }

            if (defaultDataSource is string) {
                // Load the default document from a Uri
                this.defaultDataSource = GetDataSource(defaultDataSource as string, null);

                if (this.defaultDataSource == null)
                    throw new XslTransformException(Res.XmlIl_UnknownDocument, defaultDataSource as string);
            }
            else if (defaultDataSource != null) {
                this.defaultDataSource = ConstructDocument(defaultDataSource, null, null);
            }
        }
Example #3
0
        /// <summary>
        /// Loads the XSLT file using specified path, settings and stylesheet resolver.
        /// </summary>
        /// <param name="path">The URL to the XSLT file.</param>
        /// <param name="settings">XSLT settings.</param>
        /// <param name="stylesheetResolver">The stylesheet resolver.</param>
        /// <returns><see cref="XslCompiledTransform" /> object that can transform the input.</returns>
        public virtual XslCompiledTransform LoadXslt(string path, XsltSettings settings, XmlResolver stylesheetResolver)
        {
            var xslt = new XslCompiledTransform();
            xslt.Load(path, settings, stylesheetResolver);

            return xslt;
        }
Example #4
0
        public XmlReader Transform(XPathNavigator input, XsltArgumentList args, System.Xml.XmlResolver resolver)
        {
            this.CheckCommand();
            Processor processor = new Processor(input, args, resolver, this._CompiledStylesheet, this._QueryStore, this._RootAction, this.debugger);

            return(processor.StartReader());
        }
Example #5
0
		private void RecurseNode(XmlDocument doc, XmlResolver resolver, XmlNode elementNode, string xsltName)
		{
			this.ElementToHTMLPage(doc,resolver,elementNode,xsltName);

			foreach(XmlNode childNode in elementNode)
			{
				if(childNode.Name == "Glossary")
				{
					this.ElementToHTMLPage(doc,resolver,childNode,"Glossary.xsl");
				}
				if(childNode.Name == "Packages")
				{
					foreach(XmlNode packageNode in childNode.ChildNodes)
					{
						this.RecurseNode(doc,resolver,packageNode,"Package.xsl");
					}
				}
				if(childNode.Name == "Actors")
				{
					foreach(XmlNode actorNode in childNode.ChildNodes)
					{
						this.RecurseNode(doc,resolver,actorNode,"Actor.xsl");
					}
				}
				if(childNode.Name == "UseCases")
				{
					foreach(XmlNode useCaseNode in childNode.ChildNodes)
					{
						this.RecurseNode(doc,resolver,useCaseNode,"UseCase.xsl");
					}
				}
			}
		}
Example #6
0
		/// <summary>
		/// Initializes the writer to write redirected output. 
		/// </summary>              
		/// <remarks>Depending on the <c>method</c> attribute value, 
		/// <c>XmlTextWriter</c> or <c>StreamWriter</c> is created. 
		/// <c>XmlTextWriter</c> is used for outputting XML and  
		/// <c>StreamWriter</c> - for plain text.
		/// </remarks>
		public void InitWriter(XmlResolver outResolver)
		{
			if (outResolver == null)
			{
				outResolver = new OutputResolver(Directory.GetCurrentDirectory());
			}
			// Save current directory
			//storedDir = Directory.GetCurrentDirectory();
			string outFile = outResolver.ResolveUri(null, href).LocalPath;
			DirectoryInfo dir = Directory.GetParent(outFile);
			if (!dir.Exists)
				dir.Create();
			// Create writer
			if (method == OutputMethod.Xml)
			{
				xmlWriter = new XmlTextWriter(outFile, encoding);
				if (indent)
					xmlWriter.Formatting = Formatting.Indented;
				if (!omitXmlDecl)
				{
					if (standalone)
						xmlWriter.WriteStartDocument(true);
					else
						xmlWriter.WriteStartDocument();
				}
			}
			else
				textWriter = new StreamWriter(outFile, false, encoding);
			// Set new current directory            
			//Directory.SetCurrentDirectory(dir.ToString());                                    
            href = ""; // clean the href for the next usage
		}
 public static CompilerErrorCollection CompileToType(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver, bool debug, TypeBuilder typeBuilder, string scriptAssemblyPath)
 {
     QilExpression expression;
     if (stylesheet == null)
     {
         throw new ArgumentNullException("stylesheet");
     }
     if (typeBuilder == null)
     {
         throw new ArgumentNullException("typeBuilder");
     }
     if (settings == null)
     {
         settings = XsltSettings.Default;
     }
     if (settings.EnableScript && (scriptAssemblyPath == null))
     {
         throw new ArgumentNullException("scriptAssemblyPath");
     }
     if (scriptAssemblyPath != null)
     {
         scriptAssemblyPath = Path.GetFullPath(scriptAssemblyPath);
     }
     CompilerErrorCollection errors = new Compiler(settings, debug, scriptAssemblyPath).Compile(stylesheet, stylesheetResolver, out expression).Errors;
     if (!errors.HasErrors)
     {
         if (GeneratedCodeCtor == null)
         {
             GeneratedCodeCtor = typeof(GeneratedCodeAttribute).GetConstructor(new Type[] { typeof(string), typeof(string) });
         }
         typeBuilder.SetCustomAttribute(new CustomAttributeBuilder(GeneratedCodeCtor, new object[] { typeof(XslCompiledTransform).FullName, "4.0.0.0" }));
         new XmlILGenerator().Generate(expression, typeBuilder);
     }
     return errors;
 }
Example #8
0
 public void Load(IXPathNavigable stylesheet, System.Xml.XmlResolver resolver)
 {
     if (stylesheet == null)
     {
         throw new ArgumentNullException("stylesheet");
     }
     this.Load(stylesheet.CreateNavigator(), resolver);
 }
Example #9
0
		public NvdlValidatingReader (XmlReader reader, NvdlRules rules,
			XmlResolver resolver, NvdlConfig config)
			: base (reader)
		{
			dispatcher = new NvdlDispatcher (new SimpleRules (
				new NvdlCompileContext (
				rules, config, resolver)), this);
		}
Example #10
0
 internal XslTransform(object debugger)
 {
     this._XmlResolver = new XmlUrlResolver();
     if (debugger != null)
     {
         this.debugger = new DebuggerAddapter(debugger);
     }
 }
 private void Execute(object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
 {
     if (dataSources == null)
     {
         dataSources = XmlNullResolver.Singleton;
     }
     this.delExec(new XmlQueryRuntime(this.staticData, defaultDocument, dataSources, argumentList, results));
 }
Example #12
0
		public XmlSecureResolver (
			XmlResolver resolver, Evidence evidence)
		{
			this.resolver = resolver;
			if (SecurityManager.SecurityEnabled) {
				this.permissionSet = SecurityManager.ResolvePolicy (evidence);
			}
		}
Example #13
0
 /// <summary>
 /// Creates XmlTransformingReader with given XmlReader, stylesheet URI, 
 /// XsltArgumentList and Xmlresolver.
 /// </summary>
 /// <param name="parentReader">Source XML as XmlReader</param>
 /// <param name="transformSource">URI of the stylesheet to transform the source</param>
 /// <param name="args">Arguments to the transformation</param>
 /// <param name="resolver">XmlResolver to resolve URIs in document() function</param>
 public XmlTransformingReader(XmlReader parentReader, 
   string transformSource, XsltArgumentList args, XmlResolver resolver) 
 {			
   XPathDocument doc = new XPathDocument(parentReader);
   XslTransform xslt = new XslTransform();
   xslt.Load(transformSource);
   _outReader = xslt.Transform(doc, args, resolver);
 }
Example #14
0
		protected Transform ()
		{
//			if (SecurityManager.SecurityEnabled) {
//				xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
//			} else {
				xmlResolver = new XmlUrlResolver ();
//			}
		}
Example #15
0
 public void Load(XPathNavigator stylesheet, System.Xml.XmlResolver resolver)
 {
     if (stylesheet == null)
     {
         throw new ArgumentNullException("stylesheet");
     }
     this.Compile(stylesheet, resolver, null);
 }
Example #16
0
 public void Load(XmlReader stylesheet, System.Xml.XmlResolver resolver, Evidence evidence)
 {
     if (stylesheet == null)
     {
         throw new ArgumentNullException("stylesheet");
     }
     this.Load(new XPathDocument(stylesheet, XmlSpace.Preserve), resolver, evidence);
 }
Example #17
0
 public XmlReader Transform(IXPathNavigable input, XsltArgumentList args, System.Xml.XmlResolver resolver)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     return(this.Transform(input.CreateNavigator(), args, resolver));
 }
		public Transform ()
		{
		// FIXME: enable it after CAS implementation
#if false // NET_1_1
			xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
#else
			xmlResolver = new XmlUrlResolver ();
#endif
		}
        internal CanonicalXml(XmlDocument document, XmlResolver resolver, bool includeComments) {
            if (document == null)
                throw new ArgumentNullException("document");

            m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
            m_c14nDoc.XmlResolver = resolver;
            m_c14nDoc.Load(new XmlNodeReader(document));
            m_ancMgr = new C14NAncestralNamespaceContextManager();
        }
        internal ExcCanonicalXml(XmlDocument document, bool includeComments, string inclusiveNamespacesPrefixList, XmlResolver resolver) {
            if (document == null)
                throw new ArgumentNullException("document");

            m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
            m_c14nDoc.XmlResolver = resolver;
            m_c14nDoc.Load(new XmlNodeReader(document));
            m_ancMgr = new ExcAncestralNamespaceContextManager(inclusiveNamespacesPrefixList);
        }
Example #21
0
 internal static XmlDocument TransformToDocument( XmlReader input, XslCompiledTransform transform, XsltArgumentList args, XmlResolver resolver )
 {
     XmlDocument doc = new XmlDocument( );
     using( XmlWriter output = doc.CreateNavigator().AppendChild() )
     {
         transform.Transform( input, args, output, resolver );
     }
     return doc;
 }
        internal ExcCanonicalXml(Stream inputStream, bool includeComments, string inclusiveNamespacesPrefixList, XmlResolver resolver, string strBaseUri) {
            if (inputStream == null)
                throw new ArgumentNullException("inputStream");

            m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
            m_c14nDoc.XmlResolver = resolver;
            m_c14nDoc.Load(Utils.PreProcessStreamInput(inputStream, resolver, strBaseUri));
            m_ancMgr = new ExcAncestralNamespaceContextManager(inclusiveNamespacesPrefixList);
        }
Example #23
0
    	internal XmlOutput(XslTransform transform, XsltArgumentList xsltArgs, 
						   XPathNavigator navigator, XmlResolver resolverForXmlTransformed,
						   XmlReader[] readersToClose) {
			_transform = transform;
			_xsltArgs = xsltArgs;
			_navigator = navigator;
			_resolverForXmlTransformed = resolverForXmlTransformed;
			_readersToClose = readersToClose;
		}
		public Transform ()
#endif
		{
			if (SecurityManager.SecurityEnabled) {
				xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
			} else {
				xmlResolver = new XmlUrlResolver ();
			}
		}
Example #25
0
        public void ReadXml(XPathNavigator node, XmlResolver resolver)
        {
            if (node.NodeType == XPathNodeType.Element) {

            if (node.MoveToFirstAttribute()) {
               do {
                  switch (node.LocalName) {
                     case "media-type":
                        this.MediaType = node.Value;
                        break;

                     case "boundary":
                        this.Boundary = node.Value;
                        break;
                  }
               } while (node.MoveToNextAttribute());

               node.MoveToParent();
            }

            if (node.MoveToChild(XPathNodeType.Element)) {

               XPathHttpMultipartItem currentItem = null;

               do {
                  if (node.NamespaceURI == XPathHttpClient.Namespace) {

                     switch (node.LocalName) {
                        case "header":
                           if (currentItem == null) {
                              currentItem = new XPathHttpMultipartItem();
                           }

                           currentItem.Headers.Add(node.GetAttribute("name", ""), node.GetAttribute("value", ""));
                           break;

                        case "body":
                           if (currentItem == null) {
                              currentItem = new XPathHttpMultipartItem();
                           }

                           currentItem.Body = new XPathHttpBody();
                           currentItem.Body.ReadXml(node, resolver);

                           this.Items.Add(currentItem);
                           currentItem = null;
                           break;
                     }
                  }

               } while (node.MoveToNext(XPathNodeType.Element));

               node.MoveToParent();
            }
             }
        }
Example #26
0
 public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
 {
     this.schemaType    = schemaType;
     this.nameTable     = nameTable;
     this.schemaNames   = schemaNames;
     this.eventHandler  = eventHandler;
     this.xmlResolver   = new XmlUrlResolver();
     this.processMarkup = true;
     this.dummyDocument = new XmlDocument();
 }
		public XmlValidatingReader (XmlReader reader)
		{
			sourceReader = reader;
			xmlTextReader = reader as XmlTextReader;
			if (xmlTextReader == null)
				resolver = new XmlUrlResolver ();
			entityHandling = EntityHandling.ExpandEntities;
			validationType = ValidationType.Auto;
			storedCharacters = new StringBuilder ();
		}
 public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
 {
     this.schemaType = schemaType;
     this.nameTable = nameTable;
     this.schemaNames = schemaNames;
     this.eventHandler = eventHandler;
     this.xmlResolver = new XmlUrlResolver();
     this.processMarkup = true;
     this.dummyDocument = new XmlDocument();
 }
 /// <summary>
 /// This should be a part of the I/O layer
 /// </summary>
 public static void LoadFromPath(this XslCompiledTransform xslCompiledTransform, string path, XsltSettings settings, XmlResolver stylesheetResolver)
 {
     using (C1StreamReader streamReader = new C1StreamReader(path))
     {
         using (XmlReader xmlReader = XmlReader.Create(streamReader))
         {
             xslCompiledTransform.Load(xmlReader, settings, stylesheetResolver);
         }
     }
 }
Example #30
0
        private void Compile(XPathNavigator stylesheet, System.Xml.XmlResolver resolver, Evidence evidence)
        {
            Compiler       compiler = (this.Debugger == null) ? new Compiler() : new DbgCompiler(this.Debugger);
            NavigatorInput input    = new NavigatorInput(stylesheet);

            compiler.Compile(input, resolver ?? XmlNullResolver.Singleton, evidence);
            this._CompiledStylesheet = compiler.CompiledStylesheet;
            this._QueryStore         = compiler.QueryStore;
            this._RootAction         = compiler.RootAction;
        }
Example #31
0
        public void Load(string url, System.Xml.XmlResolver resolver)
        {
            XmlTextReaderImpl reader = new XmlTextReaderImpl(url)
            {
                XmlResolver = resolver
            };
            Evidence evidence = XmlSecureResolver.CreateEvidenceForUrl(reader.BaseURI);

            this.Compile(Compiler.LoadDocument(reader).CreateNavigator(), resolver, evidence);
        }
 public EncryptedXml(XmlDocument document, Evidence evidence)
 {
     this.m_document = document;
     this.m_evidence = evidence;
     this.m_xmlResolver = null;
     this.m_padding = PaddingMode.ISO10126;
     this.m_mode = CipherMode.CBC;
     this.m_encoding = System.Text.Encoding.UTF8;
     this.m_keyNameMapping = new Hashtable(4);
 }
Example #33
0
		public override XmlReader CreateValidator (XmlReader reader,
			XmlResolver resolver)
		{
			// XmlResolver is never used.
			RelaxngValidatingReader rvr = 
				new RelaxngValidatingReader (
					reader, pattern);
			rvr.ReportDetails = true;
			return rvr;
		}
Example #34
0
 public BaseValidator(BaseValidator other) {
     reader = other.reader;
     schemaCollection = other.schemaCollection;
     eventHandling = other.eventHandling;
     nameTable = other.nameTable;
     schemaNames = other.schemaNames;
     positionInfo = other.positionInfo;
     xmlResolver = other.xmlResolver;
     baseUri = other.baseUri;
     elementName = other.elementName;
 }
 internal CanonicalXml(Stream inputStream, bool includeComments, XmlResolver resolver, string strBaseUri)
 {
     if (inputStream == null)
     {
         throw new ArgumentNullException("inputStream");
     }
     this.m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
     this.m_c14nDoc.XmlResolver = resolver;
     this.m_c14nDoc.Load(System.Security.Cryptography.Xml.Utils.PreProcessStreamInput(inputStream, resolver, strBaseUri));
     this.m_ancMgr = new C14NAncestralNamespaceContextManager();
 }
Example #36
0
		/// <summary>
		/// Gets an appropriate <see cref="System.Xml.XmlReader"/> implementation
		/// for the supplied <see cref="System.IO.Stream"/>.
		/// </summary>
		/// <param name="stream">The XML <see cref="System.IO.Stream"/> that is going to be read.</param>
		/// <param name="xmlResolver"><see cref="XmlResolver"/> to be used for resolving external references</param>
		/// <param name="schemas">XML schemas that should be used for validation.</param>
		/// <param name="eventHandler">Validation event handler.</param>
		/// <returns>
		/// A validating <see cref="System.Xml.XmlReader"/> implementation.
		/// </returns>
		public static XmlReader CreateValidatingReader(Stream stream, XmlResolver xmlResolver, XmlSchemaCollection schemas, ValidationEventHandler eventHandler)
		{
			XmlValidatingReader reader = new XmlValidatingReader(new XmlTextReader(stream));
			reader.XmlResolver = xmlResolver;
			reader.Schemas.Add(schemas);
			reader.ValidationType = ValidationType.Schema;
			if (eventHandler != null)
			{
				reader.ValidationEventHandler += eventHandler;
			}
			return reader;
		}
Example #37
0
		public override XmlReader CreateValidator (XmlReader reader,
			XmlResolver resolver)
		{
			XmlReaderSettings s = new XmlReaderSettings ();
			s.ValidationType = ValidationType.Schema;
			// do not allow inline schema and schemaLocation.
			s.ValidationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints;
			s.XmlResolver = resolver;
			foreach (XmlSchema schema in schemas)
				s.Schemas.Add (schema);
			return XmlReader.Create (reader, s);
		}
Example #38
0
        public XmlSchema Add(XmlSchema schema, System.Xml.XmlResolver resolver)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }
            SchemaInfo schemaInfo = new SchemaInfo {
                SchemaType = SchemaType.XSD
            };

            return(this.Add(schema.TargetNamespace, schemaInfo, schema, true, resolver));
        }
 public BaseValidator(BaseValidator other)
 {
     this.reader           = other.reader;
     this.schemaCollection = other.schemaCollection;
     this.eventHandling    = other.eventHandling;
     this.nameTable        = other.nameTable;
     this.schemaNames      = other.schemaNames;
     this.positionInfo     = other.positionInfo;
     this.xmlResolver      = other.xmlResolver;
     this.baseUri          = other.baseUri;
     this.elementName      = other.elementName;
 }
Example #40
0
 public BaseValidator(BaseValidator other)
 {
     reader = other.reader;
     _schemaCollection = other._schemaCollection;
     _eventHandling = other._eventHandling;
     _nameTable = other._nameTable;
     _schemaNames = other._schemaNames;
     _positionInfo = other._positionInfo;
     _xmlResolver = other._xmlResolver;
     _baseUri = other._baseUri;
     elementName = other.elementName;
 }
 public BaseValidator(BaseValidator other)
 {
     this.reader = other.reader;
     this.schemaCollection = other.schemaCollection;
     this.eventHandling = other.eventHandling;
     this.nameTable = other.nameTable;
     this.schemaNames = other.schemaNames;
     this.positionInfo = other.positionInfo;
     this.xmlResolver = other.xmlResolver;
     this.baseUri = other.baseUri;
     this.elementName = other.elementName;
 }
Example #42
0
        private static void PrepareSerializer()
        {
            lock (xmlSerializerSync)
            {
                if (xmlSerializer == null)
                {
                    xmlSerializer = new XmlSerializer(typeof(oval_variables));
                    xmlResolver = new ExtensibleXmlResourceResolver();

                }
            }
        }
Example #43
0
 public void Load(XPathNavigator stylesheet, System.Xml.XmlResolver resolver, Evidence evidence)
 {
     if (stylesheet == null)
     {
         throw new ArgumentNullException("stylesheet");
     }
     if (evidence == null)
     {
         evidence = new Evidence();
     }
     else
     {
         new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
     }
     this.Compile(stylesheet, resolver, evidence);
 }
Example #44
0
 public XmlSchemaCollection(XmlNameTable nametable)
 {
     this.timeout      = -1;
     this.isThreadSafe = true;
     if (nametable == null)
     {
         throw new ArgumentNullException("nametable");
     }
     this.nameTable    = nametable;
     this.collection   = Hashtable.Synchronized(new Hashtable());
     this.xmlResolver  = new XmlUrlResolver();
     this.isThreadSafe = true;
     if (this.isThreadSafe)
     {
         this.wLock = new ReaderWriterLock();
     }
 }
Example #45
0
        public void Transform(string inputfile, string outputfile, System.Xml.XmlResolver resolver)
        {
            FileStream stream = null;

            try
            {
                XPathDocument document = new XPathDocument(inputfile);
                stream = new FileStream(outputfile, FileMode.Create, FileAccess.ReadWrite);
                this.Transform((IXPathNavigable)document, null, (Stream)stream, resolver);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }
Example #46
0
        public XmlSchema Add(string targetNamespace, string schemaUri)
        {
            if ((schemaUri == null) || (schemaUri.Length == 0))
            {
                throw new ArgumentNullException("schemaUri");
            }
            if (targetNamespace != null)
            {
                targetNamespace = XmlComplianceUtil.CDataNormalize(targetNamespace);
            }
            XmlSchema schema = null;

            lock (this.InternalSyncObject)
            {
                System.Xml.XmlResolver xmlResolver = this.readerSettings.GetXmlResolver();
                if (xmlResolver == null)
                {
                    xmlResolver = new XmlUrlResolver();
                }
                Uri uri = xmlResolver.ResolveUri(null, schemaUri);
                if (this.IsSchemaLoaded(uri, targetNamespace, out schema))
                {
                    return(schema);
                }
                XmlReader reader = XmlReader.Create(schemaUri, this.readerSettings);
                try
                {
                    schema = this.Add(targetNamespace, this.ParseSchema(targetNamespace, reader));
                    while (reader.Read())
                    {
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
            return(schema);
        }
Example #47
0
        XmlReaderSettings MakeReaderSettings(System.Xml.XmlResolver resolver, ValidationEventHandler errorHandler)
        {
            XmlReaderSettings settings = null;

            settings = new XmlReaderSettings();
            settings.CheckCharacters  = true;
            settings.ConformanceLevel = ConformanceLevel.Document;
            settings.IgnoreComments   = true;
            settings.NameTable        = _nameTable;
            settings.ValidationFlags  = XmlSchemaValidationFlags.ReportValidationWarnings;
#pragma warning disable 612, 618
            settings.ValidationType = _requiresDtd == XhtmlDTDSpecification.None ? ValidationType.Auto : ValidationType.DTD;
#pragma warning restore 612, 618
            settings.ValidationEventHandler += errorHandler;
#if NET20 || NET35
            settings.ProhibitDtd = false;
#else
            settings.DtdProcessing = DtdProcessing.Parse;
#endif
            settings.XmlResolver = resolver;
            return(settings);
        }
    private void GenerateFile()
    {
        _PollutantFile = PollutantXSLTFile;

        string allPollutantsfile = AllPollutantXMLFile;


        // Execute the transformation.
        XslCompiledTransform xsltNew = new XslCompiledTransform();
        //xsltNew.Load(_PollutantFile);
        XsltSettings xsltSettings = new XsltSettings();

        xsltSettings.EnableDocumentFunction = true;
        System.Xml.XmlResolver styleSheetResolver = null;
        xsltNew.Load(_PollutantFile, xsltSettings, styleSheetResolver);
        // Create the XsltArgumentList.
        XsltArgumentList argList = new XsltArgumentList();

        argList.AddParam("language", "", SetLanguage());



        MemoryStream ms = new MemoryStream();

        xsltNew.Transform(new System.Xml.XPath.XPathDocument(allPollutantsfile), argList, ms);


        ms.Flush();
        ms.Position = 0;
        StreamReader sr = new StreamReader(ms);
        string       s  = sr.ReadToEnd();


        string myTest = ms.ToString();

        string cacheName = HTMLFilePath();

        AddToCache(cacheName, s);
    }
Example #49
0
 public void Transform(XPathNavigator input, XsltArgumentList args, XmlWriter output, System.Xml.XmlResolver resolver)
 {
     this.CheckCommand();
     new Processor(input, args, resolver, this._CompiledStylesheet, this._QueryStore, this._RootAction, this.debugger).Execute(output);
 }
Example #50
0
 public XmlReaderSettings(XmlResolver resolver)
 {
     Initialize(resolver);
 }
Example #51
0
 public XslTransform()
 {
     this._XmlResolver = new XmlUrlResolver();
 }
Example #52
0
 public XmlSecureResolver(XmlResolver resolver, string?securityUrl)
 {
     _resolver = resolver;
 }
Example #53
0
 public void Transform(IXPathNavigable input, XsltArgumentList args, XmlWriter output, System.Xml.XmlResolver resolver)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     this.Transform(input.CreateNavigator(), args, output, resolver);
 }
Example #54
0
        private XmlSchema Add(string ns, SchemaInfo schemaInfo, XmlSchema schema, bool compile, System.Xml.XmlResolver resolver)
        {
            int num = 0;

            if (schema != null)
            {
                if ((schema.ErrorCount == 0) && compile)
                {
                    if (!schema.CompileSchema(this, resolver, schemaInfo, ns, this.validationEventHandler, this.nameTable, true))
                    {
                        num = 1;
                    }
                    ns = (schema.TargetNamespace == null) ? string.Empty : schema.TargetNamespace;
                }
                num += schema.ErrorCount;
            }
            else
            {
                num += schemaInfo.ErrorCount;
                ns   = this.NameTable.Add(ns);
            }
            if (num == 0)
            {
                XmlSchemaCollectionNode node = new XmlSchemaCollectionNode {
                    NamespaceURI = ns,
                    SchemaInfo   = schemaInfo,
                    Schema       = schema
                };
                this.Add(ns, node);
                return(schema);
            }
            return(null);
        }
Example #55
0
 public void Load(XmlReader stylesheet, System.Xml.XmlResolver resolver)
 {
     this.Load(new XPathDocument(stylesheet, XmlSpace.Preserve), resolver);
 }