blob: 4ad13c025b276a9a2f9dec14d67285b9b53b133e [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
amywu923ee602007-04-10 18:32:07 +00002 * Copyright (c) 2004, 2005 IBM Corporation and others.
nitind958d79a2004-11-23 19:23:00 +00003 * 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
amywu923ee602007-04-10 18:32:07 +00007 *
nitind958d79a2004-11-23 19:23:00 +00008 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
david_williams56777022005-04-11 06:21:55 +000011package org.eclipse.wst.html.core.internal.contentmodel.chtml;
nitind958d79a2004-11-23 19:23:00 +000012
13
14
david_williamsc06c86f2005-03-18 18:23:41 +000015import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
16import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup;
17import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
nitind958d79a2004-11-23 19:23:00 +000018
19/**
20 * for ADDRESS.
21 */
22final class CtdAddress extends ComplexTypeDefinition {
23
24 /**
25 * @param elementCollection ElementCollection
26 */
27 public CtdAddress(ElementCollection elementCollection) {
28 super(elementCollection);
29 }
30
31 /**
32 * ((%inline) | P)*.
33 */
34 protected void createContent() {
35 if (content != null)
36 return; // already created.
37 if (collection == null)
38 return;
39
40 // ( | )*
41 content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
42 // (%inline)
43 CMGroupImpl inlines = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
44 if (inlines == null)
45 return;
46 collection.getInline(inlines);
47 content.appendChild(inlines);
48 // P
49 CMNode p = collection.getNamedItem(CHTMLNamespace.ElementName.P);
50 if (p != null)
51 content.appendChild(p);
52 }
53
54 /**
55 * ((%inline) | P)*.
56 * Because %inline; contains #PCDATA, the type is MIXED.
57 * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
58 * those are defined in CMElementDeclaration.
59 */
60 public int getContentType() {
61 return CMElementDeclaration.MIXED;
62 }
63
64 /**
65 * @return java.lang.String
66 */
67 public String getTypeName() {
68 return ComplexTypeDefinitionFactory.CTYPE_ADDRESS;
69 }
amywu923ee602007-04-10 18:32:07 +000070}