KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > xmi > impl > GenericXMLResourceFactoryImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2005 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: GenericXMLResourceFactoryImpl.java,v 1.2 2005/06/12 13:31:45 emerks Exp $
16  */

17 package org.eclipse.emf.ecore.xmi.impl;
18
19 import org.eclipse.emf.common.util.URI;
20 import org.eclipse.emf.ecore.resource.Resource;
21 import org.eclipse.emf.ecore.xmi.XMLResource;
22 import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
23
24 public class GenericXMLResourceFactoryImpl extends XMLResourceFactoryImpl
25 {
26   public GenericXMLResourceFactoryImpl()
27   {
28     super();
29   }
30
31   public Resource createResource(URI uri)
32   {
33     XMLResource result = new GenericXMLResourceImpl(uri);
34     result.setEncoding("UTF-8");
35     
36     result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
37     result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
38
39     result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
40
41     result.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, new Integer JavaDoc(80));
42     
43     result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
44
45     result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
46     
47     return result;
48   }
49 }
Popular Tags