1 /*******************************************************************************
2 * Copyright (c) 2010 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
.linuxtools
.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
.linuxtools
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
22 import org
.xml
.sax
.SAXException
;
23 import org
.xml
.sax
.XMLReader
;
26 * <b><u>FilterXMLParser</u></b>
28 * This is SAX based XML parser
31 public class TmfFilterXMLParser
{
33 private static ITmfFilterTreeNode fRoot
= null;
36 * The XMLParser constructor
38 * @param uri The XML file to parse
40 public TmfFilterXMLParser(final String uri
) throws SAXException
, IOException
{
42 SAXParserFactory m_parserFactory
= null;
43 if (m_parserFactory
== null) {
44 m_parserFactory
= SAXParserFactory
.newInstance();
45 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() {