blob: b7f6c09e32bb2071f291162d904a888a046b0e05 [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
2 * Copyright (c) 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
david_williams56777022005-04-11 06:21:55 +000011package org.eclipse.wst.html.core.internal.contentmodel;
nitind958d79a2004-11-23 19:23:00 +000012
13
14
david_williams4ad020f2005-04-18 08:00:30 +000015import org.eclipse.wst.html.core.internal.provisional.HTML40Namespace;
david_williamsc06c86f2005-03-18 18:23:41 +000016import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
17import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup;
18import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
nitind958d79a2004-11-23 19:23:00 +000019
20/**
21 * for SELECT.
22 */
23final class CtdSelect extends ComplexTypeDefinition {
24
25 /**
26 * @param elementCollection ElementCollection
27 */
28 public CtdSelect(ElementCollection elementCollection) {
29 super(elementCollection);
30 primaryCandidateName = HTML40Namespace.ElementName.OPTION;
31 }
32
33 /**
34 * (OPTGROUP | OPTION)+.
35 */
36 protected void createContent() {
37 if (content != null)
38 return; // already created.
39 if (collection == null)
40 return;
41
42 // ( | )+
43 content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
44 // OPTGROUP
45 CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.OPTGROUP);
46 if (dec != null)
47 content.appendChild(dec);
48 // OPTION
49 dec = collection.getNamedItem(HTML40Namespace.ElementName.OPTION);
50 if (dec != null)
51 content.appendChild(dec);
52 }
53
54 /**
55 * (OPTGROUP | OPTION)+.
56 * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
57 * those are defined in CMElementDeclaration.
58 */
59 public int getContentType() {
60 return CMElementDeclaration.ELEMENT;
61 }
62
63 /**
64 * @return java.lang.String
65 */
66 public String getTypeName() {
67 return ComplexTypeDefinitionFactory.CTYPE_SELECT;
68 }
69}