/// <summary> /// Add an instance document to the list of documents to be validated. /// </summary> /// <param name="source">Stream source of the document</param> /// <param name="baseUri">Base Uri of the source document</param> public void AddSource(Stream source, Uri baseUri) { StreamSource ss = new StreamSource(new JDotNetInputStream(source)); ss.setSystemId(baseUri.ToString()); sources.Add(ss); }
/// <summary> /// Supply the instance document to be validated in the form of a Stream /// </summary> /// <param name="source">A stream containing the XML document to be parsed /// and validated.</param> /// <param name="baseUri">The base URI to be used for resolving any relative /// references, for example a reference to an <c>xsi:schemaLocation</c></param> public void SetSource(Stream source, Uri baseUri) { StreamSource ss = new StreamSource(new DotNetInputStream(source)); ss.setSystemId(baseUri.ToString()); this.source = ss; }
/// <summary> /// Compile a schema supplied as a Stream. The resulting schema components are added /// to the cache. /// </summary> /// <param name="input">A stream containing the source text of the schema. This method /// will consume the supplied stream. It is the caller's responsibility to close the stream /// after use.</param> /// <param name="baseUri">The base URI of the schema document, for resolving any references to other /// schema documents</param> public void Compile(Stream input, Uri baseUri) { StreamSource ss = new StreamSource(new JDotNetInputStream(input)); ss.setSystemId(baseUri.ToString()); schemaManager.load(ss); }
/// <summary> /// Compile a schema supplied as a Stream. The resulting schema components are added /// to the cache. /// </summary> /// <param name="input">A stream containing the source text of the schema</param> /// <param name="baseUri">The base URI of the schema document, for resolving any references to other /// schema documents</param> public void Compile(Stream input, Uri baseUri) { StreamSource ss = new StreamSource(new DotNetInputStream(input)); ss.setSystemId(baseUri.ToString()); if (errorList == null) { config.addSchemaSource(ss); } else { config.addSchemaSource(ss, new ErrorGatherer(errorList)); } }
/// <summary> /// Load an XML document supplied as raw (lexical) XML on a Stream. /// </summary> /// <remarks> /// <para>The document is parsed using the <c>System.Xml</c> parser.</para> /// <para>Before calling this method, the BaseUri property must be set to identify the /// base URI of this document, used for resolving any relative URIs contained within it.</para> /// <para>Note that the Microsoft <c>System.Xml</c> parser does not report whether attributes are /// defined in the DTD as being of type <c>ID</c> and <c>IDREF</c>. This is true whether or not /// DTD-based validation is enabled. This means that such attributes are not accessible to the /// <c>id()</c> and <c>idref()</c> functions.</para> /// </remarks> /// <param name="input">The Stream containing the XML source to be parsed</param> /// <returns>An <c>XdmNode</c>, the document node at the root of the tree of the resulting /// in-memory document /// </returns> public XdmNode Build(Stream input) { if (baseUri == null) { throw new ArgumentException("No base URI suppplied"); } Source source = new StreamSource(new DotNetInputStream(input)); source.setSystemId(baseUri.ToString()); source = augmentSource(source); StaticQueryContext env = new StaticQueryContext(config); //env.setURIResolver(new DotNetURIResolver(xmlResolver)); DocumentInfo doc = env.buildDocument(source); return((XdmNode)XdmValue.Wrap(doc)); }
/// <summary> /// Load an XML document supplied as raw (lexical) XML on a Stream. /// </summary> /// <remarks> /// <para>The document is parsed using the <c>System.Xml</c> parser.</para> /// <para>Before calling this method, the BaseUri property must be set to identify the /// base URI of this document, used for resolving any relative URIs contained within it.</para> /// <para>Note that the Microsoft <c>System.Xml</c> parser does not report whether attributes are /// defined in the DTD as being of type <c>ID</c> and <c>IDREF</c>. This is true whether or not /// DTD-based validation is enabled. This means that such attributes are not accessible to the /// <c>id()</c> and <c>idref()</c> functions.</para> /// </remarks> /// <param name="input">The Stream containing the XML source to be parsed</param> /// <returns>An <c>XdmNode</c>, the document node at the root of the tree of the resulting /// in-memory document /// </returns> public XdmNode Build(Stream input) { if (baseUri == null) { throw new ArgumentException("No base URI suppplied"); } Source source = new StreamSource(new DotNetInputStream(input)); source.setSystemId(baseUri.ToString()); source = augmentSource(source); StaticQueryContext env = new StaticQueryContext(config); //env.setURIResolver(new DotNetURIResolver(xmlResolver)); DocumentInfo doc = env.buildDocument(source); return (XdmNode)XdmValue.Wrap(doc); }
/// <summary> /// Supply the instance document to be validated in the form of a Stream /// </summary> /// <param name="source">A stream containing the XML document to be parsed /// and validated. This stream will be consumed by the validation process, /// but it will not be closed after use: that is the responsibility of the /// caller.</param> /// <param name="baseUri">The base URI to be used for resolving any relative /// references, for example a reference to an <c>xsi:schemaLocation</c></param> public void SetSource(Stream source, Uri baseUri) { StreamSource ss = new StreamSource(new DotNetInputStream(source)); ss.setSystemId(baseUri.ToString()); this.source = ss; }
/// <summary> /// Compile a schema supplied as a Stream. The resulting schema components are added /// to the cache. /// </summary> /// <param name="input">A stream containing the source text of the schema. This method /// will consume the supplied stream. It is the caller's responsibility to close the stream /// after use.</param> /// <param name="baseUri">The base URI of the schema document, for resolving any references to other /// schema documents</param> public void Compile(Stream input, Uri baseUri) { StreamSource ss = new StreamSource(new DotNetInputStream(input)); ss.setSystemId(baseUri.ToString()); if (errorList == null) { config.addSchemaSource(ss); } else { config.addSchemaSource(ss, new ErrorGatherer(errorList)); } }