Пример #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
 /// <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);
 }