Skip to main content
summaryrefslogtreecommitdiffstats
blob: fefbbf04eff55af55f6993f93ee65a55fb4f054c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*******************************************************************************
 * Copyright (c) 2004, 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsp.core.internal.contentmodel;

import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocumentFactory;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType;

/**
 * CMDocument factory for JSP documents (which for now live in the HTML Core
 * plugin).
 */
public final class JSPCMDocumentFactory {

	private JSPCMDocumentFactory() {
		super();
	}

	public static CMDocument getCMDocument() {
		return getCMDocument(CMDocType.JSP20_DOC_TYPE);
	}

	/**
	 * @return org.eclipse.wst.xml.core.internal.contentmodel.CMDocument
	 * @param cmtype
	 *            java.lang.String
	 */
	public static CMDocument getCMDocument(String cmtype) {
		if (cmtype == null)
			return getCMDocument();
		return HTMLCMDocumentFactory.getCMDocument(cmtype);
	}

	public static CMDocument getCMDocument(float jspVersion) {
		if (jspVersion >= 2.1f)
			return getCMDocument(CMDocType.JSP21_DOC_TYPE);
		else if (jspVersion >= 2)
			return getCMDocument(CMDocType.JSP20_DOC_TYPE);
		else if (jspVersion >= 1.2f)
			return getCMDocument(CMDocType.JSP12_DOC_TYPE);
		else if (jspVersion >= 1)
			return getCMDocument(CMDocType.JSP11_DOC_TYPE);
		return getCMDocument();
	}
}

Back to the top