nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 2 | * Copyright (c) 2004, 2005 IBM Corporation and others. |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 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 |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 7 | * |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
david_williams | 5677702 | 2005-04-11 06:21:55 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.html.core.internal.contentmodel.chtml; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 12 | |
| 13 | |
| 14 | |
david_williams | c06c86f | 2005-03-18 18:23:41 +0000 | [diff] [blame] | 15 | import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; |
| 16 | import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup; |
| 17 | import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * for ADDRESS. |
| 21 | */ |
| 22 | final 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 | } |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 70 | } |