/** * Processes the given sheet */ public void ProcessSheet( SheetContentsHandler sheetContentsExtractor, StylesTable styles, ReadOnlySharedStringsTable strings, InputStream sheetInputStream) { DataFormatter formatter; if (locale == null) { formatter = new DataFormatter(); } else { formatter = new DataFormatter(locale); } InputSource sheetSource = new InputSource(sheetInputStream); SAXParserFactory saxFactory = SAXParserFactory.newInstance(); try { SAXParser saxParser = saxFactory.newSAXParser(); XMLReader sheetParser = saxParser.GetXMLReader(); ContentHandler handler = new XSSFSheetXMLHandler( styles, strings, sheetContentsExtractor, formatter, formulasNotResults); sheetParser.SetContentHandler(handler); sheetParser.Parse(sheetSource); } catch (ParserConfigurationException e) { throw new RuntimeException("SAX Parser appears to be broken - " + e.GetMessage()); } }
protected internal virtual void loadXML() { try { try { try { SAXParserFactory saxparserFactory = SAXParserFactory.newInstance(); XMLReader xmlreader = saxparserFactory.newSAXParser().getXMLReader(); this.rules = new HashMap(); GrXMLHandler grXMLHandler = new GrXMLHandler(this.baseURL, this.rules, this.logger); xmlreader.setContentHandler(grXMLHandler); xmlreader.setErrorHandler(grXMLHandler); InputStream inputStream = this.baseURL.openStream(); xmlreader.parse(new InputSource(inputStream)); inputStream.close(); } catch (SAXParseException ex) { throw new IOException(new StringBuilder().append("Error while parsing line ").append(ex.getLineNumber()).append(" of ").append(this.baseURL).append(": ").append(ex.getMessage()).toString()); } } catch (SAXException ex3) { throw new IOException(new StringBuilder().append("Problem with XML: ").append(ex3).toString()); } } catch (ParserConfigurationException ex5) { throw new IOException(Throwable.instancehelper_getMessage(ex5)); } }
public virtual Map load() { try { try { try { SAXParserFactory saxparserFactory = SAXParserFactory.newInstance(); XMLReader xmlreader = saxparserFactory.newSAXParser().getXMLReader(); ConfigHandler contentHandler = new ConfigHandler(this.rpdMap, this.globalProperties, this.replaceDuplicates, this.url); xmlreader.setContentHandler(contentHandler); xmlreader.parse(this.url.toString()); } catch (SAXParseException ex) { throw new IOException(new StringBuilder().append("Error while parsing line ").append(ex.getLineNumber()).append(" of ").append(this.url).append(": ").append(ex.getMessage()).toString()); } } catch (SAXException ex3) { throw new IOException(new StringBuilder().append("Problem with XML: ").append(ex3).toString()); } } catch (ParserConfigurationException ex5) { throw new IOException(Throwable.instancehelper_getMessage(ex5)); } return(this.rpdMap); }
/// <summary> /// Creates a SAX parser using JAXP /// </summary> /// <returns> the created SAX parser </returns> internal static XMLReader createParser() { try { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.NamespaceAware = true; return(factory.newSAXParser().XMLReader); } catch (Exception e) { throw new Exception("Couldn't create XMLReader: " + e.Message); } }
protected internal ConstitParseSampleStream(ObjectStream <sbyte[]> samples) : base(samples) { SAXParserFactory factory = SAXParserFactory.newInstance(); try { saxParser = factory.newSAXParser(); } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } catch (SAXException e) { throw new IllegalStateException(e); } }