コード例 #1
0
            public virtual void  load()
            {
                if (loaded)
                {
                    return;
                }
                try
                {
                    System.IO.Stream      inStream = new System.IO.BufferedStream(System.Net.WebRequest.Create(this.url).GetResponse().GetResponseStream());
                    XmlSAXDocumentManager factory  = XmlSAXDocumentManager.NewInstance();
                    factory.NamespaceAllowed = false;                     // FIXME

                    XLRHandler   xmlHandler   = new XLRHandler(Enclosing_Instance.nodedict, prefix);
                    CDATAHandler cdataHandler = new CDATAHandler(xmlHandler);

                    XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(factory);
                    //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.setProperty' was converted to 'XmlSAXDocumentManager.setProperty' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersSAXParsersetProperty_javalangString_javalangObject'"
                    parser.setProperty("http://xml.org/sax/properties/lexical-handler", cdataHandler);
                    parser.parse(inStream, xmlHandler);
                }
                catch (System.Exception e)
                {
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
                loaded = true;
            }
コード例 #2
0
		/// <summary>
		/// Returns a clone instance of 'XmlSAXDocumentManager'.
		/// </summary>
		/// <returns>A clone 'XmlSAXDocumentManager' instance.</returns>
		public static XmlSAXDocumentManager CloneInstance(XmlSAXDocumentManager instance)
		{
			XmlSAXDocumentManager temp = new XmlSAXDocumentManager();
			temp.NamespaceAllowed = instance.NamespaceAllowed;
			temp.isValidating = instance.isValidating;
			XmlSaxContentHandler contentHandler = instance.getContentHandler();
			if (contentHandler != null)
				temp.setContentHandler(contentHandler);
			XmlSaxErrorHandler errorHandler = instance.getErrorHandler();
			if (errorHandler != null)
				temp.setErrorHandler(errorHandler);
			temp.setFeature("http://xml.org/sax/features/namespaces", instance.getFeature("http://xml.org/sax/features/namespaces"));
			temp.setFeature("http://xml.org/sax/features/namespace-prefixes", instance.getFeature("http://xml.org/sax/features/namespace-prefixes"));
			temp.setFeature("http://xml.org/sax/features/validation", instance.getFeature("http://xml.org/sax/features/validation"));
			temp.setProperty("http://xml.org/sax/properties/lexical-handler", instance.getProperty("http://xml.org/sax/properties/lexical-handler"));
			temp.parserFileName = instance.parserFileName;
			return temp;
		}