} catch (ParserConfigurationException pce) { pce.printStackTrace(); throw pce; } catch (IOException ioe) {
configParser.parseFile(includedFile); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace();
public void createFiles(OutputStream fos) throws IOException { try { final ScxmlStateDiagramStandard xmi; xmi = new ScxmlStateDiagramStandard(diagram); xmi.transformerXml(fos); } catch (ParserConfigurationException e) { Log.error(e.toString()); e.printStackTrace(); throw new IOException(e.toString()); } catch (TransformerException e) { Log.error(e.toString()); e.printStackTrace(); throw new IOException(e.toString()); } }
public void createFiles(OutputStream fos) throws IOException { try { final IXmiClassDiagram xmi; if (diagram instanceof StateDiagram) { xmi = new XmiStateDiagram((StateDiagram) diagram); } else if (diagram instanceof DescriptionDiagram) { xmi = new XmiDescriptionDiagram((DescriptionDiagram) diagram); } else if (fileFormat == FileFormat.XMI_STANDARD) { xmi = new XmiClassDiagramStandard((ClassDiagram) diagram); } else if (fileFormat == FileFormat.XMI_ARGO) { xmi = new XmiClassDiagramArgo((ClassDiagram) diagram); } else if (fileFormat == FileFormat.XMI_STAR) { xmi = new XmiClassDiagramStar((ClassDiagram) diagram); } else { throw new UnsupportedOperationException(); } xmi.transformerXml(fos); } catch (ParserConfigurationException e) { Log.error(e.toString()); e.printStackTrace(); throw new IOException(e.toString()); } catch (TransformerException e) { Log.error(e.toString()); e.printStackTrace(); throw new IOException(e.toString()); } }
public SvgGraphics(boolean svgDimensionStyle, Dimension2D minDim, String backcolor, double scale, String hover, long seed) { try { this.svgDimensionStyle = svgDimensionStyle; this.scale = scale; this.document = getDocument(); this.backcolor = backcolor; ensureVisible(minDim.getWidth(), minDim.getHeight()); this.root = getRootNode(); // Create a node named defs, which will be the parent // for a pair of linear gradient definitions. defs = simpleElement("defs"); gRoot = simpleElement("g"); strokeWidth = "" + scale; this.filterUid = "b" + getSeed(seed); this.shadowId = "f" + getSeed(seed); this.gradientId = "g" + getSeed(seed); if (hover != null) { defs.appendChild(getPathHover(hover)); } } catch (ParserConfigurationException e) { e.printStackTrace(); throw new IllegalStateException(e); } }
@Override protected List<ProvinceModel> doInBackground(Void... params) { if (null == mContext) return null; List<ProvinceModel> provinceList = new ArrayList<ProvinceModel>(); try { SAXParserFactory sax = SAXParserFactory.newInstance();// 创建解析器 XMLReader reader = sax.newSAXParser().getXMLReader(); InputStream in = mContext.getAssets().open("city.xml"); reader.setContentHandler(new ProvinceInfoHandler(provinceList));// 为reader设置内容处理器 reader.parse(new InputSource(in));// 开始解析文件 } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } return provinceList; }
private void doVersionCheck() { try { String warningMsg = "\nYou are using an outdated format for server-setup.xml. Please switch to the new format.\n"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder dbuilder = dbf.newDocumentBuilder(); File configFile = new File(_configFileName); Document d = dbuilder.parse(configFile); NodeList nodeList = d.getElementsByTagName("version"); if (nodeList.getLength() == 0) { System.out.println(warningMsg); return; } Node firstNode = nodeList.item(0); String version = firstNode.getTextContent(); if (!version.equals("2.0")) { System.out.println(warningMsg); } } catch (ParserConfigurationException parserException) { parserException.printStackTrace(); } catch (IOException ioException) { ioException.printStackTrace(); } catch (SAXException saxException) { saxException.printStackTrace(); } }
public ChildesFileIterator(Iterator<File> files) { super(files); oneUtterancePerDoc = true; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder d = null; try { d = dbf.newDocumentBuilder(); } catch (javax.xml.parsers.ParserConfigurationException pce) { pce.printStackTrace(); } db = d; }
public ChildesFileIterator(Iterator<File> files) { super(files); oneUtterancePerDoc = true; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder d = null; try { d = dbf.newDocumentBuilder(); } catch (javax.xml.parsers.ParserConfigurationException pce) { pce.printStackTrace(); } db = d; }
public DefaultDom() { dbf = DocumentBuilderFactory.newInstance(); try { db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } }
public FilterRunner(IRapidView rapidView, boolean limitLevel){ mLimitLevel = limitLevel; mRapidView = rapidView; try{ mFactory = DocumentBuilderFactory.newInstance(); mBuilder = mFactory.newDocumentBuilder(); mDocument = mBuilder.newDocument(); } catch (ParserConfigurationException e){ e.printStackTrace(); } }
public ActionRunner(IRapidView rapidView, boolean sandbox){ mLimitLevel = sandbox; mRapidView = rapidView; try{ mFactory = DocumentBuilderFactory.newInstance(); mBuilder = mFactory.newDocumentBuilder(); mDocument = mBuilder.newDocument(); } catch (ParserConfigurationException e){ e.printStackTrace(); } }
public XmlWriter() { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // root elements doc = docBuilder.newDocument(); parentNode = doc; } catch (ParserConfigurationException pce) { pce.printStackTrace(); } }
public static Document createDocumentNode() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null; try { builder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } return builder.newDocument(); }
public static Document loadXMLFromString(String xml) throws IOException, SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null; try { builder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } InputSource is = new InputSource(new StringReader(xml)); return builder.parse(is); } public int getNodeIndex(NodeList nl, String nodename) {
/** * Creates new form YunSuTest */ public YunSuTest() { dbf = DocumentBuilderFactory.newInstance(); try { db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } initComponents(); }
public ApplicationXmlDocument() { try { createDocument("server"); } catch (ParserConfigurationException e) { // it should never occur e.printStackTrace(); } }
public static FieldReferenceOffsetManager buildFROM() { try { return TemplateHandler.loadFrom("/template/smallExample.xml"); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
private void handlePart(PackagePart packagePart, XWPFListManager xwpfListManager, StringBuilder buffer) throws IOException, SAXException { Map<String, String> hyperlinks = loadHyperlinkRelationships(packagePart); try (InputStream stream = packagePart.getInputStream()) { XMLReader reader = SAXHelper.newXMLReader(); reader.setContentHandler(new OOXMLWordAndPowerPointTextHandler( new XWPFToTextContentHandler(buffer), hyperlinks)); reader.parse(new InputSource(new CloseShieldInputStream(stream))); } catch (ParserConfigurationException e) { e.printStackTrace(); } }
@BeforeClass public static void setup() { Common.connect(); Common.connectAdmin(); try { buildEnvironment(); } catch (ParserConfigurationException e) { e.printStackTrace(); } }