themeinstaller/source/src/com/nokia/tools/themeinstaller/odtconverter/ODTConverter.java
branchRCL_3
changeset 18 04b7640f6fb5
parent 0 05da4621cfb2
equal deleted inserted replaced
17:fe49e33862e2 18:04b7640f6fb5
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Interface class for parse operations
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.tools.themeinstaller.odtconverter;
       
    20 
       
    21 import java.io.IOException;
       
    22 
       
    23 import org.w3c.dom.Document;
       
    24 
       
    25 import com.nokia.tools.themeinstaller.cssparser.CSSParser;
       
    26 import com.nokia.tools.themeinstaller.xmlparser.XMLParser;
       
    27 
       
    28 /**
       
    29  * Interface class for parse operations
       
    30  */
       
    31 public class ODTConverter extends ParseOperation
       
    32     {
       
    33 
       
    34     /** ParserComposite */
       
    35     private ParserComposite iParserComposite;
       
    36 
       
    37     /** Listener for parse operations */
       
    38     IParseOperationListener iListener;
       
    39 
       
    40     /**
       
    41      * Constructor
       
    42      */
       
    43     public ODTConverter()
       
    44         {
       
    45         iParserComposite = new ParserComposite();
       
    46         }
       
    47 
       
    48     /**
       
    49      * Adds the listener.
       
    50      *
       
    51      * @param aListener listener for parse operations
       
    52      */
       
    53     public void addListener( IParseOperationListener aListener )
       
    54         {
       
    55         iParserComposite.addListener( aListener );
       
    56         }
       
    57 
       
    58     /**
       
    59      * Creates XMLParser and adds it to ParserComposite
       
    60      * @param aFileName
       
    61      */
       
    62     public void addXML( String aFileName )
       
    63         {
       
    64         XMLParser xmlConv = new XMLParser( aFileName );
       
    65         iParserComposite.addOperation( xmlConv );
       
    66         }
       
    67 
       
    68     /**
       
    69      * Creates XMLParser and adds it to ParserComposite. By using this method,
       
    70      * the XML parser will ignore DTD definition in DOCTYPE. The specified
       
    71      * external DTD file is used instead.
       
    72      * @param aFileName File name of the XML
       
    73      * @param aExtDTD File name of the external DTD
       
    74      */
       
    75     public void addXML( String aFileName, String aExtDTD )
       
    76         {
       
    77         XMLParser xmlConv = new XMLParser( aFileName, aExtDTD );
       
    78         iParserComposite.addOperation( xmlConv );
       
    79         }
       
    80 
       
    81     /**
       
    82      * Creates CSSParser and adds it to ParserComposite
       
    83      * @param aFileName
       
    84      */
       
    85     public void addCSS( String aFileName )
       
    86         {
       
    87         CSSParser cssConv = new CSSParser( aFileName );
       
    88         iParserComposite.addOperation( cssConv );
       
    89         }
       
    90 
       
    91 
       
    92     /* (non-Javadoc)
       
    93      * @see com.nokia.tools.themeinstaller.odtconverter.ParseOperation#parse()
       
    94      */
       
    95     public void parse( ) throws IOException, ODTException
       
    96         {
       
    97         iParserComposite.parse( );
       
    98         }
       
    99 
       
   100     /* (non-Javadoc)
       
   101      * @see com.nokia.tools.themeinstaller.odtconverter.ParseOperation#getDOMDocument()
       
   102      */
       
   103     public Document getDOMDocument()
       
   104         {
       
   105         return iParserComposite.getDOMDocument();
       
   106         }
       
   107 
       
   108     }