View Javadoc

1   /*
2    * Copyright 1999-2006 Faculty of Mathematics, Physics
3    * and Informatics, Comenius University, Bratislava. This file is protected by
4    * the Mozilla Public License version 1.1 (the License); you may not use this
5    * file except in compliance with the License. You may obtain a copy of the
6    * License at http://euromath2.sourceforge.net/license.html Unless required by
7    * applicable law or agreed to in writing, software distributed under the
8    * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
9    * OF ANY KIND, either express or implied. See the License for the specific
10   * language governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.tests;
13  
14  import org.apache.xerces.parsers.DOMParser;
15  import org.apache.xerces.xni.Augmentations;
16  import org.apache.xerces.xni.XMLResourceIdentifier;
17  import org.apache.xerces.xni.XMLString;
18  import org.apache.xerces.xni.XNIException;
19  import org.w3c.dom.Document;
20  
21  import sk.uniba.euromath.config.EuromathConfig;
22  
23  /***
24   *
25   * @author Martin Vysny
26   */
27  public class EntityCorrectLoading extends DOMParser{
28  	public static void main(String[] args) {
29  		try {
30  			new EntityCorrectLoading().main();
31  		} catch (Exception ex) {
32  			ex.printStackTrace();
33  		}
34  	}
35  	public void main() throws Exception {
36  		TestTools.printTimer();
37  		System.out.println("Loading config.");
38  		EuromathConfig.setPluginRoot();
39  		EuromathConfig.initInstance();
40  		TestTools.printTimer();
41  		System.out.println("Loading document.");
42  		parse("../test/mo_ex.mml");
43  		Document doc=getDocument();
44  		TestTools.printTimer();
45  		System.out.println("Done.");
46  	}
47  	/* (non-Javadoc)
48  	 * @see org.apache.xerces.xni.XMLDTDHandler#unparsedEntityDecl(java.lang.String, org.apache.xerces.xni.XMLResourceIdentifier, java.lang.String, org.apache.xerces.xni.Augmentations)
49  	 */
50  	public void unparsedEntityDecl(String arg0, XMLResourceIdentifier arg1,
51  			String arg2, Augmentations arg3) throws XNIException {
52  		System.out.print(arg0+": ");
53  		System.out.println(arg3);
54  		// TODO Auto-generated method stub
55  		super.unparsedEntityDecl(arg0, arg1, arg2, arg3);
56  	}
57  	
58  	/* (non-Javadoc)
59  	 * @see org.apache.xerces.xni.XMLDTDHandler#externalEntityDecl(java.lang.String, org.apache.xerces.xni.XMLResourceIdentifier, org.apache.xerces.xni.Augmentations)
60  	 */
61  	public void externalEntityDecl(String arg0, XMLResourceIdentifier arg1,
62  			Augmentations arg2) throws XNIException {
63  		super.externalEntityDecl(arg0, arg1, arg2);
64  	}
65  	/* (non-Javadoc)
66  	 * @see org.apache.xerces.xni.XMLDTDHandler#internalEntityDecl(java.lang.String, org.apache.xerces.xni.XMLString, org.apache.xerces.xni.XMLString, org.apache.xerces.xni.Augmentations)
67  	 */
68  	public void internalEntityDecl(String arg0, XMLString arg1, XMLString arg2,
69  			Augmentations arg3) throws XNIException {
70  		if(arg0.charAt(0)!='%')  System.out.println(arg0+": "+arg1+"; "+arg3);
71  		super.internalEntityDecl(arg0, arg1, arg2, arg3);
72  	}
73  }