예제 #1
0
 public virtual bool GetFeature(string name)
 {
     if (_parent != null)
     {
         return(_parent.GetFeature(name));
     }
     throw new SAXNotRecognizedException("Feature: " + name);
 }
예제 #2
0
 /// <summary>
 /// Check and display the value of a feature.
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="name"></param>
 private static void checkFeature(IXmlReader reader, String name)
 {
     try {
         Console.WriteLine("  " + name + " = " + reader.GetFeature(name));
     } catch (SAXNotRecognizedException e) {
         Console.WriteLine("XMLReader does not recognize feature " + name);
     } catch (SAXNotSupportedException e) {
         Console.WriteLine("XMLReader recognizes feature " + name + " but does not support checking its value");
     }
 }
예제 #3
0
        /* IXmlReader */

        /// <summary>See <see href="http://www.saxproject.org/apidoc/org/xml/sax/helpers/XMLFilterImpl.html#getFeature(java.lang.String)">
        /// getFeature(java.lang.String)</see> on www.saxproject.org.</summary>
        /// <remarks>Difference to Java: Will throw <see cref="SaxException"/>
        /// if parent is <c>null</c>.</remarks>
        public bool GetFeature(string name)
        {
            CheckParent();
            return(parent.GetFeature(name));
        }
예제 #4
0
파일: SAXTest.cs 프로젝트: rasmusjp/sax.net
 /// <summary>
 /// Check and display the value of a feature.
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="name"></param>
 private static void checkFeature(IXmlReader reader, String name) {
   try {
     Console.WriteLine("  " + name + " = " + reader.GetFeature(name));
   } catch (SAXNotRecognizedException e) {
     Console.WriteLine("XMLReader does not recognize feature " + name);
   } catch (SAXNotSupportedException e) {
     Console.WriteLine("XMLReader recognizes feature " + name + " but does not support checking its value");
   }
 }
예제 #5
0
 /// <summary>
 /// Handles the output of the results of trying to set the feature. Returns true if the
 /// feature can be set without exception.
 /// </summary>
 public bool TryFeature(string feature, IXmlReader parser)
 {
     int slashPos = feature.LastIndexOf('/');
       string featureName = feature.Substring(slashPos + 1);
       try {
     if (!parser.GetFeature(feature))
       parser.SetFeature(feature, true);
     writer.WriteLine("    <" + featureName + ">true</" + featureName + ">");
     return true;
       } catch {
     writer.WriteLine("    <" + featureName + ">false</" + featureName + ">");
     return false;
       }
 }
예제 #6
0
 /// <summary>
 /// Handles setting the feature.
 /// </summary>
 public void SetFeature(string feature, IXmlReader parser, bool flag)
 {
     if (parser.GetFeature(feature) != flag)
     parser.SetFeature(feature, flag);
 }