You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/08/06 17:59:21 UTC
[23/33] lucenenet git commit: Lucene.Net.Benchmark: Added Sax and
TagSoup to the Support folder.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Ext/DeclHandler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/DeclHandler.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/DeclHandler.cs
new file mode 100644
index 0000000..047e9ac
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/DeclHandler.cs
@@ -0,0 +1,131 @@
+// DeclHandler.java - Optional handler for DTD declaration events.
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: DeclHandler.java,v 1.6 2004/04/22 13:28:49 dmegginson Exp $
+
+namespace Sax.Ext
+{
+ /// <summary>
+ /// SAX2 extension handler for DTD declaration events.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ /// See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ /// for further information.
+ /// <para/>
+ /// This is an optional extension handler for SAX2 to provide more
+ /// complete information about DTD declarations in an XML document.
+ /// XML readers are not required to recognize this handler, and it
+ /// is not part of core-only SAX2 distributions.
+ /// <para/>
+ /// Note that data-related DTD declarations (unparsed entities and
+ /// notations) are already reported through the
+ /// <see cref="IDTDHandler"/> interface.
+ /// <para/>
+ /// If you are using the declaration handler together with a lexical
+ /// handler, all of the events will occur between the
+ /// <see cref="ILexicalHandler.StartDTD(string, string, string)"/> and the
+ /// <see cref="ILexicalHandler.EndDTD()"/> events.
+ /// <para/>
+ /// To set the DeclHandler for an XML reader, use the
+ /// <see cref="IXMLReader.SetProperty(string, object)"/> method
+ /// with the property name
+ /// <a href="http://xml.org/sax/properties/declaration-handler">http://xml.org/sax/properties/declaration-handler</a>
+ /// and an object implementing this interface (or null) as the value.
+ /// If the reader does not report declaration events, it will throw a
+ /// <see cref="SAXNotRecognizedException"/>
+ /// when you attempt to register the handler.
+ /// </remarks>
+ /// <since>SAX 2.0 (extensions 1.0)</since>
+ /// <author>David Megginson</author>
+ /// <version>2.0.1 (sax2r2)</version>
+ public interface IDeclHandler
+ {
+ /// <summary>
+ /// Report an element type declaration.
+ /// </summary>
+ /// <remarks>
+ /// The content model will consist of the string "EMPTY", the
+ /// string "ANY", or a parenthesised group, optionally followed
+ /// by an occurrence indicator.The model will be normalized so
+ /// that all parameter entities are fully resolved and all whitespace
+ /// is removed,and will include the enclosing parentheses.Other
+ /// normalization (such as removing redundant parentheses or
+ /// simplifying occurrence indicators) is at the discretion of the
+ /// parser.
+ /// </remarks>
+ /// <param name="name">The element type name.</param>
+ /// <param name="model">The content model as a normalized string.</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ void ElementDecl(string name, string model);
+
+ /// <summary>
+ /// Report an attribute type declaration.
+ /// </summary>
+ /// <remarks>
+ /// Only the effective (first) declaration for an attribute will
+ /// be reported.The type will be one of the strings "CDATA",
+ /// "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
+ /// "ENTITIES", a parenthesized token group with
+ /// the separator "|" and all whitespace removed, or the word
+ /// "NOTATION" followed by a space followed by a parenthesized
+ /// token group with all whitespace removed.
+ /// <para/>
+ /// The value will be the value as reported to applications,
+ /// appropriately normalized and with entity and character
+ /// references expanded.
+ /// </remarks>
+ /// <param name="eName">The name of the associated element.</param>
+ /// <param name="aName">The name of the attribute.</param>
+ /// <param name="type">A string representing the attribute type.</param>
+ /// <param name="mode">A string representing the attribute defaulting mode
+ /// ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
+ /// none of these applies.</param>
+ /// <param name="value">A string representing the attribute's default value,
+ /// or null if there is none.</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ void AttributeDecl(string eName,
+ string aName,
+ string type,
+ string mode,
+ string value);
+
+ /// <summary>
+ /// Report an internal entity declaration.
+ /// </summary>
+ /// <remarks>
+ /// Only the effective (first) declaration for each entity
+ /// will be reported.All parameter entities in the value
+ /// will be expanded, but general entities will not.
+ /// </remarks>
+ /// <param name="name">The name of the entity. If it is a parameter
+ /// entity, the name will begin with '%'.</param>
+ /// <param name="value">The replacement text of the entity.</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="ExternalEntityDecl(string, string, string)"/>
+ /// <seealso cref="IDTDHandler.UnparsedEntityDecl(string, string, string, string)"/>
+ void InternalEntityDecl(string name, string value);
+
+ /// <summary>
+ /// Report a parsed external entity declaration.
+ /// </summary>
+ /// <remarks>
+ /// Only the effective (first) declaration for each entity
+ /// will be reported.
+ /// <para/>
+ /// If the system identifier is a URL, the parser must resolve it
+ /// fully before passing it to the application.
+ /// </remarks>
+ /// <param name="name">The name of the entity. If it is a parameter
+ /// entity, the name will begin with '%'.</param>
+ /// <param name="publicId">The entity's public identifier, or null if none
+ /// was given.</param>
+ /// <param name="systemId">The entity's system identifier.</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="InternalEntityDecl(string, string)"/>
+ /// <seealso cref="IDTDHandler.UnparsedEntityDecl(string, string, string, string)"/>
+ void ExternalEntityDecl(string name, string publicId,
+ string systemId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Ext/DefaultHandler2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/DefaultHandler2.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/DefaultHandler2.cs
new file mode 100644
index 0000000..409e44a
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/DefaultHandler2.cs
@@ -0,0 +1,112 @@
+// DefaultHandler2.java - extended DefaultHandler
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: DefaultHandler2.java,v 1.3 2002/01/12 19:04:19 dbrownell Exp $
+
+using Sax.Helpers;
+
+namespace Sax.Ext
+{
+ /// <summary>
+ /// This class extends the SAX2 base handler class to support the
+ /// SAX2 <see cref="ILexicalHandler"/>, <see cref="IDeclHandler"/>, and
+ /// <see cref="IEntityResolver2"/> extensions. Except for overriding the
+ /// original SAX1 <see cref="DefaultHandler.ResolveEntity(string, string)"/>
+ /// method the added handler methods just return. Subclassers may
+ /// override everything on a method-by-method basis.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ /// <para/>
+ /// <em>Note:</em> this class might yet learn that the
+ /// <see cref="IContentHandler.SetDocumentLocator(ILocator)"/> call might be passed a
+ /// <see cref="Locator2"/> object, and that the
+ /// <em>ContentHandler.startElement()</em> call might be passed a
+ /// <see cref="Attributes2"/> object.
+ /// </remarks>
+ /// <since>2.0 (extensions 1.1 alpha)</since>
+ /// <author>David Brownell</author>
+ /// <version>TBS</version>
+ public class DefaultHandler2 : DefaultHandler, ILexicalHandler, IDeclHandler, IEntityResolver2
+ {
+ /// <summary>Constructs a handler which ignores all parsing events.</summary>
+ public DefaultHandler2() { }
+
+
+ // SAX2 ext-1.0 LexicalHandler
+
+ public virtual void StartCDATA()
+ { }
+
+ public virtual void EndCDATA()
+ { }
+
+ public virtual void StartDTD(string name, string publicId, string systemId)
+ { }
+
+ public virtual void EndDTD()
+ { }
+
+ public virtual void StartEntity(string name)
+ { }
+
+ public virtual void EndEntity(string name)
+ { }
+
+ public virtual void Comment(char[] ch, int start, int length)
+ { }
+
+
+ // SAX2 ext-1.0 DeclHandler
+
+ public virtual void AttributeDecl(string eName, string aName,
+ string type, string mode, string value)
+ { }
+
+ public virtual void ElementDecl(string name, string model)
+ { }
+
+ public virtual void ExternalEntityDecl(string name,
+ string publicId, string systemId)
+ { }
+
+ public virtual void InternalEntityDecl(string name, string value)
+ { }
+
+ // SAX2 ext-1.1 EntityResolver2
+
+ /// <summary>
+ /// Tells the parser that if no external subset has been declared
+ /// in the document text, none should be used.
+ /// </summary>
+ public virtual InputSource GetExternalSubset(string name, string baseURI)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Tells the parser to resolve the systemId against the baseURI
+ /// and read the entity text from that resulting absolute URI.
+ /// Note that because the older <see cref="DefaultHandler.ResolveEntity(string, string)"/>,
+ /// method is overridden to call this one, this method may sometimes
+ /// be invoked with null <paramref name="name"/> and <paramref name="baseURI"/>, and
+ /// with the <paramref name="systemId"/> already absolutized.
+ /// </summary>
+ public virtual InputSource ResolveEntity(string name, string publicId,
+ string baseURI, string systemId)
+ { return null; }
+
+ // SAX1 EntityResolver
+
+ /// <summary>
+ /// Invokes <see cref="IEntityResolver2.ResolveEntity(string, string, string, string)"/>
+ /// with null entity name and base URI.
+ /// You only need to override that method to use this class.
+ /// </summary>
+ public override InputSource ResolveEntity(string publicId, string systemId)
+ {
+ return ResolveEntity(null, publicId, null, systemId);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs
new file mode 100644
index 0000000..4e836ed
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/EntityResolver2.cs
@@ -0,0 +1,178 @@
+// EntityResolver2.java - Extended SAX entity resolver.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: EntityResolver2.java,v 1.2 2002/01/12 19:20:08 dbrownell Exp $
+
+namespace Sax.Ext
+{
+ /// <summary>
+ /// Extended interface for mapping external entity references to input
+ /// sources, or providing a missing external subset. The
+ /// <see cref="IXMLReader.EntityResolver"/> property
+ /// is used to provide implementations of this interface to parsers.
+ /// When a parser uses the methods in this interface, the
+ /// <see cref="IEntityResolver2.ResolveEntity(string, string, string, string)"/>
+ /// method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
+ /// <see cref="IEntityResolver.ResolveEntity(string, string)"/> method.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ /// <para/>
+ /// 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>http://xml.org/sax/features/use-entity-resolver2</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
+ /// <see cref="IEntityResolver"/> method will be used.
+ /// <para/>
+ /// That supports three categories of application that modify entity
+ /// resolution. <em>Old Style</em> applications won't know about this interface;
+ /// they will provide an <see cref="IEntityResolver"/>.
+ /// <em>Transitional Mode</em> provide an <see cref="IEntityResolver2"/> 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 "true", and the
+ /// <see cref="IEntityResolver2"/> implementation they provide might throw an exception
+ /// if the original SAX 1.0 style entity resolution method is invoked.
+ /// </remarks>
+ /// <seealso cref="IXMLReader.EntityResolver"/>
+ /// <since>SAX 2.0 (extensions 1.1 alpha)</since>
+ /// <author>David Brownell</author>
+ /// <version>TBD</version>
+ public interface IEntityResolver2 : IEntityResolver
+ {
+ /// <summary>
+ /// Allows applications to provide an external subset for documents
+ /// that don'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 <see cref="ILexicalHandler.StartDTD(string, string, string)"/> 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.
+ /// <para/>
+ /// 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:
+ /// <para/>
+ /// <code>
+ /// ... comments and PIs from the prolog (as usual)
+ /// StartDTD("rootName", source.getPublicId (), source.getSystemId ());
+ /// StartEntity("[dtd]");
+ /// ... declarations, comments, and PIs from the external subset
+ /// EndEntity("[dtd]");
+ /// EndDTD();
+ /// ... then the rest of the document(as usual)
+ /// StartElement(..., "rootName", ...);
+ /// </code>
+ /// <para/>
+ /// Note that the InputSource gets no further resolution.
+ /// Implementations of this method may wish to invoke
+ /// <see cref="ResolveEntity(string, string, string, string)"/> 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.
+ /// <para/>
+ /// 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 "no DTDs" 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 "ID" before it can process a widely used type of reference.
+ /// <para/>
+ /// <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.
+ /// </summary>
+ /// <param name="name">
+ /// Identifies the document root element. This name comes
+ /// from a DOCTYPE declaration (where available) or from the actual
+ /// root element.
+ /// </param>
+ /// <param name="baseURI">
+ /// The document'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.
+ /// </param>
+ /// <returns>An <see cref="InputSource"/> object describing the new external subset
+ /// to be used by the parser, or null to indicate that no external
+ /// subset is provided.
+ /// </returns>
+ /// <exception cref="SAXException">Any SAX exception, possibly wrapping
+ /// another exception.</exception>
+ /// <exception cref="System.IO.IOException">Probably indicating a failure to create
+ /// a new <see cref="System.IO.Stream"/> or <see cref="System.IO.TextReader"/>, or an illegal URL.</exception>
+ InputSource GetExternalSubset(string name, string baseURI);
+
+ /// <summary>
+ /// 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.
+ /// <para/>
+ /// This method provides more flexibility than the <see cref="IEntityResolver"/>
+ /// 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.
+ /// <para/>
+ /// 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 <see cref="GetExternalSubset(string, string)"/>.
+ /// 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.
+ /// <para/>
+ /// Note that the entity naming scheme used here is the same one
+ /// used in the <see cref="ILexicalHandler"/>, or in the <see cref="IContentHandler.SkippedEntity(string)"/>
+ /// method.
+ /// </summary>
+ /// <param name="name">Identifies the external entity being resolved.
+ /// Either "[dtd]" for the external subset, or a name starting
+ /// with "%" to indicate a parameter entity, or else the name of
+ /// a general entity. This is never null when invoked by a SAX2</param>
+ /// <param name="publicId">The public identifier of the external entity being
+ /// referenced (normalized as required by the XML specification), or
+ /// null if none was supplied.</param>
+ /// <param name="baseURI">The URI with respect to which relative systemIDs
+ /// are interpreted. This is always an absolute URI, unless it is
+ /// null (likely because the <see cref="IXMLReader"/> was given an <see cref="InputSource"/> without
+ /// one). This URI is defined by the XML specification to be the one
+ /// associated with the "<" starting the relevant declaration.</param>
+ /// <param name="systemId">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.</param>
+ /// <returns>An <see cref="InputSource"/> 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.</returns>
+ /// <exception cref="SAXException">Any SAX exception, possibly wrapping
+ /// another exception.</exception>
+ /// <exception cref="System.IO.IOException">Probably indicating a failure to create
+ /// a new <see cref="System.IO.Stream"/> or <see cref="System.IO.TextReader"/>, or an illegal URL.</exception>
+ InputSource ResolveEntity(
+ string name,
+ string publicId,
+ string baseURI,
+ string systemId
+ );
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Ext/LexicalHandler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/LexicalHandler.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/LexicalHandler.cs
new file mode 100644
index 0000000..4092f79
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/LexicalHandler.cs
@@ -0,0 +1,180 @@
+// LexicalHandler.java - optional handler for lexical parse events.
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: LexicalHandler.java,v 1.5 2002/01/30 21:00:44 dbrownell Exp $
+
+namespace Sax.Ext
+{
+ /// <summary>
+ /// SAX2 extension handler for lexical events.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with<strong> NO WARRANTY</strong>.</em>
+ /// See<a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ /// for further information.
+ /// <para/>
+ /// This is an optional extension handler for SAX2 to provide
+ /// lexical information about an XML document, such as comments
+ /// and CDATA section boundaries.
+ /// XML readers are not required to recognize this handler, and it
+ /// is not part of core-only SAX2 distributions.
+ /// <para/>
+ /// The events in the lexical handler apply to the entire document,
+ /// not just to the document element, and all lexical handler events
+ /// must appear between the content handler's StartDocument and
+ /// EndDocument events.
+ /// <para/>
+ /// To set the LexicalHandler for an XML reader, use the
+ /// <see cref="IXMLReader.SetProperty(string, object)"/> method
+ /// with the property name
+ /// <a href="http://xml.org/sax/properties/lexical-handler">http://xml.org/sax/properties/lexical-handler</a>
+ /// and an object implementing this interface (or null) as the value.
+ /// If the reader does not report lexical events, it will throw a
+ /// <see cref="SAXNotRecognizedException"/>
+ /// when you attempt to register the handler.
+ /// </remarks>
+ /// <since>SAX 2.0 (extensions 1.0)</since>
+ /// <author>David Megginson</author>
+ /// <version>2.0.1 (sax2r2)</version>
+ public interface ILexicalHandler
+ {
+ /// <summary>
+ /// Report the start of DTD declarations, if any.
+ /// </summary>
+ /// <remarks>
+ /// This method is intended to report the beginning of the
+ /// DOCTYPE declaration; if the document has no DOCTYPE declaration,
+ /// this method will not be invoked.
+ /// <para/>
+ /// All declarations reported through
+ /// <see cref="IDTDHandler"/> or
+ /// <see cref="Ext.IDeclHandler"/> events must appear
+ /// between the startDTD and <see cref="EndDTD()"/> events.
+ /// Declarations are assumed to belong to the internal DTD subset
+ /// unless they appear between <see cref="StartEntity(string)"/>
+ /// and <see cref="EndEntity(string)"/> events. Comments and
+ /// processing instructions from the DTD should also be reported
+ /// between the <see cref="StartDTD(string, string, string)"/> and <see cref="EndDTD()"/> events, in their original
+ /// order of(logical) occurrence; they are not required to
+ /// appear in their correct locations relative to <see cref="IDTDHandler"/>
+ /// or <see cref="IDeclHandler"/> events, however.
+ /// <para/>
+ /// Note that the start / endDTD events will appear within
+ /// the start / endDocument events from <see cref="IContentHandler"/> and
+ /// before the first <see cref="IContentHandler.StartElement(string, string, string, IAttributes)"/>
+ /// event.
+ /// </remarks>
+ /// <param name="name">The document type name.</param>
+ /// <param name="publicId">The declared public identifier for the
+ /// external DTD subset, or null if none was declared.</param>
+ /// <param name="systemId">The declared system identifier for the
+ /// external DTD subset, or null if none was declared.
+ /// (Note that this is not resolved against the document
+ /// base URI.)</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <see cref="EndDTD()"/>
+ /// <see cref="StartEntity(string)"/>
+ void StartDTD(string name, string publicId,
+ string systemId);
+
+ /// <summary>
+ /// Report the end of DTD declarations.
+ /// <para/>
+ /// This method is intended to report the end of the
+ /// DOCTYPE declaration; if the document has no DOCTYPE declaration,
+ /// this method will not be invoked.
+ /// </summary>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="StartDTD(string, string, string)"/>
+ void EndDTD();
+
+ /// <summary>
+ /// Report the beginning of some internal and external XML entities.
+ /// </summary>
+ /// <remarks>
+ /// The reporting of parameter entities (including
+ /// the external DTD subset) is optional, and SAX2 drivers that
+ /// report LexicalHandler events may not implement it; you can use the
+ /// <a href="http://xml.org/sax/features/lexical-handler/parameter-entities">http://xml.org/sax/features/lexical-handler/parameter-entities</a>
+ /// feature to query or control the reporting of parameter entities.
+ /// <para/>
+ /// General entities are reported with their regular names,
+ /// parameter entities have '%' prepended to their names, and
+ /// the external DTD subset has the pseudo-entity name "[dtd]".
+ /// <para/>
+ /// When a SAX2 driver is providing these events, all other
+ /// events must be properly nested within start/end entity
+ /// events. There is no additional requirement that events from
+ /// <see cref="IDeclHandler"/> or
+ /// <see cref="IDTDHandler"/> be properly ordered.
+ /// <para/>
+ /// Note that skipped entities will be reported through the
+ /// <see cref="IContentHandler.SkippedEntity(string)"/>
+ /// event, which is part of the ContentHandler interface.
+ /// <para/>Because of the streaming event model that SAX uses, some
+ /// entity boundaries cannot be reported under any
+ /// circumstances:
+ /// <list type="bullet">
+ /// <item><description>general entities within attribute values</description></item>
+ /// <item><description>parameter entities within declarations</description></item>
+ /// </list>
+ /// <para/>These will be silently expanded, with no indication of where
+ /// the original entity boundaries were.
+ /// <para/>Note also that the boundaries of character references (which
+ /// are not really entities anyway) are not reported.
+ /// <para/>All start/endEntity events must be properly nested.
+ /// </remarks>
+ /// <param name="name">The name of the entity. If it is a parameter
+ /// entity, the name will begin with '%', and if it is the
+ /// external DTD subset, it will be "[dtd]".</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="EndEntity(string)"/>
+ /// <seealso cref="IDeclHandler.InternalEntityDecl(string, string)"/>
+ /// <seealso cref="IDeclHandler.ExternalEntityDecl(string, string, string)"/>
+ void StartEntity(string name);
+
+ /// <summary>
+ /// Report the end of an entity.
+ /// </summary>
+ /// <param name="name">The name of the entity that is ending.</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="StartEntity(string)"/>
+ void EndEntity(string name);
+
+ /// <summary>
+ /// Report the start of a CDATA section.
+ /// </summary>
+ /// <remarks>
+ /// The contents of the CDATA section will be reported through
+ /// the regular <see cref="IContentHandler.Characters(char[], int, int)"/>
+ /// event; this event is intended only to report
+ /// the boundary.
+ /// </remarks>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="EndEntity(string)"/>
+ void StartCDATA();
+
+ /// <summary>
+ /// Report the end of a CDATA section.
+ /// </summary>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ /// <seealso cref="StartCDATA()"/>
+ void EndCDATA();
+
+ /// <summary>
+ /// Report an XML comment anywhere in the document.
+ /// <para/>
+ /// This callback will be used for comments inside or outside the
+ /// document element, including comments in the external DTD
+ /// subset(if read). Comments in the DTD must be properly
+ /// nested inside start/endDTD and start/endEntity events(if
+ /// used).
+ /// </summary>
+ /// <param name="ch">An array holding the characters in the comment.</param>
+ /// <param name="start">The starting position in the array.</param>
+ /// <param name="length">The number of characters to use from the array.</param>
+ /// <exception cref="SAXException">The application may raise an exception.</exception>
+ void Comment(char[] ch, int start, int length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2.cs
new file mode 100644
index 0000000..907d427
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2.cs
@@ -0,0 +1,64 @@
+// Locator2.java - extended Locator
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: Locator2.java,v 1.5 2004/03/17 14:30:10 dmegginson Exp $
+
+using System.Text;
+
+namespace Sax.Ext
+{
+ /// <summary>
+ /// SAX2 extension to augment the entity information provided
+ /// though a <see cref="ILocator"/>.
+ /// </summary>
+ /// <remarks>
+ /// If an implementation supports this extension, the Locator
+ /// provided in <see cref="IContentHandler.SetDocumentLocator(ILocator)"/>
+ /// will implement this interface, and the
+ /// <a href="http://xml.org/sax/features/use-locator2">http://xml.org/sax/features/use-locator2</a> feature
+ /// flag will have the value <em>true</em>.
+ /// <para/>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with<strong> NO WARRANTY</strong>.</em>
+ /// <para/>
+ /// XMLReader implementations are not required to support this
+ /// information, and it is not part of core-only SAX2 distributions.
+ /// </remarks>
+ /// <since>SAX 2.0 (extensions 1.1 alpha)</since>
+ /// <author>David Brownell</author>
+ /// <version>TBS</version>
+ public interface ILocator2 : ILocator
+ {
+ /// <summary>
+ /// Returns the version of XML used for the entity. This will
+ /// normally be the identifier from the current entity's
+ /// <em><?xml version='...' ...?></em> declaration,
+ /// or be defaulted by the parser.
+ /// </summary>
+ string XMLVersion { get; }
+
+ /// <summary>
+ /// Returns the name of the character encoding for the entity.
+ /// If the encoding was declared externally(for example, in a MIME
+ /// Content-Type header), that will be the name returned.Else if there
+ /// was an<em><?xml ...encoding='...'?></em> declaration at
+ /// the start of the document, that encoding name will be returned.
+ /// Otherwise the encoding will been inferred (normally to be UTF-8, or
+ /// some UTF-16 variant), and that inferred name will be returned.
+ /// <para/>
+ /// When an <see cref="InputSource"/> is used
+ /// to provide an entity's character stream, this method returns the
+ /// encoding provided in that input stream.
+ /// <para/>
+ /// Note that some recent W3C specifications require that text
+ /// in some encodings be normalized, using Unicode Normalization
+ /// Form C, before processing.Such normalization must be performed
+ /// by applications, and would normally be triggered based on the
+ /// value returned by this method.
+ /// <para/>
+ /// Encoding names may be those used by the underlying JVM,
+ /// and comparisons should be case-insensitive.
+ /// </summary>
+ Encoding Encoding { get; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2Impl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2Impl.cs b/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2Impl.cs
new file mode 100644
index 0000000..f4f460f
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Ext/Locator2Impl.cs
@@ -0,0 +1,76 @@
+// Locator2Impl.java - extended LocatorImpl
+// http://www.saxproject.org
+// Public Domain: no warranty.
+// $Id: Locator2Impl.java,v 1.3 2004/04/26 17:34:35 dmegginson Exp $
+
+using Sax.Helpers;
+using System.Text;
+
+namespace Sax.Ext
+{
+ /// <summary>
+ /// SAX2 extension helper for holding additional Entity information,
+ /// implementing the <see cref="Locator2"/> interface.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ /// <para/>
+ /// This is not part of core-only SAX2 distributions.
+ /// </remarks>
+ /// <since>SAX 2.0.2</since>
+ /// <author>David Brownell</author>
+ /// <version>TBS</version>
+ public class Locator2 : Locator, ILocator2
+ {
+ private Encoding encoding;
+ private string version;
+
+ /// <summary>
+ /// Construct a new, empty <see cref="Locator2"/> object.
+ /// This will not normally be useful, since the main purpose
+ /// of this class is to make a snapshot of an existing <see cref="Locator"/>.
+ /// </summary>
+ public Locator2() { }
+
+ /// <summary>
+ /// Copy an existing <see cref="Locator"/> or <see cref="Locator2"/> object.
+ /// If the object implements <see cref="Locator2"/>, values of the
+ /// <em>encoding</em> and <em>version</em>strings are copied,
+ /// otherwise they set to <em>null</em>.
+ /// </summary>
+ /// <param name="locator">The existing Locator object.</param>
+ public Locator2(ILocator locator)
+ : base(locator)
+ {
+ if (locator is Locator2) {
+ Locator2 l2 = (Locator2)locator;
+
+ version = l2.XMLVersion;
+ encoding = l2.Encoding;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Locator2 method implementations
+ ////////////////////////////////////////////////////////////////////
+
+ /// <summary>
+ /// Gets the current value of the version property.
+ /// </summary>
+ public string XMLVersion
+ {
+ get { return version; }
+ set { version = value; }
+ }
+
+ /// <summary>
+ /// Gets the current value of the encoding property.
+ /// </summary>
+ public Encoding Encoding
+ {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs
new file mode 100644
index 0000000..53dc226
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/AttributesImpl.cs
@@ -0,0 +1,615 @@
+// AttributesImpl.java - default implementation of Attributes.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: AttributesImpl.java,v 1.9 2002/01/30 20:52:24 dbrownell Exp $
+
+using System;
+
+namespace Sax.Helpers
+{
+ /// <summary>
+ /// Default implementation of the <see cref="Attributes"/> interface.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with<strong> NO WARRANTY</strong>.</em>
+ /// See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ /// for further information.
+ /// <para/>
+ /// This class provides a default implementation of the SAX2
+ /// <see cref="Attributes"/> interface, with the
+ /// addition of manipulators so that the list can be modified or
+ /// reused.
+ /// <para/>There are two typical uses of this class:
+ /// <list type="bullet">
+ /// <item><description>to take a persistent snapshot of an Attributes object
+ /// in a <see cref="IContentHandler.StartElement(string, string, string, IAttributes)"/> event; or</description></item>
+ /// <item><description>to construct or modify an Attributes object in a SAX2 driver or filter.</description></item>
+ /// </list>
+ /// <para/>
+ /// This class replaces the now-deprecated SAX1 AttributeListImpl
+ /// class; in addition to supporting the updated Attributes
+ /// interface rather than the deprecated IAttributeList
+ /// interface, it also includes a much more efficient
+ /// implementation using a single array rather than a set of Vectors.
+ /// </remarks>
+ /// <since>SAX 2.0</since>
+ /// <author>David Megginson</author>
+ /// <version>2.0.1 (sax2r2)</version>
+ public class Attributes : IAttributes
+ {
+ ////////////////////////////////////////////////////////////////////
+ // Constructors.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /// <summary>
+ /// Construct a new, empty <see cref="Attributes"/> object.
+ /// </summary>
+ public Attributes()
+ {
+ length = 0;
+ data = null;
+ }
+
+ /// <summary>
+ /// Copy an existing Attributes object.
+ /// <para/>
+ /// This constructor is especially useful inside a
+ /// <see cref="IContentHandler.StartElement(string, string, string, IAttributes)"/>.
+ /// </summary>
+ /// <param name="atts">The existing <see cref="Attributes"/> object.</param>
+ public Attributes(IAttributes atts)
+ {
+ SetAttributes(atts);
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Attributes.
+ ////////////////////////////////////////////////////////////////////
+
+ /// <summary>
+ /// Return the number of attributes in the list.
+ /// </summary>
+ /// <seealso cref="Attributes.Length"/>
+ public virtual int Length
+ {
+ get { return length; }
+ }
+
+ /// <summary>
+ /// Return an attribute's Namespace URI.
+ /// </summary>
+ /// <param name="index">The attribute's index (zero-based).</param>
+ /// <returns>The Namespace URI, the empty string if none is
+ /// available, or null if the index is out of range.</returns>
+ /// <seealso cref="Attributes.GetURI(int)"/>
+ public virtual string GetURI(int index)
+ {
+ if (index >= 0 && index < length)
+ {
+ return data[index * 5];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /// <summary>
+ /// Return an attribute's local name.
+ /// </summary>
+ /// <param name="index">The attribute's index (zero-based).</param>
+ /// <returns>The attribute's local name, the empty string if none is available, or null if the index if out of range.</returns>
+ /// <seealso cref="Attributes.GetLocalName(int)"/>
+ public virtual string GetLocalName(int index)
+ {
+ if (index >= 0 && index < length)
+ {
+ return data[index * 5 + 1];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /// <summary>
+ /// Return an attribute's qualified (prefixed) name.
+ /// </summary>
+ /// <param name="index">The attribute's index (zero-based).</param>
+ /// <returns>The attribute's qualified name, the empty string if
+ /// none is available, or null if the index is out of bounds.</returns>
+ /// <seealso cref="Attributes.GetQName(int)"/>
+ public virtual string GetQName(int index)
+ {
+ if (index >= 0 && index < length)
+ {
+ return data[index * 5 + 2];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /// <summary>
+ /// Return an attribute's type by index.
+ /// </summary>
+ /// <param name="index">The attribute's index (zero-based).</param>
+ /// <returns>The attribute's type, "CDATA" if the type is unknown, or null
+ /// if the index is out of bounds.</returns>
+ /// <seealso cref="Attributes.GetType(int)"/>
+ public virtual string GetType(int index)
+ {
+ if (index >= 0 && index < length)
+ {
+ return data[index * 5 + 3];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /// <summary>
+ /// Return an attribute's value by index.
+ /// </summary>
+ /// <param name="index">The attribute's index (zero-based).</param>
+ /// <returns>The attribute's value or null if the index is out of bounds.</returns>
+ /// <seealso cref="Attributes.GetValue(int)"/>
+ public virtual string GetValue(int index)
+ {
+ if (index >= 0 && index < length)
+ {
+ return data[index * 5 + 4];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /// <summary>
+ /// Look up an attribute's index by Namespace name.
+ /// </summary>
+ /// <remarks>In many cases, it will be more efficient to look up the name once and
+ /// use the index query methods rather than using the name query methods
+ /// repeatedly.</remarks>
+ /// <param name="index">The attribute's Namespace URI, or the empty
+ /// string if none is available.</param>
+ /// <param name="localName">The attribute's local name.</param>
+ /// <returns>The attribute's index, or -1 if none matches.</returns>
+ /// <seealso cref="Attributes.GetIndex(string, string)"/>
+ public virtual int GetIndex(string uri, string localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5)
+ {
+ if (data[i].Equals(uri, StringComparison.Ordinal) && data[i + 1].Equals(localName, StringComparison.Ordinal))
+ {
+ return i / 5;
+ }
+ }
+ return -1;
+ }
+
+
+ /// <summary>
+ /// Look up an attribute's index by qualified (prefixed) name.
+ /// </summary>
+ /// <param name="qName">The qualified name.</param>
+ /// <returns>The attribute's index, or -1 if none matches.</returns>
+ /// <seealso cref="Attributes.GetIndex(string)"/>
+ public virtual int GetIndex(string qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5)
+ {
+ if (data[i + 2].Equals(qName, StringComparison.Ordinal))
+ {
+ return i / 5;
+ }
+ }
+ return -1;
+ }
+
+
+ /// <summary>
+ /// Look up an attribute's type by Namespace-qualified name.
+ /// </summary>
+ /// <param name="uri">The Namespace URI, or the empty string for a name
+ /// with no explicit Namespace URI.</param>
+ /// <param name="localName">The local name.</param>
+ /// <returns>The attribute's type, or null if there is no matching attribute.</returns>
+ /// <seealso cref="Attributes.GetType(string, string)"/>
+ public virtual string GetType(string uri, string localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5)
+ {
+ if (data[i].Equals(uri, StringComparison.Ordinal) && data[i + 1].Equals(localName, StringComparison.Ordinal))
+ {
+ return data[i + 3];
+ }
+ }
+ return null;
+ }
+
+
+ /// <summary>
+ /// Look up an attribute's type by qualified (prefixed) name.
+ /// </summary>
+ /// <param name="qName">The qualified name.</param>
+ /// <returns>The attribute's type, or null if there is no
+ /// matching attribute.</returns>
+ /// <seealso cref="Attributes.GetType(string)"/>
+ public virtual string GetType(string qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5)
+ {
+ if (data[i + 2].Equals(qName, StringComparison.Ordinal))
+ {
+ return data[i + 3];
+ }
+ }
+ return null;
+ }
+
+
+ /// <summary>
+ /// Look up an attribute's value by Namespace-qualified name.
+ /// </summary>
+ /// <param name="uri">The Namespace URI, or the empty string for a name
+ /// with no explicit Namespace URI.</param>
+ /// <param name="localName">The local name.</param>
+ /// <returns>The attribute's value, or null if there is no matching attribute.</returns>
+ /// <seealso cref="Attributes.GetValue(string, string)"/>
+ public virtual string GetValue(string uri, string localName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5)
+ {
+ if (data[i].Equals(uri, StringComparison.Ordinal) && data[i + 1].Equals(localName, StringComparison.Ordinal))
+ {
+ return data[i + 4];
+ }
+ }
+ return null;
+ }
+
+
+ /// <summary>
+ /// Look up an attribute's value by qualified (prefixed) name.
+ /// </summary>
+ /// <param name="qName">The qualified name.</param>
+ /// <returns>The attribute's value, or null if there is no
+ /// matching attribute.</returns>
+ /// <seealso cref="Attributes.GetValue(string)"/>
+ public virtual string GetValue(string qName)
+ {
+ int max = length * 5;
+ for (int i = 0; i < max; i += 5)
+ {
+ if (data[i + 2].Equals(qName, StringComparison.Ordinal))
+ {
+ return data[i + 4];
+ }
+ }
+ return null;
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Manipulators.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /// <summary>
+ /// Clear the attribute list for reuse.
+ /// <para/>
+ /// Note that little memory is freed by this call:
+ /// the current array is kept so it can be
+ /// reused.
+ /// <summary>
+ public virtual void Clear()
+ {
+ if (data != null)
+ {
+ for (int i = 0; i < (length * 5); i++)
+ data[i] = null;
+ }
+ length = 0;
+ }
+
+ /// <summary>
+ /// Copy an entire Attributes object.
+ /// <para/>
+ /// It may be more efficient to reuse an existing object
+ /// rather than constantly allocating new ones.
+ /// </summary>
+ /// <param name="atts">The attributes to copy.</param>
+ public virtual void SetAttributes(IAttributes atts)
+ {
+ Clear();
+ length = atts.Length;
+ if (length > 0)
+ {
+ data = new string[length * 5];
+ for (int i = 0; i < length; i++)
+ {
+ data[i * 5] = atts.GetURI(i);
+ data[i * 5 + 1] = atts.GetLocalName(i);
+ data[i * 5 + 2] = atts.GetQName(i);
+ data[i * 5 + 3] = atts.GetType(i);
+ data[i * 5 + 4] = atts.GetValue(i);
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// Add an attribute to the end of the list.
+ /// <para/>For the sake of speed, this method does no checking
+ /// to see if the attribute is already in the list: that is
+ /// the responsibility of the application.
+ /// </summary>
+ /// <param name="uri">The Namespace URI, or the empty string if
+ /// none is available or Namespace processing is not
+ /// being performed.</param>
+ /// <param name="localName">The local name, or the empty string if
+ /// Namespace processing is not being performed.</param>
+ /// <param name="qName">The qualified (prefixed) name, or the empty string
+ /// if qualified names are not available.</param>
+ /// <param name="type">The attribute type as a string.</param>
+ /// <param name="value">The attribute value.</param>
+ public virtual void AddAttribute(string uri, string localName, string qName,
+ string type, string value)
+ {
+ EnsureCapacity(length + 1);
+ data[length * 5] = uri;
+ data[length * 5 + 1] = localName;
+ data[length * 5 + 2] = qName;
+ data[length * 5 + 3] = type;
+ data[length * 5 + 4] = value;
+ length++;
+ }
+
+
+ /// <summary>
+ /// Set an attribute in the list.
+ ///
+ /// <para/>For the sake of speed, this method does no checking
+ /// for name conflicts or well-formedness: such checks are the
+ /// responsibility of the application.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <param name="uri">The Namespace URI, or the empty string if
+ /// none is available or Namespace processing is not
+ /// being performed.</param>
+ /// <param name="localName">The local name, or the empty string if
+ /// Namespace processing is not being performed.</param>
+ /// <param name="qName">The qualified name, or the empty string
+ /// if qualified names are not available.</param>
+ /// <param name="type">The attribute type as a string.</param>
+ /// <param name="value">The attribute value.</param>
+ /// <exception cref="IndexOutOfRangeException">When the
+ /// supplied index does not point to an attribute
+ /// in the list.</exception>
+ public virtual void SetAttribute(int index, string uri, string localName,
+ string qName, string type, string value)
+ {
+ if (index >= 0 && index < length)
+ {
+ data[index * 5] = uri;
+ data[index * 5 + 1] = localName;
+ data[index * 5 + 2] = qName;
+ data[index * 5 + 3] = type;
+ data[index * 5 + 4] = value;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ /// <summary>
+ /// Remove an attribute from the list.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <exception cref="IndexOutOfRangeException">When the supplied index does not point to an attribute in the list.</exception>
+ public virtual void RemoveAttribute(int index)
+ {
+ if (index >= 0 && index < length)
+ {
+ if (index < length - 1)
+ {
+ System.Array.Copy(data, (index + 1) * 5, data, index * 5,
+ (length - index - 1) * 5);
+ }
+ index = (length - 1) * 5;
+ data[index++] = null;
+ data[index++] = null;
+ data[index++] = null;
+ data[index++] = null;
+ data[index] = null;
+ length--;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ /// <summary>
+ /// Set the Namespace URI of a specific attribute.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <param name="uri">The attribute's Namespace URI, or the empty
+ /// string for none.</param>
+ /// <exception cref="IndexOutOfRangeException">When the
+ /// supplied index does not point to an attribute
+ /// in the list.</exception>
+ public virtual void SetURI(int index, string uri)
+ {
+ if (index >= 0 && index < length)
+ {
+ data[index * 5] = uri;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ /// <summary>
+ /// Set the local name of a specific attribute.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <param name="localName">The attribute's local name, or the empty
+ /// string for none.</param>
+ /// <exception cref="IndexOutOfRangeException">When the
+ /// supplied index does not point to an attribute
+ /// in the list.</exception>
+ public virtual void SetLocalName(int index, string localName)
+ {
+ if (index >= 0 && index < length)
+ {
+ data[index * 5 + 1] = localName;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ /// <summary>
+ /// Set the qualified name of a specific attribute.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <param name="qName">The attribute's qualified name, or the empty
+ /// string for none.</param>
+ /// <exception cref="IndexOutOfRangeException">When the
+ /// supplied index does not point to an attribute
+ /// in the list.</exception>
+ public virtual void SetQName(int index, string qName)
+ {
+ if (index >= 0 && index < length)
+ {
+ data[index * 5 + 2] = qName;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ /// <summary>
+ /// Set the type of a specific attribute.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <param name="type">The attribute's type.</param>
+ /// <exception cref="IndexOutOfRangeException">When the
+ /// supplied index does not point to an attribute
+ /// in the list.</exception>
+ public virtual void SetType(int index, string type)
+ {
+ if (index >= 0 && index < length)
+ {
+ data[index * 5 + 3] = type;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ /// <summary>
+ /// Set the value of a specific attribute.
+ /// </summary>
+ /// <param name="index">The index of the attribute (zero-based).</param>
+ /// <param name="value">The attribute's value.</param>
+ /// <exception cref="IndexOutOfRangeException">When the
+ /// supplied index does not point to an attribute
+ /// in the list.</exception>
+ public virtual void SetValue(int index, string value)
+ {
+ if (index >= 0 && index < length)
+ {
+ data[index * 5 + 4] = value;
+ }
+ else
+ {
+ BadIndex(index);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////////
+
+ /// <summary>
+ /// Ensure the internal array's capacity.
+ /// </summary>
+ /// <param name="n">The minimum number of attributes that the array must be able to hold.</param>
+ private void EnsureCapacity(int n)
+ {
+ if (n <= 0)
+ {
+ return;
+ }
+ int max;
+ if (data == null || data.Length == 0)
+ {
+ max = 25;
+ }
+ else if (data.Length >= n * 5)
+ {
+ return;
+ }
+ else
+ {
+ max = data.Length;
+ }
+ while (max < n * 5)
+ {
+ max *= 2;
+ }
+
+ string[] newData = new string[max];
+ if (length > 0)
+ {
+ System.Array.Copy(data, 0, newData, 0, length * 5);
+ }
+ data = newData;
+ }
+
+ /// <summary>
+ /// Report a bad array index in a manipulator.
+ /// </summary>
+ /// <param name="index">The index to report.</param>
+ /// <exception cref="IndexOutOfRangeException">Always.</exception>
+ private void BadIndex(int index)
+ {
+ string msg =
+ "Attempt to modify attribute at illegal index: " + index;
+ throw new IndexOutOfRangeException(msg);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ int length;
+ string[] data;
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Helpers/DefaultHandler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/DefaultHandler.cs b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/DefaultHandler.cs
new file mode 100644
index 0000000..d3523a4
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/DefaultHandler.cs
@@ -0,0 +1,389 @@
+// DefaultHandler.java - default implementation of the core handlers.
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: DefaultHandler.java,v 1.9 2004/04/26 17:34:35 dmegginson Exp $
+
+namespace Sax.Helpers
+{
+ /// <summary>
+ /// Default base class for SAX2 event handlers.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with<strong> NO WARRANTY</strong>.</em>
+ /// See<a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ /// for further information.
+ /// <para/>
+ /// This class is available as a convenience base class for SAX2
+ /// applications: it provides default implementations for all of the
+ /// callbacks in the four core SAX2 handler classes:
+ /// <list type="number">
+ /// <item><description><see cref="IEntityResolver"/></description></item>
+ /// <item><description><see cref="IDTDHandler"/></description></item>
+ /// <item><description><see cref="IContentHandler"/></description></item>
+ /// <item><description><see cref="IErrorHandler"/></description></item>
+ /// </list>
+ /// <para/>
+ /// Application writers can extend this class when they need to
+ /// implement only part of an interface; parser writers can
+ /// instantiate this class to provide default handlers when the
+ /// application has not supplied its own.
+ /// <para/>
+ /// This class replaces the deprecated SAX1
+ /// Sax.HandlerBase class.
+ /// </remarks>
+ /// <since>SAX 2.0</since>
+ /// <author>David Megginson,</author>
+ /// <version>2.0.1 (sax2r2)</version>
+ /// <seealso cref="IEntityResolver"/>
+ /// <seealso cref="IDTDHandler"/>
+ /// <seealso cref="IContentHandler"/>
+ /// <seealso cref="IErrorHandler"/>
+ public class DefaultHandler : IEntityResolver, IDTDHandler, IContentHandler, IErrorHandler
+ {
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the EntityResolver interface.
+ ////////////////////////////////////////////////////////////////////
+
+ /// <summary>
+ /// Resolve an external entity.
+ /// <para/>
+ /// Always return null, so that the parser will use the system
+ /// identifier provided in the XML document. This method implements
+ /// the SAX default behaviour: application writers can override it
+ /// in a subclass to do special translations such as catalog lookups
+ /// or URI redirection.
+ /// </summary>
+ /// <param name="publicId">The public identifer, or null if none is available.</param>
+ /// <param name="systemId">The system identifier provided in the XML document.</param>
+ /// <remarks>The new input source, or null to require the default behaviour.</remarks>
+ /// <exception cref="System.IO.IOException">If there is an error setting
+ /// up the new input source.</exception>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IEntityResolver.ResolveEntity(string, string)"/>
+ public virtual InputSource ResolveEntity(string publicId, string systemId)
+ {
+ return null;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of DTDHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /// <summary>
+ /// Receive notification of a notation declaration.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass if they wish to keep track of the notations
+ /// declared in a document.
+ /// </summary>
+ /// <param name="name">The notation name.</param>
+ /// <param name="publicId">The notation public identifier, or null if not
+ /// available.</param>
+ /// <param name="systemId">The notation system identifier.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IDTDHandler.NotationDecl(string, string, string)"/>
+ public virtual void NotationDecl(string name, string publicId, string systemId)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of an unparsed entity declaration.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to keep track of the unparsed entities
+ /// declared in a document.
+ /// </summary>
+ /// <param name="name">The entity name.</param>
+ /// <param name="publicId">The entity public identifier, or null if not available.</param>
+ /// <param name="systemId">The entity system identifier.</param>
+ /// <param name="notationName">The name of the associated notation.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IDTDHandler.UnparsedEntityDecl(string, string, string, string)"/>
+ public virtual void UnparsedEntityDecl(string name, string publicId,
+ string systemId, string notationName)
+ {
+ // no op
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of ContentHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /// <summary>
+ /// Receive a Locator object for document events.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass if they wish to store the locator for use
+ /// with other document events.
+ /// </summary>
+ /// <param name="locator">A locator for all SAX document events.</param>
+ /// <seealso cref="IContentHandler.SetDocumentLocator(ILocator)"/>
+ /// <seealso cref="ILocator"/>
+ public virtual void SetDocumentLocator(ILocator locator)
+ {
+ // no op
+ }
+
+ /// <summary>
+ /// Receive notification of the beginning of the document.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions at the beginning
+ /// of a document (such as allocating the root node of a tree or
+ /// creating an output file).
+ /// </summary>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.StartDocument()"/>
+ public virtual void StartDocument()
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of the end of the document.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions at the end
+ /// of a document (such as finalising a tree or closing an output
+ /// file).
+ /// </summary>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.EndDocument()"/>
+ public virtual void EndDocument()
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of the start of a Namespace mapping.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions at the start of
+ /// each Namespace prefix scope (such as storing the prefix mapping).
+ /// </summary>
+ /// <param name="prefix">The Namespace prefix being declared.</param>
+ /// <param name="uri">The Namespace URI mapped to the prefix.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.StartPrefixMapping(string, string)"/>
+ public virtual void StartPrefixMapping(string prefix, string uri)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of the end of a Namespace mapping.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions at the end of
+ /// each prefix mapping.
+ /// </summary>
+ /// <param name="prefix">The Namespace prefix being declared.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.EndPrefixMapping(string)"/>
+ public virtual void EndPrefixMapping(string prefix)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of the start of an element.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions at the start of
+ /// each element (such as allocating a new tree node or writing
+ /// output to a file).
+ /// </summary>
+ /// <param name="prefix">The Namespace URI, or the empty string if the
+ /// element has no Namespace URI or if Namespace
+ /// processing is not being performed.</param>
+ /// <param name="localName">The local name (without prefix), or the
+ /// empty string if Namespace processing is not being
+ /// performed.</param>
+ /// <param name="qName">The qualified name (with prefix), or the
+ /// empty string if qualified names are not available.</param>
+ /// <param name="attributes">The attributes attached to the element. If
+ /// there are no attributes, it shall be an empty
+ /// <see cref="Attributes"/> object.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.StartElement(string, string, string, IAttributes)"/>
+ public virtual void StartElement(string uri, string localName,
+ string qName, IAttributes attributes)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of the end of an element.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions at the end of
+ /// each element (such as finalising a tree node or writing
+ /// output to a file).
+ /// </summary>
+ /// <param name="uri">The Namespace URI, or the empty string if the
+ /// element has no Namespace URI or if Namespace
+ /// processing is not being performed.</param>
+ /// <param name="localName">The local name (without prefix), or the
+ /// empty string if Namespace processing is not being
+ /// performed.</param>
+ /// <param name="qName">The qualified name (with prefix), or the
+ /// empty string if qualified names are not available.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.EndElement(string, string, string)"/>
+ public virtual void EndElement(string uri, string localName, string qName)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of character data inside an element.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method to take specific actions for each chunk of character data
+ /// (such as adding the data to a node or buffer, or printing it to
+ /// a file).
+ /// </summary>
+ /// <param name="ch">The characters.</param>
+ /// <param name="start">The start position in the character array.</param>
+ /// <param name="length">The number of characters to use from the character array.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.Characters(char[], int, int)"/>
+ public virtual void Characters(char[] ch, int start, int length)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of ignorable whitespace in element content.
+ /// <para/>
+ /// By default, do nothing. Application writers may override this
+ /// method to take specific actions for each chunk of ignorable
+ /// whitespace (such as adding data to a node or buffer, or printing
+ /// it to a file).
+ /// </summary>
+ /// <param name="ch">The whitespace characters.</param>
+ /// <param name="start">The start position in the character array.</param>
+ /// <param name="length">The number of characters to use from the character array.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.IgnorableWhitespace(char[], int, int)"/>
+ public virtual void IgnorableWhitespace(char[] ch, int start, int length)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of a processing instruction.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions for each
+ /// processing instruction, such as setting status variables or
+ /// invoking other methods.
+ /// </summary>
+ /// <param name="target">The processing instruction target.</param>
+ /// <param name="data">The processing instruction data, or null if
+ /// none is supplied.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.ProcessingInstruction(string, string)"/>
+ public virtual void ProcessingInstruction(string target, string data)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of a skipped entity.
+ /// <para/>By default, do nothing. Application writers may override this
+ /// method in a subclass to take specific actions for each
+ /// processing instruction, such as setting status variables or
+ /// invoking other methods.
+ /// </summary>
+ /// <param name="name">The name of the skipped entity.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IContentHandler.ProcessingInstruction(string, string)"/>
+ public virtual void SkippedEntity(string name)
+ {
+ // no op
+ }
+
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Default implementation of the ErrorHandler interface.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /// <summary>
+ /// Receive notification of a parser warning.
+ /// <para/>
+ /// The default implementation does nothing. Application writers
+ /// may override this method in a subclass to take specific actions
+ /// for each warning, such as inserting the message in a log file or
+ /// printing it to the console.
+ /// </summary>
+ /// <param name="e">The warning information encoded as an exception.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IErrorHandler.Warning(SAXParseException)"/>
+ /// <seealso cref="SAXParseException"/>
+ public virtual void Warning(SAXParseException e)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Receive notification of a recoverable parser error.
+ /// <para/>The default implementation does nothing. Application writers
+ /// may override this method in a subclass to take specific actions
+ /// for each error, such as inserting the message in a log file or
+ /// printing it to the console.
+ /// </summary>
+ /// <param name="e">The warning information encoded as an exception.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IErrorHandler.Warning(SAXParseException)"/>
+ /// <seealso cref="SAXParseException"/>
+ public virtual void Error(SAXParseException e)
+ {
+ // no op
+ }
+
+
+ /// <summary>
+ /// Report a fatal XML parsing error.
+ /// <para/>
+ /// The default implementation throws a <see cref="SAXParseException"/>.
+ /// Application writers may override this method in a subclass if
+ /// they need to take specific actions for each fatal error (such as
+ /// collecting all of the errors into a single report): in any case,
+ /// the application must stop all regular processing when this
+ /// method is invoked, since the document is no longer reliable, and
+ /// the parser may no longer report parsing events.
+ /// </summary>
+ /// <param name="e">The error information encoded as an exception.</param>
+ /// <exception cref="SAXException">Any SAX exception, possibly
+ /// wrapping another exception.</exception>
+ /// <seealso cref="IErrorHandler.FatalError(SAXParseException)"/>
+ /// <seealso cref="SAXParseException"/>
+ public virtual void FatalError(SAXParseException e)
+ {
+ throw e;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/198e5868/src/Lucene.Net.Benchmark/Support/Sax/Helpers/LocatorImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Benchmark/Support/Sax/Helpers/LocatorImpl.cs b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/LocatorImpl.cs
new file mode 100644
index 0000000..8356240
--- /dev/null
+++ b/src/Lucene.Net.Benchmark/Support/Sax/Helpers/LocatorImpl.cs
@@ -0,0 +1,131 @@
+// SAX default implementation for Locator.
+// http://www.saxproject.org
+// No warranty; no copyright -- use this as you will.
+// $Id: LocatorImpl.java,v 1.6 2002/01/30 20:52:27 dbrownell Exp $
+
+namespace Sax.Helpers
+{
+ /// <summary>
+ /// Provide an optional convenience implementation of <see cref="ILocator"/>.
+ /// </summary>
+ /// <remarks>
+ /// <em>This module, both source code and documentation, is in the
+ /// Public Domain, and comes with<strong> NO WARRANTY</strong>.</em>
+ /// See<a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ /// for further information.
+ /// <para/>
+ /// This class is available mainly for application writers, who
+ /// can use it to make a persistent snapshot of a locator at any
+ /// point during a document parse:
+ /// <code>
+ /// ILocator locator;
+ /// ILocator startloc;
+ ///
+ /// public void SetLocator(ILocator locator)
+ /// {
+ /// // note the locator
+ /// this.locator = locator;
+ /// }
+ ///
+ /// public void StartDocument()
+ /// {
+ /// // save the location of the start of the document
+ /// // for future use.
+ /// ILocator startloc = new Locator(locator);
+ /// }
+ /// </code>
+ /// <para/>
+ /// Normally, parser writers will not use this class, since it
+ /// is more efficient to provide location information only when
+ /// requested, rather than constantly updating a <see cref="ILocator"/> object.
+ /// </remarks>
+ public class Locator : ILocator
+ {
+ /// <summary>
+ /// Zero-argument constructor.
+ /// <para/>This will not normally be useful, since the main purpose
+ /// of this class is to make a snapshot of an existing <see cref="ILocator"/>.
+ /// <summary>
+ public Locator()
+ {
+ }
+
+ /// <summary>
+ /// Copy constructor.
+ /// <para/>
+ /// Create a persistent copy of the current state of a locator.
+ /// When the original locator changes, this copy will still keep
+ /// the original values (and it can be used outside the scope of
+ /// DocumentHandler methods).
+ /// <summary>
+ /// <param name="locator">The locator to copy.</param>
+ public Locator(ILocator locator)
+ {
+ publicId = locator.PublicId;
+ systemId = locator.SystemId;
+ lineNumber = locator.LineNumber;
+ columnNumber = locator.ColumnNumber;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Implementation of org.xml.sax.Locator
+ ////////////////////////////////////////////////////////////////////
+
+
+ /// <summary>
+ /// Gets the public identifier as a string, or null if none
+ /// is available.
+ /// </summary>
+ /// <seealso cref="ILocator.PublicId"/>
+ public string PublicId
+ {
+ get { return publicId; }
+ set { publicId = value; }
+ }
+
+
+ /// <summary>
+ /// Gets the system identifier as a string, or null if none
+ /// is available.
+ /// </summary>
+ /// <seealso cref="ILocator.SystemId"/>
+ public string SystemId
+ {
+ get { return systemId; }
+ set { systemId = value; }
+ }
+
+
+ /// <summary>
+ /// Gets the saved line number (1-based).
+ /// Returns the line number as an integer, or -1 if none is available.
+ /// </summary>
+ /// <seealso cref="ILocator.LineNumber"/>
+ public int LineNumber
+ {
+ get { return lineNumber; }
+ set { lineNumber = value; }
+ }
+
+
+ /// <summary>
+ /// Gets the saved column number (1-based).
+ /// Returns the column number as an integer, or -1 if none is available.
+ /// </summary>
+ /// <seealso cref="ILocator.ColumnNumber"/>
+ public int ColumnNumber
+ {
+ get { return columnNumber; }
+ set { columnNumber = value; }
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private string publicId;
+ private string systemId;
+ private int lineNumber;
+ private int columnNumber;
+ }
+}