blob: 62b71e90b30c7963e53b4e9165979cf90a934a18 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Interface IEntityResolver2
| Apache Lucene.NET 4.8.0-beta00010 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Interface IEntityResolver2
| Apache Lucene.NET 4.8.0-beta00010 Documentation ">
<meta name="generator" content="docfx 2.56.0.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="benchmark/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Sax.Ext.IEntityResolver2">
<h1 id="Sax_Ext_IEntityResolver2" data-uid="Sax.Ext.IEntityResolver2" class="text-break">Interface IEntityResolver2
</h1>
<div class="markdown level0 summary"><p>Extended interface for mapping external entity references to input
sources, or providing a missing external subset. The
<a class="xref" href="Sax.IXMLReader.html#Sax_IXMLReader_EntityResolver">EntityResolver</a> property
is used to provide implementations of this interface to parsers.
When a parser uses the methods in this interface, the
<a class="xref" href="Sax.Ext.IEntityResolver2.html#Sax_Ext_IEntityResolver2_ResolveEntity_System_String_System_String_System_String_System_String_">ResolveEntity(String, String, String, String)</a>
method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
<a class="xref" href="Sax.IEntityResolver.html#Sax_IEntityResolver_ResolveEntity_System_String_System_String_">ResolveEntity(String, String)</a> method.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<a class="xref" href="Sax.IEntityResolver.html#Sax_IEntityResolver_ResolveEntity_System_String_System_String_">IEntityResolver.ResolveEntity(String, String)</a>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Sax.Ext.html">Sax.Ext</a></h6>
<h6><strong>Assembly</strong>: Lucene.Net.Benchmark.dll</h6>
<h5 id="Sax_Ext_IEntityResolver2_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public interface IEntityResolver2 : IEntityResolver</code></pre>
</div>
<h5 id="Sax_Ext_IEntityResolver2_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p><em>This module, both source code and documentation, is in the
Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
<p>
If a SAX application requires the customized handling which this
interface defines for external entities, it must ensure that it uses
an XMLReader with the
<em><a href="http://xml.org/sax/features/use-entity-resolver2">http://xml.org/sax/features/use-entity-resolver2</a></em> feature flag
set to <em>true</em> (which is its default value when the feature is
recognized). If that flag is unrecognized, or its value is false,
or the resolver does not implement this interface, then only the
<a class="xref" href="Sax.IEntityResolver.html">IEntityResolver</a> method will be used.
<p>
That supports three categories of application that modify entity
resolution. <em>Old Style</em> applications won&apos;t know about this interface;
they will provide an <a class="xref" href="Sax.IEntityResolver.html">IEntityResolver</a>.
<em>Transitional Mode</em> provide an <a class="xref" href="Sax.Ext.IEntityResolver2.html">IEntityResolver2</a> and automatically
get the benefit of its methods in any systems (parsers or other tools)
supporting it, due to polymorphism.
Both <em>Old Style</em> and <em>Transitional Mode</em> applications will
work with any SAX2 parser.
<em>New style</em> applications will fail to run except on SAX2 parsers
that support this particular feature.
They will insist that feature flag have a value of &quot;true&quot;, and the
<a class="xref" href="Sax.Ext.IEntityResolver2.html">IEntityResolver2</a> implementation they provide might throw an exception
if the original SAX 1.0 style entity resolution method is invoked.</p>
</div>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Sax_Ext_IEntityResolver2_GetExternalSubset_System_String_System_String_.md&amp;value=---%0Auid%3A%20Sax.Ext.IEntityResolver2.GetExternalSubset(System.String%2CSystem.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs/#L124">View Source</a>
</span>
<a id="Sax_Ext_IEntityResolver2_GetExternalSubset_" data-uid="Sax.Ext.IEntityResolver2.GetExternalSubset*"></a>
<h4 id="Sax_Ext_IEntityResolver2_GetExternalSubset_System_String_System_String_" data-uid="Sax.Ext.IEntityResolver2.GetExternalSubset(System.String,System.String)">GetExternalSubset(String, String)</h4>
<div class="markdown level1 summary"><p>Allows applications to provide an external subset for documents
that don&apos;t explicitly define one. Documents with DOCTYPE declarations
that omit an external subset can thus augment the declarations
available for validation, entity processing, and attribute processing
(normalization, defaulting, and reporting types including ID).
This augmentation is reported
through the <a class="xref" href="Sax.Ext.ILexicalHandler.html#Sax_Ext_ILexicalHandler_StartDTD_System_String_System_String_System_String_">StartDTD(String, String, String)</a> method as if
the document text had originally included the external subset;
this callback is made before any internal subset data or errors
are reported.
<p>
This method can also be used with documents that have no DOCTYPE
declaration.When the root element is encountered,
but no DOCTYPE declaration has been seen, this method is
invoked.If it returns a value for the external subset, that root
element is declared to be the root element, giving the effect of
splicing a DOCTYPE declaration at the end the prolog of a document
that could not otherwise be valid. The sequence of parser callbacks
in that case logically resembles this:
<p>
<pre><code>... comments and PIs from the prolog (as usual)
StartDTD(&quot;rootName&quot;, source.getPublicId (), source.getSystemId ());
StartEntity(&quot;[dtd]&quot;);
... declarations, comments, and PIs from the external subset
EndEntity(&quot;[dtd]&quot;);
EndDTD();
... then the rest of the document(as usual)
StartElement(..., &quot;rootName&quot;, ...);</code></pre>
<p><p>
Note that the InputSource gets no further resolution.
Implementations of this method may wish to invoke
<a class="xref" href="Sax.Ext.IEntityResolver2.html#Sax_Ext_IEntityResolver2_ResolveEntity_System_String_System_String_System_String_System_String_">ResolveEntity(String, String, String, String)</a> to gain benefits such as use
of local caches of DTD entities.Also, this method will never be
used by a (non - validating) processor that is not including external
parameter entities.
<p>
Uses for this method include facilitating data validation when
interoperating with XML processors that would always require
undesirable network accesses for external entities, or which for
other reasons adopt a &quot;no DTDs&quot; policy.
Non - validation motives include forcing documents to include DTDs so
that attributes are handled consistently.
For example, an XPath processor needs to know which attibutes have
type &quot;ID&quot; before it can process a widely used type of reference.
<p>
<strong> Warning:</strong> Returning an external subset modifies
the input document.By providing definitions for general entities,
it can make a malformed document appear to be well formed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">InputSource GetExternalSubset(string name, string baseURI)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">name</span></td>
<td><p>Identifies the document root element. This name comes
from a DOCTYPE declaration (where available) or from the actual
root element. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">baseURI</span></td>
<td><p>The document&apos;s base URI, serving as an additional
hint for selecting the external subset. This is always an absolute
URI, unless it is null because the XMLReader was given an InputSource
without one.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Sax.InputSource.html">InputSource</a></td>
<td><p>An <a class="xref" href="Sax.InputSource.html">InputSource</a> object describing the new external subset
to be used by the parser, or null to indicate that no external
subset is provided.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Sax.SAXException.html">SAXException</a></td>
<td><p>Any SAX exception, possibly wrapping
another exception.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>Probably indicating a failure to create
a new <span class="xref">System.IO.Stream</span> or <span class="xref">System.IO.TextReader</span>, or an illegal URL.</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Sax_Ext_IEntityResolver2_ResolveEntity_System_String_System_String_System_String_System_String_.md&amp;value=---%0Auid%3A%20Sax.Ext.IEntityResolver2.ResolveEntity(System.String%2CSystem.String%2CSystem.String%2CSystem.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs/#L173">View Source</a>
</span>
<a id="Sax_Ext_IEntityResolver2_ResolveEntity_" data-uid="Sax.Ext.IEntityResolver2.ResolveEntity*"></a>
<h4 id="Sax_Ext_IEntityResolver2_ResolveEntity_System_String_System_String_System_String_System_String_" data-uid="Sax.Ext.IEntityResolver2.ResolveEntity(System.String,System.String,System.String,System.String)">ResolveEntity(String, String, String, String)</h4>
<div class="markdown level1 summary"><p>Allows applications to map references to external entities into input
sources, or tell the parser it should use conventional URI resolution.
This method is only called for external entities which have been
properly declared.
<p>
This method provides more flexibility than the <a class="xref" href="Sax.IEntityResolver.html">IEntityResolver</a>
interface, supporting implementations of more complex catalogue
schemes such as the one defined by the<a href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">OASIS XML Catalogs</a> specification.
<p>
Parsers configured to use this resolver method will call it
to determine the input source to use for any external entity
being included because of a reference in the XML text.
That excludes the document entity, and any external entity returned
by <a class="xref" href="Sax.Ext.IEntityResolver2.html#Sax_Ext_IEntityResolver2_GetExternalSubset_System_String_System_String_">GetExternalSubset(String, String)</a>.
When a(non - validating) processor is configured not to include
a class of entities(parameter or general) through use of feature
flags, this method is not invoked for such entities.
<p>
Note that the entity naming scheme used here is the same one
used in the <a class="xref" href="Sax.Ext.ILexicalHandler.html">ILexicalHandler</a>, or in the <a class="xref" href="Sax.IContentHandler.html#Sax_IContentHandler_SkippedEntity_System_String_">SkippedEntity(String)</a>
method.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">InputSource ResolveEntity(string name, string publicId, string baseURI, string systemId)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">name</span></td>
<td><p>Identifies the external entity being resolved.
Either &quot;[dtd]&quot; for the external subset, or a name starting
with &quot;%&quot; to indicate a parameter entity, or else the name of
a general entity. This is never null when invoked by a SAX2</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">publicId</span></td>
<td><p>The public identifier of the external entity being
referenced (normalized as required by the XML specification), or
null if none was supplied.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">baseURI</span></td>
<td><p>The URI with respect to which relative systemIDs
are interpreted. This is always an absolute URI, unless it is
null (likely because the <a class="xref" href="Sax.IXMLReader.html">IXMLReader</a> was given an <a class="xref" href="Sax.InputSource.html">InputSource</a> without
one). This URI is defined by the XML specification to be the one
associated with the &quot;&lt;&quot; starting the relevant declaration.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">systemId</span></td>
<td><p>The system identifier of the external entity
being referenced; either a relative or absolute URI.
This is never null when invoked by a SAX2 parser; only declared
entities, and any external subset, are resolved by such parsers.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Sax.InputSource.html">InputSource</a></td>
<td><p>An <a class="xref" href="Sax.InputSource.html">InputSource</a> object describing the new input source to
be used by the parser. Returning null directs the parser to
resolve the system ID against the base URI and open a connection
to resulting URI.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Sax.SAXException.html">SAXException</a></td>
<td><p>Any SAX exception, possibly wrapping
another exception.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>Probably indicating a failure to create
a new <span class="xref">System.IO.Stream</span> or <span class="xref">System.IO.TextReader</span>, or an illegal URL.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="seealso">See Also</h3>
<div class="seealso">
<div><a class="xref" href="Sax.IXMLReader.html#Sax_IXMLReader_EntityResolver">EntityResolver</a></div>
</div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Sax_Ext_IEntityResolver2.md&amp;value=---%0Auid%3A%20Sax.Ext.IEntityResolver2%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/apache/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs/#L51" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 Licensed to the Apache Software Foundation (ASF)
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>