예제 #1
0
        /// <summary>
        /// Creates a new Base Parser Context
        /// </summary>
        /// <param name="handler">RDF Handler</param>
        /// <param name="traceParsing">Whether to trace parsing</param>
        public BaseParserContext(IRdfHandler handler, bool traceParsing)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            _handler      = handler;
            _traceParsing = traceParsing;

            _baseUri = _handler.GetBaseUri();
        }
예제 #2
0
 /// <summary>
 /// Gets the Base URI from the RDF Handler.
 /// </summary>
 /// <param name="handler">RDF Handler.</param>
 /// <returns></returns>
 internal static Uri GetBaseUri(this IRdfHandler handler)
 {
     if (handler is GraphHandler)
     {
         return(((GraphHandler)handler).BaseUri);
     }
     else if (handler is IWrappingRdfHandler)
     {
         IRdfHandler temp = ((IWrappingRdfHandler)handler).InnerHandlers.FirstOrDefault(h => h.GetBaseUri() != null);
         if (temp == null)
         {
             return(null);
         }
         else
         {
             return(temp.GetBaseUri());
         }
     }
     else
     {
         return(null);
     }
 }
예제 #3
0
 /// <summary>
 /// Creates a new Parser Context which uses Streaming parsing.
 /// </summary>
 /// <param name="handler">RDF Handler.</param>
 /// <param name="input">Input.</param>
 public RdfXmlParserContext(IRdfHandler handler, TextReader input)
     : base(handler)
 {
     _queue = new StreamingEventQueue <IRdfXmlEvent>(new StreamingEventGenerator(input, handler.GetBaseUri().ToSafeString()));
 }
예제 #4
0
 /// <summary>
 /// Creates a new Parser Context which uses Streaming parsing
 /// </summary>
 /// <param name="handler">RDF Handler</param>
 /// <param name="stream">Stream</param>
 public RdfXmlParserContext(IRdfHandler handler, Stream stream)
     : base(handler)
 {
     this._queue = new StreamingEventQueue <IRdfXmlEvent>(new StreamingEventGenerator(stream, handler.GetBaseUri().ToSafeString()));
 }