1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Yuriy Vashchuk (yvashchuk@gmail.com) - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.core
.filter
.xml
;
15 import java
.io
.IOException
;
17 import javax
.xml
.parsers
.ParserConfigurationException
;
18 import javax
.xml
.parsers
.SAXParserFactory
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
21 import org
.xml
.sax
.SAXException
;
22 import org
.xml
.sax
.XMLReader
;
25 * The SAX based XML parser
28 * @author Yuriy Vashchuk
29 * @author Patrick Tasse
31 public class TmfFilterXMLParser
{
33 private static ITmfFilterTreeNode fRoot
= null;
36 * The XMLParser constructor
38 * @param uri The XML file to parse
39 * @throws SAXException SAX exception
40 * @throws IOException IO exception
42 public TmfFilterXMLParser(final String uri
) throws SAXException
, IOException
{
44 SAXParserFactory m_parserFactory
= null;
45 m_parserFactory
= SAXParserFactory
.newInstance();
46 m_parserFactory
.setNamespaceAware(true);
48 XMLReader saxReader
= null;
51 saxReader
= m_parserFactory
.newSAXParser().getXMLReader();
52 saxReader
.setContentHandler(new TmfFilterContentHandler());
55 fRoot
= ((TmfFilterContentHandler
) saxReader
.getContentHandler()).getTree();
57 } catch (ParserConfigurationException e
) {
65 * @return The builded tree
67 public ITmfFilterTreeNode
getTree() {