Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.wst.css.core/.classpath7
-rw-r--r--bundles/org.eclipse.wst.css.core/.compatibility2
-rw-r--r--bundles/org.eclipse.wst.css.core/.cvsignore5
-rw-r--r--bundles/org.eclipse.wst.css.core/.options2
-rw-r--r--bundles/org.eclipse.wst.css.core/.project28
-rw-r--r--bundles/org.eclipse.wst.css.core/build.properties22
-rw-r--r--bundles/org.eclipse.wst.css.core/cssprofile/css-profile.dtd132
-rw-r--r--bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css1.xml826
-rw-r--r--bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css2.xml2258
-rw-r--r--bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-mobile1_0.xml146
-rw-r--r--bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-wap.xml614
-rw-r--r--bundles/org.eclipse.wst.css.core/cssprofile/cssprofile.properties34
-rw-r--r--bundles/org.eclipse.wst.css.core/plugin.properties16
-rw-r--r--bundles/org.eclipse.wst.css.core/plugin.xml99
-rw-r--r--bundles/org.eclipse.wst.css.core/src/ModelsCSS.properties31
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/CSSCorePlugin.java129
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/ICSSModelAdapter.java24
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IModelProvideAdapter.java35
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleDeclarationAdapter.java25
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSelectorAdapter.java33
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetAdapter.java41
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetListAdapter.java41
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategy.java98
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategyImpl.java191
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CleanupProcessorCSS.java131
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAccess.java26
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAttr.java40
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSCharsetRule.java23
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSDocument.java98
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSImportRule.java34
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSMediaRule.java22
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSModel.java49
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNamedNodeMap.java26
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNode.java94
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNodeList.java31
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPageRule.java28
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPrimitiveValue.java46
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSRuleContainer.java60
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelector.java67
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorCombinator.java29
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorItem.java32
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorList.java62
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSimpleSelector.java77
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclItem.java73
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclaration.java46
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleRule.java28
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleSheet.java47
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValue.java26
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValueList.java35
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICounter.java49
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDOMImplementationCSS.java28
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDocumentStyle.java62
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleListener.java32
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleNotifier.java40
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/CSSSourceFormatter.java49
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/FormatProcessorCSS.java112
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/Logger.java154
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizer.java1357
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizerConstants.java19
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSResourceEncodingDetector.java149
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/ContentDescriberForCSS.java24
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IMediaGroupID.java34
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IValID.java266
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMContainer.java164
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFontProperty.java198
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFunction.java89
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNode.java1369
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNumber.java220
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMProperty.java417
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMString.java86
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMSubProperty.java122
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMURange.java81
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMUtil.java48
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/AbstractCSSNodeList.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSAttrImpl.java151
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSCharsetRuleImpl.java94
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDeclarationItemParser.java1077
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDocumentImpl.java183
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSFontFaceRuleImpl.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSImportRuleImpl.java234
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSMediaRuleImpl.java244
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelCreationContext.java155
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelDeletionContext.java268
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelImpl.java677
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelNodeFeeder.java122
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelParser.java1281
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdateContext.java416
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdater.java583
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUtil.java301
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNamedNodeMapImpl.java48
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java559
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeListImpl.java38
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPageRuleImpl.java111
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveContainer.java56
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveValueImpl.java374
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRegionContainer.java257
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleDeclContainer.java58
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleImpl.java84
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleListImpl.java45
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelector.java427
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorCombinator.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorItem.java42
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorListImpl.java212
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorParser.java335
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSimpleSelector.java281
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStructuredDocumentRegionContainer.java265
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclItemImpl.java258
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationFactoryContext.java69
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationImpl.java306
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleRuleImpl.java110
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleSheetImpl.java628
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSUnknownRuleImpl.java79
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CounterImpl.java128
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/DOMCSSImpl.java54
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/MediaListImpl.java166
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RGBColorImpl.java108
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RectImpl.java122
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/StyleSheetListImpl.java44
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/ByteUtil.java228
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentCharsetDetector.java126
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentLoader.java87
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSEmbededStyleNotifyAdapter.java60
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleEventDeliverer.java155
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleNotifyAdapter.java174
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java974
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrChangeContext.java29
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrFormatter.java165
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSFormatUtil.java165
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatter.java48
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatterFactory.java81
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceGenerator.java61
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CharsetRuleFormatter.java188
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CompoundRegion.java52
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CounterFormatter.java316
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DeclContainerFormatter.java118
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DefaultCSSSourceFormatter.java113
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FontFaceRuleFormatter.java97
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FormatRegion.java71
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FunctionFormatter.java187
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/ImportRuleFormatter.java345
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaListFormatter.java216
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaRuleFormatter.java394
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PageRuleFormatter.java193
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PrimitiveValueFormatter.java271
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RGBFormatter.java44
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RectFormatter.java44
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java394
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclarationFormatter.java253
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleRuleFormatter.java166
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleSheetFormatter.java273
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java86
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCategoryImpl.java75
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCharsetRuleImpl.java45
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMContainerImpl.java63
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMDescriptorImpl.java75
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFontFaceRuleImpl.java45
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFunctionImpl.java96
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMImportRuleImpl.java44
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMKeywordImpl.java75
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMMediaRuleImpl.java41
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNodeImpl.java148
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNumberImpl.java52
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPageRuleImpl.java50
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPropertyImpl.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoClassImpl.java33
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoElementImpl.java33
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorExpressionImpl.java49
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorImpl.java81
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStringImpl.java86
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleRuleImpl.java50
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleSheetImpl.java50
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMUnitImpl.java108
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMetaModelImpl.java95
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileImpl.java158
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileTest.java73
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/MetaModelErrors.java30
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/NodePool.java171
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileHandler.java283
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileKeywords.java58
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileLoader.java72
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/RegistryReader.java123
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ValueCollector.java50
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/XMLReaderUtil.java38
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/nls/ResourceHandler.java72
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSRegionUtil.java51
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSSourceParser.java284
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSStructuredDocumentRegionFactory.java27
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSTokenizer.java1220
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSContextRegion.java23
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSTextRegionFactory.java34
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/tasks/CSSTaskTagSeeker.java40
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentReParser.java451
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentRegionFactory.java39
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/StructuredDocumentWalker.java169
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/rules/StructuredTextPartitionerForCSS.java35
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCategory.java16
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCharsetRule.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMContainer.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMDescriptor.java20
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFontFaceRule.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFunction.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMImportRule.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMKeyword.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMMediaRule.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNode.java51
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNumber.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMPageRule.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMProperty.java22
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMSelector.java29
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMString.java17
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleRule.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleSheet.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMUnit.java18
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMetaModel.java37
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfile.java31
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfileRegistry.java69
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSFunctionID.java22
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSKeywordID.java261
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMMTypeCollector.java62
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMediaGroupID.java29
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelFinder.java51
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelTraverser.java92
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelUtil.java120
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSNumberID.java23
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSProfileFinder.java103
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSPropertyID.java137
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSStringID.java22
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSUnitID.java34
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/CSSModelLoader.java54
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/ModelHandlerForCSS.java56
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSRegionContexts.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextParser.java101
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextToken.java23
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSModelPreferenceNames.java32
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSPreferenceHelper.java278
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/AbstractCssTraverser.java204
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSClassTraverser.java114
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSLinkConverter.java191
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSPathService.java78
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSSelectorListFactory.java35
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSStyleDeclarationFactory.java65
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSUtil.java335
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportRuleCollector.java71
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportedCollector.java61
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/RegionIterator.java140
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectionCollector.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorValidator.java97
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorsCollector.java101
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLHelper.java210
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLModelProviderCSS.java387
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionXSubStyleAdapter.java142
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionYSubStyleAdapter.java150
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundShorthandAdapter.java179
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderBottomShorthandAdapter.java140
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderColorShorthandAdapter.java158
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderLeftShorthandAdapter.java140
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderRightShorthandAdapter.java140
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderShorthandAdapter.java140
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderStyleShorthandAdapter.java130
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderTopShorthandAdapter.java140
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderWidthShorthandAdapter.java130
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/CSSPropertyContext.java2998
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipBottomSubStyleAdapter.java53
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipLeftSubStyleAdapter.java53
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipRightSubStyleAdapter.java53
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipSubStyleAdapter.java132
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipTopSubStyleAdapter.java53
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/FontShorthandAdapter.java240
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ICSS2Properties.java127
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/IShorthandAdapter.java31
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ISubPropertyAdapter.java29
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ListStyleShorthandAdapter.java110
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/MarginShorthandAdapter.java129
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/PaddingShorthandAdapter.java129
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ValueData.java45
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSS2Properties.java1666
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSCharsetRule.java54
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSFontFaceRule.java31
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSImportRule.java47
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSMediaRule.java84
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPageRule.java47
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPrimitiveValue.java313
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRule.java102
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRuleList.java50
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleDeclaration.java163
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleRule.java48
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleSheet.java94
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSUnknownRule.java26
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValue.java76
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValueList.java54
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Counter.java42
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DOMImplementationCSS.java45
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DocumentCSS.java57
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ElementCSSInlineStyle.java36
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/RGBColor.java54
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Rect.java48
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ViewCSS.java51
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/DocumentStyle.java38
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/LinkStyle.java35
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/MediaList.java93
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheet.java100
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheetList.java49
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/AbstractView.java31
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/DocumentView.java33
-rw-r--r--bundles/org.eclipse.wst.css.ui/.classpath7
-rw-r--r--bundles/org.eclipse.wst.css.ui/.compatibility2
-rw-r--r--bundles/org.eclipse.wst.css.ui/.cvsignore5
-rw-r--r--bundles/org.eclipse.wst.css.ui/.project28
-rw-r--r--bundles/org.eclipse.wst.css.ui/build.properties22
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/aural_props.gifbin0 -> 229 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/boxmodel_props.gifbin0 -> 348 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/charset_rule.gifbin0 -> 365 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/class_selector.gifbin0 -> 338 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/colback_props.gifbin0 -> 610 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/content_props.gifbin0 -> 366 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyname.gifbin0 -> 612 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_function.gifbin0 -> 164 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_identifier.gifbin0 -> 314 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_unit.gifbin0 -> 218 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/font_props.gifbin0 -> 120 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/fontface_rule.gifbin0 -> 347 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/id_selector.gifbin0 -> 374 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_rule.gifbin0 -> 363 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_selector.gifbin0 -> 339 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/media_rule.gifbin0 -> 592 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/other_props.gifbin0 -> 600 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/page_rule.gifbin0 -> 586 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/pagedmedia_props.gifbin0 -> 597 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/pseudo.gifbin0 -> 588 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/sort.gifbin0 -> 162 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/style_rule.gifbin0 -> 371 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/stylesheet.gifbin0 -> 579 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/table_props.gifbin0 -> 599 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/tag_selector.gifbin0 -> 346 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/text_props.gifbin0 -> 601 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/ui_props.gifbin0 -> 608 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/unknown_rule.gifbin0 -> 365 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/full/obj16/visual_props.gifbin0 -> 609 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/icons/sourceEditor.gifbin0 -> 353 bytes
-rw-r--r--bundles/org.eclipse.wst.css.ui/plugin.properties18
-rw-r--r--bundles/org.eclipse.wst.css.ui/plugin.xml133
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/EditingCSS.properties50
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/ActionContributorCSS.java118
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/CSSEditorPlugin.java134
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextEditorCSS.java60
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java125
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/autoedit/StructuredAutoEditStrategyCSS.java501
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSCACandidate.java102
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistContext.java454
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistProcessor.java273
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalArranger.java169
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGenerator.java209
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForAtmarkRule.java293
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationName.java171
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationValue.java370
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForHTMLTag.java157
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForPseudoSelector.java157
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/HTML40Namespace.java889
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ContentSettingsRegistry.java34
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ui/CSSContentSettingsPropertyPage.java101
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupActionCSS.java40
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupDialogCSS.java292
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageHelper.java124
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageType.java235
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java154
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java51
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java42
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/nls/ResourceHandler.java66
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java53
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java47
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java60
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java55
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/CSSPreferenceManager.java185
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorManager.java228
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorPage.java236
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSFilesPreferencePage.java59
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSSourcePreferencePage.java247
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/registry/AdapterFactoryProviderCSS.java55
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/CSSTextColors.java143
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/IStyleConstantsCSS.java31
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForCSS.java202
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForEmbeddedCSS.java104
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/taginfo/CSSBestMatchHoverProcessor.java33
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/text/CSSDocumentRegionEdgeMatcher.java89
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java118
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSNodeAdapter.java319
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeAdapterFactoryCSS.java42
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java263
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java231
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java66
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java53
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySource.java350
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySourceAdapterFactory.java45
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSTextPropertyDescriptor.java114
-rw-r--r--bundles/org.eclipse.wst.html.core/.classpath7
-rw-r--r--bundles/org.eclipse.wst.html.core/.compatibility2
-rw-r--r--bundles/org.eclipse.wst.html.core/.cvsignore5
-rw-r--r--bundles/org.eclipse.wst.html.core/.options2
-rw-r--r--bundles/org.eclipse.wst.html.core/.project28
-rw-r--r--bundles/org.eclipse.wst.html.core/build.properties22
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref.xml294
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_de.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_es.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_fr.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_it.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_ja.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_ko.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_pt_BR.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_zh_CN.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/data/htmref_zh_TW.properties108
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/wml11.dtd355
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/wml13.dtd4
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml-basic10-f.dtd3086
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml-lat1.ent196
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml-mobile10-flat.dtd3216
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml-special.ent79
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml-symbol.ent242
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml1-frameset.dtd1225
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml1-strict.dtd988
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml1-transitional.dtd1196
-rw-r--r--bundles/org.eclipse.wst.html.core/dtds/xhtml11-flat.dtd4513
-rw-r--r--bundles/org.eclipse.wst.html.core/plugin.properties12
-rw-r--r--bundles/org.eclipse.wst.html.core/plugin.xml322
-rw-r--r--bundles/org.eclipse.wst.html.core/src/ModelsHTML.properties40
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTML40Namespace.java675
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCMProperties.java116
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCorePlugin.java125
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFilesPreferenceNames.java31
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFormatContraints.java35
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/PreferenceNames.java35
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/AbstractNodeCleanupHandler.java87
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/CSSTextNodeCleanupHandler.java86
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/ElementNodeCleanupHandler.java635
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupHandlerFactory.java119
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupProcessorImpl.java45
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/JSPElementNodeCleanupHandler.java22
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/NodeCleanupHandler.java22
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/commentelement/handlers/CommentElementHandlerForSSI.java164
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/AttributeCollection.java1295
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMContentImpl.java58
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMGroupImpl.java83
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamedNodeMapImpl.java99
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamespaceImpl.java59
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeImpl.java65
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeListImpl.java62
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinition.java76
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinitionFactory.java185
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdAddress.java71
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdColumnGroup.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdDl.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdEmbed.java65
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFieldset.java74
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFlowContainer.java55
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFrameset.java93
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHead.java176
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHtml.java80
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdInlineContainer.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdLiContainer.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdMap.java72
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdNoframesContent.java65
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdOptionContainer.java70
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdParamContainer.java71
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdSelect.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTable.java128
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTableCellContainer.java74
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTrContainer.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/DeclCollection.java238
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ElementCollection.java886
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/EntityCollection.java837
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HCMDocImpl.java93
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttrDeclImpl.java122
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttributeDeclaration.java24
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataType.java66
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataTypeImpl.java125
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocument.java37
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocumentFactory.java60
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMNode.java32
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElemDeclImpl.java377
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElementDeclaration.java81
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclImpl.java76
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclaration.java22
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLPropertyDeclaration.java105
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedA.java100
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedADDRESS.java58
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAPPLET.java68
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAREA.java61
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASE.java50
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASEFONT.java57
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBDO.java61
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBGSOUND.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBLOCKQUOTE.java63
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBODY.java96
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBR.java51
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBUTTON.java102
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCAPTION.java48
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCENTER.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOL.java67
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOLGROUP.java77
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDD.java59
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDIV.java63
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDL.java64
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDT.java59
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEMBED.java94
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEmpty.java49
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFIELDSET.java57
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFONT.java62
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFORM.java93
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAME.java62
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAMESET.java80
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFlowContainer.java26
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFontStyle.java65
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHEAD.java78
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHR.java77
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHTML.java81
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHeading.java86
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIFRAME.java76
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIMG.java89
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedINPUT.java122
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedISINDEX.java65
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedInlineContainer.java29
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLABEL.java94
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLEGEND.java54
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLI.java71
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLINK.java63
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedListItemContainer.java30
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMAP.java53
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMARQUEE.java81
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMENU.java90
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMETA.java59
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMarkChanges.java50
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOBR.java33
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOEMBED.java42
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOFRAMES.java80
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOSCRIPT.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOBJECT.java86
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOL.java70
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTGROUP.java55
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTION.java66
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedP.java106
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPARAM.java57
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPRE.java92
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPcdata.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPhrase.java42
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedQ.java49
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSCRIPT.java81
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSELECT.java79
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSPAN.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIBase.java50
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIConfig.java48
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIEcho.java46
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIExec.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFlastmod.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFsize.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIInclude.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIPrintenv.java49
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSISet.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSTYLE.java77
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedScripts.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTABLE.java91
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTEXTAREA.java77
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTITLE.java70
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTR.java74
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableBody.java73
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableCell.java80
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedUL.java73
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedWBR.java32
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JCMDocImpl.java79
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSP11Namespace.java112
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPCMDocument.java29
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPElementCollection.java897
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProvider.java23
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProviderFactory.java359
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/AttributeCollection.java324
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHCMDocImpl.java95
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHTMLNamespace.java152
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMContentImpl.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMGroupImpl.java83
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNamedNodeMapImpl.java97
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeImpl.java64
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeListImpl.java61
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinition.java77
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinitionFactory.java146
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdAddress.java70
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdDl.java68
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdFlowContainer.java55
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHead.java175
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHtml.java79
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdInlineContainer.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdLiContainer.java68
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdOptionContainer.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdSelect.java64
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/DeclCollection.java238
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ElementCollection.java495
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/EntityCollection.java837
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLAttrDeclImpl.java118
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMDataTypeImpl.java126
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMNode.java32
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLElemDeclImpl.java380
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLEntityDeclImpl.java77
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedA.java99
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedADDRESS.java57
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBASE.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBLOCKQUOTE.java57
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBODY.java68
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBR.java51
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedCENTER.java55
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDD.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDIV.java62
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDL.java59
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDT.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedEmpty.java49
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFORM.java92
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFlowContainer.java26
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHEAD.java71
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHR.java75
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHTML.java81
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHeading.java85
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedIMG.java88
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedINPUT.java108
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedInlineContainer.java29
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedLI.java58
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedListItemContainer.java30
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMENU.java87
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMETA.java67
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOL.java58
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOPTION.java63
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedP.java105
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPRE.java91
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPcdata.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSELECT.java65
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIBase.java52
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIConfig.java45
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIEcho.java43
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIExec.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFlastmod.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFsize.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIInclude.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIPrintenv.java48
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSISet.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTEXTAREA.java62
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTITLE.java69
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedUL.java57
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProvider.java26
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProviderFactory.java363
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ssi/SSICMDocumentFactory.java158
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/DocumentStyleImpl.java96
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/ElementStyleImpl.java73
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLConverter.java309
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java294
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapterFactory.java136
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeConstants.java19
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeEntry.java127
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistry.java139
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistryReader.java108
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapter.java354
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapterFactory.java70
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaData.java28
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaDataAdapter.java283
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/TagScanner.java166
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/UnknownTagAdapter.java82
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/XMLStyleModelImpl.java67
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java42
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentLoader.java166
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLModelLoader.java114
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/EmbeddedCSSFormatter.java90
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLElementFormatter.java333
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatContraintsImpl.java42
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatProcessorImpl.java67
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatter.java659
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatterFactory.java115
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLStructuredFormattingStrategyImpl.java60
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLTextFormatter.java281
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/SpaceConverter.java233
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractCSSModelAdapter.java105
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractStyleSheetAdapter.java238
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryContext.java137
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryDeclarationData.java44
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryTraverser.java115
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryValueData.java47
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLDocumentAdapter.java398
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapter.java154
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapterFactory.java81
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/LinkElementAdapter.java276
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAdapterFactory.java162
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAttrAdapter.java248
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleElementAdapter.java411
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleListener.java22
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLHelper.java33
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLModelProvider.java448
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/Logger.java142
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/ContentDescriberForHTML.java25
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizer.java1692
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizerConstants.java20
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLResourceEncodingDetector.java190
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/nls/ResourceHandler.java72
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/rules/StructuredTextPartitionerForHTML.java204
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/EmbeddedHTML.java139
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/ModelHandlerForHTML.java55
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMAttributeDeclarationBuddySystem.java67
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMDocumentForBuddySystem.java119
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMElementDeclarationBuddySystem.java201
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNamedNodeMapForBuddySystem.java109
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNodeBuddySystem.java74
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/DocumentQuery.java200
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapter.java29
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapterFactory.java68
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HMQUtil.java121
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLElementDeclarationAdapter.java54
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryAssociationProvider.java54
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryCMProvider.java100
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryImpl.java148
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForEmbeddedHTML.java52
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java131
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/XHTMLAssociationProvider.java80
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/preferences/HTMLContentBuilder.java75
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/AbstractErrorInfo.java40
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CMUtil.java200
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CompositeValidator.java74
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/DocumentPropagatingValidator.java58
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ElementPropagatingValidator.java50
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfo.java26
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfoImpl.java56
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorState.java41
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/FMUtil.java103
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLAttributeValidator.java207
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLDocumentContentValidator.java194
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementAncestorValidator.java70
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementContentValidator.java178
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleDocumentValidator.java39
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleValidator.java42
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLValidationAdapterFactory.java72
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/MessageFactory.java256
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NamespaceValidator.java127
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NullValidator.java34
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/PrimeValidator.java25
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SMUtil.java36
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/Segment.java64
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SyntaxValidator.java345
-rw-r--r--bundles/org.eclipse.wst.html.ui/.classpath7
-rw-r--r--bundles/org.eclipse.wst.html.ui/.compatibility2
-rw-r--r--bundles/org.eclipse.wst.html.ui/.cvsignore4
-rw-r--r--bundles/org.eclipse.wst.html.ui/.project28
-rw-r--r--bundles/org.eclipse.wst.html.ui/build.properties22
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/table.gifbin0 -> 573 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-anchor.gifbin0 -> 197 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-body.gifbin0 -> 343 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-button.gifbin0 -> 344 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-font.gifbin0 -> 229 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-form.gifbin0 -> 353 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-html.gifbin0 -> 570 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image-map.gifbin0 -> 577 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image.gifbin0 -> 601 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-jsp.gifbin0 -> 135 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-title.gifbin0 -> 581 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag.gifbin0 -> 82 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/icons/sourceEditor.gifbin0 -> 353 bytes
-rw-r--r--bundles/org.eclipse.wst.html.ui/plugin.properties19
-rw-r--r--bundles/org.eclipse.wst.html.ui/plugin.xml277
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/EditingHTML.properties166
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/HTMLEditorPlugin.java195
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextEditorHTML.java61
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java384
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntry.java30
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntryProvider.java29
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ContentSettingsRegistry.java174
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntry.java23
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProvider.java24
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProviderBuilder.java56
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/HTMLContentSettingsPropertyPage.java279
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ProjectContentSettingsPropertyPage.java282
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/ActionContributorHTML.java31
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupActionHTML.java42
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupDialogHTML.java311
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/Logger.java157
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/SharedHTMLEditorPluginImageHelper.java58
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java428
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java132
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTemplateCompletionProcessor.java53
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/NoRegionContentAssistProcessorForHTML.java40
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/XHTMLMinimalContentModelGenerator.java83
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImageHelper.java154
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImages.java29
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/IHelpContextIds.java43
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/nls/ResourceHandler.java70
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java49
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/openon/DefaultOpenOnHTML.java46
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLColorPage.java130
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLFilesPreferencePage.java191
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLSourcePreferencePage.java143
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLTemplatePreferencePage.java59
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForEmbeddedHTML.java35
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForHTML.java138
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/IStyleConstantsHTML.java22
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/LineStyleProviderForHTML.java95
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLBestMatchHoverProcessor.java34
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLInformationProvider.java53
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLTagInfoHoverProcessor.java28
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTML.java51
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttribute.java26
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttributeValue.java26
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLTag.java25
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/text/HTMLDocumentRegionEdgeMatcher.java28
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java32
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLNodeActionManager.java136
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterFactoryForHTML.java50
-rw-r--r--bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterForHTML.java114
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.xml24
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_de.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_es.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_fr.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_it.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ja.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ko.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_pt_BR.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_CN.properties35
-rw-r--r--bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_TW.properties35
818 files changed, 115944 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.css.core/.classpath b/bundles/org.eclipse.wst.css.core/.classpath
new file mode 100644
index 0000000000..df094ee4a7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.css.core/.compatibility b/bundles/org.eclipse.wst.css.core/.compatibility
new file mode 100644
index 0000000000..b943e425e3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004
+.project=8811
diff --git a/bundles/org.eclipse.wst.css.core/.cvsignore b/bundles/org.eclipse.wst.css.core/.cvsignore
new file mode 100644
index 0000000000..0e7c86bf57
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/.cvsignore
@@ -0,0 +1,5 @@
+bin
+temp.folder
+cssmodel.jar
+build.xml
+dev.properties
diff --git a/bundles/org.eclipse.wst.css.core/.options b/bundles/org.eclipse.wst.css.core/.options
new file mode 100644
index 0000000000..490975b210
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/.options
@@ -0,0 +1,2 @@
+org.eclipse.wst.css.core/debug=true
+org.eclipse.wst.css.core/debug/tracefilter= \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/.project b/bundles/org.eclipse.wst.css.core/.project
new file mode 100644
index 0000000000..bb046e9d84
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.css.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.css.core/build.properties b/bundles/org.eclipse.wst.css.core/build.properties
new file mode 100644
index 0000000000..78aa1c4e21
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+bin.includes = plugin.xml,\
+ *.jar,\
+ css.jar,\
+ cssprofile/,\
+ .options,\
+ plugin.properties
+source.cssmodel.jar = src/
+src.includes = plugin.xml,\
+ cssprofile/,\
+ build.xml,\
+ .options,\
+ plugin.properties
diff --git a/bundles/org.eclipse.wst.css.core/cssprofile/css-profile.dtd b/bundles/org.eclipse.wst.css.core/cssprofile/css-profile.dtd
new file mode 100644
index 0000000000..35535a837c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/cssprofile/css-profile.dtd
@@ -0,0 +1,132 @@
+<!-- DTD for CSS Meta Model Profile -->
+
+<!-- Entities -->
+
+<!-- name-definition : In defining meta model object, object name -->
+<!-- is given by using this attribute. -->
+
+<!ENTITY % name-definition 'name CDATA #REQUIRED' >
+
+<!-- name-reference : used to refer meta model object that defined -->
+<!-- by name-definition -->
+
+<!ENTITY % name-reference 'name CDATA #REQUIRED' >
+
+<!-- availability : CSS Meta Model Profile permit importing -->
+<!-- other profile and describe difference for it. -->
+
+<!ENTITY % availability 'enabled (true | false) "true"' >
+<!ENTITY % overwrite 'overwrite (true | false) "false"' >
+
+<!-- ******************** -->
+<!-- elments/attributes -->
+<!-- ******************** -->
+
+<!ELEMENT css-profile (profile-import? , (stylesheet-def | charset-rule-def | import-rule-def | page-rule-def | media-rule-def | fontface-rule-def | style-rule-def | property-def | descriptor-def | container-def | function-def | number-def | unit-def | keyword-def | category-def | pseudo-element-def | pseudo-class-def)*) >
+
+<!-- a profile can include other profile -->
+
+<!ELEMENT profile-import EMPTY >
+<!ATTLIST profile-import name CDATA #REQUIRED >
+
+<!-- which type of rule can be used? -->
+
+<!ELEMENT stylesheet-def (description? , (charset-rule | import-rule | page-rule | media-rule | fontface-rule | style-rule)*) >
+<!ATTLIST stylesheet-def %overwrite; >
+
+<!ELEMENT charset-rule EMPTY >
+<!ATTLIST charset-rule %availability; >
+<!ELEMENT import-rule EMPTY >
+<!ATTLIST import-rule %availability; >
+<!ELEMENT page-rule EMPTY >
+<!ATTLIST page-rule %availability; >
+<!ELEMENT media-rule EMPTY >
+<!ATTLIST media-rule %availability; >
+<!ELEMENT fontface-rule EMPTY >
+<!ATTLIST fontface-rule %availability; >
+<!ELEMENT style-rule EMPTY >
+<!ATTLIST style-rule %availability; >
+
+<!ELEMENT charset-rule-def (description?) >
+<!ATTLIST charset-rule-def %overwrite; >
+
+<!ELEMENT import-rule-def (description?) >
+<!ATTLIST import-rule-def %overwrite; >
+
+<!ELEMENT page-rule-def (description? , (property | pseudo-class)*) >
+<!ATTLIST page-rule-def %overwrite; >
+
+<!ELEMENT media-rule-def (description?) >
+<!ATTLIST media-rule-def %overwrite; >
+
+<!ELEMENT fontface-rule-def (description? , descriptor*) >
+<!ATTLIST fontface-rule-def %overwrite; >
+
+<!ELEMENT style-rule-def (description? , (property | selector-expression | pseudo-class | pseudo-element)*) >
+<!ATTLIST style-rule-def %overwrite; >
+
+<!ELEMENT selector-expression EMPTY >
+<!ATTLIST selector-expression name (descendant | child | adjacent | universal | attribute) #REQUIRED %availability; >
+
+<!ELEMENT pseudo-class EMPTY >
+<!ATTLIST pseudo-class %name-reference; %availability; >
+
+<!ELEMENT pseudo-element EMPTY >
+<!ATTLIST pseudo-element %name-reference; %availability; >
+
+<!ELEMENT pseudo-class-def (description?, selector-value) >
+<!ATTLIST pseudo-class-def %name-definition; %overwrite; >
+<!ELEMENT selector-value (#PCDATA) >
+
+<!ELEMENT pseudo-element-def (description?, selector-value) >
+<!ATTLIST pseudo-element-def %name-definition; %overwrite; >
+
+<!ELEMENT keyword-def (description? , keyword-value) >
+<!ATTLIST keyword-def %name-definition; %overwrite; >
+<!ELEMENT keyword-value (#PCDATA) >
+<!ELEMENT description (#PCDATA) >
+
+<!ELEMENT function-def (description? , function-value) >
+<!ATTLIST function-def %name-definition; %overwrite; >
+<!ELEMENT function-value (#PCDATA) >
+
+<!ELEMENT number-def (description? , unit*) >
+<!ATTLIST number-def %name-definition; %overwrite; >
+<!ELEMENT unit EMPTY >
+<!ATTLIST unit %name-reference; %availability; >
+
+<!ELEMENT unit-def (description? , unit-value) >
+<!ATTLIST unit-def %name-definition; %overwrite; >
+<!ELEMENT unit-value (#PCDATA) >
+
+<!ELEMENT container-def (description? , (number | keyword | function | container)*) >
+<!ATTLIST container-def %name-definition; %overwrite; >
+
+<!ELEMENT category-def (description?, caption) >
+<!ATTLIST category-def %name-definition; %overwrite; >
+<!ELEMENT caption (#PCDATA) >
+
+<!ELEMENT property-def (description? , (number | keyword | function | container | string | separator | property)*) >
+<!ATTLIST property-def %name-definition; %overwrite;
+ inherited (yes | no | na) "na"
+ mediagroup CDATA #IMPLIED
+ category CDATA #IMPLIED >
+<!ELEMENT descriptor-def (description?, (number | keyword | function | container | string | separator | property)*) >
+<!ATTLIST descriptor-def %name-definition; %overwrite; >
+
+<!ELEMENT number EMPTY >
+<!ATTLIST number %name-reference; %availability; >
+<!ELEMENT keyword EMPTY >
+<!ATTLIST keyword %name-reference; %availability; >
+<!ELEMENT function EMPTY >
+<!ATTLIST function %name-reference; %availability; >
+<!ELEMENT container EMPTY >
+<!ATTLIST container %name-reference; %availability; >
+<!ELEMENT string EMPTY >
+<!ATTLIST string %name-reference; %availability; >
+<!ELEMENT separator EMPTY >
+<!ATTLIST separator name (comma | slash) #REQUIRED %availability; >
+<!ELEMENT property EMPTY >
+<!ATTLIST property %name-reference; %availability; >
+<!ELEMENT descriptor EMPTY >
+<!ATTLIST descriptor %name-reference; %availability; >
diff --git a/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css1.xml b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css1.xml
new file mode 100644
index 0000000000..6b0b175319
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css1.xml
@@ -0,0 +1,826 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--<!DOCTYPE css-profile SYSTEM "css-profile.dtd" >-->
+<css-profile>
+ <stylesheet-def>
+ <description>%css1.stylesheet-def.description</description>
+ <import-rule/>
+ <style-rule/>
+ </stylesheet-def>
+
+ <import-rule-def>
+ </import-rule-def>
+
+ <style-rule-def>
+ <selector-expression name="descendant"/>
+ <pseudo-element name="first-line"/>
+ <pseudo-element name="first-letter"/>
+ <pseudo-class name="link"/>
+ <pseudo-class name="visited"/>
+ <pseudo-class name="active"/>
+ <property name="background"/>
+ <property name="background-attachment"/>
+ <property name="background-color"/>
+ <property name="background-image"/>
+ <property name="background-position"/>
+ <property name="background-repeat"/>
+ <property name="border"/>
+ <property name="border-bottom"/>
+ <property name="border-bottom-width"/>
+ <property name="border-color"/>
+ <property name="border-left"/>
+ <property name="border-left-width"/>
+ <property name="border-right"/>
+ <property name="border-right-width"/>
+ <property name="border-style"/>
+ <property name="border-top"/>
+ <property name="border-top-width"/>
+ <property name="border-width"/>
+ <property name="clear"/>
+ <property name="color"/>
+ <property name="display"/>
+ <property name="float"/>
+ <property name="font"/>
+ <property name="font-family"/>
+ <property name="font-size"/>
+ <property name="font-style"/>
+ <property name="font-variant"/>
+ <property name="font-weight"/>
+ <property name="height"/>
+ <property name="letter-spacing"/>
+ <property name="line-height"/>
+ <property name="list-style"/>
+ <property name="list-style-image"/>
+ <property name="list-style-position"/>
+ <property name="list-style-type"/>
+ <property name="margin"/>
+ <property name="margin-bottom"/>
+ <property name="margin-left"/>
+ <property name="margin-right"/>
+ <property name="margin-top"/>
+ <property name="padding"/>
+ <property name="padding-bottom"/>
+ <property name="padding-left"/>
+ <property name="padding-right"/>
+ <property name="padding-top"/>
+ <property name="text-align"/>
+ <property name="text-decoration"/>
+ <property name="text-indent"/>
+ <property name="text-transform"/>
+ <property name="vertical-align"/>
+ <property name="white-space"/>
+ <property name="width"/>
+ <property name="word-spacing"/>
+ </style-rule-def>
+
+ <pseudo-class-def name="link">
+ <selector-value>link</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="visited">
+ <selector-value>visited</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="active">
+ <selector-value>active</selector-value>
+ </pseudo-class-def>
+
+ <pseudo-element-def name="first-line">
+ <selector-value>first-line</selector-value>
+ </pseudo-element-def>
+ <pseudo-element-def name="first-letter">
+ <selector-value>first-letter</selector-value>
+ </pseudo-element-def>
+
+ <!-- property definition -->
+
+ <property-def name="background" inherited="no" category="colorandbackground">
+ <property name="background-color"/>
+ <property name="background-image"/>
+ <property name="background-repeat"/>
+ <property name="background-attachment"/>
+ <property name="background-position"/>
+ </property-def>
+ <property-def name="background-attachment" inherited="no" category="colorandbackground">
+ <keyword name="scroll"/>
+ <keyword name="fixed"/>
+ </property-def>
+ <property-def name="background-color" inherited="no" category="colorandbackground">
+ <container name="color"/>
+ <keyword name="transparent"/>
+ </property-def>
+ <property-def name="background-image" inherited="no" category="colorandbackground">
+ <function name="uri"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="background-position" inherited="no" category="colorandbackground">
+ <number name="percentage"/>
+ <number name="length"/>
+ <keyword name="top"/>
+ <keyword name="center"/>
+ <keyword name="bottom"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ </property-def>
+ <property-def name="background-repeat" inherited="no" category="colorandbackground">
+ <keyword name="repeat"/>
+ <keyword name="repeat-x"/>
+ <keyword name="repeat-y"/>
+ <keyword name="no-repeat"/>
+ </property-def>
+ <property-def name="border" inherited="no" category="box">
+ <property name="border-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ </property-def>
+ <property-def name="border-color" inherited="no" category="box">
+ <container name="color"/>
+ </property-def>
+ <property-def name="border-style" inherited="no" category="box">
+ <keyword name="none"/>
+ <keyword name="dotted"/>
+ <keyword name="dashed"/>
+ <keyword name="solid"/>
+ <keyword name="double"/>
+ <keyword name="groove"/>
+ <keyword name="ridge"/>
+ <keyword name="inset"/>
+ <keyword name="outset"/>
+ </property-def>
+ <property-def name="border-top" inherited="no" category="box">
+ <property name="border-top-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ </property-def>
+ <property-def name="border-right" inherited="no" category="box">
+ <property name="border-right-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ </property-def>
+ <property-def name="border-bottom" inherited="no" category="box">
+ <property name="border-bottom-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ </property-def>
+ <property-def name="border-left" inherited="no" category="box">
+ <property name="border-left-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ </property-def>
+ <property-def name="border-top-width" inherited="no" category="box">
+ <keyword name="thin"/>
+ <keyword name="medium"/>
+ <keyword name="thick"/>
+ <number name="length"/>
+ </property-def>
+ <property-def name="border-right-width" inherited="no" category="box">
+ <keyword name="thin"/>
+ <keyword name="medium"/>
+ <keyword name="thick"/>
+ <number name="length"/>
+ </property-def>
+ <property-def name="border-bottom-width" inherited="no" category="box">
+ <keyword name="thin"/>
+ <keyword name="medium"/>
+ <keyword name="thick"/>
+ <number name="length"/>
+ </property-def>
+ <property-def name="border-left-width" inherited="no" category="box">
+ <keyword name="thin"/>
+ <keyword name="medium"/>
+ <keyword name="thick"/>
+ <number name="length"/>
+ </property-def>
+ <property-def name="border-width" inherited="no" category="box">
+ <keyword name="thin"/>
+ <keyword name="medium"/>
+ <keyword name="thick"/>
+ <number name="length"/>
+ </property-def>
+ <property-def name="clear" inherited="no" category="box">
+ <keyword name="none"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="both"/>
+ </property-def>
+ <property-def name="color" inherited="yes" category="colorandbackground">
+ <container name="color"/>
+ </property-def>
+ <property-def name="display" inherited="no" category="classification">
+ <keyword name="block"/>
+ <keyword name="inline"/>
+ <keyword name="list-item"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="float" inherited="no" category="box">
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="font"
+ inherited="yes" category="font">
+ <property name="font-style"/>
+ <property name="font-variant"/>
+ <property name="font-weight"/>
+ <property name="font-size"/>
+ <property name="line-height"/>
+ <property name="font-family"/>
+ <separator name="slash"/>
+ </property-def>
+ <property-def name="font-family" inherited="yes" category="font">
+ <string name="family-name"/>
+ <container name="generic-family"/>
+ <separator name="comma"/>
+ </property-def>
+ <property-def name="font-size" inherited="yes" category="font">
+ <container name="absolute-size"/>
+ <container name="relative-size"/>
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="font-style" inherited="yes" category="font">
+ <keyword name="normal"/>
+ <keyword name="italic"/>
+ <keyword name="oblique"/>
+ </property-def>
+ <property-def name="font-variant" inherited="yes" category="font">
+ <keyword name="normal"/>
+ <keyword name="small-caps"/>
+ </property-def>
+ <property-def name="font-weight" inherited="yes" category="font">
+ <keyword name="normal"/>
+ <keyword name="bold"/>
+ <keyword name="bolder"/>
+ <keyword name="lighter"/>
+ <keyword name="100"/>
+ <keyword name="200"/>
+ <keyword name="300"/>
+ <keyword name="400"/>
+ <keyword name="500"/>
+ <keyword name="600"/>
+ <keyword name="700"/>
+ <keyword name="800"/>
+ <keyword name="900"/>
+ </property-def>
+ <property-def name="height" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="letter-spacing" inherited="yes" category="text">
+ <keyword name="normal"/>
+ <number name="length"/>
+ </property-def>
+ <property-def name="line-height" inherited="yes" category="text">
+ <keyword name="normal"/>
+ <number name="number"/>
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="list-style" inherited="yes" category="classification">
+ <keyword name="disc"/>
+ <keyword name="circle"/>
+ <keyword name="square"/>
+ <keyword name="decimal"/>
+ <keyword name="lower-roman"/>
+ <keyword name="upper-roman"/>
+ <keyword name="lower-alpha"/>
+ <keyword name="upper-alpha"/>
+ <keyword name="none"/>
+ <keyword name="inside"/>
+ <keyword name="outside"/>
+ <function name="uri"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="list-style-image" inherited="yes" category="classification">
+ <function name="uri"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="list-style-position" inherited="yes" category="classification">
+ <keyword name="inside"/>
+ <keyword name="outside"/>
+ </property-def>
+ <property-def name="list-style-type" inherited="yes" category="classification">
+ <keyword name="disc"/>
+ <keyword name="circle"/>
+ <keyword name="square"/>
+ <keyword name="decimal"/>
+ <keyword name="lower-roman"/>
+ <keyword name="upper-roman"/>
+ <keyword name="lower-alpha"/>
+ <keyword name="upper-alpha"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="margin" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="margin-top" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="margin-right" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="margin-bottom" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="margin-left" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="padding" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="padding-top" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="padding-right" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="padding-bottom" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="padding-left" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="text-align" inherited="yes" category="text">
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="center"/>
+ <keyword name="justify"/>
+ </property-def>
+ <property-def name="text-decoration" inherited="no" category="text">
+ <keyword name="none"/>
+ <keyword name="underline"/>
+ <keyword name="overline"/>
+ <keyword name="line-through"/>
+ <keyword name="blink"/>
+ </property-def>
+ <property-def name="text-indent" inherited="yes" category="text">
+ <number name="length"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="text-transform" inherited="yes" category="text">
+ <keyword name="capitalize"/>
+ <keyword name="uppercase"/>
+ <keyword name="lowercase"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="vertical-align" inherited="no" category="text">
+ <keyword name="baseline"/>
+ <keyword name="sub"/>
+ <keyword name="super"/>
+ <keyword name="top"/>
+ <keyword name="text-top"/>
+ <keyword name="middle"/>
+ <keyword name="bottom"/>
+ <keyword name="text-bottom"/>
+ <number name="percentage"/>
+ </property-def>
+ <property-def name="white-space" inherited="yes" category="classification">
+ <keyword name="normal"/>
+ <keyword name="pre"/>
+ <keyword name="nowrap"/>
+ </property-def>
+ <property-def name="width" inherited="no" category="box">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="word-spacing" inherited="yes" category="text">
+ <keyword name="normal"/>
+ <number name="length"/>
+ </property-def>
+
+ <!-- container definition : Container is the lump of values.
+ It can be used like macros. -->
+ <container-def name="absolute-size">
+ <keyword name="xx-small"/>
+ <keyword name="x-small"/>
+ <keyword name="small"/>
+ <keyword name="medium"/>
+ <keyword name="large"/>
+ <keyword name="x-large"/>
+ <keyword name="xx-large"/>
+ </container-def>
+ <container-def name="color">
+ <keyword name="aqua"/>
+ <keyword name="black"/>
+ <keyword name="blue"/>
+ <keyword name="fuchsia"/>
+ <keyword name="gray"/>
+ <keyword name="green"/>
+ <keyword name="lime"/>
+ <keyword name="maroon"/>
+ <keyword name="navy"/>
+ <keyword name="olive"/>
+ <keyword name="purple"/>
+ <keyword name="red"/>
+ <keyword name="silver"/>
+ <keyword name="teal"/>
+ <keyword name="white"/>
+ <keyword name="yellow"/>
+ <function name="rgb"/>
+ <number name="hash"/>
+ </container-def>
+ <container-def name="generic-family">
+ <keyword name="serif"/>
+ <keyword name="sans-serif"/>
+ <keyword name="cursive"/>
+ <keyword name="fantasy"/>
+ <keyword name="monospace"/>
+ </container-def>
+ <container-def name="relative-size">
+ <keyword name="smaller"/>
+ <keyword name="larger"/>
+ </container-def>
+
+ <!-- category definition : This is used to categorize properties
+ in Properties View. -->
+ <category-def name="box">
+ <caption>%css1.category-def.box.caption</caption>
+ </category-def>
+ <category-def name="colorandbackground">
+ <caption>%css1.category-def.colorandbackground.caption</caption>
+ </category-def>
+ <category-def name="classification">
+ <caption>%css1.category-def.classification.caption</caption>
+ </category-def>
+ <category-def name="font">
+ <caption>%css1.category-def.font.caption</caption>
+ </category-def>
+ <category-def name="text">
+ <caption>%css1.category-def.text.caption</caption>
+ </category-def>
+
+ <function-def name="rgb">
+ <function-value>rgb</function-value>
+ </function-def>
+ <function-def name="uri">
+ <function-value>url</function-value>
+ </function-def>
+
+ <!-- number definition : What unit types be acceptable for each
+ number type? -->
+ <number-def name="hash">
+ <unit name="hash"/>
+ </number-def>
+ <number-def name="length">
+ <unit name="em"/>
+ <unit name="ex"/>
+ <unit name="px"/>
+ <unit name="in"/>
+ <unit name="cm"/>
+ <unit name="mm"/>
+ <unit name="pt"/>
+ <unit name="pc"/>
+ </number-def>
+ <number-def name="number">
+ </number-def>
+ <number-def name="percentage">
+ <unit name="percentage"/>
+ </number-def>
+
+ <unit-def name="cm">
+ <unit-value>cm</unit-value>
+ </unit-def>
+ <unit-def name="em">
+ <unit-value>em</unit-value>
+ </unit-def>
+ <unit-def name="ex">
+ <unit-value>ex</unit-value>
+ </unit-def>
+ <unit-def name="hash">
+ <unit-value>#</unit-value>
+ </unit-def>
+ <unit-def name="in">
+ <unit-value>in</unit-value>
+ </unit-def>
+ <unit-def name="mm">
+ <unit-value>mm</unit-value>
+ </unit-def>
+ <unit-def name="pc">
+ <unit-value>pc</unit-value>
+ </unit-def>
+ <unit-def name="percentage">
+ <unit-value>%</unit-value>
+ </unit-def>
+ <unit-def name="pt">
+ <unit-value>pt</unit-value>
+ </unit-def>
+ <unit-def name="px">
+ <unit-value>px</unit-value>
+ </unit-def>
+
+ <!-- keywords : string constants (this is last part..) -->
+ <keyword-def name="100">
+ <keyword-value>100</keyword-value>
+ </keyword-def>
+ <keyword-def name="200">
+ <keyword-value>200</keyword-value>
+ </keyword-def>
+ <keyword-def name="300">
+ <keyword-value>300</keyword-value>
+ </keyword-def>
+ <keyword-def name="400">
+ <keyword-value>400</keyword-value>
+ </keyword-def>
+ <keyword-def name="500">
+ <keyword-value>500</keyword-value>
+ </keyword-def>
+ <keyword-def name="600">
+ <keyword-value>600</keyword-value>
+ </keyword-def>
+ <keyword-def name="700">
+ <keyword-value>700</keyword-value>
+ </keyword-def>
+ <keyword-def name="800">
+ <keyword-value>800</keyword-value>
+ </keyword-def>
+ <keyword-def name="900">
+ <keyword-value>900</keyword-value>
+ </keyword-def>
+ <keyword-def name="aqua">
+ <keyword-value>aqua</keyword-value>
+ </keyword-def>
+ <keyword-def name="auto">
+ <keyword-value>auto</keyword-value>
+ </keyword-def>
+ <keyword-def name="baseline">
+ <keyword-value>baseline</keyword-value>
+ </keyword-def>
+ <keyword-def name="black">
+ <keyword-value>black</keyword-value>
+ </keyword-def>
+ <keyword-def name="blink">
+ <keyword-value>blink</keyword-value>
+ </keyword-def>
+ <keyword-def name="block">
+ <keyword-value>block</keyword-value>
+ </keyword-def>
+ <keyword-def name="blue">
+ <keyword-value>blue</keyword-value>
+ </keyword-def>
+ <keyword-def name="bold">
+ <keyword-value>bold</keyword-value>
+ </keyword-def>
+ <keyword-def name="bolder">
+ <keyword-value>bolder</keyword-value>
+ </keyword-def>
+ <keyword-def name="both">
+ <keyword-value>both</keyword-value>
+ </keyword-def>
+ <keyword-def name="bottom">
+ <keyword-value>bottom</keyword-value>
+ </keyword-def>
+ <keyword-def name="capitalize">
+ <keyword-value>capitalize</keyword-value>
+ </keyword-def>
+ <keyword-def name="center">
+ <keyword-value>center</keyword-value>
+ </keyword-def>
+ <keyword-def name="circle">
+ <keyword-value>circle</keyword-value>
+ </keyword-def>
+ <keyword-def name="cursive">
+ <keyword-value>cursive</keyword-value>
+ </keyword-def>
+ <keyword-def name="dashed">
+ <keyword-value>dashed</keyword-value>
+ </keyword-def>
+ <keyword-def name="decimal">
+ <keyword-value>decimal</keyword-value>
+ </keyword-def>
+ <keyword-def name="disc">
+ <keyword-value>disc</keyword-value>
+ </keyword-def>
+ <keyword-def name="dotted">
+ <keyword-value>dotted</keyword-value>
+ </keyword-def>
+ <keyword-def name="double">
+ <keyword-value>double</keyword-value>
+ </keyword-def>
+ <keyword-def name="fantasy">
+ <keyword-value>fantasy</keyword-value>
+ </keyword-def>
+ <keyword-def name="fixed">
+ <keyword-value>fixed</keyword-value>
+ </keyword-def>
+ <keyword-def name="fuchsia">
+ <keyword-value>fuchsia</keyword-value>
+ </keyword-def>
+ <keyword-def name="gray">
+ <keyword-value>gray</keyword-value>
+ </keyword-def>
+ <keyword-def name="green">
+ <keyword-value>green</keyword-value>
+ </keyword-def>
+ <keyword-def name="groove">
+ <keyword-value>groove</keyword-value>
+ </keyword-def>
+ <keyword-def name="inline">
+ <keyword-value>inline</keyword-value>
+ </keyword-def>
+ <keyword-def name="inset">
+ <keyword-value>inset</keyword-value>
+ </keyword-def>
+ <keyword-def name="inside">
+ <keyword-value>inside</keyword-value>
+ </keyword-def>
+ <keyword-def name="italic">
+ <keyword-value>italic</keyword-value>
+ </keyword-def>
+ <keyword-def name="justify">
+ <keyword-value>justify</keyword-value>
+ </keyword-def>
+ <keyword-def name="large">
+ <keyword-value>large</keyword-value>
+ </keyword-def>
+ <keyword-def name="larger">
+ <keyword-value>larger</keyword-value>
+ </keyword-def>
+ <keyword-def name="left">
+ <keyword-value>left</keyword-value>
+ </keyword-def>
+ <keyword-def name="lighter">
+ <keyword-value>lighter</keyword-value>
+ </keyword-def>
+ <keyword-def name="lime">
+ <keyword-value>lime</keyword-value>
+ </keyword-def>
+ <keyword-def name="line-through">
+ <keyword-value>line-through</keyword-value>
+ </keyword-def>
+ <keyword-def name="list-item">
+ <keyword-value>list-item</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower-alpha">
+ <keyword-value>lower-alpha</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower-roman">
+ <keyword-value>lower-roman</keyword-value>
+ </keyword-def>
+ <keyword-def name="lowercase">
+ <keyword-value>lowercase</keyword-value>
+ </keyword-def>
+ <keyword-def name="maroon">
+ <keyword-value>maroon</keyword-value>
+ </keyword-def>
+ <keyword-def name="medium">
+ <keyword-value>medium</keyword-value>
+ </keyword-def>
+ <keyword-def name="middle">
+ <keyword-value>middle</keyword-value>
+ </keyword-def>
+ <keyword-def name="monospace">
+ <keyword-value>monospace</keyword-value>
+ </keyword-def>
+ <keyword-def name="navy">
+ <keyword-value>navy</keyword-value>
+ </keyword-def>
+ <keyword-def name="no-repeat">
+ <keyword-value>no-repeat</keyword-value>
+ </keyword-def>
+ <keyword-def name="none">
+ <keyword-value>none</keyword-value>
+ </keyword-def>
+ <keyword-def name="normal">
+ <keyword-value>normal</keyword-value>
+ </keyword-def>
+ <keyword-def name="nowrap">
+ <keyword-value>nowrap</keyword-value>
+ </keyword-def>
+ <keyword-def name="oblique">
+ <keyword-value>oblique</keyword-value>
+ </keyword-def>
+ <keyword-def name="olive">
+ <keyword-value>olive</keyword-value>
+ </keyword-def>
+ <keyword-def name="outset">
+ <keyword-value>outset</keyword-value>
+ </keyword-def>
+ <keyword-def name="outside">
+ <keyword-value>outside</keyword-value>
+ </keyword-def>
+ <keyword-def name="overline">
+ <keyword-value>overline</keyword-value>
+ </keyword-def>
+ <keyword-def name="pre">
+ <keyword-value>pre</keyword-value>
+ </keyword-def>
+ <keyword-def name="purple">
+ <keyword-value>purple</keyword-value>
+ </keyword-def>
+ <keyword-def name="red">
+ <keyword-value>red</keyword-value>
+ </keyword-def>
+ <keyword-def name="repeat">
+ <keyword-value>repeat</keyword-value>
+ </keyword-def>
+ <keyword-def name="repeat-x">
+ <keyword-value>repeat-x</keyword-value>
+ </keyword-def>
+ <keyword-def name="repeat-y">
+ <keyword-value>repeat-y</keyword-value>
+ </keyword-def>
+ <keyword-def name="ridge">
+ <keyword-value>ridge</keyword-value>
+ </keyword-def>
+ <keyword-def name="right">
+ <keyword-value>right</keyword-value>
+ </keyword-def>
+ <keyword-def name="sans-serif">
+ <keyword-value>sans-serif</keyword-value>
+ </keyword-def>
+ <keyword-def name="scroll">
+ <keyword-value>scroll</keyword-value>
+ </keyword-def>
+ <keyword-def name="serif">
+ <keyword-value>serif</keyword-value>
+ </keyword-def>
+ <keyword-def name="silver">
+ <keyword-value>silver</keyword-value>
+ </keyword-def>
+ <keyword-def name="small">
+ <keyword-value>small</keyword-value>
+ </keyword-def>
+ <keyword-def name="small-caps">
+ <keyword-value>small-caps</keyword-value>
+ </keyword-def>
+ <keyword-def name="smaller">
+ <keyword-value>smaller</keyword-value>
+ </keyword-def>
+ <keyword-def name="solid">
+ <keyword-value>solid</keyword-value>
+ </keyword-def>
+ <keyword-def name="square">
+ <keyword-value>square</keyword-value>
+ </keyword-def>
+ <keyword-def name="sub">
+ <keyword-value>sub</keyword-value>
+ </keyword-def>
+ <keyword-def name="super">
+ <keyword-value>super</keyword-value>
+ </keyword-def>
+ <keyword-def name="teal">
+ <keyword-value>teal</keyword-value>
+ </keyword-def>
+ <keyword-def name="text-top">
+ <keyword-value>text-top</keyword-value>
+ </keyword-def>
+ <keyword-def name="text-bottom">
+ <keyword-value>text-bottom</keyword-value>
+ </keyword-def>
+ <keyword-def name="thick">
+ <keyword-value>thick</keyword-value>
+ </keyword-def>
+ <keyword-def name="thin">
+ <keyword-value>thin</keyword-value>
+ </keyword-def>
+ <keyword-def name="top">
+ <keyword-value>top</keyword-value>
+ </keyword-def>
+ <keyword-def name="transparent">
+ <keyword-value>transparent</keyword-value>
+ </keyword-def>
+ <keyword-def name="underline">
+ <keyword-value>underline</keyword-value>
+ </keyword-def>
+ <keyword-def name="upper-alpha">
+ <keyword-value>upper-alpha</keyword-value>
+ </keyword-def>
+ <keyword-def name="upper-roman">
+ <keyword-value>upper-roman</keyword-value>
+ </keyword-def>
+ <keyword-def name="uppercase">
+ <keyword-value>uppercase</keyword-value>
+ </keyword-def>
+ <keyword-def name="white">
+ <keyword-value>white</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-large">
+ <keyword-value>x-large</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-small">
+ <keyword-value>x-small</keyword-value>
+ </keyword-def>
+ <keyword-def name="xx-small">
+ <keyword-value>xx-small</keyword-value>
+ </keyword-def>
+ <keyword-def name="xx-large">
+ <keyword-value>xx-large</keyword-value>
+ </keyword-def>
+ <keyword-def name="yellow">
+ <keyword-value>yellow</keyword-value>
+ </keyword-def>
+</css-profile> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css2.xml b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css2.xml
new file mode 100644
index 0000000000..4efc084b91
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-css2.xml
@@ -0,0 +1,2258 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--<!DOCTYPE css-profile SYSTEM "css-profile.dtd" >-->
+<css-profile>
+ <stylesheet-def>
+ <description>%css2.stylesheet-def.description</description>
+ <charset-rule/>
+ <import-rule/>
+ <page-rule/>
+ <media-rule/>
+ <fontface-rule/>
+ <style-rule/>
+ </stylesheet-def>
+
+ <charset-rule-def>
+ </charset-rule-def>
+ <import-rule-def>
+ </import-rule-def>
+ <media-rule-def>
+ </media-rule-def>
+
+ <page-rule-def>
+ <pseudo-class name="left"/>
+ <pseudo-class name="right"/>
+ <pseudo-class name="first"/>
+ <property name="size"/>
+ <property name="marks"/>
+ <property name="page-break-after"/>
+ <property name="page-break-before"/>
+ <property name="page-break-inside"/>
+ <property name="orphans"/>
+ <property name="widows"/>
+ </page-rule-def>
+
+ <fontface-rule-def>
+ <descriptor name="ascent"/>
+ <descriptor name="baseline"/>
+ <descriptor name="bbox"/>
+ <descriptor name="cap-height"/>
+ <descriptor name="centerline"/>
+ <descriptor name="definition-src"/>
+ <descriptor name="descent"/>
+ <descriptor name="font-family"/>
+ <descriptor name="font-size"/>
+ <descriptor name="font-stretch"/>
+ <descriptor name="font-style"/>
+ <descriptor name="font-variant"/>
+ <descriptor name="font-weight"/>
+ <descriptor name="mathline"/>
+ <descriptor name="panose-1"/>
+ <descriptor name="slope"/>
+ <descriptor name="slope"/>
+ <descriptor name="src"/>
+ <descriptor name="stemh"/>
+ <descriptor name="stemv"/>
+ <descriptor name="topline"/>
+ <descriptor name="unicode-range"/>
+ <descriptor name="units-per-em"/>
+ <descriptor name="widths"/>
+ <descriptor name="x-height"/>
+ </fontface-rule-def>
+
+ <!-- Which properties can style rule include ? -->
+
+ <style-rule-def>
+ <selector-expression name="descendant"/>
+ <selector-expression name="child"/>
+ <selector-expression name="adjacent"/>
+ <selector-expression name="universal"/>
+ <selector-expression name="attribute"/>
+ <pseudo-element name="first-line"/>
+ <pseudo-element name="first-letter"/>
+ <pseudo-element name="before"/>
+ <pseudo-element name="after"/>
+ <pseudo-class name="first-child"/>
+ <pseudo-class name="link"/>
+ <pseudo-class name="visited"/>
+ <pseudo-class name="hover"/>
+ <pseudo-class name="active"/>
+ <pseudo-class name="focus"/>
+ <pseudo-class name="lang"/>
+ <property name="azimuth"/>
+ <property name="background"/>
+ <property name="background-attachment"/>
+ <property name="background-color"/>
+ <property name="background-image"/>
+ <property name="background-position"/>
+ <property name="background-repeat"/>
+ <property name="border"/>
+ <property name="border-collapse"/>
+ <property name="border-color"/>
+ <property name="border-spacing"/>
+ <property name="border-style"/>
+ <property name="border-top"/>
+ <property name="border-right"/>
+ <property name="border-bottom"/>
+ <property name="border-left"/>
+ <property name="border-top-color"/>
+ <property name="border-right-color"/>
+ <property name="border-bottom-color"/>
+ <property name="border-left-color"/>
+ <property name="border-top-style"/>
+ <property name="border-right-style"/>
+ <property name="border-bottom-style"/>
+ <property name="border-left-style"/>
+ <property name="border-top-width"/>
+ <property name="border-right-width"/>
+ <property name="border-bottom-width"/>
+ <property name="border-left-width"/>
+ <property name="border-width"/>
+ <property name="bottom"/>
+ <property name="caption-side"/>
+ <property name="clear"/>
+ <property name="clip"/>
+ <property name="color"/>
+ <property name="content"/>
+ <property name="counter-increment"/>
+ <property name="counter-reset"/>
+ <property name="cue"/>
+ <property name="cue-after"/>
+ <property name="cue-before"/>
+ <property name="cursor"/>
+ <property name="direction"/>
+ <property name="display"/>
+ <property name="elevation"/>
+ <property name="empty-cells"/>
+ <property name="float"/>
+ <property name="font"/>
+ <property name="font-family"/>
+ <property name="font-size"/>
+ <property name="font-size-adjust"/>
+ <property name="font-stretch"/>
+ <property name="font-style"/>
+ <property name="font-variant"/>
+ <property name="font-weight"/>
+ <property name="height"/>
+ <property name="left"/>
+ <property name="letter-spacing"/>
+ <property name="line-height"/>
+ <property name="list-style"/>
+ <property name="list-style-image"/>
+ <property name="list-style-position"/>
+ <property name="list-style-type"/>
+ <property name="margin"/>
+ <property name="margin-top"/>
+ <property name="margin-right"/>
+ <property name="margin-bottom"/>
+ <property name="margin-left"/>
+ <property name="marker-offset"/>
+ <property name="marks"/>
+ <property name="max-height"/>
+ <property name="max-width"/>
+ <property name="min-height"/>
+ <property name="min-width"/>
+ <property name="orphans"/>
+ <property name="outline"/>
+ <property name="outline-color"/>
+ <property name="outline-style"/>
+ <property name="outline-width"/>
+ <property name="overflow"/>
+ <property name="padding"/>
+ <property name="padding-top"/>
+ <property name="padding-right"/>
+ <property name="padding-bottom"/>
+ <property name="padding-left"/>
+ <property name="page"/>
+ <property name="page-break-after"/>
+ <property name="page-break-before"/>
+ <property name="page-break-inside"/>
+ <property name="pause"/>
+ <property name="pause-after"/>
+ <property name="pause-before"/>
+ <property name="pitch"/>
+ <property name="pitch-range"/>
+ <property name="play-during"/>
+ <property name="position"/>
+ <property name="quotes"/>
+ <property name="richness"/>
+ <property name="right"/>
+ <property name="size"/>
+ <property name="speak"/>
+ <property name="speak-header"/>
+ <property name="speak-numeral"/>
+ <property name="speak-punctuation"/>
+ <property name="speech-rate"/>
+ <property name="stress"/>
+ <property name="table-layout"/>
+ <property name="text-align"/>
+ <property name="text-decoration"/>
+ <property name="text-indent"/>
+ <property name="text-shadow"/>
+ <property name="text-transform"/>
+ <property name="top"/>
+ <property name="unicode-bidi"/>
+ <property name="vertical-align"/>
+ <property name="visibility"/>
+ <property name="voice-family"/>
+ <property name="volume"/>
+ <property name="white-space"/>
+ <property name="widows"/>
+ <property name="width"/>
+ <property name="word-spacing"/>
+ <property name="z-index"/>
+ </style-rule-def>
+
+ <pseudo-class-def name="first-child">
+ <selector-value>first-child</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="link">
+ <selector-value>link</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="visited">
+ <selector-value>visited</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="hover">
+ <selector-value>hover</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="active">
+ <selector-value>active</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="focus">
+ <selector-value>focus</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="lang">
+ <selector-value>lang</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="left">
+ <selector-value>left</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="right">
+ <selector-value>right</selector-value>
+ </pseudo-class-def>
+ <pseudo-class-def name="first">
+ <selector-value>first</selector-value>
+ </pseudo-class-def>
+
+ <pseudo-element-def name="first-line">
+ <selector-value>first-line</selector-value>
+ </pseudo-element-def>
+ <pseudo-element-def name="first-letter">
+ <selector-value>first-letter</selector-value>
+ </pseudo-element-def>
+ <pseudo-element-def name="before">
+ <selector-value>before</selector-value>
+ </pseudo-element-def>
+ <pseudo-element-def name="after">
+ <selector-value>after</selector-value>
+ </pseudo-element-def>
+
+ <!-- property definition -->
+
+ <property-def name="azimuth"
+ inherited="yes" mediagroup="aural" category="aural">
+ <description>This provides spatial audio property for aural
+ presentation</description>
+ <number name="angle"/>
+ <keyword name="left-side"/>
+ <keyword name="far-left"/>
+ <keyword name="left"/>
+ <keyword name="center-left"/>
+ <keyword name="center"/>
+ <keyword name="center-right"/>
+ <keyword name="right"/>
+ <keyword name="far-right"/>
+ <keyword name="right-side"/>
+ <keyword name="behind"/>
+ <keyword name="leftwards"/>
+ <keyword name="rightwards"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="background"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <property name="background-color"/>
+ <property name="background-image"/>
+ <property name="background-repeat"/>
+ <property name="background-attachment"/>
+ <property name="background-position"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="background-attachment"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <keyword name="scroll"/>
+ <keyword name="fixed"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="background-color"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <container name="color"/>
+ <keyword name="transparent"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="background-image"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <function name="uri"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="background-position"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <number name="percentage"/>
+ <number name="length"/>
+ <keyword name="top"/>
+ <keyword name="center"/>
+ <keyword name="bottom"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="background-repeat"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <keyword name="repeat"/>
+ <keyword name="repeat-x"/>
+ <keyword name="repeat-y"/>
+ <keyword name="no-repeat"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border"
+ inherited="no" mediagroup="visual" category="box">
+ <property name="border-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-collapse"
+ inherited="yes" mediagroup="visual" category="tables">
+ <keyword name="collapse"/>
+ <keyword name="separate"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-color"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="color"/>
+ <keyword name="transparent"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-spacing"
+ inherited="yes" mediagroup="visual" category="tables">
+ <number name="length"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-style"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-style"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-top"
+ inherited="no" mediagroup="visual" category="box">
+ <property name="border-top-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-right"
+ inherited="no" mediagroup="visual" category="box">
+ <property name="border-right-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-bottom"
+ inherited="no" mediagroup="visual" category="box">
+ <property name="border-bottom-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-left"
+ inherited="no" mediagroup="visual" category="box">
+ <property name="border-left-width"/>
+ <property name="border-style"/>
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-top-color"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-right-color"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-bottom-color"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-left-color"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-top-style"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-style"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-right-style"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-style"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-bottom-style"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-style"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-left-style"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-style"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-top-width"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-right-width"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-bottom-width"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-left-width"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="border-width"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="border-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="bottom"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="caption-side"
+ inherited="yes" mediagroup="visual" category="tables">
+ <keyword name="top"/>
+ <keyword name="bottom"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="clear"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="none"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="both"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="clip"
+ inherited="no" mediagroup="visual" category="visual">
+ <container name="shape"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="color"
+ inherited="yes" mediagroup="visual" category="colorandbackground">
+ <container name="color"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="content"
+ inherited="no" mediagroup="all" category="content">
+ <string name="any"/>
+ <function name="uri"/>
+ <function name="counter"/>
+ <function name="attr"/>
+ <keyword name="open-quote"/>
+ <keyword name="close-quote"/>
+ <keyword name="no-open-quote"/>
+ <keyword name="no-close-quote"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="counter-increment"
+ inherited="no" mediagroup="all" category="content">
+ <string name="counter-identifier"/>
+ <number name="integer"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="counter-reset"
+ inherited="no" mediagroup="all" category="content">
+ <string name="counter-identifier"/>
+ <number name="integer"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="cue"
+ inherited="no" mediagroup="aural" category="aural">
+ <property name="cue-before"/>
+ <property name="cue-after"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="cue-after"
+ inherited="no" mediagroup="aural" category="aural">
+ <function name="uri"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="cue-before"
+ inherited="no" mediagroup="aural" category="aural">
+ <function name="uri"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="cursor"
+ inherited="yes" mediagroup="visual,interactive" category="ui">
+ <function name="uri"/>
+ <keyword name="auto"/>
+ <keyword name="crosshair"/>
+ <keyword name="default"/>
+ <keyword name="pointer"/>
+ <keyword name="move"/>
+ <keyword name="e-resize"/>
+ <keyword name="ne-resize"/>
+ <keyword name="nw-resize"/>
+ <keyword name="n-resize"/>
+ <keyword name="se-resize"/>
+ <keyword name="sw-resize"/>
+ <keyword name="s-resize"/>
+ <keyword name="w-resize"/>
+ <keyword name="text"/>
+ <keyword name="wait"/>
+ <keyword name="help"/>
+ <keyword name="inherit"/>
+ <separator name="comma"/>
+ </property-def>
+ <property-def name="direction"
+ inherited="yes" mediagroup="visual" category="visual">
+ <keyword name="ltr"/>
+ <keyword name="rtl"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="display"
+ inherited="no" mediagroup="all" category="visual">
+ <keyword name="inline"/>
+ <keyword name="block"/>
+ <keyword name="list-item"/>
+ <keyword name="run-in"/>
+ <keyword name="compact"/>
+ <keyword name="marker"/>
+ <keyword name="table"/>
+ <keyword name="inline-table"/>
+ <keyword name="table-row-group"/>
+ <keyword name="table-header-group"/>
+ <keyword name="table-footer-group"/>
+ <keyword name="table-row"/>
+ <keyword name="table-column-group"/>
+ <keyword name="table-column"/>
+ <keyword name="table-cell"/>
+ <keyword name="table-caption"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="elevation"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="angle"/>
+ <keyword name="below"/>
+ <keyword name="level"/>
+ <keyword name="above"/>
+ <keyword name="higher"/>
+ <keyword name="lower"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="empty-cells"
+ inherited="yes" mediagroup="visual" category="tables">
+ <keyword name="show"/>
+ <keyword name="hide"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="float"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="font"
+ inherited="yes" mediagroup="visual" category="font">
+ <property name="font-style"/>
+ <property name="font-variant"/>
+ <property name="font-weight"/>
+ <property name="font-size"/>
+ <property name="line-height"/>
+ <property name="font-family"/>
+ <keyword name="caption"/>
+ <keyword name="icon"/>
+ <keyword name="menu"/>
+ <keyword name="message-box"/>
+ <keyword name="small-caption"/>
+ <keyword name="status-bar"/>
+ <keyword name="inherit"/>
+ <separator name="slash"/>
+ </property-def>
+ <property-def name="font-family"
+ inherited="yes" mediagroup="visual" category="font">
+ <string name="family-name"/>
+ <container name="generic-family"/>
+ <keyword name="inherit"/>
+ <separator name="comma"/>
+ </property-def>
+ <property-def name="font-size"
+ inherited="yes" mediagroup="visual" category="font">
+ <container name="absolute-size"/>
+ <container name="relative-size"/>
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="font-size-adjust"
+ inherited="yes" mediagroup="visual" category="font">
+ <number name="number"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="font-stretch"
+ inherited="yes" mediagroup="visual" category="font">
+ <keyword name="normal"/>
+ <keyword name="wider"/>
+ <keyword name="narrower"/>
+ <keyword name="ultra-condensed"/>
+ <keyword name="extra-condensed"/>
+ <keyword name="condensed"/>
+ <keyword name="semi-condensed"/>
+ <keyword name="semi-expanded"/>
+ <keyword name="expanded"/>
+ <keyword name="extra-expanded"/>
+ <keyword name="ultra-expanded"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="font-style"
+ inherited="yes" mediagroup="visual" category="font">
+ <keyword name="normal"/>
+ <keyword name="italic"/>
+ <keyword name="oblique"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="font-variant"
+ inherited="yes" mediagroup="visual" category="font">
+ <keyword name="normal"/>
+ <keyword name="small-caps"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="font-weight"
+ inherited="yes" mediagroup="visual" category="font">
+ <keyword name="normal"/>
+ <keyword name="bold"/>
+ <keyword name="bolder"/>
+ <keyword name="lighter"/>
+ <keyword name="100"/>
+ <keyword name="200"/>
+ <keyword name="300"/>
+ <keyword name="400"/>
+ <keyword name="500"/>
+ <keyword name="600"/>
+ <keyword name="700"/>
+ <keyword name="800"/>
+ <keyword name="900"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="height"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="left"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="letter-spacing"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="normal"/>
+ <number name="length"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="line-height"
+ inherited="yes" mediagroup="visual" category="visual">
+ <keyword name="normal"/>
+ <number name="number"/>
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="list-style"
+ inherited="yes" mediagroup="visual" category="content">
+ <property name="list-style-type"/>
+ <property name="list-style-position"/>
+ <property name="list-style-image"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="list-style-image"
+ inherited="yes" mediagroup="visual" category="content">
+ <function name="uri"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="list-style-position"
+ inherited="yes" mediagroup="visual" category="content">
+ <keyword name="inside"/>
+ <keyword name="outside"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="list-style-type"
+ inherited="yes" mediagroup="visual" category="content">
+ <keyword name="disc"/>
+ <keyword name="circle"/>
+ <keyword name="square"/>
+ <keyword name="decimal"/>
+ <keyword name="decimal-leading-zero"/>
+ <keyword name="lower-roman"/>
+ <keyword name="upper-roman"/>
+ <keyword name="lower-greek"/>
+ <keyword name="lower-alpha"/>
+ <keyword name="lower-latin"/>
+ <keyword name="upper-alpha"/>
+ <keyword name="upper-latin"/>
+ <keyword name="hebrew"/>
+ <keyword name="armenian"/>
+ <keyword name="georgian"/>
+ <keyword name="cjk-ideographic"/>
+ <keyword name="hiragana"/>
+ <keyword name="katakana"/>
+ <keyword name="hiragana-iroha"/>
+ <keyword name="katakana-iroha"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="margin"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="margin-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="margin-top"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="margin-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="margin-right"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="margin-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="margin-bottom"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="margin-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="margin-left"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="margin-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="marker-offset"
+ inherited="no" mediagroup="visual" category="content">
+ <number name="length"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="marks"
+ inherited="na" mediagroup="visual,paged" category="page">
+ <keyword name="crop"/>
+ <keyword name="cross"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="max-height"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="max-width"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="min-height"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="min-width"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="orphans"
+ inherited="yes" mediagroup="visual,paged" category="page">
+ <number name="integer"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="outline"
+ inherited="no" mediagroup="visual,interactive" category="ui">
+ <property name="outline-color"/>
+ <property name="outline-style"/>
+ <property name="outline-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="outline-color"
+ inherited="no" mediagroup="visual,interactive" category="ui">
+ <container name="color"/>
+ <keyword name="invert"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="outline-style"
+ inherited="no" mediagroup="visual,interactive" category="ui">
+ <container name="border-style"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="outline-width"
+ inherited="no" mediagroup="visual,interactive" category="ui">
+ <container name="border-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="overflow"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="visible"/>
+ <keyword name="hidden"/>
+ <keyword name="scroll"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="padding"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="padding-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="padding-top"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="padding-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="padding-right"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="padding-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="padding-bottom"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="padding-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="padding-left"
+ inherited="no" mediagroup="visual" category="box">
+ <container name="padding-width"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="page"
+ inherited="yes" mediagroup="visual,paged" category="page">
+ <string name="page-identifier"/>
+ <keyword name="auto"/>
+ </property-def>
+ <property-def name="page-break-after"
+ inherited="no" mediagroup="visual,paged" category="page">
+ <keyword name="auto"/>
+ <keyword name="always"/>
+ <keyword name="avoid"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="page-break-before"
+ inherited="no" mediagroup="visual,paged" category="page">
+ <keyword name="auto"/>
+ <keyword name="always"/>
+ <keyword name="avoid"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="page-break-inside"
+ inherited="yes" mediagroup="visual,paged" category="page">
+ <keyword name="avoid"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="pause"
+ inherited="no" mediagroup="aural" category="aural">
+ <number name="time"/>
+ <number name="percentage"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="pause-after"
+ inherited="no" mediagroup="aural" category="aural">
+ <number name="time"/>
+ <number name="percentage"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="pause-before"
+ inherited="no" mediagroup="aural" category="aural">
+ <number name="time"/>
+ <number name="percentage"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="pitch"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="frequency"/>
+ <keyword name="x-low"/>
+ <keyword name="low"/>
+ <keyword name="medium"/>
+ <keyword name="high"/>
+ <keyword name="x-high"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="pitch-range"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="number"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="play-during"
+ inherited="no" mediagroup="aural" category="aural">
+ <function name="uri"/>
+ <keyword name="mix"/>
+ <keyword name="repeat"/>
+ <keyword name="auto"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="position"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="static"/>
+ <keyword name="relative"/>
+ <keyword name="absolute"/>
+ <keyword name="fixed"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="quotes"
+ inherited="yes" mediagroup="visual" category="content">
+ <string name="any"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="richness"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="number"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="right"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="size"
+ inherited="na" mediagroup="visual,paged" category="page">
+ <number name="length"/>
+ <keyword name="auto"/>
+ <keyword name="portrait"/>
+ <keyword name="landscape"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="speak"
+ inherited="yes" mediagroup="aural" category="aural">
+ <keyword name="normal"/>
+ <keyword name="none"/>
+ <keyword name="spell-out"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="speak-header"
+ inherited="yes" mediagroup="aural" category="tables">
+ <keyword name="once"/>
+ <keyword name="always"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="speak-numeral"
+ inherited="yes" mediagroup="aural" category="aural">
+ <keyword name="digits"/>
+ <keyword name="continuous"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="speak-punctuation"
+ inherited="yes" mediagroup="aural" category="aural">
+ <keyword name="code"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="speech-rate"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="number"/>
+ <keyword name="x-slow"/>
+ <keyword name="slow"/>
+ <keyword name="medium"/>
+ <keyword name="fast"/>
+ <keyword name="x-fast"/>
+ <keyword name="faster"/>
+ <keyword name="slower"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="stress"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="number"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="table-layout"
+ inherited="no" mediagroup="visual" category="tables">
+ <keyword name="auto"/>
+ <keyword name="fixed"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-align"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="center"/>
+ <keyword name="justify"/>
+ <string name="any"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-decoration"
+ inherited="no" mediagroup="visual" category="text">
+ <keyword name="none"/>
+ <keyword name="underline"/>
+ <keyword name="overline"/>
+ <keyword name="line-through"/>
+ <keyword name="blink"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-indent"
+ inherited="yes" mediagroup="visual" category="text">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-shadow"
+ inherited="no" mediagroup="visual" category="text">
+ <keyword name="none"/>
+ <container name="color"/>
+ <number name="length"/>
+ <keyword name="inherit"/>
+ <separator name="comma"/>
+ </property-def>
+ <property-def name="text-transform"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="capitalize"/>
+ <keyword name="uppercase"/>
+ <keyword name="lowercase"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="top"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="unicode-bidi"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="normal"/>
+ <keyword name="embed"/>
+ <keyword name="bidi-override"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="vertical-align"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="baseline"/>
+ <keyword name="sub"/>
+ <keyword name="super"/>
+ <keyword name="top"/>
+ <keyword name="text-top"/>
+ <keyword name="middle"/>
+ <keyword name="bottom"/>
+ <keyword name="text-bottom"/>
+ <number name="percentage"/>
+ <number name="length"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="visibility"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="visible"/>
+ <keyword name="hidden"/>
+ <keyword name="collapse"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="voice-family"
+ inherited="yes" mediagroup="aural" category="aural">
+ <string name="specific-voice"/>
+ <container name="generic-voice"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="volume"
+ inherited="yes" mediagroup="aural" category="aural">
+ <number name="number"/>
+ <number name="percentage"/>
+ <keyword name="silent"/>
+ <keyword name="x-soft"/>
+ <keyword name="soft"/>
+ <keyword name="medium"/>
+ <keyword name="loud"/>
+ <keyword name="x-loud"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="white-space"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="normal"/>
+ <keyword name="pre"/>
+ <keyword name="nowrap"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="widows"
+ inherited="yes" mediagroup="visual,paged" category="page">
+ <number name="integer"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="width"
+ inherited="no" mediagroup="visual" category="visual">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="word-spacing"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="normal"/>
+ <number name="length"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="z-index"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="auto"/>
+ <number name="integer"/>
+ <keyword name="inherit"/>
+ </property-def>
+
+ <!-- descriptor definition : These are for @font-face -->
+
+ <descriptor-def name="ascent">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="baseline">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="bbox">
+ <number name="number"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="cap-height">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="centerline">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="definition-src">
+ <function name="uri"/>
+ </descriptor-def>
+ <descriptor-def name="descent">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="font-family">
+ <string name="family-name"/>
+ <container name="generic-family"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="font-size">
+ <keyword name="all"/>
+ <number name="length"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="font-stretch">
+ <keyword name="all"/>
+ <keyword name="normal"/>
+ <keyword name="ultra-condensed"/>
+ <keyword name="extra-condensed"/>
+ <keyword name="condensed"/>
+ <keyword name="semi-condensed"/>
+ <keyword name="semi-expanded"/>
+ <keyword name="expanded"/>
+ <keyword name="extra-expanded"/>
+ <keyword name="ultra-expanded"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="font-style">
+ <keyword name="all"/>
+ <keyword name="normal"/>
+ <keyword name="italic"/>
+ <keyword name="oblique"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="font-variant">
+ <keyword name="normal"/>
+ <keyword name="small-caps"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="font-weight">
+ <keyword name="all"/>
+ <keyword name="normal"/>
+ <keyword name="bold"/>
+ <keyword name="100"/>
+ <keyword name="200"/>
+ <keyword name="300"/>
+ <keyword name="400"/>
+ <keyword name="500"/>
+ <keyword name="600"/>
+ <keyword name="700"/>
+ <keyword name="800"/>
+ <keyword name="900"/>
+ <separator name="comma"/>
+ </descriptor-def>
+ <descriptor-def name="mathline">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="panose-1">
+ <number name="integer"/>
+ </descriptor-def>
+ <descriptor-def name="slope">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="src">
+ <function name="uri"/>
+ <function name="format"/>
+ <container name="font-face-name"/>
+ </descriptor-def>
+ <descriptor-def name="stemh">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="stemv">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="topline">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="unicode-range">
+ <string name="urange"/>
+ </descriptor-def>
+ <descriptor-def name="units-per-em">
+ <number name="number"/>
+ </descriptor-def>
+ <descriptor-def name="widths">
+ <string name="urange"/>
+ <number name="length"/>
+ </descriptor-def>
+ <descriptor-def name="x-height">
+ <number name="number"/>
+ </descriptor-def>
+
+ <!-- container definition : Container is the lump of values.
+ It can be used like macros. -->
+ <container-def name="absolute-size">
+ <keyword name="xx-small"/>
+ <keyword name="x-small"/>
+ <keyword name="small"/>
+ <keyword name="medium"/>
+ <keyword name="large"/>
+ <keyword name="x-large"/>
+ <keyword name="xx-large"/>
+ </container-def>
+ <container-def name="border-style">
+ <keyword name="none"/>
+ <keyword name="hidden"/>
+ <keyword name="dotted"/>
+ <keyword name="dashed"/>
+ <keyword name="solid"/>
+ <keyword name="double"/>
+ <keyword name="groove"/>
+ <keyword name="ridge"/>
+ <keyword name="inset"/>
+ <keyword name="outset"/>
+ </container-def>
+ <container-def name="border-width">
+ <keyword name="thin"/>
+ <keyword name="medium"/>
+ <keyword name="thick"/>
+ <number name="length"/>
+ </container-def>
+ <container-def name="color">
+ <keyword name="aqua"/>
+ <keyword name="black"/>
+ <keyword name="blue"/>
+ <keyword name="fuchsia"/>
+ <keyword name="gray"/>
+ <keyword name="green"/>
+ <keyword name="lime"/>
+ <keyword name="maroon"/>
+ <keyword name="navy"/>
+ <keyword name="olive"/>
+ <keyword name="purple"/>
+ <keyword name="red"/>
+ <keyword name="silver"/>
+ <keyword name="teal"/>
+ <keyword name="white"/>
+ <keyword name="yellow"/>
+ <container name="system-color"/>
+ <function name="rgb"/>
+ <number name="hash"/>
+ </container-def>
+ <container-def name="generic-family">
+ <keyword name="serif"/>
+ <keyword name="sans-serif"/>
+ <keyword name="cursive"/>
+ <keyword name="fantasy"/>
+ <keyword name="monospace"/>
+ </container-def>
+ <container-def name="font-face-name">
+ <function name="local"/>
+ </container-def>
+ <container-def name="generic-voice">
+ <keyword name="male"/>
+ <keyword name="female"/>
+ <keyword name="child"/>
+ </container-def>
+ <container-def name="margin-width">
+ <number name="length"/>
+ <number name="percentage"/>
+ <keyword name="auto"/>
+ </container-def>
+ <container-def name="padding-width">
+ <number name="length"/>
+ <number name="percentage"/>
+ </container-def>
+ <container-def name="relative-size">
+ <keyword name="smaller"/>
+ <keyword name="larger"/>
+ </container-def>
+ <container-def name="shape">
+ <function name="rect"/>
+ </container-def>
+ <container-def name="system-color">
+ <keyword name="ActiveBorder"/>
+ <keyword name="ActiveCaption"/>
+ <keyword name="AppWorkspace"/>
+ <keyword name="Background"/>
+ <keyword name="ButtonFace"/>
+ <keyword name="ButtonHighlight"/>
+ <keyword name="ButtonShadow"/>
+ <keyword name="ButtonText"/>
+ <keyword name="CaptionText"/>
+ <keyword name="GrayText"/>
+ <keyword name="Highlight"/>
+ <keyword name="HighlightText"/>
+ <keyword name="InactiveBorder"/>
+ <keyword name="InactiveCaption"/>
+ <keyword name="InactiveCaptionText"/>
+ <keyword name="InfoBackground"/>
+ <keyword name="InfoText"/>
+ <keyword name="Menu"/>
+ <keyword name="MenuText"/>
+ <keyword name="Scrollbar"/>
+ <keyword name="ThreeDDarkShadow"/>
+ <keyword name="ThreeDFace"/>
+ <keyword name="ThreeDHighlight"/>
+ <keyword name="ThreeDLightShadow"/>
+ <keyword name="ThreeDShadow"/>
+ <keyword name="Window"/>
+ <keyword name="WindowFrame"/>
+ <keyword name="WindowText"/>
+ </container-def>
+
+ <!-- category definition : This is used to categorize properties
+ in Properties View. -->
+ <category-def name="aural">
+ <caption>%css2.category-def.aural.caption</caption>
+ </category-def>
+ <category-def name="box">
+ <caption>%css2.category-def.box.caption</caption>
+ </category-def>
+ <category-def name="colorandbackground">
+ <caption>%css2.category-def.colorandbackground.caption</caption>
+ </category-def>
+ <category-def name="content">
+ <caption>%css2.category-def.content.caption</caption>
+ </category-def>
+ <category-def name="font">
+ <caption>%css2.category-def.font.caption</caption>
+ </category-def>
+ <category-def name="page">
+ <caption>%css2.category-def.page.caption</caption>
+ </category-def>
+ <category-def name="tables">
+ <caption>%css2.category-def.tables.caption</caption>
+ </category-def>
+ <category-def name="text">
+ <caption>%css2.category-def.text.caption</caption>
+ </category-def>
+ <category-def name="ui">
+ <caption>%css2.category-def.ui.caption</caption>
+ </category-def>
+ <category-def name="visual">
+<!-- <caption>%css2.category-def.visual.caption</caption>-->
+ <caption>%css2.category-def.visual.caption</caption>
+ </category-def>
+
+ <!-- function definition -->
+ <function-def name="attr">
+ <function-value>attr</function-value>
+ </function-def>
+ <function-def name="counter">
+ <function-value>counter</function-value>
+ </function-def>
+ <function-def name="rect">
+ <function-value>rect</function-value>
+ </function-def>
+ <function-def name="rgb">
+ <function-value>rgb</function-value>
+ </function-def>
+ <function-def name="uri">
+ <function-value>url</function-value>
+ </function-def>
+ <function-def name="format">
+ <function-value>format</function-value>
+ </function-def>
+ <function-def name="local">
+ <function-value>local</function-value>
+ </function-def>
+
+ <!-- number definition : What unit types be acceptable for each
+ number type? -->
+ <number-def name="angle">
+ <unit name="deg"/>
+ <unit name="grad"/>
+ <unit name="rad"/>
+ </number-def>
+ <number-def name="frequency">
+ <unit name="hz"/>
+ <unit name="khz"/>
+ </number-def>
+ <number-def name="hash">
+ <unit name="hash"/>
+ </number-def>
+ <number-def name="integer">
+ </number-def>
+ <number-def name="length">
+ <unit name="em"/>
+ <unit name="ex"/>
+ <unit name="px"/>
+ <unit name="in"/>
+ <unit name="cm"/>
+ <unit name="mm"/>
+ <unit name="pt"/>
+ <unit name="pc"/>
+ </number-def>
+ <number-def name="number">
+ </number-def>
+ <number-def name="percentage">
+ <unit name="percentage"/>
+ </number-def>
+ <number-def name="time">
+ <unit name="ms"/>
+ <unit name="s"/>
+ </number-def>
+
+ <unit-def name="cm">
+ <unit-value>cm</unit-value>
+ </unit-def>
+ <unit-def name="deg">
+ <unit-value>deg</unit-value>
+ </unit-def>
+ <unit-def name="em">
+ <unit-value>em</unit-value>
+ </unit-def>
+ <unit-def name="ex">
+ <unit-value>ex</unit-value>
+ </unit-def>
+ <unit-def name="grad">
+ <unit-value>grad</unit-value>
+ </unit-def>
+ <unit-def name="hash">
+ <unit-value>#</unit-value>
+ </unit-def>
+ <unit-def name="hz">
+ <unit-value>Hz</unit-value>
+ </unit-def>
+ <unit-def name="in">
+ <unit-value>in</unit-value>
+ </unit-def>
+ <unit-def name="khz">
+ <unit-value>kHz</unit-value>
+ </unit-def>
+ <unit-def name="mm">
+ <unit-value>mm</unit-value>
+ </unit-def>
+ <unit-def name="ms">
+ <unit-value>ms</unit-value>
+ </unit-def>
+ <unit-def name="pc">
+ <unit-value>pc</unit-value>
+ </unit-def>
+ <unit-def name="percentage">
+ <unit-value>%</unit-value>
+ </unit-def>
+ <unit-def name="pt">
+ <unit-value>pt</unit-value>
+ </unit-def>
+ <unit-def name="px">
+ <unit-value>px</unit-value>
+ </unit-def>
+ <unit-def name="rad">
+ <unit-value>rad</unit-value>
+ </unit-def>
+ <unit-def name="s">
+ <unit-value>s</unit-value>
+ </unit-def>
+
+ <!-- keywords : string constants (this is last part..) -->
+ <keyword-def name="100">
+ <keyword-value>100</keyword-value>
+ </keyword-def>
+ <keyword-def name="200">
+ <keyword-value>200</keyword-value>
+ </keyword-def>
+ <keyword-def name="300">
+ <keyword-value>300</keyword-value>
+ </keyword-def>
+ <keyword-def name="400">
+ <keyword-value>400</keyword-value>
+ </keyword-def>
+ <keyword-def name="500">
+ <keyword-value>500</keyword-value>
+ </keyword-def>
+ <keyword-def name="600">
+ <keyword-value>600</keyword-value>
+ </keyword-def>
+ <keyword-def name="700">
+ <keyword-value>700</keyword-value>
+ </keyword-def>
+ <keyword-def name="800">
+ <keyword-value>800</keyword-value>
+ </keyword-def>
+ <keyword-def name="900">
+ <keyword-value>900</keyword-value>
+ </keyword-def>
+ <keyword-def name="above">
+ <keyword-value>above</keyword-value>
+ </keyword-def>
+ <keyword-def name="absolute">
+ <keyword-value>absolute</keyword-value>
+ </keyword-def>
+ <keyword-def name="ActiveBorder">
+ <keyword-value>ActiveBorder</keyword-value>
+ </keyword-def>
+ <keyword-def name="ActiveCaption">
+ <keyword-value>ActiveCaption</keyword-value>
+ </keyword-def>
+ <keyword-def name="all">
+ <keyword-value>all</keyword-value>
+ </keyword-def>
+ <keyword-def name="always">
+ <keyword-value>always</keyword-value>
+ </keyword-def>
+ <keyword-def name="AppWorkspace">
+ <keyword-value>AppWorkspace</keyword-value>
+ </keyword-def>
+ <keyword-def name="aqua">
+ <keyword-value>aqua</keyword-value>
+ </keyword-def>
+ <keyword-def name="armenian">
+ <keyword-value>armenian</keyword-value>
+ </keyword-def>
+ <keyword-def name="auto">
+ <keyword-value>auto</keyword-value>
+ </keyword-def>
+ <keyword-def name="avoid">
+ <keyword-value>avoid</keyword-value>
+ </keyword-def>
+ <keyword-def name="Background">
+ <keyword-value>Background</keyword-value>
+ </keyword-def>
+ <keyword-def name="baseline">
+ <keyword-value>baseline</keyword-value>
+ </keyword-def>
+ <keyword-def name="behind">
+ <keyword-value>behind</keyword-value>
+ </keyword-def>
+ <keyword-def name="below">
+ <keyword-value>below</keyword-value>
+ </keyword-def>
+ <keyword-def name="bidi-override">
+ <keyword-value>bidi-override</keyword-value>
+ </keyword-def>
+ <keyword-def name="black">
+ <keyword-value>black</keyword-value>
+ </keyword-def>
+ <keyword-def name="blink">
+ <keyword-value>blink</keyword-value>
+ </keyword-def>
+ <keyword-def name="block">
+ <keyword-value>block</keyword-value>
+ </keyword-def>
+ <keyword-def name="blue">
+ <keyword-value>blue</keyword-value>
+ </keyword-def>
+ <keyword-def name="bold">
+ <keyword-value>bold</keyword-value>
+ </keyword-def>
+ <keyword-def name="bolder">
+ <keyword-value>bolder</keyword-value>
+ </keyword-def>
+ <keyword-def name="both">
+ <keyword-value>both</keyword-value>
+ </keyword-def>
+ <keyword-def name="bottom">
+ <keyword-value>bottom</keyword-value>
+ </keyword-def>
+ <keyword-def name="ButtonFace">
+ <keyword-value>ButtonFace</keyword-value>
+ </keyword-def>
+ <keyword-def name="ButtonHighlight">
+ <keyword-value>ButtonHighlight</keyword-value>
+ </keyword-def>
+ <keyword-def name="ButtonShadow">
+ <keyword-value>ButtonShadow</keyword-value>
+ </keyword-def>
+ <keyword-def name="ButtonText">
+ <keyword-value>ButtonText</keyword-value>
+ </keyword-def>
+ <keyword-def name="capitalize">
+ <keyword-value>capitalize</keyword-value>
+ </keyword-def>
+ <keyword-def name="caption">
+ <keyword-value>caption</keyword-value>
+ </keyword-def>
+ <keyword-def name="CaptionText">
+ <keyword-value>CaptionText</keyword-value>
+ </keyword-def>
+ <keyword-def name="center">
+ <keyword-value>center</keyword-value>
+ </keyword-def>
+ <keyword-def name="center-left">
+ <keyword-value>center-left</keyword-value>
+ </keyword-def>
+ <keyword-def name="center-right">
+ <keyword-value>center-right</keyword-value>
+ </keyword-def>
+ <keyword-def name="child">
+ <keyword-value>child</keyword-value>
+ </keyword-def>
+ <keyword-def name="circle">
+ <keyword-value>circle</keyword-value>
+ </keyword-def>
+ <keyword-def name="cjk-ideographic">
+ <keyword-value>cjk-ideographic</keyword-value>
+ </keyword-def>
+ <keyword-def name="close-quote">
+ <keyword-value>close-quote</keyword-value>
+ </keyword-def>
+ <keyword-def name="code">
+ <keyword-value>code</keyword-value>
+ </keyword-def>
+ <keyword-def name="condensed">
+ <keyword-value>condensed</keyword-value>
+ </keyword-def>
+ <keyword-def name="collapse">
+ <keyword-value>collapse</keyword-value>
+ </keyword-def>
+ <keyword-def name="compact">
+ <keyword-value>compact</keyword-value>
+ </keyword-def>
+ <keyword-def name="continuous">
+ <keyword-value>continuous</keyword-value>
+ </keyword-def>
+ <keyword-def name="crop">
+ <keyword-value>crop</keyword-value>
+ </keyword-def>
+ <keyword-def name="cross">
+ <keyword-value>cross</keyword-value>
+ </keyword-def>
+ <keyword-def name="crosshair">
+ <keyword-value>crosshair</keyword-value>
+ </keyword-def>
+ <keyword-def name="cursive">
+ <keyword-value>cursive</keyword-value>
+ </keyword-def>
+ <keyword-def name="dashed">
+ <keyword-value>dashed</keyword-value>
+ </keyword-def>
+ <keyword-def name="decimal">
+ <keyword-value>decimal</keyword-value>
+ </keyword-def>
+ <keyword-def name="decimal-leading-zero">
+ <keyword-value>decimal-leading-zero</keyword-value>
+ </keyword-def>
+ <keyword-def name="default">
+ <keyword-value>default</keyword-value>
+ </keyword-def>
+ <keyword-def name="digits">
+ <keyword-value>digits</keyword-value>
+ </keyword-def>
+ <keyword-def name="disc">
+ <keyword-value>disc</keyword-value>
+ </keyword-def>
+ <keyword-def name="dotted">
+ <keyword-value>dotted</keyword-value>
+ </keyword-def>
+ <keyword-def name="double">
+ <keyword-value>double</keyword-value>
+ </keyword-def>
+ <keyword-def name="e-resize">
+ <keyword-value>e-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="embed">
+ <keyword-value>embed</keyword-value>
+ </keyword-def>
+ <keyword-def name="expanded">
+ <keyword-value>expanded</keyword-value>
+ </keyword-def>
+ <keyword-def name="extra-condensed">
+ <keyword-value>extra-condensed</keyword-value>
+ </keyword-def>
+ <keyword-def name="extra-expanded">
+ <keyword-value>extra-expanded</keyword-value>
+ </keyword-def>
+ <keyword-def name="fantasy">
+ <keyword-value>fantasy</keyword-value>
+ </keyword-def>
+ <keyword-def name="far-left">
+ <keyword-value>far-left</keyword-value>
+ </keyword-def>
+ <keyword-def name="far-right">
+ <keyword-value>far-right</keyword-value>
+ </keyword-def>
+ <keyword-def name="fast">
+ <keyword-value>fast</keyword-value>
+ </keyword-def>
+ <keyword-def name="faster">
+ <keyword-value>faster</keyword-value>
+ </keyword-def>
+ <keyword-def name="female">
+ <keyword-value>female</keyword-value>
+ </keyword-def>
+ <keyword-def name="fixed">
+ <keyword-value>fixed</keyword-value>
+ </keyword-def>
+ <keyword-def name="fuchsia">
+ <keyword-value>fuchsia</keyword-value>
+ </keyword-def>
+ <keyword-def name="georgian">
+ <keyword-value>georgian</keyword-value>
+ </keyword-def>
+ <keyword-def name="gray">
+ <keyword-value>gray</keyword-value>
+ </keyword-def>
+ <keyword-def name="GrayText">
+ <keyword-value>GrayText</keyword-value>
+ </keyword-def>
+ <keyword-def name="green">
+ <keyword-value>green</keyword-value>
+ </keyword-def>
+ <keyword-def name="groove">
+ <keyword-value>groove</keyword-value>
+ </keyword-def>
+ <keyword-def name="hebrew">
+ <keyword-value>hebrew</keyword-value>
+ </keyword-def>
+ <keyword-def name="help">
+ <keyword-value>help</keyword-value>
+ </keyword-def>
+ <keyword-def name="hidden">
+ <keyword-value>hidden</keyword-value>
+ </keyword-def>
+ <keyword-def name="hide">
+ <keyword-value>hide</keyword-value>
+ </keyword-def>
+ <keyword-def name="high">
+ <keyword-value>high</keyword-value>
+ </keyword-def>
+ <keyword-def name="Highlight">
+ <keyword-value>Highlight</keyword-value>
+ </keyword-def>
+ <keyword-def name="HighlightText">
+ <keyword-value>HighlightText</keyword-value>
+ </keyword-def>
+ <keyword-def name="higher">
+ <keyword-value>higher</keyword-value>
+ </keyword-def>
+ <keyword-def name="hiragana">
+ <keyword-value>hiragana</keyword-value>
+ </keyword-def>
+ <keyword-def name="hiragana-iroha">
+ <keyword-value>hiragana-iroha</keyword-value>
+ </keyword-def>
+ <keyword-def name="icon">
+ <keyword-value>icon</keyword-value>
+ </keyword-def>
+ <keyword-def name="InactiveBorder">
+ <keyword-value>InactiveBorder</keyword-value>
+ </keyword-def>
+ <keyword-def name="InactiveCaption">
+ <keyword-value>InactiveCaption</keyword-value>
+ </keyword-def>
+ <keyword-def name="InactiveCaptionText">
+ <keyword-value>InactiveCaptionText</keyword-value>
+ </keyword-def>
+ <keyword-def name="InfoBackground">
+ <keyword-value>InfoBackground</keyword-value>
+ </keyword-def>
+ <keyword-def name="InfoText">
+ <keyword-value>InfoText</keyword-value>
+ </keyword-def>
+ <keyword-def name="inherit">
+ <keyword-value>inherit</keyword-value>
+ </keyword-def>
+ <keyword-def name="inline">
+ <keyword-value>inline</keyword-value>
+ </keyword-def>
+ <keyword-def name="inline-table">
+ <keyword-value>inline-table</keyword-value>
+ </keyword-def>
+ <keyword-def name="inset">
+ <keyword-value>inset</keyword-value>
+ </keyword-def>
+ <keyword-def name="inside">
+ <keyword-value>inside</keyword-value>
+ </keyword-def>
+ <keyword-def name="invert">
+ <keyword-value>invert</keyword-value>
+ </keyword-def>
+ <keyword-def name="italic">
+ <keyword-value>italic</keyword-value>
+ </keyword-def>
+ <keyword-def name="justify">
+ <keyword-value>justify</keyword-value>
+ </keyword-def>
+ <keyword-def name="katakana">
+ <keyword-value>katakana</keyword-value>
+ </keyword-def>
+ <keyword-def name="katakana-iroha">
+ <keyword-value>katakana-iroha</keyword-value>
+ </keyword-def>
+ <keyword-def name="landscape">
+ <keyword-value>landscape</keyword-value>
+ </keyword-def>
+ <keyword-def name="large">
+ <keyword-value>large</keyword-value>
+ </keyword-def>
+ <keyword-def name="larger">
+ <keyword-value>larger</keyword-value>
+ </keyword-def>
+ <keyword-def name="left">
+ <keyword-value>left</keyword-value>
+ </keyword-def>
+ <keyword-def name="left-side">
+ <keyword-value>left-side</keyword-value>
+ </keyword-def>
+ <keyword-def name="leftwards">
+ <keyword-value>leftwards</keyword-value>
+ </keyword-def>
+ <keyword-def name="level">
+ <keyword-value>level</keyword-value>
+ </keyword-def>
+ <keyword-def name="lighter">
+ <keyword-value>lighter</keyword-value>
+ </keyword-def>
+ <keyword-def name="lime">
+ <keyword-value>lime</keyword-value>
+ </keyword-def>
+ <keyword-def name="line-through">
+ <keyword-value>line-through</keyword-value>
+ </keyword-def>
+ <keyword-def name="list-item">
+ <keyword-value>list-item</keyword-value>
+ </keyword-def>
+ <keyword-def name="loud">
+ <keyword-value>loud</keyword-value>
+ </keyword-def>
+ <keyword-def name="low">
+ <keyword-value>low</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower">
+ <keyword-value>lower</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower-alpha">
+ <keyword-value>lower-alpha</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower-greek">
+ <keyword-value>lower-greek</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower-latin">
+ <keyword-value>lower-latin</keyword-value>
+ </keyword-def>
+ <keyword-def name="lower-roman">
+ <keyword-value>lower-roman</keyword-value>
+ </keyword-def>
+ <keyword-def name="lowercase">
+ <keyword-value>lowercase</keyword-value>
+ </keyword-def>
+ <keyword-def name="ltr">
+ <keyword-value>ltr</keyword-value>
+ </keyword-def>
+ <keyword-def name="male">
+ <keyword-value>male</keyword-value>
+ </keyword-def>
+ <keyword-def name="marker">
+ <keyword-value>marker</keyword-value>
+ </keyword-def>
+ <keyword-def name="maroon">
+ <keyword-value>maroon</keyword-value>
+ </keyword-def>
+ <keyword-def name="medium">
+ <keyword-value>medium</keyword-value>
+ </keyword-def>
+ <keyword-def name="Menu">
+ <keyword-value>Menu</keyword-value>
+ </keyword-def>
+ <keyword-def name="MenuText">
+ <keyword-value>MenuText</keyword-value>
+ </keyword-def>
+ <keyword-def name="message-box">
+ <keyword-value>message-box</keyword-value>
+ </keyword-def>
+ <keyword-def name="middle">
+ <keyword-value>middle</keyword-value>
+ </keyword-def>
+ <keyword-def name="mix">
+ <keyword-value>mix</keyword-value>
+ </keyword-def>
+ <keyword-def name="monospace">
+ <keyword-value>monospace</keyword-value>
+ </keyword-def>
+ <keyword-def name="move">
+ <keyword-value>move</keyword-value>
+ </keyword-def>
+ <keyword-def name="n-resize">
+ <keyword-value>n-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="narrower">
+ <keyword-value>narrower</keyword-value>
+ </keyword-def>
+ <keyword-def name="navy">
+ <keyword-value>navy</keyword-value>
+ </keyword-def>
+ <keyword-def name="ne-resize">
+ <keyword-value>ne-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="no-close-quote">
+ <keyword-value>no-close-quote</keyword-value>
+ </keyword-def>
+ <keyword-def name="no-open-quote">
+ <keyword-value>no-open-quote</keyword-value>
+ </keyword-def>
+ <keyword-def name="no-repeat">
+ <keyword-value>no-repeat</keyword-value>
+ </keyword-def>
+ <keyword-def name="none">
+ <keyword-value>none</keyword-value>
+ </keyword-def>
+ <keyword-def name="normal">
+ <keyword-value>normal</keyword-value>
+ </keyword-def>
+ <keyword-def name="nowrap">
+ <keyword-value>nowrap</keyword-value>
+ </keyword-def>
+ <keyword-def name="nw-resize">
+ <keyword-value>nw-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="oblique">
+ <keyword-value>oblique</keyword-value>
+ </keyword-def>
+ <keyword-def name="olive">
+ <keyword-value>olive</keyword-value>
+ </keyword-def>
+ <keyword-def name="once">
+ <keyword-value>once</keyword-value>
+ </keyword-def>
+ <keyword-def name="open-quote">
+ <keyword-value>open-quote</keyword-value>
+ </keyword-def>
+ <keyword-def name="outset">
+ <keyword-value>outset</keyword-value>
+ </keyword-def>
+ <keyword-def name="outside">
+ <keyword-value>outside</keyword-value>
+ </keyword-def>
+ <keyword-def name="overline">
+ <keyword-value>overline</keyword-value>
+ </keyword-def>
+ <keyword-def name="pointer">
+ <keyword-value>pointer</keyword-value>
+ </keyword-def>
+ <keyword-def name="portrait">
+ <keyword-value>portrait</keyword-value>
+ </keyword-def>
+ <keyword-def name="pre">
+ <keyword-value>pre</keyword-value>
+ </keyword-def>
+ <keyword-def name="purple">
+ <keyword-value>purple</keyword-value>
+ </keyword-def>
+ <keyword-def name="red">
+ <keyword-value>red</keyword-value>
+ </keyword-def>
+ <keyword-def name="relative">
+ <keyword-value>relative</keyword-value>
+ </keyword-def>
+ <keyword-def name="repeat">
+ <keyword-value>repeat</keyword-value>
+ </keyword-def>
+ <keyword-def name="repeat-x">
+ <keyword-value>repeat-x</keyword-value>
+ </keyword-def>
+ <keyword-def name="repeat-y">
+ <keyword-value>repeat-y</keyword-value>
+ </keyword-def>
+ <keyword-def name="ridge">
+ <keyword-value>ridge</keyword-value>
+ </keyword-def>
+ <keyword-def name="right">
+ <keyword-value>right</keyword-value>
+ </keyword-def>
+ <keyword-def name="right-side">
+ <keyword-value>right-side</keyword-value>
+ </keyword-def>
+ <keyword-def name="rightwards">
+ <keyword-value>rightwards</keyword-value>
+ </keyword-def>
+ <keyword-def name="rtl">
+ <keyword-value>rtl</keyword-value>
+ </keyword-def>
+ <keyword-def name="run-in">
+ <keyword-value>run-in</keyword-value>
+ </keyword-def>
+ <keyword-def name="s-resize">
+ <keyword-value>s-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="sans-serif">
+ <keyword-value>sans-serif</keyword-value>
+ </keyword-def>
+ <keyword-def name="scroll">
+ <keyword-value>scroll</keyword-value>
+ </keyword-def>
+ <keyword-def name="Scrollbar">
+ <keyword-value>Scrollbar</keyword-value>
+ </keyword-def>
+ <keyword-def name="se-resize">
+ <keyword-value>se-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="semi-condensed">
+ <keyword-value>semi-condensed</keyword-value>
+ </keyword-def>
+ <keyword-def name="semi-expanded">
+ <keyword-value>semi-expanded</keyword-value>
+ </keyword-def>
+ <keyword-def name="separate">
+ <keyword-value>separate</keyword-value>
+ </keyword-def>
+ <keyword-def name="serif">
+ <keyword-value>serif</keyword-value>
+ </keyword-def>
+ <keyword-def name="show">
+ <keyword-value>show</keyword-value>
+ </keyword-def>
+ <keyword-def name="silent">
+ <keyword-value>silent</keyword-value>
+ </keyword-def>
+ <keyword-def name="silver">
+ <keyword-value>silver</keyword-value>
+ </keyword-def>
+ <keyword-def name="slow">
+ <keyword-value>slow</keyword-value>
+ </keyword-def>
+ <keyword-def name="slower">
+ <keyword-value>slower</keyword-value>
+ </keyword-def>
+ <keyword-def name="small">
+ <keyword-value>small</keyword-value>
+ </keyword-def>
+ <keyword-def name="small-caps">
+ <keyword-value>small-caps</keyword-value>
+ </keyword-def>
+ <keyword-def name="small-caption">
+ <keyword-value>small-caption</keyword-value>
+ </keyword-def>
+ <keyword-def name="smaller">
+ <keyword-value>smaller</keyword-value>
+ </keyword-def>
+ <keyword-def name="soft">
+ <keyword-value>soft</keyword-value>
+ </keyword-def>
+ <keyword-def name="solid">
+ <keyword-value>solid</keyword-value>
+ </keyword-def>
+ <keyword-def name="spell-out">
+ <keyword-value>spell-out</keyword-value>
+ </keyword-def>
+ <keyword-def name="square">
+ <keyword-value>square</keyword-value>
+ </keyword-def>
+ <keyword-def name="static">
+ <keyword-value>static</keyword-value>
+ </keyword-def>
+ <keyword-def name="status-bar">
+ <keyword-value>status-bar</keyword-value>
+ </keyword-def>
+ <keyword-def name="sub">
+ <keyword-value>sub</keyword-value>
+ </keyword-def>
+ <keyword-def name="super">
+ <keyword-value>super</keyword-value>
+ </keyword-def>
+ <keyword-def name="sw-resize">
+ <keyword-value>sw-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="table">
+ <keyword-value>table</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-caption">
+ <keyword-value>table-caption</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-cell">
+ <keyword-value>table-cell</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-column">
+ <keyword-value>table-column</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-column-group">
+ <keyword-value>table-column-group</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-footer-group">
+ <keyword-value>table-footer-group</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-header-group">
+ <keyword-value>table-header-group</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-row">
+ <keyword-value>table-row</keyword-value>
+ </keyword-def>
+ <keyword-def name="table-row-group">
+ <keyword-value>table-row-group</keyword-value>
+ </keyword-def>
+ <keyword-def name="teal">
+ <keyword-value>teal</keyword-value>
+ </keyword-def>
+ <keyword-def name="text">
+ <keyword-value>text</keyword-value>
+ </keyword-def>
+ <keyword-def name="text-top">
+ <keyword-value>text-top</keyword-value>
+ </keyword-def>
+ <keyword-def name="text-bottom">
+ <keyword-value>text-bottom</keyword-value>
+ </keyword-def>
+ <keyword-def name="thick">
+ <keyword-value>thick</keyword-value>
+ </keyword-def>
+ <keyword-def name="thin">
+ <keyword-value>thin</keyword-value>
+ </keyword-def>
+ <keyword-def name="ThreeDDarkShadow">
+ <keyword-value>ThreeDDarkShadow</keyword-value>
+ </keyword-def>
+ <keyword-def name="ThreeDFace">
+ <keyword-value>ThreeDFace</keyword-value>
+ </keyword-def>
+ <keyword-def name="ThreeDHighlight">
+ <keyword-value>ThreeDHighlight</keyword-value>
+ </keyword-def>
+ <keyword-def name="ThreeDLightShadow">
+ <keyword-value>ThreeDLightShadow</keyword-value>
+ </keyword-def>
+ <keyword-def name="ThreeDShadow">
+ <keyword-value>ThreeDShadow</keyword-value>
+ </keyword-def>
+ <keyword-def name="top">
+ <keyword-value>top</keyword-value>
+ </keyword-def>
+ <keyword-def name="transparent">
+ <keyword-value>transparent</keyword-value>
+ </keyword-def>
+ <keyword-def name="ultra-condensed">
+ <keyword-value>ultra-condensed</keyword-value>
+ </keyword-def>
+ <keyword-def name="ultra-expanded">
+ <keyword-value>ultra-expanded</keyword-value>
+ </keyword-def>
+ <keyword-def name="underline">
+ <keyword-value>underline</keyword-value>
+ </keyword-def>
+ <keyword-def name="upper-alpha">
+ <keyword-value>upper-alpha</keyword-value>
+ </keyword-def>
+ <keyword-def name="upper-latin">
+ <keyword-value>upper-latin</keyword-value>
+ </keyword-def>
+ <keyword-def name="upper-roman">
+ <keyword-value>upper-roman</keyword-value>
+ </keyword-def>
+ <keyword-def name="uppercase">
+ <keyword-value>uppercase</keyword-value>
+ </keyword-def>
+ <keyword-def name="visible">
+ <keyword-value>visible</keyword-value>
+ </keyword-def>
+ <keyword-def name="w-resize">
+ <keyword-value>w-resize</keyword-value>
+ </keyword-def>
+ <keyword-def name="wait">
+ <keyword-value>wait</keyword-value>
+ </keyword-def>
+ <keyword-def name="white">
+ <keyword-value>white</keyword-value>
+ </keyword-def>
+ <keyword-def name="wider">
+ <keyword-value>wider</keyword-value>
+ </keyword-def>
+ <keyword-def name="Window">
+ <keyword-value>Window</keyword-value>
+ </keyword-def>
+ <keyword-def name="WindowFrame">
+ <keyword-value>WindowFrame</keyword-value>
+ </keyword-def>
+ <keyword-def name="WindowText">
+ <keyword-value>WindowText</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-fast">
+ <keyword-value>x-fast</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-high">
+ <keyword-value>x-high</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-large">
+ <keyword-value>x-large</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-loud">
+ <keyword-value>x-loud</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-low">
+ <keyword-value>x-low</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-slow">
+ <keyword-value>x-slow</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-small">
+ <keyword-value>x-small</keyword-value>
+ </keyword-def>
+ <keyword-def name="x-soft">
+ <keyword-value>x-soft</keyword-value>
+ </keyword-def>
+ <keyword-def name="xx-small">
+ <keyword-value>xx-small</keyword-value>
+ </keyword-def>
+ <keyword-def name="xx-large">
+ <keyword-value>xx-large</keyword-value>
+ </keyword-def>
+ <keyword-def name="yellow">
+ <keyword-value>yellow</keyword-value>
+ </keyword-def>
+</css-profile> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-mobile1_0.xml b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-mobile1_0.xml
new file mode 100644
index 0000000000..73b6c1209c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-mobile1_0.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--<!DOCTYPE css-profile SYSTEM "css-profile.dtd" >-->
+<css-profile>
+ <profile-import name="cssprofile-css2.xml"/>
+ <stylesheet-def>
+ <description>%mobile1_0.stylesheet-def.description</description>
+ <charset-rule/>
+ <import-rule/>
+ <media-rule/>
+ <style-rule/>
+ </stylesheet-def>
+
+ <!-- Which properties can style rule include ? -->
+ <!-- using "overwrite" method: only disabled properties are written. -->
+
+ <style-rule-def overwrite="true">
+ <selector-expression name="child" enabled="false"/>
+ <selector-expression name="adjacent" enabled="false"/>
+ <selector-expression name="attribute" enabled="false"/>
+ <pseudo-class name="first-child" enabled="false"/>
+ <pseudo-class name="link" enabled="false"/>
+ <pseudo-class name="active" enabled="false"/>
+ <pseudo-class name="lang" enabled="false"/>
+ <property name="azimuth" enabled="false"/>
+ <property name="border-collapse" enabled="false"/>
+ <property name="border-spacing" enabled="false"/>
+ <property name="bottom" enabled="false"/>
+ <property name="caption-side" enabled="false"/>
+ <property name="clip" enabled="false"/>
+ <property name="content" enabled="false"/>
+ <property name="counter-increment" enabled="false"/>
+ <property name="counter-reset" enabled="false"/>
+ <property name="cue" enabled="false"/>
+ <property name="cue-after" enabled="false"/>
+ <property name="cue-before" enabled="false"/>
+ <property name="cursor" enabled="false"/>
+ <property name="direction" enabled="false"/>
+ <property name="elevation" enabled="false"/>
+ <property name="empty-cells" enabled="false"/>
+ <property name="font-size-adjust" enabled="false"/>
+ <property name="font-stretch" enabled="false"/>
+ <property name="left" enabled="false"/>
+ <property name="letter-spacing" enabled="false"/>
+ <property name="line-height" enabled="false"/>
+ <property name="marker-offset" enabled="false"/>
+ <property name="marks" enabled="false"/>
+ <property name="max-height" enabled="false"/>
+ <property name="max-width" enabled="false"/>
+ <property name="min-height" enabled="false"/>
+ <property name="min-width" enabled="false"/>
+ <property name="orphans" enabled="false"/>
+ <property name="outline" enabled="false"/>
+ <property name="outline-color" enabled="false"/>
+ <property name="outline-style" enabled="false"/>
+ <property name="outline-width" enabled="false"/>
+ <property name="overflow" enabled="false"/>
+ <property name="page" enabled="false"/>
+ <property name="page-break-after" enabled="false"/>
+ <property name="page-break-before" enabled="false"/>
+ <property name="page-break-inside" enabled="false"/>
+ <property name="pause" enabled="false"/>
+ <property name="pause-after" enabled="false"/>
+ <property name="pause-before" enabled="false"/>
+ <property name="pitch" enabled="false"/>
+ <property name="pitch-range" enabled="false"/>
+ <property name="play-during" enabled="false"/>
+ <property name="position" enabled="false"/>
+ <property name="quotes" enabled="false"/>
+ <property name="richness" enabled="false"/>
+ <property name="right" enabled="false"/>
+ <property name="size" enabled="false"/>
+ <property name="speak" enabled="false"/>
+ <property name="speak-header" enabled="false"/>
+ <property name="speak-numeral" enabled="false"/>
+ <property name="speak-punctuation" enabled="false"/>
+ <property name="speech-rate" enabled="false"/>
+ <property name="stress" enabled="false"/>
+ <property name="table-layout" enabled="false"/>
+ <property name="text-shadow" enabled="false"/>
+ <property name="top" enabled="false"/>
+ <property name="unicode-bidi" enabled="false"/>
+ <property name="voice-family" enabled="false"/>
+ <property name="volume" enabled="false"/>
+ <property name="widows" enabled="false"/>
+ <property name="word-spacing" enabled="false"/>
+ <property name="z-index" enabled="false"/>
+ </style-rule-def>
+
+ <!-- property definition -->
+ <!-- using "redifine" method: if "overwrite" attribute is set to
+ "false" or not set, it means the node is cleanly redifined -->
+
+ <property-def name="background-attachment"
+ inherited="no" mediagroup="visual" category="colorandbackground">
+ <keyword name="scroll"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="display"
+ inherited="no" mediagroup="all" category="visual">
+ <keyword name="inline"/>
+ <keyword name="block"/>
+ <keyword name="list-item"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="list-style-type"
+ inherited="yes" mediagroup="visual" category="content">
+ <keyword name="disc"/>
+ <keyword name="circle"/>
+ <keyword name="square"/>
+ <keyword name="decimal"/>
+ <keyword name="lower-roman"/>
+ <keyword name="upper-roman"/>
+ <keyword name="lower-greek"/>
+ <keyword name="lower-alpha"/>
+ <keyword name="upper-alpha"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-align"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="center"/>
+ <keyword name="justify"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-decoration"
+ inherited="no" mediagroup="visual" category="text">
+ <keyword name="none"/>
+ <keyword name="underline"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="vertical-align"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="baseline"/>
+ <keyword name="sub"/>
+ <keyword name="super"/>
+ <keyword name="inherit"/>
+ </property-def>
+
+ <!-- container definition : Container is the lump of values.
+ It can be used like macros. -->
+ <container-def name="color" overwrite="true">
+ <container name="system-color" enabled="false"/>
+ </container-def>
+</css-profile> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-wap.xml b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-wap.xml
new file mode 100644
index 0000000000..d3b2a09000
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile-wap.xml
@@ -0,0 +1,614 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--<!DOCTYPE css-profile SYSTEM "css-profile.dtd" >-->
+<css-profile>
+ <profile-import name="cssprofile-css2.xml"/>
+ <stylesheet-def>
+ <description>%wap.stylesheet-def.description</description>
+ <charset-rule/>
+ <import-rule/>
+ <media-rule/>
+ <style-rule/>
+ </stylesheet-def>
+
+ <!-- Which properties can style rule include ? -->
+ <!-- using "overwrite" method: only disabled properties are written. -->
+
+ <style-rule-def overwrite="true">
+ <property name="azimuth" enabled="false"/>
+ <property name="border-collapse" enabled="false"/>
+ <property name="border-spacing" enabled="false"/>
+ <property name="bottom" enabled="false"/>
+ <property name="caption-side" enabled="false"/>
+ <property name="clip" enabled="false"/>
+ <property name="content" enabled="false"/>
+ <property name="cue" enabled="false"/>
+ <property name="cue-after" enabled="false"/>
+ <property name="cue-before" enabled="false"/>
+ <property name="cursor" enabled="false"/>
+ <property name="direction" enabled="false"/>
+ <property name="elevation" enabled="false"/>
+ <property name="empty-cells" enabled="false"/>
+ <property name="font-size-adjust" enabled="false"/>
+ <property name="font-stretch" enabled="false"/>
+ <property name="left" enabled="false"/>
+ <property name="letter-spacing" enabled="false"/>
+ <property name="line-height" enabled="false"/>
+ <property name="marker-offset" enabled="false"/>
+ <property name="marks" enabled="false"/>
+ <property name="max-height" enabled="false"/>
+ <property name="max-width" enabled="false"/>
+ <property name="min-height" enabled="false"/>
+ <property name="min-width" enabled="false"/>
+ <property name="orphans" enabled="false"/>
+ <property name="outline" enabled="false"/>
+ <property name="outline-color" enabled="false"/>
+ <property name="outline-style" enabled="false"/>
+ <property name="outline-width" enabled="false"/>
+ <property name="overflow" enabled="false"/>
+ <property name="page" enabled="false"/>
+ <property name="page-break-after" enabled="false"/>
+ <property name="page-break-before" enabled="false"/>
+ <property name="page-break-inside" enabled="false"/>
+ <property name="pause" enabled="false"/>
+ <property name="pause-after" enabled="false"/>
+ <property name="pause-before" enabled="false"/>
+ <property name="pitch" enabled="false"/>
+ <property name="pitch-range" enabled="false"/>
+ <property name="play-during" enabled="false"/>
+ <property name="position" enabled="false"/>
+ <property name="quotes" enabled="false"/>
+ <property name="richness" enabled="false"/>
+ <property name="right" enabled="false"/>
+ <property name="size" enabled="false"/>
+ <property name="speak" enabled="false"/>
+ <property name="speak-header" enabled="false"/>
+ <property name="speak-numeral" enabled="false"/>
+ <property name="speak-punctuation" enabled="false"/>
+ <property name="speech-rate" enabled="false"/>
+ <property name="stress" enabled="false"/>
+ <property name="table-layout" enabled="false"/>
+ <property name="text-shadow" enabled="false"/>
+ <property name="top" enabled="false"/>
+ <property name="unicode-bidi" enabled="false"/>
+ <property name="voice-family" enabled="false"/>
+ <property name="volume" enabled="false"/>
+ <property name="widows" enabled="false"/>
+ <property name="word-spacing" enabled="false"/>
+ <property name="z-index" enabled="false"/>
+ <property name="-wap-marquee-style"/>
+ <property name="-wap-marquee-loop"/>
+ <property name="-wap-marquee-dir"/>
+ <property name="-wap-marquee-speed"/>
+ <property name="-wap-accesskey"/>
+ <property name="-wap-input-format"/>
+ <property name="-wap-input-required"/>
+ </style-rule-def>
+
+ <!-- property definition -->
+ <!-- using "redifine" method: if "overwrite" attribute is set to
+ "false" or not set, it means the node is cleanly redifined -->
+
+ <property-def name="display"
+ inherited="no" mediagroup="all" category="visual">
+ <keyword name="inline"/>
+ <keyword name="block"/>
+ <keyword name="list-item"/>
+ <keyword name="-wap-marquee"/>
+ <keyword name="none"/>
+ </property-def>
+ <property-def name="list-style-type"
+ inherited="yes" mediagroup="visual" category="content">
+ <keyword name="disc"/>
+ <keyword name="circle"/>
+ <keyword name="square"/>
+ <keyword name="decimal"/>
+ <keyword name="lower-roman"/>
+ <keyword name="upper-roman"/>
+ <keyword name="lower-alpha"/>
+ <keyword name="upper-alpha"/>
+ <keyword name="none"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-align"
+ inherited="yes" mediagroup="visual" category="text">
+ <keyword name="left"/>
+ <keyword name="right"/>
+ <keyword name="center"/>
+ <keyword name="justify"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="text-decoration"
+ inherited="no" mediagroup="visual" category="text">
+ <keyword name="none"/>
+ <keyword name="underline"/>
+ <keyword name="blink"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="vertical-align"
+ inherited="no" mediagroup="visual" category="visual">
+ <keyword name="baseline"/>
+ <keyword name="sub"/>
+ <keyword name="super"/>
+ <keyword name="top"/>
+ <keyword name="middle"/>
+ <keyword name="bottom"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-marquee-style"
+ inherited="no" mediagroup="visual" category="wap">
+ <keyword name="scroll"/>
+ <keyword name="slide"/>
+ <keyword name="alternate"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-marquee-loop"
+ inherited="no" mediagroup="visual" category="wap">
+ <number name="integer"/>
+ <keyword name="infinite"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-marquee-dir"
+ inherited="no" mediagroup="visual" category="wap">
+ <keyword name="ltr"/>
+ <keyword name="rtl"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-marquee-speed"
+ inherited="no" mediagroup="visual" category="wap">
+ <keyword name="slow"/>
+ <keyword name="normal"/>
+ <keyword name="fast"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-accesskey"
+ inherited="no" mediagroup="interactive" category="wap">
+ <container name="keycombination"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-input-format"
+ inherited="no" mediagroup="interactive" category="wap">
+ <container name="format"/>
+ <keyword name="inherit"/>
+ </property-def>
+ <property-def name="-wap-input-required"
+ inherited="no" mediagroup="interactive" category="wap">
+ <keyword name="true"/>
+ <keyword name="false"/>
+ <keyword name="inherit"/>
+ </property-def>
+
+ <!-- container definition : Container is the lump of values.
+ It can be used like macros. -->
+ <container-def name="color" overwrite="true">
+ <container name="system-color" enabled="false"/>
+ </container-def>
+ <container-def name="format">
+ <string name="any"/>
+ </container-def>
+ <container-def name="keycombination">
+ <container name="key"/>
+ <keyword name="-"/>
+ </container-def>
+ <container-def name="key">
+ <keyword name="space"/>
+ <container name="specialkey"/>
+ </container-def>
+ <container-def name="specialkey">
+ <container name="modifierkey"/>
+ <container name="functionkey"/>
+ <container name="navigationkey"/>
+ <container name="editkey"/>
+ <container name="misckey"/>
+ <container name="volumecontrolkey"/>
+ <container name="applicationkey"/>
+ <container name="phonekey"/>
+ <container name="vendorkey"/>
+ </container-def>
+ <container-def name="modifierkey">
+ <keyword name="accesskey"/>
+ <container name="cmdkey"/>
+ <container name="optkey"/>
+ <container name="ctrlkey"/>
+ <container name="shiftkey"/>
+ <container name="altkey"/>
+ <container name="winkey"/>
+ <container name="metakey"/>
+ <keyword name="fn"/>
+ <keyword name="fcn"/>
+ <keyword name="caps"/>
+ </container-def>
+ <container-def name="cmdkey">
+ <keyword name="cmd"/>
+ <keyword name="rcmd"/>
+ <keyword name="lcmd"/>
+ </container-def>
+ <container-def name="optkey">
+ <keyword name="opt"/>
+ <keyword name="ropt"/>
+ <keyword name="lopt"/>
+ </container-def>
+ <container-def name="ctrlkey">
+ <keyword name="ctrl"/>
+ <keyword name="rctrl"/>
+ <keyword name="lctrl"/>
+ </container-def>
+ <container-def name="shiftkey">
+ <keyword name="shift"/>
+ <keyword name="rshift"/>
+ <keyword name="lshift"/>
+ </container-def>
+ <container-def name="altkey">
+ <keyword name="alt"/>
+ <keyword name="ralt"/>
+ <keyword name="lalt"/>
+ </container-def>
+ <container-def name="winkey">
+ <keyword name="win"/>
+ <keyword name="rwin"/>
+ <keyword name="lwin"/>
+ </container-def>
+ <container-def name="metakey">
+ <keyword name="meta"/>
+ <keyword name="rmeta"/>
+ <keyword name="lmeta"/>
+ </container-def>
+ <container-def name="functionkey">
+ <keyword name="f1"/>
+ <keyword name="f2"/>
+ <keyword name="f3"/>
+ <keyword name="f4"/>
+ <keyword name="f5"/>
+ <keyword name="f6"/>
+ <keyword name="f7"/>
+ <keyword name="f8"/>
+ <keyword name="f9"/>
+ <keyword name="f10"/>
+ <keyword name="f11"/>
+ <keyword name="f12"/>
+ <keyword name="f13"/>
+ <keyword name="f14"/>
+ <keyword name="f15"/>
+ </container-def>
+ <container-def name="navigationkey">
+ <keyword name="tab"/>
+ <keyword name="esc"/>
+ <keyword name="enter"/>
+ <keyword name="return"/>
+ <keyword name="menu"/>
+ <keyword name="help"/>
+ <keyword name="namemenu"/>
+ <keyword name="rcl"/>
+ <keyword name="snd"/>
+ <keyword name="arrowkey"/>
+ <keyword name="pagekey"/>
+ </container-def>
+ <container-def name="arrowkey">
+ <keyword name="up"/>
+ <keyword name="down"/>
+ <keyword name="left"/>
+ <keyword name="right"/>
+ </container-def>
+ <container-def name="pagekey">
+ <keyword name="home"/>
+ <keyword name="end"/>
+ <keyword name="pgup"/>
+ <keyword name="pgdn"/>
+ </container-def>
+ <container-def name="editkey">
+ <keyword name="bs"/>
+ <keyword name="del"/>
+ <keyword name="ins"/>
+ <keyword name="undo"/>
+ <keyword name="cut"/>
+ <keyword name="copy"/>
+ <keyword name="paste"/>
+ <keyword name="clr"/>
+ <keyword name="sto"/>
+ </container-def>
+ <container-def name="misckey">
+ <keyword name="prtsc"/>
+ <keyword name="sysrq"/>
+ <keyword name="scrlock"/>
+ <keyword name="pause"/>
+ <keyword name="brk"/>
+ <keyword name="numlock"/>
+ <keyword name="pwr"/>
+ </container-def>
+ <container-def name="volumecontrolkey">
+ <keyword name="volumeup"/>
+ <keyword name="volumedown"/>
+ </container-def>
+ <container-def name="applicationkey">
+ <keyword name="memo"/>
+ <keyword name="todo"/>
+ <keyword name="calendar"/>
+ <keyword name="mail"/>
+ <keyword name="address"/>
+ </container-def>
+ <container-def name="phonekey">
+ <keyword name="phone-send"/>
+ <keyword name="phone-end"/>
+ <keyword name="phone-accept"/>
+ </container-def>
+ <container-def name="vendorkey">
+ <keyword name="vnd."/>
+ </container-def>
+
+ <category-def name="wap">
+ <caption>%wap.category-def.wap.caption</caption>
+ </category-def>
+
+ <number-def name="length">
+ <unit name="em"/>
+ <unit name="ex"/>
+ <unit name="px"/>
+ </number-def>
+
+ <keyword-def name="-wap-marquee">
+ <keyword-value>-wap-marquee</keyword-value>
+ </keyword-def>
+ <keyword-def name="slide">
+ <keyword-value>slide</keyword-value>
+ </keyword-def>
+ <keyword-def name="alternate">
+ <keyword-value>alternate</keyword-value>
+ </keyword-def>
+ <keyword-def name="infinite">
+ <keyword-value>infinite</keyword-value>
+ </keyword-def>
+ <keyword-def name="-">
+ <keyword-value>-</keyword-value>
+ </keyword-def>
+ <keyword-def name="space">
+ <keyword-value>space</keyword-value>
+ </keyword-def>
+ <keyword-def name="accesskey">
+ <keyword-value>accesskey</keyword-value>
+ </keyword-def>
+ <keyword-def name="fn">
+ <keyword-value>fn</keyword-value>
+ </keyword-def>
+ <keyword-def name="fcn">
+ <keyword-value>fcn</keyword-value>
+ </keyword-def>
+ <keyword-def name="caps">
+ <keyword-value>caps</keyword-value>
+ </keyword-def>
+ <keyword-def name="cmd">
+ <keyword-value>cmd</keyword-value>
+ </keyword-def>
+ <keyword-def name="rcmd">
+ <keyword-value>rcmd</keyword-value>
+ </keyword-def>
+ <keyword-def name="lcmd">
+ <keyword-value>lcmd</keyword-value>
+ </keyword-def>
+ <keyword-def name="opt">
+ <keyword-value>opt</keyword-value>
+ </keyword-def>
+ <keyword-def name="ropt">
+ <keyword-value>ropt</keyword-value>
+ </keyword-def>
+ <keyword-def name="lopt">
+ <keyword-value>lopt</keyword-value>
+ </keyword-def>
+ <keyword-def name="ctrl">
+ <keyword-value>ctrl</keyword-value>
+ </keyword-def>
+ <keyword-def name="rctrl">
+ <keyword-value>rctrl</keyword-value>
+ </keyword-def>
+ <keyword-def name="lctrl">
+ <keyword-value>lctrl</keyword-value>
+ </keyword-def>
+ <keyword-def name="shift">
+ <keyword-value>shift</keyword-value>
+ </keyword-def>
+ <keyword-def name="rshift">
+ <keyword-value>rshift</keyword-value>
+ </keyword-def>
+ <keyword-def name="lshift">
+ <keyword-value>lshift</keyword-value>
+ </keyword-def>
+ <keyword-def name="alt">
+ <keyword-value>alt</keyword-value>
+ </keyword-def>
+ <keyword-def name="ralt">
+ <keyword-value>ralt</keyword-value>
+ </keyword-def>
+ <keyword-def name="lalt">
+ <keyword-value>lalt</keyword-value>
+ </keyword-def>
+ <keyword-def name="win">
+ <keyword-value>win</keyword-value>
+ </keyword-def>
+ <keyword-def name="rwin">
+ <keyword-value>rwin</keyword-value>
+ </keyword-def>
+ <keyword-def name="lwin">
+ <keyword-value>lwin</keyword-value>
+ </keyword-def>
+ <keyword-def name="meta">
+ <keyword-value>meta</keyword-value>
+ </keyword-def>
+ <keyword-def name="rmeta">
+ <keyword-value>rmeta</keyword-value>
+ </keyword-def>
+ <keyword-def name="lmeta">
+ <keyword-value>lmeta</keyword-value>
+ </keyword-def>
+ <keyword-def name="f1">
+ <keyword-value>f1</keyword-value>
+ </keyword-def>
+ <keyword-def name="f2">
+ <keyword-value>f2</keyword-value>
+ </keyword-def>
+ <keyword-def name="f3">
+ <keyword-value>f3</keyword-value>
+ </keyword-def>
+ <keyword-def name="f4">
+ <keyword-value>f4</keyword-value>
+ </keyword-def>
+ <keyword-def name="f5">
+ <keyword-value>f5</keyword-value>
+ </keyword-def>
+ <keyword-def name="f6">
+ <keyword-value>f6</keyword-value>
+ </keyword-def>
+ <keyword-def name="f7">
+ <keyword-value>f7</keyword-value>
+ </keyword-def>
+ <keyword-def name="f8">
+ <keyword-value>f8</keyword-value>
+ </keyword-def>
+ <keyword-def name="f9">
+ <keyword-value>f9</keyword-value>
+ </keyword-def>
+ <keyword-def name="f10">
+ <keyword-value>f10</keyword-value>
+ </keyword-def>
+ <keyword-def name="f11">
+ <keyword-value>f11</keyword-value>
+ </keyword-def>
+ <keyword-def name="f12">
+ <keyword-value>f12</keyword-value>
+ </keyword-def>
+ <keyword-def name="f13">
+ <keyword-value>f13</keyword-value>
+ </keyword-def>
+ <keyword-def name="f14">
+ <keyword-value>f14</keyword-value>
+ </keyword-def>
+ <keyword-def name="f15">
+ <keyword-value>f15</keyword-value>
+ </keyword-def>
+ <keyword-def name="tab">
+ <keyword-value>tab</keyword-value>
+ </keyword-def>
+ <keyword-def name="esc">
+ <keyword-value>esc</keyword-value>
+ </keyword-def>
+ <keyword-def name="enter">
+ <keyword-value>enter</keyword-value>
+ </keyword-def>
+ <keyword-def name="return">
+ <keyword-value>return</keyword-value>
+ </keyword-def>
+ <keyword-def name="namemenu">
+ <keyword-value>namemenu</keyword-value>
+ </keyword-def>
+ <keyword-def name="rcl">
+ <keyword-value>rcl</keyword-value>
+ </keyword-def>
+ <keyword-def name="snd">
+ <keyword-value>snd</keyword-value>
+ </keyword-def>
+ <keyword-def name="arrowkey">
+ <keyword-value>arrowkey</keyword-value>
+ </keyword-def>
+ <keyword-def name="pagekey">
+ <keyword-value>pagekey</keyword-value>
+ </keyword-def>
+ <keyword-def name="up">
+ <keyword-value>up</keyword-value>
+ </keyword-def>
+ <keyword-def name="down">
+ <keyword-value>down</keyword-value>
+ </keyword-def>
+ <keyword-def name="home">
+ <keyword-value>home</keyword-value>
+ </keyword-def>
+ <keyword-def name="end">
+ <keyword-value>end</keyword-value>
+ </keyword-def>
+ <keyword-def name="pgup">
+ <keyword-value>pgup</keyword-value>
+ </keyword-def>
+ <keyword-def name="pgdn">
+ <keyword-value>pgdn</keyword-value>
+ </keyword-def>
+ <keyword-def name="bs">
+ <keyword-value>bs</keyword-value>
+ </keyword-def>
+ <keyword-def name="del">
+ <keyword-value>del</keyword-value>
+ </keyword-def>
+ <keyword-def name="ins">
+ <keyword-value>ins</keyword-value>
+ </keyword-def>
+ <keyword-def name="undo">
+ <keyword-value>undo</keyword-value>
+ </keyword-def>
+ <keyword-def name="cut">
+ <keyword-value>cut</keyword-value>
+ </keyword-def>
+ <keyword-def name="copy">
+ <keyword-value>copy</keyword-value>
+ </keyword-def>
+ <keyword-def name="paste">
+ <keyword-value>paste</keyword-value>
+ </keyword-def>
+ <keyword-def name="clr">
+ <keyword-value>clr</keyword-value>
+ </keyword-def>
+ <keyword-def name="sto">
+ <keyword-value>sto</keyword-value>
+ </keyword-def>
+ <keyword-def name="prtsc">
+ <keyword-value>prtsc</keyword-value>
+ </keyword-def>
+ <keyword-def name="sysrq">
+ <keyword-value>sysrq</keyword-value>
+ </keyword-def>
+ <keyword-def name="scrlock">
+ <keyword-value>scrlock</keyword-value>
+ </keyword-def>
+ <keyword-def name="brk">
+ <keyword-value>brk</keyword-value>
+ </keyword-def>
+ <keyword-def name="numlock">
+ <keyword-value>numlock</keyword-value>
+ </keyword-def>
+ <keyword-def name="pwr">
+ <keyword-value>pwr</keyword-value>
+ </keyword-def>
+ <keyword-def name="volumeup">
+ <keyword-value>volumeup</keyword-value>
+ </keyword-def>
+ <keyword-def name="volumedown">
+ <keyword-value>volumedown</keyword-value>
+ </keyword-def>
+ <keyword-def name="memo">
+ <keyword-value>memo</keyword-value>
+ </keyword-def>
+ <keyword-def name="todo">
+ <keyword-value>todo</keyword-value>
+ </keyword-def>
+ <keyword-def name="calendar">
+ <keyword-value>calendar</keyword-value>
+ </keyword-def>
+ <keyword-def name="mail">
+ <keyword-value>mail</keyword-value>
+ </keyword-def>
+ <keyword-def name="address">
+ <keyword-value>address</keyword-value>
+ </keyword-def>
+ <keyword-def name="phone-send">
+ <keyword-value>phone-send</keyword-value>
+ </keyword-def>
+ <keyword-def name="phone-end">
+ <keyword-value>phone-end</keyword-value>
+ </keyword-def>
+ <keyword-def name="phone-accept">
+ <keyword-value>phone-accept</keyword-value>
+ </keyword-def>
+ <keyword-def name="vnd.">
+ <keyword-value>vnd.</keyword-value>
+ </keyword-def>
+ <keyword-def name="true">
+ <keyword-value>true</keyword-value>
+ </keyword-def>
+ <keyword-def name="false">
+ <keyword-value>false</keyword-value>
+ </keyword-def>
+</css-profile> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile.properties b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile.properties
new file mode 100644
index 0000000000..dd7e399c94
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/cssprofile/cssprofile.properties
@@ -0,0 +1,34 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+# cssprofile-css1.xml
+css1.stylesheet-def.description=Cascading Style Sheets, level 1
+css1.category-def.box.caption=Box model
+css1.category-def.colorandbackground.caption=Colors and Backgrounds
+css1.category-def.classification.caption=Classification
+css1.category-def.font.caption=Font
+css1.category-def.text.caption=Text
+# cssprofile-css2.xml
+css2.stylesheet-def.description=Cascading Style Sheets, level 2
+css2.category-def.aural.caption=Aural
+css2.category-def.box.caption=Box model
+css2.category-def.colorandbackground.caption=Colors and Backgrounds
+css2.category-def.content.caption=Generated content/List
+css2.category-def.font.caption=Fonts
+css2.category-def.page.caption=Paged media
+css2.category-def.tables.caption=Tables
+css2.category-def.text.caption=Text
+css2.category-def.visual.caption=Visual
+css2.category-def.ui.caption=User interface
+# cssprofile-mobile1_0.xml
+mobile1_0.stylesheet-def.description=CSS Mobile Profile 1.0
+# cssprofile-wap.xml
+wap.stylesheet-def.description=WCSS 1.0
+wap.category-def.wap.caption=WCSS Extensions
diff --git a/bundles/org.eclipse.wst.css.core/plugin.properties b/bundles/org.eclipse.wst.css.core/plugin.properties
new file mode 100644
index 0000000000..d304ed7183
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/plugin.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Structured_Source_CSS_Model.name=Structured Source CSS Model
+Structured_Source_CSS_Model_NL_Support.name=Structured Source CSS Model NL Support
+cssprofile_css2.name=CSS2: Cascading Style Sheets, level 2
+cssprofile_css1.name=CSS1: Cascading Style Sheets, level 1
+cssprofile_mobile1_0.name=CSS Mobile Profile 1.0
+cssprofile_wap.name=WCSS 1.0
diff --git a/bundles/org.eclipse.wst.css.core/plugin.xml b/bundles/org.eclipse.wst.css.core/plugin.xml
new file mode 100644
index 0000000000..960fcf6748
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/plugin.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.wst.css.core"
+ name="%Structured_Source_CSS_Model.name"
+ version="1.0.0"
+ provider-name="IBM"
+ class="org.eclipse.wst.css.core.CSSCorePlugin">
+
+ <runtime>
+ <library name="cssmodel.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.core.runtime.compatibility"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.wst.common.encoding"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.wst.sse.ui"/>
+ <import plugin="org.eclipse.wst.xml.core"/>
+ <import plugin="org.eclipse.wst.sse.core"/>
+ </requires>
+
+ <extension
+ point="org.eclipse.wst.sse.core.cssprofile">
+ <profile
+ name="%cssprofile_css2.name"
+ default="true"
+ uri="cssprofile/cssprofile-css2.xml"
+ id="org.eclipse.wst.css.core.cssprofile.css2">
+ </profile>
+ <profile
+ name="%cssprofile_css1.name"
+ uri="cssprofile/cssprofile-css1.xml"
+ id="org.eclipse.wst.css.core.cssprofile.css1">
+ </profile>
+ <profile
+ name="%cssprofile_mobile1_0.name"
+ uri="cssprofile/cssprofile-mobile1_0.xml"
+ id="org.eclipse.wst.css.core.cssprofile.mobile1_0">
+ </profile>
+ <profile
+ name="%cssprofile_wap.name"
+ uri="cssprofile/cssprofile-wap.xml"
+ id="org.eclipse.wst.css.core.cssprofile.wap">
+ </profile>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.core.modelHandler">
+ <modelHandler
+ class="org.eclipse.wst.css.core.modelhandler.ModelHandlerForCSS"
+ associatedContentTypeId="org.eclipse.wst.css.core.csssource"
+ id="org.eclipse.wst.css.core.modelhandler">
+ </modelHandler>
+ </extension>
+ <extension
+ id="org.eclipse.wst.css.core.builderdelegate.todo"
+ point="org.eclipse.wst.sse.core.builderdelegate">
+ <participant
+ class="org.eclipse.wst.css.core.internal.tasks.CSSTaskTagSeeker"
+ contentType="org.eclipse.wst.css.core.csssource">
+ </participant>
+ </extension>
+ <extension point="org.eclipse.core.filebuffers.documentCreation"
+ id="org.eclipse.wst.css.core.documentfactories"
+ name="Structured CSS Document Factory">
+ <factory
+ contentTypeId="org.eclipse.wst.css.core.csssource"
+ class="org.eclipse.wst.sse.core.filebuffers.BasicStructuredDocumentFactory:org.eclipse.wst.css.core.csssource"/>
+ </extension>
+ <extension
+ point="org.eclipse.team.core.fileTypes">
+ <fileTypes
+ type="text"
+ extension="css">
+ </fileTypes>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.core.formatProcessors">
+ <processor
+ class="org.eclipse.wst.css.core.format.FormatProcessorCSS"
+ contentTypeId="org.eclipse.wst.css.core.csssource">
+ </processor>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.contentTypes">
+ <content-type
+ file-extensions="css"
+ priority="high"
+ name="CSS Content Type"
+ id="csssource"
+ base-type="org.eclipse.core.runtime.text">
+ <describer class="org.eclipse.wst.css.core.internal.content.ContentDescriberForCSS"/>
+ </content-type>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.wst.css.core/src/ModelsCSS.properties b/bundles/org.eclipse.wst.css.core/src/ModelsCSS.properties
new file mode 100644
index 0000000000..315c83f54b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/ModelsCSS.properties
@@ -0,0 +1,31 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Please_specify_CSS_file_na=Please specify CSS file name.
+ERROR__Cannot_use_a_static_ERROR_=IWAK0071E ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.
+You_cannot_use_CSSStyleShe_UI_=You cannot use CSSStyleSheet.getOwnerRule() because of many referencers of this rule\nPlease use getOnwerRules()
+Missing_return_statement_i_ERROR_=IWAK0072E Missing return statement in function
+1concat_ERROR_=IWAK0073E {0}first flat node is null.
+2concat_ERROR_=IWAK0074E {0}first flat node is not in model.
+3concat_ERROR_=IWAK0075E {0}last flat node is null.
+4concat_ERROR_=IWAK0076E {0}last flat node is not in model.
+25concat_ERROR_=IWAK0077E {0}first region is null.
+26concat_ERROR_=IWAK0078E {0}first region is not in model.
+27concat_ERROR_=IWAK0079E {0}last region is null.
+28concat_ERROR_=IWAK0080E {0}last region is not in model.
+5concat_ERROR_=IWAK0081E {0}first region is null.
+6concat_ERROR_=IWAK0082E {0}first region is not in model.
+7concat_ERROR_=IWAK0083E {0}last region is null.
+8concat_ERROR_=IWAK0084E {0}last region is not in model.
+9concat_ERROR_=IWAK0085E Invalid escape character at line {0} column {1}.
+12concat_EXC_=IWAK0086E Caught Exception: {0}
+13concat_ERROR_=IWAK0087E Error: Ignoring invalid lexical state : {0}. State unchanged.
+15concat_ERROR_=IWAK0088E Lexical error at line {0}, column {1}. Encountered: {2} after :
+ERROR__Cannot_use_a_static_ERROR__ERROR_=IWAK0089E ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/CSSCorePlugin.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/CSSCorePlugin.java
new file mode 100644
index 0000000000..d4cfbf6b93
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/CSSCorePlugin.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.common.encoding.CommonCharsetNames;
+import org.eclipse.wst.common.encoding.CommonEncodingPreferenceNames;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class CSSCorePlugin extends Plugin {
+ // The shared instance.
+ private static CSSCorePlugin plugin;
+ // Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public CSSCorePlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.css.core.CssPluginResources"); //$NON-NLS-1$
+ }
+ catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static CSSCorePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = CSSCorePlugin.getDefault().getResourceBundle();
+ try {
+ return bundle.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPreferences()
+ */
+ protected void initializeDefaultPluginPreferences() {
+ super.initializeDefaultPluginPreferences();
+
+ Preferences prefs = getDefault().getPluginPreferences();
+
+ CSSPreferenceHelper.createDefaultPreferences(prefs);
+
+ // set model preference defaults
+ prefs.setDefault(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CommonModelPreferenceNames.INSERT_MISSING_TAGS, true);
+ prefs.setDefault(CommonModelPreferenceNames.QUOTE_ATTR_VALUES, true);
+ prefs.setDefault(CommonModelPreferenceNames.FORMAT_SOURCE, true);
+ prefs.setDefault(CommonModelPreferenceNames.CONVERT_EOL_CODES, false);
+
+ prefs.setDefault(CommonEncodingPreferenceNames.INPUT_CODESET, ""); //$NON-NLS-1$
+
+ String defaultEnc = CommonModelPreferenceNames.UTF_8;
+ String systemEnc = System.getProperty("file.encoding"); //$NON-NLS-1$
+ if (systemEnc != null) {
+ defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, CommonModelPreferenceNames.UTF_8);
+ }
+ prefs.setDefault(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc);
+
+ prefs.setDefault(CommonEncodingPreferenceNames.END_OF_LINE_CODE, ""); //$NON-NLS-1$
+
+ prefs.setDefault(CommonModelPreferenceNames.TAB_WIDTH, 4);
+
+ prefs.setDefault(CommonModelPreferenceNames.FORMATTING_SUPPORTED, true);
+ prefs.setDefault(CommonModelPreferenceNames.LINE_WIDTH, 72);
+ prefs.setDefault(CommonModelPreferenceNames.SPLIT_MULTI_ATTRS, false);
+ prefs.setDefault(CommonModelPreferenceNames.INDENT_USING_TABS, true);
+ prefs.setDefault(CommonModelPreferenceNames.CLEAR_ALL_BLANK_LINES, false);
+
+ prefs.setDefault(CommonModelPreferenceNames.PREFERRED_MARKUP_CASE_SUPPORTED, false);
+ prefs.setDefault(CommonModelPreferenceNames.TAG_NAME_CASE, CommonModelPreferenceNames.LOWER);
+ prefs.setDefault(CommonModelPreferenceNames.ATTR_NAME_CASE, CommonModelPreferenceNames.LOWER);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/ICSSModelAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/ICSSModelAdapter.java
new file mode 100644
index 0000000000..c9095174df
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/ICSSModelAdapter.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.adapters;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.sse.core.INodeAdapter;
+
+
+/**
+ */
+public interface ICSSModelAdapter extends INodeAdapter {
+
+ ICSSModel getModel();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IModelProvideAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IModelProvideAdapter.java
new file mode 100644
index 0000000000..b40be5ec5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IModelProvideAdapter.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.adapters;
+
+
+
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.IStructuredModel;
+
+/**
+ *
+ */
+public interface IModelProvideAdapter extends INodeAdapter {
+
+ /**
+ *
+ */
+ void modelProvided(IStructuredModel newModel);
+
+ /**
+ */
+ void modelReleased(IStructuredModel newModel);
+
+ /**
+ */
+ void modelRemoved(IStructuredModel newModel);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleDeclarationAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleDeclarationAdapter.java
new file mode 100644
index 0000000000..967d8d87b7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleDeclarationAdapter.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.adapters;
+
+
+
+import org.w3c.dom.css.CSSStyleDeclaration;
+
+
+/**
+ */
+public interface IStyleDeclarationAdapter extends ICSSModelAdapter {
+
+ /**
+ */
+ public CSSStyleDeclaration getStyle();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSelectorAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSelectorAdapter.java
new file mode 100644
index 0000000000..b163d2701a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSelectorAdapter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.adapters;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.w3c.dom.Element;
+
+
+/**
+ *
+ */
+public interface IStyleSelectorAdapter extends INodeAdapter {
+
+ /**
+ * @return boolean
+ * @param element
+ * org.w3c.dom.Element
+ * @param pseudoName
+ * java.lang.String
+ */
+ boolean match(ICSSSimpleSelector selector, Element element, String pseudoName);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetAdapter.java
new file mode 100644
index 0000000000..33e09d258d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetAdapter.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.adapters;
+
+
+
+import org.w3c.dom.Element;
+import org.w3c.dom.stylesheets.StyleSheet;
+
+/**
+ */
+public interface IStyleSheetAdapter extends ICSSModelAdapter {
+
+ /**
+ * Returns HTML/XML element that is the owner of this adapter
+ */
+ Element getElement();
+
+ /**
+ * Returns CSS document that is related to this element
+ */
+ public StyleSheet getSheet();
+
+ /**
+ * This is called at the time of releasing HTML/XML model
+ */
+ public void released();
+
+ /**
+ * This is called at the time of removing this Element from the document
+ */
+ public void removed();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetListAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetListAdapter.java
new file mode 100644
index 0000000000..418db30cff
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/adapters/IStyleSheetListAdapter.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.adapters;
+
+
+
+import java.util.Enumeration;
+
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.w3c.dom.Element;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.stylesheets.StyleSheetList;
+
+/**
+ */
+public interface IStyleSheetListAdapter extends INodeAdapter {
+
+ /**
+ */
+ Enumeration getClasses();
+
+ /**
+ */
+ public CSSStyleDeclaration getOverrideStyle(Element element, String pseudoName);
+
+ /**
+ */
+ public StyleSheetList getStyleSheets();
+
+ /**
+ */
+ public void releaseStyleSheets();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategy.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategy.java
new file mode 100644
index 0000000000..ccbb10c44c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategy.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.cleanup;
+
+
+
+public interface CSSCleanupStrategy {
+
+ static final short ASIS = 0;
+ static final short LOWER = 1;
+ static final short UPPER = 2;
+
+ /**
+ *
+ * @return short
+ */
+ short getIdentCase();
+
+ /**
+ *
+ * @return short
+ */
+ short getPropNameCase();
+
+ /**
+ *
+ * @return short
+ */
+ short getPropValueCase();
+
+ /**
+ *
+ * @return short
+ */
+ short getSelectorTagCase();
+
+ /**
+ *
+ * @return boolean
+ */
+ boolean isFormatSource();
+
+ /**
+ *
+ * @return boolean
+ */
+ boolean isQuoteValues();
+
+ /**
+ *
+ * @param formatSource
+ * boolean
+ */
+ void setFormatSource(boolean formatSource);
+
+ /**
+ *
+ * @param identCase
+ * short
+ */
+ void setIdentCase(short identCase);
+
+ /**
+ *
+ * @param propNameCase
+ * short
+ */
+ void setPropNameCase(short propNameCase);
+
+ /**
+ *
+ * @param propValueCase
+ * short
+ */
+ void setPropValueCase(short propValueCase);
+
+ /**
+ *
+ * @param quoteValues
+ * boolean
+ */
+ void setQuoteValues(boolean quoteValues);
+
+ /**
+ *
+ * @param selectorTagCase
+ * short
+ */
+ void setSelectorTagCase(short selectorTagCase);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategyImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategyImpl.java
new file mode 100644
index 0000000000..931d3b1a67
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CSSCleanupStrategyImpl.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.cleanup;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.css.core.CSSCorePlugin;
+import org.eclipse.wst.css.core.preferences.CSSModelPreferenceNames;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+
+
+
+public class CSSCleanupStrategyImpl implements CSSCleanupStrategy {
+
+ static private CSSCleanupStrategy instance = null;
+ // initialize with defaults
+ protected short fIdentCase = ASIS;
+ protected short fPropNameCase = ASIS;
+ protected short fPropValueCase = ASIS;
+ protected short fSelectorTagCase = UPPER;
+ protected boolean fQuoteValues = true;
+ protected boolean fFormatSource = true;
+
+ /**
+ * CSSCleanupStrategyImpl constructor comment.
+ */
+ protected CSSCleanupStrategyImpl() {
+ super();
+ initialize();
+ }
+
+ /**
+ *
+ * @return short
+ */
+ public short getIdentCase() {
+ return fIdentCase;
+ }
+
+ /**
+ *
+ * @return org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy
+ */
+ public synchronized static CSSCleanupStrategy getInstance() {
+ if (instance == null)
+ instance = new CSSCleanupStrategyImpl();
+ return instance;
+ }
+
+ /**
+ *
+ * @return short
+ */
+ public short getPropNameCase() {
+ return fPropNameCase;
+ }
+
+ /**
+ *
+ * @return short
+ */
+ public short getPropValueCase() {
+ return fPropValueCase;
+ }
+
+ /**
+ *
+ * @return short
+ */
+ public short getSelectorTagCase() {
+ return fSelectorTagCase;
+ }
+
+ /**
+ *
+ */
+ private void initialize() {
+ Preferences prefs = CSSCorePlugin.getDefault().getPluginPreferences();
+ fIdentCase = getCleanupCaseValue(prefs.getInt(CSSModelPreferenceNames.CLEANUP_CASE_IDENTIFIER));
+ fPropNameCase = getCleanupCaseValue(prefs.getInt(CSSModelPreferenceNames.CLEANUP_CASE_PROPERTY_NAME));
+ fPropValueCase = getCleanupCaseValue(prefs.getInt(CSSModelPreferenceNames.CLEANUP_CASE_PROPERTY_VALUE));
+ fSelectorTagCase = getCleanupCaseValue(prefs.getInt(CSSModelPreferenceNames.CLEANUP_CASE_SELECTOR));
+ fQuoteValues = prefs.getBoolean(CommonModelPreferenceNames.QUOTE_ATTR_VALUES);
+ fFormatSource = prefs.getBoolean(CommonModelPreferenceNames.FORMAT_SOURCE);
+ }
+
+ /**
+ * Return the CSSCleanupStrategy equivalent case short value when given an
+ * int
+ *
+ * @param value
+ * @return equivalent case short or ASIS if cannot be determined
+ */
+ private short getCleanupCaseValue(int value) {
+ switch (value) {
+ case CommonModelPreferenceNames.LOWER :
+ return LOWER;
+ case CommonModelPreferenceNames.UPPER :
+ return UPPER;
+ }
+ return ASIS;
+ }
+
+ /**
+ *
+ * @return boolean
+ */
+ public boolean isFormatSource() {
+ return fFormatSource;
+ }
+
+ /**
+ *
+ * @return boolean
+ */
+ public boolean isQuoteValues() {
+ return fQuoteValues;
+ }
+
+ /**
+ *
+ * @param formatSource
+ * boolean
+ */
+ public void setFormatSource(boolean formatSource) {
+ fFormatSource = formatSource;
+ }
+
+ /**
+ *
+ * @param identCase
+ * short
+ */
+ public void setIdentCase(short identCase) {
+ fIdentCase = identCase;
+ }
+
+ /**
+ *
+ * @param propNameCase
+ * short
+ */
+ public void setPropNameCase(short propNameCase) {
+ fPropNameCase = propNameCase;
+ }
+
+ /**
+ *
+ * @param propValueCase
+ * short
+ */
+ public void setPropValueCase(short propValueCase) {
+ fPropValueCase = propValueCase;
+ }
+
+ /**
+ *
+ * @param quoteValues
+ * boolean
+ */
+ public void setQuoteValues(boolean quoteValues) {
+ fQuoteValues = quoteValues;
+ }
+
+ /**
+ *
+ * @param selectorTagCase
+ * short
+ */
+ public void setSelectorTagCase(short selectorTagCase) {
+ fSelectorTagCase = selectorTagCase;
+ }
+
+ // TODO: a saveOptions should be added to CSSCleanupStrategy interface
+ public void saveOptions() {
+ CSSCorePlugin.getDefault().getPluginPreferences().setValue(CSSModelPreferenceNames.CLEANUP_CASE_IDENTIFIER, fIdentCase);
+ CSSCorePlugin.getDefault().getPluginPreferences().setValue(CSSModelPreferenceNames.CLEANUP_CASE_PROPERTY_NAME, fPropNameCase);
+ CSSCorePlugin.getDefault().getPluginPreferences().setValue(CSSModelPreferenceNames.CLEANUP_CASE_PROPERTY_VALUE, fPropValueCase);
+ CSSCorePlugin.getDefault().getPluginPreferences().setValue(CSSModelPreferenceNames.CLEANUP_CASE_SELECTOR, fSelectorTagCase);
+ CSSCorePlugin.getDefault().getPluginPreferences().setValue(CommonModelPreferenceNames.QUOTE_ATTR_VALUES, fQuoteValues);
+ CSSCorePlugin.getDefault().getPluginPreferences().setValue(CommonModelPreferenceNames.FORMAT_SOURCE, fFormatSource);
+ CSSCorePlugin.getDefault().savePluginPreferences();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CleanupProcessorCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CleanupProcessorCSS.java
new file mode 100644
index 0000000000..46e6f2f6d6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/cleanup/CleanupProcessorCSS.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.cleanup;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.internal.formatter.CSSFormatUtil;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatter;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatterFactory;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.cleanup.AbstractStructuredCleanupProcessor;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupHandler;
+import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.w3c.dom.Node;
+
+
+public class CleanupProcessorCSS extends AbstractStructuredCleanupProcessor {
+
+ public void cleanupModel(IStructuredModel structuredModel, int start, int length) {
+ CSSFormatUtil formatUtil = CSSFormatUtil.getInstance();
+ if (structuredModel instanceof ICSSModel) {
+ ICSSDocument doc = ((ICSSModel) structuredModel).getDocument();
+ CSSSourceFormatter formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) doc);
+ StringBuffer buf = formatter.cleanup(doc);
+ if (buf != null) {
+ int startOffset = ((IndexedRegion) doc).getStartOffset();
+ int endOffset = ((IndexedRegion) doc).getEndOffset();
+ formatUtil.replaceSource(doc.getModel(), startOffset, endOffset - startOffset, buf.toString());
+ }
+ }
+ else if (structuredModel instanceof XMLModel) {
+ List cssnodes = formatUtil.collectCSSNodes(structuredModel, start, length);
+ if (cssnodes != null && !cssnodes.isEmpty()) {
+ ICSSModel model = null;
+ for (int i = 0; i < cssnodes.size(); i++) {
+ ICSSNode node = (ICSSNode) cssnodes.get(i);
+ CSSSourceFormatter formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) node);
+ StringBuffer buf = formatter.cleanup(node);
+ if (buf != null) {
+ int startOffset = ((IndexedRegion) node).getStartOffset();
+ int endOffset = ((IndexedRegion) node).getEndOffset();
+ if (model == null) {
+ model = node.getOwnerDocument().getModel();
+ }
+ formatUtil.replaceSource(model, startOffset, endOffset - startOffset, buf.toString());
+ }
+ }
+ }
+ }
+ }
+
+ protected String getContentType() {
+ return IContentTypeIdentifier.ContentTypeID_CSS;
+ }
+
+ public void cleanupModel(IStructuredModel structuredModel) {
+ int start = 0;
+ int length = structuredModel.getStructuredDocument().getLength();
+
+ cleanupModel(structuredModel, start, length);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.cleanup.IStructuredCleanupProcessor#cleanupDocument(org.eclipse.jface.text.IDocument)
+ */
+ public void cleanupDocument(IDocument document) throws IOException, CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.cleanup.IStructuredCleanupProcessor#cleanupDocument(org.eclipse.jface.text.IDocument,
+ * int, int)
+ */
+ public void cleanupDocument(IDocument document, int start, int length) throws IOException, CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.cleanup.AbstractStructuredCleanupProcessor#getCleanupHandler(org.w3c.dom.Node)
+ */
+ protected IStructuredCleanupHandler getCleanupHandler(Node node) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.cleanup.AbstractStructuredCleanupProcessor#getFormatProcessor()
+ */
+ protected IStructuredFormatProcessor getFormatProcessor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.cleanup.AbstractStructuredCleanupProcessor#refreshCleanupPreferences()
+ */
+ protected void refreshCleanupPreferences() {
+ // TODO Auto-generated method stub
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAccess.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAccess.java
new file mode 100644
index 0000000000..f05ef5a504
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAccess.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import java.util.Vector;
+
+/**
+ *
+ */
+public interface ICSSAccess {
+
+ /**
+ * @return java.util.Vector
+ */
+ Vector getClassNames();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAttr.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAttr.java
new file mode 100644
index 0000000000..087d93b525
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSAttr.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSAttr extends ICSSNode {
+
+ /**
+ * @return java.lang.String
+ */
+ String getName();
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ ICSSNode getOwnerCSSNode();
+
+ /**
+ * @return java.lang.String
+ */
+ String getValue();
+
+ /**
+ * @param newValue
+ * java.lang.String
+ */
+ void setValue(String newValue);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSCharsetRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSCharsetRule.java
new file mode 100644
index 0000000000..b861262a5a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSCharsetRule.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSCharsetRule;
+
+/**
+ *
+ */
+public interface ICSSCharsetRule extends ICSSNode, CSSCharsetRule {
+
+ java.lang.String ENCODING = "encoding"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSDocument.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSDocument.java
new file mode 100644
index 0000000000..8d70e3a490
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSDocument.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSFontFaceRule;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSUnknownRule;
+import org.w3c.dom.stylesheets.MediaList;
+
+/**
+ *
+ */
+public interface ICSSDocument extends ICSSNode {
+
+ /**
+ * @return org.w3c.dom.css.CSSCharsetRule
+ */
+ ICSSCharsetRule createCSSCharsetRule();
+
+ /**
+ * @return org.w3c.dom.css.CSSFontFaceRule
+ */
+ CSSFontFaceRule createCSSFontFaceRule();
+
+ /**
+ * @return org.w3c.dom.css.CSSImportRule
+ */
+ ICSSImportRule createCSSImportRule();
+
+ /**
+ * @return org.w3c.dom.css.ICSSMediaRule
+ */
+ ICSSMediaRule createCSSMediaRule();
+
+ /**
+ * @return org.w3c.dom.css.CSSPageRule
+ */
+ ICSSPageRule createCSSPageRule();
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ */
+ ICSSPrimitiveValue createCSSPrimitiveValue(short primitiveType);
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * java.lang.String
+ */
+ CSSRule createCSSRule(String rule);
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleDeclaration
+ */
+ ICSSStyleDeclaration createCSSStyleDeclaration();
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param propertyName
+ * java.lang.String
+ */
+ ICSSStyleDeclItem createCSSStyleDeclItem(String propertyName);
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleRule
+ */
+ ICSSStyleRule createCSSStyleRule();
+
+ /**
+ * @return org.w3c.dom.css.CSSUnknownRule
+ */
+ CSSUnknownRule createCSSUnknownRule();
+
+ /**
+ * @return org.w3c.dom.stylesheets.MediaList
+ */
+ MediaList createMediaList();
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSModel
+ */
+ ICSSModel getModel();
+
+ /**
+ * @return boolean
+ */
+ boolean isDocument();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSImportRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSImportRule.java
new file mode 100644
index 0000000000..9818c2f160
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSImportRule.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSImportRule;
+
+/**
+ *
+ */
+public interface ICSSImportRule extends ICSSNode, CSSImportRule {
+
+ java.lang.String HREF = "href"; //$NON-NLS-1$
+
+ /**
+ *
+ */
+ void refreshStyleSheet();
+
+ /**
+ * @param href
+ * java.lang.String
+ */
+ void setHref(String href);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSMediaRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSMediaRule.java
new file mode 100644
index 0000000000..d06f3c5a71
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSMediaRule.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSMediaRule;
+
+/**
+ *
+ */
+public interface ICSSMediaRule extends ICSSNode, ICSSRuleContainer, CSSMediaRule {
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSModel.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSModel.java
new file mode 100644
index 0000000000..15f5f3fd6e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSModel.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wst.css.core.document;
+
+
+
+import org.eclipse.wst.css.core.event.ICSSStyleNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.w3c.dom.Node;
+
+
+/**
+ *
+ */
+public interface ICSSModel extends ICSSStyleNotifier, IStructuredModel {
+
+ public static final String EXTERNAL = "externalCSS"; //$NON-NLS-1$
+ public static final String EMBEDDED = "embeddedCSS"; //$NON-NLS-1$
+ public static final String INLINE = "inlineCSS"; //$NON-NLS-1$
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSDocument
+ */
+ ICSSDocument getDocument();
+
+ /**
+ * @return org.w3c.dom.Node
+ */
+ Node getOwnerDOMNode();
+
+ /**
+ *
+ * @return java.lang.Object
+ */
+ Object getStyleSheetType();
+
+ /**
+ * cleanup -> rebuild CSS Nodes This is pre-beta fix for 178176.
+ */
+ void refreshNodes();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNamedNodeMap.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNamedNodeMap.java
new file mode 100644
index 0000000000..321acca79d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNamedNodeMap.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSNamedNodeMap extends ICSSNodeList {
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param name
+ * java.lang.String
+ */
+ ICSSNode getNamedItem(String name);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNode.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNode.java
new file mode 100644
index 0000000000..f8af0b89f4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNode.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSNode {
+
+ short ATTR_NODE = -1;
+ short UNKNOWNRULE_NODE = 0;
+ short STYLERULE_NODE = 1;
+ short CHARSETRULE_NODE = 2;
+ short IMPORTRULE_NODE = 3;
+ short MEDIARULE_NODE = 4;
+ short FONTFACERULE_NODE = 5;
+ short PAGERULE_NODE = 6;
+ short STYLESHEET_NODE = 7;
+ short STYLEDECLARATION_NODE = 8;
+ short STYLEDECLITEM_NODE = 9;
+ short VALUELIST_NODE = 10;
+ short PRIMITIVEVALUE_NODE = 11;
+ short MEDIALIST_NODE = 12;
+ short DOCUMENTCSSSTYLE_NODE = 13;
+ short LINKSTYLE_NODE = 14;
+ short ELEMENTCSSINLINESTYLE_NODE = 15;
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param deep
+ * boolean
+ */
+ ICSSNode cloneNode(boolean deep);
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNamedNodeMap
+ */
+ ICSSNamedNodeMap getAttributes();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNodeList
+ */
+ ICSSNodeList getChildNodes();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ */
+ ICSSNode getFirstChild();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ */
+ ICSSNode getLastChild();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ */
+ ICSSNode getNextSibling();
+
+ /**
+ * @return short
+ */
+ short getNodeType();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSDocument
+ */
+ ICSSDocument getOwnerDocument();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ */
+ ICSSNode getParentNode();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ */
+ ICSSNode getPreviousSibling();
+
+ /**
+ * @return boolean
+ */
+ boolean hasChildNodes();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNodeList.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNodeList.java
new file mode 100644
index 0000000000..235bfbe8cb
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSNodeList.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSNodeList {
+
+ /**
+ * @return int
+ */
+ int getLength();
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param index
+ * int
+ */
+ ICSSNode item(int index);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPageRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPageRule.java
new file mode 100644
index 0000000000..a182fad23f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPageRule.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSPageRule;
+
+/**
+ *
+ */
+public interface ICSSPageRule extends ICSSNode, CSSPageRule {
+
+ java.lang.String SELECTOR = "selector"; //$NON-NLS-1$
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelectorList
+ */
+ ICSSSelectorList getSelectors();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPrimitiveValue.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPrimitiveValue.java
new file mode 100644
index 0000000000..0260b69f00
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSPrimitiveValue.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSPrimitiveValue;
+
+/**
+ *
+ */
+public interface ICSSPrimitiveValue extends ICSSNode, ICSSValue, CSSPrimitiveValue {
+
+ short CSS_INTEGER = 26;
+ short CSS_HASH = 27;
+ short CSS_URANGE = 28;
+ short CSS_FORMAT = 29;
+ short CSS_LOCAL = 30;
+ short CSS_SLASH = 31;
+ short CSS_COMMA = 32;
+ short CSS_INHERIT_PRIMITIVE = 33;
+
+ /**
+ * @param floatValue
+ * float
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ void setValue(float floatValue) throws org.w3c.dom.DOMException;
+
+ /**
+ * @param stringValue
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ void setValue(String stringValue) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSRuleContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSRuleContainer.java
new file mode 100644
index 0000000000..61ea7d317c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSRuleContainer.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSRule;
+
+/**
+ *
+ */
+public interface ICSSRuleContainer {
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ CSSRule appendRule(CSSRule rule) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param newRule
+ * org.w3c.dom.css.CSSRule
+ * @param refRule
+ * org.w3c.dom.css.CSSRule
+ */
+ CSSRule insertRuleBefore(CSSRule newRule, CSSRule refRule) throws DOMException;
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ CSSRule removeRule(CSSRule rule) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param newChild
+ * org.w3c.dom.css.CSSRule
+ * @param oldChild
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ CSSRule replaceRule(CSSRule newRule, CSSRule oldRule) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelector.java
new file mode 100644
index 0000000000..301ceb9c8b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelector.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import java.util.Iterator;
+
+import org.w3c.dom.Element;
+
+/**
+ *
+ */
+public interface ICSSSelector {
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelectorItem
+ * @param index
+ * int
+ */
+ ICSSSelectorItem getItem(int index);
+
+ /**
+ * @return java.util.Iterator
+ */
+ Iterator getIterator();
+
+ /**
+ * @return int
+ */
+ int getLength();
+
+ /**
+ * @return int
+ */
+ int getSpecificity();
+
+ /**
+ * @return java.lang.String
+ */
+ String getString();
+
+ /**
+ * @return boolean
+ * @param element
+ * org.w3c.dom.Element
+ */
+ boolean match(Element element, String pseudoName);
+
+ /**
+ *
+ */
+ Iterator getErrors();
+
+ /**
+ *
+ */
+ int getErrorCount();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorCombinator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorCombinator.java
new file mode 100644
index 0000000000..62ceac299b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorCombinator.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSSelectorCombinator extends ICSSSelectorItem {
+
+ public static final char DESCENDANT = ' ';
+ public static final char CHILD = '>';
+ public static final char ADJACENT = '+';
+ public static final char UNKNOWN = '?'; // error case
+
+ /**
+ * @return int
+ */
+ char getCombinatorType();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorItem.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorItem.java
new file mode 100644
index 0000000000..94dae8924c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorItem.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSSelectorItem {
+
+ public static final int SIMPLE = 1;
+ public static final int COMBINATOR = 2;
+
+ /**
+ * @return int
+ */
+ int getItemType();
+
+ /**
+ * @return java.lang.String
+ */
+ String getString();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorList.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorList.java
new file mode 100644
index 0000000000..c4608ddde5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSelectorList.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import java.util.Iterator;
+
+import org.w3c.dom.Element;
+
+/**
+ *
+ */
+public interface ICSSSelectorList {
+
+ /**
+ * @return java.util.Iterator
+ */
+ Iterator getIterator();
+
+ /**
+ * @return int
+ */
+ int getLength();
+
+ /**
+ * @return java.util.Vector
+ * @param index
+ * int
+ */
+ ICSSSelector getSelector(int index);
+
+ /**
+ * @return java.lang.String
+ */
+ String getString();
+
+ /**
+ *
+ */
+ int getErrorCount();
+
+ /**
+ *
+ */
+ Iterator getErrors();
+
+ /**
+ * @return boolean
+ * @param element
+ * org.w3c.dom.Element
+ */
+ boolean match(Element element, String pseudoName);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSimpleSelector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSimpleSelector.java
new file mode 100644
index 0000000000..4e332e42bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSSimpleSelector.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+/**
+ *
+ */
+public interface ICSSSimpleSelector extends ICSSSelectorItem {
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ String getAttribute(int index);
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ String getClass(int index);
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ String getID(int index);
+
+ /**
+ * @return java.lang.String
+ */
+ String getName();
+
+ /**
+ * @return boolean
+ */
+ int getNumOfAttributes();
+
+ /**
+ * @return boolean
+ */
+ int getNumOfClasses();
+
+ /**
+ * @return boolean
+ */
+ int getNumOfIDs();
+
+ /**
+ * @return boolean
+ */
+ int getNumOfPseudoNames();
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ String getPseudoName(int index);
+
+ /**
+ * @return boolean
+ */
+ boolean isUniversal();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclItem.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclItem.java
new file mode 100644
index 0000000000..6d4b080379
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclItem.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSValue;
+
+/**
+ *
+ */
+public interface ICSSStyleDeclItem extends ICSSNode, ICSSValueList {
+
+ java.lang.String IMPORTANT = "important"; //$NON-NLS-1$
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param value
+ * org.w3c.dom.css.CSSPrimitiveValue
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ ICSSPrimitiveValue appendValue(ICSSPrimitiveValue value) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.css.CSSValue
+ */
+ CSSValue getCSSValue();
+
+ /**
+ * @return java.lang.String
+ */
+ String getPriority();
+
+ /**
+ * @return java.lang.String
+ */
+ String getPropertyName();
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param value
+ * org.w3c.dom.css.CSSPrimitiveValue
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ ICSSPrimitiveValue removeValue(ICSSPrimitiveValue value) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param newValue
+ * org.w3c.dom.css.CSSPrimitiveValue
+ * @param oldValue
+ * org.w3c.dom.css.CSSPrimitiveValue
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ ICSSPrimitiveValue replaceValue(ICSSPrimitiveValue newValue, ICSSPrimitiveValue oldValue) throws org.w3c.dom.DOMException;
+
+ /**
+ * @param priority
+ * java.lang.String
+ */
+ void setPriority(String priority);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclaration.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclaration.java
new file mode 100644
index 0000000000..f9aeb80c82
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleDeclaration.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSStyleDeclaration;
+
+/**
+ *
+ */
+public interface ICSSStyleDeclaration extends ICSSDocument, CSSStyleDeclaration {
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param propertyName
+ * java.lang.String
+ */
+ ICSSStyleDeclItem getDeclItemNode(String propertyName);
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param oldDecl
+ * com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ ICSSStyleDeclItem removeDeclItemNode(ICSSStyleDeclItem oldDecl) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param newDecl
+ * com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ ICSSStyleDeclItem setDeclItemNode(ICSSStyleDeclItem newDecl) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleRule.java
new file mode 100644
index 0000000000..95fe26fd9c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleRule.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSStyleRule;
+
+/**
+ *
+ */
+public interface ICSSStyleRule extends ICSSNode, CSSStyleRule {
+
+ java.lang.String SELECTOR = "selector"; //$NON-NLS-1$
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelectorList
+ */
+ ICSSSelectorList getSelectors();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleSheet.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleSheet.java
new file mode 100644
index 0000000000..7da1f4710a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSStyleSheet.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.css.CSSRuleList;
+import org.w3c.dom.css.CSSStyleSheet;
+import org.w3c.dom.stylesheets.StyleSheetList;
+
+/**
+ *
+ */
+public interface ICSSStyleSheet extends ICSSDocument, ICSSRuleContainer, CSSStyleSheet {
+
+ /**
+ * @return org.w3c.dom.NodeList
+ */
+ NodeList getOwnerNodes();
+
+ /**
+ * @return org.w3c.dom.NodeList
+ * @param doc
+ * org.w3c.dom.Document
+ */
+ NodeList getOwnerNodes(Document doc);
+
+ /**
+ * @return org.w3c.dom.css.CSSRuleList
+ */
+ CSSRuleList getOwnerRules();
+
+ /**
+ * @return org.w3c.dom.stylesheets.StyleSheetList
+ */
+ StyleSheetList getParentStyleSheets();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValue.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValue.java
new file mode 100644
index 0000000000..90715e9cea
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValue.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSValue;
+
+/**
+ *
+ */
+public interface ICSSValue extends CSSValue {
+
+ /**
+ * @return java.lang.String
+ */
+ String getCSSValueText();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValueList.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValueList.java
new file mode 100644
index 0000000000..91a59346ea
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICSSValueList.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.CSSValueList;
+
+/**
+ *
+ */
+public interface ICSSValueList extends ICSSValue, CSSValueList {
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param value
+ * org.w3c.dom.css.CSSPrimitiveValue
+ */
+ ICSSPrimitiveValue appendValue(ICSSPrimitiveValue value);
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param value
+ * org.w3c.dom.css.CSSPrimitiveValue
+ */
+ ICSSPrimitiveValue removeValue(ICSSPrimitiveValue value);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICounter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICounter.java
new file mode 100644
index 0000000000..fc57d59e68
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/ICounter.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.Counter;
+
+/**
+ *
+ */
+public interface ICounter extends ICSSNode, Counter {
+
+ java.lang.String IDENTIFIER = "identifier"; //$NON-NLS-1$
+ java.lang.String LISTSTYLE = "liststyle"; //$NON-NLS-1$
+ java.lang.String SEPARATOR = "separator"; //$NON-NLS-1$
+
+ /**
+ * @param identifier
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ void setIdentifier(String identifier) throws org.w3c.dom.DOMException;
+
+ /**
+ * @param listStyle
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ void setListStyle(String listStyle) throws org.w3c.dom.DOMException;
+
+ /**
+ * @param Separator
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ void setSeparator(String separator) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDOMImplementationCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDOMImplementationCSS.java
new file mode 100644
index 0000000000..81edc69b3f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDOMImplementationCSS.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.css.DOMImplementationCSS;
+
+/**
+ *
+ */
+public interface IDOMImplementationCSS extends DOMImplementationCSS {
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclBlock
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ ICSSStyleDeclaration createCSSStyleDeclaration() throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDocumentStyle.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDocumentStyle.java
new file mode 100644
index 0000000000..bed9a86504
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/document/IDocumentStyle.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.document;
+
+
+
+import org.w3c.dom.stylesheets.DocumentStyle;
+import org.w3c.dom.stylesheets.StyleSheet;
+
+/**
+ *
+ */
+public interface IDocumentStyle extends DocumentStyle {
+
+ /**
+ * @return org.w3c.dom.stylesheets.StyleSheet
+ * @param newSheet
+ * org.w3c.dom.stylesheets.StyleSheet
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ StyleSheet appendSheet(StyleSheet newSheet) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.stylesheets.StyleSheet
+ * @param newSheet
+ * org.w3c.dom.stylesheets.StyleSheet
+ * @param refSheet
+ * org.w3c.dom.stylesheets.StyleSheet
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ StyleSheet insertSheetBefore(StyleSheet newSheet, StyleSheet refSheet) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.stylesheets.StyleSheet
+ * @param oldSheet
+ * org.w3c.dom.stylesheets.StyleSheet
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ StyleSheet removeSheet(StyleSheet oldSheet) throws org.w3c.dom.DOMException;
+
+ /**
+ * @return org.w3c.dom.stylesheets.StyleSheet
+ * @param newSheet
+ * org.w3c.dom.stylesheets.StyleSheet
+ * @param oldSheet
+ * org.w3c.dom.stylesheets.StyleSheet
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ StyleSheet replaceSheet(StyleSheet newSheet, StyleSheet oldSheet) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleListener.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleListener.java
new file mode 100644
index 0000000000..021394de83
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleListener.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.event;
+
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+
+
+
+/**
+ *
+ */
+public interface ICSSStyleListener {
+
+ /**
+ *
+ */
+ void styleChanged(ICSSModel srcModel, ICSSSelector[] removed, ICSSSelector[] added, String media);
+
+ /**
+ *
+ */
+ void styleUpdate(ICSSModel srcModel);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleNotifier.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleNotifier.java
new file mode 100644
index 0000000000..cf824531f7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/event/ICSSStyleNotifier.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.event;
+
+
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface ICSSStyleNotifier extends ICSSStyleListener {
+
+ /**
+ *
+ */
+ void addStyleListener(ICSSStyleListener listener);
+
+ /**
+ *
+ */
+ List getStyleListeners();
+
+ /**
+ */
+ boolean isRecording();
+
+ /**
+ *
+ */
+ void removeStyleListener(ICSSStyleListener listener);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/CSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/CSSSourceFormatter.java
new file mode 100644
index 0000000000..4ce2309227
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/CSSSourceFormatter.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.format;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.INodeAdapter;
+
+
+/**
+ * @deprecated
+ */
+public interface CSSSourceFormatter extends INodeAdapter {
+
+ /**
+ *
+ */
+ StringBuffer cleanup(ICSSNode node);
+
+ /**
+ *
+ * @return java.lang.StringBuffer
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param region
+ * org.eclipse.jface.text.IRegion
+ */
+ StringBuffer cleanup(ICSSNode node, IRegion region);
+
+ /**
+ *
+ */
+ StringBuffer format(ICSSNode node);
+
+ /**
+ *
+ */
+ StringBuffer format(ICSSNode node, IRegion region);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/FormatProcessorCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/FormatProcessorCSS.java
new file mode 100644
index 0000000000..8ce323113b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/format/FormatProcessorCSS.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.format;
+
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.internal.formatter.CSSFormatUtil;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatter;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatterFactory;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.format.AbstractStructuredFormatProcessor;
+import org.eclipse.wst.sse.core.format.IStructuredFormatPreferences;
+import org.eclipse.wst.sse.core.format.IStructuredFormatter;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.w3c.dom.Node;
+
+
+public class FormatProcessorCSS extends AbstractStructuredFormatProcessor {
+ /**
+ * @deprecated renamed to getFileExtension() TODO will delete in C5
+ */
+ protected String getContentType() {
+ return "css"; //$NON-NLS-1$
+ }
+
+ protected String getFileExtension() {
+ return "css"; //$NON-NLS-1$
+ }
+
+ public void formatModel(IStructuredModel structuredModel) {
+ int start = 0;
+ int length = structuredModel.getStructuredDocument().getLength();
+
+ formatModel(structuredModel, start, length);
+ }
+
+ public void formatModel(IStructuredModel structuredModel, int start, int length) {
+ CSSFormatUtil formatUtil = CSSFormatUtil.getInstance();
+ if (structuredModel instanceof ICSSModel) {
+ ICSSDocument doc = ((ICSSModel) structuredModel).getDocument();
+ CSSSourceFormatter formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) doc);
+ StringBuffer buf = formatter.format(doc);
+ if (buf != null) {
+ int startOffset = ((IndexedRegion) doc).getStartOffset();
+ int endOffset = ((IndexedRegion) doc).getEndOffset();
+ formatUtil.replaceSource(doc.getModel(), startOffset, endOffset - startOffset, buf.toString());
+ }
+ }
+ else if (structuredModel instanceof XMLModel) {
+ List cssnodes = formatUtil.collectCSSNodes(structuredModel, start, length);
+ if (cssnodes != null && !cssnodes.isEmpty()) {
+ ICSSModel model = null;
+ for (int i = 0; i < cssnodes.size(); i++) {
+ ICSSNode node = (ICSSNode) cssnodes.get(i);
+ CSSSourceFormatter formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) node);
+ StringBuffer buf = formatter.format(node);
+ if (buf != null) {
+ int startOffset = ((IndexedRegion) node).getStartOffset();
+ int endOffset = ((IndexedRegion) node).getEndOffset();
+ if (model == null) {
+ model = node.getOwnerDocument().getModel();
+ }
+ formatUtil.replaceSource(model, startOffset, endOffset - startOffset, buf.toString());
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.format.AbstractStructuredFormatProcessor#getFormatPreferences()
+ */
+ public IStructuredFormatPreferences getFormatPreferences() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.format.AbstractStructuredFormatProcessor#getFormatter(org.w3c.dom.Node)
+ */
+ protected IStructuredFormatter getFormatter(Node node) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.format.AbstractStructuredFormatProcessor#refreshFormatPreferences()
+ */
+ protected void refreshFormatPreferences() {
+ // TODO Auto-generated method stub
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/Logger.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/Logger.java
new file mode 100644
index 0000000000..c0d248e113
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/Logger.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal;
+
+
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.css.core.CSSCorePlugin;
+
+/**
+ * Small convenience class to log messages to plugin's log file and also, if
+ * desired, the console. This class should only be used by classes in this
+ * plugin. Other plugins should make their own copy, with appropriate ID.
+ */
+public class Logger {
+ private static Plugin fPlugin = CSSCorePlugin.getDefault();
+ private static final String fPluginId = fPlugin.getDescriptor().getUniqueIdentifier();
+
+ private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
+
+ public static final int OK = IStatus.OK; // 0
+ public static final int INFO = IStatus.INFO; // 1
+ public static final int WARNING = IStatus.WARNING; // 2
+ public static final int ERROR = IStatus.ERROR; // 4
+
+ public static final int OK_DEBUG = 200 + OK;
+ public static final int INFO_DEBUG = 200 + INFO;
+ public static final int WARNING_DEBUG = 200 + WARNING;
+ public static final int ERROR_DEBUG = 200 + ERROR;
+
+ /**
+ * Adds message to log.
+ *
+ * @param level
+ * severity level of the message (OK, INFO, WARNING, ERROR,
+ * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
+ * @param message
+ * text to add to the log
+ * @param exception
+ * exception thrown
+ */
+ protected static void _log(int level, String message, Throwable exception) {
+ if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
+ if (!isDebugging())
+ return;
+ }
+
+ int severity = IStatus.OK;
+ switch (level) {
+ case INFO_DEBUG :
+ case INFO :
+ severity = IStatus.INFO;
+ break;
+ case WARNING_DEBUG :
+ case WARNING :
+ severity = IStatus.WARNING;
+ break;
+ case ERROR_DEBUG :
+ case ERROR :
+ severity = IStatus.ERROR;
+ }
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(severity, fPluginId, severity, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+
+ /**
+ * Prints message to log if category matches /debug/tracefilter option.
+ *
+ * @param message
+ * text to print
+ * @param category
+ * category of the message, to be compared with
+ * /debug/tracefilter
+ */
+ protected static void _trace(String category, String message, Throwable exception) {
+ if (isTracing(category)) {
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(IStatus.OK, fPluginId, IStatus.OK, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+ }
+
+ /**
+ * @return true if the plugin for this logger is debugging
+ */
+ public static boolean isDebugging() {
+ return fPlugin.isDebugging();
+ }
+
+ /**
+ * Determines if currently tracing a category
+ *
+ * @param category
+ * @return true if tracing category, false otherwise
+ */
+ public static boolean isTracing(String category) {
+ if (!isDebugging())
+ return false;
+
+ String traceFilter = Platform.getDebugOption(fPluginId + TRACEFILTER_LOCATION);
+ if (traceFilter != null) {
+ StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String cat = tokenizer.nextToken().trim();
+ if (category.equals(cat)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void log(int level, String message) {
+ _log(level, message, null);
+ }
+
+ public static void log(int level, String message, Throwable exception) {
+ _log(level, message, exception);
+ }
+
+ public static void logException(String message, Throwable exception) {
+ _log(ERROR, message, exception);
+ }
+
+ public static void logException(Throwable exception) {
+ _log(ERROR, exception.getMessage(), exception);
+ }
+
+ public static void traceException(String category, String message, Throwable exception) {
+ _trace(category, message, exception);
+ }
+
+ public static void traceException(String category, Throwable exception) {
+ _trace(category, exception.getMessage(), exception);
+ }
+
+ public static void trace(String category, String message) {
+ _trace(category, message, null);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizer.java
new file mode 100644
index 0000000000..53e61febad
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizer.java
@@ -0,0 +1,1357 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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
+ *******************************************************************************/
+/* The following code was generated by JFlex 1.2.2 on 1/27/04 6:42 PM */
+
+/*nlsXXX*/
+package org.eclipse.wst.css.core.internal.content;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.eclipse.wst.common.encoding.EncodingParserConstants;
+import org.eclipse.wst.common.encoding.HeadParserToken;
+import org.eclipse.wst.common.encoding.IntStack;
+import org.eclipse.wst.xml.core.contenttype.XMLHeadTokenizerConstants;
+
+
+/**
+ * This class is a scanner generated by <a
+ * href="http://www.informatik.tu-muenchen.de/~kleing/jflex/">JFlex </a> 1.2.2
+ * on 1/27/04 6:42 PM from the specification file
+ * <tt>file:/D:/DevTimeSupport/HeadParsers/CSSHeadTokenizer/CSSHeadTokenizer.jflex</tt>
+ */
+public class CSSHeadTokenizer {
+
+ /** this character denotes the end of file */
+ final public static int YYEOF = -1;
+
+ /** lexical states */
+ final public static int YYINITIAL = 0;
+ final public static int UnDelimitedString = 12;
+ final public static int DQ_STRING = 8;
+ final public static int SQ_STRING = 10;
+ final public static int ST_XMLDecl = 2;
+ final public static int QuotedAttributeValue = 6;
+ final public static int CHARSET_RULE = 4;
+
+ /**
+ * YY_LEXSTATE[l] is the state in the DFA for the lexical state l
+ * YY_LEXSTATE[l+1] is the state in the DFA for the lexical state l at the
+ * beginning of a line l is of the form l = 2*k, k a non negative integer
+ */
+ private final static int YY_LEXSTATE[] = {0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static String yycmap_packed = "\11\0\1\6\1\11\2\0\1\10\22\0\1\6\1\0\1\36\2\0" + "\1\41\1\0\1\37\7\0\1\40\13\0\1\35\1\12\1\7\1\34" + "\1\13\1\17\1\22\1\0\1\20\1\31\1\25\1\0\1\33\1\21" + "\1\32\2\0\1\16\1\15\1\27\1\30\2\0\1\23\1\24\1\26" + "\3\0\1\14\10\0\1\22\1\0\1\20\1\31\1\25\1\0\1\33" + "\1\21\1\32\2\0\1\16\1\15\1\27\1\30\2\0\1\23\1\24" + "\1\26\3\0\1\14\102\0\1\4\3\0\1\5\17\0\1\3\16\0" + "\1\1\20\0\1\3\16\0\1\1\1\2\170\0\1\2\ufe87\0";
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
+
+
+ /* error codes */
+ final private static int YY_UNKNOWN_ERROR = 0;
+ final private static int YY_ILLEGAL_STATE = 1;
+ final private static int YY_NO_MATCH = 2;
+ final private static int YY_PUSHBACK_2BIG = 3;
+
+ /* error messages for the codes above */
+ final private static String YY_ERROR_MSG[] = {"Unkown internal scanner error", "Internal error: unknown state", "Error: could not match input", "Error: pushback value was too large"};
+
+ /** the input device */
+ private java.io.Reader yy_reader;
+
+ /** the current state of the DFA */
+ private int yy_state;
+
+ /** the current lexical state */
+ private int yy_lexical_state = YYINITIAL;
+
+ /**
+ * this buffer contains the current text to be matched and is the source
+ * of the yytext() string
+ */
+ private char yy_buffer[] = new char[16384];
+
+ /** the textposition at the last accepting state */
+ private int yy_markedPos;
+
+ /** the textposition at the last state to be included in yytext */
+ private int yy_pushbackPos;
+
+ /** the current text position in the buffer */
+ private int yy_currentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int yy_startRead;
+
+ /**
+ * endRead marks the last character in the buffer, that has been read from
+ * input
+ */
+ private int yy_endRead;
+
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+
+ /**
+ * yy_atBOL == true <=>the scanner is currently at the beginning of a
+ * line
+ */
+ private boolean yy_atBOL;
+
+ /** yy_atEOF == true <=>the scanner has returned a value for EOF */
+ private boolean yy_atEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean yy_eof_done;
+
+ /* user code: */
+
+
+ private boolean hasMore = true;
+ private final static int MAX_TO_SCAN = 1000;
+ StringBuffer string = new StringBuffer();
+ // state stack for easier state handling
+ private IntStack fStateStack = new IntStack();
+ private String valueText = null;
+
+
+
+ public CSSHeadTokenizer() {
+ super();
+ }
+
+ public void reset(Reader in) {
+ /* the input device */
+ yy_reader = in;
+
+ /* the current state of the DFA */
+ yy_state = 0;
+
+ /* the current lexical state */
+ yy_lexical_state = YYINITIAL;
+
+ /*
+ * this buffer contains the current text to be matched and is the
+ * source of the yytext() string
+ */
+ java.util.Arrays.fill(yy_buffer, (char) 0);
+
+ /* the textposition at the last accepting state */
+ yy_markedPos = 0;
+
+ /* the textposition at the last state to be included in yytext */
+ yy_pushbackPos = 0;
+
+ /* the current text position in the buffer */
+ yy_currentPos = 0;
+
+ /* startRead marks the beginning of the yytext() string in the buffer */
+ yy_startRead = 0;
+
+ /**
+ * endRead marks the last character in the buffer, that has been read
+ * from input
+ */
+ yy_endRead = 0;
+
+
+ /* the number of characters up to the start of the matched text */
+ yychar = 0;
+
+
+ /**
+ * yy_atBOL == true <=>the scanner is currently at the beginning of a
+ * line
+ */
+ yy_atBOL = false;
+
+ /* yy_atEOF == true <=> the scanner has returned a value for EOF */
+ yy_atEOF = false;
+
+ /* denotes if the user-EOF-code has already been executed */
+ yy_eof_done = false;
+
+
+ fStateStack.clear();
+
+ hasMore = true;
+
+ // its a little wasteful to "throw away" first char array generated
+ // by class init (via auto generated code), but we really do want
+ // a small buffer for our head parsers.
+ if (yy_buffer.length != MAX_TO_SCAN) {
+ yy_buffer = new char[MAX_TO_SCAN];
+ }
+
+
+ }
+
+
+ public final HeadParserToken getNextToken() throws IOException {
+ String context = null;
+ context = primGetNextToken();
+ HeadParserToken result = null;
+ if (valueText != null) {
+ result = createToken(context, yychar, valueText);
+ valueText = null;
+ }
+ else {
+ result = createToken(context, yychar, yytext());
+ }
+ return result;
+ }
+
+ public final boolean hasMoreTokens() {
+ return hasMore && yychar < MAX_TO_SCAN;
+ }
+
+ private void pushCurrentState() {
+ fStateStack.push(yystate());
+
+ }
+
+ private void popState() {
+ yybegin(fStateStack.pop());
+ }
+
+ private HeadParserToken createToken(String context, int start, String text) {
+ return new HeadParserToken(context, start, text);
+ }
+
+
+
+ /**
+ * Creates a new scanner There is also a java.io.InputStream version of
+ * this constructor.
+ *
+ * @param in
+ * the java.io.Reader to read input from.
+ */
+ public CSSHeadTokenizer(java.io.Reader in) {
+ this.yy_reader = in;
+ }
+
+ /**
+ * Creates a new scanner. There is also java.io.Reader version of this
+ * constructor.
+ *
+ * @param in
+ * the java.io.Inputstream to read input from.
+ */
+ public CSSHeadTokenizer(java.io.InputStream in) {
+ this(new java.io.InputStreamReader(in));
+ }
+
+ /**
+ * Unpacks the compressed character translation table.
+ *
+ * @param packed
+ * the packed character translation table
+ * @return the unpacked character translation table
+ */
+ private static char[] yy_unpack_cmap(String packed) {
+ char[] map = new char[0x10000];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 158) {
+ int count = packed.charAt(i++);
+ char value = packed.charAt(i++);
+ do
+ map[j++] = value;
+ while (--count > 0);
+ }
+ return map;
+ }
+
+
+ /**
+ * Gets the next input character.
+ *
+ * @return the next character of the input stream, EOF if the end of the
+ * stream is reached.
+ * @exception IOException
+ * if any I/O-Error occurs
+ */
+ private int yy_advance() throws java.io.IOException {
+
+ /* standard case */
+ if (yy_currentPos < yy_endRead)
+ return yy_buffer[yy_currentPos++];
+
+ /* if the eof is reached, we don't need to work hard */
+ if (yy_atEOF)
+ return YYEOF;
+
+ /* otherwise: need to refill the buffer */
+
+ /* first: make room (if you can) */
+ if (yy_startRead > 0) {
+ System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0, yy_endRead - yy_startRead);
+
+ /* translate stored positions */
+ yy_endRead -= yy_startRead;
+ yy_currentPos -= yy_startRead;
+ yy_markedPos -= yy_startRead;
+ yy_pushbackPos -= yy_startRead;
+ yy_startRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (yy_currentPos >= yy_buffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[yy_currentPos * 2];
+ System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+ yy_buffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = yy_reader.read(yy_buffer, yy_endRead, yy_buffer.length - yy_endRead);
+
+ if (numRead == -1)
+ return YYEOF;
+
+ yy_endRead += numRead;
+
+ return yy_buffer[yy_currentPos++];
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ final public void yyclose() throws java.io.IOException {
+ yy_atEOF = true; /* indicate end of file */
+ yy_endRead = yy_startRead; /* invalidate buffer */
+ yy_reader.close();
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ final public int yystate() {
+ return yy_lexical_state;
+ }
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState
+ * the new lexical state
+ */
+ final public void yybegin(int newState) {
+ yy_lexical_state = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ final public String yytext() {
+ return new String(yy_buffer, yy_startRead, yy_markedPos - yy_startRead);
+ }
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ final public int yylength() {
+ return yy_markedPos - yy_startRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * @param errorCode
+ * the code of the errormessage to display
+ */
+ private void yy_ScanError(int errorCode) {
+ try {
+ System.out.println(YY_ERROR_MSG[errorCode]);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println(YY_ERROR_MSG[YY_UNKNOWN_ERROR]);
+ }
+
+ System.exit(1);
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number
+ * the number of characters to be read again. This number must
+ * not be greater than yylength()!
+ */
+ private void yypushback(int number) {
+ if (number > yylength())
+ yy_ScanError(YY_PUSHBACK_2BIG);
+
+ yy_markedPos -= number;
+ }
+
+
+ /**
+ * Contains user EOF-code, which will be executed exactly once, when the
+ * end of file is reached
+ */
+ private void yy_do_eof() {
+ if (!yy_eof_done) {
+ yy_eof_done = true;
+ hasMore = false;
+
+ }
+ }
+
+
+ /**
+ * Resumes scanning until the next regular expression is matched, the end
+ * of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception IOException
+ * if any I/O-Error occurs
+ */
+ public String primGetNextToken() throws java.io.IOException {
+ int yy_input;
+ int yy_action;
+
+
+ while (true) {
+
+ yychar += yylength();
+
+ yy_atBOL = yy_markedPos <= 0 || yy_buffer[yy_markedPos - 1] == '\n';
+ if (!yy_atBOL && yy_buffer[yy_markedPos - 1] == '\r') {
+ yy_atBOL = yy_advance() != '\n';
+ if (!yy_atEOF)
+ yy_currentPos--;
+ }
+
+ yy_action = -1;
+
+ yy_currentPos = yy_startRead = yy_markedPos;
+
+ if (yy_atBOL)
+ yy_state = YY_LEXSTATE[yy_lexical_state + 1];
+ else
+ yy_state = YY_LEXSTATE[yy_lexical_state];
+
+
+ yy_forAction : {
+ while (true) {
+
+ yy_input = yy_advance();
+
+ if (yy_input == YYEOF)
+ break yy_forAction;
+
+ yy_input = yycmap[yy_input];
+
+ boolean yy_isFinal = false;
+ boolean yy_noLookAhead = false;
+
+ yy_forNext : {
+ switch (yy_state) {
+ case 0 :
+ switch (yy_input) {
+ case 1 :
+ yy_isFinal = true;
+ yy_state = 9;
+ break yy_forNext;
+ case 2 :
+ yy_isFinal = true;
+ yy_state = 10;
+ break yy_forNext;
+ case 3 :
+ yy_isFinal = true;
+ yy_state = 11;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 1 :
+ switch (yy_input) {
+ case 1 :
+ yy_isFinal = true;
+ yy_state = 9;
+ break yy_forNext;
+ case 2 :
+ yy_isFinal = true;
+ yy_state = 10;
+ break yy_forNext;
+ case 3 :
+ yy_isFinal = true;
+ yy_state = 11;
+ break yy_forNext;
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 12;
+ break yy_forNext;
+ case 10 :
+ yy_isFinal = true;
+ yy_state = 13;
+ break yy_forNext;
+ case 15 :
+ yy_isFinal = true;
+ yy_state = 14;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 2 :
+ switch (yy_input) {
+ case 11 :
+ yy_isFinal = true;
+ yy_state = 15;
+ break yy_forNext;
+ case 21 :
+ yy_isFinal = true;
+ yy_state = 16;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 3 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 17;
+ break yy_forNext;
+ case 29 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 18;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 4 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ yy_isFinal = true;
+ yy_state = 20;
+ break yy_forNext;
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 21;
+ break yy_forNext;
+ case 30 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 22;
+ break yy_forNext;
+ case 31 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 23;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 19;
+ break yy_forNext;
+ }
+
+ case 5 :
+ switch (yy_input) {
+ case 8 :
+ case 9 :
+ case 10 :
+ case 28 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 25;
+ break yy_forNext;
+ case 11 :
+ case 32 :
+ yy_isFinal = true;
+ yy_state = 26;
+ break yy_forNext;
+ case 29 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 27;
+ break yy_forNext;
+ case 30 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 28;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 24;
+ break yy_forNext;
+ }
+
+ case 6 :
+ switch (yy_input) {
+ case 8 :
+ case 9 :
+ case 10 :
+ case 28 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 25;
+ break yy_forNext;
+ case 32 :
+ yy_isFinal = true;
+ yy_state = 26;
+ break yy_forNext;
+ case 29 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 27;
+ break yy_forNext;
+ case 31 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 28;
+ break yy_forNext;
+ case 33 :
+ yy_isFinal = true;
+ yy_state = 29;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 24;
+ break yy_forNext;
+ }
+
+ case 7 :
+ switch (yy_input) {
+ case 10 :
+ case 28 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 25;
+ break yy_forNext;
+ case 32 :
+ yy_isFinal = true;
+ yy_state = 26;
+ break yy_forNext;
+ case 11 :
+ yy_isFinal = true;
+ yy_state = 29;
+ break yy_forNext;
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 30;
+ break yy_forNext;
+ case 29 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 31;
+ break yy_forNext;
+ case 30 :
+ case 31 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 32;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 24;
+ break yy_forNext;
+ }
+
+ case 9 :
+ switch (yy_input) {
+ case 2 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 33;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 10 :
+ switch (yy_input) {
+ case 1 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 34;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 11 :
+ switch (yy_input) {
+ case 4 :
+ yy_state = 35;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 12 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_state = 36;
+ break yy_forNext;
+ case 10 :
+ yy_state = 37;
+ break yy_forNext;
+ case 15 :
+ yy_state = 38;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 13 :
+ switch (yy_input) {
+ case 11 :
+ yy_state = 39;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 14 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 40;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 15 :
+ switch (yy_input) {
+ case 28 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 41;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 16 :
+ switch (yy_input) {
+ case 23 :
+ yy_state = 42;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 17 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 17;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 20 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ yy_isFinal = true;
+ yy_state = 20;
+ break yy_forNext;
+ case 9 :
+ yy_state = 43;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 19;
+ break yy_forNext;
+ }
+
+ case 21 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ yy_isFinal = true;
+ yy_state = 20;
+ break yy_forNext;
+ case 9 :
+ yy_state = 43;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 19;
+ break yy_forNext;
+ }
+
+ case 26 :
+ switch (yy_input) {
+ case 28 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 44;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 29 :
+ switch (yy_input) {
+ case 28 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 45;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 35 :
+ switch (yy_input) {
+ case 5 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 46;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 36 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_state = 36;
+ break yy_forNext;
+ case 10 :
+ yy_state = 37;
+ break yy_forNext;
+ case 15 :
+ yy_state = 38;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 37 :
+ switch (yy_input) {
+ case 11 :
+ yy_state = 39;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 38 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 40;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 39 :
+ switch (yy_input) {
+ case 12 :
+ yy_state = 47;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 40 :
+ switch (yy_input) {
+ case 17 :
+ yy_state = 48;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 42 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 49;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 43 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ yy_isFinal = true;
+ yy_state = 20;
+ break yy_forNext;
+ case 9 :
+ yy_state = 43;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 19;
+ break yy_forNext;
+ }
+
+ case 47 :
+ switch (yy_input) {
+ case 13 :
+ yy_state = 50;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 48 :
+ switch (yy_input) {
+ case 18 :
+ yy_state = 51;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 49 :
+ switch (yy_input) {
+ case 24 :
+ yy_state = 52;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 50 :
+ switch (yy_input) {
+ case 14 :
+ yy_state = 53;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 51 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 54;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 52 :
+ switch (yy_input) {
+ case 25 :
+ yy_state = 55;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 53 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 56;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 54 :
+ switch (yy_input) {
+ case 20 :
+ yy_state = 57;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 55 :
+ switch (yy_input) {
+ case 26 :
+ yy_state = 58;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 56 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 56;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 57 :
+ switch (yy_input) {
+ case 21 :
+ yy_state = 59;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 58 :
+ switch (yy_input) {
+ case 23 :
+ yy_state = 60;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 59 :
+ switch (yy_input) {
+ case 22 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 61;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 60 :
+ switch (yy_input) {
+ case 27 :
+ yy_state = 62;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 62 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_state = 62;
+ break yy_forNext;
+ case 7 :
+ yy_isFinal = true;
+ yy_state = 63;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 63 :
+ switch (yy_input) {
+ case 6 :
+ case 8 :
+ case 9 :
+ yy_isFinal = true;
+ yy_state = 63;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ default :
+ yy_ScanError(YY_ILLEGAL_STATE);
+ break;
+ }
+ }
+
+ if (yy_isFinal) {
+ yy_action = yy_state;
+ yy_markedPos = yy_currentPos;
+ if (yy_noLookAhead)
+ break yy_forAction;
+ }
+
+ }
+ }
+
+
+ switch (yy_action) {
+
+ case 45 : {
+ yypushback(2);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 65 :
+ break;
+ case 25 : {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 66 :
+ break;
+ case 19 :
+ case 20 : {
+ yypushback(1);
+ yybegin(UnDelimitedString);
+ string.setLength(0);
+ }
+ case 67 :
+ break;
+ case 18 : {
+ yybegin(YYINITIAL);
+ hasMore = false;
+ return CSSHeadTokenizerConstants.RuleEnd;
+ }
+ case 68 :
+ break;
+ case 32 : {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue;
+ }
+ case 69 :
+ break;
+ case 44 : {
+ yypushback(2);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 70 :
+ break;
+ case 61 : {
+ if (yychar == 0) {
+ yybegin(CHARSET_RULE);
+ return CSSHeadTokenizerConstants.CHARSET_RULE;
+ }
+ }
+ case 71 :
+ break;
+ case 56 : {
+ if (yychar == 0) {
+ yybegin(ST_XMLDecl);
+ return XMLHeadTokenizerConstants.XMLDeclStart;
+ }
+ }
+ case 72 :
+ break;
+ case 8 :
+ case 9 :
+ case 10 :
+ case 11 :
+ case 12 :
+ case 13 :
+ case 14 :
+ case 15 :
+ case 16 :
+ case 21 : {
+ if (yychar > MAX_TO_SCAN) {
+ hasMore = false;
+ return EncodingParserConstants.MAX_CHARS_REACHED;
+ }
+ }
+ case 73 :
+ break;
+ case 41 : {
+ yybegin(YYINITIAL);
+ return XMLHeadTokenizerConstants.XMLDeclEnd;
+ }
+ case 74 :
+ break;
+ case 63 : {
+ pushCurrentState();
+ yybegin(QuotedAttributeValue);
+ return XMLHeadTokenizerConstants.XMLDelEncoding;
+ }
+ case 75 :
+ break;
+ case 3 :
+ case 17 : {
+ pushCurrentState();
+ yybegin(QuotedAttributeValue);
+ }
+ case 76 :
+ break;
+ case 46 : {
+ hasMore = false;
+ return EncodingParserConstants.UTF83ByteBOM;
+ }
+ case 77 :
+ break;
+ case 33 : {
+ hasMore = false;
+ return EncodingParserConstants.UTF16BE;
+ }
+ case 78 :
+ break;
+ case 34 : {
+ hasMore = false;
+ return EncodingParserConstants.UTF16LE;
+ }
+ case 79 :
+ break;
+ case 24 :
+ case 26 :
+ case 29 : {
+ string.append(yytext());
+ }
+ case 80 :
+ break;
+ case 23 : {
+ yybegin(SQ_STRING);
+ string.setLength(0);
+ }
+ case 81 :
+ break;
+ case 22 : {
+ yybegin(DQ_STRING);
+ string.setLength(0);
+ }
+ case 82 :
+ break;
+ case 27 : {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 83 :
+ break;
+ case 28 : {
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.StringValue;
+ }
+ case 84 :
+ break;
+ case 30 : {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.UnDelimitedStringValue;
+ }
+ case 85 :
+ break;
+ case 31 : {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.UnDelimitedStringValue;
+ }
+ case 86 :
+ break;
+ default :
+ if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+ yy_atEOF = true;
+ yy_do_eof();
+ {
+ hasMore = false;
+ return EncodingParserConstants.EOF;
+ }
+ }
+ else {
+ yy_ScanError(YY_NO_MATCH);
+ }
+ }
+ }
+ }
+
+ /**
+ * Runs the scanner on input files.
+ *
+ * This main method is the debugging routine for the scanner. It prints
+ * each returned token to System.out until the end of file is reached, or
+ * an error occured.
+ *
+ * @param argv
+ * the command line, contains the filenames to run the scanner
+ * on.
+ */
+ public static void main(String argv[]) {
+ for (int i = 0; i < argv.length; i++) {
+ CSSHeadTokenizer scanner = null;
+ try {
+ scanner = new CSSHeadTokenizer(new java.io.FileReader(argv[i]));
+ }
+ catch (java.io.FileNotFoundException e) {
+ System.out.println("File not found : \"" + argv[i] + "\"");
+ System.exit(1);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("Usage : java CSSHeadTokenizer <inputfile>");
+ System.exit(1);
+ }
+
+ try {
+ do {
+ System.out.println(scanner.primGetNextToken());
+ }
+ while (!scanner.yy_atEOF);
+
+ }
+ catch (java.io.IOException e) {
+ System.out.println("An I/O error occured while scanning :");
+ System.out.println(e);
+ System.exit(1);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizerConstants.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizerConstants.java
new file mode 100644
index 0000000000..b8ddef77fa
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSHeadTokenizerConstants.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.content;
+
+
+public interface CSSHeadTokenizerConstants {
+
+ String RuleEnd = "RuleEnd"; //$NON-NLS-1$
+ String CHARSET_RULE = "CHARSET_RULE"; //$NON-NLS-1$
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSResourceEncodingDetector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSResourceEncodingDetector.java
new file mode 100644
index 0000000000..45c10348af
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/CSSResourceEncodingDetector.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.content;
+
+import java.io.IOException;
+
+import org.eclipse.wst.common.encoding.AbstractResourceEncodingDetector;
+import org.eclipse.wst.common.encoding.EncodingGuesser;
+import org.eclipse.wst.common.encoding.EncodingMemento;
+import org.eclipse.wst.common.encoding.EncodingParserConstants;
+import org.eclipse.wst.common.encoding.HeadParserToken;
+import org.eclipse.wst.common.encoding.IResourceCharsetDetector;
+
+
+
+public class CSSResourceEncodingDetector extends AbstractResourceEncodingDetector implements IResourceCharsetDetector {
+
+ private CSSHeadTokenizer fTokenizer;
+
+ /**
+ * There is no spec defined encoding for CSS, so Null is returned.
+ */
+ public String getSpecDefaultEncoding() {
+ // should match what's in plugin.xml (or look it up from there).
+ return null;
+ }
+
+ private boolean canHandleAsUnicodeStream(String tokenType) {
+ boolean canHandleAsUnicodeStream = false;
+ if (tokenType == EncodingParserConstants.UTF83ByteBOM) {
+ canHandleAsUnicodeStream = true;
+ String enc = "UTF-8"; //$NON-NLS-1$
+ createEncodingMemento(enc, EncodingMemento.DETECTED_STANDARD_UNICODE_BYTES);
+ fEncodingMemento.setUTF83ByteBOMUsed(true);
+ }
+ else if (tokenType == EncodingParserConstants.UTF16BE) {
+ canHandleAsUnicodeStream = true;
+ String enc = "UTF-16BE"; //$NON-NLS-1$
+ createEncodingMemento(enc, EncodingMemento.DETECTED_STANDARD_UNICODE_BYTES);
+ }
+ else if (tokenType == EncodingParserConstants.UTF16LE) {
+ canHandleAsUnicodeStream = true;
+ String enc = "UTF-16"; //$NON-NLS-1$
+ createEncodingMemento(enc, EncodingMemento.DETECTED_STANDARD_UNICODE_BYTES);
+ }
+ return canHandleAsUnicodeStream;
+ }
+
+ /**
+ * @return Returns the tokenizer.
+ */
+ private CSSHeadTokenizer getTokenizer() {
+ if (fTokenizer == null) {
+ fTokenizer = new CSSHeadTokenizer();
+ }
+ return fTokenizer;
+ }
+
+ private boolean isLegalString(String valueTokenType) {
+ if (valueTokenType == null)
+ return false;
+ else
+ return valueTokenType.equals(EncodingParserConstants.StringValue) || valueTokenType.equals(EncodingParserConstants.UnDelimitedStringValue) || valueTokenType.equals(EncodingParserConstants.InvalidTerminatedStringValue) || valueTokenType.equals(EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue);
+ }
+
+ protected void parseInput() throws IOException {
+ checkInContents();
+ if (fEncodingMemento == null) {
+ checkHeuristics();
+ }
+ }
+
+ private void checkInContents() throws IOException {
+ CSSHeadTokenizer tokenizer = getTokenizer();
+ tokenizer.reset(fReader);
+ HeadParserToken token = null;
+ String tokenType = null;
+ do {
+ token = tokenizer.getNextToken();
+ tokenType = token.getType();
+ if (canHandleAsUnicodeStream(tokenType)) {
+ // side effect of canHandle is to create appropriate memento
+ }
+ else if (tokenType == CSSHeadTokenizerConstants.CHARSET_RULE) {
+ if (tokenizer.hasMoreTokens()) {
+ HeadParserToken valueToken = tokenizer.getNextToken();
+ String valueTokenType = valueToken.getType();
+ if (isLegalString(valueTokenType)) {
+ createEncodingMemento(valueToken.getText(), EncodingMemento.FOUND_ENCODING_IN_CONTENT);
+
+ }
+ }
+ }
+
+ }
+ while (tokenizer.hasMoreTokens());
+ }
+
+ /**
+ *
+ */
+ private void checkHeuristics() throws IOException {
+ boolean noHeuristic = false;
+ String heuristicEncoding = null;
+ try {
+ fReader.reset();
+ byte[] bytes = new byte[3];
+ int nRead = 0;
+ for (int i = 0; i < bytes.length; i++) {
+ if (fReader.ready()) {
+ int oneByte = fReader.read();
+ nRead++;
+ if (oneByte <= 0xFF) {
+ bytes[i] = (byte) oneByte;
+ }
+ else {
+ noHeuristic = true;
+ }
+ }
+ else {
+ noHeuristic = true;
+ break;
+ }
+ }
+ if (!noHeuristic && nRead == 3) {
+ heuristicEncoding = EncodingGuesser.guessEncoding(bytes, 3);
+ }
+ }
+ catch (IOException e) {
+ // if any IO exception, then not a heuristic case
+ }
+ finally {
+ fReader.reset();
+ }
+ if (heuristicEncoding != null) {
+ createEncodingMemento(heuristicEncoding, EncodingMemento.GUESSED_ENCODING_FROM_STREAM);
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/ContentDescriberForCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/ContentDescriberForCSS.java
new file mode 100644
index 0000000000..b28ef02ede
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/content/ContentDescriberForCSS.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.content;
+
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+import org.eclipse.wst.common.encoding.AbstractContentDescriber;
+import org.eclipse.wst.common.encoding.IResourceCharsetDetector;
+
+
+public class ContentDescriberForCSS extends AbstractContentDescriber implements ITextContentDescriber {
+
+ protected IResourceCharsetDetector getDetector() {
+ return new CSSResourceEncodingDetector();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IMediaGroupID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IMediaGroupID.java
new file mode 100644
index 0000000000..8d02ac886b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IMediaGroupID.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+/**
+ *
+ */
+public interface IMediaGroupID {
+
+ public final static String M_CONTINUOUS = "continuous"; //$NON-NLS-1$
+ public final static String M_PAGED = "paged"; //$NON-NLS-1$
+
+ public final static String M_VISUAL = "visual"; //$NON-NLS-1$
+ public final static String M_AURAL = "aural"; //$NON-NLS-1$
+ public final static String M_TACTILE = "tactile"; //$NON-NLS-1$
+
+ public final static String M_GRID = "grid"; //$NON-NLS-1$
+ public final static String M_BITMAP = "bitmap"; //$NON-NLS-1$
+
+ public final static String M_INTERACTIVE = "interactive"; //$NON-NLS-1$
+ public final static String M_STATIC = "static"; //$NON-NLS-1$
+
+ public final static String M_ALL = "all"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IValID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IValID.java
new file mode 100644
index 0000000000..f49c1a113e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/IValID.java
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+/**
+ *
+ */
+public interface IValID {
+
+ public final static String V_100 = "100"; //$NON-NLS-1$
+ public final static String V_200 = "200"; //$NON-NLS-1$
+ public final static String V_300 = "300"; //$NON-NLS-1$
+ public final static String V_400 = "400"; //$NON-NLS-1$
+ public final static String V_500 = "500"; //$NON-NLS-1$
+ public final static String V_600 = "600"; //$NON-NLS-1$
+ public final static String V_700 = "700"; //$NON-NLS-1$
+ public final static String V_800 = "800"; //$NON-NLS-1$
+ public final static String V_900 = "900"; //$NON-NLS-1$
+ public final static String V_ABOVE = "above"; //$NON-NLS-1$
+ public final static String V_ABSOLUTE = "absolute"; //$NON-NLS-1$
+ public final static String V_ACTIVEBORDER = "ActiveBorder"; //$NON-NLS-1$
+ public final static String V_ACTIVECAPTION = "ActiveCaption"; //$NON-NLS-1$
+ public final static String V_ALL = "all"; //$NON-NLS-1$
+ public final static String V_ALWAYS = "always"; //$NON-NLS-1$
+ public final static String V_APPWORKSPACE = "AppWorkspace"; //$NON-NLS-1$
+ public final static String V_AQUA = "aqua"; //$NON-NLS-1$
+ public final static String V_ARMENIAN = "armenian"; //$NON-NLS-1$
+ public final static String V_AUTO = "auto"; //$NON-NLS-1$
+ public final static String V_AVOID = "avoid"; //$NON-NLS-1$
+ public final static String V_BACKGROUND = "Background"; //$NON-NLS-1$
+ public final static String V_BASELINE = "baseline"; //$NON-NLS-1$
+ public final static String V_BEHIND = "behind"; //$NON-NLS-1$
+ public final static String V_BELOW = "below"; //$NON-NLS-1$
+ public final static String V_BIDI_OVERRIDE = "bidi-override"; //$NON-NLS-1$
+ public final static String V_BLACK = "black"; //$NON-NLS-1$
+ public final static String V_BLINK = "blink"; //$NON-NLS-1$
+ public final static String V_BLOCK = "block"; //$NON-NLS-1$
+ public final static String V_BLUE = "blue"; //$NON-NLS-1$
+ public final static String V_BOLD = "bold"; //$NON-NLS-1$
+ public final static String V_BOLDER = "bolder"; //$NON-NLS-1$
+ public final static String V_BOTH = "both"; //$NON-NLS-1$
+ public final static String V_BOTTOM = "bottom"; //$NON-NLS-1$
+ public final static String V_BUTTONFACE = "ButtonFace"; //$NON-NLS-1$
+ public final static String V_BUTTONHIGHLIGHT = "ButtonHighlight"; //$NON-NLS-1$
+ public final static String V_BUTTONSHADOW = "ButtonShadow"; //$NON-NLS-1$
+ public final static String V_BUTTONTEXT = "ButtonText"; //$NON-NLS-1$
+ public final static String V_CAPITALIZE = "capitalize"; //$NON-NLS-1$
+ public final static String V_CAPTION = "caption"; //$NON-NLS-1$
+ public final static String V_CAPTIONTEXT = "CaptionText"; //$NON-NLS-1$
+ public final static String V_CENTER = "center"; //$NON-NLS-1$
+ public final static String V_CENTER_LEFT = "center-left"; //$NON-NLS-1$
+ public final static String V_CENTER_RIGHT = "center-right"; //$NON-NLS-1$
+ public final static String V_CHILD = "child"; //$NON-NLS-1$
+ public final static String V_CIRCLE = "circle"; //$NON-NLS-1$
+ public final static String V_CJK_IDEOGRAPHIC = "cjk-ideographic"; //$NON-NLS-1$
+ public final static String V_CLOSE_QUOTE = "close-quote"; //$NON-NLS-1$
+ public final static String V_CODE = "code"; //$NON-NLS-1$
+ public final static String V_CONDENSED = "condensed"; //$NON-NLS-1$
+ public final static String V_COLLAPSE = "collapse"; //$NON-NLS-1$
+ public final static String V_COMPACT = "compact"; //$NON-NLS-1$
+ public final static String V_CONTINUOUS = "continuous"; //$NON-NLS-1$
+ public final static String V_CROP = "crop"; //$NON-NLS-1$
+ public final static String V_CROSS = "cross"; //$NON-NLS-1$
+ public final static String V_CROSSHAIR = "crosshair"; //$NON-NLS-1$
+ public final static String V_CURSIVE = "cursive"; //$NON-NLS-1$
+ public final static String V_DASHED = "dashed"; //$NON-NLS-1$
+ public final static String V_DECIMAL = "decimal"; //$NON-NLS-1$
+ public final static String V_DECIMAL_LEADING_ZERO = "decimal-leading-zero"; //$NON-NLS-1$
+ public final static String V_DEFAULT = "default"; //$NON-NLS-1$
+ public final static String V_DIGITS = "digits"; //$NON-NLS-1$
+ public final static String V_DISC = "disc"; //$NON-NLS-1$
+ public final static String V_DOTTED = "dotted"; //$NON-NLS-1$
+ public final static String V_DOUBLE = "double"; //$NON-NLS-1$
+ public final static String V_E_RESIZE = "e-resize"; //$NON-NLS-1$
+ public final static String V_EMBED = "embed"; //$NON-NLS-1$
+ public final static String V_EXPANDED = "expanded"; //$NON-NLS-1$
+ public final static String V_EXTRA_CONDENSED = "extra-condensed"; //$NON-NLS-1$
+ public final static String V_EXTRA_EXPANDED = "extra-expanded"; //$NON-NLS-1$
+ public final static String V_FANTASY = "fantasy"; //$NON-NLS-1$
+ public final static String V_FAR_LEFT = "far-left"; //$NON-NLS-1$
+ public final static String V_FAR_RIGHT = "far-right"; //$NON-NLS-1$
+ public final static String V_FAST = "fast"; //$NON-NLS-1$
+ public final static String V_FASTER = "faster"; //$NON-NLS-1$
+ public final static String V_FEMALE = "female"; //$NON-NLS-1$
+ public final static String V_FIXED = "fixed"; //$NON-NLS-1$
+ public final static String V_FUCHSIA = "fuchsia"; //$NON-NLS-1$
+ public final static String V_GEORGIAN = "georgian"; //$NON-NLS-1$
+ public final static String V_GRAY = "gray"; //$NON-NLS-1$
+ public final static String V_GRAYTEXT = "GrayText"; //$NON-NLS-1$
+ public final static String V_GREEN = "green"; //$NON-NLS-1$
+ public final static String V_GROOVE = "groove"; //$NON-NLS-1$
+ public final static String V_HEBREW = "hebrew"; //$NON-NLS-1$
+ public final static String V_HELP = "help"; //$NON-NLS-1$
+ public final static String V_HIDDEN = "hidden"; //$NON-NLS-1$
+ public final static String V_HIDE = "hide"; //$NON-NLS-1$
+ public final static String V_HIGH = "high"; //$NON-NLS-1$
+ public final static String V_HIGHLIGHT = "Highlight"; //$NON-NLS-1$
+ public final static String V_HIGHLIGHTTEXT = "HighlightText"; //$NON-NLS-1$
+ public final static String V_HIGHER = "higher"; //$NON-NLS-1$
+ public final static String V_HIRAGANA = "hiragana"; //$NON-NLS-1$
+ public final static String V_HIRAGANA_IROHA = "hiragana-iroha"; //$NON-NLS-1$
+ public final static String V_ICON = "icon"; //$NON-NLS-1$
+ public final static String V_INACTIVEBORDER = "InactiveBorder"; //$NON-NLS-1$
+ public final static String V_INACTIVECAPTION = "InactiveCaption"; //$NON-NLS-1$
+ public final static String V_INACTIVECAPTIONTEXT = "InactiveCaptionText"; //$NON-NLS-1$
+ public final static String V_INFOBACKGROUND = "InfoBackground"; //$NON-NLS-1$
+ public final static String V_INFOTEXT = "InfoText"; //$NON-NLS-1$
+ public final static String V_INLINE = "inline"; //$NON-NLS-1$
+ public final static String V_INLINE_TABLE = "inline-table"; //$NON-NLS-1$
+ public final static String V_INSET = "inset"; //$NON-NLS-1$
+ public final static String V_INSIDE = "inside"; //$NON-NLS-1$
+ public final static String V_INVERT = "invert"; //$NON-NLS-1$
+ public final static String V_ITALIC = "italic"; //$NON-NLS-1$
+ public final static String V_JUSTIFY = "justify"; //$NON-NLS-1$
+ public final static String V_KATAKANA = "katakana"; //$NON-NLS-1$
+ public final static String V_KATAKANA_IROHA = "katakana-iroha"; //$NON-NLS-1$
+ public final static String V_LANDSCAPE = "landscape"; //$NON-NLS-1$
+ public final static String V_LARGE = "large"; //$NON-NLS-1$
+ public final static String V_LARGER = "larger"; //$NON-NLS-1$
+ public final static String V_LEFT = "left"; //$NON-NLS-1$
+ public final static String V_LEFT_SIDE = "left-side"; //$NON-NLS-1$
+ public final static String V_LEFTWARDS = "leftwards"; //$NON-NLS-1$
+ public final static String V_LEVEL = "level"; //$NON-NLS-1$
+ public final static String V_LIGHTER = "lighter"; //$NON-NLS-1$
+ public final static String V_LIME = "lime"; //$NON-NLS-1$
+ public final static String V_LINE_THROUGH = "line-through"; //$NON-NLS-1$
+ public final static String V_LIST_ITEM = "list-item"; //$NON-NLS-1$
+ public final static String V_LOUD = "loud"; //$NON-NLS-1$
+ public final static String V_LOW = "low"; //$NON-NLS-1$
+ public final static String V_LOWER = "lower"; //$NON-NLS-1$
+ public final static String V_LOWER_ALPHA = "lower-alpha"; //$NON-NLS-1$
+ public final static String V_LOWER_GREEK = "lower-greek"; //$NON-NLS-1$
+ public final static String V_LOWER_LATIN = "lower-latin"; //$NON-NLS-1$
+ public final static String V_LOWER_ROMAN = "lower-roman"; //$NON-NLS-1$
+ public final static String V_LOWERCASE = "lowercase"; //$NON-NLS-1$
+ public final static String V_LTR = "ltr"; //$NON-NLS-1$
+ public final static String V_MALE = "male"; //$NON-NLS-1$
+ public final static String V_MARKER = "marker"; //$NON-NLS-1$
+ public final static String V_MAROON = "maroon"; //$NON-NLS-1$
+ public final static String V_MEDIUM = "medium"; //$NON-NLS-1$
+ public final static String V_MENU = "menu"; //$NON-NLS-1$
+ public final static String V_MENUTEXT = "MenuText"; //$NON-NLS-1$
+ public final static String V_MESSAGE_BOX = "message-box"; //$NON-NLS-1$
+ public final static String V_MIDDLE = "middle"; //$NON-NLS-1$
+ public final static String V_MIX = "mix"; //$NON-NLS-1$
+ public final static String V_MONOSPACE = "monospace"; //$NON-NLS-1$
+ public final static String V_MOVE = "move"; //$NON-NLS-1$
+ public final static String V_N_RESIZE = "n-resize"; //$NON-NLS-1$
+ public final static String V_NARROWER = "narrower"; //$NON-NLS-1$
+ public final static String V_NAVY = "navy"; //$NON-NLS-1$
+ public final static String V_NE_RESIZE = "ne-resize"; //$NON-NLS-1$
+ public final static String V_NO_CLOSE_QUOTE = "no-close-quote"; //$NON-NLS-1$
+ public final static String V_NO_OPEN_QUOTE = "no-open-quote"; //$NON-NLS-1$
+ public final static String V_NO_REPEAT = "no-repeat"; //$NON-NLS-1$
+ public final static String V_NONE = "none"; //$NON-NLS-1$
+ public final static String V_NORMAL = "normal"; //$NON-NLS-1$
+ public final static String V_NOWRAP = "nowrap"; //$NON-NLS-1$
+ public final static String V_NW_RESIZE = "nw-resize"; //$NON-NLS-1$
+ public final static String V_OBLIQUE = "oblique"; //$NON-NLS-1$
+ public final static String V_OLIVE = "olive"; //$NON-NLS-1$
+ public final static String V_ONCE = "once"; //$NON-NLS-1$
+ public final static String V_OPEN_QUOTE = "open-quote"; //$NON-NLS-1$
+ public final static String V_OUTSET = "outset"; //$NON-NLS-1$
+ public final static String V_OUTSIDE = "outside"; //$NON-NLS-1$
+ public final static String V_OVERLINE = "overline"; //$NON-NLS-1$
+ public final static String V_POINTER = "pointer"; //$NON-NLS-1$
+ public final static String V_PORTRAIT = "portrait"; //$NON-NLS-1$
+ public final static String V_PRE = "pre"; //$NON-NLS-1$
+ public final static String V_PURPLE = "purple"; //$NON-NLS-1$
+ public final static String V_RED = "red"; //$NON-NLS-1$
+ public final static String V_RELATIVE = "relative"; //$NON-NLS-1$
+ public final static String V_REPEAT = "repeat"; //$NON-NLS-1$
+ public final static String V_REPEAT_X = "repeat-x"; //$NON-NLS-1$
+ public final static String V_REPEAT_Y = "repeat-y"; //$NON-NLS-1$
+ public final static String V_RIDGE = "ridge"; //$NON-NLS-1$
+ public final static String V_RIGHT = "right"; //$NON-NLS-1$
+ public final static String V_RIGHT_SIDE = "right-side"; //$NON-NLS-1$
+ public final static String V_RIGHTWARDS = "rightwards"; //$NON-NLS-1$
+ public final static String V_RTL = "rtl"; //$NON-NLS-1$
+ public final static String V_RUN_IN = "run-in"; //$NON-NLS-1$
+ public final static String V_S_RESIZE = "s-resize"; //$NON-NLS-1$
+ public final static String V_SANS_SERIF = "sans-serif"; //$NON-NLS-1$
+ public final static String V_SCROLL = "scroll"; //$NON-NLS-1$
+ public final static String V_SCROLLBAR = "Scrollbar"; //$NON-NLS-1$
+ public final static String V_SE_RESIZE = "se-resize"; //$NON-NLS-1$
+ public final static String V_SEMI_CONDENSED = "semi-condensed"; //$NON-NLS-1$
+ public final static String V_SEMI_EXPANDED = "semi-expanded"; //$NON-NLS-1$
+ public final static String V_SEPARATE = "separate"; //$NON-NLS-1$
+ public final static String V_SERIF = "serif"; //$NON-NLS-1$
+ public final static String V_SHOW = "show"; //$NON-NLS-1$
+ public final static String V_SILENT = "silent"; //$NON-NLS-1$
+ public final static String V_SILVER = "silver"; //$NON-NLS-1$
+ public final static String V_SLOW = "slow"; //$NON-NLS-1$
+ public final static String V_SLOWER = "slower"; //$NON-NLS-1$
+ public final static String V_SMALL = "small"; //$NON-NLS-1$
+ public final static String V_SMALL_CAPS = "small-caps"; //$NON-NLS-1$
+ public final static String V_SMALL_CAPTION = "small-caption"; //$NON-NLS-1$
+ public final static String V_SMALLER = "smaller"; //$NON-NLS-1$
+ public final static String V_SOFT = "soft"; //$NON-NLS-1$
+ public final static String V_SOLID = "solid"; //$NON-NLS-1$
+ public final static String V_SPELL_OUT = "spell-out"; //$NON-NLS-1$
+ public final static String V_SQUARE = "square"; //$NON-NLS-1$
+ public final static String V_STATIC = "static"; //$NON-NLS-1$
+ public final static String V_STATUS_BAR = "status-bar"; //$NON-NLS-1$
+ public final static String V_SUB = "sub"; //$NON-NLS-1$
+ public final static String V_SUPER = "super"; //$NON-NLS-1$
+ public final static String V_SW_RESIZE = "sw-resize"; //$NON-NLS-1$
+ public final static String V_TABLE = "table"; //$NON-NLS-1$
+ public final static String V_TABLE_CAPTION = "table-caption"; //$NON-NLS-1$
+ public final static String V_TABLE_CELL = "table-cell"; //$NON-NLS-1$
+ public final static String V_TABLE_COLUMN = "table-column"; //$NON-NLS-1$
+ public final static String V_TABLE_COLUMN_GROUP = "table-column-group"; //$NON-NLS-1$
+ public final static String V_TABLE_FOOTER_GROUP = "table-footer-group"; //$NON-NLS-1$
+ public final static String V_TABLE_HEADER_GROUP = "table-header-group"; //$NON-NLS-1$
+ public final static String V_TABLE_ROW = "table-row"; //$NON-NLS-1$
+ public final static String V_TABLE_ROW_GROUP = "table-row-group"; //$NON-NLS-1$
+ public final static String V_TEAL = "teal"; //$NON-NLS-1$
+ public final static String V_TEXT = "text"; //$NON-NLS-1$
+ public final static String V_TEXT_TOP = "text-top"; //$NON-NLS-1$
+ public final static String V_TEXT_BOTTOM = "text-bottom"; //$NON-NLS-1$
+ public final static String V_THICK = "thick"; //$NON-NLS-1$
+ public final static String V_THIN = "thin"; //$NON-NLS-1$
+ public final static String V_THREEDDARKSHADOW = "ThreeDDarkShadow"; //$NON-NLS-1$
+ public final static String V_THREEDFACE = "ThreeDFace"; //$NON-NLS-1$
+ public final static String V_THREEDHIGHLIGHT = "ThreeDHighlight"; //$NON-NLS-1$
+ public final static String V_THREEDLIGHTSHADOW = "ThreeDLightShadow"; //$NON-NLS-1$
+ public final static String V_THREEDSHADOW = "ThreeDShadow"; //$NON-NLS-1$
+ public final static String V_TOP = "top"; //$NON-NLS-1$
+ public final static String V_TRANSPARENT = "transparent"; //$NON-NLS-1$
+ public final static String V_ULTRA_CONDENSED = "ultra-condensed"; //$NON-NLS-1$
+ public final static String V_ULTRA_EXPANDED = "ultra-expanded"; //$NON-NLS-1$
+ public final static String V_UNDERLINE = "underline"; //$NON-NLS-1$
+ public final static String V_UPPER_ALPHA = "upper-alpha"; //$NON-NLS-1$
+ public final static String V_UPPER_LATIN = "upper-latin"; //$NON-NLS-1$
+ public final static String V_UPPER_ROMAN = "upper-roman"; //$NON-NLS-1$
+ public final static String V_UPPERCASE = "uppercase"; //$NON-NLS-1$
+ public final static String V_VISIBLE = "visible"; //$NON-NLS-1$
+ public final static String V_W_RESIZE = "w-resize"; //$NON-NLS-1$
+ public final static String V_WAIT = "wait"; //$NON-NLS-1$
+ public final static String V_WHITE = "white"; //$NON-NLS-1$
+ public final static String V_WIDER = "wider"; //$NON-NLS-1$
+ public final static String V_WINDOW = "Window"; //$NON-NLS-1$
+ public final static String V_WINDOWFRAME = "WindowFrame"; //$NON-NLS-1$
+ public final static String V_WINDOWTEXT = "WindowText"; //$NON-NLS-1$
+ public final static String V_X_FAST = "x-fast"; //$NON-NLS-1$
+ public final static String V_X_HIGH = "x-high"; //$NON-NLS-1$
+ public final static String V_X_LARGE = "x-large"; //$NON-NLS-1$
+ public final static String V_X_LOUD = "x-loud"; //$NON-NLS-1$
+ public final static String V_X_LOW = "x-low"; //$NON-NLS-1$
+ public final static String V_X_SLOW = "x-slow"; //$NON-NLS-1$
+ public final static String V_X_SMALL = "x-small"; //$NON-NLS-1$
+ public final static String V_X_SOFT = "x-soft"; //$NON-NLS-1$
+ public final static String V_XX_SMALL = "xx-small"; //$NON-NLS-1$
+ public final static String V_XX_LARGE = "xx-large"; //$NON-NLS-1$
+ public final static String V_YELLOW = "yellow"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMContainer.java
new file mode 100644
index 0000000000..d013f7ca6e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMContainer.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.Vector;
+
+/**
+ *
+ */
+public class PropCMContainer extends PropCMNode {
+
+ private java.util.Vector nodes = new Vector();
+ private static java.util.Hashtable instances = null;
+ public final static String VAL_ABSOLUTE_SIZE = "absolute-size";//$NON-NLS-1$
+ public final static String VAL_BORDER_STYLE = "border-style";//$NON-NLS-1$
+ public final static String VAL_BORDER_WIDTH = "border-width";//$NON-NLS-1$
+ public final static String VAL_COLOR = "color";//$NON-NLS-1$
+ public final static String VAL_SYSTEM_COLOR = "system-color";//$NON-NLS-1$
+ public final static String VAL_GENERIC_FAMILY = "generic-family";//$NON-NLS-1$
+ public final static String VAL_GENERIC_VOICE = "generic-voice";//$NON-NLS-1$
+ public final static String VAL_MARGIN_WIDTH = "margin-width";//$NON-NLS-1$
+ public final static String VAL_PADDING_WIDTH = "padding-width";//$NON-NLS-1$
+ public final static String VAL_RELATIVE_SIZE = "relative-size";//$NON-NLS-1$
+
+ /**
+ *
+ */
+ protected PropCMContainer(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ Object appendChild(Object node) {
+ if (!nodes.contains(node))
+ nodes.add(node);
+ return node;
+ }
+
+ /**
+ *
+ */
+ public boolean canHave(String identifier) {
+ int nChild = getNumChild();
+ for (int i = 0; i < nChild; i++) {
+ Object child = getChildAt(i);
+ if (child instanceof String && identifier.equalsIgnoreCase((String) child))
+ return true;
+ if (child instanceof PropCMContainer && ((PropCMContainer) child).canHave(identifier))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ public Object getChildAt(int index) {
+ if (nodes == null || index < 0 || nodes.size() <= index)
+ return null;
+ return nodes.elementAt(index);
+ }
+
+ /**
+ *
+ */
+ static PropCMContainer getContInstanceOf(String name) {
+ if (name == null)
+ return null;
+
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(20);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMContainer) node;
+
+ if (PropCMNode.isLoading()) {
+ // register
+ node = new PropCMContainer(name);
+ instances.put(name, node);
+ }
+
+ return (PropCMContainer) node;
+ }
+
+ /**
+ *
+ */
+ void getIdentifiers(Set idents) {
+ if (idents == null)
+ return;
+ int nChildren = nodes.size();
+ for (int i = 0; i < nChildren; i++) {
+ Object node = nodes.elementAt(i);
+ if (node instanceof PropCMNode)
+ ((PropCMNode) node).getIdentifiers(idents);
+ else if (node instanceof String)
+ idents.add(node);
+ }
+ }
+
+ /**
+ *
+ */
+ public int getNumChild() {
+ if (nodes == null)
+ return 0;
+ return nodes.size();
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_CONTAINER;
+ }
+
+ /**
+ *
+ */
+ void getValues(Collection values) {
+ if (values == null)
+ return;
+ int nChildren = nodes.size();
+ for (int i = 0; i < nChildren; i++) {
+ Object node = nodes.elementAt(i);
+ if (node instanceof PropCMNode)
+ ((PropCMNode) node).getValues(values);
+ else if (node instanceof String) {
+ if (!values.contains(node))
+ values.add(node);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ Object removeChild(Object node) {
+ nodes.remove(node);
+ return node;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFontProperty.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFontProperty.java
new file mode 100644
index 0000000000..a28e21da9f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFontProperty.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ *
+ */
+public class PropCMFontProperty extends PropCMProperty {
+
+ // static fields
+ private static java.util.Hashtable instances = null;
+ private static java.util.Hashtable cachedIdMap = null;
+ // selecting properties
+ public final static String PF_FONT_FAMILY = "font-family";//$NON-NLS-1$
+ public final static String PF_FONT_STYLE = "font-style";//$NON-NLS-1$
+ public final static String PF_FONT_VARIANT = "font-variant";//$NON-NLS-1$
+ public final static String PF_FONT_WEIGHT = "font-weight";//$NON-NLS-1$
+ public final static String PF_FONT_STRETCH = "font-stretch";//$NON-NLS-1$
+ public final static String PF_FONT_SIZE = "font-size";//$NON-NLS-1$
+ // qualification properties
+ public final static String PF_UNICODE_RANGE = "unicode-range";//$NON-NLS-1$
+ // numeric properties
+ public final static String PF_UNITS_PER_EM = "units-per-em";//$NON-NLS-1$
+ // referencing properties
+ public final static String PF_SRC = "src";//$NON-NLS-1$
+ // matching properties
+ public final static String PF_PANOSE_1 = "panose-1";//$NON-NLS-1$
+ public final static String PF_STEMV = "stemv";//$NON-NLS-1$
+ public final static String PF_STEMH = "stemh";//$NON-NLS-1$
+ public final static String PF_SLOPE = "slope";//$NON-NLS-1$
+ public final static String PF_CAP_HEIGHT = "cap-height";//$NON-NLS-1$
+ public final static String PF_X_HEIGHT = "x-height";//$NON-NLS-1$
+ public final static String PF_ASCENT = "ascent";//$NON-NLS-1$
+ public final static String PF_DESCENT = "descent";//$NON-NLS-1$
+ // synthesis properties
+ public final static String PF_WIDTHS = "widths";//$NON-NLS-1$
+ public final static String PF_BBOX = "bbox";//$NON-NLS-1$
+ public final static String PF_DEFINITION_SRC = "definition-src";//$NON-NLS-1$
+ // alignment properties
+ public final static String PF_BASELINE = "baseline";//$NON-NLS-1$
+ public final static String PF_CENTERLINE = "centerline";//$NON-NLS-1$
+ public final static String PF_MATHLINE = "mathline";//$NON-NLS-1$
+ public final static String PF_TOPLINE = "topline";//$NON-NLS-1$
+
+ /**
+ *
+ */
+ protected PropCMFontProperty(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ public static PropCMProperty getInstanceOf(String name) {
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(10);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMProperty) node;
+
+ // register
+ if (PropCMNode.isLoading()) {
+ node = new PropCMFontProperty(name);
+ instances.put(name, node);
+ }
+
+ return (PropCMProperty) node;
+ }
+
+ /**
+ *
+ */
+ public static Enumeration getNameEnum() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return instances.keys();
+ }
+
+ /**
+ *
+ */
+ public static Enumeration getPropertyEnum() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return instances.elements();
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_FONTPROPERTY;
+ }
+
+ /**
+ *
+ */
+ public static Vector names() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return new Vector(instances.keySet());
+ }
+
+ /**
+ *
+ */
+ public static List names(Object mediaGroup) {
+ if (mediaGroup == null)
+ return names();
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ Vector properties = new Vector();
+
+ Iterator it = instances.values().iterator();
+ while (it.hasNext()) {
+ PropCMProperty prop = (PropCMProperty) it.next();
+ if (prop.getMediaGroups().contains(mediaGroup))
+ properties.add(prop.getName());
+ }
+
+ return properties;
+ }
+
+ /**
+ * If itentifier is null, get all properties
+ */
+ public static Vector propertiesFor(String identifier, boolean shorthands) {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // if identifier is null, get all properties
+ if (identifier == null)
+ return new Vector(instances.values());
+
+ if (cachedIdMap == null) {
+ // start cacheing
+ cachedIdMap = new Hashtable();
+ }
+ else {
+ // search cached
+ Object ret = cachedIdMap.get(identifier + String.valueOf(shorthands));
+ if (ret != null)
+ return new Vector((Collection) ret);
+ }
+
+ // create
+ Enumeration properties = getPropertyEnum();
+ HashSet set = new HashSet();
+ while (properties.hasMoreElements()) {
+ PropCMProperty prop = (PropCMProperty) properties.nextElement();
+ if (!shorthands && prop.isShorthand())
+ continue;
+ if (prop.canHave(identifier))
+ set.add(prop);
+ }
+
+ // cache
+ cachedIdMap.put(identifier + String.valueOf(shorthands), set);
+
+ return new Vector(set);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFunction.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFunction.java
new file mode 100644
index 0000000000..03efc91c06
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMFunction.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Set;
+
+/**
+ *
+ */
+public class PropCMFunction extends PropCMNode {
+
+ private static java.util.Hashtable instances = null;
+ public final static String VAL_ATTR = "attr";//$NON-NLS-1$
+ public final static String VAL_COUNTER = "counter";//$NON-NLS-1$
+ public final static String VAL_RGB = "rgb";//$NON-NLS-1$
+ public final static String VAL_SHAPE = "rect";//$NON-NLS-1$
+ public final static String VAL_URI = "url";//$NON-NLS-1$
+ public final static String VAL_FORMAT = "format";//$NON-NLS-1$
+ public final static String VAL_LOCAL = "local";//$NON-NLS-1$
+
+ /**
+ *
+ */
+ protected PropCMFunction(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ void getIdentifiers(Set indents) {
+ }
+
+ /**
+ *
+ */
+ static public PropCMFunction getInstanceOf(String name) {
+ if (name == null)
+ return null;
+
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(10);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMFunction) node;
+
+ // register
+ if (PropCMNode.isLoading()) {
+ node = new PropCMFunction(name);
+ instances.put(name, node);
+ }
+
+ return (PropCMFunction) node;
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_FUNC;
+ }
+
+ /**
+ *
+ */
+ void getValues(Collection values) {
+ if (values != null && !values.contains(this))
+ values.add(this);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNode.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNode.java
new file mode 100644
index 0000000000..52a84df134
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNode.java
@@ -0,0 +1,1369 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Vector;
+
+/**
+ *
+ */
+public abstract class PropCMNode {
+
+ public final static short VAL_IDENTIFIER = 0;
+ public final static short VAL_PROPERTY = 1;
+ public final static short VAL_NUMBER = 2;
+ public final static short VAL_STRING = 3;
+ public final static short VAL_FUNC = 4;
+ public final static short VAL_CONTAINER = 5;
+ public final static short VAL_SUBPROPERTY = 6;
+ public final static short VAL_FONTPROPERTY = 7;
+ public final static short VAL_UNICODE_RANGE = 8;
+ protected java.lang.String name = null;
+ private static short LOADING = 0; // 0 : not initialized, 1 : under
+ // initializing, 2 : initialize-done
+ // and fix DB
+
+ /**
+ *
+ */
+ public PropCMNode(String name) {
+ super();
+ this.name = name;
+ }
+
+ /**
+ *
+ */
+ public Set getIdentifiers() {
+ HashSet ids = new HashSet();
+ getIdentifiers(ids);
+ return ids;
+ }
+
+ /**
+ *
+ */
+ abstract void getIdentifiers(Set indents);
+
+ /**
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ *
+ */
+ public abstract short getType();
+
+ /**
+ *
+ */
+ public Collection getValues() {
+ Vector vals = new Vector();
+ getValues(vals);
+ return vals;
+ }
+
+ /**
+ *
+ */
+ abstract void getValues(Collection values);
+
+ /**
+ *
+ */
+ protected static void initPropertyCM() {
+ if (!isNeedInitialize())
+ return;
+ LOADING = 1;
+
+ PropCMNumber.initNumberCMDim();
+
+ // azimuth
+ PropCMProperty prop = PropCMProperty.getInstanceOf(PropCMProperty.P_AZIMUTH);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_ANGLE));
+ prop.appendChild(IValID.V_LEFT_SIDE);
+ prop.appendChild(IValID.V_FAR_LEFT);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_CENTER_LEFT);
+ prop.appendChild(IValID.V_CENTER);
+ prop.appendChild(IValID.V_CENTER_RIGHT);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendChild(IValID.V_FAR_RIGHT);
+ prop.appendChild(IValID.V_RIGHT_SIDE);
+ prop.appendChild(IValID.V_BEHIND);
+ prop.appendChild(IValID.V_LEFTWARDS);
+ prop.appendChild(IValID.V_RIGHTWARDS);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+ prop.setMaxValueCount(2);
+
+ // background
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BG);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.setMaxValueCount(6);
+
+ // background-attachment
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT);
+ prop.appendChild(IValID.V_SCROLL);
+ prop.appendChild(IValID.V_FIXED);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // background-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendChild(IValID.V_TRANSPARENT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // background-image
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // background-position ---- sub-properties horizontal
+ prop = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_CENTER);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // background-position ---- sub-properties vertical
+ prop = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_TOP);
+ prop.appendChild(IValID.V_CENTER);
+ prop.appendChild(IValID.V_BOTTOM);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // background-position
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION);
+ prop.appendChild(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X));
+ prop.appendChild(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y));
+ prop.setMaxValueCount(2);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // background-repeat
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT);
+ prop.appendChild(IValID.V_REPEAT);
+ prop.appendChild(IValID.V_REPEAT_X);
+ prop.appendChild(IValID.V_REPEAT_Y);
+ prop.appendChild(IValID.V_NO_REPEAT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE));
+ // prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR));
+ prop.setMaxValueCount(9);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-collapse
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLLAPSE);
+ prop.appendChild(IValID.V_COLLAPSE);
+ prop.appendChild(IValID.V_SEPARATE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR));
+ // prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendChild(IValID.V_TRANSPARENT);
+ prop.setMaxValueCount(4);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-spacing
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_SPACING);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.setMaxValueCount(2);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE));
+ // prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE));
+ prop.setMaxValueCount(4);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-top
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR));
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-right
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR));
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-bottom
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR));
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-left
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR));
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-top-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-top-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-top-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-right-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-right-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-right-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-bottom-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-bottom-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-bottom-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-left-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-left-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-left-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // border-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH);
+ // prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH));
+ prop.setMaxValueCount(4);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // bottom
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_BOTTOM);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // caption-side
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CAPTION_SIDE);
+ prop.appendChild(IValID.V_TOP);
+ prop.appendChild(IValID.V_BOTTOM);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // clear
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CLEAR);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendChild(IValID.V_BOTH);
+ prop.appendChild(IValID.V_STATIC);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // clip ---- sub-properties top
+ prop = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(IValID.V_AUTO);
+ ((PropCMSubProperty) prop).setContainer(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // clip ---- sub-properties right
+ prop = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(IValID.V_AUTO);
+ ((PropCMSubProperty) prop).setContainer(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // clip ---- sub-properties bottom
+ prop = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(IValID.V_AUTO);
+ ((PropCMSubProperty) prop).setContainer(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // clip ---- sub-properties left
+ prop = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(IValID.V_AUTO);
+ ((PropCMSubProperty) prop).setContainer(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // clip
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_SHAPE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // content
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CONTENT);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_ANY));
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_COUNTER));
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_ATTR));
+ prop.appendChild(IValID.V_OPEN_QUOTE);
+ prop.appendChild(IValID.V_CLOSE_QUOTE);
+ prop.appendChild(IValID.V_NO_OPEN_QUOTE);
+ prop.appendChild(IValID.V_NO_CLOSE_QUOTE);
+ prop.setMaxValueCount(-1); // infinite
+ prop.appendMediaGroup(IMediaGroupID.M_ALL);
+
+ // counter-increment
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_INCREMENT);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_COUNTER_ID));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_INTEGER));
+ prop.appendChild(IValID.V_NONE);
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_ALL);
+
+ // counter-reset
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_RESET);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_COUNTER_ID));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_INTEGER));
+ prop.appendChild(IValID.V_NONE);
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_ALL);
+
+ // cue
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CUE);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_BEFORE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_AFTER));
+ prop.setMaxValueCount(2);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // cue-after
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_AFTER);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // cue-before
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_BEFORE);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // cursor
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_CURSOR);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(IValID.V_CROSSHAIR);
+ prop.appendChild(IValID.V_DEFAULT);
+ prop.appendChild(IValID.V_POINTER);
+ prop.appendChild(IValID.V_MOVE);
+ prop.appendChild(IValID.V_E_RESIZE);
+ prop.appendChild(IValID.V_NE_RESIZE);
+ prop.appendChild(IValID.V_NW_RESIZE);
+ prop.appendChild(IValID.V_N_RESIZE);
+ prop.appendChild(IValID.V_SE_RESIZE);
+ prop.appendChild(IValID.V_SW_RESIZE);
+ prop.appendChild(IValID.V_S_RESIZE);
+ prop.appendChild(IValID.V_W_RESIZE);
+ prop.appendChild(IValID.V_TEXT);
+ prop.appendChild(IValID.V_WAIT);
+ prop.appendChild(IValID.V_HELP);
+ prop.setMaxValueCount(-1); // infinite
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_INTERACTIVE);
+
+ // direction
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_DIRECTION);
+ prop.appendChild(IValID.V_LTR);
+ prop.appendChild(IValID.V_RTL);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // display
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_DISPLAY);
+ prop.appendChild(IValID.V_INLINE);
+ prop.appendChild(IValID.V_BLOCK);
+ prop.appendChild(IValID.V_LIST_ITEM);
+ prop.appendChild(IValID.V_RUN_IN);
+ prop.appendChild(IValID.V_COMPACT);
+ prop.appendChild(IValID.V_MARKER);
+ prop.appendChild(IValID.V_TABLE);
+ prop.appendChild(IValID.V_INLINE_TABLE);
+ prop.appendChild(IValID.V_TABLE_ROW_GROUP);
+ prop.appendChild(IValID.V_TABLE_HEADER_GROUP);
+ prop.appendChild(IValID.V_TABLE_FOOTER_GROUP);
+ prop.appendChild(IValID.V_TABLE_ROW);
+ prop.appendChild(IValID.V_TABLE_COLUMN_GROUP);
+ prop.appendChild(IValID.V_TABLE_COLUMN);
+ prop.appendChild(IValID.V_TABLE_CELL);
+ prop.appendChild(IValID.V_TABLE_CAPTION);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_ALL);
+
+ // elevation
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_ELEVATION);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_ANGLE));
+ prop.appendChild(IValID.V_BELOW);
+ prop.appendChild(IValID.V_LEVEL);
+ prop.appendChild(IValID.V_ABOVE);
+ prop.appendChild(IValID.V_HIGHER);
+ prop.appendChild(IValID.V_LOWER);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // empty-cells
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_EMPTY_CELLS);
+ prop.appendChild(IValID.V_SHOW);
+ prop.appendChild(IValID.V_HIDE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // float
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FLOAT);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY));
+ prop.appendChild(IValID.V_CAPTION);
+ prop.appendChild(IValID.V_ICON);
+ prop.appendChild(IValID.V_MENU);
+ prop.appendChild(IValID.V_MESSAGE_BOX);
+ prop.appendChild(IValID.V_SMALL_CAPTION);
+ prop.appendChild(IValID.V_STATUS_BAR);
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-family
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_FONT));
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_GENERIC_FAMILY));
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-size
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_ABSOLUTE_SIZE));
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_RELATIVE_SIZE));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-size-adjust
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE_ADJUST);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-stretch
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STRETCH);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_WIDER);
+ prop.appendChild(IValID.V_NARROWER);
+ prop.appendChild(IValID.V_ULTRA_CONDENSED);
+ prop.appendChild(IValID.V_EXTRA_CONDENSED);
+ prop.appendChild(IValID.V_CONDENSED);
+ prop.appendChild(IValID.V_SEMI_CONDENSED);
+ prop.appendChild(IValID.V_SEMI_EXPANDED);
+ prop.appendChild(IValID.V_EXPANDED);
+ prop.appendChild(IValID.V_EXTRA_EXPANDED);
+ prop.appendChild(IValID.V_ULTRA_EXPANDED);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE);
+ prop.appendChild(IValID.V_ITALIC);
+ prop.appendChild(IValID.V_OBLIQUE);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-variant
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT);
+ prop.appendChild(IValID.V_SMALL_CAPS);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // font-weight
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT);
+ prop.appendChild(IValID.V_BOLD);
+ prop.appendChild(IValID.V_100);
+ prop.appendChild(IValID.V_200);
+ prop.appendChild(IValID.V_300);
+ prop.appendChild(IValID.V_400);
+ prop.appendChild(IValID.V_500);
+ prop.appendChild(IValID.V_600);
+ prop.appendChild(IValID.V_700);
+ prop.appendChild(IValID.V_800);
+ prop.appendChild(IValID.V_900);
+ prop.appendChild(IValID.V_LIGHTER);
+ prop.appendChild(IValID.V_BOLDER);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // height
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_HEIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // leftt
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LEFT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // letter-spacing
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LETTER_SPACING);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // line-height
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // list-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE));
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // list-style-image
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // list-style-position
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION);
+ prop.appendChild(IValID.V_INSIDE);
+ prop.appendChild(IValID.V_OUTSIDE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // list-style-type
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE);
+ prop.appendChild(IValID.V_DISC);
+ prop.appendChild(IValID.V_CIRCLE);
+ prop.appendChild(IValID.V_SQUARE);
+ prop.appendChild(IValID.V_DECIMAL);
+ prop.appendChild(IValID.V_DECIMAL_LEADING_ZERO);
+ prop.appendChild(IValID.V_LOWER_ROMAN);
+ prop.appendChild(IValID.V_UPPER_ROMAN);
+ prop.appendChild(IValID.V_LOWER_GREEK);
+ prop.appendChild(IValID.V_LOWER_ALPHA);
+ prop.appendChild(IValID.V_LOWER_LATIN);
+ prop.appendChild(IValID.V_UPPER_ALPHA);
+ prop.appendChild(IValID.V_UPPER_LATIN);
+ prop.appendChild(IValID.V_HEBREW);
+ prop.appendChild(IValID.V_ARMENIAN);
+ prop.appendChild(IValID.V_GEORGIAN);
+ prop.appendChild(IValID.V_CJK_IDEOGRAPHIC);
+ prop.appendChild(IValID.V_HIRAGANA);
+ prop.appendChild(IValID.V_KATAKANA);
+ prop.appendChild(IValID.V_HIRAGANA_IROHA);
+ prop.appendChild(IValID.V_KATAKANA_IROHA);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // margin
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN);
+ // prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_MARGIN_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_TOP));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_RIGHT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_BOTTOM));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_LEFT));
+ prop.setMaxValueCount(4);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // margin-top
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_TOP);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_MARGIN_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // margin-right
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_RIGHT);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_MARGIN_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // margin-bottom
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_BOTTOM);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_MARGIN_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // margin-left
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_LEFT);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_MARGIN_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // marker-offset
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARKER_OFFSET);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // marks
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MARKS);
+ prop.appendChild(IValID.V_CROP);
+ prop.appendChild(IValID.V_CROSS);
+ prop.appendChild(IValID.V_NONE);
+ prop.setMaxValueCount(2);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // max-height
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_HEIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // max-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_WIDTH);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // min-height
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_HEIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // min-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_WIDTH);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // orphans
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_ORPHANS);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_INTEGER));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // outline
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE);
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_COLOR));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_STYLE));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_WIDTH));
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_INTERACTIVE);
+
+ // outline-color
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_COLOR);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendChild(IValID.V_INVERT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_INTERACTIVE);
+
+ // outline-style
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_STYLE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_INTERACTIVE);
+
+ // outline-width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_WIDTH);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_INTERACTIVE);
+
+ // overflow
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_OVERFLOW);
+ prop.appendChild(IValID.V_VISIBLE);
+ prop.appendChild(IValID.V_HIDDEN);
+ prop.appendChild(IValID.V_SCROLL);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // padding
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING);
+ // prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_PADDING_WIDTH));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_TOP));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_RIGHT));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_BOTTOM));
+ prop.appendChild(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_LEFT));
+ prop.setMaxValueCount(4);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // padding-top
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_TOP);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_PADDING_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // padding-right
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_RIGHT);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_PADDING_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // padding-bottom
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_BOTTOM);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_PADDING_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // padding-left
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_LEFT);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_PADDING_WIDTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // page
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_PAGE_ID));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // page-break-after
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_AFTER);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(IValID.V_ALWAYS);
+ prop.appendChild(IValID.V_AVOID);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // page-break-before
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_BEFORE);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(IValID.V_ALWAYS);
+ prop.appendChild(IValID.V_AVOID);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // page-break-inside
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_INSIDE);
+ prop.appendChild(IValID.V_AVOID);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // pause
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_TIME));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.setMaxValueCount(2);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // pause-after
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_AFTER);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_TIME));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // pause-before
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_BEFORE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_TIME));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // pitch
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_FREQUENCY));
+ prop.appendChild(IValID.V_X_LOW);
+ prop.appendChild(IValID.V_LOW);
+ prop.appendChild(IValID.V_MEDIUM);
+ prop.appendChild(IValID.V_HIGH);
+ prop.appendChild(IValID.V_X_HIGH);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // pitch-range
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH_RANGE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // play-during
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_PLAY_DURING);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(IValID.V_MIX);
+ prop.appendChild(IValID.V_REPEAT);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(IValID.V_NONE);
+ prop.setMaxValueCount(3);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // position
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_POSITION);
+ prop.appendChild(IValID.V_ABSOLUTE);
+ prop.appendChild(IValID.V_RELATIVE);
+ prop.appendChild(IValID.V_FIXED);
+ prop.appendChild(IValID.V_STATIC);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // quotes
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_QUOTES);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_ANY));
+ prop.appendChild(IValID.V_NONE);
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // richness
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_RICHNESS);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // right
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_RIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // size
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_SIZE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(IValID.V_PORTRAIT);
+ prop.appendChild(IValID.V_LANDSCAPE);
+ prop.setMaxValueCount(2);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // speak
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendChild(IValID.V_SPELL_OUT);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // speak-header
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_HEADER);
+ prop.appendChild(IValID.V_ONCE);
+ prop.appendChild(IValID.V_ALWAYS);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // speak-numeral
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_NUMERAL);
+ prop.appendChild(IValID.V_DIGITS);
+ prop.appendChild(IValID.V_CONTINUOUS);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // speak-punctuation
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_PUNCTUATION);
+ prop.appendChild(IValID.V_CODE);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // speech-rate
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_SPEECH_RATE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendChild(IValID.V_X_SLOW);
+ prop.appendChild(IValID.V_SLOW);
+ prop.appendChild(IValID.V_MEDIUM);
+ prop.appendChild(IValID.V_FAST);
+ prop.appendChild(IValID.V_X_FAST);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // stress
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_STRESS);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // table-layout
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TABLE_LAYOUT);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(IValID.V_FIXED);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // text-align
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_ALIGN);
+ prop.appendChild(IValID.V_LEFT);
+ prop.appendChild(IValID.V_CENTER);
+ prop.appendChild(IValID.V_RIGHT);
+ prop.appendChild(IValID.V_JUSTIFY);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_ANY));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // text-decoration
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_DECORATION);
+ prop.appendChild(IValID.V_UNDERLINE);
+ prop.appendChild(IValID.V_OVERLINE);
+ prop.appendChild(IValID.V_LINE_THROUGH);
+ prop.appendChild(IValID.V_BLINK);
+ prop.appendChild(IValID.V_NONE);
+ prop.setMaxValueCount(4);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // text-indent
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_INDENT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // text-shadow
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_SHADOW);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // text-transform
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_TRANSFORM);
+ prop.appendChild(IValID.V_CAPITALIZE);
+ prop.appendChild(IValID.V_UPPERCASE);
+ prop.appendChild(IValID.V_LOWERCASE);
+ prop.appendChild(IValID.V_NONE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // top
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_TOP);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // unicode-bidi
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_UNICODE_BIDI);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_EMBED);
+ prop.appendChild(IValID.V_BIDI_OVERRIDE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // vertical-align
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_VERTICAL_ALIGN);
+ prop.appendChild(IValID.V_BOTTOM);
+ prop.appendChild(IValID.V_TEXT_BOTTOM);
+ prop.appendChild(IValID.V_SUB);
+ prop.appendChild(IValID.V_BASELINE);
+ prop.appendChild(IValID.V_MIDDLE);
+ prop.appendChild(IValID.V_SUPER);
+ prop.appendChild(IValID.V_TEXT_TOP);
+ prop.appendChild(IValID.V_TOP);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // visibility
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_VISIBILITY);
+ prop.appendChild(IValID.V_VISIBLE);
+ prop.appendChild(IValID.V_HIDDEN);
+ prop.appendChild(IValID.V_COLLAPSE);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // voice-family
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_VOICE_FAMILY);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_VOICE));
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_GENERIC_VOICE));
+ prop.setMaxValueCount(-1);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // volume
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_VOLUME);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_SILENT);
+ prop.appendChild(IValID.V_X_SOFT);
+ prop.appendChild(IValID.V_SOFT);
+ prop.appendChild(IValID.V_MEDIUM);
+ prop.appendChild(IValID.V_LOUD);
+ prop.appendChild(IValID.V_X_LOUD);
+ prop.appendMediaGroup(IMediaGroupID.M_AURAL);
+
+ // white-space
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_WHITE_SPACE);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_PRE);
+ prop.appendChild(IValID.V_NOWRAP);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // widows
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_WIDOWS);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_INTEGER));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+ prop.appendMediaGroup(IMediaGroupID.M_PAGED);
+
+ // width
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_WIDTH);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // word-spacing
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_WORD_SPACING);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ // z-index
+ prop = PropCMProperty.getInstanceOf(PropCMProperty.P_Z_INDEX);
+ prop.appendChild(IValID.V_AUTO);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_INTEGER));
+ prop.appendMediaGroup(IMediaGroupID.M_VISUAL);
+
+ /** ******** font properties ********* */
+ // font-family
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_FONT_FAMILY);
+ prop.appendChild(PropCMString.getInstanceOf(PropCMString.VAL_FONT));
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_GENERIC_FAMILY));
+ prop.setMaxValueCount(-1);
+
+ // font-style
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_FONT_STYLE);
+ prop.appendChild(IValID.V_ITALIC);
+ prop.appendChild(IValID.V_OBLIQUE);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_ALL);
+ prop.setMaxValueCount(-1);
+
+ // font-variant
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_FONT_VARIANT);
+ prop.appendChild(IValID.V_SMALL_CAPS);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.setMaxValueCount(-1);
+
+ // font-weight
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_FONT_WEIGHT);
+ prop.appendChild(IValID.V_BOLD);
+ prop.appendChild(IValID.V_100);
+ prop.appendChild(IValID.V_200);
+ prop.appendChild(IValID.V_300);
+ prop.appendChild(IValID.V_400);
+ prop.appendChild(IValID.V_500);
+ prop.appendChild(IValID.V_600);
+ prop.appendChild(IValID.V_700);
+ prop.appendChild(IValID.V_800);
+ prop.appendChild(IValID.V_900);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_ALL);
+ prop.setMaxValueCount(-1);
+
+ // font-stretch
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_FONT_STRETCH);
+ prop.appendChild(IValID.V_NORMAL);
+ prop.appendChild(IValID.V_ULTRA_CONDENSED);
+ prop.appendChild(IValID.V_EXTRA_CONDENSED);
+ prop.appendChild(IValID.V_CONDENSED);
+ prop.appendChild(IValID.V_SEMI_CONDENSED);
+ prop.appendChild(IValID.V_SEMI_EXPANDED);
+ prop.appendChild(IValID.V_EXPANDED);
+ prop.appendChild(IValID.V_EXTRA_EXPANDED);
+ prop.appendChild(IValID.V_ULTRA_EXPANDED);
+ prop.appendChild(IValID.V_ALL);
+ prop.setMaxValueCount(-1);
+
+ // font-size
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_FONT_SIZE);
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_ABSOLUTE_SIZE));
+ prop.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_RELATIVE_SIZE));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ prop.appendChild(IValID.V_ALL);
+ prop.setMaxValueCount(-1);
+
+ // unicode-range
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_UNICODE_RANGE);
+ prop.appendChild(PropCMURange.getInstanceOf(PropCMURange.VAL_URANGE));
+ prop.setMaxValueCount(-1);
+
+ // units-per-em
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_UNITS_PER_EM);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // src
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_SRC);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_FORMAT));
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_LOCAL));
+ prop.setMaxValueCount(-1);
+
+ // panose-1
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_PANOSE_1);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_INTEGER));
+ prop.setMaxValueCount(10);
+
+ // stemv
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_STEMV);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // stemh
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_STEMH);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // slope
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_SLOPE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // cap-height
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_CAP_HEIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // x-height
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_X_HEIGHT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // ascent
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_ASCENT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // descent
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_DESCENT);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // widths
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_WIDTHS);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.appendChild(PropCMURange.getInstanceOf(PropCMURange.VAL_URANGE));
+ prop.setMaxValueCount(-1);
+
+ // bbox
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_BBOX);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+ prop.setMaxValueCount(4);
+ prop.setMaxValueCount(4);
+
+ // definition-src
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_DEFINITION_SRC);
+ prop.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_URI));
+
+ // baseline
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_BASELINE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // centerline
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_CENTERLINE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // mathline
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_MATHLINE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ // topline
+ prop = PropCMFontProperty.getInstanceOf(PropCMFontProperty.PF_TOPLINE);
+ prop.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_NUM));
+
+ /** ******** containers ********* */
+
+ // absolute-size
+ PropCMContainer cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_ABSOLUTE_SIZE);
+ cont.appendChild(IValID.V_XX_SMALL);
+ cont.appendChild(IValID.V_X_SMALL);
+ cont.appendChild(IValID.V_SMALL);
+ cont.appendChild(IValID.V_MEDIUM);
+ cont.appendChild(IValID.V_LARGE);
+ cont.appendChild(IValID.V_X_LARGE);
+ cont.appendChild(IValID.V_XX_LARGE);
+
+ // border-style
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_STYLE);
+ cont.appendChild(IValID.V_SOLID);
+ cont.appendChild(IValID.V_DASHED);
+ cont.appendChild(IValID.V_DOTTED);
+ cont.appendChild(IValID.V_DOUBLE);
+ cont.appendChild(IValID.V_GROOVE);
+ cont.appendChild(IValID.V_RIDGE);
+ cont.appendChild(IValID.V_INSET);
+ cont.appendChild(IValID.V_OUTSET);
+ cont.appendChild(IValID.V_HIDDEN);
+ cont.appendChild(IValID.V_NONE);
+
+ // border-width
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_BORDER_WIDTH);
+ cont.appendChild(IValID.V_THIN);
+ cont.appendChild(IValID.V_MEDIUM);
+ cont.appendChild(IValID.V_THICK);
+ cont.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+
+ // color
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_COLOR);
+ cont.appendChild(IValID.V_AQUA);
+ cont.appendChild(IValID.V_BLACK);
+ cont.appendChild(IValID.V_BLUE);
+ cont.appendChild(IValID.V_FUCHSIA);
+ cont.appendChild(IValID.V_GRAY);
+ cont.appendChild(IValID.V_GREEN);
+ cont.appendChild(IValID.V_LIME);
+ cont.appendChild(IValID.V_MAROON);
+ cont.appendChild(IValID.V_NAVY);
+ cont.appendChild(IValID.V_OLIVE);
+ cont.appendChild(IValID.V_PURPLE);
+ cont.appendChild(IValID.V_RED);
+ cont.appendChild(IValID.V_SILVER);
+ cont.appendChild(IValID.V_TEAL);
+ cont.appendChild(IValID.V_WHITE);
+ cont.appendChild(IValID.V_YELLOW);
+ cont.appendChild(PropCMContainer.getContInstanceOf(PropCMContainer.VAL_SYSTEM_COLOR));
+ cont.appendChild(PropCMFunction.getInstanceOf(PropCMFunction.VAL_RGB));
+ cont.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_HASH));
+
+ // system color
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_SYSTEM_COLOR);
+ cont.appendChild(IValID.V_ACTIVEBORDER);
+ cont.appendChild(IValID.V_ACTIVECAPTION);
+ cont.appendChild(IValID.V_APPWORKSPACE);
+ cont.appendChild(IValID.V_BACKGROUND);
+ cont.appendChild(IValID.V_BUTTONFACE);
+ cont.appendChild(IValID.V_BUTTONHIGHLIGHT);
+ cont.appendChild(IValID.V_BUTTONSHADOW);
+ cont.appendChild(IValID.V_BUTTONTEXT);
+ cont.appendChild(IValID.V_CAPTIONTEXT);
+ cont.appendChild(IValID.V_GRAYTEXT);
+ cont.appendChild(IValID.V_HIGHLIGHT);
+ cont.appendChild(IValID.V_HIGHLIGHTTEXT);
+ cont.appendChild(IValID.V_INACTIVEBORDER);
+ cont.appendChild(IValID.V_INACTIVECAPTION);
+ cont.appendChild(IValID.V_INACTIVECAPTIONTEXT);
+ cont.appendChild(IValID.V_INFOBACKGROUND);
+ cont.appendChild(IValID.V_INFOTEXT);
+ cont.appendChild(IValID.V_MENU);
+ cont.appendChild(IValID.V_MENUTEXT);
+ cont.appendChild(IValID.V_SCROLLBAR);
+ cont.appendChild(IValID.V_THREEDDARKSHADOW);
+ cont.appendChild(IValID.V_THREEDFACE);
+ cont.appendChild(IValID.V_THREEDHIGHLIGHT);
+ cont.appendChild(IValID.V_THREEDLIGHTSHADOW);
+ cont.appendChild(IValID.V_THREEDSHADOW);
+ cont.appendChild(IValID.V_WINDOW);
+ cont.appendChild(IValID.V_WINDOWFRAME);
+ cont.appendChild(IValID.V_WINDOWTEXT);
+
+ // generic-family
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_GENERIC_FAMILY);
+ cont.appendChild(IValID.V_SERIF);
+ cont.appendChild(IValID.V_SANS_SERIF);
+ cont.appendChild(IValID.V_CURSIVE);
+ cont.appendChild(IValID.V_FANTASY);
+ cont.appendChild(IValID.V_MONOSPACE);
+
+ // generic-voice
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_GENERIC_VOICE);
+ cont.appendChild(IValID.V_MALE);
+ cont.appendChild(IValID.V_FEMALE);
+ cont.appendChild(IValID.V_CHILD);
+
+ // margin-width
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_MARGIN_WIDTH);
+ cont.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ cont.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+ cont.appendChild(IValID.V_AUTO);
+
+ // padding-width
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_PADDING_WIDTH);
+ cont.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_LENGTH));
+ cont.appendChild(PropCMNumber.getInstanceOf(PropCMNumber.VAL_PERCENTAGE));
+
+ // relative-size
+ cont = PropCMContainer.getContInstanceOf(PropCMContainer.VAL_RELATIVE_SIZE);
+ cont.appendChild(IValID.V_SMALLER);
+ cont.appendChild(IValID.V_LARGER);
+
+ LOADING = 2;
+ }
+
+ /**
+ *
+ */
+ protected static boolean isLoading() {
+ return LOADING == 1;
+ }
+
+ /**
+ *
+ */
+ protected static boolean isNeedInitialize() {
+ return LOADING == 0;
+ }
+
+ /**
+ *
+ */
+ public String toString() {
+ return getName();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNumber.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNumber.java
new file mode 100644
index 0000000000..2d13122c4f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMNumber.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.w3c.dom.css.CSSPrimitiveValue;
+
+
+/**
+ *
+ */
+public class PropCMNumber extends PropCMNode {
+
+ private static java.util.Hashtable instances = null;
+ public final static java.lang.String VAL_ANGLE = "angle";//$NON-NLS-1$
+ public final static java.lang.String VAL_FREQUENCY = "frequency";//$NON-NLS-1$
+ public final static java.lang.String VAL_INTEGER = "integer";//$NON-NLS-1$
+ public final static java.lang.String VAL_LENGTH = "length";//$NON-NLS-1$
+ public final static java.lang.String VAL_PERCENTAGE = "percentage";//$NON-NLS-1$
+ public final static java.lang.String VAL_TIME = "time";//$NON-NLS-1$
+ public final static java.lang.String VAL_HASH = "hash"; // for
+ // hex-color//$NON-NLS-1$
+ public final static java.lang.String VAL_NUM = "number";//$NON-NLS-1$
+ public final static String DIM_CM = "cm";//$NON-NLS-1$
+ public final static String DIM_DEG = "deg";//$NON-NLS-1$
+ public final static String DIM_EMS = "em";//$NON-NLS-1$
+ public final static String DIM_EXS = "ex";//$NON-NLS-1$
+ public final static String DIM_GRAD = "grad";//$NON-NLS-1$
+ public final static String DIM_HASH = "#";//$NON-NLS-1$
+ public final static String DIM_HZ = "Hz";//$NON-NLS-1$
+ public final static String DIM_IN = "in";//$NON-NLS-1$
+ public final static String DIM_INTEGER = "INTEGER";//$NON-NLS-1$
+ public final static String DIM_KHZ = "kHz";//$NON-NLS-1$
+ public final static String DIM_MM = "mm";//$NON-NLS-1$
+ public final static String DIM_MS = "ms";//$NON-NLS-1$
+ public final static String DIM_NUMBER = "NUMBER";//$NON-NLS-1$
+ public final static String DIM_PC = "pc";//$NON-NLS-1$
+ public final static String DIM_PERCENTAGE = "%";//$NON-NLS-1$
+ public final static String DIM_PT = "pt";//$NON-NLS-1$
+ public final static String DIM_PX = "px";//$NON-NLS-1$
+ public final static String DIM_RAD = "rad";//$NON-NLS-1$
+ public final static String DIM_S = "s";//$NON-NLS-1$
+ private java.util.Vector fDims = new Vector();
+
+ /**
+ *
+ */
+ protected PropCMNumber(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ public static String getDimension(short primitiveType) {
+ switch (primitiveType) {
+ case CSSPrimitiveValue.CSS_CM :
+ return DIM_CM;
+ case CSSPrimitiveValue.CSS_DEG :
+ return DIM_DEG;
+ case CSSPrimitiveValue.CSS_EMS :
+ return DIM_EMS;
+ case CSSPrimitiveValue.CSS_EXS :
+ return DIM_EXS;
+ case CSSPrimitiveValue.CSS_GRAD :
+ return DIM_GRAD;
+ case ICSSPrimitiveValue.CSS_HASH :
+ return DIM_HASH; // prefix dimension ....
+ case CSSPrimitiveValue.CSS_HZ :
+ return DIM_HZ;
+ case CSSPrimitiveValue.CSS_IN :
+ return DIM_IN;
+ case ICSSPrimitiveValue.CSS_INTEGER :
+ return "";//$NON-NLS-1$
+ case CSSPrimitiveValue.CSS_KHZ :
+ return DIM_KHZ;
+ case CSSPrimitiveValue.CSS_MM :
+ return DIM_MM;
+ case CSSPrimitiveValue.CSS_MS :
+ return DIM_MS;
+ case CSSPrimitiveValue.CSS_NUMBER :
+ return "";//$NON-NLS-1$
+ case CSSPrimitiveValue.CSS_PC :
+ return DIM_PC;
+ case CSSPrimitiveValue.CSS_PERCENTAGE :
+ return DIM_PERCENTAGE;
+ case CSSPrimitiveValue.CSS_PT :
+ return DIM_PT;
+ case CSSPrimitiveValue.CSS_PX :
+ return DIM_PX;
+ case CSSPrimitiveValue.CSS_RAD :
+ return DIM_RAD;
+ case CSSPrimitiveValue.CSS_S :
+ return DIM_S;
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ */
+ public Set getDimensions() {
+ HashSet vals = new HashSet();
+ Iterator it = fDims.iterator();
+ while (it.hasNext()) {
+ vals.add(it.next());
+ }
+
+ return vals;
+ }
+
+ /**
+ *
+ */
+ void getIdentifiers(Set indents) {
+ }
+
+ /**
+ *
+ */
+ static public PropCMNumber getInstanceOf(String name) {
+ if (name == null)
+ return null;
+
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(20);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMNumber) node;
+
+ // register
+ if (PropCMNode.isLoading()) {
+ node = new PropCMNumber(name);
+ instances.put(name, node);
+ }
+
+ return (PropCMNumber) node;
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_NUMBER;
+ }
+
+ /**
+ *
+ */
+ void getValues(Collection values) {
+ if (values != null && !values.contains(this))
+ values.add(this);
+ }
+
+ /**
+ *
+ */
+ static void initNumberCMDim() {
+ PropCMNumber num = getInstanceOf(VAL_ANGLE);
+ num.fDims.add(DIM_DEG);
+ num.fDims.add(DIM_GRAD);
+ num.fDims.add(DIM_RAD);
+
+ num = getInstanceOf(VAL_FREQUENCY);
+ num.fDims.add(DIM_HZ);
+ num.fDims.add(DIM_KHZ);
+
+ num = getInstanceOf(VAL_HASH);
+ num.fDims.add(DIM_HASH);
+
+ // num = getInstanceOf(VAL_INTEGER);
+ // num.fDims.add(DIM_INTEGER);
+
+ num = getInstanceOf(VAL_LENGTH);
+ num.fDims.add(DIM_CM);
+ num.fDims.add(DIM_EMS);
+ num.fDims.add(DIM_EXS);
+ num.fDims.add(DIM_IN);
+ num.fDims.add(DIM_MM);
+ num.fDims.add(DIM_PC);
+ num.fDims.add(DIM_PT);
+ num.fDims.add(DIM_PX);
+
+ // num = getInstanceOf(VAL_NUMBER);
+ // num.fDims.add(DIM_NUMBER);
+
+ num = getInstanceOf(VAL_PERCENTAGE);
+ num.fDims.add(DIM_PERCENTAGE);
+
+ num = getInstanceOf(VAL_TIME);
+ num.fDims.add(DIM_MS);
+ num.fDims.add(DIM_S);
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMProperty.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMProperty.java
new file mode 100644
index 0000000000..bbab38f642
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMProperty.java
@@ -0,0 +1,417 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ *
+ */
+public class PropCMProperty extends PropCMContainer {
+
+ // static fields
+ private static java.util.Hashtable instances = null;
+ private static java.util.Hashtable cachedIdMap = null;
+ public final static String P_AZIMUTH = "azimuth";//$NON-NLS-1$
+ public final static String P_BG = "background";//$NON-NLS-1$
+ public final static String P_BG_ATTACHMENT = "background-attachment";//$NON-NLS-1$
+ public final static String P_BG_COLOR = "background-color";//$NON-NLS-1$
+ public final static String P_BG_IMAGE = "background-image";//$NON-NLS-1$
+ public final static String P_BG_POSITION = "background-position";//$NON-NLS-1$
+ public final static String P_BG_REPEAT = "background-repeat";//$NON-NLS-1$
+ public final static String P_BORDER = "border";//$NON-NLS-1$
+ public final static String P_BORDER_COLLAPSE = "border-collapse";//$NON-NLS-1$
+ public final static String P_BORDER_COLOR = "border-color";//$NON-NLS-1$
+ public final static String P_BORDER_SPACING = "border-spacing";//$NON-NLS-1$
+ public final static String P_BORDER_STYLE = "border-style";//$NON-NLS-1$
+ public final static String P_BORDER_TOP = "border-top";//$NON-NLS-1$
+ public final static String P_BORDER_RIGHT = "border-right";//$NON-NLS-1$
+ public final static String P_BORDER_BOTTOM = "border-bottom";//$NON-NLS-1$
+ public final static String P_BORDER_LEFT = "border-left";//$NON-NLS-1$
+ public final static String P_BORDER_TOP_COLOR = "border-top-color";//$NON-NLS-1$
+ public final static String P_BORDER_RIGHT_COLOR = "border-right-color";//$NON-NLS-1$
+ public final static String P_BORDER_BOTTOM_COLOR = "border-bottom-color";//$NON-NLS-1$
+ public final static String P_BORDER_LEFT_COLOR = "border-left-color";//$NON-NLS-1$
+ public final static String P_BORDER_TOP_STYLE = "border-top-style";//$NON-NLS-1$
+ public final static String P_BORDER_RIGHT_STYLE = "border-right-style";//$NON-NLS-1$
+ public final static String P_BORDER_BOTTOM_STYLE = "border-bottom-style";//$NON-NLS-1$
+ public final static String P_BORDER_LEFT_STYLE = "border-left-style";//$NON-NLS-1$
+ public final static String P_BORDER_TOP_WIDTH = "border-top-width";//$NON-NLS-1$
+ public final static String P_BORDER_RIGHT_WIDTH = "border-right-width";//$NON-NLS-1$
+ public final static String P_BORDER_BOTTOM_WIDTH = "border-bottom-width";//$NON-NLS-1$
+ public final static String P_BORDER_LEFT_WIDTH = "border-left-width";//$NON-NLS-1$
+ public final static String P_BORDER_WIDTH = "border-width";//$NON-NLS-1$
+ public final static String P_BOTTOM = "bottom";//$NON-NLS-1$
+ public final static String P_CAPTION_SIDE = "caption-side";//$NON-NLS-1$
+ public final static String P_CLEAR = "clear";//$NON-NLS-1$
+ public final static String P_CLIP = "clip";//$NON-NLS-1$
+ public final static String P_COLOR = "color";//$NON-NLS-1$
+ public final static String P_CONTENT = "content";//$NON-NLS-1$
+ public final static String P_COUNTER_INCREMENT = "counter-increment";//$NON-NLS-1$
+ public final static String P_COUNTER_RESET = "counter-reset";//$NON-NLS-1$
+ public final static String P_CUE = "cue";//$NON-NLS-1$
+ public final static String P_CUE_AFTER = "cue-after";//$NON-NLS-1$
+ public final static String P_CUE_BEFORE = "cue-before";//$NON-NLS-1$
+ public final static String P_CURSOR = "cursor";//$NON-NLS-1$
+ public final static String P_DIRECTION = "direction";//$NON-NLS-1$
+ public final static String P_DISPLAY = "display";//$NON-NLS-1$
+ public final static String P_ELEVATION = "elevation";//$NON-NLS-1$
+ public final static String P_EMPTY_CELLS = "empty-cells";//$NON-NLS-1$
+ public final static String P_FLOAT = "float";//$NON-NLS-1$
+ public final static String P_FONT = "font";//$NON-NLS-1$
+ public final static String P_FONT_FAMILY = "font-family";//$NON-NLS-1$
+ public final static String P_FONT_SIZE = "font-size";//$NON-NLS-1$
+ public final static String P_FONT_SIZE_ADJUST = "font-size-adjust";//$NON-NLS-1$
+ public final static String P_FONT_STRETCH = "font-stretch";//$NON-NLS-1$
+ public final static String P_FONT_STYLE = "font-style";//$NON-NLS-1$
+ public final static String P_FONT_VARIANT = "font-variant";//$NON-NLS-1$
+ public final static String P_FONT_WEIGHT = "font-weight";//$NON-NLS-1$
+ public final static String P_HEIGHT = "height";//$NON-NLS-1$
+ public final static String P_LEFT = "left";//$NON-NLS-1$
+ public final static String P_LETTER_SPACING = "letter-spacing";//$NON-NLS-1$
+ public final static String P_LINE_HEIGHT = "line-height";//$NON-NLS-1$
+ public final static String P_LIST_STYLE = "list-style";//$NON-NLS-1$
+ public final static String P_LIST_STYLE_IMAGE = "list-style-image";//$NON-NLS-1$
+ public final static String P_LIST_STYLE_POSITION = "list-style-position";//$NON-NLS-1$
+ public final static String P_LIST_STYLE_TYPE = "list-style-type";//$NON-NLS-1$
+ public final static String P_MARGIN = "margin";//$NON-NLS-1$
+ public final static String P_MARGIN_TOP = "margin-top";//$NON-NLS-1$
+ public final static String P_MARGIN_RIGHT = "margin-right";//$NON-NLS-1$
+ public final static String P_MARGIN_BOTTOM = "margin-bottom";//$NON-NLS-1$
+ public final static String P_MARGIN_LEFT = "margin-left";//$NON-NLS-1$
+ public final static String P_MARKER_OFFSET = "marker-offset";//$NON-NLS-1$
+ public final static String P_MARKS = "marks";//$NON-NLS-1$
+ public final static String P_MAX_HEIGHT = "max-height";//$NON-NLS-1$
+ public final static String P_MAX_WIDTH = "max-width";//$NON-NLS-1$
+ public final static String P_MIN_HEIGHT = "min-height";//$NON-NLS-1$
+ public final static String P_MIN_WIDTH = "min-width";//$NON-NLS-1$
+ public final static String P_ORPHANS = "orphans";//$NON-NLS-1$
+ public final static String P_OUTLINE = "outline";//$NON-NLS-1$
+ public final static String P_OUTLINE_COLOR = "outline-color";//$NON-NLS-1$
+ public final static String P_OUTLINE_STYLE = "outline-style";//$NON-NLS-1$
+ public final static String P_OUTLINE_WIDTH = "outline-width";//$NON-NLS-1$
+ public final static String P_OVERFLOW = "overflow";//$NON-NLS-1$
+ public final static String P_PADDING = "padding";//$NON-NLS-1$
+ public final static String P_PADDING_TOP = "padding-top";//$NON-NLS-1$
+ public final static String P_PADDING_RIGHT = "padding-right";//$NON-NLS-1$
+ public final static String P_PADDING_BOTTOM = "padding-bottom";//$NON-NLS-1$
+ public final static String P_PADDING_LEFT = "padding-left";//$NON-NLS-1$
+ public final static String P_PAGE = "page";//$NON-NLS-1$
+ public final static String P_PAGE_BREAK_AFTER = "page-break-after";//$NON-NLS-1$
+ public final static String P_PAGE_BREAK_BEFORE = "page-break-before";//$NON-NLS-1$
+ public final static String P_PAGE_BREAK_INSIDE = "page-break-inside";//$NON-NLS-1$
+ public final static String P_PAUSE = "pause";//$NON-NLS-1$
+ public final static String P_PAUSE_AFTER = "pause-after";//$NON-NLS-1$
+ public final static String P_PAUSE_BEFORE = "pause-before";//$NON-NLS-1$
+ public final static String P_PITCH = "pitch";//$NON-NLS-1$
+ public final static String P_PITCH_RANGE = "pitch-range";//$NON-NLS-1$
+ public final static String P_PLAY_DURING = "play-during";//$NON-NLS-1$
+ public final static String P_POSITION = "position";//$NON-NLS-1$
+ public final static String P_QUOTES = "quotes";//$NON-NLS-1$
+ public final static String P_RICHNESS = "richness";//$NON-NLS-1$
+ public final static String P_RIGHT = "right";//$NON-NLS-1$
+ public final static String P_SIZE = "size";//$NON-NLS-1$
+ public final static String P_SPEAK = "speak";//$NON-NLS-1$
+ public final static String P_SPEAK_HEADER = "speak-header";//$NON-NLS-1$
+ public final static String P_SPEAK_NUMERAL = "speak-numeral";//$NON-NLS-1$
+ public final static String P_SPEAK_PUNCTUATION = "speak-punctuation";//$NON-NLS-1$
+ public final static String P_SPEECH_RATE = "speech-rate";//$NON-NLS-1$
+ public final static String P_STRESS = "stress";//$NON-NLS-1$
+ public final static String P_TABLE_LAYOUT = "table-layout";//$NON-NLS-1$
+ public final static String P_TEXT_ALIGN = "text-align";//$NON-NLS-1$
+ public final static String P_TEXT_DECORATION = "text-decoration";//$NON-NLS-1$
+ public final static String P_TEXT_INDENT = "text-indent";//$NON-NLS-1$
+ public final static String P_TEXT_SHADOW = "text-shadow";//$NON-NLS-1$
+ public final static String P_TEXT_TRANSFORM = "text-transform";//$NON-NLS-1$
+ public final static String P_TOP = "top";//$NON-NLS-1$
+ public final static String P_UNICODE_BIDI = "unicode-bidi";//$NON-NLS-1$
+ public final static String P_VERTICAL_ALIGN = "vertical-align";//$NON-NLS-1$
+ public final static String P_VISIBILITY = "visibility";//$NON-NLS-1$
+ public final static String P_VOICE_FAMILY = "voice-family";//$NON-NLS-1$
+ public final static String P_VOLUME = "volume";//$NON-NLS-1$
+ public final static String P_WHITE_SPACE = "white-space";//$NON-NLS-1$
+ public final static String P_WIDOWS = "widows";//$NON-NLS-1$
+ public final static String P_WIDTH = "width";//$NON-NLS-1$
+ public final static String P_WORD_SPACING = "word-spacing";//$NON-NLS-1$
+ public final static String P_Z_INDEX = "z-index";//$NON-NLS-1$
+ // instance fields
+ private int fMinValueCount = 1;
+ private int fMaxValueCount = 1;
+ private Object[] mediaGroups;
+ protected List containers;
+
+ /**
+ *
+ */
+ protected PropCMProperty(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ Object appendChild(Object node) {
+ Object ret = super.appendChild(node);
+ if (node instanceof PropCMProperty) {
+ // register shorthand container
+ PropCMProperty cm = (PropCMProperty) node;
+ if (cm.containers == null)
+ cm.containers = new Vector();
+ if (!cm.containers.contains(this))
+ cm.containers.add(this);
+ }
+ return ret;
+ }
+
+ /**
+ *
+ */
+ void appendMediaGroup(Object mg) {
+ if (mediaGroups == null)
+ mediaGroups = new Object[1];
+ else {
+ Object[] oldMediaGroups = mediaGroups;
+ mediaGroups = new Object[oldMediaGroups.length + 1];
+ System.arraycopy(oldMediaGroups, 0, mediaGroups, 0, oldMediaGroups.length);
+ }
+ mediaGroups[mediaGroups.length - 1] = mg;
+ }
+
+ /**
+ *
+ */
+ public static PropCMProperty getInstanceOf(String name) {
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(200);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMProperty) node;
+
+ // register
+ if (PropCMNode.isLoading()) {
+ node = new PropCMProperty(name);
+ instances.put(name, node);
+ }
+
+ return (PropCMProperty) node;
+ }
+
+ /**
+ *
+ */
+ public int getMaxValueCount() {
+ return fMaxValueCount;
+ }
+
+ /**
+ *
+ */
+ public List getMediaGroups() {
+ if (mediaGroups != null)
+ return Arrays.asList(mediaGroups);
+ else
+ return new ArrayList();
+ }
+
+ /**
+ *
+ */
+ public int getMinValueCount() {
+ return fMinValueCount;
+ }
+
+ /**
+ *
+ */
+ public static Enumeration getNameEnum() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return instances.keys();
+ }
+
+ /**
+ *
+ */
+ public static Enumeration getPropertyEnum() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return instances.elements();
+ }
+
+ /**
+ *
+ */
+ public int getShorthandContainerCount() {
+ return (containers == null) ? 0 : containers.size();
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_PROPERTY;
+ }
+
+ /**
+ *
+ */
+ public boolean isShorthand() {
+ int nChild = getNumChild();
+ for (int i = 0; i < nChild; i++) {
+ Object obj = getChildAt(i);
+ if (obj instanceof PropCMProperty && !(obj instanceof PropCMSubProperty))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ public static Vector names() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return new Vector(instances.keySet());
+ }
+
+ /**
+ *
+ */
+ public static List names(Object mediaGroup) {
+ if (mediaGroup == null)
+ return names();
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ Vector properties = new Vector();
+
+ Iterator it = instances.values().iterator();
+ while (it.hasNext()) {
+ PropCMProperty prop = (PropCMProperty) it.next();
+ if (prop.getMediaGroups().contains(mediaGroup))
+ properties.add(prop.getName());
+ }
+
+ return properties;
+ }
+
+ /**
+ * If identifier is null, get all properties
+ */
+ public static Vector propertiesFor(String identifier, boolean shorthands) {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // if identifier is null, get all properties
+ if (identifier == null)
+ return new Vector(instances.values());
+
+ if (cachedIdMap == null) {
+ // start cacheing
+ cachedIdMap = new Hashtable();
+ }
+ else {
+ // search cached
+ Object ret = cachedIdMap.get(identifier + String.valueOf(shorthands));
+ if (ret != null)
+ return new Vector((Collection) ret);
+ }
+
+ // create
+ Enumeration propertyEnum = getPropertyEnum();
+ HashSet set = new HashSet();
+ while (propertyEnum.hasMoreElements()) {
+ PropCMProperty prop = (PropCMProperty) propertyEnum.nextElement();
+ if (!shorthands && prop.isShorthand())
+ continue;
+ if (prop.canHave(identifier))
+ set.add(prop);
+ }
+
+ // cache
+ cachedIdMap.put(identifier + String.valueOf(shorthands), set);
+
+ return new Vector(set);
+ }
+
+ /**
+ *
+ */
+ protected void setMaxValueCount(int newMaxValueCount) {
+ fMaxValueCount = newMaxValueCount;
+ }
+
+ /**
+ *
+ */
+ protected void setMinValueCount(int newMinValueCount) {
+ fMinValueCount = newMinValueCount;
+ }
+
+ /**
+ *
+ */
+ public PropCMProperty shorthandContainerAt(int i) {
+ if (containers == null)
+ return null;
+ if (i < 0 || containers.size() <= i)
+ return null;
+ return (PropCMProperty) containers.get(i);
+ }
+
+ /**
+ *
+ */
+ public Iterator shorthandContainerIterator() {
+ if (containers == null) {
+ return new Iterator() {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ };
+ }
+ else
+ return containers.iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMString.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMString.java
new file mode 100644
index 0000000000..a60b57844e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMString.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Set;
+
+/**
+ *
+ */
+public class PropCMString extends PropCMNode {
+
+ private static java.util.Hashtable instances = null;
+ public final static java.lang.String VAL_FONT = "font";//$NON-NLS-1$
+ public final static java.lang.String VAL_COUNTER_ID = "counterId";//$NON-NLS-1$
+ public final static java.lang.String VAL_PAGE_ID = "pageId";//$NON-NLS-1$
+ public final static java.lang.String VAL_VOICE = "voice";//$NON-NLS-1$
+ public final static java.lang.String VAL_ANY = "any"; // reserved
+ // name//$NON-NLS-1$
+
+ /**
+ *
+ */
+ protected PropCMString(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ void getIdentifiers(Set indents) {
+ }
+
+ /**
+ *
+ */
+ static public PropCMString getInstanceOf(String name) {
+ if (name == null)
+ return null;
+
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(10);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMString) node;
+
+ // register
+ node = new PropCMString(name);
+ instances.put(name, node);
+
+ return (PropCMString) node;
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_STRING;
+ }
+
+ /**
+ *
+ */
+ void getValues(Collection values) {
+ if (values != null && !values.contains(this))
+ values.add(this);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMSubProperty.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMSubProperty.java
new file mode 100644
index 0000000000..81ebb3733d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMSubProperty.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ *
+ */
+public class PropCMSubProperty extends PropCMProperty {
+
+ // static fields
+ private static java.util.Hashtable instances = null;
+ public final static String PSUB_BG_POSITION_X = "background-positionH";//$NON-NLS-1$
+ public final static String PSUB_BG_POSITION_Y = "background-positionV";//$NON-NLS-1$
+ public final static String PSUB_CLIP_TOP = "clipTop";//$NON-NLS-1$
+ public final static String PSUB_CLIP_RIGHT = "clipRight";//$NON-NLS-1$
+ public final static String PSUB_CLIP_BOTTOM = "clipBottom";//$NON-NLS-1$
+ public final static String PSUB_CLIP_LEFT = "clipLeft";//$NON-NLS-1$
+
+ /**
+ *
+ */
+ protected PropCMSubProperty(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ public PropCMProperty getContainer() {
+ return shorthandContainerAt(0);
+ }
+
+ /**
+ *
+ */
+ public static PropCMProperty getInstanceOf(String name) {
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(10);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMProperty) node;
+
+ // register
+ if (PropCMNode.isLoading()) {
+ node = new PropCMSubProperty(name);
+ instances.put(name, node);
+ }
+
+ return (PropCMProperty) node;
+ }
+
+ /**
+ *
+ */
+ public static Enumeration getNameEnum() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return instances.keys();
+ }
+
+ /**
+ *
+ */
+ public static Enumeration getPropertyEnum() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return instances.elements();
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_SUBPROPERTY;
+ }
+
+ /**
+ *
+ */
+ public static Vector names() {
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ return new Vector(instances.keySet());
+ }
+
+ /**
+ *
+ */
+ public void setContainer(PropCMProperty prop) {
+ if (containers == null)
+ containers = new Vector();
+ containers.clear();
+ containers.add(prop);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMURange.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMURange.java
new file mode 100644
index 0000000000..3375715d5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMURange.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Set;
+
+/**
+ *
+ */
+public class PropCMURange extends PropCMNode {
+
+ private static java.util.Hashtable instances = null;
+ public final static String VAL_URANGE = "urange";//$NON-NLS-1$
+
+ /**
+ *
+ */
+ protected PropCMURange(String name) {
+ super(name);
+ }
+
+ /**
+ *
+ */
+ void getIdentifiers(Set indents) {
+ }
+
+ /**
+ *
+ */
+ public static PropCMURange getInstanceOf(String name) {
+ if (name == null)
+ return null;
+
+ // initialize
+ if (instances == null)
+ instances = new Hashtable(10);
+
+ // Initialize of DB
+ if (isNeedInitialize())
+ PropCMNode.initPropertyCM();
+
+ // query
+ Object node = instances.get(name);
+ if (node != null)
+ return (PropCMURange) node;
+
+ // register
+ node = new PropCMURange(name);
+ instances.put(name, node);
+
+ return (PropCMURange) node;
+ }
+
+ /**
+ *
+ */
+ public short getType() {
+ return VAL_UNICODE_RANGE;
+ }
+
+ /**
+ *
+ */
+ void getValues(Collection values) {
+ if (values != null && !values.contains(this))
+ values.add(this);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMUtil.java
new file mode 100644
index 0000000000..816ba377c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/contentmodel/PropCMUtil.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public class PropCMUtil {
+
+ /**
+ *
+ */
+ public static void minus(Collection src, Collection ref) {
+ Iterator it = ref.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (src.contains(obj))
+ src.remove(obj);
+ }
+ return;
+ }
+
+ /**
+ *
+ */
+ public static void plus(Collection src, Collection ref) {
+ Iterator it = ref.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (!src.contains(obj))
+ src.add(obj);
+ }
+ return;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/AbstractCSSNodeList.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/AbstractCSSNodeList.java
new file mode 100644
index 0000000000..eb10e00def
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/AbstractCSSNodeList.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+
+
+/**
+ *
+ */
+abstract class AbstractCSSNodeList {
+
+ protected Vector nodes = null;
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param ndoe
+ * com.ibm.sed.css.interfaces.CSSNode
+ */
+ ICSSNode appendNode(ICSSNode node) {
+ if (node == null)
+ return null;
+ if (this.nodes == null)
+ this.nodes = new Vector();
+ this.nodes.addElement(node);
+ return node;
+ }
+
+ /**
+ * @return int
+ */
+ public int getLength() {
+ if (this.nodes == null)
+ return 0;
+ return this.nodes.size();
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param index
+ * int
+ */
+ protected ICSSNode itemImpl(int index) {
+ if (this.nodes == null)
+ return null;
+ if (index < 0 || index >= this.nodes.size())
+ return null;
+ return (ICSSNode) this.nodes.elementAt(index);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param index
+ * com.ibm.sed.css.interfaces.CSSNode
+ */
+ ICSSNode removeNode(int index) {
+ if (this.nodes == null)
+ return null; // no node
+ if (index < 0 || index >= this.nodes.size())
+ return null; // invalid parameter
+
+ ICSSNode removed = (ICSSNode) this.nodes.elementAt(index);
+ this.nodes.removeElementAt(index);
+ return removed;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSAttrImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSAttrImpl.java
new file mode 100644
index 0000000000..92d03de02e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSAttrImpl.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSNamedNodeMap;
+import org.eclipse.wst.css.core.document.ICSSNode;
+
+/**
+ *
+ */
+class CSSAttrImpl extends CSSRegionContainer implements ICSSAttr {
+
+ private String fName = null;
+ private String fValue = null;
+ private CSSNodeImpl ownerCSSNode = null;
+
+ /**
+ * CSSAttrImpl constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSRegionContainer
+ */
+ CSSAttrImpl(CSSAttrImpl that) {
+ super(that);
+ this.fName = that.fName;
+ this.setValue(that.fValue);
+ }
+
+ /**
+ * CSSAttr constructor comment.
+ */
+ CSSAttrImpl(String name) {
+ super();
+ this.fName = name;
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ return new CSSAttrImpl(this);
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNamedNodeMap
+ */
+ public ICSSNamedNodeMap getAttributes() {
+ return null;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public java.lang.String getName() {
+ return fName;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return ATTR_NODE;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ public ICSSNode getOwnerCSSNode() {
+ return ownerCSSNode;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public java.lang.String getValue() {
+ return fValue;
+ }
+
+ /**
+ * @return boolean
+ * @param name
+ * java.lang.String
+ */
+ protected boolean matchName(String name) {
+ if (name == null)
+ return /* (this.name == null) */false;
+ if (this.fName == null)
+ return false;
+ return this.fName.equals(name);
+ }
+
+ /**
+ *
+ */
+ protected void notifyValueChanged(String oldValue) {
+ if (this.ownerCSSNode == null)
+ return;
+
+ // for model
+ ICSSDocument doc = ownerCSSNode.getContainerDocument();
+ if (doc == null)
+ return;
+ CSSModelImpl model = (CSSModelImpl) doc.getModel();
+ if (model == null)
+ return;
+ model.valueChanged(this, oldValue);
+
+ // for adapters
+ String value = getValue();
+ this.ownerCSSNode.notify(CHANGE, this, oldValue, value, this.ownerCSSNode.getStartOffset());
+ }
+
+ /**
+ * @param newName
+ * java.lang.String
+ */
+ protected void setName(java.lang.String newName) {
+ fName = newName;
+ }
+
+ /**
+ * @param newOwnerCSSNode
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ protected void setOwnerCSSNode(CSSNodeImpl newOwnerCSSNode) {
+ ownerCSSNode = newOwnerCSSNode;
+ }
+
+ /**
+ * @param newValue
+ * java.lang.String
+ */
+ public void setValue(java.lang.String newValue) {
+ String oldValue = fValue;
+ fValue = newValue;
+
+ notifyValueChanged(oldValue);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSCharsetRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSCharsetRuleImpl.java
new file mode 100644
index 0000000000..8f9d1caa54
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSCharsetRuleImpl.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.w3c.dom.DOMException;
+
+
+/**
+ *
+ */
+class CSSCharsetRuleImpl extends CSSRuleImpl implements ICSSCharsetRule {
+
+ /**
+ *
+ */
+ CSSCharsetRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSCharsetRuleImpl
+ */
+ CSSCharsetRuleImpl(CSSCharsetRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSCharsetRuleImpl cloned = new CSSCharsetRuleImpl(this);
+
+ return cloned;
+ }
+
+ /**
+ * The encoding information used in this <code>@charset</code> rule.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified encoding value has a
+ * syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding
+ * rule is readonly.
+ */
+ public String getEncoding() {
+ return CSSUtil.extractStringContents(getAttribute(ENCODING));
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return CHARSETRULE_NODE;
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return CHARSET_RULE;
+ }
+
+ /**
+ *
+ */
+ public void setEncoding(String encoding) throws org.w3c.dom.DOMException {
+ // pa_TODO css pref
+ // String quote =
+ // com.ibm.sse.editor.css.preferences.CSSPreferenceHelper.getInstance().getQuoteString((ICSSModel)getOwnerDocument().getModel());
+ String quote = CSSPreferenceHelper.getInstance().getQuoteString(null);
+ String enc = CSSUtil.extractStringContents(encoding);
+ quote = CSSUtil.detectQuote(enc, quote);
+ setAttribute(ENCODING, quote + enc + quote);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDeclarationItemParser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDeclarationItemParser.java
new file mode 100644
index 0000000000..aa99414765
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDeclarationItemParser.java
@@ -0,0 +1,1077 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICounter;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.internal.text.TextRegionListImpl;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.w3c.dom.css.CSSPrimitiveValue;
+
+
+/**
+ *
+ */
+class CSSDeclarationItemParser {
+ /**
+ *
+ */
+ final class FloatInfo {
+ /**
+ *
+ */
+ FloatInfo(String text) {
+ parse(text);
+ }
+
+ /**
+ *
+ */
+ void parse(String text) {
+ StringBuffer bufValue = new StringBuffer();
+ StringBuffer bufIdent = new StringBuffer();
+ boolean bNum = true;
+ int len = text.length();
+ for (int i = 0; i < len; i++) {
+ char c = text.charAt(i);
+ if (bNum) {
+ if ('0' <= c && c <= '9' || c == '.' || c == '+' || c == '-') {
+ bufValue.append(c);
+ }
+ else {
+ bufIdent.append(c);
+ bNum = false;
+ }
+ }
+ else {
+ bufIdent.append(c);
+ }
+ }
+ String valueStr = bufValue.toString();
+ fValue = Float.valueOf(valueStr).floatValue();
+ fIdentifier = bufIdent.toString();
+ fType = getFloatValueType(valueStr, fIdentifier);
+ }
+
+ /**
+ *
+ */
+ float getValue() {
+ return fValue;
+ }
+
+ /**
+ *
+ */
+ String getIdentifier() {
+ return fIdentifier;
+ }
+
+ /**
+ *
+ */
+ short getValueType() {
+ return fType;
+ }
+
+ private float fValue = 0.0f;
+ private String fIdentifier = null;
+ private short fType = CSSPrimitiveValue.CSS_UNKNOWN;
+ }
+
+ final static int S_NORMAL = 0;
+ final static int S_FUNCTION = 1;
+ final static int S_FONT_SLASH = 2;
+ final static int S_COMMA_SEPARATION = 3;
+ private ICSSDocument fDocument = null;
+ private IStructuredDocumentRegion fParentRegion = null;
+ private boolean fTempStructuredDocument = false;
+ private CSSModelUpdateContext fUpdateContext = null;
+
+ /**
+ * CSSDeclarationItemParser constructor comment.
+ */
+ CSSDeclarationItemParser(ICSSDocument doc) {
+ super();
+ fDocument = doc;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createAttrValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("attr")) { //$NON-NLS-1$
+ return null;
+ }
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT};
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ if (valueRegions.size() != 1) {
+ return null;
+ }
+
+ CSSPrimitiveValueImpl value = getCSSPrimitiveValue(CSSPrimitiveValue.CSS_ATTR);
+ if (value == null) {
+ return null;
+ }
+
+ ITextRegion region = valueRegions.get(0);
+ value.setValue(getText(region));
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createCountersValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("counters")) { //$NON-NLS-1$
+ return null;
+ }
+
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT, CSSRegionContexts.CSS_DECLARATION_VALUE_STRING};
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ int size = valueRegions.size();
+ if (size != 2 && size != 3) {
+ return null;
+ }
+
+ CounterImpl value = getCounter();
+ if (value == null) {
+ return null;
+ }
+
+ for (int i = 0; i < size; i++) {
+ ITextRegion region = valueRegions.get(i);
+ String text = getText(region);
+ CSSAttrImpl attr = null;
+ switch (i) {
+ case 0 :
+ value.setIdentifier(text);
+ attr = value.getAttributeNode(ICounter.IDENTIFIER);
+ break;
+ case 1 :
+ value.setSeparator(text);
+ attr = value.getAttributeNode(ICounter.SEPARATOR);
+ break;
+ case 2 :
+ value.setListStyle(text);
+ attr = value.getAttributeNode(ICounter.LISTSTYLE);
+ break;
+ default :
+ break;
+ }
+ if (attr != null) {
+ attr.setRangeRegion(fParentRegion, region, region);
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createCounterValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("counter")) { //$NON-NLS-1$
+ return null;
+ }
+
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT};
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ int size = valueRegions.size();
+ if (size != 1 && size != 2) {
+ return null;
+ }
+
+ CounterImpl value = getCounter();
+ if (value == null) {
+ return null;
+ }
+
+ for (int i = 0; i < size; i++) {
+ ITextRegion region = valueRegions.get(i);
+ String text = getText(region);
+ CSSAttrImpl attr = null;
+ switch (i) {
+ case 0 :
+ value.setIdentifier(text);
+ attr = value.getAttributeNode(ICounter.IDENTIFIER);
+ break;
+ case 1 :
+ value.setListStyle(text);
+ attr = value.getAttributeNode(ICounter.LISTSTYLE);
+ break;
+ default :
+ break;
+ }
+ if (attr != null) {
+ attr.setRangeRegion(fParentRegion, region, region);
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSStyleDeclItemImpl createDeclarationItem(ITextRegionList nodeRegions) {
+ CSSStyleDeclItemImpl item = null;
+ String name = getPropertyName(nodeRegions);
+ if (name != null) {
+ item = getCSSStyleDeclItem(name);
+ }
+ return item;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createFloatValue(String text, String type) {
+ FloatInfo info = new FloatInfo(text);
+ CSSPrimitiveValueImpl value = getCSSPrimitiveValue(info.getValueType());
+ if (value != null) {
+ value.setValue(info.getValue());
+ }
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createFormatValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("format")) { //$NON-NLS-1$
+ return null;
+ }
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_STRING};
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ // format can take variable args.
+ if (valueRegions.size() == 0) {
+ return null;
+ }
+
+ CSSPrimitiveValueImpl value = getCSSPrimitiveValue(ICSSPrimitiveValue.CSS_FORMAT);
+ if (value == null) {
+ return null;
+ }
+
+ ITextRegion region = valueRegions.get(0);
+ value.setValue(CSSUtil.extractStringContents(getText(region)));
+
+ return value;
+
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createLocalValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("local")) { //$NON-NLS-1$
+ return null;
+ }
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_STRING};
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ if (valueRegions.size() != 1) {
+ return null;
+ }
+
+ CSSPrimitiveValueImpl value = getCSSPrimitiveValue(ICSSPrimitiveValue.CSS_LOCAL);
+ if (value == null) {
+ return null;
+ }
+
+ ITextRegion region = valueRegions.get(0);
+ value.setValue(CSSUtil.extractStringContents(getText(region)));
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createPrimitiveValue(ITextRegion region) {
+ if (region == null) {
+ return null;
+ }
+ CSSPrimitiveValueImpl value = null;
+ String type = region.getType();
+ String text = getText(region);
+ if (isBlank(type)) {
+ value = null;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || type == CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION || type == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) {
+ value = createFloatValue(text, type);
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_STRING || type == CSSRegionContexts.CSS_DECLARATION_VALUE_URI || type == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || type == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ value = createStringValue(text, type);
+ }
+
+ if (value == null) {
+ value = createStringValue(text, type);
+ }
+
+ if (!fTempStructuredDocument && value != null) {
+ value.setRangeRegion(fParentRegion, region, region);
+ }
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createPrimitiveValue(ITextRegionList regions) {
+ CSSPrimitiveValueImpl value = null;
+ CSSUtil.stripSurroundingSpace(regions);
+ if (regions.isEmpty()) {
+ return null;
+ }
+ ITextRegion region = regions.get(0);
+ if (region == null) {
+ return null;
+ }
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ String text = getText(region).toLowerCase();
+ if (text.equals("rgb(")) { //$NON-NLS-1$
+ value = createRgbValue(regions);
+ }
+ else if (text.equals("counter(")) { //$NON-NLS-1$
+ value = createCounterValue(regions);
+ }
+ else if (text.equals("counters(")) { //$NON-NLS-1$
+ value = createCountersValue(regions);
+ }
+ else if (text.equals("attr(")) { //$NON-NLS-1$
+ value = createAttrValue(regions);
+ }
+ else if (text.equals("format(")) { //$NON-NLS-1$
+ value = createFormatValue(regions);
+ }
+ else if (text.equals("local(")) { //$NON-NLS-1$
+ value = createLocalValue(regions);
+ }
+ else if (text.equals("rect(")) { //$NON-NLS-1$
+ value = createRectValue(regions);
+ }
+ if (value == null) {
+ value = createStringValue(regions);
+ }
+ }
+ else {
+ value = createStringValue(regions);
+ }
+
+ if (!fTempStructuredDocument && value != null) {
+ value.setRangeRegion(fParentRegion, regions.get(0), regions.get(regions.size() - 1));
+ }
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createRectValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("rect")) { //$NON-NLS-1$
+ return null;
+ }
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION, CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT}; // IDENT:
+ // for
+ // 'auto'
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ if (valueRegions.size() != 4) {
+ return null;
+ }
+
+ RectImpl value = getRect();
+ if (value == null) {
+ return null;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ ITextRegion region = valueRegions.get(i);
+ CSSPrimitiveValueImpl childValue = null;
+ switch (i) {
+ case 0 :
+ childValue = (CSSPrimitiveValueImpl) value.getTop();
+ break;
+ case 1 :
+ childValue = (CSSPrimitiveValueImpl) value.getRight();
+ break;
+ case 2 :
+ childValue = (CSSPrimitiveValueImpl) value.getBottom();
+ break;
+ case 3 :
+ childValue = (CSSPrimitiveValueImpl) value.getLeft();
+ break;
+ default :
+ break;
+ }
+ if (childValue == null) {
+ return null;
+ }
+ String text = getText(region);
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ setStringValue(childValue, text, type);
+ }
+ else {
+ setFloatValue(childValue, text, type);
+ }
+ if (!fTempStructuredDocument) {
+ childValue.setRangeRegion(fParentRegion, region, region);
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createRgbValue(ITextRegionList regions) {
+ String funcName = getFunctionName(regions);
+ if (funcName == null || !funcName.toLowerCase().equals("rgb")) { //$NON-NLS-1$
+ return null;
+ }
+ String accepts[] = {CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE};
+ ITextRegionList valueRegions = getFunctionParameters(regions, accepts);
+ if (valueRegions.size() != 3) {
+ return null;
+ }
+
+ RGBColorImpl value = getRGBColor();
+ if (value == null) {
+ return null;
+ }
+
+ for (int i = 0; i < 3; i++) {
+ ITextRegion region = valueRegions.get(i);
+ CSSPrimitiveValueImpl childValue = null;
+ switch (i) {
+ case 0 :
+ childValue = (CSSPrimitiveValueImpl) value.getRed();
+ break;
+ case 1 :
+ childValue = (CSSPrimitiveValueImpl) value.getGreen();
+ break;
+ case 2 :
+ childValue = (CSSPrimitiveValueImpl) value.getBlue();
+ break;
+ default :
+ break;
+ }
+ if (childValue == null) {
+ return null;
+ }
+ setFloatValue(childValue, getText(region), region.getType());
+ if (!fTempStructuredDocument) {
+ childValue.setRangeRegion(fParentRegion, region, region);
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createStringValue(String text, String type) {
+ short valueType = getStringValueType(text, type);
+ CSSPrimitiveValueImpl value = getCSSPrimitiveValue(valueType);
+ if (value != null) {
+ if (valueType == CSSPrimitiveValue.CSS_URI) {
+ text = CSSUtil.extractUriContents(text);
+ }
+ else if (valueType == CSSPrimitiveValue.CSS_STRING) {
+ text = CSSUtil.extractStringContents(text);
+ }
+ value.setValue(text);
+ }
+ return value;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl createStringValue(ITextRegionList regions) {
+ String type = CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT;
+ if (regions.size() == 1) {
+ ITextRegion region = regions.get(0);
+ type = region.getType();
+ }
+ return createStringValue(makeString(regions), type);
+ }
+
+ /**
+ *
+ */
+ private CounterImpl getCounter() {
+ CounterImpl node;
+ if (fUpdateContext != null && fUpdateContext.isActive()) {
+ node = fUpdateContext.getCounter();
+ }
+ else {
+ node = (CounterImpl) fDocument.createCSSPrimitiveValue(CSSPrimitiveValue.CSS_COUNTER);
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ private CSSPrimitiveValueImpl getCSSPrimitiveValue(short type) {
+ CSSPrimitiveValueImpl node;
+ if (fUpdateContext != null && fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSPrimitiveValue(type);
+ }
+ else {
+ node = (CSSPrimitiveValueImpl) fDocument.createCSSPrimitiveValue(type);
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ private CSSStyleDeclItemImpl getCSSStyleDeclItem(String propertyName) {
+ CSSStyleDeclItemImpl node;
+ if (fUpdateContext != null && fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSStyleDeclItem(propertyName);
+ }
+ else {
+ node = (CSSStyleDeclItemImpl) fDocument.createCSSStyleDeclItem(propertyName);
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ static short getFloatValueType(String ident) {
+ ident = ident.toLowerCase();
+ short valueType;
+ if (ident.length() == 0) {
+ valueType = CSSPrimitiveValue.CSS_NUMBER;
+ }
+ else if (ident.equals("%")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PERCENTAGE;
+ }
+ else if (ident.equalsIgnoreCase("em")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_EMS;
+ }
+ else if (ident.equalsIgnoreCase("ex")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_EXS;
+ }
+ else if (ident.equalsIgnoreCase("px")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PX;
+ }
+ else if (ident.equalsIgnoreCase("cm")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_CM;
+ }
+ else if (ident.equalsIgnoreCase("mm")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_MM;
+ }
+ else if (ident.equalsIgnoreCase("in")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_IN;
+ }
+ else if (ident.equalsIgnoreCase("pt")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PT;
+ }
+ else if (ident.equalsIgnoreCase("pc")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PC;
+ }
+ else if (ident.equalsIgnoreCase("deg")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_DEG;
+ }
+ else if (ident.equalsIgnoreCase("rad")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_RAD;
+ }
+ else if (ident.equalsIgnoreCase("grad")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_GRAD;
+ }
+ else if (ident.equalsIgnoreCase("ms")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_MS;
+ }
+ else if (ident.equalsIgnoreCase("s")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_S;
+ }
+ else if (ident.equalsIgnoreCase("hz")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_HZ;
+ }
+ else if (ident.equalsIgnoreCase("khz")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_KHZ;
+ }
+ else {
+ valueType = CSSPrimitiveValue.CSS_DIMENSION;
+ }
+ return valueType;
+ }
+
+ /**
+ *
+ */
+ static short getFloatValueType(String value, String ident) {
+ ident = ident.toLowerCase();
+ short valueType;
+ if (ident.length() == 0) {
+ if (0 <= value.indexOf('.')) {
+ valueType = CSSPrimitiveValue.CSS_NUMBER;
+ }
+ else {
+ valueType = ICSSPrimitiveValue.CSS_INTEGER;
+ }
+ }
+ else if (ident.equals("%")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PERCENTAGE;
+ }
+ else if (ident.equalsIgnoreCase("em")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_EMS;
+ }
+ else if (ident.equalsIgnoreCase("ex")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_EXS;
+ }
+ else if (ident.equalsIgnoreCase("px")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PX;
+ }
+ else if (ident.equalsIgnoreCase("cm")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_CM;
+ }
+ else if (ident.equalsIgnoreCase("mm")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_MM;
+ }
+ else if (ident.equalsIgnoreCase("in")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_IN;
+ }
+ else if (ident.equalsIgnoreCase("pt")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PT;
+ }
+ else if (ident.equalsIgnoreCase("pc")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_PC;
+ }
+ else if (ident.equalsIgnoreCase("deg")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_DEG;
+ }
+ else if (ident.equalsIgnoreCase("rad")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_RAD;
+ }
+ else if (ident.equalsIgnoreCase("grad")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_GRAD;
+ }
+ else if (ident.equalsIgnoreCase("ms")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_MS;
+ }
+ else if (ident.equalsIgnoreCase("s")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_S;
+ }
+ else if (ident.equalsIgnoreCase("hz")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_HZ;
+ }
+ else if (ident.equalsIgnoreCase("khz")) { //$NON-NLS-1$
+ valueType = CSSPrimitiveValue.CSS_KHZ;
+ }
+ else {
+ valueType = CSSPrimitiveValue.CSS_DIMENSION;
+ }
+ return valueType;
+ }
+
+ /**
+ *
+ */
+ private String getFunctionName(ITextRegionList regions) {
+ if (regions == null || regions.size() < 2) {
+ return null;
+ }
+ ITextRegion firstRegion = regions.get(0);
+ if (firstRegion.getType() != CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ return null;
+ }
+ ITextRegion lastRegion = regions.get(regions.size() - 1);
+ if (lastRegion.getType() != CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
+ return null;
+ }
+ String text = getText(firstRegion);
+ return text.substring(0, text.length() - 1);
+ }
+
+ /**
+ * this method has no validation check, then regions must be passed
+ * getFunctionName()...
+ */
+ private ITextRegionList getFunctionParameters(ITextRegionList regions, String[] accepts) {
+ ITextRegionList newRegions = new TextRegionListImpl();
+ int nAccepts = (accepts != null) ? accepts.length : 0;
+ Iterator i = regions.iterator();
+ i.next(); // skip FUNCTION
+ while (i.hasNext()) {
+ ITextRegion region = (ITextRegion) i.next();
+ if (region == null) {
+ continue;
+ }
+ String type = region.getType();
+ if (isBlank(type)) {
+ continue;
+ }
+ if (nAccepts == 0) {
+ newRegions.add(region);
+ }
+ else {
+ for (int iAccept = 0; iAccept < nAccepts; iAccept++) {
+ if (type == accepts[iAccept]) {
+ newRegions.add(region);
+ break;
+ }
+ }
+ }
+ }
+ return newRegions;
+ }
+
+ /**
+ *
+ */
+ // private String getPropertyName(IStructuredDocumentRegion flatNode) {
+ // Vector nodeRegions = new Vector(flatNode.getRegions());
+ // return getPropertyName(nodeRegions);
+ // }
+ /**
+ *
+ */
+ private String getPropertyName(ITextRegionList nodeRegions) {
+ ITextRegionList nameRegions = new TextRegionListImpl();
+ String name = null;
+ while (!nodeRegions.isEmpty()) {
+ ITextRegion region = nodeRegions.remove(0);
+ if (region == null) {
+ continue;
+ }
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
+ CSSUtil.stripSurroundingSpace(nameRegions);
+ name = makeString(nameRegions);
+ break;
+ }
+ else {
+ nameRegions.add(region);
+ }
+ }
+ return name;
+ }
+
+ /**
+ *
+ */
+ private RectImpl getRect() {
+ RectImpl node;
+ if (fUpdateContext != null && fUpdateContext.isActive()) {
+ node = fUpdateContext.getRect();
+ }
+ else {
+ node = (RectImpl) fDocument.createCSSPrimitiveValue(CSSPrimitiveValue.CSS_RECT);
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ private RGBColorImpl getRGBColor() {
+ RGBColorImpl node;
+ if (fUpdateContext != null && fUpdateContext.isActive()) {
+ node = fUpdateContext.getRGBColor();
+ }
+ else {
+ node = (RGBColorImpl) fDocument.createCSSPrimitiveValue(CSSPrimitiveValue.CSS_RGBCOLOR);
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ private short getStringValueType(String text, String type) {
+ short valueType;
+ if (text.toLowerCase().equals("inherit")) { //$NON-NLS-1$
+ valueType = ICSSPrimitiveValue.CSS_INHERIT_PRIMITIVE;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) {
+ valueType = CSSPrimitiveValue.CSS_URI;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_STRING) {
+ valueType = CSSPrimitiveValue.CSS_STRING;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ valueType = ICSSPrimitiveValue.CSS_HASH;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && text.equals(",")) { //$NON-NLS-1$
+ valueType = ICSSPrimitiveValue.CSS_COMMA;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && text.equals("/")) { //$NON-NLS-1$
+ valueType = ICSSPrimitiveValue.CSS_SLASH;
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE) {
+ valueType = ICSSPrimitiveValue.CSS_URANGE;
+ }
+ else {
+ valueType = CSSPrimitiveValue.CSS_IDENT;
+ }
+ return valueType;
+ }
+
+ /**
+ *
+ */
+ private String makeString(ITextRegionList regions) {
+ StringBuffer buf = new StringBuffer();
+ boolean bSpace = false;
+ for (Iterator i = regions.iterator(); i.hasNext();) {
+ ITextRegion region = (ITextRegion) i.next();
+ String type = region.getType();
+ if (!bSpace && isBlank(type)) {
+ buf.append(" "); //$NON-NLS-1$
+ bSpace = true;
+ }
+ else {
+ buf.append(getText(region));
+ bSpace = false;
+ }
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ *
+ */
+ void setStructuredDocumentTemporary(boolean bTemp) {
+ fTempStructuredDocument = bTemp;
+ }
+
+ /**
+ *
+ */
+ private void setFloatValue(CSSPrimitiveValueImpl value, String text, String type) {
+ FloatInfo info = new FloatInfo(text);
+ value.setFloatValue(info.getValueType(), info.getValue());
+ }
+
+ /**
+ *
+ */
+ private void setStringValue(CSSPrimitiveValueImpl value, String text, String type) {
+ short valueType = getStringValueType(text, type);
+ value.setStringValue(valueType, text);
+ }
+
+ /**
+ * @param item
+ * org.eclipse.wst.css.core.model.interfaces.ICSSStyleDeclItem
+ * @param nodeRegions
+ * java.util.Vector
+ */
+ private void setupImportantAttribute(ICSSStyleDeclItem item, ITextRegionList nodeRegions) {
+ if (item == null || nodeRegions == null || nodeRegions.isEmpty()) {
+ return;
+ }
+ ITextRegion region = nodeRegions.get(nodeRegions.size() - 1);
+ if (region != null && region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT) {
+ item.setPriority(getText(region));
+ CSSAttrImpl attr = ((CSSStyleDeclItemImpl) item).getAttributeNode(ICSSStyleDeclItem.IMPORTANT);
+ attr.setRangeRegion(fParentRegion, region, region);
+ nodeRegions.remove(region);
+ }
+ }
+
+ /**
+ *
+ */
+ void setUpdateContext(CSSModelUpdateContext updateContext) {
+ fUpdateContext = updateContext;
+ }
+
+ /**
+ *
+ */
+ public static boolean hasColonSeparator(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null) {
+ return false;
+ }
+ ITextRegionList regions = flatNode.getRegions();
+ if (regions == null || regions.size() == 0) {
+ return false;
+ }
+
+ for (Iterator i = regions.iterator(); i.hasNext();) {
+ ITextRegion region = (ITextRegion) i.next();
+ if (region == null) {
+ continue;
+ }
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ CSSStyleDeclItemImpl setupDeclarationItem(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null) {
+ return null;
+ }
+ if (!hasColonSeparator(flatNode)) {
+ return null;
+ }
+
+ fParentRegion = flatNode;
+
+ ITextRegionList nodeRegions = new TextRegionListImpl(flatNode.getRegions()); // make
+ // copy
+ CSSStyleDeclItemImpl newItem = createDeclarationItem(nodeRegions);
+ if (newItem == null) {
+ return null;
+ }
+ if (!fTempStructuredDocument && flatNode != null) {
+ newItem.setRangeStructuredDocumentRegion(flatNode, flatNode);
+ }
+
+ CSSUtil.stripSurroundingSpace(nodeRegions);
+ setupImportantAttribute(newItem, nodeRegions);
+ // Now, nodeRegions just has regions for value.
+ setupValues(newItem, nodeRegions);
+ return newItem;
+ }
+
+ void setupValues(ICSSStyleDeclItem item, IStructuredDocumentRegion parentRegion, ITextRegionList nodeRegions) {
+ fParentRegion = parentRegion;
+ setupValues(item, nodeRegions);
+ }
+
+ /**
+ * nodeRegions must be broken. If you need after, make copy of them.
+ */
+ private void setupValues(ICSSStyleDeclItem item, ITextRegionList nodeRegions) {
+ if (item == null) {
+ return;
+ }
+
+ ICSSPrimitiveValue value;
+ ITextRegionList regionBuf = new TextRegionListImpl();
+
+ String propertyName = item.getPropertyName().toLowerCase();
+ boolean bFont = (propertyName.equals(PropCMProperty.P_FONT));
+ // (short-hand) font
+ int status = (propertyName.equals(PropCMProperty.P_VOICE_FAMILY) || propertyName.equals(PropCMProperty.P_FONT_FAMILY)) ? S_COMMA_SEPARATION : S_NORMAL;
+ while (!nodeRegions.isEmpty()) {
+ value = null;
+ ITextRegion region = nodeRegions.remove(0);
+ if (region == null) {
+ continue;
+ }
+ String type = region.getType();
+ // if (type == CSSRegionContexts.CSS_DECLARATION_DELIMITER || type
+ // == CSSRegionContexts.CSS_RBRACE) {
+ // break;
+ // }
+ switch (status) {
+ case S_NORMAL :
+ if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ regionBuf.add(region);
+ status = S_FUNCTION;
+ }
+ else if (bFont && type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && fParentRegion.getText(region).equals("/")) { //$NON-NLS-1$
+ value = createPrimitiveValue(region);
+ status = S_FONT_SLASH;
+ }
+ else if (!isBlank(type)) {
+ value = createPrimitiveValue(region);
+ }
+ break;
+ case S_FUNCTION :
+ if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
+ regionBuf.add(region);
+ value = createPrimitiveValue(regionBuf);
+ regionBuf.clear();
+ status = S_NORMAL;
+ }
+ else if (!isBlank(type)) {
+ regionBuf.add(region);
+ }
+ break;
+ case S_FONT_SLASH :
+ if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION) {
+ value = createPrimitiveValue(region);
+ status = S_COMMA_SEPARATION;
+ }
+ else if (!isBlank(type)) {
+ value = createPrimitiveValue(region);
+ }
+ break;
+ case S_COMMA_SEPARATION :
+ if (type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && fParentRegion.getText(region).equals(",")) { //$NON-NLS-1$
+ value = createPrimitiveValue(regionBuf);
+ regionBuf.clear();
+ if (value != null) {
+ if (fUpdateContext == null || !fUpdateContext.isActive()) {
+ item.appendValue(value);
+ }
+ }
+ value = createPrimitiveValue(region);
+ }
+ else {
+ regionBuf.add(region);
+ }
+ break;
+ default :
+ break;
+ }
+ if (value != null) {
+ if (fUpdateContext == null || !fUpdateContext.isActive()) {
+ item.appendValue(value);
+ }
+ }
+ }
+ if (!regionBuf.isEmpty()) {
+ value = createPrimitiveValue(regionBuf);
+ if (fUpdateContext == null || !fUpdateContext.isActive()) {
+ item.appendValue(value);
+ }
+ }
+ }
+
+ private String getText(ITextRegion region) {
+ return (fParentRegion != null) ? fParentRegion.getText(region) : ""; //$NON-NLS-1$
+ }
+
+ private static boolean isBlank(String type) {
+ return (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT || type == CSSRegionContexts.CSS_DECLARATION_VALUE_S);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDocumentImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDocumentImpl.java
new file mode 100644
index 0000000000..c3bb647e9f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSDocumentImpl.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.w3c.dom.css.CSSFontFaceRule;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSUnknownRule;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ *
+ */
+abstract class CSSDocumentImpl extends CSSStructuredDocumentRegionContainer implements ICSSDocument {
+
+ private CSSModelImpl fModel = null;
+
+ /**
+ * CSSDocumentImpl constructor comment.
+ */
+ CSSDocumentImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSDocumentImpl
+ */
+ CSSDocumentImpl(CSSDocumentImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSNode
+ * @param name
+ * java.lang.String
+ */
+ ICSSNode createCSSAttr(String name) {
+ CSSAttrImpl attr = new CSSAttrImpl(name);
+ attr.setOwnerDocument(this);
+
+ return attr;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSCharsetRule
+ */
+ public ICSSCharsetRule createCSSCharsetRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSFontFaceRule
+ */
+ public CSSFontFaceRule createCSSFontFaceRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSImportRule
+ */
+ public ICSSImportRule createCSSImportRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.ICSSMediaRule
+ */
+ public ICSSMediaRule createCSSMediaRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPageRule
+ */
+ public ICSSPageRule createCSSPageRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ */
+ public ICSSPrimitiveValue createCSSPrimitiveValue(short primitiveType) {
+ CSSPrimitiveValueImpl value = null;
+ if (primitiveType == CSSPrimitiveValue.CSS_COUNTER)
+ value = new CounterImpl();
+ else if (primitiveType == CSSPrimitiveValue.CSS_RECT)
+ value = new RectImpl();
+ else if (primitiveType == CSSPrimitiveValue.CSS_RGBCOLOR)
+ value = new RGBColorImpl();
+ else
+ value = new CSSPrimitiveValueImpl(primitiveType);
+ value.setOwnerDocument(this);
+
+ return value;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * java.lang.String
+ */
+ public CSSRule createCSSRule(String rule) {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleDeclaration
+ */
+ public ICSSStyleDeclaration createCSSStyleDeclaration() {
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param propertyName
+ * java.lang.String
+ */
+ public ICSSStyleDeclItem createCSSStyleDeclItem(String propertyName) {
+ CSSStyleDeclItemImpl item = new CSSStyleDeclItemImpl(propertyName);
+ item.setOwnerDocument(this);
+
+ return item;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleRule
+ */
+ public ICSSStyleRule createCSSStyleRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSUnknownRule
+ */
+ public CSSUnknownRule createCSSUnknownRule() {
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.stylesheets.MediaList
+ */
+ public MediaList createMediaList() {
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSModel
+ */
+ public ICSSModel getModel() {
+ return fModel;
+ }
+
+ /**
+ * @param model
+ * com.ibm.sed.css.treemodel.CSSModelImpl
+ */
+ void setModel(CSSModelImpl model) {
+ this.fModel = model;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSFontFaceRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSFontFaceRuleImpl.java
new file mode 100644
index 0000000000..c3bdf63fe1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSFontFaceRuleImpl.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.css.CSSFontFaceRule;
+
+
+/**
+ *
+ */
+class CSSFontFaceRuleImpl extends CSSRuleDeclContainer implements CSSFontFaceRule {
+
+ /**
+ *
+ */
+ CSSFontFaceRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSFontFaceRuleImpl
+ */
+ CSSFontFaceRuleImpl(CSSFontFaceRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSFontFaceRuleImpl cloned = new CSSFontFaceRuleImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ String extractPreString() {
+ return "@font-face";//$NON-NLS-1$
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return FONTFACERULE_NODE;
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return FONT_FACE_RULE;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSImportRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSImportRuleImpl.java
new file mode 100644
index 0000000000..bf99f11560
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSImportRuleImpl.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.adapters.IModelProvideAdapter;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.util.CSSLinkConverter;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.URLModelProviderCSS;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSStyleSheet;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ *
+ */
+class CSSImportRuleImpl extends CSSRuleImpl implements ICSSImportRule {
+
+ private boolean fDirty = true;
+ private ICSSStyleSheet fStyleSheet;
+
+ /**
+ *
+ */
+ CSSImportRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSImportRuleImpl
+ */
+ CSSImportRuleImpl(CSSImportRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSImportRuleImpl cloned = new CSSImportRuleImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ *
+ */
+ void closeStyleSheet() {
+ if (fStyleSheet != null) {
+ ICSSStyleSheet sheet = fStyleSheet;
+ fStyleSheet = null; // to prevent loop, we must reset fStyleSheet
+ // before all closing action
+
+ sheet.getModel().removeStyleListener(getOwnerDocument().getModel());
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) getAdapterFor(IModelProvideAdapter.class);
+ // if (getOwnerDocument().getModel().getStyleSheetType() ==
+ // ICSSModel.EMBEDDED) { // case STYLE tag
+ // adapter = (ModelProvideAdapter)
+ // ((INodeNotifier)getOwnerDocument().getModel().getOwnerDOMNode()).getAdapterFor(ModelProvideAdapter.class);
+ // }
+ if (adapter != null)
+ adapter.modelRemoved(sheet.getModel());
+
+ sheet.getModel().releaseFromRead();
+ }
+ }
+
+ /**
+ * The location of the style sheet to be imported. The attribute will not
+ * contain the <code>"url(...)"</code> specifier around the URI.
+ */
+ public String getHref() {
+ return CSSUtil.extractUriContents(getAttribute(HREF));
+ }
+
+ /**
+ * A list of media types for which this style sheet may be used.
+ */
+ public org.w3c.dom.stylesheets.MediaList getMedia() {
+ ICSSNode media = getFirstChild();
+ if (media != null) {
+ if (media instanceof MediaList) {
+ return (MediaList) media;
+ }
+ }
+
+ // THIS CASE IS ERROR CASE
+ return null;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return IMPORTRULE_NODE;
+ }
+
+ /**
+ * The style sheet referred to by this rule, if it has been loaded. The
+ * value of this attribute is <code>null</code> if the style sheet has
+ * not yet been loaded or if it will not be loaded (e.g. if the style
+ * sheet is for a media type not supported by the user agent).
+ */
+ public CSSStyleSheet getStyleSheet() {
+
+ if (fDirty) {
+ // NOTE: try/catch block is a TEMP fix to avoid compile errors:
+ try {
+ closeStyleSheet();
+
+ if (getHref() == null || getHref().length() <= 0) {
+ fDirty = false;
+ return null;
+ }
+
+ IStructuredModel baseModel = getOwnerDocument().getModel();
+ if (getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED) { // case
+ // STYLE
+ // tag
+ baseModel = ((XMLNode) getOwnerDocument().getModel().getOwnerDOMNode()).getModel();
+ }
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) getAdapterFor(IModelProvideAdapter.class);
+ // if (getOwnerDocument().getModel().getStyleSheetType() ==
+ // ICSSModel.EMBEDDED) { // case STYLE tag
+ // adapter = (ModelProvideAdapter)
+ // ((INodeNotifier)getOwnerDocument().getModel().getOwnerDOMNode()).getAdapterFor(ModelProvideAdapter.class);
+ // }
+
+ // load model from IModelManager
+ URLModelProviderCSS provider = new URLModelProviderCSS();
+ IStructuredModel newModel = provider.getModelForRead(baseModel, getHref());
+ fDirty = false;
+
+ if (newModel == null)
+ return null;
+ if (!(newModel instanceof ICSSModel)) {
+ newModel.releaseFromRead();
+ return null;
+ }
+
+ // notify adapter
+ if (adapter != null)
+ adapter.modelProvided(newModel);
+
+ fStyleSheet = (ICSSStyleSheet) ((ICSSModel) newModel).getDocument();
+ if (fStyleSheet != null)
+ fStyleSheet.getModel().addStyleListener(getOwnerDocument().getModel());
+ }
+ catch (java.io.IOException e) {
+ Logger.logException(e);
+ }
+ }
+ return fStyleSheet;
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return IMPORT_RULE;
+ }
+
+ /**
+ *
+ */
+ public void refreshStyleSheet() {
+ if (!fDirty) {
+ closeStyleSheet();
+ fDirty = true;
+ notify(INodeNotifier.CHANGE, getAttributeNode(HREF), null, null, getStartOffset());
+ }
+ }
+
+ /**
+ */
+ void releaseRule() {
+ if (fStyleSheet != null) {
+ ICSSStyleSheet sheet = fStyleSheet;
+ fStyleSheet = null; // to prevent loop, we must reset fStyleSheet
+ // before all closing action
+
+ sheet.getModel().removeStyleListener(getOwnerDocument().getModel());
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) getAdapterFor(IModelProvideAdapter.class);
+ // if (getOwnerDocument().getModel().getStyleSheetType() ==
+ // ICSSModel.EMBEDDED) { // case STYLE tag
+ // adapter = (ModelProvideAdapter)
+ // ((INodeNotifier)getOwnerDocument().getModel().getOwnerDOMNode()).getAdapterFor(ModelProvideAdapter.class);
+ // }
+ if (adapter != null)
+ adapter.modelReleased(sheet.getModel());
+
+ sheet.getModel().releaseFromRead();
+ }
+ }
+
+ /**
+ * @param href
+ * java.lang.String
+ */
+ public void setHref(String href) throws DOMException {
+ fDirty = true;
+ setAttribute(HREF, CSSLinkConverter.addFunc(href));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSMediaRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSMediaRuleImpl.java
new file mode 100644
index 0000000000..d71bfaf055
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSMediaRuleImpl.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSRuleList;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ *
+ */
+class CSSMediaRuleImpl extends CSSRuleImpl implements ICSSMediaRule {
+
+ /**
+ *
+ */
+ CSSMediaRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSMediaRuleImpl
+ */
+ CSSMediaRuleImpl(CSSMediaRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public org.w3c.dom.css.CSSRule appendRule(org.w3c.dom.css.CSSRule rule) throws org.w3c.dom.DOMException {
+ if (rule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) appendChild((CSSNodeImpl) rule);
+ return ret;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSMediaRuleImpl cloned = new CSSMediaRuleImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * Used to delete a rule from the media block.
+ *
+ * @param index
+ * The index within the media block's rule collection of the
+ * rule to remove.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified index does not
+ * correspond to a rule in the media rule list. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule
+ * is readonly.
+ */
+ public void deleteRule(int index) throws DOMException {
+ CSSNodeImpl node = getIndexedRule(index);
+ if (node != null)
+ removeChild(node);
+ }
+
+ /**
+ * A list of all CSS rules contained within the media block.
+ */
+ public CSSRuleList getCssRules() {
+ CSSRuleListImpl list = new CSSRuleListImpl();
+
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSRule)
+ list.appendNode(node);
+ }
+
+ return list;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSRuleImpl
+ * @param index
+ * int
+ */
+ CSSRuleImpl getIndexedRule(int index) {
+ if (index < 0)
+ return null;
+
+ int i = 0;
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSRule) {
+ if (i++ == index)
+ return (CSSRuleImpl) node;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * A list of media types for this rule.
+ */
+ public MediaList getMedia() {
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof MediaListImpl)
+ return (MediaList) node;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return MEDIARULE_NODE;
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return MEDIA_RULE;
+ }
+
+ /**
+ * Used to insert a new rule into the media block.
+ *
+ * @param rule
+ * The parsable text representing the rule. For rule sets this
+ * contains both the selector and the style declaration. For
+ * at-rules, this specifies both the at-identifier and the rule
+ * content.
+ * @param index
+ * The index within the media block's rule collection of the
+ * rule before which to insert the specified rule. If the
+ * specified index is equal to the length of the media blocks's
+ * rule collection, the rule will be added to the end of the
+ * media block.
+ * @return The index within the media block's rule collection of the newly
+ * inserted rule.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be
+ * inserted at the specified index, e.g., if an
+ * <code>@import</code> rule is inserted after a standard rule set or other
+ * at-rule. <br>
+ * INDEX_SIZE_ERR: Raised if the specified index is not a valid
+ * insertion point. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
+ * readonly. <br>
+ * SYNTAX_ERR: Raised if the specified rule has a syntax error and
+ * is unparsable.
+ */
+ public int insertRule(String rule, int index) throws DOMException {
+ int length = getCssRules().getLength();
+ if (index < 0 || length < index)
+ throw new DOMException(DOMException.INDEX_SIZE_ERR, "");//$NON-NLS-1$
+
+ CSSRuleImpl refRule = (length != index) ? getIndexedRule(index) : null;
+
+ CSSRuleImpl newRule = (CSSRuleImpl) getOwnerDocument().createCSSRule(rule);
+
+ // prevent from nesting @media rule
+ if (newRule.getType() == CSSRule.MEDIA_RULE)
+ throw new DOMException(DOMException.SYNTAX_ERR, "");//$NON-NLS-1$
+
+ insertBefore(newRule, refRule);
+
+ return index;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param newRule
+ * org.w3c.dom.css.CSSRule
+ * @param refRule
+ * org.w3c.dom.css.CSSRule
+ */
+ public org.w3c.dom.css.CSSRule insertRuleBefore(org.w3c.dom.css.CSSRule newRule, org.w3c.dom.css.CSSRule refRule) throws org.w3c.dom.DOMException {
+ if (newRule == null && refRule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) insertBefore((CSSNodeImpl) newRule, (CSSNodeImpl) refRule);
+ return ret;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public org.w3c.dom.css.CSSRule removeRule(org.w3c.dom.css.CSSRule rule) throws org.w3c.dom.DOMException {
+ if (rule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) removeChild((CSSNodeImpl) rule);
+ return ret;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param newChild
+ * org.w3c.dom.css.CSSRule
+ * @param oldChild
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public org.w3c.dom.css.CSSRule replaceRule(org.w3c.dom.css.CSSRule newRule, org.w3c.dom.css.CSSRule oldRule) throws org.w3c.dom.DOMException {
+ if (newRule == null && oldRule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) replaceChild((CSSNodeImpl) newRule, (CSSNodeImpl) oldRule);
+ return ret;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelCreationContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelCreationContext.java
new file mode 100644
index 0000000000..bc640da725
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelCreationContext.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+/**
+ *
+ */
+class CSSModelCreationContext {
+
+ private CSSNodeImpl fRootNode = null;
+ private CSSNodeImpl fTargetNode = null;
+ private CSSNodeImpl fNextNode = null;
+ private int fReparseStart = -1;
+ private int fReparseEnd = -1;
+
+ /**
+ * CSSModelContext constructor comment.
+ */
+ CSSModelCreationContext(CSSNodeImpl rootNode) {
+ super();
+
+ fRootNode = rootNode;
+ }
+
+ /**
+ *
+ */
+ void clear() {
+ fNextNode = null;
+ fTargetNode = null;
+ resetReparseRange();
+ }
+
+ /**
+ *
+ */
+ CSSNodeImpl getNextNode() {
+ return fNextNode;
+ }
+
+ /**
+ *
+ */
+ int getReparseEnd() {
+ return fReparseEnd;
+ }
+
+ /**
+ *
+ */
+ int getReparseStart() {
+ return fReparseStart;
+ }
+
+ /**
+ *
+ */
+ CSSNodeImpl getRootNode() {
+ return fRootNode;
+ }
+
+ /**
+ *
+ */
+ CSSNodeImpl getTargetNode() {
+ return fTargetNode;
+ }
+
+ /**
+ *
+ */
+ boolean isToReparse() {
+ return (0 <= getReparseStart() && 0 <= getReparseEnd());
+ }
+
+ /**
+ *
+ */
+ void resetReparseRange() {
+ fReparseStart = fReparseEnd = -1;
+ }
+
+ /**
+ *
+ */
+ void setLast() {
+ fNextNode = null;
+
+ if (!(fRootNode instanceof CSSStructuredDocumentRegionContainer)) {
+ fTargetNode = fRootNode;
+ }
+ else {
+ IStructuredDocumentRegion lastStructuredDocumentRegion = ((CSSStructuredDocumentRegionContainer) fRootNode).getLastStructuredDocumentRegion();
+ CSSNodeImpl node = fRootNode;
+ while (node != null) {
+ ICSSNode lastChild = node.getLastChild();
+ if (lastChild instanceof CSSStructuredDocumentRegionContainer && ((CSSStructuredDocumentRegionContainer) lastChild).getLastStructuredDocumentRegion() == lastStructuredDocumentRegion) {
+ node = (CSSNodeImpl) lastChild;
+ }
+ else {
+ break;
+ }
+ }
+ fTargetNode = node;
+ }
+ }
+
+ /**
+ *
+ */
+ void setNextNode(ICSSNode node) {
+ fNextNode = (CSSNodeImpl) node;
+ if (fNextNode != null) {
+ fTargetNode = (CSSNodeImpl) fNextNode.getParentNode();
+ }
+ }
+
+ /**
+ *
+ */
+ void setReparseEnd(int end) {
+ fReparseEnd = end;
+ }
+
+ /**
+ *
+ */
+ void setReparseStart(int start) {
+ fReparseStart = start;
+ }
+
+ /**
+ *
+ */
+ void setTargetNode(ICSSNode node) {
+ fTargetNode = (CSSNodeImpl) node;
+ if (fNextNode != null && fNextNode.getParentNode() != fTargetNode) {
+ fNextNode = null;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelDeletionContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelDeletionContext.java
new file mode 100644
index 0000000000..ee63966d4b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelDeletionContext.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+
+
+/**
+ *
+ */
+class CSSModelDeletionContext {
+
+ private int fOldStart = -1;
+ private int fOldLength = 0;
+ private int fNewStart = -1;
+ private int fNewLength = 0;
+ private int fLengthDifference = 0;
+ private IStructuredDocumentRegionList fOldStructuredDocumentRegions = null;
+ // private ICSSNode fRootNode = null;
+ private int fRemovedRangeBegin = -1;
+ private int fRemovedRangeEnd = -1;
+ private CSSNodeListImpl fNodesToBeRemoved = new CSSNodeListImpl();
+
+ /**
+ * CSSModelDeletionContext constructor comment.
+ */
+ CSSModelDeletionContext(ICSSNode rootNode) {
+ super();
+
+ // fRootNode = rootNode;
+ }
+
+ /**
+ *
+ */
+ boolean addNodeToBeRemoved(ICSSNode node) {
+ int nNodes = fNodesToBeRemoved.getLength();
+ for (int i = 0; i < nNodes; i++) {
+ ICSSNode parent = fNodesToBeRemoved.item(i);
+ if (CSSModelUtil.isParentOf(parent, node)) {
+ return false;
+ }
+ }
+ fNodesToBeRemoved.appendNode(node);
+ return true;
+ }
+
+ /**
+ *
+ */
+ void expandRemovedRangeBegin(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null) {
+ return;
+ }
+ int newBegin = flatNode.getStart(); // fOldStart == fNewStart, right??
+ if (fRemovedRangeBegin < 0 || newBegin < fRemovedRangeBegin) {
+ fRemovedRangeBegin = newBegin;
+ }
+ }
+
+ /**
+ *
+ */
+ void expandRemovedRangeEnd(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null) {
+ return;
+ }
+ int newEnd = flatNode.getEnd() + ((isOldNode(flatNode)) ? fLengthDifference : 0);
+ if (fRemovedRangeEnd < 0 || fRemovedRangeEnd < newEnd) {
+ fRemovedRangeEnd = newEnd;
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSStructuredDocumentRegionContainer findContainer(CSSNodeImpl parent, IStructuredDocumentRegion flatNode) {
+ if (parent instanceof CSSStructuredDocumentRegionContainer) {
+ // Am i a container of flatNode?
+ IStructuredDocumentRegion firstNode = ((CSSStructuredDocumentRegionContainer) parent).getFirstStructuredDocumentRegion();
+ IStructuredDocumentRegion lastNode = ((CSSStructuredDocumentRegionContainer) parent).getLastStructuredDocumentRegion();
+ int firstStart = getOriginalOffset(firstNode);
+ int lastStart = getOriginalOffset(lastNode);
+ int start = flatNode.getStart();
+
+ if (firstStart <= start && start <= lastStart) {
+ // I am a container, is my child a container ?
+ for (ICSSNode node = parent.getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSNodeImpl) {
+ CSSStructuredDocumentRegionContainer container = findContainer((CSSNodeImpl) node, flatNode);
+ if (container != null) {
+ return container;
+ }
+ }
+ }
+ return (CSSStructuredDocumentRegionContainer) parent;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ */
+ CSSStructuredDocumentRegionContainer findDeletionTarget(CSSNodeImpl parent, IStructuredDocumentRegion flatNode) {
+ CSSStructuredDocumentRegionContainer target = findContainer(parent, flatNode);
+ if (target == null) {
+ return null;
+ }
+
+ // System.out.print(flatNode.toString() + ": ");
+
+ // child a(=====)b(=====)c
+ // parent (================) a,c can remove parent, but b cannot.
+
+ ICSSNode child;
+
+ for (child = target.getFirstChild(); child != null && !(child instanceof CSSStructuredDocumentRegionContainer); child = child.getNextSibling()) {
+ // just advancing
+ }
+
+ if (child == null) {
+ // System.out.println("target has no children."); // TESTBYCOZY
+ return target; // has no child containers.
+ }
+ else {
+ IStructuredDocumentRegion firstNode = ((CSSStructuredDocumentRegionContainer) child).getFirstStructuredDocumentRegion();
+ if (flatNode.getStart() < getOriginalOffset(firstNode)) {
+ // System.out.println("flatNode is in front of first child");
+ // // TESTBYCOZY
+ return target; // a
+ }
+ }
+
+ for (child = target.getLastChild(); child != null && !(child instanceof CSSStructuredDocumentRegionContainer); child = child.getPreviousSibling()) {
+ // just advancing
+ }
+
+ if (child == null) {
+ // System.out.println("target has no children."); // TESTBYCOZY
+ return target; // has no child containers.
+ }
+ else {
+ IStructuredDocumentRegion firstNode = ((CSSStructuredDocumentRegionContainer) child).getFirstStructuredDocumentRegion();
+ if (getOriginalOffset(firstNode) < flatNode.getStart()) {
+ // System.out.println("flatNode is in after of last child");
+ // // TESTBYCOZY
+ return target; // c
+ }
+ }
+
+ // System.out.println("flatNode inner of children"); // TESTBYCOZY
+ return null; // b
+ }
+
+ /**
+ *
+ */
+ Iterator getNodesToBeRemoved() {
+ Collection nodes = new ArrayList();
+ int nNodes = fNodesToBeRemoved.getLength();
+ for (int i = 0; i < nNodes; i++) {
+ nodes.add(fNodesToBeRemoved.item(i));
+ }
+ return nodes.iterator();
+ }
+
+ /**
+ *
+ */
+ private int getOriginalOffset(IStructuredDocumentRegion flatNode) {
+ int offset = 0;
+ if (flatNode != null) {
+ offset = flatNode.getStart();
+ if (0 <= fLengthDifference) {
+ if (fNewStart + fNewLength < offset) {
+ offset -= fLengthDifference;
+ }
+ }
+ else {
+ if (fOldStart + fOldLength <= offset || (fNewStart < 0 && fOldStart <= offset && !isOldNode(flatNode)) || (0 <= fNewStart && fNewStart + fNewLength <= offset && !isOldNode(flatNode))) {
+ offset -= fLengthDifference;
+ }
+ }
+ }
+
+ return offset;
+ }
+
+ /**
+ *
+ */
+ int getRemovedRangeBegin() {
+ return fRemovedRangeBegin;
+ }
+
+ /**
+ *
+ */
+ int getRemovedRangeEnd() {
+ return fRemovedRangeEnd;
+ }
+
+ /**
+ *
+ */
+ private boolean isOldNode(IStructuredDocumentRegion flatNode) {
+ if (fOldStructuredDocumentRegions != null) {
+ for (Enumeration e = fOldStructuredDocumentRegions.elements(); e.hasMoreElements();) {
+ if (e.nextElement() == flatNode) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ void setupContext(IStructuredDocumentRegionList newStructuredDocumentRegions, IStructuredDocumentRegionList oldStructuredDocumentRegions) {
+ IStructuredDocumentRegion flatNode = null;
+ fOldLength = CSSUtil.getTextLength(oldStructuredDocumentRegions);
+ if (oldStructuredDocumentRegions != null && 0 < oldStructuredDocumentRegions.getLength() && (flatNode = oldStructuredDocumentRegions.item(0)) != null) {
+ fOldStart = flatNode.getStart();
+ }
+ else {
+ fOldStart = -1;
+ }
+ fNewLength = CSSUtil.getTextLength(newStructuredDocumentRegions);
+ if (newStructuredDocumentRegions != null && 0 < newStructuredDocumentRegions.getLength() && (flatNode = newStructuredDocumentRegions.item(0)) != null) {
+ fNewStart = flatNode.getStart();
+ fRemovedRangeBegin = fNewStart;
+ fRemovedRangeEnd = fNewStart + fNewLength;
+ }
+ else {
+ fNewStart = -1;
+ fRemovedRangeBegin = fRemovedRangeEnd = -1;
+ }
+ fLengthDifference = fNewLength - fOldLength;
+ fOldStructuredDocumentRegions = oldStructuredDocumentRegions;
+
+ // cleanup nodes
+ while (0 < fNodesToBeRemoved.getLength()) {
+ fNodesToBeRemoved.removeNode(0);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelImpl.java
new file mode 100644
index 0000000000..1d98f57a45
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelImpl.java
@@ -0,0 +1,677 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.core.event.ICSSStyleListener;
+import org.eclipse.wst.css.core.internal.event.CSSEmbededStyleNotifyAdapter;
+import org.eclipse.wst.css.core.internal.event.CSSStyleNotifyAdapter;
+import org.eclipse.wst.css.core.internal.parser.CSSSourceParser;
+import org.eclipse.wst.css.core.util.ImportRuleCollector;
+import org.eclipse.wst.css.core.util.ImportedCollector;
+import org.eclipse.wst.css.core.util.SelectorsCollector;
+import org.eclipse.wst.sse.core.AbstractStructuredModel;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.events.IStructuredDocumentListener;
+import org.eclipse.wst.sse.core.events.NewDocumentEvent;
+import org.eclipse.wst.sse.core.events.NoChangeEvent;
+import org.eclipse.wst.sse.core.events.RegionChangedEvent;
+import org.eclipse.wst.sse.core.events.RegionsReplacedEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.exceptions.ResourceInUse;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.util.Assert;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+
+public class CSSModelImpl extends AbstractStructuredModel implements ICSSModel, IStructuredDocumentListener {
+
+ private CSSDocumentImpl document = null;
+ private org.w3c.dom.Node ownerNode = null;
+ private CSSStyleNotifyAdapter styleNotifier = null;
+ private CSSModelParser fParser = null;
+ private CSSModelUpdater fUpdater = null;
+ private boolean fStructuredDocumentUpdate = false;
+ private final static String ID_NON_EXTERNAL_CSS = "**_NON_EXTERNAL_CSS_***";//$NON-NLS-1$
+
+ /**
+ * CSSModelImpl constructor comment.
+ *
+ */
+ public CSSModelImpl() {
+ super();
+ }
+
+ /**
+ * @param listener
+ * org.eclipse.wst.css.core.event.CSSStyleListener
+ */
+ public void addStyleListener(ICSSStyleListener listener) {
+ getStyleNotifier().addStyleListener(listener);
+ }
+
+ /**
+ * @param parentNode
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param newAttr
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param oldAttr
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ void attrReplaced(CSSNodeImpl parentNode, CSSNodeImpl newAttr, CSSNodeImpl oldAttr) {
+ if (!fStructuredDocumentUpdate) {
+ CSSModelUpdater updater = getUpdater();
+ updater.attrReplaced(parentNode, newAttr, oldAttr);
+ }
+
+ ICSSSelector removed[] = null, added[] = null;
+ if (oldAttr != null && oldAttr.getNodeType() == ICSSNode.ATTR_NODE && ((CSSAttrImpl) oldAttr).getName().equals(ICSSStyleRule.SELECTOR)) {
+ CSSAttrImpl attr = (CSSAttrImpl) oldAttr;
+ // collect changed selector
+ ICSSSelectorList list = new CSSSelectorListImpl(attr.getValue());
+ removed = new ICSSSelector[list.getLength()];
+ for (int i = 0; i < list.getLength(); i++)
+ removed[i] = list.getSelector(i);
+ }
+ if (newAttr != null && newAttr.getNodeType() == ICSSNode.ATTR_NODE && ((CSSAttrImpl) newAttr).getName().equals(ICSSStyleRule.SELECTOR)) {
+ CSSAttrImpl attr = (CSSAttrImpl) newAttr;
+ // collect changed selector
+ ICSSSelectorList list = new CSSSelectorListImpl(attr.getValue());
+ added = new ICSSSelector[list.getLength()];
+ for (int i = 0; i < list.getLength(); i++)
+ added[i] = list.getSelector(i);
+ }
+ if (removed != null || added != null || getDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
+ getStyleNotifier().fire(removed, added, null);
+ }
+ // for href attribute
+ if (getStyleListeners() != null && getStyleListeners().size() > 0) {
+ boolean update = false;
+ if (oldAttr != null && oldAttr.getNodeType() == ICSSNode.ATTR_NODE && ((CSSAttrImpl) oldAttr).getName().equals(ICSSImportRule.HREF)) {
+ update = true;
+ }
+ if (newAttr != null && newAttr.getNodeType() == ICSSNode.ATTR_NODE && ((CSSAttrImpl) newAttr).getName().equals(ICSSImportRule.HREF)) {
+ update = true;
+ }
+ if (update)
+ ((ICSSImportRule) parentNode).getStyleSheet();
+ }
+ }
+
+ /**
+ *
+ */
+ public void beginRecording(Object requester, String label, String description) {
+ getStyleNotifier().beginRecording();
+
+ Node node = getOwnerDOMNode();
+ if (node != null && node instanceof XMLNode) {
+ IStructuredModel model = ((XMLNode) node).getModel();
+ if (model != null) {
+ model.beginRecording(requester, label, description);
+ return;
+ }
+ }
+ super.beginRecording(requester, label, description);
+ }
+
+ /**
+ * @param parentNode
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param newChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param oldChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ void childReplaced(CSSNodeImpl parentNode, CSSNodeImpl newChild, CSSNodeImpl oldChild) {
+ if (!fStructuredDocumentUpdate) {
+ CSSModelUpdater updater = getUpdater();
+ updater.childReplaced(parentNode, newChild, oldChild);
+ }
+
+ // always check and send selector event
+ ICSSSelector removed[] = null, added[] = null;
+ if (parentNode.getNodeType() == ICSSNode.STYLESHEET_NODE || parentNode.getNodeType() == ICSSNode.MEDIARULE_NODE) {
+ // collect old selectors
+ SelectorsCollector selTrav = new SelectorsCollector();
+ selTrav.apply(oldChild);
+ int nSel = selTrav.getSelectors().size();
+ if (nSel > 0) {
+ removed = new ICSSSelector[nSel];
+ for (int i = 0; i < nSel; i++)
+ removed[i] = (ICSSSelector) selTrav.getSelectors().get(i);
+ }
+ // collect new selectors
+ selTrav = new SelectorsCollector();
+ selTrav.apply(newChild);
+ nSel = selTrav.getSelectors().size();
+ if (nSel > 0) {
+ added = new ICSSSelector[nSel];
+ for (int i = 0; i < nSel; i++)
+ added[i] = (ICSSSelector) selTrav.getSelectors().get(i);
+ }
+ }
+ else {
+ // modification
+ ICSSNode rule = parentNode;
+ while (rule != null) {
+ if (rule instanceof ICSSStyleRule)
+ break;
+ rule = rule.getParentNode();
+ }
+ if (rule != null) {
+ ICSSSelectorList list = ((ICSSStyleRule) rule).getSelectors();
+ added = new ICSSSelector[list.getLength()];
+ for (int i = 0; i < list.getLength(); i++)
+ added[i] = list.getSelector(i);
+ }
+ }
+ if (removed != null || added != null || getDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
+ // send selector changed event
+ getStyleNotifier().fire(removed, added, null);
+ }
+ // close removed import-rule's external style sheets
+ {
+ ImportRuleCollector trav = new ImportRuleCollector();
+ trav.apply(oldChild);
+ Iterator it = trav.getRules().iterator();
+ while (it.hasNext()) {
+ ((CSSImportRuleImpl) it.next()).closeStyleSheet();
+ }
+ }
+ // send events to listener for new import-rules
+ if (getStyleListeners() != null && getStyleListeners().size() > 0) {
+ ImportedCollector trav = new ImportedCollector();
+ trav.apply(newChild);
+ }
+ }
+
+ /**
+ *
+ */
+ private void closeImported() {
+ if (!isShared()) {
+ // release listeners
+ if (getStyleListeners() != null) {
+ Vector toRemove = new Vector(getStyleListeners());
+ Iterator it = toRemove.iterator();
+ while (it.hasNext()) {
+ removeStyleListener((ICSSStyleListener) it.next());
+ }
+ }
+ // close import rules
+ ImportRuleCollector trav = new ImportRuleCollector();
+ trav.apply(getDocument());
+ Iterator it2 = trav.getRules().iterator();
+ while (it2.hasNext()) {
+ ((CSSImportRuleImpl) it2.next()).releaseRule();
+ }
+ }
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSDocumentImpl
+ */
+ private CSSDocumentImpl createDocument() {
+ CSSDocumentImpl doc = null;
+ int parserMode = CSSSourceParser.MODE_STYLESHEET;
+ if (ownerNode == null) {
+ // this case is external CSS file
+ doc = (CSSStyleSheetImpl) DOMCSSImpl.createCSSStyleSheet(null, null); // parameters
+ // are
+ // for
+ // STYLE-tag
+ parserMode = CSSSourceParser.MODE_STYLESHEET;
+ }
+ else if (ownerNode instanceof org.w3c.dom.Element && ((Element) ownerNode).getTagName().toUpperCase().equals("STYLE")) {//$NON-NLS-1$
+ // this case is STYLE-tag
+ Element style = (Element) ownerNode;
+ doc = (CSSStyleSheetImpl) DOMCSSImpl.createCSSStyleSheet(style.getAttribute("TITLE"), //$NON-NLS-1$
+ style.getAttribute("MEDIA"));//$NON-NLS-1$
+ parserMode = CSSSourceParser.MODE_STYLESHEET;
+ }
+ else if (ownerNode instanceof org.w3c.dom.Element || ownerNode instanceof org.w3c.dom.Attr) {
+ // Inline attributes
+ doc = (CSSStyleDeclarationImpl) DOMCSSImpl.createCSSStyleDeclaration();
+ parserMode = CSSSourceParser.MODE_DECLARATION;
+ }
+ RegionParser regionParser = getStructuredDocument().getParser();
+ if (regionParser instanceof CSSSourceParser) {
+ ((CSSSourceParser) regionParser).setParserMode(parserMode);
+ }
+ return doc;
+ }
+
+ /**
+ *
+ */
+ public void endRecording(Object requester) {
+ Node node = getOwnerDOMNode();
+ if (node != null && node instanceof XMLNode) {
+ IStructuredModel model = ((XMLNode) node).getModel();
+ if (model != null) {
+ model.endRecording(requester);
+ return;
+ }
+ }
+ super.endRecording(requester);
+
+ getStyleNotifier().endRecording();
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSDocument
+ */
+ public ICSSDocument getDocument() {
+ if (document == null) {
+ this.document = createDocument();
+ this.document.setModel(this);
+ }
+ return this.document;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.IStructuredDocument
+ */
+ public IStructuredDocument getStructuredDocument() {
+ IStructuredDocument structuredDocument = super.getStructuredDocument();
+ if (structuredDocument != null)
+ return structuredDocument;
+
+ // the first time
+ Assert.isNotNull(getModelHandler());
+ structuredDocument = (IStructuredDocument) getModelHandler().getDocumentLoader().createNewStructuredDocument();
+ // structuredDocument = new
+ // com.ibm.sed.structuredDocument.impl.IStructuredDocument(IStructuredModel.CSS);
+ // CSSStructuredDocumentReParser reParser = new
+ // CSSStructuredDocumentReParser();
+ // reParser.setStructuredDocument(structuredDocument);
+ // ((com.ibm.sed.structuredDocument.impl.IStructuredDocument)structuredDocument).setReParser(reParser);
+
+ setStructuredDocument(structuredDocument);
+
+ return structuredDocument;
+ }
+
+ /**
+ * getNode method comment.
+ */
+ public IndexedRegion getIndexedRegion(int offset) {
+ if (getDocument() == null)
+ return null;
+ return ((CSSStructuredDocumentRegionContainer) getDocument()).getContainerNode(offset);
+ }
+
+ /**
+ * @return org.w3c.dom.Node
+ */
+ public Node getOwnerDOMNode() {
+ return ownerNode;
+ }
+
+ /**
+ * @param ownerNode
+ * org.w3c.dom.Node if the case of external CSS model, you
+ * should set null, else if internal css, you should set
+ * STYLE-tag node, else if inline css, you should set the
+ * element that is the owner of style-attribute.
+ */
+ public void setOwnerDOMNode(Node node) {
+ // prohibit owner change
+ Assert.isTrue(ownerNode == null);
+ ownerNode = node;
+ if (ownerNode != null) { // for internal/inline CSS context
+ try {
+ setId(ID_NON_EXTERNAL_CSS);
+ }
+ catch (ResourceInUse e) {
+ // impossible
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSModelParser getParser() {
+ if (fParser == null) {
+ if (getDocument() != null) {
+ fParser = new CSSModelParser(document);
+ }
+ }
+ return fParser;
+ }
+
+ /**
+ * @return java.util.List
+ */
+ public List getStyleListeners() {
+ return getStyleNotifier().getStyleListeners();
+ }
+
+ /**
+ *
+ * @return java.lang.Object
+ */
+ public java.lang.Object getStyleSheetType() {
+ if (getDocument() instanceof ICSSStyleDeclaration)
+ return INLINE;
+ if (getOwnerDOMNode() != null)
+ return EMBEDDED;
+ else
+ return EXTERNAL;
+ }
+
+ private CSSStyleNotifyAdapter getStyleNotifier() {
+ if (styleNotifier == null) {
+ styleNotifier = (ownerNode != null) ? new CSSEmbededStyleNotifyAdapter(this) : new CSSStyleNotifyAdapter(this);
+ }
+ return styleNotifier;
+ }
+
+ /**
+ *
+ */
+ private CSSModelUpdater getUpdater() {
+ if (fUpdater == null) {
+ fUpdater = new CSSModelUpdater(this);
+ fUpdater.setParser(getParser());
+ }
+ return fUpdater;
+ }
+
+ /**
+ */
+ public boolean isRecording() {
+ return getStyleNotifier().isRecording();
+ }
+
+ /**
+ * This function returns true if there are other references to the
+ * underlying model.
+ */
+ public boolean isShared() {
+ return (getStyleSheetType() == EXTERNAL) && super.isShared();
+ }
+
+ /**
+ * @param structuredDocumentEvent
+ * com.ibm.sed.structuredDocument.events.NewModelEvent
+ */
+ public void newModel(NewDocumentEvent structuredDocumentEvent) {
+ if (structuredDocumentEvent == null)
+ return;
+ IStructuredDocument structuredDocument = structuredDocumentEvent.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ // this should not happen, but for the case
+ if (structuredDocument != getStructuredDocument())
+ setStructuredDocument(structuredDocument);
+ IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
+ if (flatNodes == null)
+ return;
+ if (getDocument() == null)
+ return;
+
+ fStructuredDocumentUpdate = true;
+
+ ((CSSStructuredDocumentRegionContainer) getDocument()).removeChildNodes();
+
+ CSSModelParser parser = getParser();
+ parser.setStructuredDocumentEvent(structuredDocumentEvent);
+ parser.replaceStructuredDocumentRegions(flatNodes, null);
+
+ fStructuredDocumentUpdate = false;
+ }
+
+ /**
+ * noChange method comment.
+ */
+ public void noChange(NoChangeEvent structuredDocumentEvent) {
+ // nop
+ }
+
+ /**
+ * @param structuredDocumentEvent
+ * com.ibm.sed.structuredDocument.events.StructuredDocumentRegionsReplacedEvent
+ */
+ public void nodesReplaced(StructuredDocumentRegionsReplacedEvent structuredDocumentEvent) {
+ if (structuredDocumentEvent == null) {
+ return;
+ }
+ IStructuredDocumentRegionList oldStructuredDocumentRegions = structuredDocumentEvent.getOldStructuredDocumentRegions();
+ IStructuredDocumentRegionList newStructuredDocumentRegions = structuredDocumentEvent.getNewStructuredDocumentRegions();
+ if (oldStructuredDocumentRegions == null && newStructuredDocumentRegions == null) {
+ return;
+ }
+
+ fStructuredDocumentUpdate = true;
+
+ CSSModelParser parser = getParser();
+ parser.setStructuredDocumentEvent(structuredDocumentEvent);
+ parser.replaceStructuredDocumentRegions(newStructuredDocumentRegions, oldStructuredDocumentRegions);
+
+ fStructuredDocumentUpdate = false;
+ }
+
+ /**
+ * cleanup -> rebuild CSS Nodes This is pre-beta fix for 178176.
+ */
+ public void refreshNodes() {
+ // cleanup old nodes
+ fStructuredDocumentUpdate = true;
+ ((CSSStructuredDocumentRegionContainer) getDocument()).removeChildNodes();
+ fStructuredDocumentUpdate = false;
+
+ getParser().cleanupUpdateContext();
+
+ IStructuredDocument structuredDocument = getStructuredDocument();
+ String source = structuredDocument.getText();
+
+ structuredDocument.replaceText(this, 0, source.length(), null);
+ structuredDocument.replaceText(this, 0, 0, source);
+ }
+
+ /**
+ * @param structuredDocumentEvent
+ * com.ibm.sed.structuredDocument.events.RegionChangedEvent
+ */
+ public void regionChanged(RegionChangedEvent structuredDocumentEvent) {
+ if (structuredDocumentEvent == null) {
+ return;
+ }
+ IStructuredDocumentRegion flatNode = structuredDocumentEvent.getStructuredDocumentRegion();
+ if (flatNode == null) {
+ return;
+ }
+ ITextRegion region = structuredDocumentEvent.getRegion();
+ if (region == null) {
+ return;
+ }
+
+ fStructuredDocumentUpdate = true;
+
+ CSSModelParser parser = getParser();
+ parser.setStructuredDocumentEvent(structuredDocumentEvent);
+ parser.changeRegion(flatNode, region);
+
+ fStructuredDocumentUpdate = false;
+ }
+
+ /**
+ * @param structuredDocumentEvent
+ * com.ibm.sed.structuredDocument.events.RegionsReplacedEvent
+ */
+ public void regionsReplaced(RegionsReplacedEvent structuredDocumentEvent) {
+ if (structuredDocumentEvent == null)
+ return;
+ IStructuredDocumentRegion flatNode = structuredDocumentEvent.getStructuredDocumentRegion();
+ if (flatNode == null)
+ return;
+ ITextRegionList oldRegions = structuredDocumentEvent.getOldRegions();
+ ITextRegionList newRegions = structuredDocumentEvent.getNewRegions();
+ if (oldRegions == null && newRegions == null)
+ return;
+
+ fStructuredDocumentUpdate = true;
+
+ CSSModelParser parser = getParser();
+ parser.setStructuredDocumentEvent(structuredDocumentEvent);
+ parser.replaceRegions(flatNode, newRegions, oldRegions);
+
+ fStructuredDocumentUpdate = false;
+
+ }
+
+ /**
+ *
+ */
+ public void releaseFromEdit() {
+ closeImported();
+ if (getStyleSheetType() == EXTERNAL) {
+ super.releaseFromEdit();
+ }
+ }
+
+ /**
+ *
+ */
+ public void releaseFromRead() {
+ closeImported();
+ if (getStyleSheetType() == EXTERNAL) {
+ super.releaseFromRead();
+ }
+ }
+
+ /**
+ * @param listener
+ * org.eclipse.wst.css.core.event.CSSStyleListener
+ */
+ public void removeStyleListener(ICSSStyleListener listener) {
+ getStyleNotifier().removeStyleListener(listener);
+ }
+
+ /**
+ * @param newStructuredDocument
+ * com.ibm.sed.structuredDocument.IStructuredDocument
+ */
+ public void setStructuredDocument(IStructuredDocument newStructuredDocument) {
+ IStructuredDocument oldStructuredDocument = super.getStructuredDocument();
+ if (newStructuredDocument == oldStructuredDocument)
+ return; // noting to do
+
+ if (oldStructuredDocument != null)
+ oldStructuredDocument.removeDocumentChangingListener(this);
+ super.setStructuredDocument(newStructuredDocument);
+ if (newStructuredDocument.getLength() > 0) {
+ newModel(new NewDocumentEvent(newStructuredDocument, this));
+ }
+ if (newStructuredDocument != null)
+ newStructuredDocument.addDocumentChangingListener(this);
+ }
+
+ /**
+ * @param srcModel
+ * com.imb.sed.css.mode.intefaces.ICSSModel
+ * @param removed
+ * org.eclipse.wst.css.core.model.interfaces.ICSSSelector[]
+ * @param added
+ * org.eclipse.wst.css.core.model.interfaces.ICSSSelector[]
+ */
+ public void styleChanged(ICSSModel srcModel, ICSSSelector[] removed, ICSSSelector[] added, String media) {
+ getStyleNotifier().styleChanged(srcModel, removed, added, media);
+ }
+
+ /**
+ * @param srcModel
+ * org.eclipse.wst.css.core.model.interfaces.ICSSModel
+ */
+ public void styleUpdate(ICSSModel srcModel) {
+ getStyleNotifier().styleUpdate(srcModel);
+ }
+
+ /**
+ * @param node
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ void valueChanged(CSSNodeImpl node, String oldValue) {
+ if (!fStructuredDocumentUpdate) {
+ CSSModelUpdater updater = getUpdater();
+ updater.valueChanged(node, oldValue);
+ }
+
+ ICSSSelector removed[] = null, added[] = null;
+ if (node != null) {
+ if (node.getNodeType() == ICSSNode.ATTR_NODE && ((CSSAttrImpl) node).getName().equals(ICSSStyleRule.SELECTOR)) {
+ CSSAttrImpl attr = (CSSAttrImpl) node;
+ // collect changed selector
+ ICSSSelectorList list = new CSSSelectorListImpl(attr.getValue());
+ added = new ICSSSelector[list.getLength()];
+ for (int i = 0; i < list.getLength(); i++)
+ added[i] = list.getSelector(i);
+
+ // get old value
+ list = new CSSSelectorListImpl(oldValue);
+ removed = new ICSSSelector[list.getLength()];
+ for (int i = 0; i < list.getLength(); i++)
+ removed[i] = list.getSelector(i);
+ }
+ else if (node instanceof ICSSValue) {
+ ICSSNode rule = node;
+ while (rule != null) {
+ if (rule instanceof ICSSStyleRule)
+ break;
+ rule = rule.getParentNode();
+ }
+ if (rule != null) {
+ ICSSSelectorList list = ((ICSSStyleRule) rule).getSelectors();
+ added = new ICSSSelector[list.getLength()];
+ for (int i = 0; i < list.getLength(); i++)
+ added[i] = list.getSelector(i);
+ }
+ }
+ }
+ if (removed != null || added != null || getDocument().getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
+ // send selector changed event
+ getStyleNotifier().fire(removed, added, null);
+ }
+ // for href attribute
+ if (getStyleListeners() != null && getStyleListeners().size() > 0) {
+ if (node != null && node.getNodeType() == ICSSNode.ATTR_NODE && ((CSSAttrImpl) node).getName().equals(ICSSImportRule.HREF)) {
+ ((ICSSImportRule) ((ICSSAttr) node).getOwnerCSSNode()).getStyleSheet();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelNodeFeeder.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelNodeFeeder.java
new file mode 100644
index 0000000000..0f50a99cfc
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelNodeFeeder.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+/**
+ *
+ */
+class CSSModelNodeFeeder {
+
+ CSSDocumentImpl fDocument = null;
+ CSSModelUpdateContext fUpdateContext = null;
+
+ /**
+ * CSSModelNodeFeeder constructor comment.
+ */
+ CSSModelNodeFeeder() {
+ super();
+ }
+
+ /**
+ * CSSModelNodeFeeder constructor comment.
+ */
+ CSSModelNodeFeeder(CSSDocumentImpl document, CSSModelUpdateContext updateContext) {
+ super();
+ fDocument = document;
+ fUpdateContext = updateContext;
+ }
+
+ /**
+ *
+ */
+ CSSCharsetRuleImpl getCSSCharsetRule() {
+ CSSCharsetRuleImpl node;
+ if (fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSCharsetRule();
+ }
+ else {
+ node = (CSSCharsetRuleImpl) fDocument.createCSSCharsetRule();
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ CSSFontFaceRuleImpl getCSSFontFaceRule() {
+ CSSFontFaceRuleImpl node;
+ if (fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSFontFaceRule();
+ }
+ else {
+ node = (CSSFontFaceRuleImpl) fDocument.createCSSFontFaceRule();
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ CSSImportRuleImpl getCSSImportRule() {
+ CSSImportRuleImpl node;
+ if (fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSImportRule();
+ }
+ else {
+ node = (CSSImportRuleImpl) fDocument.createCSSImportRule();
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ CSSMediaRuleImpl getCSSMediaRule() {
+ CSSMediaRuleImpl node;
+ if (fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSMediaRule();
+ }
+ else {
+ node = (CSSMediaRuleImpl) fDocument.createCSSMediaRule();
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ CSSPageRuleImpl getCSSPageRule() {
+ CSSPageRuleImpl node;
+ if (fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSPageRule();
+ }
+ else {
+ node = (CSSPageRuleImpl) fDocument.createCSSPageRule();
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ CSSStyleRuleImpl getCSSStyleRule() {
+ CSSStyleRuleImpl node;
+ if (fUpdateContext.isActive()) {
+ node = fUpdateContext.getCSSStyleRule();
+ }
+ else {
+ node = (CSSStyleRuleImpl) fDocument.createCSSStyleRule();
+ }
+ return node;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelParser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelParser.java
new file mode 100644
index 0000000000..c860c508a6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelParser.java
@@ -0,0 +1,1281 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSRuleContainer;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.internal.text.StructuredDocumentWalker;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.text.CoreNodeList;
+import org.eclipse.wst.sse.core.internal.text.TextRegionListImpl;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.util.Assert;
+import org.w3c.dom.css.CSSFontFaceRule;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSStyleDeclaration;
+
+
+/**
+ *
+ */
+class CSSModelParser {
+
+ private CSSDocumentImpl fDocument = null;
+ private CSSModelCreationContext fCreationContext = null;
+ private CSSModelDeletionContext fDeletionContext = null;
+ private CSSModelUpdateContext fUpdateContext = null;
+ private CSSModelNodeFeeder fFeeder = null;
+ private StructuredDocumentWalker fStructuredDocumentWalker = null;
+ private boolean fParseFloating = false;
+
+ /**
+ * CSSModelParser constructor comment.
+ */
+ private CSSModelParser() {
+ super();
+ }
+
+ /**
+ *
+ */
+ CSSModelParser(CSSDocumentImpl doc) {
+ super();
+ fDocument = doc;
+ fCreationContext = new CSSModelCreationContext(doc);
+ fDeletionContext = new CSSModelDeletionContext(doc);
+ fUpdateContext = new CSSModelUpdateContext();
+ fFeeder = new CSSModelNodeFeeder(doc, fUpdateContext);
+ }
+
+ /**
+ *
+ */
+ void changeStructuredDocumentRegion(IStructuredDocumentRegion flatNode) {
+ replaceStructuredDocumentRegions(new CoreNodeList(flatNode, flatNode), new CoreNodeList(flatNode, flatNode));
+ }
+
+ /**
+ *
+ */
+ void changeRegion(IStructuredDocumentRegion flatNode, ITextRegion region) {
+ if (flatNode == null || region == null) {
+ return;
+ }
+ if (fDocument == null) {
+ return;
+ }
+
+ changeStructuredDocumentRegion(flatNode);
+ }
+
+ /**
+ *
+ */
+ private void checkNextNode(IStructuredDocumentRegion flatNode, String type) {
+ IStructuredDocumentRegion next = CSSUtil.findNextSignificantNode(flatNode);
+ if (CSSUtil.getStructuredDocumentRegionType(next) == type) {
+ fCreationContext.setReparseStart(flatNode.getEnd());
+ fCreationContext.setReparseEnd(next.getEnd());
+ }
+ }
+
+ /**
+ *
+ */
+ private void cleanupDeletionContext() {
+ // setupDeletionContext(null);
+ }
+
+ /**
+ *
+ */
+ boolean cleanupFirstNode(IStructuredDocumentRegion firstNode, CSSStructuredDocumentRegionContainer target) {
+ if (firstNode == null || target == null) {
+ return false;
+ }
+
+ if (firstNode == target.getFirstStructuredDocumentRegion()) {
+ IStructuredDocumentRegion nextNode = fStructuredDocumentWalker.getNextNodeInCurrent(firstNode);
+ IStructuredDocumentRegion lastNode = target.getLastStructuredDocumentRegion();
+ if (lastNode == null || fStructuredDocumentWalker.isOldNode(lastNode) || nextNode == null || lastNode.getStartOffset() < nextNode.getStartOffset()) {
+ target.setRangeStructuredDocumentRegion(null, null);
+ }
+ else {
+ target.setFirstStructuredDocumentRegion(nextNode);
+ }
+ ICSSNode parent = target.getParentNode();
+ if (parent instanceof CSSStructuredDocumentRegionContainer) {
+ cleanupFirstNode(firstNode, (CSSStructuredDocumentRegionContainer) parent);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ boolean cleanupLastNode(IStructuredDocumentRegion lastNode, CSSStructuredDocumentRegionContainer target) {
+ if (lastNode == null || target == null) {
+ return false;
+ }
+
+ if (lastNode == target.getLastStructuredDocumentRegion()) {
+ IStructuredDocumentRegion prevNode = fStructuredDocumentWalker.getPrevNodeInCurrent(lastNode);
+ IStructuredDocumentRegion firstNode = target.getFirstStructuredDocumentRegion();
+ if (firstNode == null || fStructuredDocumentWalker.isOldNode(firstNode) || prevNode == null || prevNode.getStartOffset() < firstNode.getStartOffset()) {
+ target.setRangeStructuredDocumentRegion(null, null);
+ }
+ else {
+ target.setLastStructuredDocumentRegion(prevNode);
+ }
+ ICSSNode parent = target.getParentNode();
+ if (parent instanceof CSSStructuredDocumentRegionContainer) {
+ cleanupLastNode(lastNode, (CSSStructuredDocumentRegionContainer) parent);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ int cleanupUpdateContext() {
+ int remains = fUpdateContext.getNodeCount();
+ fUpdateContext.cleanupContext();
+ return remains;
+ }
+
+ /**
+ * create floating CSS rule (owner document will be set) this is for
+ * CSSStyleSheet.createCSSRule(String)
+ *
+ * @return org.w3c.dom.css.CSSRule
+ * @param flatNodes
+ * com.ibm.sed.structuredDocument.IStructuredDocumentRegionList
+ */
+ CSSRule createCSSRule(IStructuredDocumentRegionList flatNodes) {
+ if (flatNodes == null) {
+ return null;
+ }
+
+ fParseFloating = true;
+
+ // setup creation context
+ fCreationContext.clear();
+ fCreationContext.setTargetNode(null);
+ fCreationContext.setNextNode(null);
+ CSSRuleImpl parentRule = null;
+
+ for (Enumeration e = flatNodes.elements(); e.hasMoreElements();) {
+ IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) e.nextElement();
+ if (flatNode == null) {
+ continue;
+ }
+ CSSNodeImpl modified = insertStructuredDocumentRegion(flatNode);
+ if (parentRule == null && modified instanceof CSSRuleImpl) {
+ parentRule = (CSSRuleImpl) modified;
+ }
+ }
+
+ fParseFloating = false;
+
+ if (parentRule != null) {
+ CSSModelUtil.cleanupContainer(parentRule);
+ }
+
+ return parentRule;
+ }
+
+ /**
+ *
+ */
+ private IStructuredDocumentRegion findBraceClose(int depth, IStructuredDocumentRegion start, boolean bBreakSibling) {
+ IStructuredDocumentRegion result = null;
+ int braceLevel = 0;
+ IStructuredDocumentRegion prevNode = null;
+ IStructuredDocumentRegion region = start.getNext();
+ for (; region != null; region = region.getNext()) {
+ int offset = region.getStart();
+ if (offset < 0) {
+ Assert.isTrue(false);
+ break;
+ }
+ CSSNodeImpl node = getNodeAt(offset);
+ int depthHit = (node != null) ? CSSModelUtil.getDepth(node) : -1;
+ if (depth <= depthHit) {
+ // sibling is found before "}"
+ if (bBreakSibling) {
+ CSSNodeImpl parent = (CSSNodeImpl) node.getParentNode();
+ while (depth <= CSSModelUtil.getDepth(parent)) {
+ node = parent;
+ parent = (CSSNodeImpl) parent.getParentNode();
+ }
+ if (parent != null && node != null) {
+ parent.removeChild(node);
+ }
+ }
+ else {
+ result = prevNode;
+ break;
+ }
+ }
+ String type = CSSUtil.getStructuredDocumentRegionType(region);
+ if (type == CSSRegionContexts.CSS_LBRACE) {
+ braceLevel++;
+ }
+ if (type == CSSRegionContexts.CSS_RBRACE) {
+ braceLevel--;
+ if (braceLevel < 0) {
+ result = region;
+ break;
+ }
+ }
+ prevNode = region;
+ }
+
+ if (result == null && region == null) {
+ // reach the end of document
+ result = prevNode;
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ */
+ private IStructuredDocumentRegionList getStructuredDocumentRegionList(int start, int end) {
+ IStructuredDocumentRegionList nodeList = null;
+ if (0 <= start && start <= end) {
+ ICSSModel model = fDocument.getModel();
+ if (model instanceof CSSModelImpl) {
+ IStructuredDocument structuredDocument = ((CSSModelImpl) model).getStructuredDocument();
+ if (structuredDocument != null) {
+ IStructuredDocumentRegion startNode = structuredDocument.getRegionAtCharacterOffset(start);
+ IStructuredDocumentRegion endNode = structuredDocument.getRegionAtCharacterOffset(end - 1);
+ if (startNode != null && endNode != null) {
+ nodeList = new CoreNodeList(startNode, endNode);
+ }
+ }
+ }
+ }
+
+ return nodeList;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl getNodeAt(int offset) {
+ CSSNodeImpl rootNode = fCreationContext.getRootNode();
+ ICSSNode target = rootNode.getNodeAt(offset);
+ if (target instanceof CSSNodeImpl) {
+ return (CSSNodeImpl) target;
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertBraceClose(IStructuredDocumentRegion region) {
+ ICSSNode target = CSSModelUtil.findBraceContainer(fCreationContext.getTargetNode());
+
+ if (!(target instanceof CSSStructuredDocumentRegionContainer)) {
+ return null;
+ }
+
+ CSSStructuredDocumentRegionContainer parent = (CSSStructuredDocumentRegionContainer) target;
+ if (CSSModelUtil.isInterruption(parent, region)) {
+ ICSSNode node = parent.getParentNode();
+ if (node instanceof CSSNodeImpl) {
+ fCreationContext.setReparseStart(parent.getStartOffset());
+ fCreationContext.setReparseEnd(parent.getEndOffset());
+ ((CSSNodeImpl) node).removeChild(parent);
+ }
+ return null;
+ }
+
+ if (parent instanceof ICSSPageRule || parent instanceof ICSSMediaRule || parent instanceof CSSFontFaceRule || parent instanceof ICSSStyleRule) {
+ CSSModelUtil.expandStructuredDocumentRegionContainer(parent, region);
+ if (!CSSModelUtil.isBraceClosed(target)) {
+ fCreationContext.setTargetNode(parent.getParentNode());
+ fCreationContext.setNextNode(parent.getNextSibling());
+ return parent;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertBraceOpen(IStructuredDocumentRegion region) {
+ IStructuredDocumentRegion keyRegion = CSSUtil.findPreviousSignificantNode(region);
+ if (keyRegion == null) {
+ return null;
+ }
+ if (!fParseFloating) {
+ CSSNodeImpl node = getNodeAt(keyRegion.getStartOffset());
+ if (node != null && !(node instanceof ICSSRuleContainer)) {
+ return null;
+ }
+ }
+ String type = CSSUtil.getStructuredDocumentRegionType(keyRegion);
+
+ CSSNodeImpl inserted = null;
+ if (type == CSSRegionContexts.CSS_PAGE) {
+ inserted = insertPageRule(keyRegion, region);
+ }
+ else if (type == CSSRegionContexts.CSS_MEDIA) {
+ inserted = insertMediaRule(keyRegion, region);
+ }
+ else if (type == CSSRegionContexts.CSS_FONT_FACE) {
+ inserted = insertFontFaceRule(keyRegion, region);
+ }
+ else if (CSSUtil.isSelectorText(keyRegion)) {
+ inserted = insertStyleRule(keyRegion, region);
+ }
+
+ if (inserted instanceof CSSStructuredDocumentRegionContainer) {
+ // CSSModelUtil.expandStructuredDocumentRegionContainer((CSSStructuredDocumentRegionContainer)inserted,
+ // flatNode);
+ IStructuredDocumentRegion braceClose = findBraceClose(CSSModelUtil.getDepth(inserted), region, (type == CSSRegionContexts.CSS_MEDIA));
+ if (braceClose != null) {
+ fCreationContext.setReparseStart(region.getEnd());
+ fCreationContext.setReparseEnd(braceClose.getEnd());
+ }
+ }
+
+ return inserted;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertCharsetRule(IStructuredDocumentRegion beginDocRegion, IStructuredDocumentRegion endDocRegion) {
+ CSSNodeImpl parent = fCreationContext.getTargetNode();
+ if (!fParseFloating && !(parent instanceof ICSSRuleContainer)) {
+ return null;
+ }
+
+ ITextRegionList regions = new TextRegionListImpl(beginDocRegion.getRegions());
+ regions.remove(0); // must be "@charset"
+ ITextRegion encodingRegion = null;
+ while (!regions.isEmpty()) {
+ ITextRegion textRegion = regions.remove(0);
+ if (textRegion == null) {
+ continue;
+ }
+ String type = textRegion.getType();
+ if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) {
+ continue;
+ }
+ if (type == CSSRegionContexts.CSS_STRING) {
+ encodingRegion = textRegion;
+ break;
+ }
+ else {
+ break;
+ }
+ }
+ if (encodingRegion == null) {
+ return null;
+ }
+
+ CSSCharsetRuleImpl rule = fFeeder.getCSSCharsetRule();
+ if (rule == null) {
+ return null;
+ }
+
+ if (!fUpdateContext.isActive()) {
+ rule.setAttribute(ICSSCharsetRule.ENCODING, beginDocRegion.getText(encodingRegion));
+ }
+
+ // setup flat container
+ rule.setRangeStructuredDocumentRegion(beginDocRegion, endDocRegion);
+ CSSAttrImpl attr = rule.getAttributeNode(ICSSCharsetRule.ENCODING);
+ if (attr != null) {
+ attr.setRangeRegion(beginDocRegion, encodingRegion, encodingRegion);
+ }
+
+ // insert to tree
+ if (!fUpdateContext.isActive() && parent != null) {
+ propagateRangePreInsert(parent, rule);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(rule, next);
+ }
+ else {
+ parent.appendChild(rule);
+ }
+ }
+
+ return rule;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertStructuredDocumentRegion(IStructuredDocumentRegion region) {
+ if (fCreationContext == null || region == null) {
+ return null;
+ }
+
+ String type = ((BasicStructuredDocumentRegion) region).getType();
+ CSSNodeImpl modified = null;
+
+ ICSSNode target = fCreationContext.getTargetNode();
+
+ if ((fParseFloating && target == null) || target instanceof ICSSRuleContainer) {
+ if (type == CSSRegionContexts.CSS_DELIMITER) {
+ modified = insertSemiColonForRule(region);
+ }
+ else if (type == CSSRegionContexts.CSS_LBRACE) {
+ modified = insertBraceOpen(region);
+ }
+ else if (type == CSSRegionContexts.CSS_RBRACE) {
+ modified = insertBraceClose(region);
+ }
+ else if (type == CSSRegionContexts.CSS_MEDIA || type == CSSRegionContexts.CSS_PAGE || type == CSSRegionContexts.CSS_FONT_FACE || CSSUtil.isSelectorText(region)) {
+ checkNextNode(region, CSSRegionContexts.CSS_LBRACE);
+ }
+ else if (type == CSSRegionContexts.CSS_IMPORT || type == CSSRegionContexts.CSS_CHARSET) {
+ checkNextNode(region, CSSRegionContexts.CSS_DELIMITER);
+ }
+ }
+ else if ((target instanceof CSSRuleDeclContainer || target instanceof CSSStyleDeclaration) && type == CSSRegionContexts.CSS_DECLARATION_PROPERTY) {
+ modified = insertStyleDeclarationItem(region);
+ }
+ else if (target instanceof ICSSStyleDeclItem && type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ modified = insertSemiColonForStyleDeclarationItem(region);
+ }
+ else if (type == CSSRegionContexts.CSS_RBRACE) {
+ modified = insertBraceClose(region);
+ }
+
+ // post process
+ if (modified != null) {
+ if (modified instanceof CSSStructuredDocumentRegionContainer) {
+ ((CSSStructuredDocumentRegionContainer) modified).propagateRangeStructuredDocumentRegion();
+ }
+ }
+
+ return modified;
+ }
+
+ /**
+ *
+ */
+ private void insertStructuredDocumentRegions(IStructuredDocumentRegionList regionList) {
+ for (Enumeration e = regionList.elements(); e.hasMoreElements();) {
+ IStructuredDocumentRegion region = (IStructuredDocumentRegion) e.nextElement();
+ if (region == null) {
+ continue;
+ }
+ insertStructuredDocumentRegion(region);
+ if (fCreationContext.isToReparse()) {
+ int origStart = region.getEnd();
+ int origEnd = regionList.item(regionList.getLength() - 1).getEnd();
+ int newStart = fCreationContext.getReparseStart();
+ int newEnd = fCreationContext.getReparseEnd();
+ if (newStart < origStart || origEnd < newEnd) {
+ IStructuredDocumentRegionList newNodeList = getStructuredDocumentRegionList(newStart, newEnd);
+ setupCreationContext(newNodeList.item(0));
+ insertStructuredDocumentRegions(newNodeList);
+ return;
+ }
+ else {
+ fCreationContext.resetReparseRange();
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertFontFaceRule(IStructuredDocumentRegion region, IStructuredDocumentRegion braceNode) {
+ CSSNodeImpl parent = fCreationContext.getTargetNode();
+ if (!fParseFloating && !(parent instanceof ICSSRuleContainer)) {
+ return null;
+ }
+
+ CSSFontFaceRuleImpl rule = fFeeder.getCSSFontFaceRule();
+ if (rule == null) {
+ return null;
+ }
+
+ // setup flat container
+ rule.setRangeStructuredDocumentRegion(region, braceNode);
+
+ // insert to tree
+ if (!fUpdateContext.isActive() && parent != null) {
+ propagateRangePreInsert(parent, rule);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(rule, next);
+ }
+ else {
+ parent.appendChild(rule);
+ }
+ }
+
+ fCreationContext.setTargetNode(rule);
+ // TargetNext is set to null automatically
+
+ return rule;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertImportRule(IStructuredDocumentRegion beginDocRegion, IStructuredDocumentRegion endDocRegion) {
+ CSSNodeImpl parent = fCreationContext.getTargetNode();
+ if (!fParseFloating && !(parent instanceof ICSSRuleContainer)) {
+ return null;
+ }
+
+ ITextRegionList regions = new TextRegionListImpl(beginDocRegion.getRegions());
+ regions.remove(0); // must be "@import"
+ ITextRegion hrefRegion = null;
+ while (!regions.isEmpty()) {
+ ITextRegion textRegion = regions.remove(0);
+ if (textRegion == null) {
+ continue;
+ }
+ String type = textRegion.getType();
+ if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) {
+ continue;
+ }
+ if (type == CSSRegionContexts.CSS_URI || type == CSSRegionContexts.CSS_STRING) {
+ hrefRegion = textRegion;
+ break;
+ }
+ else {
+ break;
+ }
+ }
+ if (hrefRegion == null) {
+ return null;
+ }
+
+ CSSImportRuleImpl rule = fFeeder.getCSSImportRule();
+ if (rule == null) {
+ return null;
+ }
+
+ CSSUtil.stripSurroundingSpace(regions);
+ MediaListImpl mediaList = (MediaListImpl) rule.getMedia();
+ setMediaList(mediaList, beginDocRegion, regions);
+
+ if (!fUpdateContext.isActive()) {
+ rule.setAttribute(ICSSImportRule.HREF, beginDocRegion.getText(hrefRegion));
+ }
+
+ // setup flat container
+ rule.setRangeStructuredDocumentRegion(beginDocRegion, endDocRegion);
+ CSSAttrImpl attr = rule.getAttributeNode(ICSSImportRule.HREF);
+ if (attr != null) {
+ attr.setRangeRegion(beginDocRegion, hrefRegion, hrefRegion);
+ }
+
+ // insert to tree
+ if (!fUpdateContext.isActive() && parent != null) {
+ propagateRangePreInsert(parent, rule);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(rule, next);
+ }
+ else {
+ parent.appendChild(rule);
+ }
+ }
+
+ return rule;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertMediaRule(IStructuredDocumentRegion flatNode, IStructuredDocumentRegion braceNode) {
+ CSSNodeImpl parent = fCreationContext.getTargetNode();
+ if (!fParseFloating && !(parent instanceof ICSSRuleContainer)) {
+ return null;
+ }
+
+ CSSMediaRuleImpl rule = fFeeder.getCSSMediaRule();
+ if (rule == null) {
+ return null;
+ }
+
+ ITextRegionList regions = new TextRegionListImpl(flatNode.getRegions());
+ regions.remove(0); // must be "@media"
+
+ CSSUtil.stripSurroundingSpace(regions);
+ MediaListImpl mediaList = (MediaListImpl) rule.getMedia();
+ setMediaList(mediaList, flatNode, regions);
+
+ // setup flat container
+ rule.setRangeStructuredDocumentRegion(flatNode, braceNode);
+
+ // insert to tree
+ if (!fUpdateContext.isActive() && parent != null) {
+ propagateRangePreInsert(parent, rule);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(rule, next);
+ }
+ else {
+ parent.appendChild(rule);
+ }
+ }
+
+ fCreationContext.setTargetNode(rule);
+ // TargetNext is set to null automatically
+
+ return rule;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertPageRule(IStructuredDocumentRegion flatNode, IStructuredDocumentRegion braceNode) {
+ CSSNodeImpl parent = fCreationContext.getTargetNode();
+ if (!fParseFloating && !(parent instanceof ICSSRuleContainer)) {
+ return null;
+ }
+
+ // get selector regions
+ ITextRegionList selectorRegions = new TextRegionListImpl(flatNode.getRegions());
+ selectorRegions.remove(0); // must be "@page"
+ CSSUtil.stripSurroundingSpace(selectorRegions);
+
+ CSSPageRuleImpl rule = fFeeder.getCSSPageRule();
+ if (rule == null) {
+ return null;
+ }
+
+ if (!fUpdateContext.isActive()) {
+ String selectorStr = CSSUtil.getRegionText(flatNode, selectorRegions);
+ if (0 < selectorStr.length()) {
+ rule.setSelectorText(selectorStr);
+ }
+ }
+
+ // setup flat container
+ rule.setRangeStructuredDocumentRegion(flatNode, braceNode);
+ CSSAttrImpl attr = rule.getAttributeNode(ICSSPageRule.SELECTOR);
+ if (attr != null && selectorRegions != null && !selectorRegions.isEmpty()) {
+ attr.setRangeRegion(flatNode, selectorRegions.get(0), selectorRegions.get(selectorRegions.size() - 1));
+ }
+
+ // insert to tree
+ if (!fUpdateContext.isActive() && parent != null) {
+ propagateRangePreInsert(parent, rule);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(rule, next);
+ }
+ else {
+ parent.appendChild(rule);
+ }
+ }
+
+ fCreationContext.setTargetNode(rule);
+ // TargetNext is set to null automatically
+
+ return rule;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertSemiColonForRule(IStructuredDocumentRegion region) {
+ IStructuredDocumentRegion keyRegion = CSSUtil.findPreviousSignificantNode(region);
+ String type = CSSUtil.getStructuredDocumentRegionType(keyRegion);
+
+ CSSNodeImpl inserted = null;
+ if (type == CSSRegionContexts.CSS_IMPORT) {
+ inserted = insertImportRule(keyRegion, region);
+ }
+ else if (type == CSSRegionContexts.CSS_CHARSET) {
+ inserted = insertCharsetRule(keyRegion, region);
+ }
+
+ return inserted;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertSemiColonForStyleDeclarationItem(IStructuredDocumentRegion region) {
+ // only target/net node is changed. nothing to do.
+
+ CSSNodeImpl targetNode = fCreationContext.getTargetNode();
+ if (targetNode instanceof ICSSStyleDeclItem) {
+ int offset = targetNode.getStartOffset();
+ // widen document region range
+ // ((CSSStyleDeclItemImpl)targetNode).setLastStructuredDocumentRegion(region);
+ CSSModelUtil.expandStructuredDocumentRegionContainer((CSSStyleDeclItemImpl) targetNode, region);
+ // psStructuredDocumentRegion indicates CSSStyleDeclItem
+ ICSSNode parentNode = targetNode.getParentNode();
+ fCreationContext.setTargetNode(parentNode);
+ ICSSNode next = null;
+ if (parentNode.hasChildNodes()) {
+ for (ICSSNode child = targetNode.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child instanceof CSSStructuredDocumentRegionContainer && offset < ((CSSStructuredDocumentRegionContainer) child).getStartOffset()) {
+ next = child;
+ break;
+ }
+ }
+ }
+ fCreationContext.setNextNode(next);
+
+ return targetNode;
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertStyleDeclarationItem(IStructuredDocumentRegion docRegion) {
+ CSSStyleDeclarationImpl parent = null;
+ CSSNodeImpl node = fCreationContext.getTargetNode();
+ if (node instanceof CSSRuleDeclContainer) {
+ CSSRuleDeclContainer declContainer = (CSSRuleDeclContainer) node;
+ parent = (CSSStyleDeclarationImpl) declContainer.getStyle();
+ }
+ else if (node instanceof CSSStyleDeclarationImpl) {
+ parent = (CSSStyleDeclarationImpl) node;
+ }
+
+ CSSDeclarationItemParser itemParser = new CSSDeclarationItemParser(parent.getOwnerDocument());
+ itemParser.setStructuredDocumentTemporary(false);
+ itemParser.setUpdateContext(fUpdateContext);
+ CSSStyleDeclItemImpl declItem = itemParser.setupDeclarationItem(docRegion);
+ if (declItem == null) {
+ return null;
+ }
+
+ // setup flat container
+ declItem.setRangeStructuredDocumentRegion(docRegion, docRegion);
+
+ // insert to tree
+ if (!fUpdateContext.isActive()) {
+ propagateRangePreInsert(parent, declItem);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(declItem, next);
+ }
+ else {
+ parent.appendChild(declItem);
+ }
+ }
+
+ fCreationContext.setTargetNode(declItem);
+ // TargetNext is set to null automatically
+
+ return declItem;
+ }
+
+ /**
+ *
+ */
+ private CSSNodeImpl insertStyleRule(IStructuredDocumentRegion flatNode, IStructuredDocumentRegion braceNode) {
+ CSSNodeImpl parent = fCreationContext.getTargetNode();
+ if (!fParseFloating && !(parent instanceof ICSSRuleContainer)) {
+ return null;
+ }
+
+ // get selector regions
+ ITextRegionList selectorRegions = new TextRegionListImpl(flatNode.getRegions());
+ CSSUtil.stripSurroundingSpace(selectorRegions);
+
+ CSSStyleRuleImpl rule = fFeeder.getCSSStyleRule();
+ if (rule == null) {
+ return null;
+ }
+
+ if (!fUpdateContext.isActive()) {
+ String selectorStr = CSSUtil.getRegionText(flatNode, selectorRegions);
+ if (selectorStr != null && 0 < selectorStr.length()) {
+ rule.setSelectorText(selectorStr);
+ }
+ }
+
+ // setup flat container
+ rule.setRangeStructuredDocumentRegion(flatNode, braceNode);
+ CSSAttrImpl attr = rule.getAttributeNode(ICSSPageRule.SELECTOR);
+ if (attr != null && selectorRegions != null && !selectorRegions.isEmpty()) {
+ attr.setRangeRegion(flatNode, selectorRegions.get(0), selectorRegions.get(selectorRegions.size() - 1));
+ }
+
+ // insert to tree
+ if (!fUpdateContext.isActive() && parent != null) {
+ propagateRangePreInsert(parent, rule);
+ CSSNodeImpl next = fCreationContext.getNextNode();
+ if (next != null) {
+ parent.insertBefore(rule, next);
+ }
+ else {
+ parent.appendChild(rule);
+ }
+ }
+
+ fCreationContext.setTargetNode(rule);
+ // TargetNext is set to null automatically
+
+ return rule;
+ }
+
+ /**
+ *
+ */
+ private void pretendRemoveNode() {
+ CSSStructuredDocumentRegionContainer node = (CSSStructuredDocumentRegionContainer) fUpdateContext.getDeletionTarget();
+ if (node == null) {
+ return;
+ }
+
+ IStructuredDocumentRegion firstNode = node.getFirstStructuredDocumentRegion();
+ if (firstNode != null) {
+ fDeletionContext.expandRemovedRangeBegin(firstNode);
+ }
+ IStructuredDocumentRegion lastNode = node.getLastStructuredDocumentRegion();
+ if (lastNode != null) {
+ fDeletionContext.expandRemovedRangeEnd(lastNode);
+ }
+
+ shrinkContainer((CSSStructuredDocumentRegionContainer) fUpdateContext.getDeletionTargetParent(), node);
+ }
+
+ /**
+ * @param parent
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param child
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private void propagateRangePreInsert(CSSNodeImpl parent, CSSNodeImpl child) {
+ if (!(child instanceof CSSStructuredDocumentRegionContainer) || !(parent instanceof CSSStructuredDocumentRegionContainer)) {
+ return;
+ }
+
+ CSSStructuredDocumentRegionContainer parentContainer = (CSSStructuredDocumentRegionContainer) parent;
+ CSSStructuredDocumentRegionContainer childContainer = (CSSStructuredDocumentRegionContainer) child;
+ IStructuredDocumentRegion firstNode = childContainer.getFirstStructuredDocumentRegion();
+ IStructuredDocumentRegion lastNode = childContainer.getLastStructuredDocumentRegion();
+ if (firstNode == null || lastNode == null) {
+ return;
+ }
+
+ boolean bModified = parentContainer.includeRangeStructuredDocumentRegion(firstNode, lastNode);
+ if (bModified) {
+ parentContainer.propagateRangeStructuredDocumentRegion();
+ }
+ }
+
+ /**
+ *
+ */
+ private void removeStructuredDocumentRegion(IStructuredDocumentRegion flatNode) {
+ String type = CSSUtil.getStructuredDocumentRegionType(flatNode);
+ if (type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ do {
+ flatNode = fStructuredDocumentWalker.getPrevNode(flatNode);
+ type = (flatNode != null) ? CSSUtil.getStructuredDocumentRegionType(flatNode) : null;
+ }
+ while (type != null && (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT));
+ }
+ if (flatNode == null) {
+ return;
+ }
+
+ // if (fDeletionContext.isInRemovedRange(flatNode)) { // already
+ // removed
+ // return;
+ // }
+
+ CSSStructuredDocumentRegionContainer node = fDeletionContext.findDeletionTarget(fDocument, flatNode);
+ if (node == null || node == fDocument) {
+ return; // not attached with any treeNode
+ }
+
+ if (node instanceof CSSStyleDeclarationImpl) {
+ ICSSNode rule = node.getParentNode();
+ if (rule instanceof CSSStyleRuleImpl) {
+ node = (CSSStructuredDocumentRegionContainer) rule;
+ }
+ else {
+ return;
+ }
+ }
+
+ // ICSSNode p = node.getParentNode();
+ // if (p == null || ! (p instanceof
+ // CSSStructuredDocumentRegionContainer)) {
+ // return;
+ // }
+ // CSSStructuredDocumentRegionContainer parent =
+ // (CSSStructuredDocumentRegionContainer)p;
+
+ if (fDeletionContext.addNodeToBeRemoved(node)) {
+ IStructuredDocumentRegion firstNode = node.getFirstStructuredDocumentRegion();
+ if (firstNode != null) {
+ fDeletionContext.expandRemovedRangeBegin(firstNode);
+ }
+ IStructuredDocumentRegion lastNode = node.getLastStructuredDocumentRegion();
+ if (lastNode != null) {
+ fDeletionContext.expandRemovedRangeEnd(lastNode);
+ }
+ }
+
+ // shrinkContainer(node);
+ // parent.removeChild(node);
+ }
+
+ /**
+ *
+ */
+ private void removeStructuredDocumentRegions(IStructuredDocumentRegionList flatNodes) {
+ for (Enumeration e = flatNodes.elements(); e.hasMoreElements();) {
+ IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) e.nextElement();
+ if (flatNode == null) {
+ continue;
+ }
+ removeStructuredDocumentRegion(flatNode);
+ }
+
+ Iterator i = fDeletionContext.getNodesToBeRemoved();
+ while (i.hasNext()) {
+ CSSNodeImpl node = (CSSNodeImpl) i.next();
+ if (!(node instanceof CSSStructuredDocumentRegionContainer)) {
+ continue;
+ }
+ CSSNodeImpl parent = (CSSNodeImpl) node.getParentNode();
+ if (!(parent instanceof CSSStructuredDocumentRegionContainer)) {
+ continue;
+ }
+ shrinkContainer((CSSStructuredDocumentRegionContainer) parent, (CSSStructuredDocumentRegionContainer) node);
+ parent.removeChild(node);
+ }
+ }
+
+ /**
+ *
+ */
+ void replaceStructuredDocumentRegions(IStructuredDocumentRegionList newStructuredDocumentRegions, IStructuredDocumentRegionList oldStructuredDocumentRegions) {
+ if (fDocument == null || fCreationContext == null) {
+ return;
+ }
+
+ if (oldStructuredDocumentRegions != null && 0 < oldStructuredDocumentRegions.getLength()) {
+ setupDeletionContext(newStructuredDocumentRegions, oldStructuredDocumentRegions);
+ short updateMode = fUpdateContext.getUpdateMode();
+ if (updateMode == CSSModelUpdateContext.UPDATE_IDLE) {
+ removeStructuredDocumentRegions(oldStructuredDocumentRegions);
+ }
+ else {
+ pretendRemoveNode();
+ }
+ newStructuredDocumentRegions = getStructuredDocumentRegionList(fDeletionContext.getRemovedRangeBegin(), fDeletionContext.getRemovedRangeEnd());
+ cleanupDeletionContext();
+ }
+
+ if (newStructuredDocumentRegions != null && 0 < newStructuredDocumentRegions.getLength()) {
+ setupCreationContext(newStructuredDocumentRegions.item(0));
+ insertStructuredDocumentRegions(newStructuredDocumentRegions);
+ }
+
+ // make document hold whole structuredDocument
+ /*
+ * boolean bUpdate = false; IStructuredDocumentRegion flatNode;
+ * flatNode = fDocument.getFirstStructuredDocumentRegion(); bUpdate =
+ * bUpdate || (flatNode == null ||
+ * fStructuredDocumentWalker.isOldNode(flatNode) ||
+ * flatNode.getPrevious() != null); flatNode =
+ * fDocument.getLastStructuredDocumentRegion(); bUpdate = bUpdate ||
+ * (flatNode == null || fStructuredDocumentWalker.isOldNode(flatNode) ||
+ * flatNode.getNext() != null);
+ */
+ IStructuredDocument structuredDocument = fStructuredDocumentWalker.getStructuredDocument();
+ fDocument.setRangeStructuredDocumentRegion(structuredDocument.getFirstStructuredDocumentRegion(), structuredDocument.getLastStructuredDocumentRegion());
+ /* } */
+
+ // remove in official release
+ // CSSModelUtil.diagnoseTree(fDocument,
+ // fStructuredDocumentWalker.getStructuredDocument());
+ }
+
+ /**
+ *
+ */
+ void replaceRegions(IStructuredDocumentRegion flatNode, ITextRegionList newRegions, ITextRegionList oldRegions) {
+ if (flatNode == null) {
+ return;
+ }
+ if (newRegions == null || oldRegions == null) {
+ return;
+ }
+ if (fDocument == null) {
+ return;
+ }
+
+ changeStructuredDocumentRegion(flatNode);
+ }
+
+ /**
+ */
+ private void resetCreationTarget(IStructuredDocumentRegion newStructuredDocumentRegion) {
+ if (newStructuredDocumentRegion == null || newStructuredDocumentRegion.getStartOffset() <= 0) {
+ // top of document
+ fCreationContext.setTargetNode(fDocument);
+ fCreationContext.setNextNode(fDocument.getFirstChild());
+ return;
+ }
+
+ int cursorPos = newStructuredDocumentRegion.getStartOffset();
+ CSSNodeImpl cursorNode = getNodeAt(cursorPos);
+ if (cursorNode == null) { // end of document
+ cursorNode = fDocument;
+ }
+
+ // find edge of tree node
+ CSSNodeImpl node = null;
+ // boolean bOverSemiColon = false;
+ boolean bOverOpenBrace = false;
+ IStructuredDocumentRegion flatNode;
+ for (flatNode = newStructuredDocumentRegion; flatNode != null; flatNode = flatNode.getPrevious()) {
+ node = getNodeAt(flatNode.getStartOffset());
+ if (node == null) {
+ node = fDocument;
+ }
+ if (node != cursorNode || node.getStartOffset() == flatNode.getStartOffset()) {
+ break;
+ }
+ if (flatNode != newStructuredDocumentRegion) {
+ String type = CSSUtil.getStructuredDocumentRegionType(flatNode);
+ // if (type == CSSRegionContexts.CSS_DELIMITER ||
+ // type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ // bOverSemiColon = true;
+ // } else
+ if (type == CSSRegionContexts.CSS_LBRACE) {
+ bOverOpenBrace = true;
+ }
+ }
+ }
+
+ CSSNodeImpl targetNode = null;
+
+ // if (flatNode == null) {
+ // v<--|
+ // AAAAAA
+ // BBBBBBBBBB cursorNode:A , node:B -> target is A
+ // targetNode = (node == null) ? fDocument : node;
+ // } else
+ if (cursorNode == node) {
+ // v<--|
+ // AAAAAA
+ // BBBBBBBBBB cursorNode:A , node:B -> target is A
+ if (bOverOpenBrace && cursorNode instanceof CSSRuleDeclContainer) {
+ targetNode = (CSSNodeImpl) ((CSSRuleDeclContainer) cursorNode).getStyle();
+ }
+ else {
+ targetNode = cursorNode;
+ }
+ }
+ else {
+ // v<--|
+ // AAA
+ // BBBBBBBBBB cursorNode:B , node:A -> depend on A's node type
+ short nodeType = node.getNodeType();
+ if (nodeType == ICSSNode.STYLEDECLITEM_NODE || nodeType == ICSSNode.CHARSETRULE_NODE || nodeType == ICSSNode.IMPORTRULE_NODE) {
+ // targetNode = (CSSNodeImpl)((bOverSemiColon) ?
+ // node.getParentNode() : node); // NP
+ String regionType = CSSUtil.getStructuredDocumentRegionType(flatNode);
+ if (regionType == CSSRegionContexts.CSS_DELIMITER || regionType == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ targetNode = (CSSNodeImpl) node.getParentNode();
+ }
+ else {
+ targetNode = node;
+ }
+ }
+ else if (CSSUtil.getStructuredDocumentRegionType(flatNode) == CSSRegionContexts.CSS_RBRACE) {
+ targetNode = (CSSNodeImpl) node.getParentNode();
+ }
+ else {
+ targetNode = node;
+ }
+ }
+
+ fCreationContext.setTargetNode(targetNode);
+ ICSSNode next = null;
+ if (targetNode.hasChildNodes()) {
+ for (ICSSNode child = targetNode.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child instanceof CSSStructuredDocumentRegionContainer && cursorPos < ((CSSStructuredDocumentRegionContainer) child).getStartOffset()) {
+ next = child;
+ break;
+ }
+ }
+ }
+ fCreationContext.setNextNode(next);
+
+ }
+
+ /**
+ */
+ private void resetReparseRange() {
+ fCreationContext.clear();
+ }
+
+ /**
+ * @param event
+ * com.ibm.sed.structuredDocument.events.StructuredDocumentEvent
+ */
+ void setStructuredDocumentEvent(StructuredDocumentEvent event) {
+ if (fStructuredDocumentWalker == null) {
+ fStructuredDocumentWalker = new StructuredDocumentWalker();
+ }
+ fStructuredDocumentWalker.initialize(event);
+ }
+
+ /**
+ * regions: surrounding spaces should be removed. Q. Why did you set
+ * mediaTable ? A. MediaList may have two or more medium that have same
+ * value, then searcing in MediaList is not perfect. Q.
+ * fUpdateContext.isActive() is not care. Are you OK? A. OK.
+ */
+ private void setMediaList(MediaListImpl mediaList, IStructuredDocumentRegion region, ITextRegionList textRegions) {
+ if (mediaList == null || textRegions == null) {
+ return;
+ }
+ Collection mediaTable = new HashSet();
+ CSSNodeListImpl attrs = mediaList.getMedia();
+ for (int i = 0; i != attrs.getLength(); i++) {
+ mediaTable.add(attrs.item(i));
+ }
+
+ ITextRegion start = null;
+ ITextRegion end = null;
+
+ Iterator i = textRegions.iterator();
+ ITextRegion textRegion = (ITextRegion) ((i.hasNext()) ? i.next() : null);
+ while (textRegion != null) {
+ if (textRegion.getType() == CSSRegionContexts.CSS_MEDIUM) {
+ String mediumStr = region.getText(textRegion);
+ if (0 < mediumStr.length()) {
+ CSSAttrImpl attr = null;
+ // is the medium already set ?
+ Iterator iTable = mediaTable.iterator();
+ while (iTable.hasNext()) {
+ CSSAttrImpl cai = (CSSAttrImpl) iTable.next();
+ if (mediumStr.equalsIgnoreCase(cai.getValue())) {
+ attr = cai;
+ mediaTable.remove(cai);
+ break;
+ }
+ }
+ if (attr == null) {
+ // is not set. create new attribute
+ String key = "mediumP" + mediaList.mediumCounter++; //$NON-NLS-1$
+ mediaList.setAttribute(key, mediumStr);
+ attr = mediaList.getAttributeNode(key);
+ }
+ attr.setRangeRegion(region, textRegion, textRegion);
+ if (start == null) {
+ start = textRegion;
+ }
+ end = textRegion;
+ }
+ }
+ textRegion = (ITextRegion) ((i.hasNext()) ? i.next() : null);
+ }
+
+ if (start != null && end != null) {
+ mediaList.setRangeRegion(region, start, end);
+ }
+ }
+
+ /**
+ *
+ */
+ private void setupCreationContext(IStructuredDocumentRegion region) {
+ resetReparseRange();
+ resetCreationTarget(region);
+ }
+
+ /**
+ *
+ */
+ private void setupDeletionContext(IStructuredDocumentRegionList newStructuredDocumentRegions, IStructuredDocumentRegionList oldStructuredDocumentRegions) {
+ fDeletionContext.setupContext(newStructuredDocumentRegions, oldStructuredDocumentRegions);
+ }
+
+ /**
+ *
+ */
+ void setupUpdateContext(short updateMode, ICSSNode parentNode, ICSSNode targetNode) {
+ fUpdateContext.setupContext(updateMode, parentNode, targetNode);
+ }
+
+ /**
+ *
+ */
+ void shrinkContainer(CSSStructuredDocumentRegionContainer parent, CSSStructuredDocumentRegionContainer child) {
+ if (child == null) {
+ return;
+ }
+
+ boolean bModified = false;
+ bModified = bModified || cleanupLastNode(child.getLastStructuredDocumentRegion(), parent);
+ bModified = bModified || cleanupFirstNode(child.getFirstStructuredDocumentRegion(), parent);
+
+ if (bModified) {
+ if (parent != null) {
+ for (ICSSNode node = parent.getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (child != node && node instanceof CSSStructuredDocumentRegionContainer) {
+ ((CSSStructuredDocumentRegionContainer) node).propagateRangeStructuredDocumentRegion();
+ }
+ }
+ }
+ }
+
+ child.setRangeStructuredDocumentRegion(null, null);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdateContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdateContext.java
new file mode 100644
index 0000000000..31018fa4e7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdateContext.java
@@ -0,0 +1,416 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.LinkedList;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.util.AbstractCssTraverser;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSPrimitiveValue;
+
+
+/**
+ *
+ */
+class CSSModelUpdateContext {
+
+
+ class CSSNodeUpdateTraverser extends AbstractCssTraverser {
+ public CSSNodeUpdateTraverser() {
+ super();
+ setTraverseImported(false);
+ setTraverseImportFirst(false);
+ }
+
+ public LinkedList getNodeList() {
+ return fTravNodeList;
+ }
+
+ protected void begin(ICSSNode node) {
+ fTravNodeList = new LinkedList();
+ }
+
+ protected short preNode(ICSSNode node) {
+ if (node instanceof CSSStyleDeclarationImpl || node instanceof CSSAttrImpl || node instanceof MediaListImpl) {
+ // skip
+ }
+ else {
+ fTravNodeList.add(node);
+ }
+ if (node instanceof CSSPrimitiveContainer) {
+ return TRAV_PRUNE;
+ }
+ else {
+ return TRAV_CONT;
+ }
+ }
+
+ LinkedList fTravNodeList = null;
+ }
+
+ ICSSNode fLastNode = null;
+ ICSSNode fDeletionTargetParent = null;
+ ICSSNode fDeletionTarget = null;
+ LinkedList fNodeList = null;
+ private short fUpdateMode = UPDATE_IDLE;
+ static final short UPDATE_IDLE = 0;
+ static final short UPDATE_INSERT_FNCONTAINER = 1;
+ static final short UPDATE_INSERT_RCONTAINER = 2;
+ static final short UPDATE_REMOVE_FNCONTAINER = 3;
+ static final short UPDATE_REMOVE_RCONTAINER = 4;
+ static final short UPDATE_CHANGE_RCONTAINER = 5;
+
+ /**
+ * CSSNodeUpdateQueue constructor comment.
+ */
+ CSSModelUpdateContext() {
+ super();
+ }
+
+ /**
+ *
+ */
+ void cleanupContext() {
+ fNodeList = null;
+ fDeletionTarget = null;
+ fDeletionTargetParent = null;
+ fUpdateMode = UPDATE_IDLE;
+ }
+
+ /**
+ *
+ */
+ CounterImpl getCounter() {
+ ICSSNode node = getNode();
+ if (node instanceof CounterImpl) {
+ return (CounterImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CounterImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSCharsetRuleImpl getCSSCharsetRule() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSCharsetRuleImpl) {
+ return (CSSCharsetRuleImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSCharsetRuleImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSFontFaceRuleImpl getCSSFontFaceRule() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSFontFaceRuleImpl) {
+ return (CSSFontFaceRuleImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSFontFaceRuleImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSImportRuleImpl getCSSImportRule() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSImportRuleImpl) {
+ return (CSSImportRuleImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSImportRuleImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSMediaRuleImpl getCSSMediaRule() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSMediaRuleImpl) {
+ return (CSSMediaRuleImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSMediaRuleImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSPageRuleImpl getCSSPageRule() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSPageRuleImpl) {
+ return (CSSPageRuleImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSPageRuleImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSPrimitiveValueImpl getCSSPrimitiveValue(short type) {
+ ICSSNode node = getNode();
+ if (node instanceof CSSPrimitiveValueImpl) {
+ short nodeType = ((CSSPrimitiveValueImpl) node).getPrimitiveType();
+ if (nodeType == type || ((nodeType == CSSPrimitiveValue.CSS_NUMBER || nodeType == ICSSPrimitiveValue.CSS_INTEGER) && (type == CSSPrimitiveValue.CSS_NUMBER || type == ICSSPrimitiveValue.CSS_INTEGER))) {
+ return (CSSPrimitiveValueImpl) node;
+ }
+ }
+
+ if (node instanceof CSSPrimitiveValueImpl) {
+ CSSPrimitiveValueImpl value = (CSSPrimitiveValueImpl) node;
+ CSSUtil.debugOut("CSSPrimitiveValueImpl [" + type + //$NON-NLS-1$
+ "] is expected, but type is [" + //$NON-NLS-1$
+ value.getPrimitiveType() + "]: \"" + value.generateSource() + "\"");//$NON-NLS-2$//$NON-NLS-1$
+ }
+ else {
+ CSSUtil.debugOut("CSSPrimitiveValueImpl(" + type + //$NON-NLS-1$
+ ") is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ }
+
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ CSSPrimitiveValueImpl getCSSPrimitiveValueAny() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSPrimitiveValueImpl) {
+ return (CSSPrimitiveValueImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSPrimitiveValueImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSStyleDeclItemImpl getCSSStyleDeclItem(String propertyName) {
+ ICSSNode node = getNode();
+ if (node instanceof CSSStyleDeclItemImpl && ((CSSStyleDeclItemImpl) node).getPropertyName().equalsIgnoreCase(propertyName)) {
+ return (CSSStyleDeclItemImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSStyleDeclItemImpl(" + propertyName + //$NON-NLS-1$
+ ") is expected, but " + CSSUtil.getClassString(node));//$NON-NLS-1$
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ CSSStyleRuleImpl getCSSStyleRule() {
+ ICSSNode node = getNode();
+ if (node instanceof CSSStyleRuleImpl) {
+ return (CSSStyleRuleImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("CSSStyleRuleImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ ICSSNode getDeletionTarget() {
+ return fDeletionTarget;
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ ICSSNode getDeletionTargetParent() {
+ return fDeletionTargetParent;
+ }
+
+ /**
+ *
+ */
+ private ICSSNode getNode() {
+ ICSSNode node = null;
+ if (fNodeList != null && 0 < fNodeList.size()) {
+ node = (ICSSNode) fNodeList.removeFirst();
+ }
+ fLastNode = node;
+ return node;
+ }
+
+ /**
+ *
+ */
+ int getNodeCount() {
+ if (fNodeList != null) {
+ return fNodeList.size();
+ }
+ else {
+ return -1;
+ }
+ }
+
+ /**
+ *
+ */
+ // ICSSNode getParentNode() {
+ // return fParentNode;
+ // }
+ /**
+ *
+ */
+ RectImpl getRect() {
+ ICSSNode node = getNode();
+ if (node instanceof RectImpl) {
+ return (RectImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("RectImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ RGBColorImpl getRGBColor() {
+ ICSSNode node = getNode();
+ if (node instanceof RGBColorImpl) {
+ return (RGBColorImpl) node;
+ }
+ else {
+ CSSUtil.debugOut("RGBColorImpl is expected, but " + //$NON-NLS-1$
+ CSSUtil.getClassString(node));
+ ungetNode();
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return short
+ */
+ short getUpdateMode() {
+ return fUpdateMode;
+ }
+
+ /**
+ *
+ */
+ boolean isActive() {
+ return (fNodeList != null);
+ }
+
+ /**
+ *
+ */
+ void setupContext(short updateMode, ICSSNode parentNode, ICSSNode targetNode) {
+ fUpdateMode = updateMode;
+
+ ICSSNode traverseRoot;
+ if (updateMode == UPDATE_REMOVE_RCONTAINER || updateMode == UPDATE_INSERT_RCONTAINER || updateMode == UPDATE_CHANGE_RCONTAINER) {
+ traverseRoot = parentNode;
+ while (traverseRoot instanceof CSSRegionContainer) {
+ traverseRoot = traverseRoot.getParentNode();
+ }
+ }
+ else {
+ traverseRoot = targetNode;
+ }
+
+ if (updateMode == UPDATE_REMOVE_RCONTAINER || updateMode == UPDATE_INSERT_RCONTAINER || // region
+ // insert
+ // =>
+ // replace
+ // flat
+ // node
+ updateMode == UPDATE_CHANGE_RCONTAINER || updateMode == UPDATE_REMOVE_FNCONTAINER) {
+ fDeletionTarget = traverseRoot;
+ if (fDeletionTarget == targetNode) {
+ fDeletionTargetParent = parentNode;
+ }
+ else {
+ fDeletionTargetParent = fDeletionTarget.getParentNode();
+ }
+ }
+ else {
+ fDeletionTarget = null;
+ fDeletionTargetParent = null;
+ }
+
+ if (updateMode == UPDATE_INSERT_RCONTAINER || updateMode == UPDATE_INSERT_FNCONTAINER || updateMode == UPDATE_REMOVE_RCONTAINER || // region
+ // remove
+ // =>
+ // re-insert
+ // flat
+ // node
+ updateMode == UPDATE_CHANGE_RCONTAINER) {
+ CSSNodeUpdateTraverser traverser = new CSSNodeUpdateTraverser();
+ traverser.apply(traverseRoot);
+ fNodeList = traverser.getNodeList();
+ }
+ else {
+ fNodeList = null;
+ }
+ }
+
+ /**
+ *
+ */
+ private void ungetNode() {
+ if (fNodeList != null && fLastNode != null) {
+ fNodeList.addFirst(fLastNode);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdater.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdater.java
new file mode 100644
index 0000000000..b8e740bb6f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUpdater.java
@@ -0,0 +1,583 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.internal.formatter.AttrChangeContext;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatterFactory;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceGenerator;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.events.NoChangeEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.w3c.dom.DOMException;
+
+
+/**
+ *
+ */
+class CSSModelUpdater {
+
+ private CSSModelImpl fModel = null;
+ private CSSModelParser fParser = null;
+
+ /**
+ * CSSModelUpdater constructor comment.
+ */
+ CSSModelUpdater() {
+ super();
+ }
+
+ /**
+ *
+ */
+ CSSModelUpdater(CSSModelImpl model) {
+ super();
+ fModel = model;
+ }
+
+ /**
+ * @param parentNode
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param node
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private void attrInserted(CSSNodeImpl parentNode, CSSAttrImpl attr) {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(parentNode);
+
+ if (formatter == null) {
+ CSSUtil.debugOut("Cannot get format adapter : " + parentNode.getClass().toString());//$NON-NLS-1$
+ return;
+ }
+
+ short updateMode = CSSModelUpdateContext.UPDATE_INSERT_RCONTAINER;
+ fParser.setupUpdateContext(updateMode, parentNode, attr);
+
+ // get formatted info
+ AttrChangeContext region = new AttrChangeContext();
+ String text = new String(formatter.formatAttrChanged(parentNode, attr, true, region));
+
+ // set text
+ StructuredDocumentEvent result = insertText(region.start, region.end - region.start, text);
+
+ int nRemains = fParser.cleanupUpdateContext();
+
+ if (0 < nRemains && !(result instanceof NoChangeEvent)) {
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @param parentNode
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param node
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private void attrRemoved(CSSNodeImpl parentNode, CSSAttrImpl attr) {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(parentNode);
+
+ if (formatter == null) {
+ CSSUtil.debugOut("Cannot get format adapter : " + parentNode.getClass().toString());//$NON-NLS-1$
+ return;
+ }
+
+ short updateMode = CSSModelUpdateContext.UPDATE_REMOVE_RCONTAINER;
+ fParser.setupUpdateContext(updateMode, parentNode, attr);
+
+ // get formatted info
+ AttrChangeContext region = new AttrChangeContext();
+ String text = new String(formatter.formatAttrChanged(parentNode, attr, false, region));
+
+ // set text
+ StructuredDocumentEvent result = insertText(region.start, region.end - region.start, text);
+
+ int nRemains = fParser.cleanupUpdateContext();
+
+ if (0 < nRemains && !(result instanceof NoChangeEvent)) {
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ void attrReplaced(CSSNodeImpl parentNode, CSSNodeImpl newAttr, CSSNodeImpl oldAttr) {
+ if (parentNode == null) {
+ return;
+ }
+
+ if (oldAttr != null) {
+ attrRemoved(parentNode, (CSSAttrImpl) oldAttr);
+ }
+
+ if (newAttr != null) {
+ attrInserted(parentNode, (CSSAttrImpl) newAttr);
+ }
+ }
+
+ /**
+ *
+ */
+ private void childInserted(CSSNodeImpl parentNode, CSSNodeImpl node) {
+ short updateMode = CSSModelUpdateContext.UPDATE_IDLE;
+
+ if (node instanceof CSSStructuredDocumentRegionContainer) {
+ updateMode = CSSModelUpdateContext.UPDATE_INSERT_FNCONTAINER;
+ }
+ else if (node instanceof CSSRegionContainer) {
+ updateMode = CSSModelUpdateContext.UPDATE_INSERT_RCONTAINER;
+ }
+ else {
+ CSSUtil.debugOut("What's this node? : " + node.getClass().toString());//$NON-NLS-1$
+ return;
+ }
+
+ fParser.setupUpdateContext(updateMode, parentNode, node);
+
+ StructuredDocumentEvent result = defaultInserted(parentNode, node);
+
+ int nRemains = fParser.cleanupUpdateContext();
+
+ if (0 < nRemains && !(result instanceof NoChangeEvent)) {
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ private void childRemoved(CSSNodeImpl parentNode, CSSNodeImpl node) {
+ short updateMode = CSSModelUpdateContext.UPDATE_IDLE;
+
+ if (node instanceof CSSStructuredDocumentRegionContainer) {
+ updateMode = CSSModelUpdateContext.UPDATE_REMOVE_FNCONTAINER;
+ }
+ else if (node instanceof CSSRegionContainer) {
+ updateMode = CSSModelUpdateContext.UPDATE_REMOVE_RCONTAINER;
+ }
+ else {
+ CSSUtil.debugOut("What's this node? : " + node.getClass().toString());//$NON-NLS-1$
+ return;
+ }
+
+ fParser.setupUpdateContext(updateMode, parentNode, node);
+
+ CSSNodeImpl prev = getOldPrevious(parentNode, node);
+ CSSNodeImpl next = getOldNext(parentNode, node);
+ int insertPos = -1, endPos = -1;
+ String source = "";//$NON-NLS-1$
+ if (prev != null) {
+ insertPos = prev.getEndOffset();
+ }
+ else {
+ insertPos = node.getStartOffset();
+ insertPos -= nearestSpaceLengthBefore(parentNode, insertPos);
+ }
+ if (next != null) {
+ endPos = next.getStartOffset();
+ }
+ else {
+ endPos = node.getEndOffset();
+ endPos += nearestSpaceLengthAfter(parentNode, endPos);
+ }
+ source = getSpaceBefore(parentNode, next, node);
+ StructuredDocumentEvent result;
+ if (source.length() > 0) {
+ result = insertText(insertPos, endPos - insertPos, source);
+ }
+ else {
+ result = removeText(insertPos, endPos - insertPos);
+ }
+
+ int nRemains = fParser.cleanupUpdateContext();
+
+ if (0 < nRemains && !(result instanceof NoChangeEvent)) {
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+
+ /*
+ * int removeStart = -1; int removeEnd = -1; if (node instanceof
+ * CSSStructuredDocumentRegionContainer) {
+ * CSSStructuredDocumentRegionContainer container =
+ * (CSSStructuredDocumentRegionContainer)node;
+ * IStructuredDocumentRegion firstNode =
+ * container.getFirstStructuredDocumentRegion();
+ * IStructuredDocumentRegion lastNode =
+ * container.getLastStructuredDocumentRegion(); if (firstNode != null &&
+ * lastNode != null) { removeStart = firstNode.getStart(); removeEnd =
+ * lastNode.getEnd(); } } else if (node instanceof CSSRegionContainer) {
+ * CSSRegionContainer container = (CSSRegionContainer)node;
+ * ITextRegion firstRegion = container.getFirstRegion(); ITextRegion
+ * lastRegion = container.getLastRegion(); if (firstRegion != null &&
+ * lastRegion != null) { removeStart = firstRegion.getStartOffset();
+ * removeEnd = lastRegion.getEndOffset(); } } if (0 <= removeStart &&
+ * 0 <= removeEnd) { removeText(removeStart, removeEnd - removeStart +
+ * 1); }
+ */
+ }
+
+ /**
+ *
+ */
+ void childReplaced(CSSNodeImpl parentNode, CSSNodeImpl newChild, CSSNodeImpl oldChild) {
+ if (parentNode == null) {
+ return;
+ }
+
+ if (oldChild != null) {
+ childRemoved(parentNode, oldChild);
+ }
+
+ if (newChild != null) {
+ childInserted(parentNode, newChild);
+ }
+ }
+
+ /**
+ *
+ */
+ private StructuredDocumentEvent defaultInserted(CSSNodeImpl parentNode, CSSNodeImpl node) {
+ int insertPos = -1;
+ ICSSNode sibling;
+ String preSpace = "", postSpace = "";//$NON-NLS-2$//$NON-NLS-1$
+ int length = 0;
+
+ if (insertPos < 0) {
+ if ((sibling = node.getPreviousSibling()) != null) {
+ // after previous child
+ insertPos = getTextEnd(sibling);
+ }
+ }
+
+ if (insertPos < 0) {
+ if ((sibling = node.getNextSibling()) != null) {
+ // before next child
+ insertPos = getTextStart(sibling);
+ }
+ }
+
+ if (insertPos < 0) {
+ // position of parent
+ insertPos = getChildInsertPos(parentNode);
+ }
+
+ if (insertPos < 0) {
+ // firsttime
+ insertPos = 0;
+ }
+
+ // format previous spaces
+ length = nearestSpaceLengthBefore(parentNode, insertPos);
+ insertPos -= length;
+ preSpace = getSpaceBefore(parentNode, node, null);
+ // format post spaces
+ length += nearestSpaceLengthAfter(parentNode, insertPos + length);
+ postSpace = getSpaceBefore(parentNode, node.getNextSibling(), null);
+
+ // set text
+ String text = preSpace + node.generateSource().trim() + postSpace;
+ return insertText(insertPos, length, text);
+ }
+
+ /**
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private int getChildInsertPos(CSSNodeImpl node) {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(node);
+ if (formatter != null)
+ return formatter.getChildInsertPos(node);
+ else
+ return node.getEndOffset();
+ }
+
+ /**
+ *
+ */
+ // private int getDocumentEnd() {
+ // int end = -1;
+ // IStructuredDocument structuredDocument =
+ // fModel.getStructuredDocument();
+ // if (structuredDocument != null) {
+ // if (structuredDocument instanceof
+ // com.ibm.sed.structured.text.impl.BasicStructuredDocument) {
+ // end =
+ // ((com.ibm.sed.structured.text.impl.BasicStructuredDocument)structuredDocument).getLength();
+ // }
+ // }
+ // return end;
+ // }
+ /**
+ *
+ */
+ // private IStructuredDocument getStructuredDocument() {
+ // return (fModel != null) ? getStructuredDocument() : null;
+ // }
+ /**
+ * @return org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param parentNode
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param node
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private CSSNodeImpl getOldNext(CSSNodeImpl parentNode, CSSNodeImpl node) {
+ CSSNodeImpl child = (CSSNodeImpl) parentNode.getLastChild();
+ CSSNodeImpl ret = null;
+ while (child != null) {
+ if (node.getEndOffset() < child.getEndOffset())
+ ret = child;
+ else
+ break;
+ child = (CSSNodeImpl) child.getPreviousSibling();
+ }
+ return ret;
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param parentNode
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param node
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private CSSNodeImpl getOldPrevious(CSSNodeImpl parentNode, CSSNodeImpl node) {
+ CSSNodeImpl child = (CSSNodeImpl) parentNode.getFirstChild();
+ CSSNodeImpl ret = null;
+ while (child != null) {
+ if (child.getStartOffset() < node.getStartOffset())
+ ret = child;
+ else
+ break;
+ child = (CSSNodeImpl) child.getNextSibling();
+ }
+ return ret;
+ }
+
+ /**
+ * @return java.lang.String
+ * @param parentNode
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ * @param node
+ * org.eclipse.wst.css.core.model.CSSNodeImpl
+ */
+ private String getSpaceBefore(ICSSNode parentNode, ICSSNode node, ICSSNode toRemove) {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) parentNode);
+
+ if (formatter != null) {
+ org.eclipse.jface.text.IRegion exceptFor = null;
+ if (toRemove != null) {
+ CSSNodeImpl remove = (CSSNodeImpl) toRemove;
+ exceptFor = new org.eclipse.jface.text.Region(remove.getStartOffset(), remove.getEndOffset() - remove.getStartOffset());
+ }
+ return formatter.formatBefore(parentNode, node, exceptFor).toString();
+ }
+ else
+ return "";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ private int getTextEnd(ICSSNode node) {
+ int end = -1;
+ if (node != null) {
+ if (node instanceof CSSStructuredDocumentRegionContainer) {
+ end = ((CSSStructuredDocumentRegionContainer) node).getEndOffset();
+ }
+ else if (node instanceof CSSRegionContainer) {
+ end = ((CSSRegionContainer) node).getEndOffset();
+ }
+ }
+ return end;
+ }
+
+ /**
+ *
+ */
+ private int getTextStart(ICSSNode node) {
+ int start = -1;
+ if (node != null) {
+ if (node instanceof CSSStructuredDocumentRegionContainer) {
+ start = ((CSSStructuredDocumentRegionContainer) node).getStartOffset();
+ }
+ else if (node instanceof CSSRegionContainer) {
+ start = ((CSSRegionContainer) node).getStartOffset();
+ }
+ }
+ return start;
+ }
+
+ /**
+ *
+ */
+ private StructuredDocumentEvent insertText(int start, int oldLength, String text) {
+ StructuredDocumentEvent result = null;
+ BasicStructuredDocument structuredDocument = (BasicStructuredDocument) fModel.getStructuredDocument();
+ if (structuredDocument != null) {
+ if (text != null && 0 < oldLength && start + oldLength <= structuredDocument.getLength()) {
+ // minimize text change
+ String delText = structuredDocument.get(start, oldLength);
+ int newLength = text.length();
+ int shorterLen = Math.min(oldLength, newLength);
+ int stMatchLen;
+ for (stMatchLen = 0; stMatchLen < shorterLen && text.charAt(stMatchLen) == delText.charAt(stMatchLen); stMatchLen++) {
+ //
+ }
+ if (0 < stMatchLen && stMatchLen < shorterLen && text.charAt(stMatchLen - 1) == 0x000d && (text.charAt(stMatchLen) == 0x000a || delText.charAt(stMatchLen) == 0x000a)) {
+ // must not divide 0d->0a sequence
+ stMatchLen--;
+ }
+ if (stMatchLen == shorterLen) {
+ if (oldLength < newLength) { // just insert
+ oldLength = 0;
+ start += stMatchLen;
+ text = text.substring(stMatchLen);
+ }
+ else if (newLength < oldLength) { // just remove
+ oldLength -= stMatchLen;
+ start += stMatchLen;
+ text = null;
+ }
+ else { // nothing to do
+ oldLength = 0;
+ text = null;
+ }
+ }
+ else {
+ int edMatchLen;
+ for (edMatchLen = 0; stMatchLen + edMatchLen < shorterLen && text.charAt(newLength - edMatchLen - 1) == delText.charAt(oldLength - edMatchLen - 1); edMatchLen++) {
+ //
+ }
+ if (0 < edMatchLen && text.charAt(newLength - edMatchLen) == 0x000a && ((edMatchLen < newLength && text.charAt(newLength - edMatchLen - 1) == 0x000d) || (edMatchLen < oldLength && delText.charAt(oldLength - edMatchLen - 1) == 0x000d))) {
+ // must not divide 0d->0a sequence
+ edMatchLen--;
+ }
+ oldLength -= stMatchLen + edMatchLen;
+ start += stMatchLen;
+ if (stMatchLen + edMatchLen < newLength) {
+ text = text.substring(stMatchLen, newLength - edMatchLen);
+ }
+ else {
+ text = null;
+ }
+ }
+ }
+ if (0 < oldLength || text != null) {
+ // String delText = structuredDocument.get(start, oldLength);
+ result = structuredDocument.replaceText(fModel, start, oldLength, text);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return int
+ * @param insertPos
+ * int
+ */
+ private int nearestSpaceLengthAfter(CSSNodeImpl node, int insertPos) {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(node);
+ if (formatter != null) {
+ return formatter.getLengthToReformatAfter(node, insertPos);
+ }
+ else
+ return 0;
+ }
+
+ /**
+ * @return int
+ * @param insertPos
+ * int
+ */
+ private int nearestSpaceLengthBefore(CSSNodeImpl node, int insertPos) {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(node);
+ if (formatter != null) {
+ return formatter.getLengthToReformatBefore(node, insertPos);
+ }
+ else
+ return 0;
+ }
+
+ /**
+ *
+ */
+ private StructuredDocumentEvent removeText(int start, int length) {
+ StructuredDocumentEvent result = null;
+ IStructuredDocument structuredDocument = fModel.getStructuredDocument();
+ if (structuredDocument != null) {
+ result = structuredDocument.replaceText(fModel, start, length, new String(""));//$NON-NLS-1$
+ }
+ return result;
+ }
+
+ /**
+ *
+ */
+ void setParser(CSSModelParser parser) {
+ fParser = parser;
+ }
+
+ /**
+ *
+ */
+ void valueChanged(CSSNodeImpl node, String oldValue) {
+ if (!(node instanceof CSSRegionContainer)) {
+ CSSUtil.debugOut("Too Bad.." + //$NON-NLS-1$
+ ((node == null) ? "null" : node.getClass().toString()));//$NON-NLS-1$
+ return;
+ }
+
+ int start = node.getStartOffset();
+
+ if (node.getNodeType() == ICSSNode.ATTR_NODE) {
+ ICSSAttr attr = (ICSSAttr) node;
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) attr.getOwnerCSSNode());
+ if (formatter != null)
+ start = formatter.getAttrInsertPos(attr.getOwnerCSSNode(), attr.getName());
+ }
+
+ int oldLength = (oldValue == null) ? 0 : oldValue.length();
+ // flash old IStructuredDocumentRegion/ITextRegion
+ if (node instanceof CSSStructuredDocumentRegionContainer) {
+ ((CSSStructuredDocumentRegionContainer) node).setFirstStructuredDocumentRegion(null);
+ ((CSSStructuredDocumentRegionContainer) node).setLastStructuredDocumentRegion(null);
+ }
+ else if (node instanceof CSSRegionContainer) {
+ ((CSSRegionContainer) node).setRangeRegion(null, null, null);
+ }
+ // generate new source
+ String newValue = node.generateSource();
+
+ ICSSNode parent;
+ if (node.getNodeType() == ICSSNode.ATTR_NODE) {
+ parent = ((ICSSAttr) node).getOwnerCSSNode();
+ }
+ else {
+ parent = node.getParentNode();
+ }
+
+ fParser.setupUpdateContext(CSSModelUpdateContext.UPDATE_CHANGE_RCONTAINER, parent, node);
+
+ StructuredDocumentEvent result = insertText(start, oldLength, newValue);
+
+ int nRemains = fParser.cleanupUpdateContext();
+
+ if (0 < nRemains && !(result instanceof NoChangeEvent)) {
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUtil.java
new file mode 100644
index 0000000000..7fc0557985
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSModelUtil.java
@@ -0,0 +1,301 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSNodeList;
+import org.eclipse.wst.css.core.document.ICSSRuleContainer;
+import org.eclipse.wst.css.core.internal.nls.ResourceHandler;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+class CSSModelUtil {
+
+ /**
+ *
+ */
+ static boolean canContainBrace(ICSSNode node) {
+ return (node != null && (node instanceof ICSSRuleContainer || node instanceof CSSRuleDeclContainer)) ? true : false;
+ }
+
+ /**
+ * @param parent
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ static void cleanupContainer(ICSSNode parent) {
+ if (parent == null) {
+ return;
+ }
+ for (ICSSNode child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
+ cleanupContainer(child);
+ }
+ if (parent instanceof CSSStructuredDocumentRegionContainer) {
+ ((CSSStructuredDocumentRegionContainer) parent).setRangeStructuredDocumentRegion(null, null);
+ }
+ else if (parent instanceof CSSRegionContainer) {
+ ((CSSRegionContainer) parent).setRangeRegion(null, null, null);
+ }
+ }
+
+ /**
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param structuredDocument
+ * com.ibm.sed.structuredDocument.IStructuredDocument
+ */
+ static boolean diagnoseNode(ICSSNode parent, IStructuredDocument structuredDocument) {
+ // check this
+ Vector errors = new Vector();
+ if (parent instanceof CSSStructuredDocumentRegionContainer) {
+ CSSStructuredDocumentRegionContainer node = (CSSStructuredDocumentRegionContainer) parent;
+ String nodeText = CSSUtil.getClassString(node) + ": ";//$NON-NLS-1$
+ IStructuredDocumentRegion flatNode = node.getFirstStructuredDocumentRegion();
+ if (flatNode == null && (!(node instanceof CSSStyleDeclarationImpl || node instanceof CSSStyleSheetImpl) || node.getFirstChild() != null)) {
+ errors.add(ResourceHandler.getString("1concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}first flat node is null."
+ }
+ else if (flatNode != null) {
+ IStructuredDocumentRegion modelNode = structuredDocument.getRegionAtCharacterOffset(flatNode.getStart());
+ if (flatNode != modelNode) {
+ errors.add(ResourceHandler.getString("2concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}first flat node is not in model."
+ }
+ }
+ flatNode = node.getLastStructuredDocumentRegion();
+ if (flatNode == null && (!(node instanceof CSSStyleDeclarationImpl || node instanceof CSSStyleSheetImpl) || node.getFirstChild() != null)) {
+ errors.add(ResourceHandler.getString("3concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}last flat node is null."
+ }
+ else if (flatNode != null) {
+ IStructuredDocumentRegion modelNode = structuredDocument.getRegionAtCharacterOffset(flatNode.getStart());
+ if (flatNode != modelNode) {
+ errors.add(ResourceHandler.getString("4concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}last flat node is not in model."
+ }
+ }
+ }
+ else if (parent instanceof CSSRegionContainer) {
+ CSSRegionContainer node = (CSSRegionContainer) parent;
+ String nodeText = CSSUtil.getClassString(node) + ": ";//$NON-NLS-1$
+ ITextRegion region = node.getFirstRegion();
+ IStructuredDocumentRegion parentRegion = node.getDocumentRegion();
+ if (region == null && (!(node instanceof MediaListImpl) || node.getFirstChild() != null)) {
+ errors.add(ResourceHandler.getString("25concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}first region is null."
+ }
+ else if (region != null) {
+ int offset = parentRegion.getStartOffset(region);
+ IStructuredDocumentRegion modelNode = structuredDocument.getRegionAtCharacterOffset(offset);
+ ITextRegion modelRegion = modelNode.getRegionAtCharacterOffset(offset);
+ if (region != modelRegion) {
+ errors.add(ResourceHandler.getString("26concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}first region is not in model."
+ }
+ }
+ region = node.getLastRegion();
+ if (region == null && (!(node instanceof MediaListImpl) || node.getFirstChild() != null)) {
+ errors.add(ResourceHandler.getString("27concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}last region is null."
+ }
+ else if (region != null) {
+ int offset = parentRegion.getStartOffset(region);
+ IStructuredDocumentRegion modelNode = structuredDocument.getRegionAtCharacterOffset(offset);
+ ITextRegion modelRegion = modelNode.getRegionAtCharacterOffset(offset);
+ if (region != modelRegion) {
+ errors.add(ResourceHandler.getString("28concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}last region is not in model."
+ }
+ }
+ }
+
+ ICSSNodeList attrs = parent.getAttributes();
+ int nAttrs = attrs.getLength();
+ for (int i = 0; i < nAttrs; i++) {
+ ICSSAttr attr = (ICSSAttr) attrs.item(i);
+ CSSRegionContainer node = (CSSRegionContainer) attr;
+ String nodeText = CSSUtil.getClassString(node) + "(" + attr.getName() + "): ";//$NON-NLS-2$//$NON-NLS-1$
+ ITextRegion region = node.getFirstRegion();
+ IStructuredDocumentRegion parentRegion = node.getDocumentRegion();
+ if (region == null && 0 < attr.getValue().length()) {
+ errors.add(ResourceHandler.getString("5concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}first region is null."
+ }
+ else if (region != null) {
+ int offset = parentRegion.getStartOffset(region);
+ IStructuredDocumentRegion modelNode = structuredDocument.getRegionAtCharacterOffset(offset);
+ ITextRegion modelRegion = modelNode.getRegionAtCharacterOffset(offset);
+ if (region != modelRegion) {
+ errors.add(ResourceHandler.getString("6concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}first region is not in model."
+ }
+ }
+ region = node.getLastRegion();
+ if (region == null && 0 < attr.getValue().length()) {
+ errors.add(ResourceHandler.getString("7concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}last region is null."
+ }
+ else if (region != null) {
+ int offset = parentRegion.getStartOffset(region);
+ IStructuredDocumentRegion modelNode = structuredDocument.getRegionAtCharacterOffset(offset);
+ ITextRegion modelRegion = modelNode.getRegionAtCharacterOffset(offset);
+ if (region != modelRegion) {
+ errors.add(ResourceHandler.getString("8concat_ERROR_", (new Object[]{nodeText}))); //$NON-NLS-1$ = "{0}last region is not in model."
+ }
+ }
+ }
+
+ if (!errors.isEmpty()) {
+ Iterator i = errors.iterator();
+ while (i.hasNext()) {
+ CSSUtil.debugOut((String) i.next());
+ }
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ /**
+ * @return boolean
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ static boolean diagnoseTree(ICSSNode parent, IStructuredDocument structuredDocument) {
+ if (parent == null) {
+ return false;
+ }
+ // check children
+ for (ICSSNode child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
+ diagnoseTree(child, structuredDocument);
+ }
+
+ diagnoseNode(parent, structuredDocument);
+
+ return true;
+ }
+
+ /**
+ * If needed, modify last flat node
+ */
+ static void expandStructuredDocumentRegionContainer(CSSStructuredDocumentRegionContainer target, IStructuredDocumentRegion flatNode) {
+ if (target == null || flatNode == null) {
+ return;
+ }
+
+ IStructuredDocumentRegion lastNode = target.getLastStructuredDocumentRegion();
+ if (lastNode == flatNode) {
+ return;
+ }
+ if (lastNode == null || lastNode.getStart() < flatNode.getStart()) {
+ target.setLastStructuredDocumentRegion(flatNode);
+ }
+ }
+
+ /*
+ *
+ */
+ static ICSSNode findBraceContainer(ICSSNode node) {
+ for (ICSSNode i = node; i != null; i = i.getParentNode()) {
+ if (CSSModelUtil.canContainBrace(i)) {
+ return i;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ static int getDepth(ICSSNode node) {
+ int depth = -1;
+ while (node != null) {
+ depth++;
+ node = node.getParentNode();
+ }
+ return depth;
+ }
+
+ /**
+ *
+ */
+ static boolean isBraceClosed(ICSSNode node) {
+ boolean bClosed = true;
+ if (!(node instanceof CSSStructuredDocumentRegionContainer)) {
+ return bClosed;
+ }
+
+ IStructuredDocumentRegion first = ((CSSStructuredDocumentRegionContainer) node).getFirstStructuredDocumentRegion();
+ IStructuredDocumentRegion last = ((CSSStructuredDocumentRegionContainer) node).getLastStructuredDocumentRegion();
+ if (first == null || last == null) {
+ return bClosed;
+ }
+ if (last.getStart() < first.getStart()) {
+ return bClosed;
+ }
+
+ IStructuredDocumentRegion flatNode = first;
+ int nOpen = 0;
+ int nClose = 0;
+ do {
+ String type = CSSUtil.getStructuredDocumentRegionType(flatNode);
+ if (type == CSSRegionContexts.CSS_LBRACE) {
+ nOpen++;
+ }
+ else if (type == CSSRegionContexts.CSS_RBRACE) {
+ nClose++;
+ }
+ flatNode = flatNode.getNext();
+ }
+ while (flatNode != null && flatNode != last);
+
+ if ((nOpen == 0 && nClose == 0) || nClose < nOpen) {
+ bClosed = false;
+ }
+
+ return bClosed;
+ }
+
+ /**
+ * only for insertion..
+ */
+ static boolean isInterruption(CSSStructuredDocumentRegionContainer target, IStructuredDocumentRegion flatNode) {
+ if (target == null || flatNode == null) {
+ return false;
+ }
+ int start = flatNode.getStart();
+ IStructuredDocumentRegion firstNode = target.getFirstStructuredDocumentRegion();
+ IStructuredDocumentRegion lastNode = target.getLastStructuredDocumentRegion();
+ if (firstNode != null && firstNode.getStart() < start && lastNode != null && start < lastNode.getStart()) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ static boolean isParentOf(ICSSNode parent, ICSSNode child) {
+ if (parent == null || child == null) {
+ return false;
+ }
+
+ for (ICSSNode node = child; node != null; node = node.getParentNode()) {
+ if (parent == node) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNamedNodeMapImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNamedNodeMapImpl.java
new file mode 100644
index 0000000000..aa5eb3fc03
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNamedNodeMapImpl.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSNamedNodeMap;
+import org.eclipse.wst.css.core.document.ICSSNode;
+
+
+/**
+ *
+ */
+public class CSSNamedNodeMapImpl extends CSSNodeListImpl implements ICSSNamedNodeMap {
+
+ /**
+ * CSSNamedNodeMapImpl constructor comment.
+ */
+ CSSNamedNodeMapImpl() {
+ super();
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param name
+ * java.lang.String
+ */
+ public ICSSNode getNamedItem(String name) {
+ Iterator it = nodes.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj instanceof CSSAttrImpl && ((CSSAttrImpl) obj).getName().compareToIgnoreCase(name) == 0) {
+ return (ICSSNode) obj;
+ }
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java
new file mode 100644
index 0000000000..431b46008d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java
@@ -0,0 +1,559 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNamedNodeMap;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSNodeList;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatterFactory;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceGenerator;
+import org.eclipse.wst.css.core.util.ImportRuleCollector;
+import org.eclipse.wst.sse.core.AbstractNotifier;
+import org.eclipse.wst.sse.core.IFactoryRegistry;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.w3c.dom.DOMException;
+
+
+/**
+ *
+ */
+abstract class CSSNodeImpl extends AbstractNotifier implements ICSSNode, IndexedRegion {
+
+ private CSSDocumentImpl fOwnerDocument = null;
+ private CSSNodeImpl fParentNode = null;
+ private CSSNodeImpl fNextSibling = null;
+ private CSSNodeImpl fPreviousSibling = null;
+ private CSSNodeImpl fFirstChild = null;
+ private CSSNodeImpl fLastChild = null;
+ protected CSSNamedNodeMapImpl fAttrs = null;
+
+ /**
+ * CSSNodeImpl constructor comment.
+ */
+ CSSNodeImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ CSSNodeImpl(CSSNodeImpl that) {
+ if (that != null) {
+ this.fOwnerDocument = that.fOwnerDocument;
+ if (that.fAttrs != null) {
+ int nAttrs = that.fAttrs.getLength();
+ for (int i = 0; i < nAttrs; i++) {
+ CSSAttrImpl attr = (CSSAttrImpl) that.fAttrs.item(i);
+ setAttribute(attr.getName(), attr.getValue());
+ }
+ }
+ }
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param newChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ protected CSSNodeImpl appendChild(CSSNodeImpl newChild) throws org.w3c.dom.DOMException {
+ return insertBefore(newChild, null);
+ }
+
+ /**
+ * @param newParent
+ * com.ibm.sed.css.interfaces.ICSSNode
+ * @param deep
+ * boolean
+ */
+ void cloneChildNodes(ICSSNode newParent, boolean deep) {
+ if (newParent == null || newParent == this)
+ return;
+
+ CSSNodeImpl container = (CSSNodeImpl) newParent;
+ container.removeChildNodes();
+
+ for (ICSSNode child = getFirstChild(); child != null; child = child.getNextSibling()) {
+ CSSNodeImpl cloned = (CSSNodeImpl) child.cloneNode(deep);
+ if (cloned != null)
+ container.appendChild(cloned);
+ }
+ }
+
+ /**
+ * @return boolean
+ * @param offset
+ * int
+ */
+ public boolean contains(int offset) {
+ return (getStartOffset() <= offset && offset < getEndOffset());
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ String generateSource() {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(this);
+ return formatter.format(this).toString();
+ }
+
+ /**
+ * @return java.lang.String
+ * @param name
+ * java.lang.String
+ */
+ String getAttribute(String name) {
+ CSSAttrImpl attr = getAttributeNode(name);
+ if (attr != null)
+ return attr.getValue();
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSAttrImpl
+ * @param name
+ * java.lang.String
+ */
+ protected CSSAttrImpl getAttributeNode(String name) {
+ if (fAttrs == null)
+ return null;
+
+ int nAttrs = fAttrs.getLength();
+ for (int i = 0; i < nAttrs; i++) {
+ CSSAttrImpl attr = (CSSAttrImpl) fAttrs.item(i);
+ if (attr.matchName(name))
+ return attr;
+ }
+ return null;
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNamedNodeMap
+ */
+ public ICSSNamedNodeMap getAttributes() {
+ if (fAttrs == null)
+ fAttrs = new CSSNamedNodeMapImpl();
+ return fAttrs;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeList
+ */
+ public ICSSNodeList getChildNodes() {
+ CSSNodeListImpl list = new CSSNodeListImpl();
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ list.appendNode(node);
+ }
+ return list;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSNode
+ * @param node
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ ICSSNode getCommonAncestor(ICSSNode node) {
+ if (node == null)
+ return null;
+
+ for (ICSSNode na = node; na != null; na = na.getParentNode()) {
+ for (ICSSNode ta = this; ta != null; ta = ta.getParentNode()) {
+ if (ta == na)
+ return ta;
+ }
+ }
+
+ return null; // not found
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSDocumentImpl
+ */
+ CSSDocumentImpl getContainerDocument() {
+ for (ICSSNode node = this; node != null; node = node.getParentNode()) {
+ if (node instanceof CSSDocumentImpl) {
+ CSSDocumentImpl doc = (CSSDocumentImpl) node;
+ if (doc.isDocument())
+ return doc;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param offset
+ * int
+ */
+ CSSNodeImpl getContainerNode(int offset) {
+ if (!contains(offset))
+ return null;
+
+ for (ICSSNode child = getFirstChild(); child != null; child = child.getNextSibling()) {
+ ICSSNode found = ((CSSNodeImpl) child).getContainerNode(offset);
+ if (found != null)
+ return (CSSNodeImpl) found;
+ }
+
+ return this;
+ }
+
+ /**
+ */
+ public IFactoryRegistry getFactoryRegistry() {
+ ICSSModel model = getOwnerDocument().getModel();
+ if (model != null) {
+ IFactoryRegistry reg = model.getFactoryRegistry();
+ if (reg != null)
+ return reg;
+ }
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNode
+ */
+ public ICSSNode getFirstChild() {
+ return this.fFirstChild;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNode
+ */
+ public ICSSNode getLastChild() {
+ return this.fLastChild;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNode
+ */
+ public ICSSNode getNextSibling() {
+ return this.fNextSibling;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSNode
+ * @param offset
+ * int
+ */
+ ICSSNode getNodeAt(int offset) {
+ // the same as getContainerNode()
+ return getContainerNode(offset);
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSDocument
+ */
+ public ICSSDocument getOwnerDocument() {
+ return this.fOwnerDocument;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNode
+ */
+ public ICSSNode getParentNode() {
+ return this.fParentNode;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNode
+ */
+ public ICSSNode getPreviousSibling() {
+ return this.fPreviousSibling;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSFactory
+ */
+ ICSSNode getRootNode() {
+ CSSNodeImpl parent = (CSSNodeImpl) getParentNode();
+ if (parent == null)
+ return this;
+ return parent.getRootNode();
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean hasChildNodes() {
+ return (this.fFirstChild != null);
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean hasProperties() {
+ return false;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param newChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param refChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ protected CSSNodeImpl insertBefore(CSSNodeImpl newChild, CSSNodeImpl refChild) throws org.w3c.dom.DOMException {
+ if (newChild == null)
+ return null;
+
+ CSSNodeImpl child = newChild;
+ CSSNodeImpl next = refChild;
+ CSSNodeImpl prev = null;
+ if (next == null) {
+ prev = this.fLastChild;
+ this.fLastChild = child;
+ }
+ else {
+ prev = (CSSNodeImpl) next.getPreviousSibling();
+ next.setPreviousSibling(child);
+ }
+
+ if (prev == null)
+ this.fFirstChild = child;
+ else
+ prev.setNextSibling(child);
+ child.setPreviousSibling(prev);
+ child.setNextSibling(next);
+ child.setParentNode(this);
+
+ notifyChildReplaced(child, null);
+
+ return newChild;
+ }
+
+ /**
+ * @param newAttr
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param oldAttr
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ protected void notifyAttrReplaced(CSSNodeImpl newAttr, CSSNodeImpl oldAttr) {
+ // for model
+ ICSSDocument doc = getContainerDocument();
+ if (doc == null)
+ return;
+ CSSModelImpl model = (CSSModelImpl) doc.getModel();
+ if (model == null)
+ return;
+ model.attrReplaced(this, newAttr, oldAttr);
+
+ // for adapters
+ int type = CHANGE;
+ if (newAttr == null)
+ type = REMOVE;
+ else if (oldAttr == null)
+ type = ADD;
+ notify(type, oldAttr, oldAttr, newAttr, getStartOffset());
+ }
+
+ /**
+ * @param newChild
+ * com.ibm.sed.css.treemodel.CSSNode
+ * @param oldChild
+ * com.ibm.sed.css.treemodel.CSSNode
+ */
+ protected void notifyChildReplaced(CSSNodeImpl newChild, CSSNodeImpl oldChild) {
+ // for model
+ ICSSDocument doc = getContainerDocument();
+ if (doc == null)
+ return;
+ CSSModelImpl model = (CSSModelImpl) doc.getModel();
+ if (model == null)
+ return;
+ model.childReplaced(this, newChild, oldChild);
+
+ // for adapters
+ int type = CHANGE;
+ if (newChild == null)
+ type = REMOVE;
+ else if (oldChild == null)
+ type = ADD;
+ notify(type, oldChild, oldChild, newChild, getStartOffset());
+ }
+
+ /**
+ * @param attr
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ void removeAttributeNode(CSSNodeImpl attr) {
+ // find
+ int nAttrs = fAttrs.getLength();
+ for (int i = 0; i < nAttrs; i++) {
+ if (fAttrs.item(i) == attr) {
+ fAttrs.removeNode(i);
+ notifyAttrReplaced(null, attr);
+ return;
+ }
+ }
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param newChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ protected CSSNodeImpl removeChild(CSSNodeImpl oldChild) throws org.w3c.dom.DOMException {
+ if (oldChild == null)
+ return null;
+ if (oldChild.getParentNode() != this)
+ return null;
+
+ // close import rules
+ ImportRuleCollector trav = new ImportRuleCollector();
+ trav.apply(oldChild);
+ Iterator it = trav.getRules().iterator();
+ while (it.hasNext()) {
+ ((CSSImportRuleImpl) it.next()).closeStyleSheet();
+ }
+
+ CSSNodeImpl child = oldChild;
+ CSSNodeImpl prev = (CSSNodeImpl) child.getPreviousSibling();
+ CSSNodeImpl next = (CSSNodeImpl) child.getNextSibling();
+
+ if (prev == null)
+ this.fFirstChild = next;
+ else
+ prev.setNextSibling(next);
+
+ if (next == null)
+ this.fLastChild = prev;
+ else
+ next.setPreviousSibling(prev);
+
+ child.setPreviousSibling(null);
+ child.setNextSibling(null);
+ child.setParentNode(null);
+
+ notifyChildReplaced(null, child);
+
+ return child;
+ }
+
+ /**
+ *
+ */
+ void removeChildNodes() {
+ ICSSNode nextChild = null;
+ for (ICSSNode child = getFirstChild(); child != null; child = nextChild) {
+ nextChild = child.getNextSibling();
+ removeChild((CSSNodeImpl) child);
+ }
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param newChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @param oldChild
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ protected CSSNodeImpl replaceChild(CSSNodeImpl newChild, CSSNodeImpl oldChild) throws org.w3c.dom.DOMException {
+ if (oldChild == null)
+ return newChild;
+ if (newChild != null)
+ insertBefore(newChild, oldChild);
+ return removeChild(oldChild);
+ }
+
+ /**
+ * @param name
+ * java.lang.String
+ * @param value
+ * java.lang.String
+ */
+ void setAttribute(String name, String value) {
+ if (name == null)
+ return;
+
+ CSSAttrImpl attr = getAttributeNode(name);
+ if (attr != null) {
+ String oldValue = attr.getValue();
+ if (value != null && value.equals(oldValue))
+ return;
+ if (value == null) {
+ if (oldValue != null) {
+ removeAttributeNode(attr);
+ }
+ return;
+ }
+ }
+ else {
+ if (value == null)
+ return;
+ if (fAttrs == null)
+ fAttrs = new CSSNamedNodeMapImpl();
+ CSSDocumentImpl doc = (CSSDocumentImpl) getOwnerDocument();
+ if (doc == null)
+ return;
+ attr = (CSSAttrImpl) doc.createCSSAttr(name);
+ attr.setOwnerCSSNode(this);
+ fAttrs.appendNode(attr);
+ notifyAttrReplaced(attr, null);
+ }
+ attr.setValue(value);
+ }
+
+ /**
+ * @param cssText
+ * java.lang.String
+ */
+ public void setCssText(String cssText) {
+ // TODO : call flat model parser and replace myself with new three!!
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+
+ /**
+ * @param nextSibling
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ private void setNextSibling(ICSSNode nextSibling) {
+ this.fNextSibling = (CSSNodeImpl) nextSibling;
+ }
+
+ /**
+ * @param ownerDocument
+ * com.ibm.sed.css.interfaces.CSSDocument
+ */
+ void setOwnerDocument(ICSSDocument ownerDocument) {
+ this.fOwnerDocument = (CSSDocumentImpl) ownerDocument;
+ }
+
+ /**
+ * @param parentNode
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ private void setParentNode(ICSSNode parentNode) {
+ this.fParentNode = (CSSNodeImpl) parentNode;
+ }
+
+ /**
+ * @param previousSibling
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ private void setPreviousSibling(ICSSNode previousSibling) {
+ this.fPreviousSibling = (CSSNodeImpl) previousSibling;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeListImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeListImpl.java
new file mode 100644
index 0000000000..92c85597fa
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeListImpl.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSNodeList;
+
+/**
+ *
+ */
+class CSSNodeListImpl extends AbstractCSSNodeList implements ICSSNodeList {
+
+ /**
+ * CSSNodeListImpl constructor comment.
+ */
+ CSSNodeListImpl() {
+ super();
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param index
+ * int
+ */
+ public ICSSNode item(int index) {
+ return itemImpl(index);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPageRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPageRuleImpl.java
new file mode 100644
index 0000000000..429e859373
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPageRuleImpl.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.w3c.dom.DOMException;
+
+
+/**
+ *
+ */
+class CSSPageRuleImpl extends CSSRuleDeclContainer implements ICSSPageRule {
+
+ ICSSSelectorList fSelectorList = new CSSSelectorListImpl(null);
+
+ /**
+ *
+ */
+ CSSPageRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSPageRuleImpl
+ */
+ CSSPageRuleImpl(CSSPageRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSPageRuleImpl cloned = new CSSPageRuleImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ String extractPreString() {
+ StringBuffer preStr = new StringBuffer("@page ");//$NON-NLS-1$
+ preStr.append(getSelectorText());
+
+ return preStr.toString();
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return PAGERULE_NODE;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelectorList
+ */
+ public ICSSSelectorList getSelectors() {
+ return fSelectorList;
+ }
+
+ /**
+ * The parsable textual representation of the page selector for the rule.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is
+ * readonly.
+ */
+ public String getSelectorText() {
+ return getAttribute(SELECTOR);
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return PAGE_RULE;
+ }
+
+ /**
+ *
+ */
+ public void setSelectorText(String selectorText) throws org.w3c.dom.DOMException {
+ setAttribute(SELECTOR, selectorText);
+ fSelectorList = new CSSSelectorListImpl(selectorText);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveContainer.java
new file mode 100644
index 0000000000..ba20a24eff
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveContainer.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+
+/**
+ *
+ */
+abstract class CSSPrimitiveContainer extends CSSPrimitiveValueImpl {
+
+ /**
+ * CSSRegionContainer constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSPrimitiveValueImpl
+ */
+ CSSPrimitiveContainer(CSSPrimitiveContainer that) {
+ super(that);
+ }
+
+ /**
+ * CSSRegionContainer constructor comment.
+ *
+ * @param primitiveType
+ * short
+ */
+ CSSPrimitiveContainer(short primitiveType) {
+ super(primitiveType);
+ }
+
+ /**
+ *
+ */
+ protected abstract void initPrimitives();
+
+ /**
+ * @param ownerDocument
+ * com.ibm.sed.css.interfaces.ICSSDocument
+ */
+ void setOwnerDocument(ICSSDocument ownerDocument) {
+ super.setOwnerDocument(ownerDocument);
+
+ initPrimitives();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveValueImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveValueImpl.java
new file mode 100644
index 0000000000..285d4d0405
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSPrimitiveValueImpl.java
@@ -0,0 +1,374 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.Counter;
+import org.w3c.dom.css.RGBColor;
+import org.w3c.dom.css.Rect;
+
+
+/**
+ *
+ */
+class CSSPrimitiveValueImpl extends CSSRegionContainer implements ICSSPrimitiveValue {
+
+ protected short fPrimitiveType = CSS_UNKNOWN;
+ private float fFloatValue = 0.0f;
+ private String fStringValue = null;
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSPrimitiveValueImpl
+ */
+ CSSPrimitiveValueImpl(CSSPrimitiveValueImpl that) {
+ super(that);
+
+ this.fPrimitiveType = that.fPrimitiveType;
+ this.fFloatValue = that.fFloatValue;
+ this.fStringValue = that.fStringValue;
+ }
+
+ /**
+ *
+ */
+ CSSPrimitiveValueImpl(short primitiveType) {
+ super();
+ fPrimitiveType = primitiveType;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSPrimitiveValueImpl cloned = new CSSPrimitiveValueImpl(this);
+
+ return cloned;
+ }
+
+ /**
+ * This method is used to get the Counter value. If this CSS value doesn't
+ * contain a counter value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>Counter</code> interface.
+ *
+ * @return The Counter value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a Counter value (e.g. this is not
+ * <code>CSS_COUNTER</code>).
+ */
+ public Counter getCounterValue() throws DOMException {
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public java.lang.String getCSSValueText() {
+ return getCssText();
+ }
+
+ /**
+ * A code defining the type of the value as defined above.
+ */
+ public short getCssValueType() {
+ if (getPrimitiveType() == CSS_INHERIT_PRIMITIVE) {
+ return CSS_INHERIT;
+ }
+ else {
+ return CSS_PRIMITIVE_VALUE;
+ }
+ }
+
+ /**
+ * This method is used to get a float value in a specified unit. If this
+ * CSS value doesn't contain a float value or can't be converted into the
+ * specified unit, a <code>DOMException</code> is raised.
+ *
+ * @param unitType
+ * A unit code to get the float value. The unit code can only
+ * be a float unit type (i.e. <code>CSS_NUMBER</code>,
+ * <code>CSS_PERCENTAGE</code>,<code>CSS_EMS</code>,
+ * <code>CSS_EXS</code>,<code>CSS_PX</code>,
+ * <code>CSS_CM</code>,<code>CSS_MM</code>,
+ * <code>CSS_IN</code>,<code>CSS_PT</code>,
+ * <code>CSS_PC</code>,<code>CSS_DEG</code>,
+ * <code>CSS_RAD</code>,<code>CSS_GRAD</code>,
+ * <code>CSS_MS</code>,<code>CSS_S</code>,
+ * <code>CSS_HZ</code>,<code>CSS_KHZ</code>,
+ * <code>CSS_DIMENSION</code>).
+ * @return The float value in the specified unit.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a float value or if the float value can't be
+ * converted into the specified unit.
+ */
+ public float getFloatValue(short unitType) throws DOMException {
+ switch (fPrimitiveType) {
+ case CSS_NUMBER :
+ case CSS_PERCENTAGE :
+ case CSS_EMS :
+ case CSS_EXS :
+ case CSS_PX :
+ case CSS_CM :
+ case CSS_MM :
+ case CSS_IN :
+ case CSS_PT :
+ case CSS_PC :
+ case CSS_DEG :
+ case CSS_RAD :
+ case CSS_GRAD :
+ case CSS_MS :
+ case CSS_S :
+ case CSS_HZ :
+ case CSS_KHZ :
+ case CSS_DIMENSION :
+ case CSS_INTEGER :
+ case CSS_HASH :
+ return fFloatValue;
+ default :
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/01/17
+ * 12:12:18)
+ *
+ * @return short
+ */
+ public short getNodeType() {
+ return PRIMITIVEVALUE_NODE;
+ }
+
+ /**
+ * The type of the value as defined by the constants specified above.
+ */
+ public short getPrimitiveType() {
+ return fPrimitiveType;
+ }
+
+ /**
+ * This method is used to get the Rect value. If this CSS value doesn't
+ * contain a rect value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>Rect</code> interface.
+ *
+ * @return The Rect value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a Rect value. (e.g. this is not
+ * <code>CSS_RECT</code>).
+ */
+ public Rect getRectValue() throws DOMException {
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+
+ /**
+ * This method is used to get the RGB color. If this CSS value doesn't
+ * contain a RGB color value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>RGBColor</code> interface.
+ *
+ * @return the RGB color value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the attached property
+ * can't return a RGB color value (e.g. this is not
+ * <code>CSS_RGBCOLOR</code>).
+ */
+ public RGBColor getRGBColorValue() throws DOMException {
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+
+ /**
+ * This method is used to get the string value. If the CSS value doesn't
+ * contain a string value, a <code>DOMException</code> is raised. Some
+ * properties (like 'font-family' or 'voice-family') convert a whitespace
+ * separated list of idents to a string.
+ *
+ * @return The string value in the current unit. The current
+ * <code>primitiveType</code> can only be a string unit type
+ * (i.e. <code>CSS_STRING</code>,<code>CSS_URI</code>,
+ * <code>CSS_IDENT</code> and <code>CSS_ATTR</code>).
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a string value.
+ */
+ public String getStringValue() throws DOMException {
+ switch (fPrimitiveType) {
+ case CSS_STRING :
+ case CSS_URI :
+ case CSS_IDENT :
+ case CSS_ATTR :
+ case CSS_URANGE :
+ case CSS_FORMAT :
+ case CSS_LOCAL :
+ case CSS_HASH :
+ case CSS_COMMA :
+ case CSS_SLASH :
+ case CSS_INHERIT_PRIMITIVE :
+ return fStringValue;
+ default :
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void notifyValueChanged(String oldValue) {
+ // for model
+ ICSSDocument doc = getContainerDocument();
+ if (doc == null)
+ return;
+ CSSModelImpl model = (CSSModelImpl) doc.getModel();
+ if (model == null)
+ return;
+ model.valueChanged(this, oldValue);
+
+ // for adapters
+ notify(CHANGE, new Short(fPrimitiveType), null, null, getStartOffset());
+ }
+
+ /**
+ * A method to set the float value with a specified unit. If the property
+ * attached with this value can not accept the specified unit or the float
+ * value, the value will be unchanged and a <code>DOMException</code>
+ * will be raised.
+ *
+ * @param unitType
+ * A unit code as defined above. The unit code can only be a
+ * float unit type (i.e. <code>CSS_NUMBER</code>,
+ * <code>CSS_PERCENTAGE</code>,<code>CSS_EMS</code>,
+ * <code>CSS_EXS</code>,<code>CSS_PX</code>,
+ * <code>CSS_CM</code>,<code>CSS_MM</code>,
+ * <code>CSS_IN</code>,<code>CSS_PT</code>,
+ * <code>CSS_PC</code>,<code>CSS_DEG</code>,
+ * <code>CSS_RAD</code>,<code>CSS_GRAD</code>,
+ * <code>CSS_MS</code>,<code>CSS_S</code>,
+ * <code>CSS_HZ</code>,<code>CSS_KHZ</code>,
+ * <code>CSS_DIMENSION</code>).
+ * @param floatValue
+ * The new float value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the attached property
+ * doesn't support the float value or the unit type. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public void setFloatValue(short unitType, float floatValue) throws DOMException {
+ switch (unitType) {
+ case CSS_NUMBER :
+ case CSS_PERCENTAGE :
+ case CSS_EMS :
+ case CSS_EXS :
+ case CSS_PX :
+ case CSS_CM :
+ case CSS_MM :
+ case CSS_IN :
+ case CSS_PT :
+ case CSS_PC :
+ case CSS_DEG :
+ case CSS_RAD :
+ case CSS_GRAD :
+ case CSS_MS :
+ case CSS_S :
+ case CSS_HZ :
+ case CSS_KHZ :
+ case CSS_DIMENSION :
+ case CSS_INTEGER :
+ String oldValue = getCSSValueText();
+ fPrimitiveType = unitType;
+ fFloatValue = floatValue;
+ notifyValueChanged(oldValue);
+ break;
+ default :
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * A method to set the string value with the specified unit. If the
+ * property attached to this value can't accept the specified unit or the
+ * string value, the value will be unchanged and a
+ * <code>DOMException</code> will be raised.
+ *
+ * @param stringType
+ * A string code as defined above. The string code can only be
+ * a string unit type (i.e. <code>CSS_STRING</code>,
+ * <code>CSS_URI</code>,<code>CSS_IDENT</code>, and
+ * <code>CSS_ATTR</code>).
+ * @param stringValue
+ * The new string value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a string value or if the string value can't be
+ * converted into the specified unit. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public void setStringValue(short stringType, String stringValue) throws DOMException {
+ switch (stringType) {
+ case CSS_STRING :
+ case CSS_URI :
+ case CSS_IDENT :
+ case CSS_ATTR :
+ case CSS_URANGE :
+ case CSS_FORMAT :
+ case CSS_LOCAL :
+ case CSS_HASH :
+ case CSS_COMMA :
+ case CSS_SLASH :
+ case CSS_INHERIT_PRIMITIVE :
+ String oldValue = getCSSValueText();
+ fPrimitiveType = stringType;
+ fStringValue = stringValue;
+ notifyValueChanged(oldValue);
+ break;
+ default :
+ throw new DOMException(DOMException.INVALID_ACCESS_ERR, "");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/01/24
+ * 15:06:25)
+ *
+ * @param floatValue
+ * float
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public void setValue(float floatValue) throws org.w3c.dom.DOMException {
+ setFloatValue(getPrimitiveType(), floatValue);
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/01/24
+ * 15:06:25)
+ *
+ * @param stringValue
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public void setValue(java.lang.String stringValue) throws org.w3c.dom.DOMException {
+ setStringValue(getPrimitiveType(), stringValue);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRegionContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRegionContainer.java
new file mode 100644
index 0000000000..e83c8ce051
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRegionContainer.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+
+/**
+ *
+ */
+abstract class CSSRegionContainer extends CSSNodeImpl {
+
+ private ITextRegion fFirstRegion = null;
+ private ITextRegion fLastRegion = null;
+ private IStructuredDocumentRegion fParentRegion = null;
+
+ /**
+ * CSSRegionContainer constructor comment.
+ */
+ CSSRegionContainer() {
+ super();
+ }
+
+ /**
+ * CSSRegionContainer constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSRegionContainer
+ */
+ CSSRegionContainer(CSSRegionContainer that) {
+ super(that);
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getCssText() {
+ if (fFirstRegion == null || fLastRegion == null)
+ return generateSource();
+
+ ITextRegionList regions = fParentRegion.getRegions();
+ StringBuffer source = new StringBuffer();
+ boolean bIn = false;
+ for (int i = 0; i < regions.size(); i++) {
+ ITextRegion current = regions.get(i);
+ if (bIn) {
+ source.append(fParentRegion.getText(current));
+ if (current == fLastRegion)
+ break;
+ }
+ else {
+ if (current == fFirstRegion) {
+ bIn = true;
+ source.append(fParentRegion.getText(current));
+ if (current == fLastRegion)
+ break;
+ }
+ }
+ }
+
+ return source.toString();
+ }
+
+ /**
+ * @return int
+ */
+ public int getEndOffset() {
+ ITextRegion region = getLastRegion();
+ if (region == null || fParentRegion == null) {
+ return -1;
+ }
+ else {
+ return fParentRegion.getEndOffset(region);
+ }
+ /*
+ * int offset = 0; if (lastRegion != null) offset =
+ * lastRegion.getEnd();
+ *
+ * CSSStructuredDocumentRegionContainer item = null; ICSSNode node =
+ * getParentNode(); while (node != null) { if (node instanceof
+ * CSSStructuredDocumentRegionContainer) item =
+ * (CSSStructuredDocumentRegionContainer) node; node =
+ * node.getParentNode(); } if (item != null) { // assumption: regions
+ * are attached to FIRST node IStructuredDocumentRegion flatNode =
+ * item.getFirstStructuredDocumentRegion(); if (flatNode != null)
+ * return (flatNode.getStart() + offset); } return 0;
+ */
+ }
+
+ IStructuredDocumentRegion getDocumentRegion() {
+ return fParentRegion;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ */
+ ITextRegion getFirstRegion() {
+ return fFirstRegion;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ */
+ ITextRegion getLastRegion() {
+ return fLastRegion;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ * @param index
+ * int
+ */
+ ITextRegion getRegion(int index) {
+ if (getFirstRegion() == null)
+ return null;
+ ITextRegionList regions = fParentRegion.getRegions();
+
+ for (int i = 0; i < regions.size(); i++) {
+ if (regions.get(i) == getFirstRegion()) {
+ if (i + index < regions.size()) {
+ ITextRegion target = regions.get(i + index);
+ if (target.getStart() <= getLastRegion().getStart())
+ return target;
+ }
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return int
+ */
+ int getRegionCount() {
+ validateRange();
+
+ if (getFirstRegion() == null)
+ return 0;
+ if (getFirstRegion() == getLastRegion())
+ return 1;
+ ITextRegionList regions = fParentRegion.getRegions();
+
+ int j = 0;
+ for (int i = 0; i < regions.size(); i++) {
+ ITextRegion current = regions.get(i);
+ if (j != 0 || current == getFirstRegion())
+ j++;
+ if (current == getLastRegion())
+ break;
+ }
+ return j;
+ }
+
+ /**
+ * @return int
+ */
+ public int getStartOffset() {
+ ITextRegion region = getFirstRegion();
+ if (region == null || fParentRegion == null) {
+ return -1;
+ }
+ else {
+ return fParentRegion.getStartOffset(region);
+ }
+ /*
+ * int offset = 0; if (firstRegion != null) offset =
+ * firstRegion.getStart();
+ *
+ * CSSStructuredDocumentRegionContainer item = null; ICSSNode node =
+ * getParentNode(); while (node != null) { if (node instanceof
+ * CSSStructuredDocumentRegionContainer) item =
+ * (CSSStructuredDocumentRegionContainer) node; node =
+ * node.getParentNode(); } if (item != null) { // assumption: regions
+ * are attached to FIRST node IStructuredDocumentRegion flatNode =
+ * item.getFirstStructuredDocumentRegion(); if (flatNode != null)
+ * return (flatNode.getStart() + offset); } return 0;
+ */
+ }
+
+ /**
+ * @param region
+ * com.ibm.sed.structuredDocument.ITextRegion
+ * @deprecated
+ */
+ ITextRegion setFirstRegion(ITextRegion region) {
+ this.fFirstRegion = region;
+ return region;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ * @param lastRegion
+ * com.ibm.sed.structuredDocument.ITextRegion
+ * @deprecated
+ */
+ ITextRegion setLastRegion(ITextRegion lastRegion) {
+ this.fLastRegion = lastRegion;
+ return lastRegion;
+ }
+
+ /**
+ * @param firstRegion
+ * com.ibm.sed.structuredDocument.ITextRegion
+ * @param lastRegion
+ * com.ibm.sed.structuredDocument.ITextRegion
+ */
+ void setRangeRegion(IStructuredDocumentRegion parentRegion, ITextRegion firstRegion, ITextRegion lastRegion) {
+ this.fParentRegion = parentRegion;
+ this.fFirstRegion = firstRegion;
+ this.fLastRegion = lastRegion;
+
+ if (firstRegion == null && lastRegion == null) {
+ setFirstRegion(null);
+ setLastRegion(null);
+ }
+ else { // range validation
+ validateRange();
+ }
+ }
+
+ /**
+ * @return boolean
+ */
+ private boolean validateRange() {
+ boolean bModified = false;
+
+ if (this.fFirstRegion != null || this.fLastRegion != null) {
+ if (this.fFirstRegion == null) {
+ this.fFirstRegion = this.fLastRegion;
+ bModified = true;
+ }
+ else if (this.fLastRegion == null) {
+ this.fLastRegion = this.fFirstRegion;
+ bModified = true;
+ }
+ else if (this.fFirstRegion.getStart() > this.fLastRegion.getStart()) {
+ // need to swap first for last
+ ITextRegion reg = fFirstRegion;
+ fFirstRegion = fLastRegion;
+ fLastRegion = reg;
+ bModified = true;
+ }
+ }
+ return bModified;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleDeclContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleDeclContainer.java
new file mode 100644
index 0000000000..d983a425e6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleDeclContainer.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.css.CSSStyleDeclaration;
+
+
+/**
+ *
+ */
+abstract class CSSRuleDeclContainer extends CSSRuleImpl {
+
+ /**
+ * CSSRuleDeclContainer constructor comment.
+ */
+ CSSRuleDeclContainer() {
+ super();
+ }
+
+ /**
+ * CSSRuleDeclContainer constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSRuleImpl
+ */
+ CSSRuleDeclContainer(CSSRuleDeclContainer that) {
+ super(that);
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ abstract String extractPreString();
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleDeclaration
+ */
+ public CSSStyleDeclaration getStyle() {
+
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSStyleDeclaration)
+ return (CSSStyleDeclaration) node;
+ }
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleImpl.java
new file mode 100644
index 0000000000..d6cf4aae79
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleImpl.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSStyleSheet;
+
+
+/**
+ *
+ */
+abstract class CSSRuleImpl extends CSSStructuredDocumentRegionContainer implements CSSRule {
+
+ /**
+ *
+ */
+ CSSRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSRuleImpl
+ */
+ CSSRuleImpl(CSSRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * If this rule is contained inside another rule (e.g. a style rule inside
+ * an
+ *
+ * @media block), this is the containing rule. If this rule is not nested
+ * inside any other rules, this returns <code>null</code>.
+ */
+ public CSSRule getParentRule() {
+ ICSSNode rule = getParentNode();
+
+ // parent rule is used only if parent is media rule
+ if (rule instanceof CSSMediaRuleImpl)
+ return (CSSRule) rule;
+
+ return null;
+ }
+
+ /**
+ * The style sheet that contains this rule.
+ */
+ public CSSStyleSheet getParentStyleSheet() {
+ ICSSNode parent = getParentNode();
+ while (parent != null) {
+ if (parent instanceof CSSStyleSheetImpl)
+ return (CSSStyleSheet) parent;
+ parent = parent.getParentNode();
+ }
+ return null;
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public abstract short getType();
+
+ /**
+ * @return boolean
+ */
+ public boolean hasProperties() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleListImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleListImpl.java
new file mode 100644
index 0000000000..51f15a490b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSRuleListImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSRuleList;
+
+/**
+ *
+ */
+public class CSSRuleListImpl extends AbstractCSSNodeList implements CSSRuleList {
+
+ /**
+ *
+ */
+ CSSRuleListImpl() {
+ super();
+ }
+
+ /**
+ * Used to retrieve a CSS rule by ordinal index. The order in this
+ * collection represents the order of the rules in the CSS style sheet. If
+ * index is greater than or equal to the number of rules in the list, this
+ * returns <code>null</code>.
+ *
+ * @param indexIndex
+ * into the collection
+ * @return The style rule at the <code>index</code> position in the
+ * <code>CSSRuleList</code>, or <code>null</code> if that is
+ * not a valid index.
+ */
+ public CSSRule item(int index) {
+ return (CSSRule) itemImpl(index);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelector.java
new file mode 100644
index 0000000000..e3cdea06a1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelector.java
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.wst.css.core.adapters.IStyleSelectorAdapter;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorCombinator;
+import org.eclipse.wst.css.core.document.ICSSSelectorItem;
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.NameValidator;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ *
+ */
+class CSSSelector implements ICSSSelector {
+
+ private int fSpecificity = -1;
+ private String fCachedString = null;
+ private List fTokens = null;
+ private List fItems = null;
+ private List fParseErrors = null;
+ private List fNameErrors = null;
+
+ CSSSelector(List tokens) {
+ fTokens = new ArrayList(tokens);
+ }
+
+ /**
+ * @return boolean
+ * @param obj
+ * java.lang.Object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null || this.getClass() != obj.getClass())
+ return false;
+
+ CSSSelector foreign = (CSSSelector) obj;
+
+ // if (fSpecificity != foreign.fSpecificity) return false;
+
+ if (getLength() != foreign.getLength())
+ return false;
+
+ for (int i = 0; i < getLength(); i++) {
+ if (!getItem(i).equals(foreign.getItem(i)))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelectorItem
+ * @param index
+ * int
+ */
+ public ICSSSelectorItem getItem(int index) {
+ if (fItems == null) {
+ fItems = parseSelector(fTokens);
+ }
+ if (fItems != null && 0 <= index && index < fItems.size()) {
+ return (ICSSSelectorItem) fItems.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * @return java.util.Iterator
+ */
+ public Iterator getIterator() {
+ if (fItems == null) {
+ fItems = parseSelector(fTokens);
+ }
+ return (fItems != null) ? fItems.iterator() : null;
+ }
+
+ /**
+ * @return int
+ */
+ public int getLength() {
+ if (fItems == null) {
+ fItems = parseSelector(fTokens);
+ }
+ return (fItems != null) ? fItems.size() : 0;
+ }
+
+ /**
+ * @return org.w3c.dom.Element
+ */
+ private Element getParentElement(Element element) {
+ try {
+ element = (Element) element.getParentNode();
+ }
+ catch (Exception ex) {
+ // cast error or null pointer ...
+ element = null;
+ }
+ return element;
+ }
+
+ /**
+ * @return org.w3c.dom.Element
+ */
+ private Element getPreviousElement(Element element) {
+ Element p = null;
+ for (Node node = element.getPreviousSibling(); node != null; node = node.getPreviousSibling()) {
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ p = (Element) node;
+ break;
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Calculate a selector's specificity a = the number of ID attributes in
+ * the selector b = the number of other attributes and pseudo-classes in
+ * the selector c = the number of element names in the selector (ignore
+ * pseudo-elements) Concatenating the three numbers a-b-c (in a number
+ * system with a large base) gives the specificity.
+ *
+ * @return int
+ */
+ public int getSpecificity() {
+ if (fSpecificity < 0) {
+ int nIDs = 0;
+ int nAttributes = 0;
+ int nElements = 0;
+ Iterator i = getIterator();
+ while (i.hasNext()) {
+ ICSSSelectorItem item = (ICSSSelectorItem) i.next();
+ if (item instanceof CSSSimpleSelector) {
+ CSSSimpleSelector selector = (CSSSimpleSelector) item;
+ nIDs += selector.getNumOfIDs();
+ nAttributes += selector.getNumOfAttributes();
+ nAttributes += selector.getNumOfClasses();
+ nAttributes += selector.getNumOfPseudoNames();
+ if (!selector.isUniversal()) {
+ nElements++;
+ }
+ }
+ }
+ fSpecificity = nIDs * 10000 + nAttributes * 100 + nElements;
+ }
+
+ return fSpecificity;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getString() {
+ if (fCachedString == null) {
+ StringBuffer buf = new StringBuffer();
+ Iterator i = getIterator();
+ while (i.hasNext()) {
+ ICSSSelectorItem item = (ICSSSelectorItem) i.next();
+ if (item instanceof CSSSelectorCombinator) {
+ // If item is DESCENDANT combinator, it is just single
+ // space.
+ // Then, you dont have to append string..
+ if (((CSSSelectorCombinator) item).getCombinatorType() != ICSSSelectorCombinator.DESCENDANT) {
+ buf.append(" ");//$NON-NLS-1$
+ buf.append(item.getString());
+ }
+ buf.append(" ");//$NON-NLS-1$
+ }
+ else {
+ buf.append(item.getString());
+ }
+ }
+ fCachedString = buf.toString();
+ }
+
+ return fCachedString;
+ }
+
+ /**
+ * @return boolean
+ * @param element
+ * org.w3c.dom.Element
+ */
+ public boolean match(org.w3c.dom.Element element, java.lang.String pseudoName) {
+ Element target = element;
+ char combinatorType = ICSSSelectorCombinator.UNKNOWN;
+ Element chunkStartElement = null; // for CHILD and ADJACENT
+ // combinator
+ int chunkStartItem = -1; // for CHILD and ADJACENT combinator
+ int numItems = getLength();
+ for (int iItem = numItems - 1; iItem >= 0; iItem--) {
+ // Check Selector Items
+ ICSSSelectorItem item = getItem(iItem);
+ if (item instanceof ICSSSimpleSelector) {
+ // Simple Selector
+ if (target == null)
+ return false;
+ if (!matchExactly((ICSSSimpleSelector) item, target, pseudoName)) {
+ switch (combinatorType) {
+ case ICSSSelectorCombinator.DESCENDANT :
+ do {
+ target = getParentElement(target);
+ if (target == null)
+ return false;
+ }
+ while (!matchExactly((ICSSSimpleSelector) item, target, pseudoName));
+ break;
+ case ICSSSelectorCombinator.CHILD :
+ case ICSSSelectorCombinator.ADJACENT :
+ if (chunkStartElement != null && chunkStartElement != element) {
+ // previous conbinator must be DESCENDENT.
+ // goto parent
+ target = getParentElement(chunkStartElement);
+ iItem = chunkStartItem + 1;
+ chunkStartElement = null;
+ chunkStartItem = -1;
+ break;
+ }
+ default :
+ // other combinators are not supported yet.
+ return false;
+ }
+ }
+ }
+ else if (item instanceof ICSSSelectorCombinator) {
+ // Combinator ( "+", ">", " ", ...)
+ if (iItem == numItems - 1)
+ return false; // last item is combinator
+
+ ICSSSelectorCombinator sc = (ICSSSelectorCombinator) item;
+ combinatorType = sc.getCombinatorType();
+ switch (combinatorType) {
+ case ICSSSelectorCombinator.DESCENDANT :
+ target = getParentElement(target);
+ break;
+ case ICSSSelectorCombinator.CHILD :
+ case ICSSSelectorCombinator.ADJACENT :
+ if (chunkStartElement == null) {
+ chunkStartElement = target;
+ chunkStartItem = iItem + 1; // safe because this
+ // is not a last item.
+ }
+ if (combinatorType == ICSSSelectorCombinator.CHILD) {
+ target = getParentElement(target);
+ }
+ else {
+ target = getPreviousElement(target);
+ }
+ break;
+ }
+ }
+ else {
+ // what is this item ???
+ return false;
+ }
+ }
+ // OK this selector maches the element.
+ return true;
+
+ }
+
+ /**
+ * @return boolean
+ */
+ private boolean matchExactly(ICSSSimpleSelector selector, Element element, String pseudoName) {
+ IStyleSelectorAdapter adapter = (IStyleSelectorAdapter) ((INodeNotifier) element).getAdapterFor(IStyleSelectorAdapter.class);
+ if (adapter != null) {
+ return adapter.match(selector, element, pseudoName);
+ }
+
+ if (element == null)
+ return false;
+ int i;
+ String key;
+
+ // TODO: PseudoName
+
+ // check tag name
+ if (!selector.isUniversal() && !element.getNodeName().equals(selector.getName()))
+ return false;
+
+ // check id
+ i = selector.getNumOfIDs();
+ if (i > 0) {
+ if (i > 1)
+ return false;
+ key = element.getAttribute("id");//$NON-NLS-1$
+ if (key == null)
+ return false;
+ if (!selector.getID(0).equals(key))
+ return false;
+ }
+
+ // check class
+ i = selector.getNumOfClasses();
+ if (i > 0) {
+ key = element.getAttribute("class");//$NON-NLS-1$
+ if (key == null)
+ return false;
+ StringTokenizer tokenizer = new StringTokenizer(key);
+ for (i = i - 1; i >= 0; i--) {
+ boolean ok = false;
+ while (tokenizer.hasMoreTokens()) {
+ if (selector.getClass(i).equals(tokenizer.nextToken())) {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok)
+ return false;
+ }
+ }
+
+ // check attributes
+ for (i = selector.getNumOfAttributes() - 1; i >= 0; i--) {
+ StringTokenizer tokenizer = new StringTokenizer(selector.getAttribute(i), "=~| \t\r\n\f");//$NON-NLS-1$
+ int countTokens = tokenizer.countTokens();
+ if (countTokens > 0) {
+ String attrValue = element.getAttribute(tokenizer.nextToken());
+ if (attrValue == null)
+ return false;
+ if (countTokens > 1) {
+ String token = tokenizer.nextToken("= \t\r\n\f");//$NON-NLS-1$
+ StringTokenizer attrValueTokenizer = null;
+ if (token.equals("~")) {//$NON-NLS-1$
+ attrValueTokenizer = new StringTokenizer(attrValue);
+ }
+ else if (token.equals("|")) {//$NON-NLS-1$
+ attrValueTokenizer = new StringTokenizer(attrValue, "-");//$NON-NLS-1$
+ }
+ if (attrValueTokenizer != null) {
+ if (tokenizer.hasMoreTokens()) {
+ token = tokenizer.nextToken();
+ boolean ok = false;
+ while (attrValueTokenizer.hasMoreTokens()) {
+ if (token.equals(attrValueTokenizer.nextToken())) {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok)
+ return false;
+ }
+ }
+ else {
+ if (!attrValue.equals(token))
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private List parseSelector(List tokens) {
+ CSSSelectorParser parser = new CSSSelectorParser(tokens);
+ List selector = parser.getSelector();
+ Iterator i = parser.getErrors();
+ fParseErrors = new ArrayList();
+ while (i.hasNext()) {
+ fParseErrors.add(i.next());
+ }
+ return selector;
+ }
+
+ public Iterator getErrors() {
+ if (fNameErrors == null) {
+ fNameErrors = new ArrayList();
+ Iterator iItem = getIterator();
+ while (iItem.hasNext()) {
+ ICSSSelectorItem item = (ICSSSelectorItem) iItem.next();
+ if (item instanceof ICSSSimpleSelector) {
+ if (!((ICSSSimpleSelector) item).isUniversal()) {
+ String name = ((ICSSSimpleSelector) item).getName();
+ if (!NameValidator.isValid(name)) {
+ fNameErrors.add(item);
+ }
+ }
+ }
+ }
+ }
+ List errors = new ArrayList(fParseErrors);
+ errors.addAll(fNameErrors);
+ return errors.iterator();
+ }
+
+ public String toString() {
+ return getString();
+ }
+
+ /**
+ * @see ICSSSelector#getErrorCount()
+ */
+ public int getErrorCount() {
+ int nErrors = 0;
+ Iterator i = getErrors();
+ while (i.hasNext()) {
+ nErrors++;
+ i.next();
+ }
+ return nErrors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorCombinator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorCombinator.java
new file mode 100644
index 0000000000..895ecb2343
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorCombinator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSSelectorCombinator;
+
+/**
+ *
+ */
+class CSSSelectorCombinator extends CSSSelectorItem implements ICSSSelectorCombinator {
+
+ char fType = ICSSSelectorCombinator.UNKNOWN;
+
+ /**
+ * CSSSelectorCombinator constructor comment.
+ */
+ public CSSSelectorCombinator(char type) {
+ super();
+ setCombinatorType(type);
+ }
+
+ /**
+ * @return boolean
+ * @param obj
+ * java.lang.Object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null || this.getClass() != obj.getClass())
+ return false;
+
+ CSSSelectorCombinator foreign = (CSSSelectorCombinator) obj;
+
+ return (getCombinatorType() == foreign.getCombinatorType());
+
+ }
+
+ /**
+ * @return int
+ */
+ public char getCombinatorType() {
+ return fType;
+ }
+
+ /**
+ * @return int
+ */
+ public int getItemType() {
+ return COMBINATOR;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(fType);
+ return buf.toString();
+ }
+
+ void setCombinatorType(char type) {
+ fType = type;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorItem.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorItem.java
new file mode 100644
index 0000000000..721b3a31a6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorItem.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSSelectorItem;
+
+/**
+ *
+ */
+abstract class CSSSelectorItem implements ICSSSelectorItem {
+
+ /**
+ * CSSSelectorItem constructor comment.
+ */
+ public CSSSelectorItem() {
+ super();
+ }
+
+ /**
+ * @return int
+ */
+ public int getItemType() {
+ return 0;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getString() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorListImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorListImpl.java
new file mode 100644
index 0000000000..f6faac4d92
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorListImpl.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+import org.w3c.dom.Element;
+
+
+/**
+ *
+ */
+public class CSSSelectorListImpl implements ICSSSelectorList {
+
+ private String fText = null;
+ private String fCachedString = null; // normalized string
+ private List fSelectors = null;
+
+ public CSSSelectorListImpl(String cssText) {
+ super();
+ fText = cssText;
+ parseSelectorText();
+ }
+
+ /**
+ * @return boolean
+ * @param obj
+ * java.lang.Object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null || this.getClass() != obj.getClass())
+ return false;
+
+ CSSSelectorListImpl foreign = (CSSSelectorListImpl) obj;
+
+ if (getLength() != foreign.getLength())
+ return false;
+
+ for (int i = 0; i < getLength(); i++) {
+ if (!getSelector(i).equals(foreign.getSelector(i)))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @return java.util.Iterator
+ */
+ public Iterator getIterator() {
+ return getSelectors().iterator();
+ }
+
+ /**
+ * @return int
+ */
+ public int getLength() {
+ return getSelectors().size();
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelector
+ * @param index
+ * int
+ */
+ public ICSSSelector getSelector(int index) {
+ List selectors = getSelectors();
+ if (0 <= index && index < selectors.size()) {
+ return (ICSSSelector) selectors.get(index);
+ }
+ else {
+ return null;
+ }
+ }
+
+ private List getSelectors() {
+ if (fSelectors == null) {
+ parseSelectorText();
+ }
+ return fSelectors;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getString() {
+ if (fCachedString == null) {
+ StringBuffer buf = new StringBuffer();
+ boolean bFirst = true;
+ // groups is list of comma-separated selectors
+ Iterator i = getSelectors().iterator();
+ while (i.hasNext()) {
+ if (!bFirst) {
+ buf.append(", ");//$NON-NLS-1$
+ }
+ ICSSSelector item = (ICSSSelector) i.next();
+ buf.append(item.getString());
+ bFirst = false;
+ }
+ fCachedString = buf.toString();
+ }
+ return fCachedString;
+ }
+
+ /**
+ * @return boolean
+ * @param element
+ * org.w3c.dom.Element
+ */
+ public boolean match(Element element, String pseudoName) {
+ int nSelectors = getLength();
+ selectorListLoop : for (int iSelector = 0; iSelector < nSelectors; iSelector++) {
+ // Check each Selector Lists
+ ICSSSelector selector = getSelector(iSelector);
+ if (selector.match(element, pseudoName))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ private void parseSelectorText() {
+ fSelectors = new ArrayList();
+ if (fText == null) {
+ return;
+ }
+
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_STYLESHEET, fText);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return;
+ }
+
+ List tokenGroup = new ArrayList();
+ for (int i = 0; i < tokens.length; i++) {
+ CSSTextToken token = tokens[i];
+ if (token.kind == CSSRegionContexts.CSS_SELECTOR_SEPARATOR && 0 < tokenGroup.size()) {
+ ICSSSelector selector = new CSSSelector(tokenGroup);
+ if (selector != null) {
+ fSelectors.add(selector);
+ }
+ tokenGroup.clear();
+ }
+ else {
+ tokenGroup.add(tokens[i]);
+ }
+ }
+ if (0 < tokenGroup.size()) {
+ ICSSSelector selector = new CSSSelector(tokenGroup);
+ if (selector != null) {
+ fSelectors.add(selector);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public String toString() {
+ return getString();
+ }
+
+ /**
+ *
+ */
+ public Iterator getErrors() {
+ List errors = new ArrayList();
+ Iterator iSelector = getSelectors().iterator();
+ while (iSelector.hasNext()) {
+ Iterator iError = ((ICSSSelector) iSelector.next()).getErrors();
+ while (iError.hasNext()) {
+ errors.add(iError.next());
+ }
+ }
+ return errors.iterator();
+ }
+
+ /**
+ *
+ */
+ public int getErrorCount() {
+ int nErrors = 0;
+ Iterator i = getErrors();
+ while (i.hasNext()) {
+ nErrors++;
+ i.next();
+ }
+ return nErrors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorParser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorParser.java
new file mode 100644
index 0000000000..1e9117e4c2
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSelectorParser.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSSelectorCombinator;
+import org.eclipse.wst.css.core.document.ICSSSelectorItem;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ *
+ */
+public class CSSSelectorParser {
+
+ private final static int IDLE = 0;
+ private final static int ATTRIBUTE = 1;
+ private final static int SIMPLE = 2;
+
+ private List fTokens = null;
+ private List fItems = null;
+ private List fErrors = null;
+
+ /**
+ *
+ */
+ CSSSelectorParser(List tokens) {
+ super();
+ fTokens = new ArrayList(tokens);
+ }
+
+ /**
+ *
+ */
+ List getSelector() {
+ if (fItems == null) {
+ parseSelector();
+ }
+ return fItems;
+ }
+
+ /**
+ *
+ */
+ private void parseSelector() {
+ fItems = new ArrayList();
+
+ List attrBuf = null;
+ CSSSimpleSelector item = null;
+
+ int status = IDLE;
+ Iterator i = fTokens.iterator();
+ while (i.hasNext()) {
+ CSSTextToken token = (CSSTextToken) i.next();
+ if (token == null || token.kind == CSSRegionContexts.CSS_S || token.kind == CSSRegionContexts.CSS_COMMENT) {
+ continue;
+ }
+ switch (status) {
+ case IDLE :
+ if (isTag(token)) {
+ item = createSimple();
+ appendTag(item, token);
+ status = SIMPLE;
+ }
+ else if (isID(token)) {
+ item = createSimple();
+ appendID(item, token);
+ status = SIMPLE;
+ }
+ else if (isClass(token)) {
+ item = createSimple();
+ appendClass(item, token);
+ status = SIMPLE;
+ }
+ else if (isPseudo(token)) {
+ item = createSimple();
+ appendPseudo(item, token);
+ status = SIMPLE;
+ }
+ else if (isAttributeBegin(token)) {
+ item = createSimple();
+ status = ATTRIBUTE;
+ }
+ else {
+ addError(token);
+ }
+ break;
+ case SIMPLE :
+ if (isID(token)) {
+ appendID(item, token);
+ }
+ else if (isClass(token)) {
+ appendClass(item, token);
+ }
+ else if (isPseudo(token)) {
+ appendPseudo(item, token);
+ }
+ else if (isAttributeBegin(token)) {
+ status = ATTRIBUTE;
+ }
+ else if (isCombinator(token)) { // combinator
+ closeItem(item);
+ closeItem(createCombinator(token));
+ status = IDLE;
+ }
+ else {
+ addError(token);
+ }
+ break;
+ case ATTRIBUTE :
+ if (isAttributeEnd(token)) {
+ appendAttribute(item, attrBuf);
+ attrBuf = null;
+ status = SIMPLE;
+ }
+ else {
+ if (attrBuf == null) {
+ attrBuf = new ArrayList();
+ }
+ attrBuf.add(token);
+ if (!isAttributeContent(token)) {
+ addError(token);
+ }
+ }
+ break;
+ default :
+ break;
+ }
+ }
+
+ closeItem(item);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isAttributeContent(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isAttributeEnd(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isAttributeBegin(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isCombinator(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_COMBINATOR);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isPseudo(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_PSEUDO);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isClass(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_CLASS);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isID(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_ID);
+ }
+
+ /**
+ * @param token
+ * @return
+ */
+ private boolean isTag(CSSTextToken token) {
+ String type = token.kind;
+ return (type == CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME || type == CSSRegionContexts.CSS_SELECTOR_UNIVERSAL || type == CSSRegionContexts.CSS_UNKNOWN);
+ }
+
+ private CSSSimpleSelector createSimple() {
+ return new CSSSimpleSelector();
+ }
+
+ /**
+ * if " " or "+" or ">" appeared, close simpleselector and add new
+ * combinator
+ */
+ private CSSSelectorCombinator createCombinator(CSSTextToken token) {
+ char type = 0;
+
+ String str = token.image;
+ if (str.trim().length() == 0) { // space
+ type = ICSSSelectorCombinator.DESCENDANT;
+ }
+ else if (str.equals("+")) { //$NON-NLS-1$
+ type = ICSSSelectorCombinator.ADJACENT;
+ }
+ else if (str.equals(">")) { //$NON-NLS-1$
+ type = ICSSSelectorCombinator.CHILD;
+ }
+
+ if (0 < type) {
+ return new CSSSelectorCombinator(type);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private void closeItem(ICSSSelectorItem item) {
+ if (item != null) {
+ fItems.add(item);
+ }
+ }
+
+ private void appendTag(CSSSimpleSelector item, CSSTextToken token) {
+ item.setName(token.image);
+ if (token.kind == CSSRegionContexts.CSS_UNKNOWN) {
+ addError(token);
+ }
+ }
+
+ /**
+ * if "#xxxx" appeared, add ID to current selector
+ */
+ private void appendID(CSSSimpleSelector item, CSSTextToken token) {
+ String text = token.toString();
+ String idContent = text.substring(1, text.length());
+ item.addID(idContent);
+ }
+
+ /**
+ * if ".xxxx" appeared, add Class to current selector
+ */
+ private void appendClass(CSSSimpleSelector item, CSSTextToken token) {
+ String text = token.toString();
+ String classContent = text.substring(1, text.length());
+ item.addClass(classContent);
+ if (Character.isDigit(classContent.charAt(0))) {
+ addError(token);
+ }
+ }
+
+ /**
+ * if ":xxxx" appeared, add Pseudo(element/class) to current selector
+ */
+ private void appendPseudo(CSSSimpleSelector item, CSSTextToken token) {
+ String text = token.toString();
+ String pseudoContent = text.substring(1, text.length());
+ item.addPseudoName(pseudoContent);
+ }
+
+ /**
+ *
+ */
+ private void appendAttribute(CSSSimpleSelector item, List tokens) {
+ StringBuffer buf = new StringBuffer();
+
+ CSSTextToken token;
+ Iterator i = tokens.iterator();
+ while (i.hasNext()) {
+ token = (CSSTextToken) i.next();
+ buf.append(token.image);
+ }
+
+ item.addAttribute(buf.toString());
+ }
+
+ /**
+ *
+ */
+ List getSelectorTags() {
+ List tagList = new ArrayList();
+ return tagList;
+ }
+
+ /**
+ *
+ */
+ private void addError(CSSTextToken token) {
+ if (fErrors == null) {
+ fErrors = new ArrayList();
+ }
+ fErrors.add(token);
+ }
+
+ /**
+ *
+ */
+ Iterator getErrors() {
+ return (fErrors == null) ? Collections.EMPTY_LIST.iterator() : fErrors.iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSimpleSelector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSimpleSelector.java
new file mode 100644
index 0000000000..b7d3f4e63e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSSimpleSelector.java
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+
+
+/**
+ *
+ */
+class CSSSimpleSelector extends CSSSelectorItem implements ICSSSimpleSelector {
+
+ private String fName = null;
+ private String fCachedString = null;
+ private StringBuffer fStringBuf = null;
+ private List fPseudoName = null;
+ private List fAttribute = null;
+ private List fClass = null;
+ private List fID = null;
+
+ /**
+ * CSSSimpleSelector constructor comment.
+ */
+ public CSSSimpleSelector() {
+ super();
+ }
+
+ /**
+ *
+ */
+ void addAttribute(String attribute) {
+ if (fAttribute == null) {
+ fAttribute = new ArrayList();
+ }
+ fAttribute.add(attribute);
+ addToBuf("[");//$NON-NLS-1$
+ addToBuf(attribute);
+ addToBuf("]");//$NON-NLS-1$
+ fCachedString = null;
+ }
+
+ /**
+ *
+ */
+ void addClass(String cls) {
+ if (fClass == null) {
+ fClass = new ArrayList();
+ }
+ fClass.add(cls);
+ addToBuf(".");//$NON-NLS-1$
+ addToBuf(cls);
+ fCachedString = null;
+ }
+
+ /**
+ *
+ */
+ void addID(String id) {
+ if (fID == null) {
+ fID = new ArrayList();
+ }
+ fID.add(id);
+ addToBuf("#");//$NON-NLS-1$
+ addToBuf(id);
+ fCachedString = null;
+ }
+
+ /**
+ *
+ */
+ void addPseudoName(String cls) {
+ if (fPseudoName == null) {
+ fPseudoName = new ArrayList();
+ }
+ fPseudoName.add(cls);
+ addToBuf(":");//$NON-NLS-1$
+ addToBuf(cls);
+ fCachedString = null;
+ }
+
+ /**
+ *
+ */
+ private void addToBuf(String str) {
+ if (fStringBuf == null) {
+ fStringBuf = new StringBuffer();
+ }
+ fStringBuf.append(str);
+ }
+
+ /**
+ * @return boolean
+ * @param obj
+ * java.lang.Object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null || this.getClass() != obj.getClass())
+ return false;
+
+ CSSSimpleSelector foreign = (CSSSimpleSelector) obj;
+
+ if (getName().compareToIgnoreCase(foreign.getName()) != 0)
+ return false;
+
+ int i;
+
+ // compare pseudo-classes / pseudo-elements
+ if (getNumOfPseudoNames() != foreign.getNumOfPseudoNames())
+ return false;
+ for (i = 0; i < getNumOfPseudoNames(); i++) {
+ if (getPseudoName(i).compareToIgnoreCase(foreign.getPseudoName(i)) != 0)
+ return false;
+ }
+
+ // compare classes
+ if (getNumOfClasses() != foreign.getNumOfClasses())
+ return false;
+ for (i = 0; i < getNumOfClasses(); i++) {
+ if (getClass(i).compareToIgnoreCase(foreign.getClass(i)) != 0)
+ return false;
+ }
+
+ // compare IDs
+ if (getNumOfIDs() != foreign.getNumOfIDs())
+ return false;
+ for (i = 0; i < getNumOfIDs(); i++) {
+ if (getID(i).compareToIgnoreCase(foreign.getID(i)) != 0)
+ return false;
+ }
+
+ // compare Attributes
+ if (getNumOfAttributes() != foreign.getNumOfAttributes())
+ return false;
+ for (i = 0; i < getNumOfAttributes(); i++) {
+ if (getAttribute(i).compareToIgnoreCase(foreign.getAttribute(i)) != 0)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ public String getAttribute(int index) {
+ if (fAttribute != null && 0 <= index && index < fAttribute.size()) {
+ return (String) fAttribute.get(index);
+ }
+ else {
+ return "";//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ public String getClass(int index) {
+ if (fClass != null && 0 <= index && index < fClass.size()) {
+ return (String) fClass.get(index);
+ }
+ else {
+ return "";//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ public String getID(int index) {
+ if (fID != null && 0 <= index && index < fID.size()) {
+ return (String) fID.get(index);
+ }
+ else {
+ return "";//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return int
+ */
+ public int getItemType() {
+ return SIMPLE;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getName() {
+ return (fName != null) ? fName : "";//$NON-NLS-1$
+ }
+
+ /**
+ * @return boolean
+ */
+ public int getNumOfAttributes() {
+ return (fAttribute != null) ? fAttribute.size() : 0;
+ }
+
+ /**
+ * @return boolean
+ */
+ public int getNumOfClasses() {
+ return (fClass != null) ? fClass.size() : 0;
+ }
+
+ /**
+ * @return boolean
+ */
+ public int getNumOfIDs() {
+ return (fID != null) ? fID.size() : 0;
+ }
+
+ /**
+ * @return boolean
+ */
+ public int getNumOfPseudoNames() {
+ return (fPseudoName != null) ? fPseudoName.size() : 0;
+ }
+
+ /**
+ * @return java.lang.String
+ * @param index
+ * int
+ */
+ public String getPseudoName(int index) {
+ if (fPseudoName != null && 0 <= index && index < fPseudoName.size()) {
+ return (String) fPseudoName.get(index);
+ }
+ else {
+ return "";//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getString() {
+ if (fCachedString == null) {
+ StringBuffer buf = new StringBuffer(getName());
+ if (fStringBuf != null) {
+ buf.append(fStringBuf.toString());
+ }
+ fCachedString = buf.toString();
+ }
+ return fCachedString;
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean isUniversal() {
+ return (fName == null || fName.equals("*"));//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ void setName(String name) {
+ fName = name;
+ fCachedString = null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStructuredDocumentRegionContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStructuredDocumentRegionContainer.java
new file mode 100644
index 0000000000..946c66afc5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStructuredDocumentRegionContainer.java
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+/**
+ *
+ */
+abstract class CSSStructuredDocumentRegionContainer extends CSSNodeImpl {
+
+ private IStructuredDocumentRegion firstStructuredDocumentRegion = null;
+ private IStructuredDocumentRegion lastStructuredDocumentRegion = null;
+
+ /**
+ * CSSContainer constructor comment.
+ */
+ CSSStructuredDocumentRegionContainer() {
+ super();
+ }
+
+ /**
+ * CSSContainer constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ CSSStructuredDocumentRegionContainer(CSSStructuredDocumentRegionContainer that) {
+ super(that);
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getCssText() {
+ if (getFirstStructuredDocumentRegion() == null)
+ return generateSource();
+
+ StringBuffer str = new StringBuffer(getFirstStructuredDocumentRegion().getText());
+ IStructuredDocumentRegion node = getFirstStructuredDocumentRegion();
+
+ while (node != getLastStructuredDocumentRegion()) {
+ node = node.getNext();
+ str.append(node.getText());
+ }
+
+ return str.toString();
+ }
+
+ /**
+ * @return int
+ */
+ public int getEndOffset() {
+ IStructuredDocumentRegion flatNode = getLastStructuredDocumentRegion();
+ if (flatNode != null)
+ return flatNode.getEnd();
+ return -1;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.IStructuredDocumentRegion
+ */
+ IStructuredDocumentRegion getFirstStructuredDocumentRegion() {
+ return firstStructuredDocumentRegion;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.IStructuredDocumentRegion
+ * @param index
+ * int
+ */
+ IStructuredDocumentRegion getStructuredDocumentRegion(int index) {
+ IStructuredDocumentRegion node = firstStructuredDocumentRegion;
+ for (int i = index; i > 0; i--) {
+ if (node == null)
+ return null;
+ node = node.getNext();
+ }
+ return node;
+ }
+
+ /**
+ * @return int
+ */
+ int getStructuredDocumentRegionCount() {
+ if (firstStructuredDocumentRegion == null)
+ return 0;
+
+ IStructuredDocumentRegion node = firstStructuredDocumentRegion;
+ int i = 0;
+ for (; node != null; i++)
+ node = node.getNext();
+ return i;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.IStructuredDocumentRegion
+ */
+ IStructuredDocumentRegion getLastStructuredDocumentRegion() {
+ return lastStructuredDocumentRegion;
+ }
+
+ /**
+ * @return int
+ */
+ public int getStartOffset() {
+ IStructuredDocumentRegion flatNode = getFirstStructuredDocumentRegion();
+ if (flatNode != null)
+ return flatNode.getStart();
+ return -1;
+ }
+
+ /**
+ * @param first
+ * com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ * @param last
+ * com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ */
+ boolean includeRangeStructuredDocumentRegion(IStructuredDocumentRegion first, IStructuredDocumentRegion last) {
+ boolean bModified = false;
+
+ // validate range of parameters
+ if (first != null && last != null) {
+ if (first.getStart() > last.getStart()) {
+ IStructuredDocumentRegion node = first;
+ first = last;
+ last = node;
+ }
+ }
+
+ // validate mine
+ boolean b = validateRange();
+ bModified = b || bModified;
+
+ if (first != null) {
+ if (getFirstStructuredDocumentRegion() == null || getFirstStructuredDocumentRegion().getStart() > first.getStart()) {
+ setFirstStructuredDocumentRegion(first);
+ bModified = true;
+ }
+ }
+
+ if (last != null) {
+ if (getLastStructuredDocumentRegion() == null || getLastStructuredDocumentRegion().getStart() < last.getStart()) {
+ setLastStructuredDocumentRegion(last);
+ bModified = true;
+ }
+ }
+
+ // re-validate
+ if (bModified)
+ validateRange();
+
+ return bModified;
+ }
+
+ /**
+ *
+ */
+ boolean propagateRangeStructuredDocumentRegion() {
+ boolean bModified = false;
+
+ CSSStructuredDocumentRegionContainer parent = (CSSStructuredDocumentRegionContainer) getParentNode();
+ if (parent == null)
+ return bModified;
+
+ boolean b = parent.includeRangeStructuredDocumentRegion(getFirstStructuredDocumentRegion(), getLastStructuredDocumentRegion());
+ bModified = b || bModified;
+
+ if (b)
+ parent.propagateRangeStructuredDocumentRegion();
+ // else need not update range of ancestors
+
+ return bModified;
+ }
+
+ /**
+ * @param cssText
+ * java.lang.String
+ */
+ public void setCssText(String cssText) {
+ if (firstStructuredDocumentRegion != null) {
+ getOwnerDocument().getModel().getStructuredDocument().replaceText(this, getStartOffset(), getEndOffset() - getStartOffset(), cssText);
+ }
+ else
+ super.setCssText(cssText);
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ * @param node
+ * com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ */
+ IStructuredDocumentRegion setFirstStructuredDocumentRegion(IStructuredDocumentRegion node) {
+ firstStructuredDocumentRegion = node;
+ return node;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ * @param node
+ * com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ */
+ IStructuredDocumentRegion setLastStructuredDocumentRegion(IStructuredDocumentRegion node) {
+ lastStructuredDocumentRegion = node;
+ return node;
+ }
+
+ /**
+ * @param firstNode
+ * com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ * @param lastNode
+ * com.ibm.sed.structuredDocument.core.IStructuredDocumentRegion
+ */
+ void setRangeStructuredDocumentRegion(IStructuredDocumentRegion firstNode, IStructuredDocumentRegion lastNode) {
+ if (firstNode != null)
+ setFirstStructuredDocumentRegion(firstNode);
+ if (lastNode != null)
+ setLastStructuredDocumentRegion(lastNode);
+
+ if (firstNode == null && lastNode == null) {
+ setFirstStructuredDocumentRegion(null);
+ setLastStructuredDocumentRegion(null);
+ }
+ else { // range validation
+ validateRange();
+ }
+ }
+
+ /**
+ * @return boolean
+ */
+ private boolean validateRange() {
+ boolean bModified = false;
+
+ if (firstStructuredDocumentRegion != null || lastStructuredDocumentRegion != null) {
+ if (this.firstStructuredDocumentRegion == null) {
+ this.firstStructuredDocumentRegion = this.lastStructuredDocumentRegion;
+ bModified = true;
+ }
+ else if (this.lastStructuredDocumentRegion == null) {
+ this.lastStructuredDocumentRegion = this.firstStructuredDocumentRegion;
+ bModified = true;
+ }
+ else if (this.firstStructuredDocumentRegion.getStart() > this.lastStructuredDocumentRegion.getStart()) {
+ // need to swap first for last
+ IStructuredDocumentRegion node = firstStructuredDocumentRegion;
+ firstStructuredDocumentRegion = lastStructuredDocumentRegion;
+ lastStructuredDocumentRegion = node;
+ bModified = true;
+ }
+ }
+
+ return bModified;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclItemImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclItemImpl.java
new file mode 100644
index 0000000000..0bd3c4c03d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclItemImpl.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.internal.encoding.CSSDocumentLoader;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatterFactory;
+import org.eclipse.wst.css.core.internal.formatter.CSSSourceGenerator;
+import org.eclipse.wst.css.core.internal.formatter.StyleDeclItemFormatter;
+import org.eclipse.wst.css.core.internal.parser.CSSSourceParser;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSValue;
+
+
+/**
+ *
+ */
+class CSSStyleDeclItemImpl extends CSSStructuredDocumentRegionContainer implements ICSSStyleDeclItem {
+
+ private java.lang.String fPropertyName;
+
+ /**
+ * CSSStyleDeclItemImpl constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSNodeImpl
+ */
+ CSSStyleDeclItemImpl(CSSStyleDeclItemImpl that) {
+ super(that);
+ this.fPropertyName = that.fPropertyName;
+ }
+
+ /**
+ * CSSStyleDeclItemImpl constructor comment.
+ */
+ CSSStyleDeclItemImpl(String propertyName) {
+ super();
+ this.fPropertyName = propertyName;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param value
+ * org.w3c.dom.css.CSSPrimitiveValue
+ */
+ public ICSSPrimitiveValue appendValue(ICSSPrimitiveValue value) throws DOMException {
+ return insertValueBefore(value, null);
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSStyleDeclItemImpl cloned = new CSSStyleDeclItemImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ String generateValueSource() {
+ CSSSourceGenerator formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter(this);
+ if (formatter != null && formatter instanceof StyleDeclItemFormatter)
+ return ((StyleDeclItemFormatter) formatter).formatValue(this).toString();
+ else
+ return "";//$NON-NLS-1$
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSValue
+ */
+ public CSSValue getCSSValue() {
+ int nValue = getLength();
+ if (nValue <= 0)
+ return null;
+ else if (nValue == 1)
+ return item(0);
+ else
+ return this;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public java.lang.String getCSSValueText() {
+ if (getFirstChild() == null)
+ return "";//$NON-NLS-1$
+ // check whether children has flatnodes
+ ICSSNode child = getFirstChild();
+ while (child != null) {
+ if (((IndexedRegion) child).getEndOffset() <= 0)
+ return generateValueSource();
+ child = child.getNextSibling();
+ }
+
+ IStructuredDocumentRegion node = getFirstStructuredDocumentRegion();
+ int start = ((IndexedRegion) getFirstChild()).getStartOffset() - node.getStartOffset();
+ int end = ((IndexedRegion) getLastChild()).getEndOffset() - node.getStartOffset();
+ return node.getText().substring(start, end);
+ }
+
+ /**
+ * @return short
+ */
+ public short getCssValueType() {
+ return CSS_VALUE_LIST;
+ }
+
+ /**
+ * @return int
+ */
+ public int getLength() {
+ int i = 0;
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSPrimitiveValueImpl)
+ i++;
+ }
+ return i;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return STYLEDECLITEM_NODE;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public java.lang.String getPriority() {
+ return getAttribute(IMPORTANT);
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getPropertyName() {
+ return fPropertyName.trim().toLowerCase();
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param newValue
+ * org.w3c.dom.css.CSSPrimitiveValue
+ * @param refValue
+ * org.w3c.dom.css.CSSPrimitiveValue
+ */
+ ICSSPrimitiveValue insertValueBefore(ICSSPrimitiveValue newValue, ICSSPrimitiveValue refValue) {
+ ICSSNode node = insertBefore((CSSNodeImpl) newValue, (CSSNodeImpl) refValue);
+ return (ICSSPrimitiveValue) node;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSValue
+ * @param index
+ * int
+ */
+ public CSSValue item(int index) {
+ int i = 0;
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSPrimitiveValueImpl) {
+ if (i++ == index)
+ return (CSSValue) node;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param value
+ * org.w3c.dom.css.CSSPrimitiveValue
+ */
+ public ICSSPrimitiveValue removeValue(ICSSPrimitiveValue value) throws DOMException {
+ ICSSNode node = removeChild((CSSNodeImpl) value);
+ return (ICSSPrimitiveValue) node;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPrimitiveValue
+ * @param newValue
+ * org.w3c.dom.css.CSSPrimitiveValue
+ * @param oldValue
+ * org.w3c.dom.css.CSSPrimitiveValue
+ */
+ public ICSSPrimitiveValue replaceValue(ICSSPrimitiveValue newValue, ICSSPrimitiveValue oldValue) throws DOMException {
+ if (oldValue == null)
+ return newValue;
+ if (newValue != null)
+ insertValueBefore(newValue, oldValue);
+ return removeValue(oldValue);
+ }
+
+ /**
+ * @param value
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public void setCssValueText(String value) throws DOMException {
+ ICSSNode child = getFirstChild();
+ while (child != null) {
+ ICSSNode next = child.getNextSibling();
+ if (child instanceof ICSSPrimitiveValue) {
+ removeChild((CSSNodeImpl) child);
+ }
+ child = next;
+ }
+
+ // use temporary document
+ IDocumentLoader loader = new CSSDocumentLoader();
+ IStructuredDocument structuredDocument = (IStructuredDocument) loader.createNewStructuredDocument();
+ ((CSSSourceParser) structuredDocument.getParser()).setParserMode(CSSSourceParser.MODE_DECLARATION_VALUE);
+ structuredDocument.set(value);
+ IStructuredDocumentRegion node = structuredDocument.getFirstStructuredDocumentRegion();
+ if (node == null) {
+ return;
+ }
+ if (node.getNext() != null) {
+ throw new DOMException(DOMException.INVALID_MODIFICATION_ERR, "");//$NON-NLS-1$
+ }
+
+ CSSDeclarationItemParser itemParser = new CSSDeclarationItemParser(getOwnerDocument());
+ itemParser.setStructuredDocumentTemporary(true);
+ itemParser.setupValues(this, node, node.getRegions());
+ }
+
+ /**
+ * @param newPriority
+ * java.lang.String
+ */
+ public void setPriority(java.lang.String newPriority) throws DOMException {
+ setAttribute(IMPORTANT, newPriority);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationFactoryContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationFactoryContext.java
new file mode 100644
index 0000000000..bda0b4dd22
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationFactoryContext.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+
+public abstract class CSSStyleDeclarationFactoryContext {
+
+ protected ICSSDocument fOwnerDocument = null;
+
+ /**
+ *
+ */
+ protected void cloneChildNodes(ICSSNode src, ICSSNode dest) {
+ if (fOwnerDocument == null) {
+ return;
+ }
+ if (!(dest instanceof CSSNodeImpl)) {
+ return;
+ }
+
+ CSSNodeImpl container = (CSSNodeImpl) dest;
+ container.removeChildNodes();
+
+ for (ICSSNode child = src.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child instanceof CSSStyleDeclItemImpl) {
+ // extract shorthand property ..
+ // --> Temp
+ ICSSNode cloned = child.cloneNode(false);
+ if (cloned instanceof CSSNodeImpl) {
+ ((CSSNodeImpl) cloned).setOwnerDocument(fOwnerDocument);
+ container.appendChild((CSSNodeImpl) cloned);
+ cloneChildNodes(child, cloned);
+ }
+ // <-- Temp
+ }
+ else {
+ ICSSNode cloned = child.cloneNode(false);
+ if (cloned instanceof CSSNodeImpl) {
+ ((CSSNodeImpl) cloned).setOwnerDocument(fOwnerDocument);
+ container.appendChild((CSSNodeImpl) cloned);
+ cloneChildNodes(child, cloned);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSStyleDeclaration
+ */
+ public ICSSStyleDeclaration createStyleDeclaration() {
+ CSSStyleDeclarationImpl decl = new CSSStyleDeclarationImpl(true);
+ decl.setOwnerDocument(decl);
+ return decl;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationImpl.java
new file mode 100644
index 0000000000..9d2c6db06b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleDeclarationImpl.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSValue;
+
+
+/**
+ *
+ */
+class CSSStyleDeclarationImpl extends CSSDocumentImpl implements ICSSStyleDeclaration {
+
+ private boolean fIsDocument;
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSStyleDeclBlockImpl
+ */
+ CSSStyleDeclarationImpl(CSSStyleDeclarationImpl that) {
+ super(that);
+ this.fIsDocument = that.fIsDocument;
+ if (fIsDocument) {
+ setOwnerDocument(this);
+ }
+ }
+
+ /**
+ *
+ */
+ CSSStyleDeclarationImpl(boolean isDocument) {
+ super();
+ fIsDocument = isDocument;
+ if (fIsDocument) {
+ setOwnerDocument(this);
+ }
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSStyleDeclarationImpl cloned = new CSSStyleDeclarationImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param propertyName
+ * java.lang.String
+ */
+ public ICSSStyleDeclItem getDeclItemNode(String propertyName) {
+ ICSSNode node = getLastChild();
+ propertyName = propertyName.trim();
+ while (node != null) {
+ if (node instanceof CSSStyleDeclItemImpl) {
+ ICSSStyleDeclItem item = (ICSSStyleDeclItem) node;
+ if (propertyName.compareToIgnoreCase(item.getPropertyName().trim()) == 0)
+ return item;
+ }
+ node = node.getPreviousSibling();
+ }
+ return null;
+ }
+
+ /**
+ * @return int
+ */
+ public int getLength() {
+ int i = 0;
+ ICSSNode node = getFirstChild();
+ while (node != null) {
+ if (node instanceof CSSStyleDeclItemImpl)
+ i++;
+ node = node.getNextSibling();
+ }
+ return i;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return STYLEDECLARATION_NODE;
+ }
+
+ /**
+ * The CSS rule that contains this declaration block or <code>null</code>
+ * if this <code>CSSStyleDeclaration</code> is not attached to a
+ * <code>CSSRule</code>.
+ */
+ public CSSRule getParentRule() {
+ ICSSNode parent = getParentNode();
+ if (parent instanceof CSSRule)
+ return (CSSRule) parent;
+ return null;
+ }
+
+ /**
+ * Used to retrieve the object representation of the value of a CSS
+ * property if it has been explicitly set within this declaration block.
+ * This method returns <code>null</code> if the property is a shorthand
+ * property. Shorthand property values can only be accessed and modified
+ * as strings, using the <code>getPropertyValue</code> and
+ * <code>setProperty</code> methods.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return Returns the value of the property if it has been explicitly set
+ * for this declaration block. Returns <code>null</code> if the
+ * property has not been set.
+ */
+ public CSSValue getPropertyCSSValue(String propertyName) {
+ ICSSStyleDeclItem item = getDeclItemNode(propertyName);
+ if (item != null)
+ return item.getCSSValue();
+ return null;
+ }
+
+ /**
+ * Used to retrieve the priority of a CSS property (e.g. the
+ * <code>"important"</code> qualifier) if the property has been
+ * explicitly set in this declaration block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return A string representing the priority (e.g.
+ * <code>"important"</code>) if one exists. The empty string if
+ * none exists.
+ */
+ public String getPropertyPriority(String propertyName) {
+ ICSSStyleDeclItem item = getDeclItemNode(propertyName);
+ if (item != null)
+ return item.getPriority();
+ return null;
+ }
+
+ /**
+ * Used to retrieve the value of a CSS property if it has been explicitly
+ * set within this declaration block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return Returns the value of the property if it has been explicitly set
+ * for this declaration block. Returns the empty string if the
+ * property has not been set.
+ */
+ public String getPropertyValue(String propertyName) {
+ CSSValue value = getPropertyCSSValue(propertyName);
+ if (value != null)
+ return ((ICSSValue) value).getCSSValueText();
+ return null;
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean isDocument() {
+ return fIsDocument;
+ }
+
+ /**
+ * Used to retrieve the properties that have been explicitly set in this
+ * declaration block. The order of the properties retrieved using this
+ * method does not have to be the order in which they were set. This
+ * method can be used to iterate over all properties in this declaration
+ * block.
+ *
+ * @param index
+ * Index of the property name to retrieve.
+ * @return The name of the property at this ordinal position. The empty
+ * string if no property exists at this position.
+ */
+ public String item(int index) {
+ if (index < 0)
+ return null;
+
+ int i = 0;
+ ICSSNode node = getFirstChild();
+ while (node != null) {
+ if (node instanceof CSSStyleDeclItemImpl) {
+ if (i != index)
+ i++;
+ else {
+ CSSStyleDeclItemImpl item = (CSSStyleDeclItemImpl) node;
+ return item.getPropertyName();
+ }
+ }
+ node = node.getNextSibling();
+ }
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param oldDecl
+ * com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public ICSSStyleDeclItem removeDeclItemNode(ICSSStyleDeclItem oldDecl) throws DOMException {
+ return (ICSSStyleDeclItem) removeChild((CSSNodeImpl) oldDecl);
+ }
+
+ /**
+ * Used to remove a CSS property if it has been explicitly set within this
+ * declaration block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return Returns the value of the property if it has been explicitly set
+ * for this declaration block. Returns the empty string if the
+ * property has not been set or the property name does not
+ * correspond to a known CSS property.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration
+ * is readonly or the property is readonly.
+ */
+ public String removeProperty(String propertyName) throws DOMException {
+ ICSSStyleDeclItem item = getDeclItemNode(propertyName);
+ if (item != null) {
+ removeChild((CSSNodeImpl) item);
+ return item.getCssText();
+ }
+ return null;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/01/16
+ * 23:18:51)
+ *
+ * @return com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @param newDecl
+ * com.ibm.sed.treemodel.cei.CSSStyleDeclItem
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public ICSSStyleDeclItem setDeclItemNode(ICSSStyleDeclItem newDecl) throws DOMException {
+ if (newDecl == null)
+ return null;
+
+ ICSSStyleDeclItem item = getDeclItemNode(newDecl.getPropertyName());
+ if (item != null)
+ return (ICSSStyleDeclItem) replaceChild((CSSNodeImpl) newDecl, (CSSNodeImpl) item);
+ else
+ return (ICSSStyleDeclItem) appendChild((CSSNodeImpl) newDecl);
+ }
+
+ /**
+ * Used to set a property value and priority within this declaration
+ * block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @param value
+ * The new value of the property.
+ * @param priority
+ * The new priority of the property (e.g.
+ * <code>"important"</code>).
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified value has a syntax
+ * error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration
+ * is readonly or the property is readonly.
+ */
+ public void setProperty(String propertyName, String value, String priority) throws DOMException {
+ if (propertyName.equals("")) //$NON-NLS-1$
+ throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); //$NON-NLS-1$
+
+ // You can use this only if CSSValue.setCssText() is implemented
+ CSSStyleDeclItemImpl item = (CSSStyleDeclItemImpl) getDeclItemNode(propertyName);
+ if (item == null) {
+ item = (CSSStyleDeclItemImpl) getOwnerDocument().createCSSStyleDeclItem(propertyName);
+ appendChild(item);
+ }
+
+ // ICSSNode next = item.getNextSibling();
+ // removeChild(item);
+
+ item.setCssValueText(value);
+ item.setPriority(priority);
+
+ // insertBefore(item, (CSSNodeImpl)next);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleRuleImpl.java
new file mode 100644
index 0000000000..73bbe7f217
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleRuleImpl.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.w3c.dom.DOMException;
+
+
+/**
+ *
+ */
+class CSSStyleRuleImpl extends CSSRuleDeclContainer implements ICSSStyleRule {
+
+ ICSSSelectorList fSelectorList = new CSSSelectorListImpl(null);
+
+ /**
+ *
+ */
+ CSSStyleRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSStyleRuleImpl
+ */
+ CSSStyleRuleImpl(CSSStyleRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSStyleRuleImpl cloned = new CSSStyleRuleImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ String extractPreString() {
+ return getSelectorText();
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return STYLERULE_NODE;
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.ICSSSelectorList
+ */
+ public ICSSSelectorList getSelectors() {
+ return fSelectorList;
+ }
+
+ /**
+ * The textual representation of the selector for the rule set. The
+ * implementation may have stripped out insignificant whitespace while
+ * parsing the selector.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is
+ * readonly.
+ */
+ public String getSelectorText() {
+ return getAttribute(SELECTOR);
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return STYLE_RULE;
+ }
+
+ /**
+ *
+ */
+ public void setSelectorText(String selectorText) throws DOMException {
+ setAttribute(SELECTOR, selectorText);
+ fSelectorList = new CSSSelectorListImpl(selectorText);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleSheetImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleSheetImpl.java
new file mode 100644
index 0000000000..a9d721901f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSStyleSheetImpl.java
@@ -0,0 +1,628 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+import org.eclipse.wst.css.core.internal.encoding.CSSDocumentLoader;
+import org.eclipse.wst.css.core.internal.nls.ResourceHandler;
+import org.eclipse.wst.css.core.util.ImportRuleCollector;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.util.Assert;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.css.CSSFontFaceRule;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSRuleList;
+import org.w3c.dom.css.CSSUnknownRule;
+import org.w3c.dom.stylesheets.MediaList;
+import org.w3c.dom.stylesheets.StyleSheet;
+import org.w3c.dom.stylesheets.StyleSheetList;
+
+
+/**
+ *
+ */
+class CSSStyleSheetImpl extends CSSDocumentImpl implements ICSSStyleSheet {
+
+
+ class InternalNodeList implements NodeList {
+
+ Vector nodes = new Vector();
+
+ public int getLength() {
+ if (nodes == null)
+ return 0;
+ else
+ return nodes.size();
+ }
+
+ public Node item(int i) {
+ if (nodes == null)
+ return null;
+ if (i < 0 || nodes.size() <= i)
+ return null;
+ return (Node) nodes.get(i);
+ }
+ }
+
+ class InternalStyleSheetList extends AbstractCSSNodeList implements StyleSheetList {
+
+ public ICSSNode appendNode(ICSSNode node) {
+ if (nodes == null || !nodes.contains(node))
+ return super.appendNode(node);
+ else
+ return node;
+ }
+
+ public StyleSheet item(int i) {
+ return (StyleSheet) itemImpl(i);
+ }
+ }
+
+ private boolean fDisabled = false;
+
+ /**
+ *
+ */
+ CSSStyleSheetImpl() {
+ super();
+ setOwnerDocument(this);
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSStyleSheetImpl
+ */
+ CSSStyleSheetImpl(CSSStyleSheetImpl that) {
+ super(that);
+ setOwnerDocument(this);
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public org.w3c.dom.css.CSSRule appendRule(org.w3c.dom.css.CSSRule rule) throws org.w3c.dom.DOMException {
+ if (rule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) appendChild((CSSNodeImpl) rule);
+ return ret;
+ }
+
+ /**
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSStyleSheetImpl cloned = new CSSStyleSheetImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSCharsetRule
+ */
+ public ICSSCharsetRule createCSSCharsetRule() {
+ CSSCharsetRuleImpl rule = new CSSCharsetRuleImpl();
+ rule.setOwnerDocument(this);
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSFontFaceRule
+ */
+ public CSSFontFaceRule createCSSFontFaceRule() {
+ CSSFontFaceRuleImpl rule = new CSSFontFaceRuleImpl();
+ CSSStyleDeclarationImpl style = (CSSStyleDeclarationImpl) createCSSStyleDeclaration();
+
+ rule.appendChild(style);
+ rule.setOwnerDocument(this);
+
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSImportRule
+ */
+ public ICSSImportRule createCSSImportRule() {
+ CSSImportRuleImpl rule = new CSSImportRuleImpl();
+ MediaListImpl media = (MediaListImpl) createMediaList();
+
+ rule.appendChild(media);
+ rule.setOwnerDocument(this);
+
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.css.ICSSMediaRule
+ */
+ public ICSSMediaRule createCSSMediaRule() {
+ CSSMediaRuleImpl rule = new CSSMediaRuleImpl();
+ MediaListImpl media = (MediaListImpl) createMediaList();
+
+ rule.insertBefore(media, (CSSNodeImpl) rule.getFirstChild()); // media
+ // must
+ // be
+ // the
+ // top
+ // of
+ // children
+ // list
+ rule.setOwnerDocument(this);
+
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSPageRule
+ */
+ public ICSSPageRule createCSSPageRule() {
+ CSSPageRuleImpl rule = new CSSPageRuleImpl();
+ CSSStyleDeclarationImpl style = (CSSStyleDeclarationImpl) createCSSStyleDeclaration();
+
+ rule.appendChild(style);
+ rule.setOwnerDocument(this);
+
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * java.lang.String
+ */
+ public CSSRule createCSSRule(String rule) {
+ CSSDocumentLoader loader = new CSSDocumentLoader();
+ IStructuredDocument structuredDocument = (IStructuredDocument) loader.createNewStructuredDocument();
+ structuredDocument.set(rule);
+
+ CSSModelParser modelParser = new CSSModelParser((CSSDocumentImpl) getOwnerDocument());
+ return modelParser.createCSSRule(structuredDocument.getRegionList());
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleDeclaration
+ */
+ public ICSSStyleDeclaration createCSSStyleDeclaration() {
+ CSSStyleDeclarationImpl decl = new CSSStyleDeclarationImpl(false);
+ decl.setOwnerDocument(this);
+
+ return decl;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleRule
+ */
+ public ICSSStyleRule createCSSStyleRule() {
+ CSSStyleRuleImpl rule = new CSSStyleRuleImpl();
+ CSSStyleDeclarationImpl style = (CSSStyleDeclarationImpl) createCSSStyleDeclaration();
+
+ rule.appendChild(style);
+ rule.setOwnerDocument(this);
+
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSUnknownRule
+ */
+ public CSSUnknownRule createCSSUnknownRule() {
+ CSSUnknownRuleImpl rule = new CSSUnknownRuleImpl();
+ rule.setOwnerDocument(this);
+
+ return rule;
+ }
+
+ /**
+ * @return org.w3c.dom.stylesheets.MediaList
+ */
+ public MediaList createMediaList() {
+ MediaListImpl media = new MediaListImpl();
+ media.setOwnerDocument(this);
+
+ return media;
+ }
+
+ /**
+ * Used to delete a rule from the style sheet.
+ *
+ * @param index
+ * The index within the style sheet's rule list of the rule to
+ * remove.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified index does not
+ * correspond to a rule in the style sheet's rule list.
+ * <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet
+ * is readonly.
+ */
+ public void deleteRule(int index) throws DOMException {
+ CSSNodeImpl node = getIndexedRule(index);
+ if (node != null)
+ removeChild(node);
+ }
+
+ /**
+ * The list of all CSS rules contained within the style sheet. This
+ * includes both rule sets and at-rules.
+ */
+ public CSSRuleList getCssRules() {
+ CSSRuleListImpl list = new CSSRuleListImpl();
+
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSRule) {
+ list.appendNode(node);
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * <code>false</code> if the style sheet is applied to the document.
+ * <code>true</code> if it is not. Modifying this attribute may cause a
+ * new resolution of style for the document. A stylesheet only applies if
+ * both an appropriate medium definition is present and the disabled
+ * attribute is false. So, if the media doesn't apply to the current user
+ * agent, the <code>disabled</code> attribute is ignored.
+ */
+ public boolean getDisabled() {
+ return fDisabled;
+ }
+
+ /**
+ * If the style sheet is a linked style sheet, the value of its attribute
+ * is its location. For inline style sheets, the value of this attribute
+ * is <code>null</code>. See the href attribute definition for the
+ * <code>LINK</code> element in HTML 4.0, and the href pseudo-attribute
+ * for the XML style sheet processing instruction.
+ */
+ public String getHref() {
+ ICSSModel model = getModel();
+ if (model != null && model.getStyleSheetType() == ICSSModel.EXTERNAL) {
+ return model.getBaseLocation();
+ /*
+ * Object id = model.getId(); if (id != null) { if (id instanceof
+ * IResource) { // TODO: need to check whether this is correct or
+ * not, later. return ((IResource)id).getFullPath().toString(); }
+ * return id.toString(); }
+ */}
+ return null;
+ }
+
+ /**
+ * @return com.ibm.sed.css.treemodel.CSSRuleImpl
+ * @param index
+ * int
+ */
+ CSSRuleImpl getIndexedRule(int index) {
+ if (index < 0)
+ return null;
+
+ int i = 0;
+ for (ICSSNode node = getFirstChild(); node != null; node = node.getNextSibling()) {
+ if (node instanceof CSSRule) {
+ if (i++ == index)
+ return (CSSRuleImpl) node;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * The intended destination media for style information. The media is
+ * often specified in the <code>ownerNode</code>. If no media has been
+ * specified, the <code>MediaList</code> will be empty. See the media
+ * attribute definition for the <code>LINK</code> element in HTML 4.0,
+ * and the media pseudo-attribute for the XML style sheet processing
+ * instruction . Modifying the media list may cause a change to the
+ * attribute <code>disabled</code>.
+ */
+ public MediaList getMedia() {
+ return null;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return STYLESHEET_NODE;
+ }
+
+ /**
+ * The node that associates this style sheet with the document. For HTML,
+ * this may be the corresponding <code>LINK</code> or <code>STYLE</code>
+ * element. For XML, it may be the linking processing instruction. For
+ * style sheets that are included by other style sheets, the value of this
+ * attribute is <code>null</code>.
+ */
+ public Node getOwnerNode() {
+ // for <LINK> tag or <STYLE> tag
+ ICSSModel model = getModel();
+ if (model != null)
+ return model.getOwnerDOMNode();
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.NodeList
+ */
+ public org.w3c.dom.NodeList getOwnerNodes() {
+ List list = (getModel().getStyleListeners() != null) ? new Vector(getModel().getStyleListeners()) : null;
+ if (list == null)
+ return null;
+ InternalNodeList nodes = new InternalNodeList();
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj instanceof IStyleSheetAdapter) {
+ nodes.nodes.add(((IStyleSheetAdapter) obj).getElement());
+ }
+ }
+ if (nodes.getLength() > 0)
+ return nodes;
+ else
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.NodeList
+ * @param doc
+ * org.w3c.dom.Document
+ */
+ public NodeList getOwnerNodes(Document doc) {
+ List list = (getModel().getStyleListeners() != null) ? new Vector(getModel().getStyleListeners()) : null;
+ if (list == null)
+ return null;
+ InternalNodeList nodes = new InternalNodeList();
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj instanceof IStyleSheetAdapter) {
+ Element ele = ((IStyleSheetAdapter) obj).getElement();
+ if (ele.getOwnerDocument() == doc)
+ nodes.nodes.add(ele);
+ }
+ }
+ if (nodes.getLength() > 0)
+ return nodes;
+ else
+ return null;
+ }
+
+ /**
+ * If this style sheet comes from an <code>@import</code> rule, the <code>ownerRule</code> attribute will
+ * contain the <code>CSSImportRule</code>. In that case, the
+ * <code>ownerNode</code> attribute in the
+ * <code>StyleSheet</code> interface will be <code>null</code>.
+ * If the style sheet comes from an element or a processing
+ * instruction, the <code>ownerRule</code> attribute will be
+ * <code>null</code> and the <code>ownerNode</code> attribute
+ * will contain the <code>Node</code>.
+ */
+ public CSSRule getOwnerRule() {
+ Assert.isTrue(false, ResourceHandler.getString("You_cannot_use_CSSStyleShe_UI_")); //$NON-NLS-1$ = "You cannot use CSSStyleSheet.getOwnerRule() because of many referencers of this rule\nPlease use getOnwerRules()"
+ // for @import
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRuleList
+ */
+ public org.w3c.dom.css.CSSRuleList getOwnerRules() {
+ StyleSheetList list = getParentStyleSheets();
+ if (list == null)
+ return null;
+ CSSRuleListImpl ruleList = new CSSRuleListImpl();
+ for (int i = 0; i < list.getLength(); i++) {
+ ImportRuleCollector trav = new ImportRuleCollector(this);
+ trav.apply((ICSSStyleSheet) list.item(i));
+ ruleList.nodes.addAll(trav.getRules());
+ }
+ return ruleList;
+ }
+
+ /**
+ * For style sheet languages that support the concept of style sheet
+ * inclusion, this attribute represents the including style sheet, if one
+ * exists. If the style sheet is a top-level style sheet, or the style
+ * sheet language does not support inclusion, the value of this attribute
+ * is <code>null</code>.
+ */
+ public StyleSheet getParentStyleSheet() {
+ CSSRule owner = getOwnerRule();
+ if (owner != null)
+ return owner.getParentStyleSheet();
+ return null;
+ }
+
+ /**
+ * @return org.w3c.dom.stylesheets.StyleSheetList
+ */
+ public org.w3c.dom.stylesheets.StyleSheetList getParentStyleSheets() {
+ List list = (getModel().getStyleListeners() != null) ? new Vector(getModel().getStyleListeners()) : null;
+ if (list == null)
+ return null;
+ InternalStyleSheetList sheets = new InternalStyleSheetList();
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj instanceof ICSSModel) {
+ sheets.appendNode(((ICSSModel) obj).getDocument());
+ }
+ }
+ if (sheets.getLength() > 0)
+ return sheets;
+ else
+ return null;
+ }
+
+ /**
+ * The advisory title. The title is often specified in the
+ * <code>ownerNode</code>. See the title attribute definition for the
+ * <code>LINK</code> element in HTML 4.0, and the title pseudo-attribute
+ * for the XML style sheet processing instruction.
+ */
+ public String getTitle() {
+ Node node = getOwnerNode();
+ if (node instanceof Element) {
+ return ((Element) node).getAttribute("TITLE");//$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * This specifies the style sheet language for this style sheet. The style
+ * sheet language is specified as a content type (e.g. "text/css"). The
+ * content type is often specified in the <code>ownerNode</code>. Also
+ * see the type attribute definition for the <code>LINK</code> element
+ * in HTML 4.0, and the type pseudo-attribute for the XML style sheet
+ * processing instruction.
+ */
+ public String getType() {
+ Node node = getOwnerNode();
+ if (node instanceof Element) {
+ return ((Element) node).getAttribute("TYPE");//$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Used to insert a new rule into the style sheet. The new rule now
+ * becomes part of the cascade.
+ *
+ * @param rule
+ * The parsable text representing the rule. For rule sets this
+ * contains both the selector and the style declaration. For
+ * at-rules, this specifies both the at-identifier and the rule
+ * content.
+ * @param index
+ * The index within the style sheet's rule list of the rule
+ * before which to insert the specified rule. If the specified
+ * index is equal to the length of the style sheet's rule
+ * collection, the rule will be added to the end of the style
+ * sheet.
+ * @return The index within the style sheet's rule collection of the newly
+ * inserted rule.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be
+ * inserted at the specified index e.g. if an
+ * <code>@import</code> rule is inserted after a standard rule set or other
+ * at-rule. <br>
+ * INDEX_SIZE_ERR: Raised if the specified index is not a valid
+ * insertion point. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
+ * readonly. <br>
+ * SYNTAX_ERR: Raised if the specified rule has a syntax error and
+ * is unparsable.
+ */
+ public int insertRule(String rule, int index) throws DOMException {
+ int length = getCssRules().getLength();
+ if (index < 0 || length < index)
+ throw new DOMException(DOMException.INDEX_SIZE_ERR, "");//$NON-NLS-1$
+
+ IStructuredDocument doc = getModel().getStructuredDocument();
+ CSSRuleImpl refRule = (length != index) ? getIndexedRule(index) : null;
+ int offset = (refRule != null) ? refRule.getStartOffset() : doc.getLength();
+ doc.replaceText(this, offset, 0, rule);
+
+ // insertBefore((CSSNodeImpl) createCSSRule(rule),refRule);
+ return index;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param newRule
+ * org.w3c.dom.css.CSSRule
+ * @param refRule
+ * org.w3c.dom.css.CSSRule
+ */
+ public org.w3c.dom.css.CSSRule insertRuleBefore(org.w3c.dom.css.CSSRule newRule, org.w3c.dom.css.CSSRule refRule) throws org.w3c.dom.DOMException {
+ if (newRule == null && refRule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) insertBefore((CSSNodeImpl) newRule, (CSSNodeImpl) refRule);
+ return ret;
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean isDocument() {
+ return true;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param rule
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public org.w3c.dom.css.CSSRule removeRule(org.w3c.dom.css.CSSRule rule) throws org.w3c.dom.DOMException {
+ if (rule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) removeChild((CSSNodeImpl) rule);
+ return ret;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSRule
+ * @param newChild
+ * org.w3c.dom.css.CSSRule
+ * @param oldChild
+ * org.w3c.dom.css.CSSRule
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public org.w3c.dom.css.CSSRule replaceRule(org.w3c.dom.css.CSSRule newRule, org.w3c.dom.css.CSSRule oldRule) throws org.w3c.dom.DOMException {
+ if (newRule == null && oldRule == null)
+ return null;
+
+ CSSRule ret = (CSSRule) replaceChild((CSSNodeImpl) newRule, (CSSNodeImpl) oldRule);
+ return ret;
+ }
+
+ /**
+ * setDisabled method comment.
+ */
+ public void setDisabled(boolean disabled) {
+ this.fDisabled = disabled;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSUnknownRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSUnknownRuleImpl.java
new file mode 100644
index 0000000000..cfbd98116e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSUnknownRuleImpl.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.css.CSSUnknownRule;
+
+
+/**
+ *
+ */
+class CSSUnknownRuleImpl extends CSSRuleImpl implements CSSUnknownRule {
+
+ // TODO: This field is never read
+ String fCssText = null;
+
+ /**
+ *
+ */
+ CSSUnknownRuleImpl() {
+ super();
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSUnknownRuleImpl
+ */
+ CSSUnknownRuleImpl(CSSUnknownRuleImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CSSUnknownRuleImpl cloned = new CSSUnknownRuleImpl(this);
+
+ return cloned;
+ }
+
+ /**
+ * @return short
+ */
+ public short getNodeType() {
+ return UNKNOWNRULE_NODE;
+ }
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType() {
+ return UNKNOWN_RULE;
+ }
+
+ /**
+ * @param cssText
+ * java.lang.String
+ */
+ public void setCssText(String cssText) {
+ this.fCssText = cssText;
+
+ super.setCssText(cssText);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CounterImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CounterImpl.java
new file mode 100644
index 0000000000..e715cda50b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CounterImpl.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICounter;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.Counter;
+
+
+/**
+ *
+ */
+class CounterImpl extends CSSPrimitiveContainer implements ICounter {
+
+ /**
+ *
+ */
+ CounterImpl() {
+ super(CSS_COUNTER);
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.CounterImpl
+ */
+ CounterImpl(CounterImpl that) {
+ super(that);
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ CounterImpl cloned = new CounterImpl(this);
+
+ if (deep)
+ cloneChildNodes(cloned, deep);
+
+ return cloned;
+ }
+
+ /**
+ * This method is used to get the Counter value. If this CSS value doesn't
+ * contain a counter value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>Counter</code> interface.
+ *
+ * @return The Counter value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a Counter value (e.g. this is not
+ * <code>CSS_COUNTER</code>).
+ */
+ public Counter getCounterValue() throws DOMException {
+ return this;
+ }
+
+ /**
+ * This attribute is used for the identifier of the counter.
+ */
+ public String getIdentifier() {
+ return getAttribute(IDENTIFIER);
+ }
+
+ /**
+ * This attribute is used for the style of the list.
+ */
+ public String getListStyle() {
+ return getAttribute(LISTSTYLE);
+ }
+
+ /**
+ * This attribute is used for the separator of the nested counters.
+ */
+ public String getSeparator() {
+ return getAttribute(SEPARATOR);
+ }
+
+ /**
+ *
+ */
+ protected void initPrimitives() {
+ return;
+ }
+
+ /**
+ * @param identifier
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public void setIdentifier(String identifier) throws DOMException {
+ setAttribute(IDENTIFIER, identifier);
+ }
+
+ /**
+ * @param listStyle
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public void setListStyle(String listStyle) throws DOMException {
+ setAttribute(LISTSTYLE, listStyle);
+ }
+
+ /**
+ * @param Separator
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public void setSeparator(String Separator) throws org.w3c.dom.DOMException {
+ setAttribute(SEPARATOR, Separator);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/DOMCSSImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/DOMCSSImpl.java
new file mode 100644
index 0000000000..4b0e3e7c06
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/DOMCSSImpl.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleSheet;
+
+
+/**
+ *
+ */
+public class DOMCSSImpl {
+
+ /**
+ * DOMCSSImpl constructor comment.
+ */
+ public DOMCSSImpl() {
+ super();
+ }
+
+ /**
+ * @return com.ibm.sed.css.interfaces.CSSStyleDeclBlock
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public static ICSSStyleDeclaration createCSSStyleDeclaration() throws org.w3c.dom.DOMException {
+ CSSStyleDeclarationImpl document = new CSSStyleDeclarationImpl(true);
+
+ return document;
+ }
+
+ /**
+ * @return org.w3c.dom.css.CSSStyleSheet
+ * @param title
+ * java.lang.String
+ * @param media
+ * java.lang.String
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public static CSSStyleSheet createCSSStyleSheet(String title, String media) throws org.w3c.dom.DOMException {
+ return new CSSStyleSheetImpl();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/MediaListImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/MediaListImpl.java
new file mode 100644
index 0000000000..c7a30c0ae9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/MediaListImpl.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ *
+ */
+class MediaListImpl extends CSSRegionContainer implements MediaList {
+
+ int mediumCounter;
+
+ /**
+ * MediaListImpl constructor comment.
+ */
+ MediaListImpl() {
+ super();
+ }
+
+ /**
+ * MediaListImpl constructor comment.
+ *
+ * @param that
+ * com.ibm.sed.css.treemodel.CSSContainer
+ */
+ MediaListImpl(MediaListImpl that) {
+ super(that);
+ }
+
+ /**
+ * Adds the medium <code>newMedium</code> to the end of the list. If the
+ * <code>newMedium</code> is already used, it is first removed.
+ *
+ * @param newMediumThe
+ * new medium to add.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: If the medium contains characters
+ * that are invalid in the underlying style language. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is
+ * readonly.
+ */
+ public void appendMedium(String newMedium) throws DOMException {
+ if (newMedium == null)
+ return;
+
+ CSSNodeListImpl m = getMedia();
+ for (int i = 0; i != m.getLength(); i++) {
+ if (newMedium.equals(item(i)))
+ return;
+ }
+
+ setAttribute("medium" + Integer.toString(mediumCounter++), newMedium);//$NON-NLS-1$
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/01/17
+ * 18:50:29)
+ *
+ * @return com.ibm.sed.treemodel.css.CSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ MediaListImpl cloned = new MediaListImpl(this);
+ return cloned;
+ }
+
+ /**
+ * Deletes the medium indicated by <code>oldMedium</code> from the list.
+ *
+ * @param oldMediumThe
+ * medium to delete in the media list.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is
+ * readonly. <br>
+ * NOT_FOUND_ERR: Raised if <code>oldMedium</code> is not
+ * in the list.
+ */
+ public void deleteMedium(String oldMedium) throws DOMException {
+ for (int i = 0; i != getLength(); i++) {
+ if (oldMedium.equals(item(i))) {
+ removeAttributeNode((CSSAttrImpl) fAttrs.item(i));
+ }
+ }
+ }
+
+ /**
+ * The number of media in the list. The range of valid media is
+ * <code>0</code> to <code>length-1</code> inclusive.
+ */
+ public int getLength() {
+ return getMedia().getLength();
+ }
+
+ /**
+ * @return CSSNodeListImpl
+ */
+ CSSNodeListImpl getMedia() {
+ if (fAttrs == null)
+ fAttrs = new CSSNamedNodeMapImpl();
+ return fAttrs;
+ }
+
+ /**
+ * The parsable textual representation of the media list. This is a
+ * comma-separated list of media.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified string value has a
+ * syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this media list
+ * is readonly.
+ */
+ public String getMediaText() {
+ return getCssText();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/01/17
+ * 18:50:29)
+ *
+ * @return short
+ */
+ public short getNodeType() {
+ return MEDIALIST_NODE;
+ }
+
+ /**
+ * Returns the <code>index</code> th in the list. If <code>index</code>
+ * is greater than or equal to the number of media in the list, this
+ * returns <code>null</code>.
+ *
+ * @param index
+ * Index into the collection.
+ * @return The medium at the <code>index</code> th position in the
+ * <code>MediaList</code>, or <code>null</code> if that is
+ * not a valid index.
+ */
+ public String item(int index) {
+ if (index < 0 || getLength() <= index)
+ return null;
+
+ return ((CSSAttrImpl) getMedia().item(index)).getValue();
+ }
+
+ /**
+ * setMediaText method comment.
+ */
+ public void setMediaText(String mediaText) throws DOMException {
+ setCssText(mediaText);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RGBColorImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RGBColorImpl.java
new file mode 100644
index 0000000000..4120fc25f5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RGBColorImpl.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.RGBColor;
+
+
+/**
+ *
+ */
+class RGBColorImpl extends CSSPrimitiveContainer implements RGBColor {
+
+ private CSSPrimitiveValueImpl fRed;
+ private CSSPrimitiveValueImpl fGreen;
+ private CSSPrimitiveValueImpl fBlue;
+
+ /**
+ *
+ */
+ RGBColorImpl() {
+ super(CSS_RGBCOLOR);
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.RGBColorImpl
+ */
+ RGBColorImpl(RGBColorImpl that) {
+ super(that);
+
+ fRed = new CSSPrimitiveValueImpl(that.fRed);
+ appendChild(fRed);
+
+ fGreen = new CSSPrimitiveValueImpl(that.fGreen);
+ appendChild(fGreen);
+
+ fBlue = new CSSPrimitiveValueImpl(that.fBlue);
+ appendChild(fBlue);
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ RGBColorImpl cloned = new RGBColorImpl(this);
+
+ return cloned;
+ }
+
+ /**
+ * This attribute is used for the blue value of the RGB color.
+ */
+ public CSSPrimitiveValue getBlue() {
+ return fBlue;
+ }
+
+ /**
+ * This attribute is used for the green value of the RGB color.
+ */
+ public CSSPrimitiveValue getGreen() {
+ return fGreen;
+ }
+
+ /**
+ * This attribute is used for the red value of the RGB color.
+ */
+ public CSSPrimitiveValue getRed() {
+ return fRed;
+ }
+
+ /**
+ * @return org.w3c.dom.css.RGBColor
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public RGBColor getRGBColorValue() throws org.w3c.dom.DOMException {
+ return this;
+ }
+
+ /**
+ *
+ */
+ protected void initPrimitives() {
+
+ fRed = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fRed);
+
+ fGreen = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fGreen);
+
+ fBlue = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fBlue);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RectImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RectImpl.java
new file mode 100644
index 0000000000..83880274f1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/RectImpl.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.Rect;
+
+
+/**
+ *
+ */
+class RectImpl extends CSSPrimitiveContainer implements Rect {
+
+ private CSSPrimitiveValueImpl fTop;
+ private CSSPrimitiveValueImpl fRight;
+ private CSSPrimitiveValueImpl fBottom;
+ private CSSPrimitiveValueImpl fLeft;
+
+ /**
+ *
+ */
+ RectImpl() {
+ super(CSS_RECT);
+ }
+
+ /**
+ * @param that
+ * com.ibm.sed.css.treemodel.RectImpl
+ */
+ RectImpl(RectImpl that) {
+ super(that);
+
+ fTop = new CSSPrimitiveValueImpl(that.fTop);
+ appendChild(fTop);
+
+ fRight = new CSSPrimitiveValueImpl(that.fRight);
+ appendChild(fRight);
+
+ fBottom = new CSSPrimitiveValueImpl(that.fBottom);
+ appendChild(fBottom);
+
+ fLeft = new CSSPrimitiveValueImpl(that.fLeft);
+ appendChild(fLeft);
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param deep
+ * boolean
+ */
+ public ICSSNode cloneNode(boolean deep) {
+ RectImpl cloned = new RectImpl(this);
+
+ return cloned;
+ }
+
+ /**
+ * This attribute is used for the bottom of the rect.
+ */
+ public CSSPrimitiveValue getBottom() {
+ return fBottom;
+ }
+
+ /**
+ * This attribute is used for the left of the rect.
+ */
+ public CSSPrimitiveValue getLeft() {
+ return fLeft;
+ }
+
+ /**
+ * @return org.w3c.dom.css.Rect
+ * @exception org.w3c.dom.DOMException
+ * The exception description.
+ */
+ public Rect getRectValue() throws org.w3c.dom.DOMException {
+ return this;
+ }
+
+ /**
+ * This attribute is used for the right of the rect.
+ */
+ public CSSPrimitiveValue getRight() {
+ return fRight;
+ }
+
+ /**
+ * This attribute is used for the top of the rect.
+ */
+ public CSSPrimitiveValue getTop() {
+ return fTop;
+ }
+
+ /**
+ *
+ */
+ protected void initPrimitives() {
+
+ fTop = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fTop);
+
+ fRight = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fRight);
+
+ fBottom = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fBottom);
+
+ fLeft = (CSSPrimitiveValueImpl) getOwnerDocument().createCSSPrimitiveValue(CSS_NUMBER);
+ appendChild(fLeft);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/StyleSheetListImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/StyleSheetListImpl.java
new file mode 100644
index 0000000000..fea1bfca15
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/StyleSheetListImpl.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.document;
+
+
+
+import org.w3c.dom.stylesheets.StyleSheet;
+import org.w3c.dom.stylesheets.StyleSheetList;
+
+/**
+ *
+ */
+class StyleSheetListImpl extends AbstractCSSNodeList implements StyleSheetList {
+
+ /**
+ * StyleSheetListImpl constructor comment.
+ */
+ StyleSheetListImpl() {
+ super();
+ }
+
+ /**
+ * Used to retrieve a style sheet by ordinal index. If index is greater
+ * than or equal to the number of style sheets in the list, this returns
+ * <code>null</code>.
+ *
+ * @param indexIndex
+ * into the collection
+ * @return The style sheet at the <code>index</code> position in the
+ * <code>StyleSheetList</code>, or <code>null</code> if that
+ * is not a valid index.
+ */
+ public StyleSheet item(int index) {
+ return (StyleSheet) itemImpl(index);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/ByteUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/ByteUtil.java
new file mode 100644
index 0000000000..635e388b5c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/ByteUtil.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.encoding;
+
+
+
+public class ByteUtil {
+
+
+ public static void main(String[] args) {
+ String bigString = "\n<@ page\n"; //$NON-NLS-1$
+ String target = "<@ PAGE"; //$NON-NLS-1$
+ int match = findIfMatch(stringToByteArray(bigString), 7, 0, stringToByteArray(target));
+ System.out.println(match);
+ }
+
+ /**
+ * ByteUtil constructor comment.
+ */
+ public ByteUtil() {
+ super();
+ }
+
+ /**
+ * @return int
+ * @param s1
+ * byte[]
+ * @param s2
+ * byte[]
+ * @param n
+ * int
+ *
+ * Compare bytes. If same, return 0. Otherwise non-zero.
+ */
+ private static int _cmp(byte[] s1, int starts1pos, byte[] s2, int starts2pos, int complen, boolean ignorecase) {
+ if ((s1 == null) || (s2 == null))
+ return 1;
+ int len_s1 = s1.length - starts1pos;
+ int len_s2 = s2.length - starts2pos;
+ if ((len_s1 <= 0) || (len_s2 <= 0))
+ return 1;
+ if ((len_s1 < complen) || (len_s2 < complen))
+ return 1;
+
+ int len = complen;
+ int offset = 0;
+ byte c1 = (byte) 0, c2 = (byte) 0;
+ while (offset < len) {
+ if (ignorecase == true) {
+ c1 = _toUpper(s1[starts1pos + offset]);
+ c2 = _toUpper(s2[starts2pos + offset]);
+ }
+ else {
+ c1 = s1[starts1pos + offset];
+ c2 = s2[starts2pos + offset];
+ }
+ if (c1 == c2) {
+ offset++;
+ continue;
+ }
+ else {
+ break;
+ }
+ }
+
+ return (offset == len ? 0 : (int) (c1 - c2));
+ }
+
+ /**
+ * @return byte
+ * @param c1
+ * byte
+ *
+ * Convert to upper case letter. It's for ASCII only
+ */
+ private static byte _toUpper(byte c1) {
+ if ((c1 >= (byte) 0x61) && (c1 <= (byte) 0x7a))
+ c1 -= 0x20;
+ return c1;
+ }
+
+ /**
+ * @return int
+ * @param string
+ * byte[]
+ * @param target
+ * byte[]
+ *
+ * Look for the index of 2nd byte[] within 1st byte[]. If being found,
+ * return the pos. Otherwise, return -1. This is case-insensitive. It's
+ * simlar to String.indexOf().
+ */
+ public static int findIfMatch(byte[] container, int length, int startpos, byte[] target) {
+ int container_len = length - startpos;
+ int target_len = target.length;
+
+ // Clearly different
+ if ((container_len <= 0) || (target_len <= 0))
+ return -1;
+ if (target_len > container_len)
+ return -1;
+
+ // Look for the same bytes as 'target' in 'container' from startpos
+ int pos;
+ for (pos = startpos; pos < length; pos++) {
+ if (strCaseCmp(container, pos, target, 0, target_len) == 0) {
+ // matched.
+ return pos;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Let the conversion be done in code since it's easier to reuse and
+ * verify than converting them by hand.
+ */
+ private static byte[] stringToByteArray(String string) {
+ byte[] bytes = new byte[string.length()];
+ for (int i = 0; i < string.length(); i++)
+ bytes[i] = (byte) string.charAt(i); // typecast to number using
+ // lower 8 bits only
+ return bytes;
+ }
+
+ /**
+ * @return int
+ * @param container
+ * byte[]
+ * @param startpos
+ * int
+ * @param target
+ * byte
+ *
+ * This is case-insensitive.
+ */
+ public static int findIfMatch(byte[] container, int length, int startpos, byte target) {
+ int container_len = length - startpos;
+
+ if (container_len <= 0)
+ return -1;
+
+ // Look for the same byte as 'target' in 'container' from startpos
+ int pos;
+ for (pos = startpos; pos < length; pos++) {
+ if (_toUpper(container[pos]) == _toUpper(target))
+ return pos;
+ }
+
+ return -1;
+ }
+
+ /**
+ * @return int
+ * @param container
+ * byte[]
+ * @param length
+ * int
+ * @param startpos
+ * int
+ * @param target
+ * byte
+ *
+ * Skip same bytes as target. Return the position. If goes to end, return
+ * -1
+ */
+ public static int skipIfMatch(byte[] container, int length, int startpos, byte target) {
+ int container_len = length - startpos;
+
+ // Clearly error
+ if (container_len <= 0)
+ return -1;
+
+ int pos;
+ for (pos = startpos; pos < length; pos++) {
+ if (container[pos] != target)
+ break;
+ }
+ if (pos == length) {
+ // I found everything is target
+ pos = -1;
+ }
+ return pos;
+ }
+
+ /**
+ * @return int
+ * @param s1
+ * byte[]
+ * @param starts1pos
+ * int
+ * @param s2
+ * byte[]
+ * @param starts2pos
+ * int
+ *
+ * It's similar to XPG4's strcasecmp()
+ */
+ public static int strCaseCmp(byte[] s1, int starts1pos, byte[] s2, int starts2pos, int complen) {
+ return _cmp(s1, starts1pos, s2, starts2pos, complen, true);
+ }
+
+ /**
+ * @return int
+ * @param s1
+ * byte[]
+ * @param starts1pos
+ * int
+ * @param s2
+ * byte[]
+ * @param starts2pos
+ * int
+ *
+ * It's similar to XPG4's strcmp()
+ */
+ public static int strCmp(byte[] s1, int starts1pos, byte[] s2, int starts2pos, int complen) {
+ return _cmp(s1, starts1pos, s2, starts2pos, complen, false);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentCharsetDetector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentCharsetDetector.java
new file mode 100644
index 0000000000..a7262809d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentCharsetDetector.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.encoding;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.css.core.internal.content.CSSResourceEncodingDetector;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.document.DocumentReader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.util.StringUtils;
+
+
+public class CSSDocumentCharsetDetector extends CSSResourceEncodingDetector implements IDocumentCharsetDetector {
+
+ public String getEncodingName(IStructuredDocument structuredDocument) {
+ String result = null;
+ // if the document is empty, then there will be no nodes,
+ // so no need to continue.
+ IStructuredDocumentRegionList nodes = structuredDocument.getRegionList();
+ if (nodes.getLength() > 0) {
+ IStructuredDocumentRegion node = null;
+ // skip any initial whitespace
+ // Note that @charset "encodingname";
+ // must appear at very beginning of document,
+ // to be valid.
+ // May have to test with "damaged" files (e.g.
+ // beginning EOLs, etc., to verify this works
+ // as expected.
+ for (int i = 0; i < nodes.getLength(); i++) {
+ node = nodes.item(i);
+ if (getType(node) != CSSRegionContexts.CSS_S) {
+ break;
+ }
+ }
+ Iterator regions = node.getRegions().iterator();
+ ITextRegion region = getNextRegionOfType(CSSRegionContexts.CSS_CHARSET, regions);
+ if (region != null) {
+ ITextRegion valueRegion = getNextRegionOfType(CSSRegionContexts.CSS_STRING, regions);
+ if (valueRegion == null) {
+ // if didn't find the region, its probably due to ill
+ // formed input, such as
+ // @charset "ISO-8859-6;
+ // so we'll try again for "unknown" region.
+ // If that fails, we'll give up?
+ regions = node.getRegions().iterator();
+ region = getNextRegionOfType(CSSRegionContexts.CSS_CHARSET, regions);
+ if (region != null) {
+ valueRegion = getNextRegionOfType(CSSRegionContexts.CSS_UNKNOWN, regions);
+ if (valueRegion != null) {
+ result = node.getText(valueRegion);
+ }
+ }
+ }
+ else {
+ result = node.getText(valueRegion);
+ }
+ result = StringUtils.stripNonLetterDigits(result);
+ }
+ }
+ return result;
+ }
+
+ public String getEncodingName(IDocument document) {
+ String enc = null;
+ if (document instanceof IStructuredDocument) {
+ enc = getEncodingName((IStructuredDocument) document);
+ }
+ else {
+ // TODO Important: need to implement some "raw" parser for
+ // IDocument level
+ }
+ return enc;
+ }
+
+ private String getType(IStructuredDocumentRegion node) {
+ if (node == null)
+ return null;
+ ITextRegionList regions = node.getRegions();
+ if (regions == null || regions.size() == 0)
+ return null;
+ ITextRegion region = regions.get(0);
+ String result = region.getType();
+ return result;
+ }
+
+ private ITextRegion getNextRegionOfType(String type, Iterator regions) {
+ if (type == null)
+ return null;
+ if (regions == null)
+ return null;
+ ITextRegion result = null;
+ while (regions.hasNext()) {
+ ITextRegion region = (ITextRegion) regions.next();
+ if (region.getType() == type) {
+ result = region;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ *
+ */
+
+ public void set(IDocument document) {
+ set(new DocumentReader(document, 0));
+
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentLoader.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentLoader.java
new file mode 100644
index 0000000000..1f9a69f9ec
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/encoding/CSSDocumentLoader.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.encoding;
+
+
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.wst.common.encoding.ContentTypeEncodingPreferences;
+import org.eclipse.wst.common.encoding.EncodingGuesser;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.internal.parser.CSSSourceParser;
+import org.eclipse.wst.css.core.internal.text.CSSStructuredDocumentReParser;
+import org.eclipse.wst.css.core.internal.text.rules.StructuredTextPartitionerForCSS;
+import org.eclipse.wst.sse.core.document.AbstractDocumentLoader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.document.IEncodedDocument;
+import org.eclipse.wst.sse.core.document.StructuredDocumentFactory;
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+
+
+public class CSSDocumentLoader extends AbstractDocumentLoader {
+ private final static String CSS_ID = IContentTypeIdentifier.ContentTypeID_CSS;
+ private IDocumentCharsetDetector documentEncodingDetector;
+
+
+ public CSSDocumentLoader() {
+ super();
+ }
+
+ protected String getEncodingNameByGuess(byte[] string, int length) {
+ String ianaEnc = null;
+ ianaEnc = EncodingGuesser.guessEncoding(string, length);
+ return ianaEnc;
+ }
+
+ /**
+ * Default encoding. For CSS there is no spec'd default.
+ */
+ protected String getSpecDefaultEncoding() {
+ return null;
+ }
+
+ protected IEncodedDocument newEncodedDocument() {
+ // DMW: I copied this from CSSModelImple ...
+ // but am not sure its right
+ IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser());
+ CSSStructuredDocumentReParser reParser = new CSSStructuredDocumentReParser();
+ reParser.setStructuredDocument(structuredDocument);
+ ((BasicStructuredDocument) structuredDocument).setReParser(reParser);
+ return structuredDocument;
+ }
+
+ public RegionParser getParser() {
+ // return new CSSRegionParser();
+ return new CSSSourceParser();
+ }
+
+ protected String getPreferredNewLineDelimiter() {
+ return ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(CSS_ID);
+ }
+
+ public IDocumentCharsetDetector getDocumentEncodingDetector() {
+ if (documentEncodingDetector == null) {
+ documentEncodingDetector = new CSSDocumentCharsetDetector();
+ }
+ return documentEncodingDetector;
+ }
+
+ public IDocumentPartitioner getDefaultDocumentPartitioner() {
+ return new StructuredTextPartitionerForCSS();
+ }
+
+ public IDocumentLoader newInstance() {
+ return new CSSDocumentLoader();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSEmbededStyleNotifyAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSEmbededStyleNotifyAdapter.java
new file mode 100644
index 0000000000..e48e31ec2c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSEmbededStyleNotifyAdapter.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.event;
+
+
+
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.event.ICSSStyleListener;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.xml.core.document.XMLNode;
+
+
+public class CSSEmbededStyleNotifyAdapter extends CSSStyleNotifyAdapter {
+
+ /**
+ * CSSEmbeddedStyleNotifyAdapter constructor comment.
+ *
+ * @param model
+ * org.eclipse.wst.css.core.model.interfaces.ICSSModel
+ */
+ public CSSEmbededStyleNotifyAdapter(ICSSModel model) {
+ super(model);
+ }
+
+ /**
+ *
+ */
+ public void styleChanged(ICSSModel srcModel, ICSSSelector[] removed, ICSSSelector[] added, String media) {
+ XMLNode node = (XMLNode) model.getOwnerDOMNode();
+ if (node != null)
+ return;
+ INodeAdapter adapter = node.getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter instanceof ICSSStyleListener) {
+ ((ICSSStyleListener) adapter).styleChanged(srcModel, removed, added, media);
+ }
+ }
+
+ /**
+ *
+ */
+ public void styleUpdate(ICSSModel srcModel) {
+ XMLNode node = (XMLNode) model.getOwnerDOMNode();
+ if (node != null)
+ return;
+ INodeAdapter adapter = node.getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter instanceof ICSSStyleListener) {
+ ((ICSSStyleListener) adapter).styleUpdate(srcModel);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleEventDeliverer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleEventDeliverer.java
new file mode 100644
index 0000000000..0675a511e3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleEventDeliverer.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.event;
+
+
+
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.event.ICSSStyleListener;
+import org.eclipse.wst.css.core.event.ICSSStyleNotifier;
+
+
+/**
+ *
+ */
+public class CSSStyleEventDeliverer {
+
+ private Vector fVisited = new Vector();
+ private ICSSModel fSrcModel;
+ private ICSSSelector[] fRemoved;
+ private ICSSSelector[] fAdded;
+ private String fMedia;
+
+ /**
+ *
+ */
+ public CSSStyleEventDeliverer() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public void fire(ICSSModel srcModel, ICSSSelector[] removed, ICSSSelector[] added, String media) {
+ if (srcModel == null || srcModel.getStyleListeners() == null)
+ return;
+
+ this.fSrcModel = srcModel;
+ this.fRemoved = removed;
+ this.fAdded = added;
+ this.fMedia = media;
+
+ // prohibit delivering to srcModel
+ fVisited.clear();
+ fVisited.add(srcModel);
+ Object[] listeners = srcModel.getStyleListeners().toArray();
+ for (int i = 0; i < listeners.length; i++) {
+ visit((ICSSStyleListener) listeners[i]);
+ }
+ }
+
+ /**
+ *
+ */
+ public void fireTo(ICSSStyleListener listener, ICSSModel srcModel, ICSSSelector[] removed, ICSSSelector[] added, String media) {
+ this.fSrcModel = srcModel;
+ this.fRemoved = removed;
+ this.fAdded = added;
+ this.fMedia = media;
+
+ // prohibit delivering to srcModel
+ fVisited.clear();
+ // visited.add(srcModel); : because looping problem
+ visit(listener);
+ }
+
+ /**
+ *
+ */
+ public void fireUpdate(ICSSModel srcModel) {
+ if (srcModel == null || srcModel.getStyleListeners() == null)
+ return;
+
+ this.fSrcModel = srcModel;
+
+ // prohibit delivering to srcModel
+ fVisited.clear();
+ fVisited.add(srcModel);
+ Object[] listeners = srcModel.getStyleListeners().toArray();
+ for (int i = 0; i < listeners.length; i++) {
+ visitUpdate((ICSSStyleListener) listeners[i]);
+ }
+ }
+
+ /**
+ *
+ */
+ public void fireUpdateTo(ICSSStyleListener listener, ICSSModel srcModel) {
+ if (srcModel == null || srcModel.getStyleListeners() == null)
+ return;
+
+ this.fSrcModel = srcModel;
+
+ // prohibit delivering to srcModel
+ fVisited.clear();
+ // visited.add(srcModel);
+ visitUpdate(listener);
+ }
+
+ /**
+ *
+ */
+ protected void visit(ICSSStyleListener listener) {
+ if (listener == null || fVisited.contains(listener))
+ return;
+
+ // fire event to listener
+ listener.styleChanged(fSrcModel, fRemoved, fAdded, fMedia);
+ fVisited.add(listener);
+
+ // traverse notifier
+ if (listener instanceof ICSSStyleNotifier) {
+ ICSSStyleNotifier notifier = (ICSSStyleNotifier) listener;
+ if (notifier.getStyleListeners() != null) {
+ Object[] listeners = notifier.getStyleListeners().toArray();
+ for (int i = 0; i < listeners.length; i++) {
+ visit((ICSSStyleListener) listeners[i]);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void visitUpdate(ICSSStyleListener listener) {
+ if (listener == null || fVisited.contains(listener))
+ return;
+
+ // fire event to listener
+ listener.styleUpdate(fSrcModel);
+ fVisited.add(listener);
+
+ // traverse notifier
+ if (listener instanceof ICSSStyleNotifier) {
+ ICSSStyleNotifier notifier = (ICSSStyleNotifier) listener;
+ if (notifier.getStyleListeners() != null) {
+ Object[] listeners = notifier.getStyleListeners().toArray();
+ for (int i = 0; i < listeners.length; i++) {
+ visitUpdate((ICSSStyleListener) listeners[i]);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleNotifyAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleNotifyAdapter.java
new file mode 100644
index 0000000000..b1d03be7ca
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/event/CSSStyleNotifyAdapter.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.event;
+
+
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+import org.eclipse.wst.css.core.event.ICSSStyleListener;
+import org.eclipse.wst.css.core.event.ICSSStyleNotifier;
+import org.eclipse.wst.css.core.util.ImportedCollector;
+import org.eclipse.wst.css.core.util.SelectorsCollector;
+
+
+/**
+ *
+ */
+public class CSSStyleNotifyAdapter implements ICSSStyleNotifier {
+
+ protected java.util.Vector listeners;
+ protected final org.eclipse.wst.css.core.document.ICSSModel model;
+ protected boolean recording = false;
+
+ /**
+ *
+ */
+ public CSSStyleNotifyAdapter(ICSSModel model) {
+ super();
+ this.model = model;
+ }
+
+ /**
+ *
+ */
+ public void addStyleListener(ICSSStyleListener listener) {
+ if (listener == null)
+ return;
+
+ if (listeners == null)
+ listeners = new Vector();
+ if (!listeners.contains(listener)) {
+
+ // send new selectors event to listener
+ ImportedCollector trav = new ImportedCollector();
+ trav.apply(model.getDocument());
+ Iterator it = trav.getExternals().iterator();
+ while (it.hasNext()) {
+ ICSSStyleSheet sheet = (ICSSStyleSheet) it.next();
+ // collect selectors
+ SelectorsCollector selTrav = new SelectorsCollector();
+ selTrav.apply(sheet);
+ int nSel = selTrav.getSelectors().size();
+ ICSSSelector[] added = new ICSSSelector[nSel];
+ for (int i = 0; i < nSel; i++)
+ added[i] = (ICSSSelector) selTrav.getSelectors().get(i);
+
+ // fire event
+ CSSStyleEventDeliverer deliverer = new CSSStyleEventDeliverer();
+ deliverer.fireTo(listener, sheet.getModel(), null, added, null/*
+ * media
+ * will
+ * be
+ * implemented
+ * in
+ * the
+ * future
+ */);
+ }
+
+ // add listener
+ listeners.add(listener);
+ }
+ }
+
+ /**
+ *
+ */
+ public void beginRecording() {
+ recording = true;
+ }
+
+ /**
+ *
+ */
+ public void endRecording() {
+ recording = false;
+ }
+
+ /**
+ *
+ */
+ public void fire(ICSSSelector[] removed, ICSSSelector[] added, String media) {
+ // send selector changed event
+ CSSStyleEventDeliverer deliv = new CSSStyleEventDeliverer();
+ deliv.fire(model, removed, added, null);
+
+ }
+
+ /**
+ *
+ */
+ public java.util.List getStyleListeners() {
+ return listeners;
+ }
+
+ /**
+ */
+ public boolean isRecording() {
+ return recording;
+ }
+
+ /**
+ *
+ */
+ public void removeStyleListener(ICSSStyleListener listener) {
+ if (listener == null)
+ return;
+
+ if (listeners.contains(listener)) {
+ listeners.remove(listener);
+
+ // send old selectors event to listener
+ ImportedCollector trav = new ImportedCollector();
+ trav.apply(model.getDocument());
+ Iterator it = trav.getExternals().iterator();
+ while (it.hasNext()) {
+ ICSSStyleSheet sheet = (ICSSStyleSheet) it.next();
+ // collect selectors
+ SelectorsCollector selTrav = new SelectorsCollector();
+ selTrav.apply(sheet);
+ int nSel = selTrav.getSelectors().size();
+ ICSSSelector[] removed = new ICSSSelector[nSel];
+ for (int i = 0; i < nSel; i++)
+ removed[i] = (ICSSSelector) selTrav.getSelectors().get(i);
+
+ // fire event
+ CSSStyleEventDeliverer deliverer = new CSSStyleEventDeliverer();
+ deliverer.fireTo(listener, sheet.getModel(), removed, null, null/*
+ * media
+ * will
+ * be
+ * implemented
+ * in
+ * the
+ * future
+ */);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void styleChanged(org.eclipse.wst.css.core.document.ICSSModel srcModel, org.eclipse.wst.css.core.document.ICSSSelector[] removed, org.eclipse.wst.css.core.document.ICSSSelector[] added, java.lang.String media) {
+ }
+
+ /**
+ *
+ */
+ public void styleUpdate(org.eclipse.wst.css.core.document.ICSSModel srcModel) {
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
new file mode 100644
index 0000000000..bdb74b058e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
@@ -0,0 +1,974 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.jface.text.DefaultLineTracker;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategyImpl;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSLinkConverter;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.util.Assert;
+
+/**
+ *
+ */
+public abstract class AbstractCSSSourceFormatter implements CSSSourceGenerator {
+
+ protected final static short GENERATE = 0;
+ protected final static short FORMAT = 1;
+ protected final static short CLEANUP = 2;
+ protected static short strategy;
+
+ /**
+ *
+ */
+ AbstractCSSSourceFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void appendDelimBefore(ICSSNode node, CompoundRegion toAppend, StringBuffer source) {
+ if (node == null || source == null)
+ return;
+ if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
+ return; // for not formatting case on cleanup action
+ String delim = getLineDelimiter(node);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ boolean needIndent = !(node instanceof ICSSStyleSheet);
+ if (toAppend == null) {
+ source.append(delim);
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ else {
+ String type = toAppend.getType();
+ if (type == CSSRegionContexts.CSS_COMMENT) {
+ RegionIterator it = new RegionIterator(toAppend.getDocumentRegion(), toAppend.getTextRegion());
+ it.prev();
+ ITextRegion prev = it.prev();
+ if (prev == null || (prev.getType() == CSSRegionContexts.CSS_S && TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), 0)[0] >= 0)) {
+ source.append(delim);
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ else {
+ appendSpaceBefore(node, toAppend.getText(), source);
+ }
+ }
+ else if (type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ RegionIterator it = new RegionIterator(toAppend.getDocumentRegion(), toAppend.getTextRegion());
+ it.prev();
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S && TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), 0)[0] >= 0) {
+ source.append(delim);
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ else if (mgr.getMaxLineWidth() > 0 && (!mgr.isProhibitWrapOnAttr() || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
+ int length = getLastLineLength(node, source);
+ int append = 1;
+ if (length + append > mgr.getMaxLineWidth()) {
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ }
+ }
+ else if (type == CSSRegionContexts.CSS_RBRACE || type == CSSRegionContexts.CSS_LBRACE) {
+ source.append(delim);
+ source.append(getIndent(node));
+ }
+ else {
+ source.append(delim);
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void appendSpaceBefore(ICSSNode node, CompoundRegion toAppend, StringBuffer source) {
+ if (node == null || toAppend == null || source == null)
+ return;
+ if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
+ return; // for not formatting case on cleanup action
+ String type = toAppend.getType();
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ boolean needIndent = !(node instanceof ICSSStyleSheet);
+ if (type == CSSRegionContexts.CSS_COMMENT) {
+ // check whether previous region is 'S' and has CR-LF
+ String delim = getLineDelimiter(node);
+ RegionIterator it = new RegionIterator(toAppend.getDocumentRegion(), toAppend.getTextRegion());
+ it.prev();
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S && TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, it.getStructuredDocumentRegion().getText(prev), 0)[0] >= 0) {
+ source.append(delim);
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ else {
+ appendSpaceBefore(node, toAppend.getText(), source);
+ }
+ }
+ else if (type == CSSRegionContexts.CSS_LBRACE && mgr.isNewLineOnOpenBrace()) {
+ String delim = getLineDelimiter(node);
+ source.append(delim);
+ source.append(getIndent(node));
+ // } else if (type == CSSRegionContexts.CSS_CURLY_BRACE_CLOSE) {
+ // } else if (type == CSSRegionContexts.CSS_INCLUDES || type ==
+ // CSSRegionContexts.CSS_DASHMATCH) {
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR && node instanceof ICSSStyleDeclItem) {
+ int n = mgr.getSpacesPreDelimiter();
+ if (mgr.getMaxLineWidth() > 0 && (!mgr.isProhibitWrapOnAttr() || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
+ int length = getLastLineLength(node, source);
+ int append = 1;
+ if (length + n + append > mgr.getMaxLineWidth()) {
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ n = 0; // no space is necessary
+ }
+ }
+ // no delimiter case
+ while (n-- > 0)
+ source.append(" ");//$NON-NLS-1$
+ }
+ else if (type == CSSRegionContexts.CSS_DECLARATION_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR || type == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
+ if (mgr.getMaxLineWidth() > 0 && (!mgr.isProhibitWrapOnAttr() || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
+ int length = getLastLineLength(node, source);
+ int append = 1;
+ if (length + append > mgr.getMaxLineWidth()) {
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ if (needIndent)
+ source.append(mgr.getIndentString());
+ }
+ }
+ }
+ else
+ appendSpaceBefore(node, toAppend.getText(), source);
+ }
+
+ /**
+ *
+ */
+ protected void appendSpaceBefore(ICSSNode node, String toAppend, StringBuffer source) {
+ if (node == null || source == null)
+ return;
+ if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
+ return; // for not formatting case on cleanup action
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (toAppend != null && toAppend.startsWith("{") && mgr.isNewLineOnOpenBrace()) {//$NON-NLS-1$
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ return;
+ }
+ else if (/* ! mgr.isOnePropertyPerLine() && */mgr.getMaxLineWidth() > 0 && (!mgr.isProhibitWrapOnAttr() || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
+ int n = getLastLineLength(node, source);
+ int append = (toAppend != null) ? TextUtilities.indexOf(DefaultLineTracker.DELIMITERS, toAppend, 0)[0] : 0;
+ if (toAppend != null)
+ append = (append < 0) ? toAppend.length() : append;
+ if (n + append + 1 > mgr.getMaxLineWidth()) {
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ source.append(mgr.getIndentString());
+ return;
+ }
+ }
+ source.append(" ");//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ public final StringBuffer cleanup(ICSSNode node) {
+ short oldStrategy = strategy;
+ strategy = CLEANUP;
+ StringBuffer source = formatProc(node);
+ strategy = oldStrategy;
+
+ return source;
+ }
+
+ /**
+ *
+ */
+ public final StringBuffer cleanup(ICSSNode node, IRegion region) {
+ short oldStrategy = strategy;
+ strategy = CLEANUP;
+ StringBuffer source = formatProc(node, region);
+ strategy = oldStrategy;
+
+ return source;
+ }
+
+ /**
+ *
+ */
+ protected String decoratedIdentRegion(CompoundRegion region, CSSCleanupStrategy stgy) {
+ if (isFormat())
+ return region.getText();
+
+ String text = region.getText();
+ if (region.getType() == CSSRegionContexts.CSS_STRING || region.getType() == CSSRegionContexts.CSS_URI)
+ return decoratedRegion(region, 0, stgy);
+
+ if (isCleanup()) {
+ if (stgy.getIdentCase() == CSSCleanupStrategy.ASIS || region.getType() == CSSRegionContexts.CSS_COMMENT)
+ return text;
+ else if (stgy.getIdentCase() == CSSCleanupStrategy.UPPER)
+ return text.toUpperCase();
+ else
+ return text.toLowerCase();
+ }
+ else {
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+
+ if (mgr.isPreserveCase() || region.getType() == CSSRegionContexts.CSS_COMMENT)
+ return text;
+ else if (mgr.isIdentUpperCase())
+ return text.toUpperCase();
+ else
+ return text.toLowerCase();
+ }
+ }
+
+ /**
+ *
+ */
+ protected String decoratedPropNameRegion(CompoundRegion region, CSSCleanupStrategy stgy) {
+ if (isFormat())
+ return region.getText();
+
+ String text = region.getText();
+ if (region.getType() == CSSRegionContexts.CSS_STRING || region.getType() == CSSRegionContexts.CSS_URI)
+ return decoratedRegion(region, 1, stgy);
+ if (isCleanup()) {
+ if (stgy.getPropNameCase() == CSSCleanupStrategy.ASIS || region.getType() != CSSRegionContexts.CSS_DECLARATION_PROPERTY)
+ return text;
+ else if (stgy.getPropNameCase() == CSSCleanupStrategy.UPPER)
+ return text.toUpperCase();
+ else
+ return text.toLowerCase();
+ }
+ else {
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+
+ if (mgr.isPreserveCase() || region.getType() != CSSRegionContexts.CSS_DECLARATION_PROPERTY)
+ return text;
+ else if (mgr.isPropNameUpperCase())
+ return text.toUpperCase();
+ else
+ return text.toLowerCase();
+ }
+ }
+
+ /**
+ *
+ */
+ protected String decoratedPropValueRegion(CompoundRegion region, CSSCleanupStrategy stgy) {
+ if (isFormat())
+ return region.getText();
+
+ String text = region.getText();
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_STRING || type == CSSRegionContexts.CSS_URI)
+ return decoratedRegion(region, 2, stgy);
+ if (isCleanup()) {
+ if (stgy.getPropValueCase() != CSSCleanupStrategy.ASIS) {
+ if (type == CSSRegionContexts.CSS_COMMENT) {
+ }
+ else {
+ if (stgy.getPropValueCase() == CSSCleanupStrategy.UPPER)
+ text = text.toUpperCase();
+ else
+ text = text.toLowerCase();
+ }
+ }
+ }
+ else {
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+
+ if (!mgr.isPreserveCase()) {
+ if (type == CSSRegionContexts.CSS_COMMENT) {
+ }
+ else {
+ if (mgr.isPropValueUpperCase())
+ text = text.toUpperCase();
+ else
+ text = text.toLowerCase();
+ }
+ }
+ }
+ return text;
+ }
+
+ /**
+ *
+ */
+ protected String decoratedRegion(CompoundRegion region, int type, CSSCleanupStrategy stgy) {
+ if (isFormat())
+ return region.getText();
+
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ String text = region.getText();
+ if (region.getType() == CSSRegionContexts.CSS_URI) {
+ String uri = CSSLinkConverter.stripFunc(text);
+ boolean upper = (type == 0) ? mgr.isIdentUpperCase() : ((type == 1) ? mgr.isPropNameUpperCase() : mgr.isPropValueUpperCase());
+ String func = mgr.isPreserveCase() ? text.substring(0, 4) : (upper ? "URL(" : "url(");//$NON-NLS-2$//$NON-NLS-1$
+ if (isCleanup()) {
+ upper = ((type == 0) ? stgy.getIdentCase() : ((type == 1) ? stgy.getPropNameCase() : stgy.getPropValueCase())) == CSSCleanupStrategy.UPPER;
+ func = ((type == 0) ? stgy.getIdentCase() : ((type == 1) ? stgy.getPropNameCase() : stgy.getPropValueCase())) == CSSCleanupStrategy.ASIS ? text.substring(0, 4) : (upper ? "URL(" : "url(");//$NON-NLS-2$//$NON-NLS-1$
+ }
+ if ((!isCleanup() && mgr.isQuoteInURI()) || (isCleanup() && stgy.isQuoteValues())) {
+ String quote = mgr.getQuoteString(null /* reserved parameter */);
+ quote = CSSUtil.detectQuote(uri, quote);
+ text = func + quote + uri + quote + ")";//$NON-NLS-1$
+ }
+ else if (isCleanup() && !stgy.isQuoteValues()) {
+ text = func + CSSLinkConverter.removeFunc(text) + ")";//$NON-NLS-1$
+ }
+ else {
+ text = func + uri + ")";//$NON-NLS-1$
+ }
+ }
+ else if (region.getType() == CSSRegionContexts.CSS_STRING && (!isCleanup() || stgy.isQuoteValues())) {
+ String quote = mgr.getQuoteString(null /* reserved parameter */);
+ // begginning
+ if (!text.startsWith(quote)) {
+ if (text.startsWith("\"") || text.startsWith("\'")) //$NON-NLS-1$ //$NON-NLS-2$
+ text = quote + text.substring(1);
+ else
+ text = quote + text;
+ }
+ // ending
+ if (!text.endsWith(quote)) {
+ if (text.endsWith("\"") || text.endsWith("\'")) //$NON-NLS-1$ //$NON-NLS-2$
+ text = text.substring(0, text.length() - 1) + quote;
+ else
+ text = text + quote;
+ }
+ }
+ return text;
+ }
+
+ /**
+ *
+ */
+ public final StringBuffer format(ICSSNode node) {
+ short oldStrategy = strategy;
+ strategy = FORMAT;
+ StringBuffer source = formatProc(node);
+ strategy = oldStrategy;
+
+ return source;
+ }
+
+ /**
+ *
+ */
+ public final StringBuffer format(ICSSNode node, IRegion region) {
+ short oldStrategy = strategy;
+ strategy = FORMAT;
+ StringBuffer source = formatProc(node, region);
+ strategy = oldStrategy;
+
+ return source;
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ return new StringBuffer(insert && (attr != null) ? attr.getValue() : "");//$NON-NLS-1$
+ }
+
+ /**
+ * Generate or format source between children('child' and its previous
+ * sibling) and append to string buffer
+ */
+ abstract protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor);
+
+ /**
+ * Generate or format source between children('child' and its previous
+ * sibling) and append to string buffer
+ */
+ public final StringBuffer formatBefore(ICSSNode node, ICSSNode child, IRegion exceptFor) {
+ Assert.isTrue(child == null || child.getParentNode() == node);
+ StringBuffer buf = new StringBuffer();
+ formatBefore(node, child, /* (child != null) ? (child.getCssText()) : */"", buf, exceptFor);//$NON-NLS-1$
+ return buf;
+ }
+
+ /**
+ * Generate or format source between children('child' and its previous
+ * sibling) and append to string buffer
+ */
+ protected abstract void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source);
+
+ /**
+ *
+ */
+ protected final void formatChildren(ICSSNode node, StringBuffer source) {
+ ICSSNode child = node.getFirstChild();
+ boolean first = true;
+ while (child != null) {
+ // append child
+ CSSSourceFormatter formatter = (CSSSourceFormatter) ((INodeNotifier) child).getAdapterFor(CSSSourceFormatter.class);
+ if (formatter == null) {
+ formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) child);
+ }
+ StringBuffer childSource = ((AbstractCSSSourceFormatter) formatter).formatProc(child);
+ if (!first) {
+ formatBefore(node, child, new String(childSource), source, null);
+ }
+ source.append(childSource);
+ // append between children
+ child = child.getNextSibling();
+ first = false;
+ }
+ }
+
+ /**
+ *
+ */
+ protected final void formatChildren(ICSSNode node, IRegion region, StringBuffer source) {
+ ICSSNode child = node.getFirstChild();
+ int start = region.getOffset();
+ int end = region.getOffset() + region.getLength();
+ boolean first = true;
+ while (child != null) {
+ int curEnd = ((IndexedRegion) child).getEndOffset();
+ StringBuffer childSource = null;
+ boolean toFinish = false;
+ if (start < curEnd) {
+ int curStart = ((IndexedRegion) child).getStartOffset();
+ if (curStart < end) {
+ // append child
+ CSSSourceFormatter formatter = (CSSSourceFormatter) ((INodeNotifier) child).getAdapterFor(CSSSourceFormatter.class);
+ if (formatter == null) {
+ formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) child);
+ }
+ if (includes(region, curStart, curEnd))
+ childSource = ((AbstractCSSSourceFormatter) formatter).formatProc(child);
+ else
+ childSource = ((AbstractCSSSourceFormatter) formatter).formatProc(child, overlappedRegion(region, curStart, curEnd));
+ }
+ else
+ toFinish = true;
+ }
+ // append between children
+ if (!first) {
+ curEnd = ((IndexedRegion) child).getStartOffset(); // change
+ // only
+ // start
+ if (start < curEnd) {
+ int curStart = ((IndexedRegion) child.getPreviousSibling()).getEndOffset();
+ if (curStart < end) {
+ String toAppend = (childSource != null) ? new String(childSource) : "";//$NON-NLS-1$
+ if (includes(region, curStart, curEnd))
+ formatBefore(node, child, toAppend, source, null);
+ else
+ formatBefore(node, child, overlappedRegion(region, curStart, curEnd), toAppend, source);
+ }
+ }
+ }
+ if (childSource != null) {
+ source.append(childSource);
+ }
+ first = false;
+ if (toFinish)
+ break;
+ child = child.getNextSibling();
+ }
+ }
+
+ /**
+ * Generate or format source after the last child and append to string
+ * buffer
+ */
+ protected abstract void formatPost(ICSSNode node, StringBuffer source);
+
+ /**
+ * Generate or format source after the last child and append to string
+ * buffer
+ */
+ protected abstract void formatPost(ICSSNode node, IRegion region, StringBuffer source);
+
+ /**
+ * Generate or format source before the first child and append to string
+ * buffer
+ */
+ protected abstract void formatPre(ICSSNode node, StringBuffer source);
+
+ /**
+ * Generate or format source before the first child and append to string
+ * buffer
+ */
+ abstract protected void formatPre(ICSSNode node, IRegion region, StringBuffer source);
+
+ /**
+ *
+ * @return java.lang.StringBuffer
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ protected final StringBuffer formatProc(ICSSNode node) {
+ StringBuffer source = new StringBuffer();
+ formatPre(node, source);
+ formatChildren(node, source);
+ formatPost(node, source);
+ return source;
+ }
+
+ /**
+ *
+ * @return java.lang.StringBuffer
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param region
+ * org.eclipse.jface.text.IRegion
+ */
+ protected final StringBuffer formatProc(ICSSNode node, IRegion region) {
+ StringBuffer source = new StringBuffer();
+ int curStart = ((IndexedRegion) node).getStartOffset();
+ int curEnd = ((IndexedRegion) node).getEndOffset();
+ if (node.getChildNodes().getLength() > 0) {
+ curEnd = ((IndexedRegion) node.getFirstChild()).getStartOffset();
+ if (overlaps(region, curStart, curEnd)) {
+ if (includes(region, curStart, curEnd))
+ formatPre(node, source);
+ else
+ formatPre(node, overlappedRegion(region, curStart, curEnd), source);
+ }
+ curStart = curEnd;
+ curEnd = ((IndexedRegion) node.getLastChild()).getEndOffset();
+ if (overlaps(region, curStart, curEnd)) {
+ if (includes(region, curStart, curEnd))
+ formatChildren(node, source);
+ else
+ formatChildren(node, overlappedRegion(region, curStart, curEnd), source);
+ }
+ curStart = curEnd;
+ curEnd = ((IndexedRegion) node).getEndOffset();
+ if (overlaps(region, curStart, curEnd)) {
+ if (includes(region, curStart, curEnd))
+ formatPost(node, source);
+ else
+ formatPost(node, overlappedRegion(region, curStart, curEnd), source);
+ }
+ }
+ else {
+ curEnd = getChildInsertPos(node);
+ if (overlaps(region, curStart, curEnd)) {
+ if (includes(region, curStart, curEnd))
+ formatPre(node, source);
+ else
+ formatPre(node, overlappedRegion(region, curStart, curEnd), source);
+ }
+ curStart = curEnd;
+ curEnd = ((IndexedRegion) node).getEndOffset();
+ if (overlaps(region, curStart, curEnd)) {
+ if (includes(region, curStart, curEnd))
+ formatPost(node, source);
+ else
+ formatPost(node, overlappedRegion(region, curStart, curEnd), source);
+ }
+ }
+ return source;
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ return -1;
+ }
+
+ /**
+ * Insert the method's description here.
+ *
+ * @return org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ */
+ protected CSSCleanupStrategy getCleanupStrategy(ICSSNode node) {
+ CSSCleanupStrategy strategy = CSSCleanupStrategyImpl.getInstance();
+ ICSSDocument doc = node.getOwnerDocument();
+ if (doc == null)
+ return strategy;
+ ICSSModel model = doc.getModel();
+ if (model == null)
+ return strategy;
+ if (model.getStyleSheetType() != ICSSModel.EXTERNAL) {
+ // TODO - TRANSITION Nakamori-san, or Kit, how can we move to
+ // "HTML" plugin?
+ // can we subclass?
+ // strategy = CSSInHTMLCleanupStrategyImpl.getInstance();
+ }
+ return strategy;
+ }
+
+ /**
+ *
+ */
+ protected String getIndent(ICSSNode node) {
+ if (node == null)
+ return "";//$NON-NLS-1$
+ ICSSNode parent = node.getParentNode();
+ if (node instanceof ICSSAttr)
+ parent = ((ICSSAttr) node).getOwnerCSSNode();
+ if (parent == null)
+ return "";//$NON-NLS-1$
+ if (node instanceof org.w3c.dom.css.CSSStyleDeclaration)
+ parent = parent.getParentNode();
+ if (parent == null)
+ return "";//$NON-NLS-1$
+
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ String parentIndent = getIndent(parent);
+ if (parent instanceof org.w3c.dom.css.CSSRule)
+ return parentIndent + mgr.getIndentString();
+ if (node.getParentNode() instanceof ICSSStyleDeclaration)
+ return parentIndent + mgr.getIndentString();
+ return parentIndent;
+ }
+
+ /**
+ *
+ */
+ protected int getLastLineLength(ICSSNode node, StringBuffer source) {
+ if (node == null || source == null)
+ return 0;
+ String delim = getLineDelimiter(node);
+ String str = new String(source);
+ int n = str.lastIndexOf(delim);
+ if (n < 0)
+ return str.length();
+ else
+ return str.length() - n - delim.length();
+ }
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ public int getLengthToReformatAfter(ICSSNode node, int insertPos) {
+ if (node == null)
+ return 0;
+ IndexedRegion nnode = (IndexedRegion) node;
+ if (insertPos < 0 || !nnode.contains(insertPos))
+ return 0;
+
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(insertPos);
+ if (flatNode == null)
+ return 0;
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(insertPos);
+ if (region == null)
+ return 0;
+ RegionIterator it = new RegionIterator(flatNode, region);
+ boolean found = false;
+ while (it.hasNext()) {
+ region = it.next();
+ // if (region.getType() != CSSRegionContexts.CSS_S &&
+ // region.getType() != CSSRegionContexts.CSS_DELIMITER &&
+ // region.getType() !=
+ // CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ if (region.getType() != CSSRegionContexts.CSS_S) {
+ found = true;
+ break;
+ }
+ }
+ int pos = (found ? it.getStructuredDocumentRegion().getStartOffset(region) : it.getStructuredDocumentRegion().getTextEndOffset(region)) - insertPos;
+ return (pos >= 0) ? pos : 0;
+ }
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ public int getLengthToReformatBefore(ICSSNode node, int insertPos) {
+ if (node == null)
+ return 0;
+ IndexedRegion nnode = (IndexedRegion) node;
+ if (insertPos <= 0 || !nnode.contains(insertPos - 1))
+ return 0;
+
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(insertPos - 1);
+ if (flatNode == null)
+ return 0;
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(insertPos - 1);
+ if (region == null)
+ return 0;
+ RegionIterator it = new RegionIterator(flatNode, region);
+ boolean found = false;
+ while (it.hasPrev()) {
+ region = it.prev();
+ // if (region.getType() != CSSRegionContexts.CSS_S &&
+ // region.getType() != CSSRegionContexts.CSS_DELIMITER &&
+ // region.getType() !=
+ // CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ if (region.getType() != CSSRegionContexts.CSS_S) {
+ found = true;
+ break;
+ }
+ }
+ int pos = insertPos - (found ? it.getStructuredDocumentRegion().getTextEndOffset(region) : it.getStructuredDocumentRegion().getStartOffset(region));
+ // flatNode = it.getStructuredDocumentRegion();
+ // if (found) {
+ // if (region.getLength() != region.getTextLength()) {
+ // pos = insertPos - flatNode.getTextEndOffset(region);
+ // } else {
+ // pos = insertPos - flatNode.getEndOffset(region);
+ // }
+ // } else {
+ // pos = insertPos - flatNode.getStartOffset(region);
+ // }
+ return (pos >= 0) ? pos : 0;
+ }
+
+ /**
+ *
+ */
+ String getLineDelimiter(ICSSNode node) {
+ ICSSModel model = (node != null) ? node.getOwnerDocument().getModel() : null;
+ return (model != null) ? model.getStructuredDocument().getLineDelimiter() : "\n" /*
+ * default
+ * delimiter
+ */;//$NON-NLS-1$
+
+ // TODO : check whether to use model.getLineDelimiter() or
+ // model.getStructuredDocument().getLineDelimiter()
+ }
+
+ /**
+ *
+ */
+ protected CompoundRegion[] getOutsideRegions(IStructuredDocument model, IRegion reg) {
+ CompoundRegion[] ret = new CompoundRegion[2];
+ RegionIterator it = new RegionIterator(model, reg.getOffset());
+ it.prev();
+ if (it.hasPrev()) {
+ ITextRegion textRegion = it.prev();
+ IStructuredDocumentRegion documentRegion = it.getStructuredDocumentRegion();
+ ret[0] = new CompoundRegion(documentRegion, textRegion);
+ }
+ else {
+ ret[0] = null;
+ }
+ it.reset(model, reg.getOffset() + reg.getLength());
+ if (it.hasNext()) {
+ ITextRegion textRegion = it.next();
+ IStructuredDocumentRegion documentRegion = it.getStructuredDocumentRegion();
+ ret[1] = new CompoundRegion(documentRegion, textRegion);
+ }
+ else {
+ ret[1] = null;
+ }
+ return ret;
+ }
+
+ /**
+ */
+ protected CSSSourceGenerator getParentFormatter(ICSSNode node) {
+ ICSSNode parent = node.getParentNode();
+ if (parent != null) {
+ CSSSourceGenerator formatter = (CSSSourceGenerator) ((INodeNotifier) parent).getAdapterFor(CSSSourceFormatter.class);
+ if (formatter == null) {
+ formatter = CSSSourceFormatterFactory.getInstance().getSourceFormatter((INodeNotifier) parent);
+ }
+ return formatter;
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ protected CompoundRegion[] getRegions(IStructuredDocument model, IRegion reg, IRegion exceptFor, String pickupType) {
+ int start = reg.getOffset();
+ int end = reg.getOffset() + reg.getLength();
+ int startE = (exceptFor != null) ? exceptFor.getOffset() : -1;
+ int endE = (exceptFor != null) ? exceptFor.getOffset() + exceptFor.getLength() : 0;
+
+ ArrayList list = new ArrayList();
+ IStructuredDocumentRegion flatNode = model.getRegionAtCharacterOffset(start);
+ boolean pickuped = false;
+ while (flatNode != null && flatNode.getStartOffset() < end) {
+ ITextRegionList regionList = flatNode.getRegions();
+ Iterator it = regionList.iterator();
+ while (it.hasNext()) {
+ ITextRegion region = (ITextRegion) it.next();
+ if (flatNode.getStartOffset(region) < start)
+ continue;
+ if (end <= flatNode.getStartOffset(region))
+ break;
+ if (startE >= 0 && startE <= flatNode.getStartOffset(region) && flatNode.getEndOffset(region) <= endE)
+ continue;
+ if (region.getType() == CSSRegionContexts.CSS_COMMENT || region.getType() == CSSRegionContexts.CSS_CDC || region.getType() == CSSRegionContexts.CSS_CDO)
+ list.add(new CompoundRegion(flatNode, region));
+ else if (!pickuped && region.getType() == pickupType) {
+ list.add(new CompoundRegion(flatNode, region));
+ pickuped = true;
+ }
+ }
+ flatNode = flatNode.getNext();
+ }
+ if (list.size() > 0) {
+ CompoundRegion[] regions = new CompoundRegion[list.size()];
+ list.toArray(regions);
+ return regions;
+ }
+ else
+ return new CompoundRegion[0];
+ }
+
+ /**
+ *
+ */
+ protected CompoundRegion[] getRegionsWithoutWhiteSpaces(IStructuredDocument model, IRegion reg, CSSCleanupStrategy stgy) {
+ int start = reg.getOffset();
+ int end = reg.getOffset() + reg.getLength() - 1;
+ ArrayList list = new ArrayList();
+ IStructuredDocumentRegion flatNode = model.getRegionAtCharacterOffset(start);
+ while (flatNode != null && flatNode.getStartOffset() <= end) {
+ ITextRegionList regionList = flatNode.getRegions();
+ Iterator it = regionList.iterator();
+ while (it.hasNext()) {
+ ITextRegion region = (ITextRegion) it.next();
+ if (flatNode.getStartOffset(region) < start)
+ continue;
+ if (end < flatNode.getStartOffset(region))
+ break;
+ if (region.getType() != CSSRegionContexts.CSS_S || (isCleanup() && !stgy.isFormatSource())) // for
+ // not
+ // formatting
+ // case
+ // on
+ // cleanup
+ // action
+ list.add(new CompoundRegion(flatNode, region));
+ }
+ flatNode = flatNode.getNext();
+ }
+ if (list.size() > 0) {
+ CompoundRegion[] regions = new CompoundRegion[list.size()];
+ list.toArray(regions);
+ return regions;
+ }
+ else
+ return new CompoundRegion[0];
+ }
+
+ /**
+ *
+ */
+ public static boolean includes(IRegion region, int start, int end) {
+ if (region == null)
+ return false;
+ else
+ return (region.getOffset() <= start) && (end <= region.getOffset() + region.getLength());
+ }
+
+ /**
+ *
+ * @return boolean
+ */
+ protected static boolean isCleanup() {
+ return strategy == CLEANUP;
+ }
+
+ /**
+ *
+ * @return boolean
+ */
+ protected static boolean isFormat() {
+ return strategy == FORMAT;
+ }
+
+ /**
+ *
+ */
+ protected boolean isIncludesPreEnd(ICSSNode node, IRegion region) {
+ return (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getStartOffset() == (region.getOffset() + region.getLength()));
+ }
+
+ /**
+ *
+ */
+ static protected boolean needS(CompoundRegion region) {
+ return (region != null && region.getType() != CSSRegionContexts.CSS_S);
+ }
+
+ /**
+ *
+ */
+ public static IRegion overlappedRegion(IRegion region, int start, int end) {
+ if (overlaps(region, start, end)) {
+ int offset = (region.getOffset() <= start) ? start : region.getOffset();
+ int length = ((end <= region.getOffset() + region.getLength()) ? end : region.getOffset() + region.getLength()) - offset;
+ return new FormatRegion(offset, length);
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ public static boolean overlaps(IRegion region, int start, int end) {
+ if (region == null)
+ return false;
+ else
+ return (start < region.getOffset() + region.getLength()) && (region.getOffset() < end);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrChangeContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrChangeContext.java
new file mode 100644
index 0000000000..924a73e7b6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrChangeContext.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+/**
+ *
+ */
+public class AttrChangeContext {
+
+ public int start, end;
+
+ /**
+ *
+ */
+ public AttrChangeContext() {
+ super();
+ start = end = 0;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrFormatter.java
new file mode 100644
index 0000000000..b3eab4454b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AttrFormatter.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+
+
+/**
+ *
+ */
+public class AttrFormatter extends DefaultCSSSourceFormatter {
+
+ private static AttrFormatter instance;
+
+ /**
+ *
+ */
+ AttrFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ ICSSAttr attr = (ICSSAttr) node;
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int end = ((IndexedRegion) node).getEndOffset();
+ if (end > 0) { // format source
+ int start = ((IndexedRegion) node).getStartOffset();
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+
+ if (attr.getName().equals(ICSSStyleRule.SELECTOR) || attr.getName().equals(ICSSPageRule.SELECTOR)) {
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBetween(node, regions[i - 1], regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+ else if (attr.getName().equals(ICSSImportRule.HREF)) {
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ }
+ else if (attr.getName().equals(ICSSCharsetRule.ENCODING)) {
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else if (attr.getName().equals(ICSSStyleDeclItem.IMPORTANT)) {
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ }
+ else if (attr.getName() == null || attr.getName().length() == 0) {
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else {
+ // counter attributes
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ }
+ }
+ else { // generate source
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ String value = attr.getValue();
+ if (value == null)
+ value = "";//$NON-NLS-1$
+ if (attr.getName().equals(ICSSStyleRule.SELECTOR) || attr.getName().equals(ICSSPageRule.SELECTOR)) {
+ }
+ else if (attr.getName().equals(ICSSImportRule.HREF)) {
+ String uri = org.eclipse.wst.css.core.util.CSSLinkConverter.stripFunc(value);
+ String func = mgr.isPropValueUpperCase() ? "URL(" : "url(";//$NON-NLS-2$//$NON-NLS-1$
+ if (mgr.isQuoteInURI()) {
+ String quote = mgr.getQuoteString(attr.getOwnerDocument().getModel());
+ quote = CSSUtil.detectQuote(uri, quote);
+ value = func + quote + uri + quote + ")";//$NON-NLS-1$
+ }
+ else {
+ value = func + uri + ")";//$NON-NLS-1$
+ }
+ }
+ else if (attr.getName().equals(ICSSCharsetRule.ENCODING)) {
+ String quote = mgr.getQuoteString(attr.getOwnerDocument().getModel());
+ if (!value.startsWith("\"") && !value.startsWith("\'"))//$NON-NLS-2$//$NON-NLS-1$
+ value = quote + value;
+ if (!value.endsWith("\"") && !value.endsWith("\'"))//$NON-NLS-2$//$NON-NLS-1$
+ value = value + quote;
+ }
+ else if (attr.getName().equals(ICSSStyleDeclItem.IMPORTANT)) {
+ if (mgr.isPropValueUpperCase())
+ value = value.toUpperCase();
+ else
+ value = value.toLowerCase();
+ }
+ else if (attr.getName() == null || attr.getName().length() == 0) {
+ if (mgr.isIdentUpperCase())
+ value = value.toUpperCase();
+ else
+ value = value.toLowerCase();
+ }
+ else {
+ if (mgr.isPropValueUpperCase())
+ value = value.toUpperCase();
+ else
+ value = value.toLowerCase();
+ }
+ source.append(value);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ formatPre(node, source);
+ }
+
+ /**
+ *
+ */
+ public synchronized static AttrFormatter getInstance() {
+ if (instance == null) {
+ instance = new AttrFormatter();
+ }
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSFormatUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSFormatUtil.java
new file mode 100644
index 0000000000..1dbdc01d32
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSFormatUtil.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.css.core.adapters.ICSSModelAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleDeclarationAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+
+public class CSSFormatUtil {
+ public List collectCSSNodes(IStructuredModel model, int start, int length) {
+ List nodes = new ArrayList();
+
+ IndexedRegion startNode = model.getIndexedRegion(start);
+ IndexedRegion endNode = model.getIndexedRegion(start + length - 1);
+
+ if (startNode == null || endNode == null) {
+ return nodes;
+ }
+
+ if (model instanceof ICSSModel && startNode instanceof ICSSNode && endNode instanceof ICSSNode) {
+ // CSS model
+ ICSSNode ca = getCommonAncestor((ICSSNode) startNode, (ICSSNode) endNode);
+ if (ca != null) {
+ for (ICSSNode node = ca.getFirstChild(); node != null && start + length < ((IndexedRegion) node).getStartOffset(); node = node.getNextSibling()) {
+ if (start < ((IndexedRegion) node).getEndOffset()) {
+ nodes.add(node);
+ }
+ }
+ }
+ }
+ else if (model instanceof XMLModel && startNode instanceof XMLNode && endNode instanceof XMLNode) {
+ if (startNode instanceof Text) {
+ startNode = (IndexedRegion) ((Text) startNode).getParentNode();
+ }
+ if (endNode instanceof Text) {
+ endNode = (IndexedRegion) ((Text) endNode).getParentNode();
+ }
+ // HTML model, maybe
+ XMLNode ca = (XMLNode) getCommonAncestor((Node) startNode, (Node) endNode);
+ findCSS(nodes, ca);
+ }
+
+ return nodes;
+ }
+
+ /**
+ * getCommonAncestor method
+ *
+ * @return org.w3c.dom.Node
+ * @param node
+ * org.w3c.dom.Node
+ */
+ private Node getCommonAncestor(Node node1, Node node2) {
+ if (node1 == null || node2 == null)
+ return null;
+
+ for (Node na = node2; na != null; na = na.getParentNode()) {
+ for (Node ta = node1; ta != null; ta = ta.getParentNode()) {
+ if (ta == na)
+ return ta;
+ }
+ }
+ return null; // not found
+ }
+
+ private void findCSS(List cssNodes, XMLNode node) {
+ ICSSModelAdapter adapter;
+ adapter = (ICSSModelAdapter) node.getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter != null) {
+ ICSSModel model = adapter.getModel();
+ if (model != null && model.getStyleSheetType() == ICSSModel.EMBEDDED) {
+ cssNodes.add(model.getDocument());
+ }
+ }
+ else {
+ adapter = (ICSSModelAdapter) node.getAdapterFor(IStyleDeclarationAdapter.class);
+ if (adapter != null) {
+ ICSSModel model = adapter.getModel();
+ if (model != null && model.getStyleSheetType() == ICSSModel.INLINE) {
+ cssNodes.add(model.getDocument());
+ }
+ }
+ }
+
+ for (XMLNode child = (XMLNode) node.getFirstChild(); child != null; child = (XMLNode) child.getNextSibling()) {
+ findCSS(cssNodes, child);
+ }
+ }
+
+ private ICSSNode getCommonAncestor(ICSSNode nodeA, ICSSNode nodeB) {
+ if (nodeA == null || nodeB == null) {
+ return null;
+ }
+
+ for (ICSSNode na = nodeA; na != null; na = na.getParentNode()) {
+ for (ICSSNode ta = nodeB; ta != null; ta = ta.getParentNode()) {
+ if (ta == na) {
+ return ta;
+ }
+ }
+ }
+
+ return null; // not found
+ }
+
+ /**
+ */
+ public void replaceSource(IStructuredModel model, int offset, int length, String source) {
+ if (model == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ if (offset >= 0 && length >= 0 && offset + length <= structuredDocument.getLength()) {
+ if (structuredDocument.containsReadOnly(offset, length))
+ return;
+ if (source == null)
+ source = new String();
+ // We use 'structuredDocument' as the requester object just so
+ // this and the other
+ // format-related 'repalceText' (in replaceSource) can use the
+ // same requester.
+ // Otherwise, if requester is not identical,
+ // the undo group gets "broken" into multiple pieces based
+ // on the requesters being different. Technically, any unique,
+ // common
+ // requester object would work.
+ structuredDocument.replaceText(structuredDocument, offset, length, source);
+ }
+ }
+
+ public synchronized static CSSFormatUtil getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSFormatUtil();
+ }
+ return fInstance;
+ }
+
+ private CSSFormatUtil() {
+ super();
+ }
+
+ private static CSSFormatUtil fInstance;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatter.java
new file mode 100644
index 0000000000..a132fe5497
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatter.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.document.ICSSNode;
+
+
+/**
+ *
+ */
+public interface CSSSourceFormatter {
+
+ /**
+ *
+ */
+ StringBuffer cleanup(ICSSNode node);
+
+ /**
+ *
+ * @return java.lang.StringBuffer
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param region
+ * org.eclipse.jface.text.IRegion
+ */
+ StringBuffer cleanup(ICSSNode node, IRegion region);
+
+ /**
+ *
+ */
+ StringBuffer format(ICSSNode node);
+
+ /**
+ *
+ */
+ StringBuffer format(ICSSNode node, IRegion region);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatterFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatterFactory.java
new file mode 100644
index 0000000000..5d5bca8b27
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceFormatterFactory.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.sse.core.INodeNotifier;
+
+
+/**
+ *
+ */
+public class CSSSourceFormatterFactory {
+ /**
+ *
+ */
+ private CSSSourceFormatterFactory() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public CSSSourceGenerator getSourceFormatter(INodeNotifier target) {
+ ICSSNode node = (ICSSNode) target;
+ short type = node.getNodeType();
+ switch (type) {
+ case ICSSNode.CHARSETRULE_NODE :
+ return CharsetRuleFormatter.getInstance();
+ case ICSSNode.FONTFACERULE_NODE :
+ return FontFaceRuleFormatter.getInstance();
+ case ICSSNode.IMPORTRULE_NODE :
+ return ImportRuleFormatter.getInstance();
+ case ICSSNode.MEDIALIST_NODE :
+ return MediaListFormatter.getInstance();
+ case ICSSNode.MEDIARULE_NODE :
+ return MediaRuleFormatter.getInstance();
+ case ICSSNode.PRIMITIVEVALUE_NODE :
+ ICSSPrimitiveValue value = (ICSSPrimitiveValue) node;
+ if (value.getPrimitiveType() == org.w3c.dom.css.CSSPrimitiveValue.CSS_COUNTER)
+ return CounterFormatter.getInstance();
+ else if (value.getPrimitiveType() == org.w3c.dom.css.CSSPrimitiveValue.CSS_RECT)
+ return RectFormatter.getInstance();
+ else if (value.getPrimitiveType() == org.w3c.dom.css.CSSPrimitiveValue.CSS_RGBCOLOR)
+ return RGBFormatter.getInstance();
+ else
+ return PrimitiveValueFormatter.getInstance();
+ case ICSSNode.PAGERULE_NODE :
+ return PageRuleFormatter.getInstance();
+ case ICSSNode.STYLEDECLARATION_NODE :
+ return StyleDeclarationFormatter.getInstance();
+ case ICSSNode.STYLEDECLITEM_NODE :
+ return StyleDeclItemFormatter.getInstance();
+ case ICSSNode.STYLERULE_NODE :
+ return StyleRuleFormatter.getInstance();
+ case ICSSNode.STYLESHEET_NODE :
+ return StyleSheetFormatter.getInstance();
+ case ICSSNode.ATTR_NODE :
+ return AttrFormatter.getInstance();
+ default :
+ return UnknownRuleFormatter.getInstance();
+ }
+ }
+
+ public synchronized static CSSSourceFormatterFactory getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSSourceFormatterFactory();
+ }
+ return fInstance;
+ }
+
+ private static CSSSourceFormatterFactory fInstance;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceGenerator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceGenerator.java
new file mode 100644
index 0000000000..ed8d1246a4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CSSSourceGenerator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+
+
+public interface CSSSourceGenerator extends CSSSourceFormatter {
+
+ /**
+ *
+ */
+ StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext region);
+
+ /**
+ *
+ */
+ StringBuffer formatBefore(ICSSNode node, ICSSNode child, IRegion exceptFor);
+
+ /**
+ *
+ */
+ int getAttrInsertPos(ICSSNode node, String attrName);
+
+ /**
+ *
+ */
+ int getChildInsertPos(ICSSNode node);
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ int getLengthToReformatAfter(ICSSNode node, int insertPos);
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ int getLengthToReformatBefore(ICSSNode node, int insertPos);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CharsetRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CharsetRuleFormatter.java
new file mode 100644
index 0000000000..2d0605d532
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CharsetRuleFormatter.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class CharsetRuleFormatter extends DefaultCSSSourceFormatter {
+
+ public final static java.lang.String CHARSET = "@charset";//$NON-NLS-1$
+ private static CharsetRuleFormatter instance;
+
+ /**
+ *
+ */
+ CharsetRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer buf = new StringBuffer();
+ if (node == null || attr == null)
+ return buf;
+
+ if (!ICSSCharsetRule.ENCODING.equalsIgnoreCase(attr.getName()))
+ return buf;
+
+ // get region to replace
+ if (context != null && ((IndexedRegion) node).getEndOffset() > 0) {
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ RegionIterator it = new RegionIterator(flatNode, region);
+ it.prev();
+ if (it.hasPrev()) {
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S)
+ context.start = it.getStructuredDocumentRegion().getStartOffset(prev);
+ else
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ else
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ if (region.getType() == CSSRegionContexts.CSS_S) {
+ context.start = flatNode.getStartOffset(region);
+ context.end = flatNode.getStartOffset(region);
+ }
+ else {
+ context.start = flatNode.getEndOffset() + 1;
+ context.end = flatNode.getEndOffset();
+ }
+ }
+ }
+ // generate text
+ if (insert) {
+ appendSpaceBefore(node, attr.getValue(), buf);
+ buf.append(attr.getValue());
+ }
+ return buf;
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int end = ((IndexedRegion) node).getEndOffset();
+ if (end > 0) { // format source
+ int start = ((IndexedRegion) node).getStartOffset();
+ formatPre(node, new FormatRegion(start, end - start), source);
+ }
+ else { // generate source
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ String quote = mgr.getQuoteString(node.getOwnerDocument().getModel());
+ String str = CHARSET;
+ if (mgr.isIdentUpperCase())
+ str = CHARSET.toUpperCase();
+ source.append(str);
+ String enc = ((ICSSCharsetRule) node).getEncoding();
+ quote = CSSUtil.detectQuote(enc, quote);
+ str = quote + ((enc != null) ? enc : "") + quote;//$NON-NLS-1$
+ appendSpaceBefore(node, str, source);
+ source.append(str);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ if (!ICSSCharsetRule.ENCODING.equalsIgnoreCase(attrName))
+ return -1;
+
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICSSCharsetRule.ENCODING);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ else {
+ IndexedRegion iNode = (IndexedRegion) node;
+ if (iNode.getEndOffset() <= 0)
+ return -1;
+
+ CompoundRegion regions[] = getRegionsWithoutWhiteSpaces(node.getOwnerDocument().getModel().getStructuredDocument(), new FormatRegion(iNode.getStartOffset(), iNode.getEndOffset() - iNode.getStartOffset()), stgy);
+ for (int i = regions.length - 1; i >= 0; i--) {
+ if (regions[i].getType() != CSSRegionContexts.CSS_COMMENT)
+ return regions[i].getStartOffset();
+ }
+ return iNode.getEndOffset();
+ }
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_DELIMITER)
+ return n - 1;
+ else
+ return n;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ */
+ public synchronized static CharsetRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new CharsetRuleFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CompoundRegion.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CompoundRegion.java
new file mode 100644
index 0000000000..1f75fb543d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CompoundRegion.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+class CompoundRegion {
+
+ CompoundRegion(IStructuredDocumentRegion documentRegion, ITextRegion textRegion) {
+ super();
+ this.fDocumentRegion = documentRegion;
+ this.fTextRegion = textRegion;
+ }
+
+ IStructuredDocumentRegion getDocumentRegion() {
+ return fDocumentRegion;
+ }
+
+ ITextRegion getTextRegion() {
+ return fTextRegion;
+ }
+
+ String getType() {
+ return fTextRegion.getType();
+ }
+
+ String getText() {
+ return fDocumentRegion.getText(fTextRegion);
+ }
+
+ int getStartOffset() {
+ return fDocumentRegion.getStartOffset(fTextRegion);
+ }
+
+ int getEndOffset() {
+ return fDocumentRegion.getEndOffset(fTextRegion);
+ }
+
+
+ private IStructuredDocumentRegion fDocumentRegion;
+ private ITextRegion fTextRegion;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CounterFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CounterFormatter.java
new file mode 100644
index 0000000000..acb7749fac
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/CounterFormatter.java
@@ -0,0 +1,316 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICounter;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class CounterFormatter extends DefaultCSSSourceFormatter {
+
+ private static CounterFormatter instance;
+
+ /**
+ *
+ */
+ CounterFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer source = new StringBuffer();
+ if (node == null || attr == null)
+ return source;
+
+ if (!ICounter.IDENTIFIER.equalsIgnoreCase(attr.getName()) && !ICounter.LISTSTYLE.equalsIgnoreCase(attr.getName()) && !ICounter.SEPARATOR.equalsIgnoreCase(attr.getName()))
+ return source;
+
+ // get region to replace
+ IndexedRegion iNode = (IndexedRegion) node;
+ context.start = iNode.getStartOffset();
+ context.end = iNode.getEndOffset();
+
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+
+ ICounter counter = (ICounter) node;
+ String quote = mgr.getQuoteString(node.getOwnerDocument().getModel());
+ String sep = counter.getSeparator();
+ String ident = counter.getIdentifier();
+ String style = counter.getListStyle();
+
+ if (ICounter.IDENTIFIER.equalsIgnoreCase(attr.getName())) {
+ if (insert)
+ ident = attr.getValue();
+ else
+ ident = "";//$NON-NLS-1$
+ }
+ else if (ICounter.LISTSTYLE.equalsIgnoreCase(attr.getName())) {
+ if (insert)
+ style = attr.getValue();
+ else
+ style = null;
+ }
+ else if (ICounter.SEPARATOR.equalsIgnoreCase(attr.getName())) {
+ if (insert)
+ sep = attr.getValue();
+ else
+ sep = null;
+ }
+
+ quote = CSSUtil.detectQuote(sep, quote);
+ sep = (sep == null || sep.length() == 0) ? null : (quote + sep + quote);
+
+ String func = (sep == null || sep.length() == 0) ? "counter(" : "counters(";//$NON-NLS-2$//$NON-NLS-1$
+ if (mgr.isPropValueUpperCase()) {
+ ident = ident.toUpperCase();
+ style = style.toUpperCase();
+ func = func.toUpperCase();
+ }
+ else {
+ ident = ident.toLowerCase();
+ style = style.toLowerCase();
+ }
+ if (sep == null || sep.length() == 0) {
+ source.append(func);
+ appendSpaceBefore(node, ident, source);
+ source.append(ident);
+ }
+ else {
+ source.append(func);
+ appendSpaceBefore(node, ident, source);
+ source.append(ident);
+ source.append(",");//$NON-NLS-1$
+ appendSpaceBefore(node, sep, source);
+ source.append(sep);
+ }
+
+ if (style != null && style.length() != 0) {
+ source.append(",");//$NON-NLS-1$
+ appendSpaceBefore(node, style, source);
+ }
+ source.append(")");//$NON-NLS-1$
+
+ /*
+ * IStructuredDocument structuredDocument =
+ * node.getOwnerDocument().getModel().getStructuredDocument();
+ * ITextRegion[] regions =
+ * getRegionsWithoutWhiteSpaces(structuredDocument, new
+ * FormatRegion(context.start, context.end - context.start + 1)); int
+ * commas[2]; int numComma = 0; for(int j = 0; j <regions.length; j++) {
+ * if (regions[j].getType() == CSSRegionContexts.COMMA) {
+ * commas[numComma++] = j; if (numComma > 1) break; } }
+ *
+ * if (ICounter.IDENTIFIER.equalsIgnoreCase(attr.getName())) { } else
+ * if (ICounter.LISTSTYLE.equalsIgnoreCase(attr.getName())) { } else
+ * if (ICounter.SEPARATOR.equalsIgnoreCase(attr.getName())) { boolean
+ * skipSpace = false; String func = insert ? "counters(" : "counter(";
+ * if (mgr.isPropValueUpperCase()) func = func.toUpperCase();
+ *
+ * for(int i=0; i <regions.length; i++) { if (regions[i].getType() ==
+ * CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ * source.append(func); else { if (numComma == 2 && commas[1] < i) {
+ * } else if (numComma == 1 && commas[0] < i && insert) {
+ * } else if (numComma == 1 && commas[0] < i && ! insert) { } else if
+ * (numComma == 0 && insert && regions[i].getType ==
+ * CSSRegionContexts.PARENTHESIS_CLOSE) { source.append(",");
+ * appendSpaceBefore(node,attr.getValue(),source);
+ * source.append(attr.getValue()); }
+ *
+ * if (i != 0 && !skipSpace)
+ * appendSpaceBefore(node,regions[i],source);
+ * source.append(decoratedPropValueRegion(regions[i])); } skipSpace =
+ * false;
+ *
+ * if (regions[i].getType() ==
+ * CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) skipSpace = true; } }
+ */
+ return source;
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = ((IndexedRegion) node).getEndOffset();
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ if (end > 0) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ boolean skipSpace = false;
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 && !skipSpace)
+ appendSpaceBefore(node, regions[i], source);
+ skipSpace = false;
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ if (regions[i].getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ skipSpace = true;
+ }
+ }
+ else { // generate source
+ ICounter counter = (ICounter) node;
+ String quote = mgr.getQuoteString(node.getOwnerDocument().getModel());
+ String separator = counter.getSeparator();
+ quote = CSSUtil.detectQuote(separator, quote);
+ String sep = (separator == null || separator.length() == 0) ? null : (quote + separator + quote);
+ String ident = counter.getIdentifier();
+ String style = counter.getListStyle();
+ String func = (sep == null || sep.length() == 0) ? "counter(" : "counters(";//$NON-NLS-2$//$NON-NLS-1$
+ // normalize
+ if (ident == null)
+ ident = "";//$NON-NLS-1$
+ if (style == null)
+ style = "";//$NON-NLS-1$
+
+ if (mgr.isPropValueUpperCase()) {
+ ident = ident.toUpperCase();
+ style = style.toUpperCase();
+ func = func.toUpperCase();
+ }
+ else {
+ ident = ident.toLowerCase();
+ style = style.toLowerCase();
+ }
+ if (sep == null || sep.length() == 0) {
+ source.append(func);
+ appendSpaceBefore(node, ident, source);
+ source.append(ident);
+ }
+ else {
+ source.append(func);
+ appendSpaceBefore(node, ident, source);
+ source.append(ident);
+ source.append(",");//$NON-NLS-1$
+ appendSpaceBefore(node, sep, source);
+ source.append(sep);
+ }
+
+ if (style != null && style.length() != 0) {
+ source.append(",");//$NON-NLS-1$
+ appendSpaceBefore(node, style, source);
+ }
+ source.append(")");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+
+ IndexedRegion iNode = (IndexedRegion) node;
+ if (ICounter.IDENTIFIER.equalsIgnoreCase(attrName)) {
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICounter.IDENTIFIER);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ if (iNode.getEndOffset() <= 0)
+ return -1;
+
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(iNode.getEndOffset() - 1);
+ RegionIterator it = new RegionIterator(flatNode, flatNode.getRegionAtCharacterOffset(iNode.getEndOffset() - 1));
+ while (it.hasPrev()) {
+ ITextRegion region = it.prev();
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ return it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ return ((IndexedRegion) node).getEndOffset();
+ }
+ else if (ICounter.LISTSTYLE.equalsIgnoreCase(attrName)) {
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICounter.LISTSTYLE);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(iNode.getEndOffset() - 1);
+ RegionIterator it = new RegionIterator(flatNode, flatNode.getRegionAtCharacterOffset(iNode.getEndOffset() - 1));
+ while (it.hasPrev()) {
+ ITextRegion region = it.prev();
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR)
+ return it.getStructuredDocumentRegion().getEndOffset(region);
+ else if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ return it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ return ((IndexedRegion) node).getEndOffset();
+ }
+ else if (ICounter.SEPARATOR.equalsIgnoreCase(attrName)) {
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICounter.SEPARATOR);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(iNode.getEndOffset() - 1);
+ RegionIterator it = new RegionIterator(flatNode, flatNode.getRegionAtCharacterOffset(iNode.getEndOffset() - 1));
+ boolean hasComma = false;
+ while (it.hasPrev()) {
+ ITextRegion region = it.prev();
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR) {
+ if (!hasComma)
+ hasComma = true;
+ else
+ return it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ return it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ return ((IndexedRegion) node).getEndOffset();
+ }
+ else
+ return -1;
+ }
+
+ /**
+ *
+ */
+ public synchronized static CounterFormatter getInstance() {
+ if (instance == null)
+ instance = new CounterFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DeclContainerFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DeclContainerFormatter.java
new file mode 100644
index 0000000000..8ce53613b3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DeclContainerFormatter.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+/**
+ *
+ */
+public class DeclContainerFormatter extends DefaultCSSSourceFormatter {
+
+ /**
+ *
+ */
+ DeclContainerFormatter() {
+ super();
+ }
+
+ /**
+ *
+ * @return java.lang.String
+ * @param region
+ * com.ibm.sed.structuredDocument.ITextRegion
+ * @param prevRegion
+ * com.ibm.sed.structuredDocument.ITextRegion
+ */
+ protected String decoratedSelectorRegion(CompoundRegion region, CompoundRegion prevRegion, CSSCleanupStrategy stgy) {
+ String text = region.getText();
+ if (isFormat())
+ return text;
+
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE || type == CSSRegionContexts.CSS_SELECTOR_CLASS || type == CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME || type == CSSRegionContexts.CSS_SELECTOR_ID || type == CSSRegionContexts.CSS_SELECTOR_PSEUDO) {
+ short selCase = stgy.getSelectorTagCase();
+ if (selCase == org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy.UPPER) {
+ return text.toUpperCase();
+ }
+ else if (selCase == org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy.LOWER) {
+ return text.toLowerCase();
+ }
+ return text;
+ }
+
+ return decoratedRegion(region, 0, stgy);
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int end = ((IndexedRegion) node).getEndOffset();
+ int start = (node.getLastChild() != null && ((IndexedRegion) node.getLastChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getLastChild()).getEndOffset() : getChildInsertPos(node);
+ if (end > 0 && start < end) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+ else { // generate source
+ String delim = getLineDelimiter(node);
+ source.append(delim);
+ source.append(getIndent(node));
+ source.append("}");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_RBRACE)
+ return n - 1;
+ else
+ return n;
+ }
+ return -1;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DefaultCSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DefaultCSSSourceFormatter.java
new file mode 100644
index 0000000000..fc7f0dbe85
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/DefaultCSSSourceFormatter.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.IndexedRegion;
+
+
+/**
+ *
+ */
+public class DefaultCSSSourceFormatter extends AbstractCSSSourceFormatter {
+
+ /**
+ *
+ */
+ DefaultCSSSourceFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void appendSpaceBetween(ICSSNode node, CompoundRegion prev, CompoundRegion next, StringBuffer source) {
+ if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
+ return; // for not formatting case on cleanup action
+
+ // in selector
+ String prevType = prev.getType();
+ String nextType = next.getType();
+ if (CSSRegionUtil.isSelectorBegginingType(prevType) && CSSRegionUtil.isSelectorBegginingType(nextType)) {
+ appendSpaceBefore(node, next, source);
+ return;
+ }
+
+ if (prevType == CSSRegionContexts.CSS_PAGE || prevType == CSSRegionContexts.CSS_CHARSET || prevType == CSSRegionContexts.CSS_ATKEYWORD || prevType == CSSRegionContexts.CSS_FONT_FACE || prevType == CSSRegionContexts.CSS_IMPORT || prevType == CSSRegionContexts.CSS_MEDIA) {
+ appendSpaceBefore(node, next, source);
+ return;
+ }
+
+ if (prevType == CSSRegionContexts.CSS_UNKNOWN && nextType != CSSRegionContexts.CSS_COMMENT) {
+ if (prev.getEndOffset() != next.getStartOffset()) { // not
+ // sequential
+ appendSpaceBefore(node, next, source);
+ }
+ return;
+ }
+
+ if (prevType == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR || prevType == CSSRegionContexts.CSS_COMMENT || nextType == CSSRegionContexts.CSS_COMMENT || nextType == CSSRegionContexts.CSS_LBRACE || nextType == CSSRegionContexts.CSS_UNKNOWN) {
+ appendSpaceBefore(node, next, source);
+ return;
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, StringBuffer source) {
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0)
+ return n;
+ return -1;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FontFaceRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FontFaceRuleFormatter.java
new file mode 100644
index 0000000000..66eec7d7f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FontFaceRuleFormatter.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+
+
+/**
+ *
+ */
+public class FontFaceRuleFormatter extends DeclContainerFormatter {
+
+ public final static java.lang.String FONT_FACE = "@font-face";//$NON-NLS-1$
+ private static FontFaceRuleFormatter instance;
+
+ /**
+ *
+ */
+ FontFaceRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(org.eclipse.wst.css.core.document.ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ if (end > 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else {
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ String str = FONT_FACE;
+ if (mgr.isIdentUpperCase())
+ str = FONT_FACE.toUpperCase();
+ source.append(str);
+ appendSpaceBefore(node, "{", source);//$NON-NLS-1$
+ source.append("{");//$NON-NLS-1$
+ }
+ appendDelimBefore(node, null, source);
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ if (needS(outside[1])) {
+ if (isIncludesPreEnd(node, region))
+ appendDelimBefore(node, null, source);
+ else
+ appendSpaceBefore(node, outside[1], source);
+ }
+ }
+
+ /**
+ *
+ */
+ public synchronized static FontFaceRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new FontFaceRuleFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FormatRegion.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FormatRegion.java
new file mode 100644
index 0000000000..ff0c9d322a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FormatRegion.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+
+/**
+ *
+ */
+class FormatRegion implements IRegion {
+
+ private int fOffset, fLength;
+
+ /**
+ *
+ */
+ FormatRegion(int offset, int length) {
+ super();
+ set(offset, length);
+ }
+
+ /**
+ * Returns the length of the region.
+ *
+ * @return the length of the region
+ */
+ public int getLength() {
+ return fLength;
+ }
+
+ /**
+ * Returns the offset of the region.
+ *
+ * @return the offset of the region
+ */
+ public int getOffset() {
+ return fOffset;
+ }
+
+ /**
+ *
+ */
+ void set(int offset, int length) {
+ this.fOffset = offset;
+ this.fLength = length;
+ }
+
+ /**
+ *
+ */
+ void setLength(int newLength) {
+ fLength = newLength;
+ }
+
+ /**
+ *
+ */
+ void setOffset(int newOffset) {
+ fOffset = newOffset;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FunctionFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FunctionFormatter.java
new file mode 100644
index 0000000000..91711d3890
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/FunctionFormatter.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+
+/**
+ *
+ */
+abstract public class FunctionFormatter extends AbstractCSSSourceFormatter {
+
+ /**
+ *
+ */
+ FunctionFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ ICSSNode prev = (child != null) ? child.getPreviousSibling() : node.getLastChild();
+ int start = (prev != null) ? ((IndexedRegion) prev).getEndOffset() : 0;
+ int end = (child != null) ? ((IndexedRegion) child).getStartOffset() : 0;
+ if (start > 0 && start < end) { // format source
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ // get meaning regions
+ CompoundRegion[] regions = null;
+ if (exceptFor == null)
+ regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ else {
+ String pickupType = CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR;
+ if (prev == null || child == null)
+ pickupType = null;
+ regions = getRegions(structuredDocument, new FormatRegion(start, end - start), exceptFor, pickupType);
+ }
+ // extract source
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 2, stgy));
+ }
+ }
+ else if (prev != null && child != null) { // generate source between
+ // parameters
+ source.append(",");//$NON-NLS-1$
+ }
+ appendSpaceBefore(node, toAppend, source);
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 2, stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(org.eclipse.wst.css.core.document.ICSSNode node, java.lang.StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int end = ((IndexedRegion) node).getEndOffset();
+ int start = (node.getLastChild() != null && ((IndexedRegion) node.getLastChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getLastChild()).getEndOffset() : getChildInsertPos(node);
+ if (end > 0 && start < end) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 2, stgy));
+ }
+ }
+ else { // generate source
+ source.append(")");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 2, stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (end > 0) { // format source
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ }
+ else { // generate source
+ String func = getFunc();
+ if (mgr.isPropValueUpperCase())
+ func = func.toUpperCase();
+ source.append(func);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ return n - 1;
+ else
+ return n;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ */
+ protected abstract String getFunc();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/ImportRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/ImportRuleFormatter.java
new file mode 100644
index 0000000000..afc1419da1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/ImportRuleFormatter.java
@@ -0,0 +1,345 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class ImportRuleFormatter extends AbstractCSSSourceFormatter {
+
+ public final static java.lang.String IMPORT = "@import";//$NON-NLS-1$
+ private static ImportRuleFormatter instance;
+
+ /**
+ *
+ */
+ ImportRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer buf = new StringBuffer();
+ if (node == null || attr == null)
+ return buf;
+
+ if (!ICSSImportRule.HREF.equalsIgnoreCase(attr.getName()))
+ return buf;
+
+ // get region to replace
+ if (context != null && ((IndexedRegion) node).getEndOffset() > 0) {
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ RegionIterator it = new RegionIterator(flatNode, region);
+ it.prev();
+ if (it.hasPrev()) {
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S)
+ context.start = it.getStructuredDocumentRegion().getStartOffset(prev);
+ else
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ it.next();
+ }
+ else
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ it.next();
+ it.next();
+ if (it.hasNext()) {
+ ITextRegion next = it.next();
+ if (next.getType() == CSSRegionContexts.CSS_S)
+ context.end = it.getStructuredDocumentRegion().getEndOffset(next);
+ else
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else {
+ ICSSNode child = node.getFirstChild();
+ IStructuredDocumentRegion flatNode = null;
+ ITextRegion region = null;
+ if (child == null) {
+ flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ }
+ else {
+ flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) child).getStartOffset() - 1);
+ region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) child).getStartOffset() - 1);
+ }
+ if (region.getType() == CSSRegionContexts.CSS_S) {
+ context.start = flatNode.getStartOffset(region);
+ context.end = flatNode.getEndOffset(region);
+ }
+ else {
+ context.start = flatNode.getEndOffset();
+ context.end = flatNode.getEndOffset();
+ }
+ }
+ }
+ // generate text
+ if (insert && attr.getValue() != null && attr.getValue().length() > 0) {
+ appendSpaceBefore(node, attr.getValue(), buf);
+ buf.append(attr.getValue());
+ appendSpaceBefore(node, "", buf);//$NON-NLS-1$
+ }
+ return buf;
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ // for media-type
+ ICSSNode prev = (child != null) ? child.getPreviousSibling() : node.getLastChild();
+ int start = (prev != null) ? ((IndexedRegion) prev).getEndOffset() : 0;
+ int end = (child != null) ? ((IndexedRegion) child).getStartOffset() : 0;
+ if (start > 0 && start < end) { // format source
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ // get meaning regions
+ CompoundRegion[] regions = null;
+ if (exceptFor == null)
+ regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ else {
+ String pickupType = CSSRegionContexts.CSS_MEDIA_SEPARATOR;
+ if (prev == null || child == null)
+ pickupType = null;
+ regions = getRegions(structuredDocument, new FormatRegion(start, end - start), exceptFor, pickupType);
+ }
+ // extract source
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ appendSpaceBefore(node, toAppend, source);
+ }
+ else if (prev != null && child != null) { // generate source : ????
+ source.append(",");//$NON-NLS-1$
+ appendSpaceBefore(node, toAppend, source);
+ }
+ else if (child != null) { // generate source : between 'url()' and
+ // media types
+ appendSpaceBefore(node, toAppend, source);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must be
+ // comments
+ }
+ if (needS(outside[1])) {
+ if (((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength())
+ appendSpaceBefore(node, toAppend, source);
+ else
+ appendSpaceBefore(node, outside[1], source);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int end = ((IndexedRegion) node).getEndOffset();
+ int start = (node.getLastChild() != null && ((IndexedRegion) node.getLastChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getLastChild()).getEndOffset() : getChildInsertPos(node);
+ if (end > 0 && start < end) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (end > 0) { // format source
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ String str = regions[i].getText();
+ if (regions[i].getType() == CSSRegionContexts.CSS_IMPORT)
+ str = decoratedIdentRegion(regions[i], stgy);
+ else
+ str = decoratedPropValueRegion(regions[i], stgy);
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(str);
+ }
+ }
+ else { // generate source
+ String str = IMPORT;
+ if (mgr.isIdentUpperCase())
+ str = IMPORT.toUpperCase();
+ String quote = mgr.getQuoteString(node.getOwnerDocument().getModel());
+ source.append(str);
+ str = "url(";//$NON-NLS-1$
+ if (mgr.isPropValueUpperCase())
+ str = str.toUpperCase();
+ String href = ((ICSSImportRule) node).getHref();
+ quote = CSSUtil.detectQuote(href, quote);
+ str = str + quote + href + quote + ")";//$NON-NLS-1$
+ appendSpaceBefore(node, str, source);
+ source.append(str);
+ }
+ ICSSNode child = node.getFirstChild();
+ if (child != null && (child instanceof org.w3c.dom.stylesheets.MediaList) && ((org.w3c.dom.stylesheets.MediaList) child).getLength() > 0) {
+ appendSpaceBefore(node, "", source);//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ String str = regions[i].getText();
+ if (regions[i].getType() == CSSRegionContexts.CSS_IMPORT)
+ str = decoratedIdentRegion(regions[i], stgy);
+ else
+ str = decoratedPropValueRegion(regions[i], stgy);
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(str);
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+
+ if (!ICSSImportRule.HREF.equalsIgnoreCase(attrName))
+ return -1;
+
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICSSImportRule.HREF);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ else {
+ IndexedRegion iNode = (IndexedRegion) node;
+ if (iNode.getEndOffset() <= 0)
+ return -1;
+
+ FormatRegion formatRegion = null;
+ ICSSNode child = node.getFirstChild();
+ if (child != null && ((IndexedRegion) child).getEndOffset() > 0)
+ formatRegion = new FormatRegion(iNode.getStartOffset(), ((IndexedRegion) child).getStartOffset() - iNode.getStartOffset());
+ else
+ formatRegion = new FormatRegion(iNode.getStartOffset(), iNode.getEndOffset() - iNode.getStartOffset());
+ CompoundRegion regions[] = getRegionsWithoutWhiteSpaces(node.getOwnerDocument().getModel().getStructuredDocument(), formatRegion, getCleanupStrategy(node));
+
+ boolean atrule = false;
+ for (int i = 0; i < regions.length; i++) {
+ if (regions[i].getType() == CSSRegionContexts.CSS_IMPORT) {
+ atrule = true;
+ continue;
+ }
+ else if (!atrule)
+ continue;
+ if (regions[i].getType() != CSSRegionContexts.CSS_COMMENT)
+ return regions[i].getStartOffset();
+ }
+ return (child != null && ((IndexedRegion) child).getEndOffset() > 0) ? ((IndexedRegion) child).getStartOffset() : iNode.getEndOffset();
+ }
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_DELIMITER)
+ return n - 1;
+ else
+ return n;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ */
+ public synchronized static ImportRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new ImportRuleFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaListFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaListFormatter.java
new file mode 100644
index 0000000000..4a8ef605aa
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaListFormatter.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ *
+ */
+public class MediaListFormatter extends DefaultCSSSourceFormatter {
+
+ private static MediaListFormatter instance;
+
+ /**
+ *
+ */
+ MediaListFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer buf = new StringBuffer();
+ if (node == null || attr == null)
+ return buf;
+
+ boolean first = false, last = false;
+ // get region to replace
+ if (context != null && ((IndexedRegion) node).getEndOffset() > 0) {
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ RegionIterator it = new RegionIterator(flatNode, region);
+ it.prev();
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ while (it.hasPrev()) {
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S || prev.getType() == CSSRegionContexts.CSS_MEDIA_SEPARATOR || prev.getType() == CSSRegionContexts.CSS_COMMENT)
+ context.start = it.getStructuredDocumentRegion().getStartOffset(prev);
+ else
+ break;
+ }
+ if (context.start < ((IndexedRegion) node).getStartOffset()) {
+ context.start = ((IndexedRegion) node).getStartOffset();
+ first = true;
+
+ }
+ it.reset(flatNode, region);
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ while (it.hasNext()) {
+ ITextRegion next = it.next();
+ if (next.getType() == CSSRegionContexts.CSS_S || next.getType() == CSSRegionContexts.CSS_MEDIA_SEPARATOR || next.getType() == CSSRegionContexts.CSS_COMMENT)
+ context.end = it.getStructuredDocumentRegion().getEndOffset(next);
+ else
+ break;
+ }
+ if (((IndexedRegion) node).getEndOffset() < context.end) {
+ context.end = ((IndexedRegion) node).getEndOffset();
+ last = true;
+ }
+ }
+ else {
+ last = true;
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ RegionIterator it = new RegionIterator(flatNode, region);
+ context.start = it.getStructuredDocumentRegion().getEndOffset(region);
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ while (it.hasPrev()) {
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S || prev.getType() == CSSRegionContexts.CSS_MEDIA_SEPARATOR || prev.getType() == CSSRegionContexts.CSS_COMMENT)
+ context.start = it.getStructuredDocumentRegion().getStartOffset(prev);
+ else
+ break;
+ }
+ if (context.start < ((IndexedRegion) node).getStartOffset()) {
+ context.start = ((IndexedRegion) node).getStartOffset();
+ first = true;
+ }
+ }
+ }
+ // generate text
+ if (insert && attr.getValue() != null && attr.getValue().length() > 0) {
+ if (!first)
+ buf.append(","); //$NON-NLS-1$
+ appendSpaceBefore(node, attr.getValue(), buf);
+ buf.append(attr.getValue());
+ if (!last) {
+ buf.append(","); //$NON-NLS-1$
+ appendSpaceBefore(node, "", buf); //$NON-NLS-1$
+ }
+ }
+ else if (!first && !last) {
+ buf.append(","); //$NON-NLS-1$
+ appendSpaceBefore(node, "", buf); //$NON-NLS-1$
+ }
+ return buf;
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = ((IndexedRegion) node).getEndOffset();
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (end > 0) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else { // generate source
+ MediaList list = (MediaList) node;
+ int n = list.getLength();
+ for (int i = 0; i < n; i++) {
+ String medium = list.item(i);
+ if (mgr.isIdentUpperCase())
+ medium = medium.toUpperCase();
+ else
+ medium = medium.toLowerCase();
+
+ if (i != 0) {
+ source.append(","); //$NON-NLS-1$
+ appendSpaceBefore(node, medium, source);
+ }
+ source.append(medium);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(attrName);
+
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ else {
+ IndexedRegion iNode = (IndexedRegion) node;
+ if (iNode.getEndOffset() <= 0)
+ return -1;
+
+ /*
+ * ITextRegion regions[] =
+ * getRegionsWithoutWhiteSpaces(node.getOwnerDocument().getModel().getStructuredDocument(),
+ * new FormatRegion(iNode.getStartOffset(), iNode.getEndOffset() -
+ * iNode.getStartOffset() + 1)); for(int i=regions.length - 1; i >=
+ * 0; i--) { if (regions[i].getType() ==
+ * CSSRegionContexts.IMPORTANT_SYM) return
+ * regions[i].getStartOffset(); }
+ */
+ return iNode.getEndOffset();
+ }
+ }
+
+ /**
+ *
+ */
+ public synchronized static MediaListFormatter getInstance() {
+ if (instance == null)
+ instance = new MediaListFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaRuleFormatter.java
new file mode 100644
index 0000000000..c46afcea08
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/MediaRuleFormatter.java
@@ -0,0 +1,394 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class MediaRuleFormatter extends AbstractCSSSourceFormatter {
+
+ public final static java.lang.String MEDIA = "@media";//$NON-NLS-1$
+ private static MediaRuleFormatter instance;
+
+ /**
+ *
+ */
+ MediaRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ ICSSNode prev = (child != null) ? child.getPreviousSibling() : node.getLastChild();
+ int start = (prev != null) ? ((IndexedRegion) prev).getEndOffset() : 0;
+ int end = (child != null) ? ((IndexedRegion) child).getStartOffset() : 0;
+ if (start > 0 && start < end) { // source formatting
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ // get meaning regions
+ CompoundRegion[] regions = null;
+ if (exceptFor == null)
+ regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ else {
+ String pickupType = null;
+ if ((prev != null && prev.getNodeType() == ICSSNode.MEDIALIST_NODE) || (prev == null && (child == null || child.getNodeType() != ICSSNode.MEDIALIST_NODE))) {
+ pickupType = CSSRegionContexts.CSS_LBRACE;
+ }
+ regions = getRegions(structuredDocument, new FormatRegion(start, end - start), exceptFor, pickupType);
+ }
+ // extract source
+ if (child != null && child.getNodeType() == ICSSNode.MEDIALIST_NODE) { // between
+ // "@media"
+ // and
+ // mediatype
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ appendSpaceBefore(node, toAppend, source);
+ }
+ else if (child != null && (child.getPreviousSibling() == null || child.getPreviousSibling().getNodeType() == ICSSNode.MEDIALIST_NODE)) { // between
+ // mediatype
+ // and
+ // the
+ // first
+ // style
+ // rule
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ appendDelimBefore(node, null, source);
+ }
+ else { // between styles
+ for (int i = 0; i < regions.length; i++) {
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ appendDelimBefore(node, null, source);
+ }
+ }
+ else { // source generation
+ if (child == null && prev != null && prev.getNodeType() != ICSSNode.MEDIALIST_NODE) { // after
+ // the
+ // last
+ // style
+ // rule
+ appendDelimBefore(node.getParentNode(), null, source);
+ }
+ else if (child != null && child.getNodeType() == ICSSNode.MEDIALIST_NODE) { // between
+ // "@media"
+ // and
+ // mediatype
+ appendSpaceBefore(node, toAppend, source);
+ }
+ else if (prev != null && prev.getNodeType() == ICSSNode.MEDIALIST_NODE) { // between
+ // mediatype
+ // and
+ // the
+ // first
+ // style
+ // rule
+ appendSpaceBefore(node, "{", source);//$NON-NLS-1$
+ source.append("{");//$NON-NLS-1$
+ if (child != null)
+ appendDelimBefore(node, null, source);
+ else
+ appendDelimBefore(node.getParentNode(), null, source);
+ }
+ else { // normal case
+ appendDelimBefore(node, null, source);
+ }
+ }
+
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ if (child != null && child.getNodeType() == ICSSNode.MEDIALIST_NODE) { // between
+ // "@media"
+ // and
+ // mediatype
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ if (needS(outside[1]) && ((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength()) {
+ appendSpaceBefore(node, toAppend, source);
+ }
+ }
+ else if (child != null && (child.getPreviousSibling() == null || child.getPreviousSibling().getNodeType() == ICSSNode.MEDIALIST_NODE)) { // between
+ // mediatype
+ // and
+ // the
+ // first
+ // style
+ // rule
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ if (needS(outside[1]) && ((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength()) {
+ appendDelimBefore(node, null, source);
+ }
+ }
+ else { // between styles
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ if (needS(outside[1]) && ((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength()) {
+ appendDelimBefore(node, null, source);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, StringBuffer source) {
+ int end = ((IndexedRegion) node).getEndOffset();
+ int start = (node.getLastChild() != null && ((IndexedRegion) node.getLastChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getLastChild()).getEndOffset() : getChildInsertPos(node);
+ if (end > 0 && start < end) { // source formatting
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ if (node.getLastChild() == null || node.getLastChild().getNodeType() != ICSSNode.MEDIALIST_NODE) {
+ for (int i = 0; i < regions.length; i++) {
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+ else {
+ boolean bInCurlyBrace = false;
+ for (int i = 0; i < regions.length; i++) {
+ if (!bInCurlyBrace)
+ appendSpaceBefore(node, regions[i], source);
+ else
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ if (regions[i].getType() == CSSRegionContexts.CSS_LBRACE)
+ bInCurlyBrace = true;
+ }
+ }
+ }
+ else { // source generation
+ String delim = getLineDelimiter(node);
+ if (node.getLastChild() != null && node.getLastChild().getNodeType() == ICSSNode.MEDIALIST_NODE) {
+ appendSpaceBefore(node, "{", source);//$NON-NLS-1$
+ source.append("{");//$NON-NLS-1$
+ }
+
+ source.append(delim);
+ source.append(getIndent(node));
+ source.append("}");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (end > 0) { // source formatting
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else { // source generation
+ String str = MEDIA;
+ if (mgr.isIdentUpperCase())
+ str = MEDIA.toUpperCase();
+ source.append(str);
+ }
+ ICSSNode child = node.getFirstChild();
+ if (child != null && (child instanceof org.w3c.dom.stylesheets.MediaList) && ((org.w3c.dom.stylesheets.MediaList) child).getLength() > 0) {
+ appendSpaceBefore(node, "", source);//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ if (flatNode.getRegionAtCharacterOffset(n - 1).getType() == CSSRegionContexts.CSS_LBRACE)
+ return n - 1;
+ else
+ return n;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ */
+ public synchronized static MediaRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new MediaRuleFormatter();
+ return instance;
+ }
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ public int getLengthToReformatAfter(ICSSNode node, int insertPos) {
+ if (node == null)
+ return 0;
+ IndexedRegion nnode = (IndexedRegion) node;
+ if (insertPos <= 0 || !nnode.contains(insertPos - 1))
+ return 0;
+
+ if (node.getFirstChild().getNextSibling() == node.getLastChild()) { // inserted
+ // first
+ // style
+ // rule
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(insertPos);
+ if (flatNode == null)
+ return 0;
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(insertPos);
+ if (region == null)
+ return 0;
+ RegionIterator it = new RegionIterator(flatNode, region);
+ while (it.hasNext()) {
+ region = it.next();
+ if (region.getType() == CSSRegionContexts.CSS_LBRACE)
+ break;
+ if (nnode.getEndOffset() <= it.getStructuredDocumentRegion().getEndOffset(region))
+ break;
+ }
+ int pos = it.getStructuredDocumentRegion().getStartOffset(region) - insertPos;
+ return (pos >= 0) ? pos : 0;
+
+ }
+ return super.getLengthToReformatAfter(node, insertPos);
+ }
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ public int getLengthToReformatBefore(ICSSNode node, int insertPos) {
+ if (node == null)
+ return 0;
+ IndexedRegion nnode = (IndexedRegion) node;
+ if (insertPos <= 0 || !nnode.contains(insertPos - 1))
+ return 0;
+
+ if (node.getFirstChild().getNextSibling() == node.getLastChild()) { // inserted
+ // first
+ // style
+ // rule
+ int pos = ((IndexedRegion) node.getFirstChild()).getEndOffset();
+ if (pos <= 0)
+ pos = ((IndexedRegion) node).getStartOffset() + 6 /*
+ * length
+ * of
+ * "@media"
+ */;
+ return insertPos - pos;
+ }
+ return super.getLengthToReformatBefore(node, insertPos);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PageRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PageRuleFormatter.java
new file mode 100644
index 0000000000..8d199dbaa9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PageRuleFormatter.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class PageRuleFormatter extends DeclContainerFormatter {
+
+ public final static java.lang.String PAGE = "@page";//$NON-NLS-1$
+ private static PageRuleFormatter instance;
+
+ /**
+ *
+ */
+ PageRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer buf = new StringBuffer();
+ if (node == null || attr == null)
+ return buf;
+
+ if (!ICSSPageRule.SELECTOR.equalsIgnoreCase(attr.getName()))
+ return buf;
+
+ // get region to replace
+ if (context != null && ((IndexedRegion) node).getEndOffset() > 0) {
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) attr).getEndOffset() - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) attr).getEndOffset() - 1);
+ RegionIterator it = new RegionIterator(flatNode, region);
+ it.next();
+ if (it.hasNext()) {
+ ITextRegion next = it.next();
+ if (next.getType() == CSSRegionContexts.CSS_S)
+ context.end = it.getStructuredDocumentRegion().getEndOffset(next);
+ else
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ else {
+ int pos = getAttrInsertPos(node, attr.getName());
+ context.start = pos;
+ context.end = pos;
+ /*
+ * IStructuredDocumentRegion flatNode =
+ * node.getOwnerDocument().getModel().getStructuredDocument().getNodeAtCharacterOffset(((IndexedRegion)node).getStartOffset());
+ * ITextRegion region =
+ * flatNode.getRegionAtCharacterOffset(((IndexedRegion)node).getStartOffset());
+ * if (region.getType() == CSSRegionContexts.S) {
+ * context.start = region.getStartOffset(); context.end =
+ * region.getEndOffset(); } else { context.start =
+ * flatNode.getEndOffset() + 1; context.end =
+ * flatNode.getEndOffset(); }
+ */}
+ }
+ // generate text
+ if (insert) {
+ String val = attr.getValue();
+ if (val != null && val.length() > 0) {
+ buf.append(val);
+ appendSpaceBefore(node, "", buf);//$NON-NLS-1$
+ }
+ }
+ return buf;
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (end > 0) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBetween(node, regions[i - 1], regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else { // generate source
+ String str = PAGE;
+ if (mgr.isIdentUpperCase())
+ str = PAGE.toUpperCase();
+ source.append(str);
+ str = ((ICSSPageRule) node).getSelectorText();
+ if (str != null && str.length() > 0) {
+ appendSpaceBefore(node, str, source);
+ source.append(str);
+ }
+ appendSpaceBefore(node, "{", source);//$NON-NLS-1$
+ source.append("{");//$NON-NLS-1$
+ }
+ appendDelimBefore(node, null, source);
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBetween(node, (i == 0) ? outside[0] : regions[i - 1], regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ if (needS(outside[1])) {
+ if (isIncludesPreEnd(node, region))
+ appendDelimBefore(node, null, source);
+ else
+ appendSpaceBetween(node, regions[regions.length - 1], outside[1], source);
+ }
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+
+ if (!ICSSPageRule.SELECTOR.equalsIgnoreCase(attrName))
+ return -1;
+
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICSSPageRule.SELECTOR);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ else if (((IndexedRegion) node).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) node).getStartOffset());
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) node).getStartOffset());
+ RegionIterator it = new RegionIterator(flatNode, region);
+ while (it.hasNext()) {
+ region = it.next();
+ if (region.getType() == CSSRegionContexts.CSS_LBRACE) {
+ return it.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ if (it.getStructuredDocumentRegion().getEndOffset(region) >= ((IndexedRegion) node).getEndOffset())
+ break;
+ }
+ }
+ return ((IndexedRegion) node).getStartOffset();
+ }
+
+ /**
+ *
+ */
+ public synchronized static PageRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new PageRuleFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PrimitiveValueFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PrimitiveValueFormatter.java
new file mode 100644
index 0000000000..d1a1542b3d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/PrimitiveValueFormatter.java
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.w3c.dom.css.CSSPrimitiveValue;
+
+
+/**
+ *
+ */
+public class PrimitiveValueFormatter extends DefaultCSSSourceFormatter {
+
+ private static PrimitiveValueFormatter instance;
+
+ /**
+ *
+ */
+ PrimitiveValueFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = ((IndexedRegion) node).getEndOffset();
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ if (end > 0) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ boolean appendQuote = regions.length > 1 && node.getParentNode() instanceof ICSSStyleDeclItem && isCleanup() && getCleanupStrategy(node).isQuoteValues() && (((ICSSStyleDeclItem) node.getParentNode()).getPropertyName().equals(PropCMProperty.P_FONT) || ((ICSSStyleDeclItem) node.getParentNode()).getPropertyName().equals(PropCMProperty.P_FONT_FAMILY) || ((ICSSStyleDeclItem) node.getParentNode()).getPropertyName().equals(PropCMProperty.P_VOICE_FAMILY));
+ String quote = mgr.getQuoteString(node.getOwnerDocument().getModel());
+
+ StringBuffer strBuf = new StringBuffer();
+ boolean skipSpace = false;
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 && !skipSpace)
+ appendSpaceBefore(node, regions[i], strBuf);
+ skipSpace = false;
+ strBuf.append(decoratedPropValueRegion(regions[i], stgy));
+ if (regions[i].getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ skipSpace = true;
+ }
+
+ if (appendQuote) {
+ source.append(quote);
+ String str = strBuf.toString();
+ str = str.replace('\'', ' ');
+ str = str.replace('\"', ' ');
+ str = str.trim();
+ source.append(str);
+ source.append(quote);
+ }
+ else {
+ source.append(strBuf);
+ }
+ }
+ else { // generate source
+ ICSSPrimitiveValue value = (ICSSPrimitiveValue) node;
+ short type = value.getPrimitiveType();
+ String quote = mgr.getQuoteString(node.getOwnerDocument().getModel());
+
+ String str = null;
+ switch (type) {
+ case CSSPrimitiveValue.CSS_NUMBER :
+ case CSSPrimitiveValue.CSS_PERCENTAGE :
+ case CSSPrimitiveValue.CSS_EMS :
+ case CSSPrimitiveValue.CSS_EXS :
+ case CSSPrimitiveValue.CSS_PX :
+ case CSSPrimitiveValue.CSS_CM :
+ case CSSPrimitiveValue.CSS_MM :
+ case CSSPrimitiveValue.CSS_IN :
+ case CSSPrimitiveValue.CSS_PT :
+ case CSSPrimitiveValue.CSS_PC :
+ case CSSPrimitiveValue.CSS_DEG :
+ case CSSPrimitiveValue.CSS_RAD :
+ case CSSPrimitiveValue.CSS_GRAD :
+ case CSSPrimitiveValue.CSS_MS :
+ case CSSPrimitiveValue.CSS_S :
+ case CSSPrimitiveValue.CSS_HZ :
+ case CSSPrimitiveValue.CSS_KHZ :
+ case CSSPrimitiveValue.CSS_DIMENSION :
+ case ICSSPrimitiveValue.CSS_INTEGER :
+ if (value.getFloatValue(type) == ((int) value.getFloatValue(type))) {
+ str = Integer.toString((int) value.getFloatValue(type));
+ }
+ else {
+ str = Float.toString(value.getFloatValue(type));
+ }
+ break;
+ case CSSPrimitiveValue.CSS_IDENT :
+ case ICSSPrimitiveValue.CSS_HASH :
+ case ICSSPrimitiveValue.CSS_INHERIT_PRIMITIVE :
+ str = value.getStringValue();
+ if (str != null) {
+ if (mgr.isPropValueUpperCase())
+ str = str.toUpperCase();
+ else
+ str.toLowerCase();
+ }
+ break;
+ case CSSPrimitiveValue.CSS_STRING :
+ case CSSPrimitiveValue.CSS_URI :
+ case CSSPrimitiveValue.CSS_ATTR :
+ case ICSSPrimitiveValue.CSS_URANGE :
+ case ICSSPrimitiveValue.CSS_FORMAT :
+ case ICSSPrimitiveValue.CSS_LOCAL :
+ case ICSSPrimitiveValue.CSS_COMMA :
+ case ICSSPrimitiveValue.CSS_SLASH :
+ str = value.getStringValue();
+ }
+
+ String preStr = null, postStr = null;
+ switch (type) {
+ case CSSPrimitiveValue.CSS_ATTR :
+ preStr = "attr(";//$NON-NLS-1$
+ postStr = ")";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_CM :
+ postStr = "cm";//$NON-NLS-1$
+ break;
+ // case ICSSPrimitiveValue.CSS_COUNTER:
+ case CSSPrimitiveValue.CSS_DEG :
+ postStr = "deg";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_EMS :
+ postStr = "em";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_EXS :
+ postStr = "ex";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_GRAD :
+ postStr = "grad";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_HZ :
+ postStr = "Hz";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_IN :
+ postStr = "in";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_KHZ :
+ postStr = "kHz";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_MM :
+ postStr = "mm";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_MS :
+ postStr = "ms";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_PC :
+ postStr = "pc";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_PERCENTAGE :
+ postStr = "%";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_PT :
+ postStr = "pt";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_PX :
+ postStr = "px";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_RAD :
+ postStr = "rad";//$NON-NLS-1$
+ break;
+ // case ICSSPrimitiveValue.CSS_RECT:
+ // case ICSSPrimitiveValue.CSS_RGBCOLOR:
+ case CSSPrimitiveValue.CSS_S :
+ postStr = "s";//$NON-NLS-1$
+ break;
+ case CSSPrimitiveValue.CSS_STRING :
+ quote = CSSUtil.detectQuote(str, quote);
+ preStr = quote;
+ postStr = quote;
+ break;
+ case CSSPrimitiveValue.CSS_URI :
+ quote = CSSUtil.detectQuote(str, quote);
+ preStr = "url(" + quote;//$NON-NLS-1$
+ postStr = quote + ")";//$NON-NLS-1$
+ break;
+ // the followings are original primitive values
+ case CSSPrimitiveValue.CSS_IDENT :
+ case CSSPrimitiveValue.CSS_UNKNOWN :
+ // use str
+ case ICSSPrimitiveValue.CSS_INTEGER :
+ case ICSSPrimitiveValue.CSS_HASH :
+ case ICSSPrimitiveValue.CSS_SLASH :
+ case ICSSPrimitiveValue.CSS_COMMA :
+ case CSSPrimitiveValue.CSS_DIMENSION :
+ case CSSPrimitiveValue.CSS_NUMBER :
+ case ICSSPrimitiveValue.CSS_INHERIT_PRIMITIVE :
+ break;
+ case ICSSPrimitiveValue.CSS_URANGE :
+ preStr = "U+";//$NON-NLS-1$
+ break;
+ case ICSSPrimitiveValue.CSS_FORMAT :
+ quote = CSSUtil.detectQuote(str, quote);
+ preStr = "format(" + quote;//$NON-NLS-1$
+ postStr = quote + ")";//$NON-NLS-1$
+ break;
+ case ICSSPrimitiveValue.CSS_LOCAL :
+ quote = CSSUtil.detectQuote(str, quote);
+ preStr = "local(" + quote;//$NON-NLS-1$
+ postStr = quote + ")";//$NON-NLS-1$
+ break;
+ }
+ if (mgr.isPropValueUpperCase()) {
+ if (preStr != null)
+ preStr = preStr.toUpperCase();
+ if (postStr != null)
+ postStr = postStr.toUpperCase();
+ }
+ if (preStr != null)
+ source.append(preStr);
+ if (str != null)
+ source.append(str);
+ if (postStr != null)
+ source.append(postStr);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public synchronized static PrimitiveValueFormatter getInstance() {
+ if (instance == null)
+ instance = new PrimitiveValueFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RGBFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RGBFormatter.java
new file mode 100644
index 0000000000..a6909db3fe
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RGBFormatter.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+/**
+ *
+ */
+public class RGBFormatter extends FunctionFormatter {
+
+ private static RGBFormatter instance;
+
+ /**
+ *
+ */
+ RGBFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected String getFunc() {
+ return "rgb(";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ public synchronized static RGBFormatter getInstance() {
+ if (instance == null)
+ instance = new RGBFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RectFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RectFormatter.java
new file mode 100644
index 0000000000..f3ec832dfc
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/RectFormatter.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+/**
+ *
+ */
+public class RectFormatter extends FunctionFormatter {
+
+ private static RectFormatter instance;
+
+ /**
+ *
+ */
+ RectFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected String getFunc() {
+ return "rect(";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ public synchronized static RectFormatter getInstance() {
+ if (instance == null)
+ instance = new RectFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java
new file mode 100644
index 0000000000..e85f0b6ee3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java
@@ -0,0 +1,394 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class StyleDeclItemFormatter extends DefaultCSSSourceFormatter {
+
+ private static StyleDeclItemFormatter instance;
+
+ /**
+ *
+ */
+ StyleDeclItemFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ private void appendAfterColonSpace(ICSSNode node, StringBuffer source) {
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ int n = mgr.getSpacesPostDelimiter();
+
+ if (mgr.getMaxLineWidth() > 0 && (!mgr.isProhibitWrapOnAttr() || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
+ int length = getLastLineLength(node, source);
+ int append = getFirstChildRegionLength(node);
+ if (length + n + append > mgr.getMaxLineWidth()) {
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ source.append(mgr.getIndentString());
+ n = 0; // no space is necessary
+ }
+ }
+ // no delimiter case
+ while (n-- > 0)
+ source.append(" ");//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ private int getFirstChildRegionLength(ICSSNode node) {
+ ICSSNode firstChild = node.getFirstChild();
+ if (firstChild == null)
+ return 1;
+ int start = ((IndexedRegion) firstChild).getStartOffset();
+ RegionIterator itr = new RegionIterator(node.getOwnerDocument().getModel().getStructuredDocument(), start);
+ while (itr.hasNext()) {
+ ITextRegion reg = itr.next();
+ if (reg != null && reg.getType() != CSSRegionContexts.CSS_S)
+ return reg.getTextLength();
+ }
+ return 1;
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer buf = new StringBuffer();
+ if (node == null || attr == null)
+ return buf;
+
+ if (!ICSSStyleDeclItem.IMPORTANT.equalsIgnoreCase(attr.getName()))
+ return buf;
+
+ // get region to replace
+ if (context != null && ((IndexedRegion) node).getEndOffset() > 0) {
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) attr).getStartOffset());
+ RegionIterator it = new RegionIterator(flatNode, region);
+ it.prev();
+ if (it.hasPrev()) {
+ ITextRegion prev = it.prev();
+ if (prev.getType() == CSSRegionContexts.CSS_S)
+ context.start = it.getStructuredDocumentRegion().getStartOffset(prev);
+ else
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ else
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) node).getEndOffset() - 1);
+ if (region.getType() == CSSRegionContexts.CSS_S) {
+ context.start = flatNode.getStartOffset(region);
+ context.end = flatNode.getEndOffset(region);
+ }
+ else {
+ context.start = flatNode.getEndOffset();
+ context.end = flatNode.getEndOffset();
+ }
+ }
+ }
+ // generate text
+ if (insert && attr.getValue() != null && attr.getValue().length() > 0) {
+ appendSpaceBefore(node, attr.getValue(), buf);
+ buf.append(attr.getValue());
+ }
+ return buf;
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ ICSSNode prev = (child != null) ? child.getPreviousSibling() : node.getLastChild();
+ int start = (prev != null) ? ((IndexedRegion) prev).getEndOffset() : 0;
+ int end = (child != null) ? ((IndexedRegion) child).getStartOffset() : 0;
+ if (start > 0 && start < end) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ // get meaning regions
+ CompoundRegion[] regions = null;
+ if (exceptFor == null)
+ regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ else {
+ regions = getRegions(structuredDocument, new FormatRegion(start, end - start), exceptFor, null);
+ }
+ // generate source
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 2, stgy)); // must
+ // be
+ // comments
+ }
+ }
+ if (child != null && child instanceof ICSSPrimitiveValue) {
+ if (((ICSSPrimitiveValue) child).getPrimitiveType() == ICSSPrimitiveValue.CSS_COMMA)
+ toAppend = ",";//$NON-NLS-1$
+ else if (((ICSSPrimitiveValue) child).getPrimitiveType() == ICSSPrimitiveValue.CSS_SLASH)
+ toAppend = "/";//$NON-NLS-1$
+ }
+ if (child != null && toAppend != null && !toAppend.equals(",") && !toAppend.equals("/")) //$NON-NLS-1$ //$NON-NLS-2$
+ appendSpaceBefore(node, toAppend, source);
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 2, stgy)); // must be
+ // comments
+ }
+ if (needS(outside[1])) {
+ if (((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength()) {
+ if (toAppend != "," && toAppend != "/") //$NON-NLS-1$ //$NON-NLS-2$
+ appendSpaceBefore(node, toAppend, source);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int end = ((IndexedRegion) node).getEndOffset();
+ int start = (node.getLastChild() != null && ((IndexedRegion) node.getLastChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getLastChild()).getEndOffset() : getChildInsertPos(node);
+ if (end > 0 && start < end) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+ else { // generate source
+ // append "!important"
+ String priority = ((ICSSStyleDeclItem) node).getPriority();
+ if (priority != null && priority.length() > 0) {
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (!mgr.isPreserveCase()) {
+ if (mgr.isIdentUpperCase())
+ priority = priority.toUpperCase();
+ else
+ priority = priority.toLowerCase();
+ }
+ appendSpaceBefore(node, priority, source);
+ source.append(priority);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedIdentRegion(regions[i], stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (end > 0) { // format source
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropNameRegion(regions[i], stgy));
+ }
+ }
+ else { // generatoe source
+ ICSSStyleDeclItem item = (ICSSStyleDeclItem) node;
+ if (mgr.isPropNameUpperCase())
+ source.append(item.getPropertyName().toUpperCase());
+ else
+ source.append(item.getPropertyName());
+
+ int k = mgr.getSpacesPreDelimiter();
+ if (mgr.getMaxLineWidth() > 0 && (!mgr.isProhibitWrapOnAttr() || node.getOwnerDocument().getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
+ int length = getLastLineLength(node, source);
+ int append = 1;
+ if (length + k + append > mgr.getMaxLineWidth()) {
+ source.append(getLineDelimiter(node));
+ source.append(getIndent(node));
+ source.append(mgr.getIndentString());
+ k = 0; // no space is necessary
+ }
+ }
+ // no delimiter case
+ while (k-- > 0)
+ source.append(" ");//$NON-NLS-1$
+ source.append(":");//$NON-NLS-1$
+ }
+ if (!isCleanup() || getCleanupStrategy(node).isFormatSource()) {
+ appendAfterColonSpace(node, source);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropNameRegion(regions[i], stgy));
+ }
+ if (needS(outside[1])) {
+ if (isIncludesPreEnd(node, region) && (!isCleanup() || getCleanupStrategy(node).isFormatSource())) {
+ appendAfterColonSpace(node, source);
+ }
+ else
+ appendSpaceBefore(node, outside[1], source);
+ }
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatValue(ICSSNode node) {
+ StringBuffer source = new StringBuffer();
+ formatChildren(node, source);
+
+ return source;
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+
+ if (!ICSSStyleDeclItem.IMPORTANT.equalsIgnoreCase(attrName))
+ return -1;
+
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICSSStyleDeclItem.IMPORTANT);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ else {
+ IndexedRegion iNode = (IndexedRegion) node;
+ if (iNode.getEndOffset() <= 0)
+ return -1;
+
+ CompoundRegion regions[] = getRegionsWithoutWhiteSpaces(node.getOwnerDocument().getModel().getStructuredDocument(), new FormatRegion(iNode.getStartOffset(), iNode.getEndOffset() - iNode.getStartOffset()), getCleanupStrategy(node));
+ for (int i = regions.length - 1; i >= 0; i--) {
+ if (regions[i].getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT)
+ return regions[i].getStartOffset();
+ }
+ return iNode.getEndOffset();
+ }
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n < 0) {
+ return -1;
+ }
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ if (flatNode != null && flatNode.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ n -= flatNode.getLength();
+ }
+ if (n > 0) {
+ String important = ((ICSSStyleDeclItem) node).getPriority();
+ if (important != null && important.length() > 0) {
+ // find before "!important" position
+ flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ RegionIterator it = new RegionIterator(flatNode, flatNode.getRegionAtCharacterOffset(n - 1));
+ while (it.hasPrev()) {
+ ITextRegion region = it.prev();
+ if (it.getStructuredDocumentRegion() != flatNode)
+ break;
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT)
+ return it.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ }
+ // skip last space
+ flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(n - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(n - 1);
+ if (region != null) {
+ n -= region.getLength() - region.getTextLength();
+ }
+
+ return n;
+ }
+ else
+ return -1;
+ }
+
+ /**
+ *
+ */
+ public synchronized static StyleDeclItemFormatter getInstance() {
+ if (instance == null)
+ instance = new StyleDeclItemFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclarationFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclarationFormatter.java
new file mode 100644
index 0000000000..2278b43a63
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclarationFormatter.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class StyleDeclarationFormatter extends DefaultCSSSourceFormatter {
+
+ private static StyleDeclarationFormatter instance;
+
+ /**
+ *
+ */
+ StyleDeclarationFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ ICSSNode prev = (child != null) ? child.getPreviousSibling() : node.getLastChild();
+ int start = (prev != null) ? ((IndexedRegion) prev).getEndOffset() : 0;
+ int end = (child != null) ? ((IndexedRegion) child).getStartOffset() : 0;
+
+ // check no child
+ if (child == null && prev == null)
+ return;
+
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ if (start > 0 && start < end) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ // get meaning regions
+ CompoundRegion[] regions = null;
+ if (exceptFor == null)
+ regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ else {
+ String pickupType = CSSRegionContexts.CSS_DECLARATION_DELIMITER;
+ if (prev == null || child == null)
+ pickupType = null;
+ regions = getRegions(structuredDocument, new FormatRegion(start, end - start), exceptFor, pickupType);
+ }
+ // extract source
+ for (int i = 0; i < regions.length; i++) {
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ }
+ }
+ else if (prev != null && child != null) { // generate source :
+ // between two
+ // declarations
+ source.append(";");//$NON-NLS-1$
+ }
+ else if (prev == null) { // generate source : before the first
+ // declaration
+ org.eclipse.wst.css.core.util.RegionIterator it = null;
+ if (end > 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ it = new org.eclipse.wst.css.core.util.RegionIterator(structuredDocument, end - 1);
+ }
+ else {
+ int pos = getChildInsertPos(node);
+ if (pos >= 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ it = new org.eclipse.wst.css.core.util.RegionIterator(structuredDocument, pos - 1);
+ }
+ }
+ if (it != null) {
+ int limit = ((IndexedRegion) ((node.getParentNode() != null) ? node.getParentNode() : node)).getStartOffset();
+ while (it.hasPrev()) {
+ ITextRegion curReg = it.prev();
+ if (curReg.getType() == CSSRegionContexts.CSS_LBRACE || curReg.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER)
+ break;
+ if (curReg.getType() != CSSRegionContexts.CSS_S && curReg.getType() != CSSRegionContexts.CSS_COMMENT) {
+ source.append(";");//$NON-NLS-1$
+ break;
+ }
+ if (it.getStructuredDocumentRegion().getStartOffset(curReg) <= limit)
+ break;
+ }
+ }
+ }
+ else if (child == null) { // generate source : after the last
+ // declaration
+ org.eclipse.wst.css.core.util.RegionIterator it = null;
+ if (start > 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ it = new org.eclipse.wst.css.core.util.RegionIterator(structuredDocument, start);
+ }
+ else {
+ int pos = getChildInsertPos(node);
+ if (pos >= 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ it = new org.eclipse.wst.css.core.util.RegionIterator(structuredDocument, pos);
+ }
+ }
+ if (it != null) {
+ int limit = ((IndexedRegion) ((node.getParentNode() != null) ? node.getParentNode() : node)).getEndOffset();
+ while (it.hasNext()) {
+ ITextRegion curReg = it.next();
+ if (curReg.getType() == CSSRegionContexts.CSS_RBRACE || curReg.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER)
+ break;
+ if (curReg.getType() != CSSRegionContexts.CSS_S && curReg.getType() != CSSRegionContexts.CSS_COMMENT) {
+ source.append(";");//$NON-NLS-1$
+ break;
+ }
+ if (limit <= it.getStructuredDocumentRegion().getEndOffset(curReg))
+ break;
+ }
+ }
+ }
+ if (child == null) {
+ if (((IndexedRegion) node).getEndOffset() <= 0) {
+ // get next region
+ int pos = getChildInsertPos(node);
+ CompoundRegion toAppendRegion = null;
+ if (pos >= 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(pos);
+ toAppendRegion = new CompoundRegion(flatNode, flatNode.getRegionAtCharacterOffset(pos));
+ }
+ appendDelimBefore(node.getParentNode(), toAppendRegion, source);
+ }
+ }
+ else if ((prev != null || ((IndexedRegion) node).getEndOffset() <= 0)) {
+ if (mgr.isOnePropertyPerLine() && (node.getOwnerDocument() != node || !mgr.isProhibitWrapOnAttr()))
+ appendDelimBefore(node, null, source);
+ else if (prev != null || node.getOwnerDocument() != node)
+ appendSpaceBefore(node, toAppend, source);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must be
+ // comments
+ }
+ if (needS(outside[1])) {
+ if (((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength() && mgr.isOnePropertyPerLine() && (node.getOwnerDocument() != node || !mgr.isProhibitWrapOnAttr())) {
+ appendDelimBefore(node, null, source);
+ }
+ else
+ appendSpaceBefore(node, toAppend, source);
+ }
+ }
+
+ /**
+ * Insert the method's description here.
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ if (node == null)
+ return -1;
+ int pos = super.getChildInsertPos(node);
+ if (pos < 0) {
+ CSSSourceGenerator formatter = getParentFormatter(node);
+ return (formatter != null) ? formatter.getChildInsertPos(node.getParentNode()) : -1;
+ }
+ else
+ return pos;
+ }
+
+ /**
+ *
+ */
+ public synchronized static StyleDeclarationFormatter getInstance() {
+ if (instance == null)
+ instance = new StyleDeclarationFormatter();
+ return instance;
+ }
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ public int getLengthToReformatAfter(ICSSNode node, int insertPos) {
+ if (node == null)
+ return 0;
+ IndexedRegion nnode = (IndexedRegion) node;
+ if (insertPos < 0 || !nnode.contains(insertPos)) {
+ if (node.getParentNode() != null && nnode.getEndOffset() <= 0) {
+ CSSSourceGenerator pntFormatter = getParentFormatter(node);
+ if (pntFormatter != null)
+ return pntFormatter.getLengthToReformatAfter(node.getParentNode(), insertPos);
+ }
+ return 0;
+ }
+ return super.getLengthToReformatAfter(node, insertPos);
+ }
+
+ /**
+ *
+ * @return int
+ * @param node
+ * org.eclipse.wst.css.core.model.interfaces.ICSSNode
+ * @param insertPos
+ * int
+ */
+ public int getLengthToReformatBefore(ICSSNode node, int insertPos) {
+ if (node == null)
+ return 0;
+ IndexedRegion nnode = (IndexedRegion) node;
+ if (insertPos <= 0 || !nnode.contains(insertPos - 1)) {
+ if (node.getParentNode() != null && nnode.getEndOffset() <= 0) {
+ CSSSourceGenerator pntFormatter = getParentFormatter(node);
+ if (pntFormatter != null)
+ return pntFormatter.getLengthToReformatBefore(node.getParentNode(), insertPos);
+ }
+ return 0;
+ }
+ return super.getLengthToReformatBefore(node, insertPos);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleRuleFormatter.java
new file mode 100644
index 0000000000..ac955bd33b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleRuleFormatter.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSAttr;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class StyleRuleFormatter extends DeclContainerFormatter {
+
+ private static StyleRuleFormatter instance;
+
+ /**
+ *
+ */
+ StyleRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StringBuffer formatAttrChanged(ICSSNode node, ICSSAttr attr, boolean insert, AttrChangeContext context) {
+ StringBuffer buf = new StringBuffer();
+ if (node == null || attr == null)
+ return buf;
+
+ if (!ICSSStyleRule.SELECTOR.equalsIgnoreCase(attr.getName()))
+ return buf;
+
+ // get region to replace
+ if (context != null && ((IndexedRegion) node).getEndOffset() > 0) {
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0) {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) attr).getEndOffset() - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) attr).getEndOffset() - 1);
+ RegionIterator it = new RegionIterator(flatNode, region);
+ it.next();
+ if (it.hasNext()) {
+ ITextRegion next = it.next();
+ if (next.getType() == CSSRegionContexts.CSS_S)
+ context.end = it.getStructuredDocumentRegion().getEndOffset(next);
+ else
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ }
+ else
+ context.end = it.getStructuredDocumentRegion().getEndOffset(region);
+ context.start = it.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ else {
+ IStructuredDocumentRegion flatNode = node.getOwnerDocument().getModel().getStructuredDocument().getRegionAtCharacterOffset(((IndexedRegion) node).getStartOffset());
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(((IndexedRegion) node).getStartOffset());
+ if (region.getType() == CSSRegionContexts.CSS_S) {
+ context.start = flatNode.getStartOffset(region);
+ context.end = flatNode.getEndOffset(region);
+ }
+ else {
+ context.start = flatNode.getEndOffset();
+ context.end = flatNode.getEndOffset();
+ }
+ }
+ }
+ // generate text
+ if (insert) {
+ buf.append(attr.getValue());
+ appendSpaceBefore(node, "", buf);//$NON-NLS-1$
+ }
+ return buf;
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ if (end > 0) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBetween(node, regions[i - 1], regions[i], source);
+ source.append(decoratedSelectorRegion(regions[i], (i != 0) ? regions[i - 1] : null, stgy));
+ }
+ }
+ else { // generate source
+ String str = ((ICSSStyleRule) node).getSelectorText();
+ // appendSpaceBefore(node,str,source);
+ source.append(str);
+ appendSpaceBefore(node, "{", source);//$NON-NLS-1$
+ source.append("{");//$NON-NLS-1$
+ }
+ appendDelimBefore(node, null, source);
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBetween(node, (i == 0) ? outside[0] : regions[i - 1], regions[i], source);
+ source.append(decoratedSelectorRegion(regions[i], (i != 0) ? regions[i - 1] : null, stgy));
+ }
+ if (needS(outside[1])) {
+ if (isIncludesPreEnd(node, region))
+ appendDelimBefore(node, null, source);
+ else
+ appendSpaceBetween(node, regions[regions.length - 1], outside[1], source);
+ }
+ }
+
+ /**
+ *
+ */
+ public int getAttrInsertPos(ICSSNode node, String attrName) {
+ if (node == null || attrName == null || attrName.length() == 0)
+ return -1;
+
+ if (!ICSSStyleRule.SELECTOR.equalsIgnoreCase(attrName))
+ return -1;
+
+ ICSSAttr attr = (ICSSAttr) node.getAttributes().getNamedItem(ICSSStyleRule.SELECTOR);
+ if (attr != null && ((IndexedRegion) attr).getEndOffset() > 0)
+ return ((IndexedRegion) attr).getStartOffset();
+ else
+ return ((IndexedRegion) node).getStartOffset();
+ }
+
+ /**
+ *
+ */
+ public synchronized static StyleRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new StyleRuleFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleSheetFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleSheetFormatter.java
new file mode 100644
index 0000000000..c97dfe20b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleSheetFormatter.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ *
+ */
+public class StyleSheetFormatter extends AbstractCSSSourceFormatter {
+
+ private static StyleSheetFormatter instance;
+
+ /**
+ *
+ */
+ StyleSheetFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, String toAppend, StringBuffer source, IRegion exceptFor) {
+ String delim = getLineDelimiter(node);
+ ICSSNode prev = (child != null) ? child.getPreviousSibling() : node.getLastChild();
+ if (prev == null && child == null)
+ return;
+ int start = (prev != null) ? ((IndexedRegion) prev).getEndOffset() : 0;
+ int end = (child != null) ? ((IndexedRegion) child).getStartOffset() : 0;
+ if (start > 0 && start < end) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ // get meaning regions
+ CompoundRegion[] regions = null;
+ if (exceptFor == null)
+ regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ else {
+ String pickupType = CSSRegionContexts.CSS_DELIMITER;
+ if (prev == null)
+ pickupType = null;
+ regions = getRegions(structuredDocument, new FormatRegion(start, end - start), exceptFor, pickupType);
+ }
+ // generate source
+ if (prev != null) {
+ appendDelimBefore(node, (regions.length > 0) ? regions[0] : null, source);
+ }
+ for (int i = 0; i < regions.length; i++) {
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must
+ // be
+ // comments
+ // or
+ // semi_colon
+ if (regions[i].getType() == CSSRegionContexts.CSS_DELIMITER) {
+ // append delim after
+ appendDelimBefore(node, null, source);
+ }
+ }
+ if (prev != null)
+ appendDelimBefore(node, null, source);
+ }
+ else if (prev != null && child != null) { // source generation :
+ // between two rules
+ if (prev.getNodeType() == ICSSNode.IMPORTRULE_NODE || prev.getNodeType() == ICSSNode.CHARSETRULE_NODE || prev.getNodeType() == ICSSNode.UNKNOWNRULE_NODE)
+ source.append(";");//$NON-NLS-1$
+ source.append(delim);
+ source.append(delim);
+ }
+ else if (((IndexedRegion) node).getEndOffset() > 0) {
+ if (prev == null) { // source formatting : before the first rule
+ ICSSNode next = child.getNextSibling();
+ int pos = getChildInsertPos(node);
+ if (next != null && ((IndexedRegion) next).getEndOffset() > 0)
+ pos = ((IndexedRegion) next).getStartOffset();
+ if (pos != 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] prevRegions = getRegions(structuredDocument, new FormatRegion(0, pos), null, null);
+ if (prevRegions != null && prevRegions.length > 0)
+ appendDelimBefore(node, null, source);
+ }
+ }
+ else if (child == null) { // source formatting : after the last
+ // rule
+ if (prev.getNodeType() == ICSSNode.IMPORTRULE_NODE || prev.getNodeType() == ICSSNode.CHARSETRULE_NODE || prev.getNodeType() == ICSSNode.UNKNOWNRULE_NODE)
+ source.append(";");//$NON-NLS-1$
+ if (start > 0 && start <= ((IndexedRegion) node).getEndOffset()) {
+ appendDelimBefore(node, null, source);
+ }
+ else if (start <= 0) {
+ int pos = getChildInsertPos(node);
+ if (pos < ((IndexedRegion) node).getEndOffset()) {
+ appendDelimBefore(node, null, source);
+ }
+ }
+ }
+ }
+ else if (prev != null && child == null) { // source generation :
+ // after the last rule
+ if (prev.getNodeType() == ICSSNode.IMPORTRULE_NODE || prev.getNodeType() == ICSSNode.CHARSETRULE_NODE || prev.getNodeType() == ICSSNode.UNKNOWNRULE_NODE)
+ source.append(";");//$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatBefore(ICSSNode node, ICSSNode child, IRegion region, String toAppend, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy)); // must be
+ // comments
+ }
+ if (needS(outside[1])) {
+ if (((IndexedRegion) child).getStartOffset() == region.getOffset() + region.getLength())
+ appendDelimBefore(node, null, source);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, StringBuffer source) {
+ int end = ((IndexedRegion) node).getEndOffset();
+ int start = (node.getLastChild() != null && ((IndexedRegion) node.getLastChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getLastChild()).getEndOffset() : getChildInsertPos(node);
+ if (end > 0 && start < end) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ if ((regions != null && regions.length > 0 && regions[regions.length - 1].getType() == CSSRegionContexts.CSS_CDC) || node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED)
+ appendDelimBefore(node, null, source);
+ }
+ else { // source generation
+ ICSSNode lastChild = node.getLastChild();
+ if (lastChild != null && (lastChild.getNodeType() == ICSSNode.CHARSETRULE_NODE || lastChild.getNodeType() == ICSSNode.IMPORTRULE_NODE || lastChild.getNodeType() == ICSSNode.UNKNOWNRULE_NODE)) {
+ source.append(";");//$NON-NLS-1$
+ }
+ if (node.getOwnerDocument().getModel() != null && node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED)
+ appendDelimBefore(node, null, source);
+ return; // nothing
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPost(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(org.eclipse.wst.css.core.document.ICSSNode node, java.lang.StringBuffer source) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = (node.getFirstChild() != null && ((IndexedRegion) node.getFirstChild()).getEndOffset() > 0) ? ((IndexedRegion) node.getFirstChild()).getStartOffset() : getChildInsertPos(node);
+ if (end > 0) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || regions[i].getType() == CSSRegionContexts.CSS_CDO || node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED)
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ if (node.getLastChild() != null && (source.length() > 0 || node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED)) {
+ appendDelimBefore(node, null, source);
+ }
+ }
+ else if (node.getOwnerDocument().getModel() != null && node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED) {
+ appendDelimBefore(node, null, source);
+ // source.append("<!--");
+ // appendDelimBefore(node,null, source);
+ }
+ else
+ return; // nothing
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, java.lang.StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]) || regions[i].getType() == CSSRegionContexts.CSS_CDO || node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED)
+ appendDelimBefore(node, regions[i], source);
+ source.append(decoratedRegion(regions[i], 0, stgy));
+ }
+ if (needS(outside[1])) {
+ if (isIncludesPreEnd(node, region)) {
+ if (source.length() > 0 || node.getOwnerDocument().getModel().getStyleSheetType() == ICSSModel.EMBEDDED) {
+ String delim = getLineDelimiter(node);
+ source.append(delim);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public int getChildInsertPos(ICSSNode node) {
+ int n = ((IndexedRegion) node).getEndOffset();
+ if (n > 0) {
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(n - 1);
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(n - 1);
+ RegionIterator it = new RegionIterator(flatNode, region);
+ while (it.hasPrev()) {
+ ITextRegion reg = it.prev();
+ if (reg.getType() == CSSRegionContexts.CSS_CDC)
+ return it.getStructuredDocumentRegion().getStartOffset(reg);
+ }
+ return n;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ */
+ public synchronized static StyleSheetFormatter getInstance() {
+ if (instance == null)
+ instance = new StyleSheetFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java
new file mode 100644
index 0000000000..a3dcad1ead
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/UnknownRuleFormatter.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.formatter;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.w3c.dom.css.CSSUnknownRule;
+
+
+/**
+ *
+ */
+public class UnknownRuleFormatter extends DefaultCSSSourceFormatter {
+
+ private static UnknownRuleFormatter instance;
+
+ /**
+ *
+ */
+ UnknownRuleFormatter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ int start = ((IndexedRegion) node).getStartOffset();
+ int end = ((IndexedRegion) node).getEndOffset();
+ if (end > 0) { // format source
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0)
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ }
+ else { // generate source
+ CSSUnknownRule rule = (CSSUnknownRule) node;
+ source.append(rule.getCssText());
+ }
+ }
+
+ /**
+ *
+ */
+ protected void formatPre(ICSSNode node, IRegion region, StringBuffer source) {
+ CSSCleanupStrategy stgy = getCleanupStrategy(node);
+
+ IStructuredDocument structuredDocument = node.getOwnerDocument().getModel().getStructuredDocument();
+ CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, region, stgy);
+ CompoundRegion[] outside = getOutsideRegions(structuredDocument, region);
+ for (int i = 0; i < regions.length; i++) {
+ if (i != 0 || needS(outside[0]))
+ appendSpaceBefore(node, regions[i], source);
+ source.append(decoratedPropValueRegion(regions[i], stgy));
+ }
+ if (needS(outside[1]) && !isIncludesPreEnd(node, region))
+ appendSpaceBefore(node, outside[1], source);
+ }
+
+ /**
+ *
+ */
+ public synchronized static UnknownRuleFormatter getInstance() {
+ if (instance == null)
+ instance = new UnknownRuleFormatter();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCategoryImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCategoryImpl.java
new file mode 100644
index 0000000000..db07505586
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCategoryImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMCategory;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMCategoryImpl extends CSSMMNodeImpl implements CSSMMCategory {
+
+ public CSSMMCategoryImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_CATEGORY;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ public String getCaption() {
+ return fCaption;
+ }
+
+ void setCaption(String caption) {
+ fCaption = caption;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getCaption() == null) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+ /*
+ * @see Object#toString()
+ */
+ public String toString() {
+ return getCaption();
+ }
+
+
+ private String fCaption = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCharsetRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCharsetRuleImpl.java
new file mode 100644
index 0000000000..6e11efbf38
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMCharsetRuleImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMCharsetRule;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMCharsetRuleImpl extends CSSMMNodeImpl implements CSSMMCharsetRule {
+
+
+ public CSSMMCharsetRuleImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_CHARSET_RULE;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ return MetaModelErrors.NO_ERROR;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMContainerImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMContainerImpl.java
new file mode 100644
index 0000000000..5903c55902
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMContainerImpl.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMContainer;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMContainerImpl extends CSSMMNodeImpl implements CSSMMContainer {
+
+
+ public CSSMMContainerImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_CONTAINER;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_NUMBER || type == TYPE_KEYWORD || type == TYPE_FUNCTION || type == TYPE_CONTAINER);
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getChildCount() == 0) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMDescriptorImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMDescriptorImpl.java
new file mode 100644
index 0000000000..b3410691f7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMDescriptorImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMDescriptor;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+
+class CSSMMDescriptorImpl extends CSSMMNodeImpl implements CSSMMDescriptor {
+
+
+ public CSSMMDescriptorImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_DESCRIPTOR;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_NUMBER || type == TYPE_KEYWORD || type == TYPE_FUNCTION || type == TYPE_CONTAINER || type == TYPE_STRING || type == TYPE_SEPARATOR);
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getChildCount() == 0) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+ /*
+ * @see CSSMMDescriptor#getValues()
+ */
+ public Iterator getValues() {
+ ValueCollector collector = new ValueCollector();
+ collector.apply(this);
+ return collector.getNodes();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFontFaceRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFontFaceRuleImpl.java
new file mode 100644
index 0000000000..2e1c22fc58
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFontFaceRuleImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMFontFaceRule;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMFontFaceRuleImpl extends CSSMMNodeImpl implements CSSMMFontFaceRule {
+
+
+ public CSSMMFontFaceRuleImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_FONT_FACE_RULE;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return (child != null && child.getType() == TYPE_DESCRIPTOR);
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ return MetaModelErrors.NO_ERROR;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFunctionImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFunctionImpl.java
new file mode 100644
index 0000000000..0be028ee58
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMFunctionImpl.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMFunction;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMFunctionImpl extends CSSMMNodeImpl implements CSSMMFunction {
+
+ public CSSMMFunctionImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_FUNCTION;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String getFunctionString() {
+ return fValue;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#postSetAttribute()
+ */
+ // void postSetAttribute() throws BadInitializationException {
+ // super.postSetAttribute();
+ // String name = getName();
+ // if (name == null) { throw new BadInitializationException(); }
+ //
+ // List list = new ArrayList();
+ // list.add(CSSFunctionID.F_ATTR);
+ // list.add(CSSFunctionID.F_COUNTER);
+ // list.add(CSSFunctionID.F_RGB);
+ // list.add(CSSFunctionID.F_RECT);
+ // list.add(CSSFunctionID.F_URI);
+ // list.add(CSSFunctionID.F_FORMAT);
+ // list.add(CSSFunctionID.F_LOCAL);
+ //
+ // if (! list.contains(name.toLowerCase())) {
+ // throw new BadInitializationException();
+ // }
+ // }
+ /*
+ * @see Object#toString()
+ */
+ public String toString() {
+ return getFunctionString();
+ }
+
+ void setFunctionString(String value) {
+ fValue = value;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getFunctionString() == null) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+
+ private String fValue = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMImportRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMImportRuleImpl.java
new file mode 100644
index 0000000000..0f40141d07
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMImportRuleImpl.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMImportRule;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMImportRuleImpl extends CSSMMNodeImpl implements CSSMMImportRule {
+
+
+ public CSSMMImportRuleImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_IMPORT_RULE;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ return MetaModelErrors.NO_ERROR;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMKeywordImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMKeywordImpl.java
new file mode 100644
index 0000000000..f82b67b456
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMKeywordImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMKeyword;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMKeywordImpl extends CSSMMNodeImpl implements CSSMMKeyword {
+
+ public CSSMMKeywordImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_KEYWORD;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ /*
+ * @see CSSMMKeyword#getKeywordString()
+ */
+ public String getKeywordString() {
+ return fValue;
+ }
+
+ /*
+ * @see Object#toString()
+ */
+ public String toString() {
+ return getKeywordString();
+ }
+
+ void setKeywordString(String value) {
+ fValue = value;
+ }
+
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getKeywordString() == null) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+
+ private String fValue = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMMediaRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMMediaRuleImpl.java
new file mode 100644
index 0000000000..4a60ce6701
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMMediaRuleImpl.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMMediaRule;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+class CSSMMMediaRuleImpl extends CSSMMNodeImpl implements CSSMMMediaRule {
+
+
+ public CSSMMMediaRuleImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_MEDIA_RULE;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ short getError() {
+ return MetaModelErrors.NO_ERROR;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNodeImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNodeImpl.java
new file mode 100644
index 0000000000..06c73a67e8
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNodeImpl.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+
+abstract class CSSMMNodeImpl implements CSSMMNode {
+
+ public CSSMMNodeImpl() {
+ super();
+ }
+
+ public abstract String getType();
+
+ public String getDescription() {
+ return fDescription;
+ }
+
+ public String getAttribute(String name) {
+ if (fAttributes == null) {
+ return null;
+ }
+ return (String) fAttributes.get(name);
+ }
+
+ public Iterator getChildNodes() {
+ if (fChildNodes == null) {
+ return Collections.EMPTY_LIST.iterator();
+ }
+ else {
+ return Collections.unmodifiableCollection(fChildNodes).iterator();
+ }
+ }
+
+ public Iterator getDescendants() {
+ List descendants = new ArrayList();
+ Iterator iChild = getChildNodes();
+ while (iChild.hasNext()) {
+ CSSMMNode child = (CSSMMNode) iChild.next();
+ Iterator iDescendant = child.getDescendants();
+ if (iDescendant.hasNext()) {
+ while (iDescendant.hasNext()) {
+ CSSMMNode descendant = (CSSMMNode) iDescendant.next();
+ if (!descendants.contains(descendant)) {
+ descendants.add(descendant);
+ }
+ }
+ }
+ else {
+ if (!descendants.contains(child)) {
+ descendants.add(child);
+ }
+ }
+ }
+ return Collections.unmodifiableCollection(descendants).iterator();
+ }
+
+ void appendChild(CSSMMNode child) {
+ if (child == null) {
+ return;
+ }
+ if (fChildNodes == null) {
+ fChildNodes = new ArrayList();
+ }
+ if (!fChildNodes.contains(child)) {
+ fChildNodes.add(child);
+ ((CSSMMNodeImpl) child).fRefCount++;
+ }
+ }
+
+ void removeChild(CSSMMNode child) {
+ if (child == null || fChildNodes == null) {
+ return;
+ }
+ Iterator i = fChildNodes.iterator();
+ while (i.hasNext()) {
+ if (i.next() == child) {
+ i.remove();
+ ((CSSMMNodeImpl) child).fRefCount--;
+ return;
+ }
+ }
+ }
+
+ void removeAllChildNodes() {
+ if (fChildNodes == null) {
+ return;
+ }
+ Iterator i = fChildNodes.iterator();
+ while (i.hasNext()) {
+ ((CSSMMNodeImpl) i.next()).fRefCount--;
+ }
+ fChildNodes.clear();
+ }
+
+ abstract boolean canContain(CSSMMNode child);
+
+ void initializeAttribute(Map attributes) throws IllegalArgumentException {
+ if (fAttributes == null) {
+ fAttributes = new HashMap();
+ }
+ fAttributes.putAll(attributes);
+ postSetAttribute();
+ }
+
+ void setDescription(String description) {
+ fDescription = description;
+ }
+
+ void postSetAttribute() throws IllegalArgumentException {
+ // default : nop
+ }
+
+ abstract short getError();
+
+ int getChildCount() {
+ return (fChildNodes != null) ? fChildNodes.size() : 0;
+ }
+
+ int getReferenceCount() {
+ return fRefCount;
+ }
+
+
+ private List fChildNodes = null;
+ private String fDescription = null;
+ private Map fAttributes = null;
+ private int fRefCount = 0; // for error check
+
+ static final String ATTR_NAME = "name"; //$NON-NLS-1$
+ static final String NAME_NOT_AVAILABLE = ""; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNumberImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNumberImpl.java
new file mode 100644
index 0000000000..037c1f6ef3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMNumberImpl.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMNumber;
+
+class CSSMMNumberImpl extends CSSMMNodeImpl implements CSSMMNumber {
+
+
+ public CSSMMNumberImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_NUMBER;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return (child != null && child.getType() == TYPE_UNIT);
+ }
+
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPageRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPageRuleImpl.java
new file mode 100644
index 0000000000..3bbe54e62f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPageRuleImpl.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMPageRule;
+
+class CSSMMPageRuleImpl extends CSSMMNodeImpl implements CSSMMPageRule {
+
+
+ public CSSMMPageRuleImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_PAGE_RULE;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_PROPERTY || type == TYPE_SELECTOR);
+ }
+
+ short getError() {
+ if (getChildCount() == 0) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPropertyImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPropertyImpl.java
new file mode 100644
index 0000000000..a9f7c3afe7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPropertyImpl.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMProperty;
+
+
+class CSSMMPropertyImpl extends CSSMMNodeImpl implements CSSMMProperty {
+ public CSSMMPropertyImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_PROPERTY;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_NUMBER || type == TYPE_KEYWORD || type == TYPE_FUNCTION || type == TYPE_CONTAINER || type == TYPE_STRING || type == TYPE_SEPARATOR || type == TYPE_PROPERTY);
+ }
+
+ /*
+ * @see CSSMMProperty#getCategoryName()
+ */
+ public String getCategoryName() {
+ return getAttribute(ATTR_CATEGORY);
+ }
+
+ public Iterator getValues() {
+ ValueCollector collector = new ValueCollector();
+ collector.apply(this);
+ return collector.getNodes();
+ }
+
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getChildCount() == 0) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+
+ static final String ATTR_CATEGORY = "category"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoClassImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoClassImpl.java
new file mode 100644
index 0000000000..ae8f81e12c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoClassImpl.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+class CSSMMPseudoClassImpl extends CSSMMSelectorImpl {
+
+
+ /**
+ * Constructor for CSSMMPseudoClassImpl.
+ */
+ public CSSMMPseudoClassImpl() {
+ super();
+ }
+
+ /*
+ * @see CSSMMSelector#getSelectorType()
+ */
+ public String getSelectorType() {
+ return TYPE_PSEUDO_CLASS;
+ }
+
+ void setSelectorString(String value) {
+ fValue = ":" + value; //$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoElementImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoElementImpl.java
new file mode 100644
index 0000000000..d047156399
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMPseudoElementImpl.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+public class CSSMMPseudoElementImpl extends CSSMMSelectorImpl {
+
+
+ /**
+ * Constructor for CSSMMPseudoElementImpl.
+ */
+ public CSSMMPseudoElementImpl() {
+ super();
+ }
+
+ /*
+ * @see CSSMMSelector#getSelectorType()
+ */
+ public String getSelectorType() {
+ return TYPE_PSEUDO_ELEMENT;
+ }
+
+ void setSelectorString(String value) {
+ fValue = ":" + value; //$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorExpressionImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorExpressionImpl.java
new file mode 100644
index 0000000000..1d1e11e99f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorExpressionImpl.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+class CSSMMSelectorExpressionImpl extends CSSMMSelectorImpl {
+
+ public CSSMMSelectorExpressionImpl() {
+ super();
+ }
+
+ /*
+ * @see CSSMMSelector#getSelectorType()
+ */
+ public String getSelectorType() {
+ return TYPE_EXPRESSION;
+ }
+
+ void postSetAttribute() throws IllegalArgumentException {
+ super.postSetAttribute();
+ String name = getName();
+ if (name == null) {
+ throw new IllegalArgumentException();
+ }
+
+ Map map = new HashMap();
+ map.put(EXPRESSION_ADJACENT.toLowerCase(), "+"); //$NON-NLS-1$
+ map.put(EXPRESSION_ATTRIBUTE.toLowerCase(), "[]"); //$NON-NLS-1$
+ map.put(EXPRESSION_CHILD.toLowerCase(), ">"); //$NON-NLS-1$
+ map.put(EXPRESSION_DESCENDANT.toLowerCase(), "' '"); //$NON-NLS-1$
+ map.put(EXPRESSION_UNIVERSAL.toLowerCase(), "*"); //$NON-NLS-1$
+
+ fValue = (String) map.get(name.toLowerCase());
+ if (fValue == null) {
+ throw new IllegalArgumentException();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorImpl.java
new file mode 100644
index 0000000000..590b3fe608
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMSelectorImpl.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMSelector;
+
+
+abstract class CSSMMSelectorImpl extends CSSMMNodeImpl implements CSSMMSelector {
+
+ /**
+ * Constructor for CSSMMSelectorImpl.
+ */
+ public CSSMMSelectorImpl() {
+ super();
+ }
+
+ /*
+ * @see CSSMMNode#getName()
+ */
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNode#getType()
+ */
+ public String getType() {
+ return TYPE_SELECTOR;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#getError()
+ */
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+ /*
+ * @see CSSMMSelector#getSelectorString()
+ */
+ public String getSelectorString() {
+ return fValue;
+ }
+
+ /*
+ * @see Object#toString()
+ */
+ public String toString() {
+ return getSelectorString();
+ }
+
+
+ protected String fValue = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStringImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStringImpl.java
new file mode 100644
index 0000000000..39ab26ca0b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStringImpl.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMString;
+
+class CSSMMStringImpl extends CSSMMNodeImpl implements CSSMMString {
+
+
+ public CSSMMStringImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_STRING;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+ /*
+ * @see CSSMMNodeImpl#postSetAttribute()
+ */
+ // void postSetAttribute() throws BadInitializationException {
+ // super.postSetAttribute();
+ // String name = getName();
+ // if (name == null) { throw new BadInitializationException(); }
+ //
+ // Map map = new HashMap();
+ // map.put(CSSStringID.S_ANY.toLowerCase(), "<any>"); //$NON-NLS-1$
+ // map.put(CSSStringID.S_COUNTER_IDENTIFIER.toLowerCase(), "<counter>");
+ // //$NON-NLS-1$
+ // map.put(CSSStringID.S_FAMILY_NAME.toLowerCase(), "<family-name>");
+ // //$NON-NLS-1$
+ // map.put(CSSStringID.S_FONT_FACE_NAME.toLowerCase(),
+ // "<font-face-name>"); //$NON-NLS-1$
+ // map.put(CSSStringID.S_PAGE_IDENTIFIER.toLowerCase(),
+ // "<page-identifier>"); //$NON-NLS-1$
+ // map.put(CSSStringID.S_SPECIFIC_VOICE.toLowerCase(),
+ // "<specific-voice>"); //$NON-NLS-1$
+ // map.put(CSSStringID.S_URANGE.toLowerCase(), "<urange>"); //$NON-NLS-1$
+ //
+ // fValue = (String)map.get(name.toLowerCase());
+ // if (fValue == null) { throw new BadInitializationException(); }
+ // }
+ //
+ // /*
+ // * @see Object#toString()
+ // */
+ // public String toString() {
+ // return fValue;
+ // }
+ //
+ // private String fValue = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleRuleImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleRuleImpl.java
new file mode 100644
index 0000000000..f1919eeaf9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleRuleImpl.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMStyleRule;
+
+class CSSMMStyleRuleImpl extends CSSMMNodeImpl implements CSSMMStyleRule {
+
+
+ public CSSMMStyleRuleImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_STYLE_RULE;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_PROPERTY || type == TYPE_SELECTOR);
+ }
+
+ short getError() {
+ if (getChildCount() == 0) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleSheetImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleSheetImpl.java
new file mode 100644
index 0000000000..a276d2dfde
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMStyleSheetImpl.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMStyleSheet;
+
+class CSSMMStyleSheetImpl extends CSSMMNodeImpl implements CSSMMStyleSheet {
+
+
+ public CSSMMStyleSheetImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_STYLE_SHEET;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_CHARSET_RULE || type == TYPE_IMPORT_RULE || type == TYPE_PAGE_RULE || type == TYPE_MEDIA_RULE || type == TYPE_FONT_FACE_RULE || type == TYPE_STYLE_RULE);
+ }
+
+ short getError() {
+ if (getChildCount() == 0) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMUnitImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMUnitImpl.java
new file mode 100644
index 0000000000..7e90766f29
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMMUnitImpl.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMUnit;
+
+/**
+ * CSSMMUnit : embedded type
+ */
+class CSSMMUnitImpl extends CSSMMNodeImpl implements CSSMMUnit {
+
+ public CSSMMUnitImpl() {
+ super();
+ }
+
+ public String getType() {
+ return TYPE_UNIT;
+ }
+
+ public String getName() {
+ String name = getAttribute(ATTR_NAME);
+ if (name != null) {
+ return name.toLowerCase();
+ }
+ else {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMMUnit#getUnitString()
+ */
+ public String getUnitString() {
+ return fValue;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ return false;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#postSetAttribute()
+ */
+ // void postSetAttribute() throws BadInitializationException {
+ // super.postSetAttribute();
+ // String name = getName();
+ // if (name == null) { throw new BadInitializationException(); }
+ // Map map = new HashMap();
+ // map.put(CSSUnitID.U_CM.toLowerCase(), "cm");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_DEG.toLowerCase(), "deg");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_EMS.toLowerCase(), "em");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_EXS.toLowerCase(), "ex");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_GRAD.toLowerCase(), "grad");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_HASH.toLowerCase(), "#");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_HZ.toLowerCase(), "Hz");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_IN.toLowerCase(), "in");//$NON-NLS-1$
+ // // map.put(CSSUnitID.U_INTEGER.toLowerCase(),
+ // "(integer)");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_KHZ.toLowerCase(), "kHz");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_MM.toLowerCase(), "mm");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_MS.toLowerCase(), "ms");//$NON-NLS-1$
+ // // map.put(CSSUnitID.U_NUMBER.toLowerCase(), "(number)");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_PC.toLowerCase(), "pc");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_PERCENTAGE.toLowerCase(), "%");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_PT.toLowerCase(), "pt");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_PX.toLowerCase(), "px");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_RAD.toLowerCase(), "rad");//$NON-NLS-1$
+ // map.put(CSSUnitID.U_S.toLowerCase(), "s");//$NON-NLS-1$
+ // fValue = (String)map.get(name.toLowerCase());
+ // if (fValue == null) { throw new BadInitializationException(); }
+ // }
+ /*
+ * @see Object#toString()
+ */
+ public String toString() {
+ return getUnitString();
+ }
+
+ void setUnitString(String value) {
+ fValue = value;
+ }
+
+ short getError() {
+ if (getName() == null) {
+ return MetaModelErrors.ERROR_NOT_DEFINED;
+ }
+ else if (getUnitString() == null) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+ private String fValue = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMetaModelImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMetaModelImpl.java
new file mode 100644
index 0000000000..8ae89dfa82
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSMetaModelImpl.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMStyleSheet;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+
+
+class CSSMetaModelImpl extends CSSMMNodeImpl implements CSSMetaModel {
+ // class CSSMetaModelImpl implements CSSMetaModel {
+ public CSSMetaModelImpl() {
+ super();
+ fNodePool = new NodePool();
+ }
+
+ public String getType() {
+ return TYPE_META_MODEL;
+ }
+
+ public String getName() {
+ return NAME_NOT_AVAILABLE;
+ }
+
+ /*
+ * @see CSSMMNodeImpl#canContain(CSSMMNode)
+ */
+ boolean canContain(CSSMMNode child) {
+ if (child == null) {
+ return false;
+ }
+ String type = child.getType();
+ return (type == TYPE_STYLE_SHEET || type == TYPE_CATEGORY);
+ }
+
+ public CSSMMStyleSheet getStyleSheet() {
+ Iterator i = getChildNodes();
+ while (i.hasNext()) {
+ CSSMMNode node = (CSSMMNode) i.next();
+ if (node.getType() == TYPE_STYLE_SHEET) {
+ return (CSSMMStyleSheet) node;
+ }
+ }
+ return null;
+ // return fStyleSheet;
+ }
+
+ public Iterator getCategories() {
+ List categories = new ArrayList();
+ Iterator i = getChildNodes();
+ while (i.hasNext()) {
+ CSSMMNode node = (CSSMMNode) i.next();
+ if (node.getType() == TYPE_CATEGORY) {
+ categories.add(node);
+ }
+ }
+ return categories.iterator();
+ }
+
+ void loadCompleted() {
+ fNodePool = null;
+ }
+
+ // List fCategories = null;
+ /*
+ * @see CSSMMNodeImpl#isValid()
+ */
+ short getError() {
+ if (getStyleSheet() != null) {
+ return MetaModelErrors.ERROR_NO_CHILD;
+ }
+ else {
+ return MetaModelErrors.NO_ERROR;
+ }
+ }
+
+ NodePool getNodePool() {
+ return fNodePool;
+ }
+
+
+ private NodePool fNodePool = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileImpl.java
new file mode 100644
index 0000000000..5e5a843950
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileImpl.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+
+
+
+class CSSProfileImpl implements CSSProfile {
+
+ /**
+ * Constructor for CSSMetaModelProfileInfoImpl.
+ */
+ private CSSProfileImpl() {
+ super();
+ }
+
+ /**
+ * Constructor for CSSMetaModelProfileInfoImpl.
+ */
+ public CSSProfileImpl(String id, URL url) {
+ super();
+ fID = id;
+ fURL = url;
+ }
+
+ /*
+ * @see CSSMetaModelProfileInfo#getProfileID()
+ */
+ public String getProfileID() {
+ return fID;
+ }
+
+ /*
+ * @see CSSMetaModelProfileInfo#getProfileName()
+ */
+ public String getProfileName() {
+ return (fName == null) ? fID : fName;
+ }
+
+ public CSSMetaModel getMetaModel() {
+ if (fMetaModel == null) {
+ try {
+ InputStream input = getProfileURL().openStream();
+ ProfileLoader loader = new ProfileLoader(getResourceBundle(), getLogging());
+ fMetaModel = loader.loadProfile(input);
+ }
+ catch (IOException e) {
+ Logger.logException("Cannot open stream for profile", e); //$NON-NLS-1$
+ }
+ }
+ return fMetaModel;
+ }
+
+ private ResourceBundle getResourceBundle() {
+ ClassLoader targetLoader = null;
+ String pluginID = getOwnerPluginID();
+ if (pluginID != null) {
+ Plugin plugin = Platform.getPlugin(pluginID);
+ if (plugin != null) {
+ targetLoader = plugin.getClass().getClassLoader();
+ }
+ }
+ if (targetLoader == null) {
+ targetLoader = this.getClass().getClassLoader();
+ }
+
+ String profileURLString = getProfileURL().toString();
+ int lastSlashPos = profileURLString.lastIndexOf('/');
+ if (1 < lastSlashPos) {
+ String profileURLBase = profileURLString.substring(0, lastSlashPos + 1);
+ try {
+ URL[] urls = new URL[]{new URL(profileURLBase)};
+ targetLoader = URLClassLoader.newInstance(urls, targetLoader);
+ }
+ catch (MalformedURLException e) {
+ }
+ }
+
+ try {
+ return ResourceBundle.getBundle("cssprofile", //$NON-NLS-1$
+ Locale.getDefault(), targetLoader);
+ }
+ catch (MissingResourceException e) {
+ return null;
+ }
+ }
+
+ /*
+ * @see CSSMetaModelProfileInfo#getProfileURL()
+ */
+ public URL getProfileURL() {
+ return fURL;
+ }
+
+ void setProfileName(String name) {
+ fName = name;
+ }
+
+ public boolean isDefault() {
+ return fDefault;
+ }
+
+ void setDefault(boolean isDefault) {
+ fDefault = isDefault;
+ }
+
+ public String getOwnerPluginID() {
+ return fOwnerPluginID;
+ }
+
+ void setOwnerPluginID(String pluginID) {
+ fOwnerPluginID = pluginID;
+ }
+
+ /**
+ * hidden option : logging
+ */
+ void setLogging(boolean logging) {
+ fLogging = logging;
+ }
+
+ boolean getLogging() {
+ return fLogging;
+ }
+
+
+ String fID = null;
+ String fName = null;
+ URL fURL = null;
+ CSSMetaModel fMetaModel = null;
+ String fOwnerPluginID = null;
+ boolean fDefault = false;
+ boolean fLogging = false;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileTest.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileTest.java
new file mode 100644
index 0000000000..f1b8777221
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/CSSProfileTest.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+
+
+class CSSProfileTest {
+
+
+ /**
+ * Test use only
+ */
+ public static void main(String[] args) {
+ if (args.length == 0)
+ return;
+ CSSMetaModel metamodel = null;
+ try {
+ CSSProfile profile = new CSSProfileImpl("test", new URL(args[0])); //$NON-NLS-1$
+ metamodel = profile.getMetaModel();
+ }
+ catch (MalformedURLException e) {
+ Logger.logException(e);
+ }
+ if (metamodel == null) {
+ return;
+ }
+ /*
+ * CSSMMTypeCollector collector = new CSSMMTypeCollector();
+ * collector.apply(metamodel, CSSMMNode.TYPE_PROPERTY); Iterator
+ * iProperty = collector.getNodes(); while (iProperty.hasNext()) {
+ * CSSMMNode node = (CSSMMNode)iProperty.next();
+ * System.out.println("Property " + node.getName() + " can contain:");
+ * //$NON-NLS-2$ //$NON-NLS-1$ Iterator iValue =
+ * node.getDescendants(); while (iValue.hasNext()) {
+ * debugOut((CSSMMNode)iValue.next(), 0, false); } }
+ */
+ debugOut(metamodel, 0, true);
+ }
+
+ static void debugOut(CSSMMNode node, int depth, boolean recursive) {
+ String type = node.getType();
+ for (int i = 0; i < depth; i++) {
+ System.out.print("\t"); //$NON-NLS-1$
+ }
+ System.out.print("[ " + node.getName() + "(" + type + ") ]"); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
+ if (type == CSSMMNode.TYPE_UNIT || type == CSSMMNode.TYPE_KEYWORD || type == CSSMMNode.TYPE_FUNCTION || type == CSSMMNode.TYPE_SELECTOR) {
+ System.out.print(" -> " + node.toString()); //$NON-NLS-1$
+ }
+ System.out.println();
+
+ if (recursive) {
+ java.util.Iterator iNode = node.getChildNodes();
+ while (iNode.hasNext()) {
+ debugOut((CSSMMNode) iNode.next(), depth + 1, true);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/MetaModelErrors.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/MetaModelErrors.java
new file mode 100644
index 0000000000..aaae5587f9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/MetaModelErrors.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+interface MetaModelErrors {
+
+ static final short NO_ERROR = 0;
+
+ // MASK
+ static final short MASK_WARNING = 0x1000;
+ static final short MASK_ERROR = 0x2000;
+
+ // ERROR
+ static final short ERROR_NOT_DEFINED = MASK_ERROR + 0x01;
+ static final short ERROR_INVALID_NAME = MASK_ERROR + 0x04;
+ static final short ERROR_INVAILD_CHILD = MASK_ERROR + 0x02;
+ static final short ERROR_NO_CHILD = MASK_ERROR + 0x08;
+ // static final short ERROR_NO_ESSENTIAL_CHILD = MASK_ERROR + 0x10
+
+ // WARNING
+ static final short WARNING_HAS_NO_CHILD = MASK_WARNING + 0x01;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/NodePool.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/NodePool.java
new file mode 100644
index 0000000000..635bf5bd07
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/NodePool.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.wst.css.core.internal.Logger;
+
+
+
+class NodePool {
+
+ NodePool() {
+ super();
+ initializeClassNameTable();
+ }
+
+ CSSMMNodeImpl getNode(String tagName, String nodeName) {
+ if (nodeName != null) {
+ nodeName = nodeName.toLowerCase();
+ }
+ String className = (String) classNames.get(tagName);
+ if (className == null) {
+ return null;
+ }
+ Map nodes = (Map) nodeRegistry.get(className);
+ if (nodes == null) {
+ nodes = new HashMap();
+ nodeRegistry.put(className, nodes);
+ }
+ CSSMMNodeImpl node = (CSSMMNodeImpl) nodes.get(nodeName);
+ if (node == null) {
+ node = createNewNode(className);
+ nodes.put(nodeName, node);
+ }
+ return node;
+ }
+
+ private CSSMMNodeImpl createNewNode(String className) {
+ CSSMMNodeImpl node = null;
+ if (className != null) {
+ className = getPackageName() + "." + className; //$NON-NLS-1$
+ try {
+ node = (CSSMMNodeImpl) Class.forName(className).newInstance();
+ }
+ catch (IllegalAccessException e) {
+ Logger.logException(e);
+ }
+ catch (InstantiationException e) {
+ Logger.logException(e);
+ }
+ catch (ClassNotFoundException e) {
+ Logger.logException(e);
+ }
+ }
+ // System.out.println(className + " is Created");
+ return node;
+ }
+
+ /**
+ * Error check function: find nodes that are not referred by any node
+ */
+ Iterator getStrayNodes() {
+ List strayNodes = new ArrayList();
+ Iterator iMap = nodeRegistry.values().iterator();
+ while (iMap.hasNext()) {
+ Map nodes = (Map) iMap.next();
+ Iterator iNode = nodes.values().iterator();
+ while (iNode.hasNext()) {
+ CSSMMNodeImpl node = (CSSMMNodeImpl) iNode.next();
+ if (node.getReferenceCount() == 0) {
+ strayNodes.add(node);
+ }
+ }
+ }
+ return strayNodes.iterator();
+ }
+
+ // This class must not be inner class :)
+ private String getPackageName() {
+ if (fPackageName == null) {
+ String className = getClass().getName();
+ int pos = className.lastIndexOf('.');
+ if (0 < pos) {
+ fPackageName = className.substring(0, pos);
+ }
+ else {
+ fPackageName = ""; //$NON-NLS-1$
+ }
+ }
+ return fPackageName;
+ }
+
+ void initializeClassNameTable() {
+ classNames.put(ProfileKeywords.STYLESHEET_DEF, CLASS_STYLE_SHEET);
+ classNames.put(ProfileKeywords.CHARSET_RULE_DEF, CLASS_CHARSET_RULE);
+ classNames.put(ProfileKeywords.CHARSET_RULE, CLASS_CHARSET_RULE);
+ classNames.put(ProfileKeywords.FONTFACE_RULE_DEF, CLASS_FONT_FACE_RULE);
+ classNames.put(ProfileKeywords.FONTFACE_RULE, CLASS_FONT_FACE_RULE);
+ classNames.put(ProfileKeywords.IMPORT_RULE_DEF, CLASS_IMPORT_RULE);
+ classNames.put(ProfileKeywords.IMPORT_RULE, CLASS_IMPORT_RULE);
+ classNames.put(ProfileKeywords.MEDIA_RULE_DEF, CLASS_MEDIA_RULE);
+ classNames.put(ProfileKeywords.MEDIA_RULE, CLASS_MEDIA_RULE);
+ classNames.put(ProfileKeywords.PAGE_RULE_DEF, CLASS_PAGE_RULE);
+ classNames.put(ProfileKeywords.PAGE_RULE, CLASS_PAGE_RULE);
+ classNames.put(ProfileKeywords.STYLE_RULE_DEF, CLASS_STYLE_RULE);
+ classNames.put(ProfileKeywords.STYLE_RULE, CLASS_STYLE_RULE);
+ classNames.put(ProfileKeywords.PROPERTY_DEF, CLASS_PROPERTY);
+ classNames.put(ProfileKeywords.PROPERTY, CLASS_PROPERTY);
+ classNames.put(ProfileKeywords.DESCRIPTOR_DEF, CLASS_DESCRIPTOR);
+ classNames.put(ProfileKeywords.DESCRIPTOR, CLASS_DESCRIPTOR);
+ classNames.put(ProfileKeywords.CONTAINER_DEF, CLASS_CONTAINER);
+ classNames.put(ProfileKeywords.CONTAINER, CLASS_CONTAINER);
+ classNames.put(ProfileKeywords.NUMBER_DEF, CLASS_NUMBER);
+ classNames.put(ProfileKeywords.NUMBER, CLASS_NUMBER);
+ classNames.put(ProfileKeywords.KEYWORD_DEF, CLASS_KEYWORD);
+ classNames.put(ProfileKeywords.KEYWORD, CLASS_KEYWORD);
+ classNames.put(ProfileKeywords.UNIT, CLASS_UNIT);
+ classNames.put(ProfileKeywords.UNIT_DEF, CLASS_UNIT);
+ classNames.put(ProfileKeywords.FUNCTION, CLASS_FUNCTION);
+ classNames.put(ProfileKeywords.FUNCTION_DEF, CLASS_FUNCTION);
+ classNames.put(ProfileKeywords.SELECTOR_EXPRESSION, CLASS_SELECTOR_EXPRESSION);
+ classNames.put(ProfileKeywords.PSEUDO_ELEMENT, CLASS_PSEUDO_ELEMENT);
+ classNames.put(ProfileKeywords.PSEUDO_ELEMENT_DEF, CLASS_PSEUDO_ELEMENT);
+ classNames.put(ProfileKeywords.PSEUDO_CLASS, CLASS_PSEUDO_CLASS);
+ classNames.put(ProfileKeywords.PSEUDO_CLASS_DEF, CLASS_PSEUDO_CLASS);
+ classNames.put(ProfileKeywords.STRING, CLASS_STRING);
+ classNames.put(ProfileKeywords.CATEGORY_DEF, CLASS_CATEGORY);
+ }
+
+
+ private String fPackageName;
+ /*
+ * Conversion Tables nodeRegistry : class name -> hash of node instances
+ * classNames : Profile Tag name -> java class name
+ */
+ private Map nodeRegistry = new HashMap();
+ private Map classNames = new HashMap();
+
+ private final static String CLASS_STYLE_SHEET = "CSSMMStyleSheetImpl"; //$NON-NLS-1$
+ private final static String CLASS_CHARSET_RULE = "CSSMMCharsetRuleImpl"; //$NON-NLS-1$
+ private final static String CLASS_FONT_FACE_RULE = "CSSMMFontFaceRuleImpl"; //$NON-NLS-1$
+ private final static String CLASS_IMPORT_RULE = "CSSMMImportRuleImpl"; //$NON-NLS-1$
+ private final static String CLASS_MEDIA_RULE = "CSSMMMediaRuleImpl"; //$NON-NLS-1$
+ private final static String CLASS_PAGE_RULE = "CSSMMPageRuleImpl"; //$NON-NLS-1$
+ private final static String CLASS_STYLE_RULE = "CSSMMStyleRuleImpl"; //$NON-NLS-1$
+ private final static String CLASS_PROPERTY = "CSSMMPropertyImpl"; //$NON-NLS-1$
+ private final static String CLASS_DESCRIPTOR = "CSSMMDescriptorImpl"; //$NON-NLS-1$
+ private final static String CLASS_CONTAINER = "CSSMMContainerImpl"; //$NON-NLS-1$
+ private final static String CLASS_NUMBER = "CSSMMNumberImpl"; //$NON-NLS-1$
+ private final static String CLASS_KEYWORD = "CSSMMKeywordImpl"; //$NON-NLS-1$
+ private final static String CLASS_UNIT = "CSSMMUnitImpl"; //$NON-NLS-1$
+ private final static String CLASS_FUNCTION = "CSSMMFunctionImpl"; //$NON-NLS-1$
+ private final static String CLASS_STRING = "CSSMMStringImpl"; //$NON-NLS-1$
+ private final static String CLASS_CATEGORY = "CSSMMCategoryImpl"; //$NON-NLS-1$
+ private final static String CLASS_SELECTOR_EXPRESSION = "CSSMMSelectorExpressionImpl"; //$NON-NLS-1$
+ private final static String CLASS_PSEUDO_CLASS = "CSSMMPseudoClassImpl"; //$NON-NLS-1$
+ private final static String CLASS_PSEUDO_ELEMENT = "CSSMMPseudoElementImpl"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileHandler.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileHandler.java
new file mode 100644
index 0000000000..c9481a66c5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileHandler.java
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Stack;
+
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMSelector;
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+import org.eclipse.wst.css.core.metamodel.CSSProfileRegistry;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+class ProfileHandler extends DefaultHandler {
+
+ public ProfileHandler(CSSMetaModelImpl metamodel, ResourceBundle resourceBundle, boolean logging) {
+ super();
+ fMetaModel = metamodel;
+ fNodePool = metamodel.getNodePool();
+ fResourceBundle = resourceBundle;
+ fLogging = logging;
+ }
+
+ public ProfileHandler(CSSMetaModelImpl metamodel, ResourceBundle resourceBundle) {
+ super();
+ fMetaModel = metamodel;
+ fNodePool = metamodel.getNodePool();
+ fResourceBundle = resourceBundle;
+ fLogging = false;
+ }
+
+ private String getResourceString(String key) {
+ if (key.equals("%")) { //$NON-NLS-1$
+ return key;
+ }
+ if (!key.startsWith("%")) { //$NON-NLS-1$
+ return key;
+ }
+ if (key.startsWith("%%")) { //$NON-NLS-1$
+ return key.substring(1);
+ }
+
+ if (fResourceBundle != null) {
+ return fResourceBundle.getString(key.substring(1));
+ }
+ else {
+ return key;
+ }
+ }
+
+ public void startDocument() throws SAXException {
+ // System.out.println("startDocument");
+ // fNodeStack.push(metamodel);
+ // fCurrentNode = null;
+ }
+
+ public void endDocument() throws SAXException {
+ new ErrorCorrector().doCorrect(fMetaModel);
+ if (fLogging) {
+ Iterator i = fNodePool.getStrayNodes();
+ while (i.hasNext()) {
+ CSSMMNode node = (CSSMMNode) i.next();
+ String str = "[CSSProfile Warning] " + node.getName(); //$NON-NLS-1$
+ str += "(" + node.getType() + ") is not referred by any node."; //$NON-NLS-1$ //$NON-NLS-2$
+ Logger.log(Logger.WARNING, str);
+ // System.out.println(str);
+ }
+ }
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ TagNode tagNode = null;
+ CSSMMNodeImpl parentNode = null;
+ if (0 < fNodeStack.size()) {
+ tagNode = (TagNode) fNodeStack.peek();
+ parentNode = tagNode.node;
+ }
+
+ CSSMMNodeImpl node = null;
+ if (qName.equals(ProfileKeywords.PROFILE_IMPORT)) { // import
+ String profileName = attributes.getValue(ATTR_NAME_REFERENCE);
+ importProfile(profileName);
+ }
+ else if (isDefinition(qName)) { // node creation
+ String nodeName = attributes.getValue(ATTR_NAME_DEFINITION);
+ node = fNodePool.getNode(qName, nodeName);
+ if (node != null) {
+ String overwrite = attributes.getValue(ATTR_OVERWRITE);
+ if (overwrite == null || overwrite.equals(ATTR_VALUE_OVERWRITE_FALSE)) {
+ node.removeAllChildNodes();
+ }
+ Map attrMap = new HashMap();
+ for (int i = 0; i < attributes.getLength(); i++) {
+ attrMap.put(attributes.getQName(i), attributes.getValue(i));
+ }
+ try {
+ node.initializeAttribute(attrMap);
+ }
+ catch (IllegalArgumentException e) {
+ Logger.logException(e);
+ }
+ }
+ }
+ else if (node == null) { // node reference
+ String nodeName = attributes.getValue(ATTR_NAME_REFERENCE);
+ node = fNodePool.getNode(qName, nodeName);
+ }
+
+ if (node != null) {
+ if (parentNode != null && parentNode.canContain(node)) {
+ String enabled = attributes.getValue(ATTR_ENABLED);
+ if (enabled != null && enabled.equals(ATTR_VALUE_ENABLED_FALSE)) {
+ parentNode.removeChild(node);
+ }
+ else {
+ parentNode.appendChild(node);
+ }
+ }
+ else if (node.getType() == CSSMMNode.TYPE_STYLE_SHEET || node.getType() == CSSMMNode.TYPE_CATEGORY) {
+ fMetaModel.appendChild(node);
+ }
+ else {
+ if (fLogging && parentNode != null) {
+ Logger.log(Logger.ERROR, parentNode.getType() + " cannot contain " + //$NON-NLS-1$
+ node.getType() + " (" + qName + ")"); //$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ }
+
+ fNodeStack.push(new TagNode(qName, (node != null) ? node : parentNode));
+ }
+
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ fNodeStack.pop();
+ }
+
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ TagNode tagNode = (TagNode) fNodeStack.peek();
+ String tagName = tagNode.tag;
+ if (tagName.equals(ProfileKeywords.KEYWORD_VALUE) || tagName.equals(ProfileKeywords.UNIT_VALUE) || tagName.equals(ProfileKeywords.FUNCTION_VALUE) || tagName.equals(ProfileKeywords.SELECTOR_VALUE) || tagName.equals(ProfileKeywords.DESCRIPTION) || tagName.equals(ProfileKeywords.CAPTION)) {
+ StringBuffer buf = new StringBuffer(length);
+ for (int i = 0; i < length; i++) {
+ buf.append(ch[start + i]);
+ }
+ String value = getResourceString(buf.toString().trim());
+ CSSMMNodeImpl node = tagNode.node;
+ if (node != null) {
+ if (node.getType() == CSSMMNode.TYPE_KEYWORD && tagName.equals(ProfileKeywords.KEYWORD_VALUE)) {
+ ((CSSMMKeywordImpl) node).setKeywordString(value);
+ }
+ else if (node.getType() == CSSMMNode.TYPE_UNIT && tagName.equals(ProfileKeywords.UNIT_VALUE)) {
+ ((CSSMMUnitImpl) node).setUnitString(value);
+ }
+ else if (node.getType() == CSSMMNode.TYPE_FUNCTION && tagName.equals(ProfileKeywords.FUNCTION_VALUE)) {
+ ((CSSMMFunctionImpl) node).setFunctionString(value);
+ }
+ else if (node.getType() == CSSMMNode.TYPE_SELECTOR && ((CSSMMSelector) node).getSelectorType() == CSSMMSelector.TYPE_PSEUDO_ELEMENT) {
+ ((CSSMMPseudoElementImpl) node).setSelectorString(value);
+ }
+ else if (node.getType() == CSSMMNode.TYPE_SELECTOR && ((CSSMMSelector) node).getSelectorType() == CSSMMSelector.TYPE_PSEUDO_CLASS) {
+ ((CSSMMPseudoClassImpl) node).setSelectorString(value);
+ }
+ else if (node.getType() == CSSMMNode.TYPE_CATEGORY && tagName.equals(ProfileKeywords.CAPTION)) {
+ ((CSSMMCategoryImpl) node).setCaption(value);
+ }
+ else if (tagName.equals(ProfileKeywords.DESCRIPTION)) {
+ node.setDescription(value);
+ }
+ }
+ }
+ }
+
+ private boolean isDefinition(String tagName) {
+ return (tagName.equals(ProfileKeywords.STYLESHEET_DEF) || tagName.equals(ProfileKeywords.CHARSET_RULE_DEF) || tagName.equals(ProfileKeywords.IMPORT_RULE_DEF) || tagName.equals(ProfileKeywords.PAGE_RULE_DEF) || tagName.equals(ProfileKeywords.MEDIA_RULE_DEF) || tagName.equals(ProfileKeywords.FONTFACE_RULE_DEF) || tagName.equals(ProfileKeywords.STYLE_RULE_DEF) || tagName.equals(ProfileKeywords.KEYWORD_DEF) || tagName.equals(ProfileKeywords.NUMBER_DEF) || tagName.equals(ProfileKeywords.PROPERTY_DEF) || tagName.equals(ProfileKeywords.DESCRIPTOR_DEF) || tagName.equals(ProfileKeywords.CONTAINER_DEF) || tagName.equals(ProfileKeywords.UNIT_DEF) || tagName.equals(ProfileKeywords.FUNCTION_DEF) || tagName.equals(ProfileKeywords.STRING) || tagName.equals(ProfileKeywords.CATEGORY_DEF) || tagName.equals(ProfileKeywords.PSEUDO_CLASS_DEF) || tagName.equals(ProfileKeywords.PSEUDO_ELEMENT_DEF) || tagName.equals(ProfileKeywords.SELECTOR_EXPRESSION) || tagName.equals(ProfileKeywords.SEPARATOR));
+ }
+
+ private void importProfile(String profileName) {
+ URL profileURL = null;
+ CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
+ CSSProfile profile = reg.getProfile(profileName);
+ if (profile != null) {
+ // first: find URL by ID
+ profileURL = profile.getProfileURL();
+ }
+ else {
+ // second: find URL by filename of profile URL
+ Iterator i = reg.getProfiles();
+ while (i.hasNext()) {
+ profile = (CSSProfile) i.next();
+ URL url = profile.getProfileURL();
+ if (url.getFile().endsWith(profileName)) {
+ profileURL = url;
+ break;
+ }
+ }
+ }
+ if (profileURL == null) {
+ // final: it may be url itself
+ try {
+ profileURL = new URL(profileName);
+ }
+ catch (MalformedURLException e) {
+ Logger.logException(e);
+ }
+ }
+ if (profileURL != null) {
+ try {
+ ProfileLoader.loadProfile(fMetaModel, profileURL.openStream(), fResourceBundle, fLogging);
+ }
+ catch (IOException e) {
+ Logger.logException("Cannot open stream for profile", //$NON-NLS-1$
+ e);
+ }
+ }
+ }
+
+ class TagNode {
+
+ String tag = null;
+ CSSMMNodeImpl node = null;
+
+ TagNode(String tag, CSSMMNodeImpl node) {
+ this.tag = tag;
+ this.node = node;
+ }
+ }
+
+ class ErrorCorrector {
+
+ void doCorrect(CSSMMNodeImpl node) {
+ Iterator i = node.getChildNodes();
+ while (i.hasNext()) {
+ CSSMMNodeImpl child = (CSSMMNodeImpl) i.next();
+ doCorrect(child);
+ short error = child.getError();
+ if (error != MetaModelErrors.NO_ERROR) {
+ node.removeChild(child);
+
+ String str = "[CSSProfile Error] " + node.getName(); //$NON-NLS-1$
+ str += "(" + node.getType() + ") contains error node: "; //$NON-NLS-1$ //$NON-NLS-2$
+ str += child.getName() + "(" + child.getType() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ str += " - error code = " + error; //$NON-NLS-1$
+ if (fLogging) {
+ Logger.log(Logger.ERROR, str);
+ // System.out.println(str);
+ }
+ }
+ }
+ }
+ }
+
+
+ private CSSMetaModelImpl fMetaModel = null;
+ private NodePool fNodePool = null;
+ private Stack fNodeStack = new Stack();
+ private boolean fLogging = false;
+ private ResourceBundle fResourceBundle = null;
+
+ private final static String ATTR_NAME_DEFINITION = "name"; //$NON-NLS-1$
+ private final static String ATTR_NAME_REFERENCE = "name"; //$NON-NLS-1$
+ private final static String ATTR_OVERWRITE = "overwrite"; //$NON-NLS-1$
+ private final static String ATTR_ENABLED = "enabled"; //$NON-NLS-1$
+ private final static String ATTR_VALUE_OVERWRITE_FALSE = "false"; //$NON-NLS-1$
+ private final static String ATTR_VALUE_ENABLED_FALSE = "false"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileKeywords.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileKeywords.java
new file mode 100644
index 0000000000..47f8dee96e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileKeywords.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+interface ProfileKeywords {
+
+ final static String CSS_PROFILE = "css-profile"; //$NON-NLS-1$
+ final static String PROFILE_IMPORT = "profile-import"; //$NON-NLS-1$
+ final static String STYLESHEET_DEF = "stylesheet-def"; //$NON-NLS-1$
+ final static String CHARSET_RULE = "charset-rule"; //$NON-NLS-1$
+ final static String IMPORT_RULE = "import-rule"; //$NON-NLS-1$
+ final static String PAGE_RULE = "page-rule"; //$NON-NLS-1$
+ final static String MEDIA_RULE = "media-rule"; //$NON-NLS-1$
+ final static String FONTFACE_RULE = "fontface-rule"; //$NON-NLS-1$
+ final static String STYLE_RULE = "style-rule"; //$NON-NLS-1$
+ final static String CHARSET_RULE_DEF = "charset-rule-def"; //$NON-NLS-1$
+ final static String IMPORT_RULE_DEF = "import-rule-def"; //$NON-NLS-1$
+ final static String PAGE_RULE_DEF = "page-rule-def"; //$NON-NLS-1$
+ final static String MEDIA_RULE_DEF = "media-rule-def"; //$NON-NLS-1$
+ final static String FONTFACE_RULE_DEF = "fontface-rule-def"; //$NON-NLS-1$
+ final static String STYLE_RULE_DEF = "style-rule-def"; //$NON-NLS-1$
+ final static String FUNCTION_DEF = "function-def"; //$NON-NLS-1$
+ final static String FUNCTION_VALUE = "function-value"; //$NON-NLS-1$
+ final static String KEYWORD_DEF = "keyword-def"; //$NON-NLS-1$
+ final static String KEYWORD_VALUE = "keyword-value"; //$NON-NLS-1$
+ final static String DESCRIPTION = "description"; //$NON-NLS-1$
+ final static String NUMBER_DEF = "number-def"; //$NON-NLS-1$
+ final static String UNIT = "unit"; //$NON-NLS-1$
+ final static String UNIT_DEF = "unit-def"; //$NON-NLS-1$
+ final static String UNIT_VALUE = "unit-value"; //$NON-NLS-1$
+ final static String CONTAINER_DEF = "container-def"; //$NON-NLS-1$
+ final static String CATEGORY_DEF = "category-def"; //$NON-NLS-1$
+ final static String CAPTION = "caption"; //$NON-NLS-1$
+ final static String PROPERTY_DEF = "property-def"; //$NON-NLS-1$
+ final static String DESCRIPTOR_DEF = "descriptor-def"; //$NON-NLS-1$
+ final static String SELECTOR_EXPRESSION = "selector-expression"; //$NON-NLS-1$
+ final static String PSEUDO_CLASS = "pseudo-class"; //$NON-NLS-1$
+ final static String PSEUDO_ELEMENT = "pseudo-element"; //$NON-NLS-1$
+ final static String PSEUDO_CLASS_DEF = "pseudo-class-def"; //$NON-NLS-1$
+ final static String PSEUDO_ELEMENT_DEF = "pseudo-element-def"; //$NON-NLS-1$
+ final static String SELECTOR_VALUE = "selector-value"; //$NON-NLS-1$
+ final static String NUMBER = "number"; //$NON-NLS-1$
+ final static String KEYWORD = "keyword"; //$NON-NLS-1$
+ final static String FUNCTION = "function"; //$NON-NLS-1$
+ final static String CONTAINER = "container"; //$NON-NLS-1$
+ final static String STRING = "string"; //$NON-NLS-1$
+ final static String SEPARATOR = "separator"; //$NON-NLS-1$
+ final static String PROPERTY = "property"; //$NON-NLS-1$
+ final static String DESCRIPTOR = "descriptor"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileLoader.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileLoader.java
new file mode 100644
index 0000000000..e1b5315376
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ProfileLoader.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ResourceBundle;
+
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+
+class ProfileLoader {
+
+
+ /**
+ * Constructor for ProfileLoader.
+ */
+ private ProfileLoader() {
+ super();
+ }
+
+ ProfileLoader(ResourceBundle resourceBundle, boolean logging) {
+ super();
+ fResourceBundle = resourceBundle;
+ fLogging = logging;
+ }
+
+ static void loadProfile(CSSMetaModelImpl metamodel, InputStream input, ResourceBundle resourceBundle, boolean logging) {
+ try {
+ XMLReader xmlReader = XMLReaderUtil.createXMLReader(PARSER_NAME);
+ // XMLReaderFactory.createXMLReader(PARSER_NAME);
+ xmlReader.setContentHandler(new ProfileHandler(metamodel, resourceBundle, logging));
+ xmlReader.parse(new InputSource(input));
+ }
+ catch (IOException e) {
+ Logger.logException(e);
+ }
+ catch (SAXException e) {
+ Logger.logException(e);
+ }
+ }
+
+ CSSMetaModel loadProfile(InputStream input) {
+ if (fMetaModel == null) {
+ fMetaModel = new CSSMetaModelImpl();
+ }
+ loadProfile(fMetaModel, input, fResourceBundle, fLogging);
+ fMetaModel.loadCompleted();
+ return fMetaModel;
+ }
+
+
+ CSSMetaModelImpl fMetaModel = null;
+ private final static String PARSER_NAME = "org.apache.xerces.parsers.SAXParser"; //$NON-NLS-1$
+ private ResourceBundle fResourceBundle = null;
+ private boolean fLogging = false;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/RegistryReader.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/RegistryReader.java
new file mode 100644
index 0000000000..aa28e70e31
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/RegistryReader.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IPluginRegistry;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+
+
+
+public class RegistryReader {
+
+ //
+ private String PLUGIN_ID = IModelManagerPlugin.ID; //$NON-NLS-1$
+ private String EXTENSION_POINT_ID = "cssprofile"; //$NON-NLS-1$
+ private String TAG_NAME = "profile"; //$NON-NLS-1$
+ private String ATT_ID = "id"; //$NON-NLS-1$
+ private String ATT_NAME = "name"; //$NON-NLS-1$
+ private String ATT_URI = "uri"; //$NON-NLS-1$
+ private String ATT_DEFAULT = "default"; //$NON-NLS-1$
+ private String ATT_LOGGING = "logging"; // Hidden Option //$NON-NLS-1$
+
+ /**
+ * Constructor for CSSMetaModelRegistryReader.
+ */
+ public RegistryReader() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected CSSProfile readElement(IConfigurationElement element) {
+ CSSProfileImpl info = null;
+ if (element.getName().equals(TAG_NAME)) {
+ String strID = element.getAttribute(ATT_ID);
+ String strNAME = element.getAttribute(ATT_NAME);
+ String strURI = element.getAttribute(ATT_URI);
+
+ if (strID != null || strURI != null) {
+ Plugin plugin = null;
+ IPluginDescriptor descriptor = element.getDeclaringExtension().getDeclaringPluginDescriptor();
+ try {
+ plugin = descriptor.getPlugin();
+ }
+ catch (CoreException e) {
+ // if an error occurs here, its probably that the plugin
+ // could not be found/loaded
+ // Logger.log("could not find plugin: " + descriptor, e);
+ // //$NON-NLS-1$
+ }
+ if (plugin != null) {
+ Path path = new Path(strURI);
+ URL url = plugin.find(path);
+ if (url != null) {
+ try {
+ url = Platform.asLocalURL(url);
+ info = new CSSProfileImpl(strID, url);
+ info.setProfileName(strNAME);
+ info.setDefault((element.getAttribute(ATT_DEFAULT) != null));
+ info.setLogging((element.getAttribute(ATT_LOGGING) != null));
+ info.setOwnerPluginID(descriptor.getUniqueIdentifier());
+ }
+ catch (java.io.IOException e) {
+ // through
+ }
+ }
+ }
+ }
+
+ if (info == null) {
+ Logger.log(Logger.ERROR, "Error reading CSS Profile: " + strID); //$NON-NLS-1$
+ }
+ }
+ return info;
+ }
+
+ /**
+ * We simply require an 'add' method, of what ever it is we are to read
+ * into
+ */
+ public Iterator enumProfiles() {
+ Set set = new HashSet();
+ IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
+ IExtensionPoint point = pluginRegistry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);
+ if (point != null) {
+ IConfigurationElement[] elements = point.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ CSSProfile info = readElement(elements[i]);
+ // null can be returned if there's an error reading the
+ // element
+ if (info != null) {
+ set.add(info);
+ }
+ }
+ }
+ return set.iterator();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ValueCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ValueCollector.java
new file mode 100644
index 0000000000..e92f3993fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/ValueCollector.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelTraverser;
+
+
+
+class ValueCollector extends CSSMetaModelTraverser {
+ public void begin(CSSMMNode node) {
+ fNodes = new ArrayList();
+ }
+
+ protected short preNode(CSSMMNode node) {
+ short rc = TRAV_CONT;
+ if (node != null) {
+ String type = node.getType();
+ if (type == CSSMMNode.TYPE_PROPERTY || type == CSSMMNode.TYPE_DESCRIPTOR || type == CSSMMNode.TYPE_CONTAINER) {
+ rc = TRAV_CONT;
+ }
+ else {
+ if (!fNodes.contains(node)) {
+ fNodes.add(node);
+ rc = TRAV_PRUNE;
+ }
+ }
+ }
+ return rc;
+ }
+
+ public Iterator getNodes() {
+ return fNodes.iterator();
+ }
+
+
+ private List fNodes = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/XMLReaderUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/XMLReaderUtil.java
new file mode 100644
index 0000000000..a22aa7cfd9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/metamodel/XMLReaderUtil.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.metamodel;
+
+
+
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.wst.css.core.internal.Logger;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+class XMLReaderUtil {
+
+ static public XMLReader createXMLReader(String className) throws SAXException {
+ try {
+ return SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+ }
+ catch (ParserConfigurationException e) {
+ Logger.logException(e);
+ }
+ catch (FactoryConfigurationError e) {
+ Logger.logException(e);
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/nls/ResourceHandler.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/nls/ResourceHandler.java
new file mode 100644
index 0000000000..18b6491de2
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/nls/ResourceHandler.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.nls;
+
+
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ResourceHandler {
+
+
+ private static ResourceBundle fgResourceBundle;
+
+ /**
+ * Returns the resource bundle used by all classes in this Project
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("ModelsCSS");//$NON-NLS-1$
+ }
+ catch (MissingResourceException e) {
+ // does nothing - this method will return null and
+ // getString(String) will return the key
+ // it was called with
+ }
+ return null;
+ }
+
+ public static String getString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle = getResourceBundle();
+ }
+
+ if (fgResourceBundle != null) {
+ try {
+ return fgResourceBundle.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ else {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+
+ public static String getString(String key, Object[] args) {
+
+ try {
+ return MessageFormat.format(getString(key), args);
+ }
+ catch (IllegalArgumentException e) {
+ return getString(key);
+ }
+
+ }
+
+ public static String getString(String key, Object[] args, int x) {
+
+ return getString(key);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSRegionUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSRegionUtil.java
new file mode 100644
index 0000000000..ace7fa6f6f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSRegionUtil.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.parser;
+
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+
+
+public class CSSRegionUtil {
+
+ /**
+ */
+ public static boolean isDeclarationValueType(String type) {
+ return (type == CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION || type == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION || type == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH || type == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || type == CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT || type == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR || type == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE || type == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE || type == CSSRegionContexts.CSS_DECLARATION_VALUE_S || type == CSSRegionContexts.CSS_DECLARATION_VALUE_STRING || type == CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE || type == CSSRegionContexts.CSS_DECLARATION_VALUE_URI);
+ }
+
+ /**
+ * these type can be beggining of selector
+ */
+ public static boolean isSelectorBegginingType(String type) {
+ return (type == CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME || type == CSSRegionContexts.CSS_SELECTOR_UNIVERSAL || type == CSSRegionContexts.CSS_SELECTOR_PSEUDO || type == CSSRegionContexts.CSS_SELECTOR_CLASS || type == CSSRegionContexts.CSS_SELECTOR_ID || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START);
+ }
+
+
+ /**
+ *
+ * @param type
+ * @return
+ */
+ public static boolean isDeclarationType(String type) {
+ return (type == CSSRegionContexts.CSS_DECLARATION_PROPERTY || type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR || isDeclarationValueType(type) || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER);
+ }
+
+ /**
+ * These types consist selector region
+ *
+ * @param type
+ * @return
+ */
+ public static boolean isSelectorType(String type) {
+ return (type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE || type == CSSRegionContexts.CSS_SELECTOR_CLASS || type == CSSRegionContexts.CSS_SELECTOR_COMBINATOR || type == CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME || type == CSSRegionContexts.CSS_SELECTOR_ID || type == CSSRegionContexts.CSS_SELECTOR_PSEUDO || type == CSSRegionContexts.CSS_SELECTOR_SEPARATOR || type == CSSRegionContexts.CSS_SELECTOR_UNIVERSAL);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSSourceParser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSSourceParser.java
new file mode 100644
index 0000000000..1d1337f5f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSSourceParser.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.parser;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.util.Debug;
+
+
+public class CSSSourceParser implements RegionParser {
+ public static final int MODE_STYLESHEET = 0;
+ public static final int MODE_DECLARATION = 1;
+ public static final int MODE_DECLARATION_VALUE = 2;
+
+ private long fStartTime;
+ private long fStopTime;
+ private CSSTokenizer fTokenizer;
+
+ public void setParserMode(int mode) {
+ int initialState;
+ int bufsize;
+ switch (mode) {
+ case MODE_STYLESHEET :
+ initialState = CSSTokenizer.YYINITIAL;
+ bufsize = CSSTokenizer.BUFFER_SIZE_NORMAL;
+ break;
+ case MODE_DECLARATION :
+ initialState = CSSTokenizer.ST_DECLARATION;
+ bufsize = CSSTokenizer.BUFFER_SIZE_NORMAL;
+ break;
+ case MODE_DECLARATION_VALUE :
+ initialState = CSSTokenizer.ST_DECLARATION_PRE_VALUE;
+ bufsize = CSSTokenizer.BUFFER_SIZE_SMALL;
+ break;
+ default :
+ return;
+ }
+ if (0 < initialState) {
+ CSSTokenizer tokenizer = getTokenizer();
+ tokenizer.setInitialState(initialState);
+ tokenizer.setInitialBufferSize(bufsize);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#getNodes()
+ */
+ public IStructuredDocumentRegion getDocumentRegions() {
+ IStructuredDocumentRegion headnode = null;
+ if (headnode == null) {
+ if (Debug.perfTest) {
+ fStartTime = System.currentTimeMillis();
+ }
+ headnode = parseNodes();
+ if (Debug.perfTest) {
+ fStopTime = System.currentTimeMillis();
+ System.out.println(" -- creating nodes of IStructuredDocument -- "); //$NON-NLS-1$
+ System.out.println(" Time parse and init all regions: " + (fStopTime - fStartTime) + " (msecs)"); //$NON-NLS-2$//$NON-NLS-1$
+ // System.out.println(" for " + fRegions.size() + "
+ // Regions");//$NON-NLS-2$//$NON-NLS-1$
+ System.out.println(" and " + _countNodes(headnode) + " Nodes"); //$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ return headnode;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#getRegions()
+ */
+ public List getRegions() {
+ IStructuredDocumentRegion headNode = null;
+ if (!getTokenizer().isEOF()) {
+ headNode = getDocumentRegions();
+ // throw new IllegalStateException("parsing has not finished");
+ }
+ // for memory recovery, we assume if someone
+ // requests all regions, we can reset our big
+ // memory consuming objects
+ // but the new "getRegions" method is then more expensive.
+ // I don't think its used much, though.
+ List localRegionsList = getRegions(headNode);
+ primReset();
+ return localRegionsList;
+ }
+
+ /**
+ * Method getRegions.
+ *
+ * @param headNode
+ * @return List
+ */
+ protected List getRegions(IStructuredDocumentRegion headNode) {
+ List allRegions = new ArrayList();
+ IStructuredDocumentRegion currentNode = headNode;
+ while (currentNode != null) {
+ ITextRegionList nodeRegions = currentNode.getRegions();
+ for (int i = 0; i < nodeRegions.size(); i++) {
+ allRegions.add(nodeRegions.get(i));
+ }
+ currentNode = currentNode.getNext();
+ }
+ return allRegions;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#reset(java.io.Reader)
+ */
+ public void reset(Reader reader) {
+ primReset();
+ getTokenizer().reset(reader, 0);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#reset(java.io.Reader, int)
+ */
+ public void reset(Reader reader, int offset) {
+ reset(reader);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#reset(java.lang.String)
+ */
+ public void reset(String input) {
+ reset(new StringReader(input));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#reset(java.lang.String, int)
+ */
+ public void reset(String input, int offset) {
+ reset(input);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.parser.RegionParser#newInstance()
+ */
+ public RegionParser newInstance() {
+ return new CSSSourceParser();
+ }
+
+ private IStructuredDocumentRegion parseNodes() {
+ // regions are initially reported as complete offsets within the
+ // scanned input
+ // they are adjusted here to be indexes from the currentNode's start
+ // offset
+ IStructuredDocumentRegion headNode = null;
+ IStructuredDocumentRegion lastNode = null;
+ ITextRegion region = null;
+ IStructuredDocumentRegion currentNode = null;
+ String type = null;
+ String currentRegionType = null;
+
+ while ((region = getNextRegion()) != null) {
+ type = region.getType();
+ if (mustBeStart(type, currentRegionType) && currentNode != null) {
+ currentNode.setEnded(true);
+ }
+
+ if ((currentNode != null && currentNode.isEnded()) || currentNode == null) {
+ if (currentNode != null && !currentNode.isEnded()) {
+ currentNode.setEnded(true);
+ }
+ lastNode = currentNode;
+ currentNode = createStructuredDocumentRegion(type);
+ currentRegionType = type;
+ if (lastNode != null) {
+ lastNode.setNext(currentNode);
+ }
+ currentNode.setPrevious(lastNode);
+ currentNode.setStart(region.getStart());
+ }
+
+ currentNode.addRegion(region);
+ currentNode.setLength(region.getStart() + region.getLength() - currentNode.getStart());
+ region.adjustStart(-currentNode.getStart());
+
+ if (mustBeEnd(type)) {
+ currentNode.setEnded(true);
+ }
+
+ if (headNode == null && currentNode != null) {
+ headNode = currentNode;
+ }
+ }
+
+ if (currentNode != null && !currentNode.isEnded()) {
+ currentNode.setEnded(true);
+ }
+
+ primReset();
+ return headNode;
+ }
+
+ private IStructuredDocumentRegion createStructuredDocumentRegion(String type) {
+ return CSSStructuredDocumentRegionFactory.createRegion(type);
+ }
+
+ private boolean mustBeStart(String type, String docRegionType) {
+ return ((type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_LBRACE || type == CSSRegionContexts.CSS_RBRACE || type == CSSRegionContexts.CSS_IMPORT || type == CSSRegionContexts.CSS_PAGE || type == CSSRegionContexts.CSS_MEDIA || type == CSSRegionContexts.CSS_FONT_FACE || type == CSSRegionContexts.CSS_CHARSET || type == CSSRegionContexts.CSS_ATKEYWORD || type == CSSRegionContexts.CSS_DECLARATION_PROPERTY || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) || (docRegionType == CSSRegionContexts.CSS_DECLARATION_PROPERTY && type == CSSRegionContexts.CSS_S) || (!CSSRegionUtil.isSelectorBegginingType(docRegionType) && (type == CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME || type == CSSRegionContexts.CSS_SELECTOR_UNIVERSAL || type == CSSRegionContexts.CSS_SELECTOR_PSEUDO || type == CSSRegionContexts.CSS_SELECTOR_CLASS || type == CSSRegionContexts.CSS_SELECTOR_ID || type == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START)));
+ }
+
+ private boolean mustBeEnd(String type) {
+ return (type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_LBRACE || type == CSSRegionContexts.CSS_RBRACE || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER);
+ }
+
+ private ITextRegion getNextRegion() {
+ ITextRegion region = null;
+ try {
+ region = getTokenizer().getNextToken();
+ // DMW: 2/12/03 Removed state
+ // if (region != null) {
+ // fRegions.add(region);
+ // }
+ return region;
+ }
+ catch (StackOverflowError e) {
+ Logger.logException(getClass().getName() + ": input could not be parsed correctly at position " + getTokenizer().getOffset(), e); //$NON-NLS-1$
+ throw e;
+ }
+ catch (Exception e) {
+ Logger.logException(getClass().getName() + ": input could not be parsed correctly at position " + getTokenizer().getOffset() + " (" + e.getLocalizedMessage() + ")", e); //$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ }
+ return null;
+ }
+
+ private void primReset() {
+
+ getTokenizer().reset(new char[0]);
+ }
+
+ private CSSTokenizer getTokenizer() {
+ if (fTokenizer == null) {
+ fTokenizer = new CSSTokenizer();
+ }
+ return fTokenizer;
+ }
+
+
+ /**
+ * This is a simple utility to count nodes. Used only for debug
+ * statements.
+ */
+ private int _countNodes(IStructuredDocumentRegion nodes) {
+ int result = 0;
+ IStructuredDocumentRegion countNode = nodes;
+ while (countNode != null) {
+ result++;
+ countNode = countNode.getNext();
+ }
+ return result;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSStructuredDocumentRegionFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSStructuredDocumentRegionFactory.java
new file mode 100644
index 0000000000..cd90d9f724
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSStructuredDocumentRegionFactory.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.parser;
+
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+public class CSSStructuredDocumentRegionFactory {
+ public static IStructuredDocumentRegion createRegion(String type) {
+ IStructuredDocumentRegion instance = null;
+ if (type != null) {
+ instance = new BasicStructuredDocumentRegion();
+ }
+ else {
+
+ }
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSTokenizer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSTokenizer.java
new file mode 100644
index 0000000000..b5318f3e72
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/CSSTokenizer.java
@@ -0,0 +1,1220 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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
+ *******************************************************************************/
+/* The following code was generated by JFlex 1.2.2 on 04/10/01 22:53 */
+
+/*nlsXXX*/
+package org.eclipse.wst.css.core.internal.parser;
+
+import java.io.CharArrayReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.css.core.internal.parser.regions.CSSTextRegionFactory;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+
+/**
+ * This class is a scanner generated by <a
+ * href="http://www.informatik.tu-muenchen.de/~kleing/jflex/">JFlex </a> 1.2.2
+ */
+public class CSSTokenizer implements CSSRegionContexts {
+
+ /** this character denotes the end of file */
+ final public static int YYEOF = -1;
+
+ /** lexical states */
+ final public static int ST_SELECTOR_ATTRIBUTE_NAME = 11;
+ final public static int ST_IMPORT_DELIMITER = 5;
+ final public static int ST_DECLARATION_PRE_VALUE = 17;
+ final public static int ST_SELECTOR = 0;
+ final public static int ST_CHARSET_DELIMITER = 2;
+ final public static int ST_DECLARATION_VALUE = 18;
+ final public static int ST_PAGE_PSEUDO_PAGE = 8;
+ final public static int ST_IMPORT_URI = 3;
+ final public static int ST_SELECTOR_ATTRIBUTE_END = 14;
+ final public static int ST_SELECTOR_ATTRIBUTE_OPERATOR = 12;
+ final public static int ST_DECLARATION = 15;
+ final public static int ST_PAGE_DELIMITER = 9;
+ final public static int ST_SELECTOR_ATTRIBUTE_VALUE = 13;
+ final public static int ST_MEDIA_MEDIUM = 6;
+ final public static int ST_CHARSET_NAME = 1;
+ final public static int ST_IMPORT_MEDIUM = 4;
+ final public static int ST_DECLARATION_SEPARATOR = 16;
+ final public static int ST_FONT_FACE_DELIMITER = 9;
+ final public static int ST_MEDIA_DELIMITER = 7;
+ final public static int ST_SELECTOR_MODIFIER = 10;
+ final public static int YYINITIAL = 0;
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static String yycmap_packed = "\11\0\1\11\1\17\1\0\1\4\1\20\22\0\1\6\1\31\1\10" + "\1\22\1\16\1\72\1\16\1\5\1\26\1\12\1\35\1\14\1\55" + "\1\13\1\15\1\34\12\1\1\62\1\50\1\30\1\67\1\32\1\21" + "\1\36\1\43\1\27\1\40\1\57\1\46\1\64\1\61\1\41\1\51" + "\2\2\1\25\1\52\1\65\1\54\1\53\1\2\1\24\1\44\1\47" + "\1\23\5\2\1\66\1\3\1\71\1\16\1\2\1\16\1\42\1\7" + "\1\37\1\56\1\45\1\63\1\61\1\41\1\51\2\2\1\25\1\52" + "\1\65\1\54\1\53\1\2\1\24\1\44\1\47\1\23\5\2\1\60" + "\1\70\1\33\1\70\1\0\uff80\2";
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
+
+ /**
+ * Translates a state to a row index in the transition table
+ */
+ final private static int yy_rowMap[] = {0, 59, 118, 177, 236, 295, 354, 413, 472, 531, 590, 649, 708, 767, 826, 885, 944, 1003, 1062, 1121, 1180, 1239, 1298, 1357, 1416, 1475, 1534, 1121, 1593, 1121, 1652, 1711, 1121, 1770, 1829, 1888, 1121, 1947, 2006, 2065, 2124, 2183, 2242, 1121, 2301, 2360, 2419, 1121, 1121, 2478, 2537, 2596, 1121, 2655, 2714, 1121, 1121, 2773, 2832, 2891, 1121, 2950, 1121, 3009, 3068, 3127, 3186, 3245, 3304, 3363, 3422, 1121, 1121, 3481, 3540, 3599, 3658, 3717, 1121, 3776, 3835, 3894, 3953, 4012, 4071, 1593, 1121, 4130, 1239, 4189, 4248, 1416, 4307, 1475, 4366, 4425, 4484, 4543, 4602, 4661, 4720, 4779, 4838, 4897, 1770, 4956, 1121, 1829, 5015, 5074, 1947, 5133, 1121, 2006, 5192, 5251, 2183, 5310, 5369, 2360, 5428, 5487, 2537, 5546, 5605, 1121, 2714, 2832, 5664, 5723, 3068, 5782, 3127, 5841, 1121, 3186, 5900, 5959, 3363, 6018, 6077, 6136, 6195, 3894, 1121, 3599, 1121, 6254, 3658, 6313, 1121, 3717, 6372, 6431, 6490, 6549, 3953, 6608, 6667, 6726, 4071, 6785,
+ 1121, 4130, 6844, 1121, 6903, 6962, 7021, 7080, 7139, 7198, 7257, 7316, 7375, 7434, 7493, 7552, 1770, 7611, 7670, 1829, 7729, 7788, 1947, 7847, 7906, 2006, 7965, 8024, 8083, 8142, 8201, 8260, 8319, 8378, 3127, 8437, 8496, 3186, 8555, 8614, 8673, 8732, 8791, 3658, 8850, 8909, 3717, 8968, 9027, 9086, 9145, 9204, 9263, 9322, 9381, 1121, 1121, 9440, 9499, 9558, 9617, 9676, 9735, 9794, 9853, 9912, 9971, 10030, 10089, 10148, 10207, 10266, 10325, 10384, 10443, 10502, 10561, 10620, 10679, 10738, 10797, 10856, 10915, 10974, 11033, 11092, 11151, 11210, 11269, 11328, 11387, 11446, 11505, 1121, 11564, 11623, 1121, 11682, 11741, 11800, 11859, 11918, 11977, 12036, 12095, 12154, 12213, 1121, 12272, 12331, 12390, 12449, 12508, 12567, 12626, 12685, 12744, 12803, 12862, 12921, 12980, 13039, 13098, 13157, 13216, 11092, 13275, 13334, 1121, 13393, 13452, 13511, 13570, 13629, 13688, 1121, 13747, 13806, 13865, 13924, 13983, 14042, 14101, 14160, 14219, 12036, 14278, 14337, 14396, 14455,
+ 14514, 14573, 14632, 14691, 14750, 14809, 14868, 14927, 14986, 15045, 15104, 15163, 15222, 15281, 15340, 13157, 15399, 15458, 15517, 15576, 15635, 15694, 15753, 1121, 15812, 15871, 15930, 15989, 16048, 16107, 16166, 16225, 16284, 16343, 16402, 16461, 16520, 16579, 16638, 16697, 16756, 16815, 16874, 16933, 16992, 17051, 17110, 17169, 17228, 17287, 17346, 17405, 17464, 17523, 17582, 17641, 17700, 17759, 17818, 17877, 17936, 17995, 18054, 1121, 18113, 18172, 18231, 18290, 18349, 18408, 18467, 18526, 18585, 12154, 18644, 12213, 18703, 18762, 18821, 18880, 18939, 18998, 19057, 19116, 19175, 19234, 13275, 19293, 13334, 19352, 19411, 19470, 19529, 19588, 19647, 19706, 19765, 19824, 19883, 19942, 1121, 20001, 20060, 20119, 20178, 1121, 20237, 20296, 20355, 1121, 20414, 20473, 20532, 20591, 20650, 20709, 20768, 20827, 20886, 20945};
+
+ /**
+ * The packed transition table of the DFA
+ */
+ final private static String yy_packed = "\2\24\1\25\1\26\1\27\1\24\1\27\1\25\1\24" + "\1\27\1\24\1\30\1\24\1\31\1\24\2\27\1\24" + "\1\32\3\25\1\24\1\25\1\33\2\24\1\34\1\35" + "\1\36\1\37\11\25\1\24\4\25\1\24\2\25\1\24" + "\1\25\1\40\3\25\1\41\10\24\1\27\1\42\1\27" + "\1\24\1\43\1\27\1\24\1\44\3\24\2\27\7\24" + "\1\33\2\24\1\34\1\35\1\24\1\37\40\24\1\27" + "\1\24\1\27\2\24\1\27\1\24\1\44\3\24\2\27" + "\7\24\1\33\2\24\1\34\1\35\1\24\1\37\11\24" + "\1\45\26\24\1\27\1\46\1\27\1\24\1\47\1\27" + "\1\24\1\44\3\24\2\27\2\24\1\50\4\24\1\33" + "\2\24\1\34\1\35\1\24\1\37\11\24\1\45\24\24" + "\1\51\1\52\1\27\1\24\1\27\1\51\1\24\1\27" + "\1\24\1\53\3\24\2\27\2\24\3\51\1\24\1\51" + "\1\33\2\24\1\34\1\35\1\24\1\37\11\51\1\45" + "\4\51\1\24\2\51\1\24\1\51\1\24\3\51\11\24" + "\1\27\1\24\1\27\2\24\1\27\1\24\1\44\3\24" + "\2\27\7\24\1\33\2\24\1\34\1\35\1\24\1\37" + "\11\24\1\45\4\24\1\54\17\24\1\55\1\56\1\27" + "\1\24\1\27\1\55\1\24\1\27\1\24\1\57\3\24" + "\2\27\2\24\3\55\1\24\1\55\1\33\2\24\1\34"
+ + "\1\35\1\24\1\37\11\55\1\24\4\55\1\24\2\55" + "\1\24\1\55\1\24\3\55\11\24\1\27\1\24\1\27" + "\2\24\1\27\1\24\1\44\3\24\2\27\7\24\1\33" + "\2\24\1\34\1\35\1\24\1\37\16\24\1\60\2\24" + "\1\61\14\24\1\62\1\63\1\27\1\24\1\27\1\62" + "\1\24\1\27\1\24\1\64\3\24\2\27\2\24\3\62" + "\1\24\1\62\1\33\2\24\1\34\1\35\1\24\1\37" + "\11\62\1\24\4\62\1\24\2\62\1\65\1\62\1\66" + "\3\62\11\24\1\27\1\24\1\27\2\24\1\27\1\24" + "\1\44\3\24\2\27\7\24\1\33\2\24\1\34\1\35" + "\1\24\1\37\21\24\1\65\16\24\1\67\1\24\1\67" + "\2\24\1\67\1\24\1\44\1\70\1\31\1\24\2\67" + "\1\24\1\32\5\24\1\33\1\24\1\70\1\34\1\35" + "\1\36\1\37\16\24\1\71\2\24\1\65\1\24\1\40" + "\3\24\1\41\6\24\1\72\1\73\1\27\1\24\1\27" + "\1\72\1\24\1\27\1\24\1\74\3\24\2\27\2\24" + "\3\72\1\24\1\72\1\33\2\24\1\34\1\35\1\24" + "\1\37\11\72\1\24\4\72\1\24\2\72\1\24\1\72" + "\1\24\3\72\11\24\1\27\1\24\1\27\2\24\1\27" + "\1\24\1\44\3\24\2\27\7\24\1\33\2\24\1\34" + "\1\35\1\24\1\37\30\24\1\75\1\76\1\77\3\24"
+ + "\1\100\1\101\1\27\1\102\1\27\1\100\1\103\1\27" + "\1\24\1\104\3\24\2\27\2\24\3\100\1\24\1\100" + "\1\33\2\24\1\34\1\35\1\24\1\37\11\100\1\24" + "\4\100\1\24\2\100\1\24\1\100\1\24\3\100\11\24" + "\1\27\1\24\1\27\2\24\1\27\1\24\1\44\3\24" + "\2\27\7\24\1\33\2\24\1\34\1\35\1\24\1\37" + "\32\24\1\77\3\24\1\105\1\106\1\27\1\24\1\27" + "\1\105\1\24\1\27\1\24\1\107\3\24\2\27\2\24" + "\3\105\1\24\1\105\1\33\2\24\1\34\1\35\1\24" + "\1\37\11\105\1\110\4\105\1\24\2\105\1\24\1\105" + "\1\24\3\105\11\24\1\27\1\24\1\27\2\24\1\27" + "\1\24\1\44\3\24\2\27\7\24\1\33\2\24\1\34" + "\1\35\1\24\1\37\11\24\1\110\11\24\1\111\11\24" + "\1\112\1\113\1\114\1\27\1\115\1\27\1\113\1\116" + "\1\27\1\117\1\120\1\121\1\122\1\24\2\27\1\24" + "\1\123\1\124\2\113\1\24\1\113\1\33\1\125\1\24" + "\1\34\1\126\1\24\1\37\11\113\1\110\4\113\1\127" + "\2\113\1\24\1\113\1\24\3\113\6\24\1\112\1\113" + "\1\114\1\130\1\115\1\130\1\113\1\116\1\130\1\117" + "\1\120\1\121\1\122\1\24\2\130\1\24\1\123\1\124"
+ + "\2\113\1\24\1\113\1\33\1\125\1\24\1\34\1\126" + "\1\24\1\37\11\113\1\110\4\113\1\127\2\113\1\24" + "\1\113\1\24\3\113\5\24\74\0\2\25\1\131\3\0" + "\1\25\3\0\1\25\7\0\3\25\1\0\1\25\7\0" + "\11\25\1\0\4\25\1\0\2\25\1\0\1\25\1\0" + "\3\25\6\0\1\132\2\25\1\0\2\25\1\132\1\25" + "\1\0\5\25\2\0\16\25\1\132\2\25\1\132\2\25" + "\1\132\10\25\1\132\4\25\1\132\7\25\4\0\1\27" + "\1\0\1\27\2\0\1\27\5\0\2\27\53\0\2\25" + "\1\131\3\0\1\25\3\0\1\133\7\0\3\25\1\0" + "\1\25\7\0\11\25\1\0\4\25\1\0\2\25\1\0" + "\1\25\1\0\3\25\6\0\2\134\1\135\3\0\1\134" + "\3\0\1\134\7\0\3\134\1\0\1\134\7\0\11\134" + "\1\0\4\134\1\0\2\134\1\0\1\134\1\0\3\134" + "\6\0\2\136\1\137\3\0\1\136\3\0\1\136\7\0" + "\3\136\1\0\1\136\7\0\11\136\1\0\4\136\1\0" + "\2\136\1\0\1\136\1\0\3\136\36\0\1\140\76\0" + "\1\141\74\0\2\142\10\0\1\143\1\144\1\145\7\0" + "\2\146\10\0\1\147\1\150\3\0\1\147\3\0\1\147" + "\7\0\3\147\1\0\1\147\7\0\11\147\1\0\4\147" + "\1\0\2\147\1\0\1\147\1\0\3\147\6\0\2\151"
+ + "\1\152\1\0\1\153\11\151\2\0\52\151\1\0\2\154" + "\1\155\1\0\3\154\1\153\6\154\2\0\52\154\13\0" + "\1\156\60\0\2\157\1\160\1\0\1\161\11\157\2\0" + "\52\157\1\0\2\162\1\163\1\0\3\162\1\161\6\162" + "\2\0\52\162\24\0\1\164\47\0\2\51\1\165\3\0" + "\1\51\3\0\1\51\7\0\3\51\1\0\1\51\7\0" + "\11\51\1\0\4\51\1\0\2\51\1\0\1\51\1\0" + "\3\51\6\0\1\166\2\51\1\0\2\51\1\166\1\51" + "\1\0\5\51\2\0\16\51\1\166\2\51\1\166\2\51" + "\1\166\10\51\1\166\4\51\1\166\7\51\1\0\2\51" + "\1\165\3\0\1\51\3\0\1\167\7\0\3\51\1\0" + "\1\51\7\0\11\51\1\0\4\51\1\0\2\51\1\0" + "\1\51\1\0\3\51\6\0\2\55\1\170\3\0\1\55" + "\3\0\1\55\7\0\3\55\1\0\1\55\7\0\11\55" + "\1\0\4\55\1\0\2\55\1\0\1\55\1\0\3\55" + "\6\0\1\171\2\55\1\0\2\55\1\171\1\55\1\0" + "\5\55\2\0\16\55\1\171\2\55\1\171\2\55\1\171" + "\10\55\1\171\4\55\1\171\7\55\1\0\2\55\1\170" + "\3\0\1\55\3\0\1\172\7\0\3\55\1\0\1\55" + "\7\0\11\55\1\0\4\55\1\0\2\55\1\0\1\55" + "\1\0\3\55\6\0\2\62\1\173\3\0\1\62\3\0"
+ + "\1\62\7\0\3\62\1\0\1\62\7\0\11\62\1\0" + "\4\62\1\0\2\62\1\0\1\62\1\0\3\62\6\0" + "\1\174\2\62\1\0\2\62\1\174\1\62\1\0\5\62" + "\2\0\16\62\1\174\2\62\1\174\2\62\1\174\10\62" + "\1\174\4\62\1\174\7\62\1\0\2\62\1\173\3\0" + "\1\62\3\0\1\175\7\0\3\62\1\0\1\62\7\0" + "\11\62\1\0\4\62\1\0\2\62\1\0\1\62\1\0" + "\3\62\7\0\1\62\1\173\3\0\1\62\3\0\1\62" + "\7\0\3\62\1\0\1\62\7\0\11\62\1\0\4\62" + "\1\0\2\62\1\0\1\62\1\0\3\62\5\0\4\176" + "\1\177\1\176\1\177\2\176\1\177\2\176\1\0\2\176" + "\2\177\11\176\1\0\25\176\1\0\12\176\1\0\2\72" + "\1\200\3\0\1\72\3\0\1\72\7\0\3\72\1\0" + "\1\72\7\0\11\72\1\0\4\72\1\0\2\72\1\0" + "\1\72\1\0\3\72\6\0\1\201\2\72\1\0\2\72" + "\1\201\1\72\1\0\5\72\2\0\16\72\1\201\2\72" + "\1\201\2\72\1\201\10\72\1\201\4\72\1\201\7\72" + "\1\0\2\72\1\200\3\0\1\72\3\0\1\202\7\0" + "\3\72\1\0\1\72\7\0\11\72\1\0\4\72\1\0" + "\2\72\1\0\1\72\1\0\3\72\74\0\1\75\4\0" + "\2\100\1\203\3\0\1\100\3\0\1\100\7\0\3\100" + "\1\0\1\100\7\0\11\100\1\0\4\100\1\0\2\100"
+ + "\1\0\1\100\1\0\3\100\6\0\1\204\2\100\1\0" + "\2\100\1\204\1\100\1\0\5\100\2\0\16\100\1\204" + "\2\100\1\204\2\100\1\204\10\100\1\204\4\100\1\204" + "\7\100\1\0\2\205\1\206\1\0\1\207\11\205\2\0" + "\52\205\1\0\2\210\1\211\1\0\3\210\1\207\6\210" + "\2\0\52\210\1\0\2\100\1\203\3\0\1\100\3\0" + "\1\212\7\0\3\100\1\0\1\100\7\0\11\100\1\0" + "\4\100\1\0\2\100\1\0\1\100\1\0\3\100\6\0" + "\2\105\1\213\3\0\1\105\3\0\1\105\7\0\3\105" + "\1\0\1\105\7\0\11\105\1\0\4\105\1\0\2\105" + "\1\0\1\105\1\0\3\105\6\0\1\214\2\105\1\0" + "\2\105\1\214\1\105\1\0\5\105\2\0\16\105\1\214" + "\2\105\1\214\2\105\1\214\10\105\1\214\4\105\1\214" + "\7\105\1\0\2\105\1\213\3\0\1\105\3\0\1\215" + "\7\0\3\105\1\0\1\105\7\0\11\105\1\0\4\105" + "\1\0\2\105\1\0\1\105\1\0\3\105\6\0\1\112" + "\1\216\1\217\3\0\1\216\3\0\1\216\1\0\1\220" + "\5\0\3\216\1\0\1\216\7\0\11\216\1\0\4\216" + "\1\0\2\216\1\0\1\216\1\0\3\216\4\0\1\221" + "\1\0\2\113\1\222\3\0\1\113\3\0\1\113\7\0"
+ + "\3\113\1\223\1\113\7\0\11\113\1\0\4\113\1\0" + "\2\113\1\0\1\113\1\0\3\113\6\0\1\224\2\113" + "\1\0\2\113\1\224\1\113\1\0\5\113\2\0\16\113" + "\1\224\2\113\1\224\2\113\1\224\10\113\1\224\4\113" + "\1\224\7\113\1\0\2\225\1\226\1\0\1\227\11\225" + "\2\0\52\225\1\0\2\230\1\231\1\0\3\230\1\227" + "\6\230\2\0\52\230\1\0\1\232\1\113\1\222\3\0" + "\1\113\3\0\1\233\1\0\1\220\5\0\3\113\1\223" + "\1\113\7\0\11\113\1\0\4\113\1\0\2\113\1\0" + "\1\113\1\0\3\113\6\0\1\112\13\0\1\220\56\0" + "\1\234\72\0\2\235\1\236\3\0\1\235\3\0\1\235" + "\7\0\3\235\1\0\1\235\7\0\11\235\1\0\4\235" + "\1\0\2\235\1\0\1\235\1\0\3\235\6\0\2\113" + "\1\222\3\0\1\113\3\0\1\113\1\237\6\0\1\113" + "\1\240\1\113\1\223\1\113\7\0\11\113\1\0\4\113" + "\1\0\2\113\1\0\1\113\1\0\3\113\11\0\1\241" + "\1\0\1\241\2\0\1\241\5\0\2\241\30\0\1\242" + "\21\0\4\243\1\244\1\243\1\244\2\243\1\244\5\243" + "\2\244\12\243\1\0\14\243\1\0\22\243\1\0\1\245" + "\1\25\1\131\1\25\1\0\1\25\1\245\1\0\1\25"
+ + "\1\0\1\25\3\0\2\25\2\0\3\25\1\0\1\25" + "\7\0\1\245\2\25\1\245\2\25\1\245\2\25\1\0" + "\4\25\1\0\1\245\1\25\1\0\1\25\1\0\1\245" + "\2\25\6\0\2\25\1\131\3\0\1\25\3\0\1\25" + "\7\0\3\25\1\0\1\25\2\0\1\246\4\0\11\25" + "\1\0\4\25\1\0\2\25\1\0\1\25\1\0\3\25" + "\6\0\1\247\2\134\1\0\2\134\1\247\1\134\1\0" + "\5\134\2\0\16\134\1\247\2\134\1\247\2\134\1\247" + "\10\134\1\247\4\134\1\247\7\134\1\0\1\250\2\136" + "\1\0\2\136\1\250\1\136\1\0\5\136\2\0\16\136" + "\1\250\2\136\1\250\2\136\1\250\10\136\1\250\4\136" + "\1\250\7\136\13\0\1\251\57\0\35\141\1\252\35\141" + "\41\0\1\253\103\0\1\254\65\0\2\255\66\0\2\256" + "\103\0\1\257\17\0\2\147\1\150\3\0\1\147\3\0" + "\1\147\7\0\3\147\1\260\1\147\7\0\11\147\1\0" + "\4\147\1\0\2\147\1\0\1\147\1\0\3\147\6\0" + "\1\261\2\147\1\0\2\147\1\261\1\147\1\0\5\147" + "\2\0\16\147\1\261\2\147\1\261\2\147\1\261\10\147" + "\1\261\4\147\1\261\7\147\1\0\1\262\1\151\1\152" + "\1\151\1\263\1\151\1\262\10\151\1\264\16\151\1\262"
+ + "\2\151\1\262\2\151\1\262\10\151\1\262\4\151\1\262" + "\7\151\1\0\1\265\1\154\1\155\3\154\1\265\1\266" + "\7\154\1\267\16\154\1\265\2\154\1\265\2\154\1\265" + "\10\154\1\265\4\154\1\265\7\154\32\0\1\246\41\0" + "\1\270\1\157\1\160\1\157\1\271\1\157\1\270\10\157" + "\1\272\16\157\1\270\2\157\1\270\2\157\1\270\10\157" + "\1\270\4\157\1\270\7\157\1\0\1\273\1\162\1\163" + "\3\162\1\273\1\274\7\162\1\275\16\162\1\273\2\162" + "\1\273\2\162\1\273\10\162\1\273\4\162\1\273\7\162" + "\25\0\1\276\46\0\1\277\1\51\1\165\1\51\1\0" + "\1\51\1\277\1\0\1\51\1\0\1\51\3\0\2\51" + "\2\0\3\51\1\0\1\51\7\0\1\277\2\51\1\277" + "\2\51\1\277\2\51\1\0\4\51\1\0\1\277\1\51" + "\1\0\1\51\1\0\1\277\2\51\6\0\2\51\1\165" + "\3\0\1\51\3\0\1\51\7\0\3\51\1\0\1\51" + "\2\0\1\246\4\0\11\51\1\0\4\51\1\0\2\51" + "\1\0\1\51\1\0\3\51\6\0\1\300\1\55\1\170" + "\1\55\1\0\1\55\1\300\1\0\1\55\1\0\1\55" + "\3\0\2\55\2\0\3\55\1\0\1\55\7\0\1\300" + "\2\55\1\300\2\55\1\300\2\55\1\0\4\55\1\0"
+ + "\1\300\1\55\1\0\1\55\1\0\1\300\2\55\6\0" + "\2\55\1\170\3\0\1\55\3\0\1\55\7\0\3\55" + "\1\0\1\55\2\0\1\246\4\0\11\55\1\0\4\55" + "\1\0\2\55\1\0\1\55\1\0\3\55\6\0\1\301" + "\1\62\1\173\1\62\1\0\1\62\1\301\1\0\1\62" + "\1\0\1\62\3\0\2\62\2\0\3\62\1\0\1\62" + "\7\0\1\301\2\62\1\301\2\62\1\301\2\62\1\0" + "\4\62\1\0\1\301\1\62\1\0\1\62\1\0\1\301" + "\2\62\6\0\2\62\1\173\3\0\1\62\3\0\1\62" + "\7\0\3\62\1\0\1\62\2\0\1\246\4\0\11\62" + "\1\0\4\62\1\0\2\62\1\0\1\62\1\0\3\62" + "\6\0\1\302\1\72\1\200\1\72\1\0\1\72\1\302" + "\1\0\1\72\1\0\1\72\3\0\2\72\2\0\3\72" + "\1\0\1\72\7\0\1\302\2\72\1\302\2\72\1\302" + "\2\72\1\0\4\72\1\0\1\302\1\72\1\0\1\72" + "\1\0\1\302\2\72\6\0\2\72\1\200\3\0\1\72" + "\3\0\1\72\7\0\3\72\1\0\1\72\2\0\1\246" + "\4\0\11\72\1\0\4\72\1\0\2\72\1\0\1\72" + "\1\0\3\72\6\0\1\303\1\100\1\203\1\100\1\0" + "\1\100\1\303\1\0\1\100\1\0\1\100\3\0\2\100" + "\2\0\3\100\1\0\1\100\7\0\1\303\2\100\1\303" + "\2\100\1\303\2\100\1\0\4\100\1\0\1\303\1\100"
+ + "\1\0\1\100\1\0\1\303\2\100\6\0\1\304\1\205" + "\1\206\1\205\1\305\1\205\1\304\10\205\1\306\16\205" + "\1\304\2\205\1\304\2\205\1\304\10\205\1\304\4\205" + "\1\304\7\205\1\0\1\307\1\210\1\211\3\210\1\307" + "\1\310\7\210\1\311\16\210\1\307\2\210\1\307\2\210" + "\1\307\10\210\1\307\4\210\1\307\7\210\1\0\2\100" + "\1\203\3\0\1\100\3\0\1\100\7\0\3\100\1\0" + "\1\100\2\0\1\246\4\0\11\100\1\0\4\100\1\0" + "\2\100\1\0\1\100\1\0\3\100\6\0\1\312\1\105" + "\1\213\1\105\1\0\1\105\1\312\1\0\1\105\1\0" + "\1\105\3\0\2\105\2\0\3\105\1\0\1\105\7\0" + "\1\312\2\105\1\312\2\105\1\312\2\105\1\0\4\105" + "\1\0\1\312\1\105\1\0\1\105\1\0\1\312\2\105" + "\6\0\2\105\1\213\3\0\1\105\3\0\1\105\7\0" + "\3\105\1\0\1\105\2\0\1\246\4\0\11\105\1\0" + "\4\105\1\0\2\105\1\0\1\105\1\0\3\105\6\0" + "\2\216\1\217\3\0\1\216\3\0\1\216\7\0\3\216" + "\1\0\1\216\7\0\11\216\1\0\4\216\1\0\2\216" + "\1\0\1\216\1\0\3\216\6\0\1\313\2\216\1\0" + "\2\216\1\313\1\216\1\0\5\216\2\0\16\216\1\313"
+ + "\2\216\1\313\2\216\1\313\10\216\1\313\4\216\1\313" + "\7\216\1\0\1\314\1\113\1\222\1\113\1\0\1\113" + "\1\314\1\0\1\113\1\0\1\113\3\0\2\113\2\0" + "\3\113\1\223\1\113\7\0\1\314\2\113\1\314\2\113" + "\1\314\2\113\1\0\4\113\1\0\1\314\1\113\1\0" + "\1\113\1\0\1\314\2\113\6\0\1\315\1\225\1\226" + "\1\225\1\316\1\225\1\315\10\225\1\317\16\225\1\315" + "\2\225\1\315\2\225\1\315\10\225\1\315\4\225\1\315" + "\7\225\1\0\1\320\1\230\1\231\3\230\1\320\1\321" + "\7\230\1\322\16\230\1\320\2\230\1\320\2\230\1\320" + "\10\230\1\320\4\230\1\320\7\230\1\0\1\232\1\113" + "\1\222\3\0\1\113\3\0\1\113\1\0\1\220\5\0" + "\3\113\1\223\1\113\7\0\11\113\1\0\4\113\1\0" + "\2\113\1\0\1\113\1\0\3\113\4\0\1\221\1\0" + "\2\113\1\222\3\0\1\113\3\0\1\113\7\0\3\113" + "\1\223\1\113\2\0\1\246\4\0\11\113\1\0\4\113" + "\1\0\2\113\1\0\1\113\1\0\3\113\6\0\1\234" + "\1\216\1\217\3\0\1\216\3\0\1\216\7\0\3\216" + "\1\0\1\216\7\0\11\216\1\0\4\216\1\0\2\216" + "\1\0\1\216\1\0\3\216\4\0\1\221\1\0\1\323"
+ + "\2\235\1\0\2\235\1\323\1\235\1\0\5\235\2\0" + "\16\235\1\323\2\235\1\323\2\235\1\323\10\235\1\323" + "\4\235\1\323\7\235\1\0\1\324\5\0\1\324\11\0" + "\1\324\5\0\1\324\7\0\2\324\1\0\2\324\1\0" + "\2\324\7\0\2\324\3\0\2\324\7\0\2\113\1\222" + "\3\0\1\113\3\0\1\113\7\0\2\113\1\325\1\223" + "\1\113\7\0\11\113\1\0\4\113\1\0\2\113\1\0" + "\1\113\1\0\3\113\57\0\1\326\21\0\1\327\1\25" + "\1\131\1\25\1\0\1\25\1\327\1\0\1\25\1\0" + "\1\25\3\0\2\25\2\0\3\25\1\0\1\25\7\0" + "\1\327\2\25\1\327\2\25\1\327\2\25\1\0\4\25" + "\1\0\1\327\1\25\1\0\1\25\1\0\1\327\2\25" + "\6\0\1\330\1\134\1\135\1\134\1\0\1\134\1\330" + "\1\0\1\134\1\0\1\134\3\0\2\134\2\0\3\134" + "\1\0\1\134\7\0\1\330\2\134\1\330\2\134\1\330" + "\2\134\1\0\4\134\1\0\1\330\1\134\1\0\1\134" + "\1\0\1\330\2\134\6\0\1\331\1\136\1\137\1\136" + "\1\0\1\136\1\331\1\0\1\136\1\0\1\136\3\0" + "\2\136\2\0\3\136\1\0\1\136\7\0\1\331\2\136" + "\1\331\2\136\1\331\2\136\1\0\4\136\1\0\1\331"
+ + "\1\136\1\0\1\136\1\0\1\331\2\136\20\0\1\332" + "\57\0\34\141\1\333\1\252\35\141\42\0\2\334\102\0" + "\1\335\75\0\2\336\74\0\1\337\76\0\1\340\7\0" + "\1\341\1\342\1\260\1\0\1\260\1\341\1\0\1\260" + "\1\0\1\341\3\0\2\260\2\0\3\341\1\0\1\341" + "\7\0\11\341\1\0\4\341\1\0\2\341\1\0\1\341" + "\1\0\3\341\6\0\1\343\1\147\1\150\1\147\1\0" + "\1\147\1\343\1\0\1\147\1\0\1\147\3\0\2\147" + "\2\0\3\147\1\260\1\147\7\0\1\343\2\147\1\343" + "\2\147\1\343\2\147\1\0\4\147\1\0\1\343\1\147" + "\1\0\1\147\1\0\1\343\2\147\6\0\1\344\1\151" + "\1\152\1\151\1\153\1\151\1\344\27\151\1\344\2\151" + "\1\344\2\151\1\344\10\151\1\344\4\151\1\344\7\151" + "\1\0\2\151\1\152\1\0\1\153\12\151\1\0\52\151" + "\1\0\1\345\1\154\1\155\3\154\1\345\1\153\26\154" + "\1\345\2\154\1\345\2\154\1\345\10\154\1\345\4\154" + "\1\345\7\154\1\0\2\154\1\155\1\0\3\154\1\153" + "\7\154\1\0\52\154\1\0\1\346\1\157\1\160\1\157" + "\1\161\1\157\1\346\27\157\1\346\2\157\1\346\2\157"
+ + "\1\346\10\157\1\346\4\157\1\346\7\157\1\0\2\157" + "\1\160\1\0\1\161\12\157\1\0\52\157\1\0\1\347" + "\1\162\1\163\3\162\1\347\1\161\26\162\1\347\2\162" + "\1\347\2\162\1\347\10\162\1\347\4\162\1\347\7\162" + "\1\0\2\162\1\163\1\0\3\162\1\161\7\162\1\0" + "\52\162\26\0\1\350\45\0\1\351\1\51\1\165\1\51" + "\1\0\1\51\1\351\1\0\1\51\1\0\1\51\3\0" + "\2\51\2\0\3\51\1\0\1\51\7\0\1\351\2\51" + "\1\351\2\51\1\351\2\51\1\0\4\51\1\0\1\351" + "\1\51\1\0\1\51\1\0\1\351\2\51\6\0\1\352" + "\1\55\1\170\1\55\1\0\1\55\1\352\1\0\1\55" + "\1\0\1\55\3\0\2\55\2\0\3\55\1\0\1\55" + "\7\0\1\352\2\55\1\352\2\55\1\352\2\55\1\0" + "\4\55\1\0\1\352\1\55\1\0\1\55\1\0\1\352" + "\2\55\6\0\1\353\1\62\1\173\1\62\1\0\1\62" + "\1\353\1\0\1\62\1\0\1\62\3\0\2\62\2\0" + "\3\62\1\0\1\62\7\0\1\353\2\62\1\353\2\62" + "\1\353\2\62\1\0\4\62\1\0\1\353\1\62\1\0" + "\1\62\1\0\1\353\2\62\6\0\1\354\1\72\1\200" + "\1\72\1\0\1\72\1\354\1\0\1\72\1\0\1\72" + "\3\0\2\72\2\0\3\72\1\0\1\72\7\0\1\354"
+ + "\2\72\1\354\2\72\1\354\2\72\1\0\4\72\1\0" + "\1\354\1\72\1\0\1\72\1\0\1\354\2\72\6\0" + "\1\355\1\100\1\203\1\100\1\0\1\100\1\355\1\0" + "\1\100\1\0\1\100\3\0\2\100\2\0\3\100\1\0" + "\1\100\7\0\1\355\2\100\1\355\2\100\1\355\2\100" + "\1\0\4\100\1\0\1\355\1\100\1\0\1\100\1\0" + "\1\355\2\100\6\0\1\356\1\205\1\206\1\205\1\207" + "\1\205\1\356\27\205\1\356\2\205\1\356\2\205\1\356" + "\10\205\1\356\4\205\1\356\7\205\1\0\2\205\1\206" + "\1\0\1\207\12\205\1\0\52\205\1\0\1\357\1\210" + "\1\211\3\210\1\357\1\207\26\210\1\357\2\210\1\357" + "\2\210\1\357\10\210\1\357\4\210\1\357\7\210\1\0" + "\2\210\1\211\1\0\3\210\1\207\7\210\1\0\52\210" + "\1\0\1\360\1\105\1\213\1\105\1\0\1\105\1\360" + "\1\0\1\105\1\0\1\105\3\0\2\105\2\0\3\105" + "\1\0\1\105\7\0\1\360\2\105\1\360\2\105\1\360" + "\2\105\1\0\4\105\1\0\1\360\1\105\1\0\1\105" + "\1\0\1\360\2\105\6\0\1\361\1\216\1\217\1\216" + "\1\0\1\216\1\361\1\0\1\216\1\0\1\216\3\0" + "\2\216\2\0\3\216\1\0\1\216\7\0\1\361\2\216"
+ + "\1\361\2\216\1\361\2\216\1\0\4\216\1\0\1\361" + "\1\216\1\0\1\216\1\0\1\361\2\216\6\0\1\362" + "\1\113\1\222\1\113\1\0\1\113\1\362\1\0\1\113" + "\1\0\1\113\3\0\2\113\2\0\3\113\1\223\1\113" + "\7\0\1\362\2\113\1\362\2\113\1\362\2\113\1\0" + "\4\113\1\0\1\362\1\113\1\0\1\113\1\0\1\362" + "\2\113\6\0\1\363\1\225\1\226\1\225\1\227\1\225" + "\1\363\27\225\1\363\2\225\1\363\2\225\1\363\10\225" + "\1\363\4\225\1\363\7\225\1\0\2\225\1\226\1\0" + "\1\227\12\225\1\0\52\225\1\0\1\364\1\230\1\231" + "\3\230\1\364\1\227\26\230\1\364\2\230\1\364\2\230" + "\1\364\10\230\1\364\4\230\1\364\7\230\1\0\2\230" + "\1\231\1\0\3\230\1\227\7\230\1\0\52\230\1\0" + "\1\365\1\235\1\236\1\235\1\0\1\235\1\365\1\0" + "\1\235\1\0\1\235\3\0\2\235\2\0\3\235\1\0" + "\1\235\7\0\1\365\2\235\1\365\2\235\1\365\2\235" + "\1\0\4\235\1\0\1\365\1\235\1\0\1\235\1\0" + "\1\365\2\235\6\0\1\366\5\0\1\366\3\0\1\367" + "\5\0\1\366\5\0\1\366\7\0\2\366\1\0\2\366" + "\1\0\2\366\7\0\2\366\3\0\2\366\7\0\2\113"
+ + "\1\222\3\0\1\113\3\0\1\113\7\0\3\113\1\370" + "\1\113\7\0\11\113\1\0\4\113\1\0\2\113\1\0" + "\1\113\1\0\3\113\60\0\1\371\20\0\1\372\1\25" + "\1\131\1\25\1\0\1\25\1\372\1\0\1\25\1\0" + "\1\25\3\0\2\25\2\0\3\25\1\0\1\25\7\0" + "\1\372\2\25\1\372\2\25\1\372\2\25\1\0\4\25" + "\1\0\1\372\1\25\1\0\1\25\1\0\1\372\2\25" + "\6\0\1\373\1\134\1\135\1\134\1\0\1\134\1\373" + "\1\0\1\134\1\0\1\134\3\0\2\134\2\0\3\134" + "\1\0\1\134\7\0\1\373\2\134\1\373\2\134\1\373" + "\2\134\1\0\4\134\1\0\1\373\1\134\1\0\1\134" + "\1\0\1\373\2\134\6\0\1\374\1\136\1\137\1\136" + "\1\0\1\136\1\374\1\0\1\136\1\0\1\136\3\0" + "\2\136\2\0\3\136\1\0\1\136\7\0\1\374\2\136" + "\1\374\2\136\1\374\2\136\1\0\4\136\1\0\1\374" + "\1\136\1\0\1\136\1\0\1\374\2\136\31\0\1\375" + "\122\0\1\376\67\0\1\377\66\0\2\u0100\73\0\1\u0101" + "\24\0\2\341\1\342\1\u0102\1\0\1\u0102\1\341\1\0" + "\1\u0102\1\u0103\1\341\3\0\2\u0102\2\0\3\341\1\0" + "\1\341\7\0\11\341\1\0\4\341\1\0\2\341\1\0"
+ + "\1\341\1\0\3\341\6\0\1\u0104\2\341\1\0\2\341" + "\1\u0104\1\341\1\0\5\341\2\0\16\341\1\u0104\2\341" + "\1\u0104\2\341\1\u0104\10\341\1\u0104\4\341\1\u0104\7\341" + "\1\0\1\u0105\1\147\1\150\1\147\1\0\1\147\1\u0105" + "\1\0\1\147\1\0\1\147\3\0\2\147\2\0\3\147" + "\1\260\1\147\7\0\1\u0105\2\147\1\u0105\2\147\1\u0105" + "\2\147\1\0\4\147\1\0\1\u0105\1\147\1\0\1\147" + "\1\0\1\u0105\2\147\6\0\1\u0106\1\151\1\152\1\151" + "\1\153\1\151\1\u0106\27\151\1\u0106\2\151\1\u0106\2\151" + "\1\u0106\10\151\1\u0106\4\151\1\u0106\7\151\1\0\1\u0107" + "\1\154\1\155\3\154\1\u0107\1\153\26\154\1\u0107\2\154" + "\1\u0107\2\154\1\u0107\10\154\1\u0107\4\154\1\u0107\7\154" + "\1\0\1\u0108\1\157\1\160\1\157\1\161\1\157\1\u0108" + "\27\157\1\u0108\2\157\1\u0108\2\157\1\u0108\10\157\1\u0108" + "\4\157\1\u0108\7\157\1\0\1\u0109\1\162\1\163\3\162" + "\1\u0109\1\161\26\162\1\u0109\2\162\1\u0109\2\162\1\u0109" + "\10\162\1\u0109\4\162\1\u0109\7\162\1\0\2\u010a\1\u010b"
+ + "\1\350\1\u010c\1\350\1\u010a\1\u010d\1\350\1\u010e\4\u010a" + "\2\350\5\u010a\1\0\44\u010a\1\0\1\u010f\1\51\1\165" + "\1\51\1\0\1\51\1\u010f\1\0\1\51\1\0\1\51" + "\3\0\2\51\2\0\3\51\1\0\1\51\7\0\1\u010f" + "\2\51\1\u010f\2\51\1\u010f\2\51\1\0\4\51\1\0" + "\1\u010f\1\51\1\0\1\51\1\0\1\u010f\2\51\6\0" + "\1\u0110\1\55\1\170\1\55\1\0\1\55\1\u0110\1\0" + "\1\55\1\0\1\55\3\0\2\55\2\0\3\55\1\0" + "\1\55\7\0\1\u0110\2\55\1\u0110\2\55\1\u0110\2\55" + "\1\0\4\55\1\0\1\u0110\1\55\1\0\1\55\1\0" + "\1\u0110\2\55\6\0\1\u0111\1\62\1\173\1\62\1\0" + "\1\62\1\u0111\1\0\1\62\1\0\1\62\3\0\2\62" + "\2\0\3\62\1\0\1\62\7\0\1\u0111\2\62\1\u0111" + "\2\62\1\u0111\2\62\1\0\4\62\1\0\1\u0111\1\62" + "\1\0\1\62\1\0\1\u0111\2\62\6\0\1\u0112\1\72" + "\1\200\1\72\1\0\1\72\1\u0112\1\0\1\72\1\0" + "\1\72\3\0\2\72\2\0\3\72\1\0\1\72\7\0" + "\1\u0112\2\72\1\u0112\2\72\1\u0112\2\72\1\0\4\72" + "\1\0\1\u0112\1\72\1\0\1\72\1\0\1\u0112\2\72" + "\6\0\1\u0113\1\100\1\203\1\100\1\0\1\100\1\u0113"
+ + "\1\0\1\100\1\0\1\100\3\0\2\100\2\0\3\100" + "\1\0\1\100\7\0\1\u0113\2\100\1\u0113\2\100\1\u0113" + "\2\100\1\0\4\100\1\0\1\u0113\1\100\1\0\1\100" + "\1\0\1\u0113\2\100\6\0\1\u0114\1\205\1\206\1\205" + "\1\207\1\205\1\u0114\27\205\1\u0114\2\205\1\u0114\2\205" + "\1\u0114\10\205\1\u0114\4\205\1\u0114\7\205\1\0\1\u0115" + "\1\210\1\211\3\210\1\u0115\1\207\26\210\1\u0115\2\210" + "\1\u0115\2\210\1\u0115\10\210\1\u0115\4\210\1\u0115\7\210" + "\1\0\1\u0116\1\105\1\213\1\105\1\0\1\105\1\u0116" + "\1\0\1\105\1\0\1\105\3\0\2\105\2\0\3\105" + "\1\0\1\105\7\0\1\u0116\2\105\1\u0116\2\105\1\u0116" + "\2\105\1\0\4\105\1\0\1\u0116\1\105\1\0\1\105" + "\1\0\1\u0116\2\105\6\0\1\u0117\1\216\1\217\1\216" + "\1\0\1\216\1\u0117\1\0\1\216\1\0\1\216\3\0" + "\2\216\2\0\3\216\1\0\1\216\7\0\1\u0117\2\216" + "\1\u0117\2\216\1\u0117\2\216\1\0\4\216\1\0\1\u0117" + "\1\216\1\0\1\216\1\0\1\u0117\2\216\6\0\1\u0118" + "\1\113\1\222\1\113\1\0\1\113\1\u0118\1\0\1\113"
+ + "\1\0\1\113\3\0\2\113\2\0\3\113\1\223\1\113" + "\7\0\1\u0118\2\113\1\u0118\2\113\1\u0118\2\113\1\0" + "\4\113\1\0\1\u0118\1\113\1\0\1\113\1\0\1\u0118" + "\2\113\6\0\1\u0119\1\225\1\226\1\225\1\227\1\225" + "\1\u0119\27\225\1\u0119\2\225\1\u0119\2\225\1\u0119\10\225" + "\1\u0119\4\225\1\u0119\7\225\1\0\1\u011a\1\230\1\231" + "\3\230\1\u011a\1\227\26\230\1\u011a\2\230\1\u011a\2\230" + "\1\u011a\10\230\1\u011a\4\230\1\u011a\7\230\1\0\1\u011b" + "\1\235\1\236\1\235\1\0\1\235\1\u011b\1\0\1\235" + "\1\0\1\235\3\0\2\235\2\0\3\235\1\0\1\235" + "\7\0\1\u011b\2\235\1\u011b\2\235\1\u011b\2\235\1\0" + "\4\235\1\0\1\u011b\1\235\1\0\1\235\1\0\1\u011b" + "\2\235\6\0\1\u011c\5\0\1\u011c\3\0\1\367\5\0" + "\1\u011c\5\0\1\u011c\7\0\2\u011c\1\0\2\u011c\1\0" + "\2\u011c\7\0\2\u011c\3\0\2\u011c\7\0\1\u011d\5\0" + "\1\u011d\11\0\1\u011d\5\0\1\u011d\7\0\2\u011d\1\0" + "\2\u011d\1\0\2\u011d\7\0\2\u011d\3\0\2\u011d\7\0" + "\2\u011e\1\u011f\1\u0120\1\u0121\1\u0120\1\u011e\1\u0122\1\u0120"
+ + "\1\u0123\4\u011e\2\u0120\5\u011e\1\0\44\u011e\54\0\1\u0124" + "\17\0\1\u0125\1\25\1\131\1\25\1\0\1\25\1\u0125" + "\1\0\1\25\1\0\1\25\3\0\2\25\2\0\3\25" + "\1\0\1\25\7\0\1\u0125\2\25\1\u0125\2\25\1\u0125" + "\2\25\1\0\4\25\1\0\1\u0125\1\25\1\0\1\25" + "\1\0\1\u0125\2\25\6\0\1\u0126\1\134\1\135\1\134" + "\1\0\1\134\1\u0126\1\0\1\134\1\0\1\134\3\0" + "\2\134\2\0\3\134\1\0\1\134\7\0\1\u0126\2\134" + "\1\u0126\2\134\1\u0126\2\134\1\0\4\134\1\0\1\u0126" + "\1\134\1\0\1\134\1\0\1\u0126\2\134\6\0\1\u0127" + "\1\136\1\137\1\136\1\0\1\136\1\u0127\1\0\1\136" + "\1\0\1\136\3\0\2\136\2\0\3\136\1\0\1\136" + "\7\0\1\u0127\2\136\1\u0127\2\136\1\u0127\2\136\1\0" + "\4\136\1\0\1\u0127\1\136\1\0\1\136\1\0\1\u0127" + "\2\136\51\0\1\u0128\52\0\1\u0129\110\0\2\u012a\42\0" + "\1\u012b\63\0\1\u0102\1\0\1\u0102\2\0\1\u0102\1\u0103" + "\4\0\2\u0102\53\0\1\u012c\1\341\1\342\1\341\1\0" + "\1\341\1\u012c\1\0\1\341\1\u0103\1\341\3\0\2\341" + "\2\0\3\341\1\0\1\341\7\0\1\u012c\2\341\1\u012c"
+ + "\2\341\1\u012c\2\341\1\0\4\341\1\0\1\u012c\1\341" + "\1\0\1\341\1\0\1\u012c\2\341\6\0\1\u012d\1\147" + "\1\150\1\147\1\0\1\147\1\u012d\1\0\1\147\1\0" + "\1\147\3\0\2\147\2\0\3\147\1\260\1\147\7\0" + "\1\u012d\2\147\1\u012d\2\147\1\u012d\2\147\1\0\4\147" + "\1\0\1\u012d\1\147\1\0\1\147\1\0\1\u012d\2\147" + "\6\0\1\u012e\1\151\1\152\1\151\1\153\1\151\1\u012e" + "\27\151\1\u012e\2\151\1\u012e\2\151\1\u012e\10\151\1\u012e" + "\4\151\1\u012e\7\151\1\0\1\u012f\1\154\1\155\3\154" + "\1\u012f\1\153\26\154\1\u012f\2\154\1\u012f\2\154\1\u012f" + "\10\154\1\u012f\4\154\1\u012f\7\154\1\0\1\u0130\1\157" + "\1\160\1\157\1\161\1\157\1\u0130\27\157\1\u0130\2\157" + "\1\u0130\2\157\1\u0130\10\157\1\u0130\4\157\1\u0130\7\157" + "\1\0\1\u0131\1\162\1\163\3\162\1\u0131\1\161\26\162" + "\1\u0131\2\162\1\u0131\2\162\1\u0131\10\162\1\u0131\4\162" + "\1\u0131\7\162\1\0\2\u010a\1\u010b\1\u0132\1\0\2\u010a" + "\1\0\1\u0132\1\u010e\4\u010a\2\u0132\5\u010a\1\0\44\u010a"
+ + "\1\0\1\u0133\1\u010a\1\u010b\1\u0132\2\u010a\1\u0133\1\u010a" + "\1\u0132\1\u0134\4\u010a\2\u0132\16\u010a\1\u0133\2\u010a\1\u0133" + "\2\u010a\1\u0133\10\u010a\1\u0133\4\u010a\1\u0133\7\u010a\1\0" + "\2\u010c\1\u0135\1\0\1\u0132\11\u010c\2\0\52\u010c\1\0" + "\2\u010d\1\u0136\1\0\3\u010d\1\u0132\6\u010d\2\0\52\u010d" + "\1\0\1\u0137\1\51\1\165\1\51\1\0\1\51\1\u0137" + "\1\0\1\51\1\0\1\51\3\0\2\51\2\0\3\51" + "\1\0\1\51\7\0\1\u0137\2\51\1\u0137\2\51\1\u0137" + "\2\51\1\0\4\51\1\0\1\u0137\1\51\1\0\1\51" + "\1\0\1\u0137\2\51\6\0\1\u0138\1\55\1\170\1\55" + "\1\0\1\55\1\u0138\1\0\1\55\1\0\1\55\3\0" + "\2\55\2\0\3\55\1\0\1\55\7\0\1\u0138\2\55" + "\1\u0138\2\55\1\u0138\2\55\1\0\4\55\1\0\1\u0138" + "\1\55\1\0\1\55\1\0\1\u0138\2\55\6\0\1\u0139" + "\1\62\1\173\1\62\1\0\1\62\1\u0139\1\0\1\62" + "\1\0\1\62\3\0\2\62\2\0\3\62\1\0\1\62" + "\7\0\1\u0139\2\62\1\u0139\2\62\1\u0139\2\62\1\0" + "\4\62\1\0\1\u0139\1\62\1\0\1\62\1\0\1\u0139"
+ + "\2\62\6\0\1\u013a\1\72\1\200\1\72\1\0\1\72" + "\1\u013a\1\0\1\72\1\0\1\72\3\0\2\72\2\0" + "\3\72\1\0\1\72\7\0\1\u013a\2\72\1\u013a\2\72" + "\1\u013a\2\72\1\0\4\72\1\0\1\u013a\1\72\1\0" + "\1\72\1\0\1\u013a\2\72\6\0\1\u013b\1\100\1\203" + "\1\100\1\0\1\100\1\u013b\1\0\1\100\1\0\1\100" + "\3\0\2\100\2\0\3\100\1\0\1\100\7\0\1\u013b" + "\2\100\1\u013b\2\100\1\u013b\2\100\1\0\4\100\1\0" + "\1\u013b\1\100\1\0\1\100\1\0\1\u013b\2\100\6\0" + "\1\u013c\1\205\1\206\1\205\1\207\1\205\1\u013c\27\205" + "\1\u013c\2\205\1\u013c\2\205\1\u013c\10\205\1\u013c\4\205" + "\1\u013c\7\205\1\0\1\u013d\1\210\1\211\3\210\1\u013d" + "\1\207\26\210\1\u013d\2\210\1\u013d\2\210\1\u013d\10\210" + "\1\u013d\4\210\1\u013d\7\210\1\0\1\u013e\1\105\1\213" + "\1\105\1\0\1\105\1\u013e\1\0\1\105\1\0\1\105" + "\3\0\2\105\2\0\3\105\1\0\1\105\7\0\1\u013e" + "\2\105\1\u013e\2\105\1\u013e\2\105\1\0\4\105\1\0" + "\1\u013e\1\105\1\0\1\105\1\0\1\u013e\2\105\6\0"
+ + "\1\u013f\1\216\1\217\1\216\1\0\1\216\1\u013f\1\0" + "\1\216\1\0\1\216\3\0\2\216\2\0\3\216\1\0" + "\1\216\7\0\1\u013f\2\216\1\u013f\2\216\1\u013f\2\216" + "\1\0\4\216\1\0\1\u013f\1\216\1\0\1\216\1\0" + "\1\u013f\2\216\6\0\1\u0140\1\113\1\222\1\113\1\0" + "\1\113\1\u0140\1\0\1\113\1\0\1\113\3\0\2\113" + "\2\0\3\113\1\223\1\113\7\0\1\u0140\2\113\1\u0140" + "\2\113\1\u0140\2\113\1\0\4\113\1\0\1\u0140\1\113" + "\1\0\1\113\1\0\1\u0140\2\113\6\0\1\u0141\1\225" + "\1\226\1\225\1\227\1\225\1\u0141\27\225\1\u0141\2\225" + "\1\u0141\2\225\1\u0141\10\225\1\u0141\4\225\1\u0141\7\225" + "\1\0\1\u0142\1\230\1\231\3\230\1\u0142\1\227\26\230" + "\1\u0142\2\230\1\u0142\2\230\1\u0142\10\230\1\u0142\4\230" + "\1\u0142\7\230\1\0\1\u0143\1\235\1\236\1\235\1\0" + "\1\235\1\u0143\1\0\1\235\1\0\1\235\3\0\2\235" + "\2\0\3\235\1\0\1\235\7\0\1\u0143\2\235\1\u0143" + "\2\235\1\u0143\2\235\1\0\4\235\1\0\1\u0143\1\235" + "\1\0\1\235\1\0\1\u0143\2\235\6\0\1\u0144\5\0"
+ + "\1\u0144\3\0\1\367\5\0\1\u0144\5\0\1\u0144\7\0" + "\2\u0144\1\0\2\u0144\1\0\2\u0144\7\0\2\u0144\3\0" + "\2\u0144\7\0\1\u0145\5\0\1\u0145\11\0\1\u0145\5\0" + "\1\u0145\7\0\2\u0145\1\0\2\u0145\1\0\2\u0145\7\0" + "\2\u0145\3\0\2\u0145\7\0\2\u011e\1\u011f\1\u0146\1\0" + "\2\u011e\1\0\1\u0146\1\u0123\4\u011e\2\u0146\5\u011e\1\0" + "\44\u011e\1\0\1\u0147\1\u011e\1\u011f\1\u0146\2\u011e\1\u0147" + "\1\u011e\1\u0146\1\u0148\4\u011e\2\u0146\16\u011e\1\u0147\2\u011e" + "\1\u0147\2\u011e\1\u0147\10\u011e\1\u0147\4\u011e\1\u0147\7\u011e" + "\1\0\2\u0121\1\u0149\1\0\1\u0146\11\u0121\2\0\52\u0121" + "\1\0\2\u0122\1\u014a\1\0\3\u0122\1\u0146\6\u0122\2\0" + "\52\u0122\24\0\1\u014b\47\0\1\u014c\1\25\1\131\1\25" + "\1\0\1\25\1\u014c\1\0\1\25\1\0\1\25\3\0" + "\2\25\2\0\3\25\1\0\1\25\7\0\1\u014c\2\25" + "\1\u014c\2\25\1\u014c\2\25\1\0\4\25\1\0\1\u014c" + "\1\25\1\0\1\25\1\0\1\u014c\2\25\6\0\1\u014d" + "\1\134\1\135\1\134\1\0\1\134\1\u014d\1\0\1\134"
+ + "\1\0\1\134\3\0\2\134\2\0\3\134\1\0\1\134" + "\7\0\1\u014d\2\134\1\u014d\2\134\1\u014d\2\134\1\0" + "\4\134\1\0\1\u014d\1\134\1\0\1\134\1\0\1\u014d" + "\2\134\6\0\1\u014e\1\136\1\137\1\136\1\0\1\136" + "\1\u014e\1\0\1\136\1\0\1\136\3\0\2\136\2\0" + "\3\136\1\0\1\136\7\0\1\u014e\2\136\1\u014e\2\136" + "\1\u014e\2\136\1\0\4\136\1\0\1\u014e\1\136\1\0" + "\1\136\1\0\1\u014e\2\136\52\0\2\u014f\73\0\1\u0150" + "\106\0\2\u0151\7\0\1\u0152\1\341\1\342\1\341\1\0" + "\1\341\1\u0152\1\0\1\341\1\u0103\1\341\3\0\2\341" + "\2\0\3\341\1\0\1\341\7\0\1\u0152\2\341\1\u0152" + "\2\341\1\u0152\2\341\1\0\4\341\1\0\1\u0152\1\341" + "\1\0\1\341\1\0\1\u0152\2\341\6\0\1\u0153\1\147" + "\1\150\1\147\1\0\1\147\1\u0153\1\0\1\147\1\0" + "\1\147\3\0\2\147\2\0\3\147\1\260\1\147\7\0" + "\1\u0153\2\147\1\u0153\2\147\1\u0153\2\147\1\0\4\147" + "\1\0\1\u0153\1\147\1\0\1\147\1\0\1\u0153\2\147" + "\6\0\1\u0154\1\151\1\152\1\151\1\153\1\151\1\u0154"
+ + "\27\151\1\u0154\2\151\1\u0154\2\151\1\u0154\10\151\1\u0154" + "\4\151\1\u0154\7\151\1\0\1\u0155\1\154\1\155\3\154" + "\1\u0155\1\153\26\154\1\u0155\2\154\1\u0155\2\154\1\u0155" + "\10\154\1\u0155\4\154\1\u0155\7\154\1\0\1\u0156\1\157" + "\1\160\1\157\1\161\1\157\1\u0156\27\157\1\u0156\2\157" + "\1\u0156\2\157\1\u0156\10\157\1\u0156\4\157\1\u0156\7\157" + "\1\0\1\u0157\1\162\1\163\3\162\1\u0157\1\161\26\162" + "\1\u0157\2\162\1\u0157\2\162\1\u0157\10\162\1\u0157\4\162" + "\1\u0157\7\162\4\0\1\u0132\1\0\1\u0132\2\0\1\u0132" + "\1\u010e\4\0\2\u0132\53\0\1\u0158\1\u010a\1\u010b\1\u010a" + "\1\0\1\u010a\1\u0158\1\0\1\u010a\1\u010e\13\u010a\1\0" + "\10\u010a\1\u0158\2\u010a\1\u0158\2\u010a\1\u0158\10\u010a\1\u0158" + "\4\u010a\1\u0158\7\u010a\1\0\1\u0159\1\u010c\1\u0135\1\u010c" + "\1\u015a\1\u010c\1\u0159\10\u010c\1\u015b\16\u010c\1\u0159\2\u010c" + "\1\u0159\2\u010c\1\u0159\10\u010c\1\u0159\4\u010c\1\u0159\7\u010c"
+ + "\1\0\1\u015c\1\u010d\1\u0136\3\u010d\1\u015c\1\u015d\7\u010d" + "\1\u015e\16\u010d\1\u015c\2\u010d\1\u015c\2\u010d\1\u015c\10\u010d" + "\1\u015c\4\u010d\1\u015c\7\u010d\1\0\1\u015f\1\51\1\165" + "\1\51\1\0\1\51\1\u015f\1\0\1\51\1\0\1\51" + "\3\0\2\51\2\0\3\51\1\0\1\51\7\0\1\u015f" + "\2\51\1\u015f\2\51\1\u015f\2\51\1\0\4\51\1\0" + "\1\u015f\1\51\1\0\1\51\1\0\1\u015f\2\51\6\0" + "\1\u0160\1\55\1\170\1\55\1\0\1\55\1\u0160\1\0" + "\1\55\1\0\1\55\3\0\2\55\2\0\3\55\1\0" + "\1\55\7\0\1\u0160\2\55\1\u0160\2\55\1\u0160\2\55" + "\1\0\4\55\1\0\1\u0160\1\55\1\0\1\55\1\0" + "\1\u0160\2\55\6\0\1\u0161\1\62\1\173\1\62\1\0" + "\1\62\1\u0161\1\0\1\62\1\0\1\62\3\0\2\62" + "\2\0\3\62\1\0\1\62\7\0\1\u0161\2\62\1\u0161" + "\2\62\1\u0161\2\62\1\0\4\62\1\0\1\u0161\1\62" + "\1\0\1\62\1\0\1\u0161\2\62\6\0\1\u0162\1\72" + "\1\200\1\72\1\0\1\72\1\u0162\1\0\1\72\1\0" + "\1\72\3\0\2\72\2\0\3\72\1\0\1\72\7\0" + "\1\u0162\2\72\1\u0162\2\72\1\u0162\2\72\1\0\4\72"
+ + "\1\0\1\u0162\1\72\1\0\1\72\1\0\1\u0162\2\72" + "\6\0\1\u0163\1\100\1\203\1\100\1\0\1\100\1\u0163" + "\1\0\1\100\1\0\1\100\3\0\2\100\2\0\3\100" + "\1\0\1\100\7\0\1\u0163\2\100\1\u0163\2\100\1\u0163" + "\2\100\1\0\4\100\1\0\1\u0163\1\100\1\0\1\100" + "\1\0\1\u0163\2\100\6\0\1\u0164\1\205\1\206\1\205" + "\1\207\1\205\1\u0164\27\205\1\u0164\2\205\1\u0164\2\205" + "\1\u0164\10\205\1\u0164\4\205\1\u0164\7\205\1\0\1\u0165" + "\1\210\1\211\3\210\1\u0165\1\207\26\210\1\u0165\2\210" + "\1\u0165\2\210\1\u0165\10\210\1\u0165\4\210\1\u0165\7\210" + "\1\0\1\u0166\1\105\1\213\1\105\1\0\1\105\1\u0166" + "\1\0\1\105\1\0\1\105\3\0\2\105\2\0\3\105" + "\1\0\1\105\7\0\1\u0166\2\105\1\u0166\2\105\1\u0166" + "\2\105\1\0\4\105\1\0\1\u0166\1\105\1\0\1\105" + "\1\0\1\u0166\2\105\6\0\1\u0167\1\216\1\217\1\216" + "\1\0\1\216\1\u0167\1\0\1\216\1\0\1\216\3\0" + "\2\216\2\0\3\216\1\0\1\216\7\0\1\u0167\2\216" + "\1\u0167\2\216\1\u0167\2\216\1\0\4\216\1\0\1\u0167"
+ + "\1\216\1\0\1\216\1\0\1\u0167\2\216\6\0\1\u0168" + "\1\113\1\222\1\113\1\0\1\113\1\u0168\1\0\1\113" + "\1\0\1\113\3\0\2\113\2\0\3\113\1\223\1\113" + "\7\0\1\u0168\2\113\1\u0168\2\113\1\u0168\2\113\1\0" + "\4\113\1\0\1\u0168\1\113\1\0\1\113\1\0\1\u0168" + "\2\113\6\0\1\u0169\1\225\1\226\1\225\1\227\1\225" + "\1\u0169\27\225\1\u0169\2\225\1\u0169\2\225\1\u0169\10\225" + "\1\u0169\4\225\1\u0169\7\225\1\0\1\u016a\1\230\1\231" + "\3\230\1\u016a\1\227\26\230\1\u016a\2\230\1\u016a\2\230" + "\1\u016a\10\230\1\u016a\4\230\1\u016a\7\230\1\0\1\u016b" + "\1\235\1\236\1\235\1\0\1\235\1\u016b\1\0\1\235" + "\1\0\1\235\3\0\2\235\2\0\3\235\1\0\1\235" + "\7\0\1\u016b\2\235\1\u016b\2\235\1\u016b\2\235\1\0" + "\4\235\1\0\1\u016b\1\235\1\0\1\235\1\0\1\u016b" + "\2\235\6\0\1\u016c\5\0\1\u016c\3\0\1\367\5\0" + "\1\u016c\5\0\1\u016c\7\0\2\u016c\1\0\2\u016c\1\0" + "\2\u016c\7\0\2\u016c\3\0\2\u016c\7\0\1\u016d\5\0" + "\1\u016d\11\0\1\u016d\5\0\1\u016d\7\0\2\u016d\1\0"
+ + "\2\u016d\1\0\2\u016d\7\0\2\u016d\3\0\2\u016d\12\0" + "\1\u0146\1\0\1\u0146\2\0\1\u0146\1\u0123\4\0\2\u0146" + "\53\0\1\u016e\1\u011e\1\u011f\1\u011e\1\0\1\u011e\1\u016e" + "\1\0\1\u011e\1\u0123\13\u011e\1\0\10\u011e\1\u016e\2\u011e" + "\1\u016e\2\u011e\1\u016e\10\u011e\1\u016e\4\u011e\1\u016e\7\u011e" + "\1\0\1\u016f\1\u0121\1\u0149\1\u0121\1\u0170\1\u0121\1\u016f" + "\10\u0121\1\u0171\16\u0121\1\u016f\2\u0121\1\u016f\2\u0121\1\u016f" + "\10\u0121\1\u016f\4\u0121\1\u016f\7\u0121\1\0\1\u0172\1\u0122" + "\1\u014a\3\u0122\1\u0172\1\u0173\7\u0122\1\u0174\16\u0122\1\u0172" + "\2\u0122\1\u0172\2\u0122\1\u0172\10\u0122\1\u0172\4\u0122\1\u0172" + "\7\u0122\47\0\1\u0175\24\0\2\25\1\131\1\25\1\0" + "\2\25\1\0\1\25\1\0\1\25\3\0\2\25\2\0" + "\3\25\1\0\1\25\7\0\11\25\1\0\4\25\1\0" + "\2\25\1\0\1\25\1\0\3\25\6\0\1\u0176\1\134" + "\1\135\1\134\1\0\1\134\1\u0176\1\0\1\134\1\0" + "\1\134\3\0\2\134\2\0\3\134\1\0\1\134\7\0" + "\1\u0176\2\134\1\u0176\2\134\1\u0176\2\134\1\0\4\134"
+ + "\1\0\1\u0176\1\134\1\0\1\134\1\0\1\u0176\2\134" + "\6\0\1\u0177\1\136\1\137\1\136\1\0\1\136\1\u0177" + "\1\0\1\136\1\0\1\136\3\0\2\136\2\0\3\136" + "\1\0\1\136\7\0\1\u0177\2\136\1\u0177\2\136\1\u0177" + "\2\136\1\0\4\136\1\0\1\u0177\1\136\1\0\1\136" + "\1\0\1\u0177\2\136\54\0\1\u0178\65\0\2\u0179\30\0" + "\1\u017a\1\341\1\342\1\341\1\0\1\341\1\u017a\1\0" + "\1\341\1\u0103\1\341\3\0\2\341\2\0\3\341\1\0" + "\1\341\7\0\1\u017a\2\341\1\u017a\2\341\1\u017a\2\341" + "\1\0\4\341\1\0\1\u017a\1\341\1\0\1\341\1\0" + "\1\u017a\2\341\6\0\1\u017b\1\147\1\150\1\147\1\0" + "\1\147\1\u017b\1\0\1\147\1\0\1\147\3\0\2\147" + "\2\0\3\147\1\260\1\147\7\0\1\u017b\2\147\1\u017b" + "\2\147\1\u017b\2\147\1\0\4\147\1\0\1\u017b\1\147" + "\1\0\1\147\1\0\1\u017b\2\147\6\0\1\u017c\1\151" + "\1\152\1\151\1\153\1\151\1\u017c\27\151\1\u017c\2\151" + "\1\u017c\2\151\1\u017c\10\151\1\u017c\4\151\1\u017c\7\151" + "\1\0\1\u017d\1\154\1\155\3\154\1\u017d\1\153\26\154"
+ + "\1\u017d\2\154\1\u017d\2\154\1\u017d\10\154\1\u017d\4\154" + "\1\u017d\7\154\1\0\1\u017e\1\157\1\160\1\157\1\161" + "\1\157\1\u017e\27\157\1\u017e\2\157\1\u017e\2\157\1\u017e" + "\10\157\1\u017e\4\157\1\u017e\7\157\1\0\1\u017f\1\162" + "\1\163\3\162\1\u017f\1\161\26\162\1\u017f\2\162\1\u017f" + "\2\162\1\u017f\10\162\1\u017f\4\162\1\u017f\7\162\1\0" + "\1\u0180\1\u010a\1\u010b\1\u010a\1\0\1\u010a\1\u0180\1\0" + "\1\u010a\1\u010e\13\u010a\1\0\10\u010a\1\u0180\2\u010a\1\u0180" + "\2\u010a\1\u0180\10\u010a\1\u0180\4\u010a\1\u0180\7\u010a\1\0" + "\1\u0181\1\u010c\1\u0135\1\u010c\1\u0132\1\u010c\1\u0181\27\u010c" + "\1\u0181\2\u010c\1\u0181\2\u010c\1\u0181\10\u010c\1\u0181\4\u010c" + "\1\u0181\7\u010c\1\0\2\u010c\1\u0135\2\u0132\1\u015a\2\u010c" + "\1\u015a\1\u0182\4\u010c\2\u0132\52\u010c\1\0\2\u010c\1\u0135" + "\1\0\1\u0132\12\u010c\1\0\52\u010c\1\0\1\u0183\1\u010d" + "\1\u0136\3\u010d\1\u0183\1\u0132\26\u010d\1\u0183\2\u010d\1\u0183"
+ + "\2\u010d\1\u0183\10\u010d\1\u0183\4\u010d\1\u0183\7\u010d\1\0" + "\2\u010d\1\u0136\1\u0132\1\u010d\1\u015d\1\u010d\1\u0132\1\u015d" + "\1\u0184\4\u010d\2\u0132\52\u010d\1\0\2\u010d\1\u0136\1\0" + "\3\u010d\1\u0132\7\u010d\1\0\52\u010d\1\0\2\51\1\165" + "\1\51\1\0\2\51\1\0\1\51\1\0\1\51\3\0" + "\2\51\2\0\3\51\1\0\1\51\7\0\11\51\1\0" + "\4\51\1\0\2\51\1\0\1\51\1\0\3\51\6\0" + "\2\55\1\170\1\55\1\0\2\55\1\0\1\55\1\0" + "\1\55\3\0\2\55\2\0\3\55\1\0\1\55\7\0" + "\11\55\1\0\4\55\1\0\2\55\1\0\1\55\1\0" + "\3\55\6\0\2\62\1\173\1\62\1\0\2\62\1\0" + "\1\62\1\0\1\62\3\0\2\62\2\0\3\62\1\0" + "\1\62\7\0\11\62\1\0\4\62\1\0\2\62\1\0" + "\1\62\1\0\3\62\6\0\2\72\1\200\1\72\1\0" + "\2\72\1\0\1\72\1\0\1\72\3\0\2\72\2\0" + "\3\72\1\0\1\72\7\0\11\72\1\0\4\72\1\0" + "\2\72\1\0\1\72\1\0\3\72\6\0\2\100\1\203" + "\1\100\1\0\2\100\1\0\1\100\1\0\1\100\3\0" + "\2\100\2\0\3\100\1\0\1\100\7\0\11\100\1\0" + "\4\100\1\0\2\100\1\0\1\100\1\0\3\100\6\0"
+ + "\1\u0185\1\205\1\206\1\205\1\207\1\205\1\u0185\27\205" + "\1\u0185\2\205\1\u0185\2\205\1\u0185\10\205\1\u0185\4\205" + "\1\u0185\7\205\1\0\1\u0186\1\210\1\211\3\210\1\u0186" + "\1\207\26\210\1\u0186\2\210\1\u0186\2\210\1\u0186\10\210" + "\1\u0186\4\210\1\u0186\7\210\1\0\2\105\1\213\1\105" + "\1\0\2\105\1\0\1\105\1\0\1\105\3\0\2\105" + "\2\0\3\105\1\0\1\105\7\0\11\105\1\0\4\105" + "\1\0\2\105\1\0\1\105\1\0\3\105\6\0\1\u0187" + "\1\216\1\217\1\216\1\0\1\216\1\u0187\1\0\1\216" + "\1\0\1\216\3\0\2\216\2\0\3\216\1\0\1\216" + "\7\0\1\u0187\2\216\1\u0187\2\216\1\u0187\2\216\1\0" + "\4\216\1\0\1\u0187\1\216\1\0\1\216\1\0\1\u0187" + "\2\216\6\0\2\113\1\222\1\113\1\0\2\113\1\0" + "\1\113\1\0\1\113\3\0\2\113\2\0\3\113\1\223" + "\1\113\7\0\11\113\1\0\4\113\1\0\2\113\1\0" + "\1\113\1\0\3\113\6\0\1\u0188\1\225\1\226\1\225" + "\1\227\1\225\1\u0188\27\225\1\u0188\2\225\1\u0188\2\225" + "\1\u0188\10\225\1\u0188\4\225\1\u0188\7\225\1\0\1\u0189"
+ + "\1\230\1\231\3\230\1\u0189\1\227\26\230\1\u0189\2\230" + "\1\u0189\2\230\1\u0189\10\230\1\u0189\4\230\1\u0189\7\230" + "\1\0\1\u018a\1\235\1\236\1\235\1\0\1\235\1\u018a" + "\1\0\1\235\1\0\1\235\3\0\2\235\2\0\3\235" + "\1\0\1\235\7\0\1\u018a\2\235\1\u018a\2\235\1\u018a" + "\2\235\1\0\4\235\1\0\1\u018a\1\235\1\0\1\235" + "\1\0\1\u018a\2\235\6\0\1\u018b\5\0\1\u018b\3\0" + "\1\367\5\0\1\u018b\5\0\1\u018b\7\0\2\u018b\1\0" + "\2\u018b\1\0\2\u018b\7\0\2\u018b\3\0\2\u018b\7\0" + "\1\u018c\5\0\1\u018c\11\0\1\u018c\5\0\1\u018c\7\0" + "\2\u018c\1\0\2\u018c\1\0\2\u018c\7\0\2\u018c\3\0" + "\2\u018c\7\0\1\u018d\1\u011e\1\u011f\1\u011e\1\0\1\u011e" + "\1\u018d\1\0\1\u011e\1\u0123\13\u011e\1\0\10\u011e\1\u018d" + "\2\u011e\1\u018d\2\u011e\1\u018d\10\u011e\1\u018d\4\u011e\1\u018d" + "\7\u011e\1\0\1\u018e\1\u0121\1\u0149\1\u0121\1\u0146\1\u0121" + "\1\u018e\27\u0121\1\u018e\2\u0121\1\u018e\2\u0121\1\u018e\10\u0121" + "\1\u018e\4\u0121\1\u018e\7\u0121\1\0\2\u0121\1\u0149\2\u0146"
+ + "\1\u0170\2\u0121\1\u0170\1\u018f\4\u0121\2\u0146\52\u0121\1\0" + "\2\u0121\1\u0149\1\0\1\u0146\12\u0121\1\0\52\u0121\1\0" + "\1\u0190\1\u0122\1\u014a\3\u0122\1\u0190\1\u0146\26\u0122\1\u0190" + "\2\u0122\1\u0190\2\u0122\1\u0190\10\u0122\1\u0190\4\u0122\1\u0190" + "\7\u0122\1\0\2\u0122\1\u014a\1\u0146\1\u0122\1\u0173\1\u0122" + "\1\u0146\1\u0173\1\u0191\4\u0122\2\u0146\52\u0122\1\0\2\u0122" + "\1\u014a\1\0\3\u0122\1\u0146\7\u0122\1\0\52\u0122\42\0" + "\2\u0192\30\0\2\134\1\135\1\134\1\0\2\134\1\0" + "\1\134\1\0\1\134\3\0\2\134\2\0\3\134\1\0" + "\1\134\7\0\11\134\1\0\4\134\1\0\2\134\1\0" + "\1\134\1\0\3\134\6\0\2\136\1\137\1\136\1\0" + "\2\136\1\0\1\136\1\0\1\136\3\0\2\136\2\0" + "\3\136\1\0\1\136\7\0\11\136\1\0\4\136\1\0" + "\2\136\1\0\1\136\1\0\3\136\44\0\2\u0193\33\0" + "\1\u0194\1\341\1\342\1\341\1\0\1\341\1\u0194\1\0" + "\1\341\1\u0103\1\341\3\0\2\341\2\0\3\341\1\0" + "\1\341\7\0\1\u0194\2\341\1\u0194\2\341\1\u0194\2\341"
+ + "\1\0\4\341\1\0\1\u0194\1\341\1\0\1\341\1\0" + "\1\u0194\2\341\6\0\2\147\1\150\1\147\1\0\2\147" + "\1\0\1\147\1\0\1\147\3\0\2\147\2\0\3\147" + "\1\260\1\147\7\0\11\147\1\0\4\147\1\0\2\147" + "\1\0\1\147\1\0\3\147\6\0\2\151\1\152\1\151" + "\1\153\65\151\1\0\2\154\1\155\4\154\1\153\62\154" + "\1\0\2\157\1\160\1\157\1\161\65\157\1\0\2\162" + "\1\163\4\162\1\161\62\162\1\0\1\u0195\1\u010a\1\u010b" + "\1\u010a\1\0\1\u010a\1\u0195\1\0\1\u010a\1\u010e\13\u010a" + "\1\0\10\u010a\1\u0195\2\u010a\1\u0195\2\u010a\1\u0195\10\u010a" + "\1\u0195\4\u010a\1\u0195\7\u010a\1\0\1\u0196\1\u010c\1\u0135" + "\1\u010c\1\u0132\1\u010c\1\u0196\27\u010c\1\u0196\2\u010c\1\u0196" + "\2\u010c\1\u0196\10\u010c\1\u0196\4\u010c\1\u0196\7\u010c\1\0" + "\1\u0197\1\u010d\1\u0136\3\u010d\1\u0197\1\u0132\26\u010d\1\u0197" + "\2\u010d\1\u0197\2\u010d\1\u0197\10\u010d\1\u0197\4\u010d\1\u0197" + "\7\u010d\1\0\2\205\1\206\1\205\1\207\65\205\1\0" + "\2\210\1\211\4\210\1\207\62\210\1\0\2\216\1\217"
+ + "\1\216\1\0\2\216\1\0\1\216\1\0\1\216\3\0" + "\2\216\2\0\3\216\1\0\1\216\7\0\11\216\1\0" + "\4\216\1\0\2\216\1\0\1\216\1\0\3\216\6\0" + "\2\225\1\226\1\225\1\227\65\225\1\0\2\230\1\231" + "\4\230\1\227\62\230\1\0\2\235\1\236\1\235\1\0" + "\2\235\1\0\1\235\1\0\1\235\3\0\2\235\2\0" + "\3\235\1\0\1\235\7\0\11\235\1\0\4\235\1\0" + "\2\235\1\0\1\235\1\0\3\235\20\0\1\367\60\0" + "\1\u0198\5\0\1\u0198\11\0\1\u0198\5\0\1\u0198\7\0" + "\2\u0198\1\0\2\u0198\1\0\2\u0198\7\0\2\u0198\3\0" + "\2\u0198\7\0\1\u0199\1\u011e\1\u011f\1\u011e\1\0\1\u011e" + "\1\u0199\1\0\1\u011e\1\u0123\13\u011e\1\0\10\u011e\1\u0199" + "\2\u011e\1\u0199\2\u011e\1\u0199\10\u011e\1\u0199\4\u011e\1\u0199" + "\7\u011e\1\0\1\u019a\1\u0121\1\u0149\1\u0121\1\u0146\1\u0121" + "\1\u019a\27\u0121\1\u019a\2\u0121\1\u019a\2\u0121\1\u019a\10\u0121" + "\1\u019a\4\u0121\1\u019a\7\u0121\1\0\1\u019b\1\u0122\1\u014a" + "\3\u0122\1\u019b\1\u0146\26\u0122\1\u019b\2\u0122\1\u019b\2\u0122"
+ + "\1\u019b\10\u0122\1\u019b\4\u0122\1\u019b\7\u0122\65\0\1\u019c" + "\52\0\2\u019d\25\0\1\u019e\1\341\1\342\1\341\1\0" + "\1\341\1\u019e\1\0\1\341\1\u0103\1\341\3\0\2\341" + "\2\0\3\341\1\0\1\341\7\0\1\u019e\2\341\1\u019e" + "\2\341\1\u019e\2\341\1\0\4\341\1\0\1\u019e\1\341" + "\1\0\1\341\1\0\1\u019e\2\341\6\0\1\u019f\1\u010a" + "\1\u010b\1\u010a\1\0\1\u010a\1\u019f\1\0\1\u010a\1\u010e" + "\13\u010a\1\0\10\u010a\1\u019f\2\u010a\1\u019f\2\u010a\1\u019f" + "\10\u010a\1\u019f\4\u010a\1\u019f\7\u010a\1\0\1\u01a0\1\u010c" + "\1\u0135\1\u010c\1\u0132\1\u010c\1\u01a0\27\u010c\1\u01a0\2\u010c" + "\1\u01a0\2\u010c\1\u01a0\10\u010c\1\u01a0\4\u010c\1\u01a0\7\u010c" + "\1\0\1\u01a1\1\u010d\1\u0136\3\u010d\1\u01a1\1\u0132\26\u010d" + "\1\u01a1\2\u010d\1\u01a1\2\u010d\1\u01a1\10\u010d\1\u01a1\4\u010d" + "\1\u01a1\7\u010d\1\0\1\u01a2\5\0\1\u01a2\11\0\1\u01a2" + "\5\0\1\u01a2\7\0\2\u01a2\1\0\2\u01a2\1\0\2\u01a2" + "\7\0\2\u01a2\3\0\2\u01a2\7\0\1\u01a3\1\u011e\1\u011f"
+ + "\1\u011e\1\0\1\u011e\1\u01a3\1\0\1\u011e\1\u0123\13\u011e" + "\1\0\10\u011e\1\u01a3\2\u011e\1\u01a3\2\u011e\1\u01a3\10\u011e" + "\1\u01a3\4\u011e\1\u01a3\7\u011e\1\0\1\u01a4\1\u0121\1\u0149" + "\1\u0121\1\u0146\1\u0121\1\u01a4\27\u0121\1\u01a4\2\u0121\1\u01a4" + "\2\u0121\1\u01a4\10\u0121\1\u01a4\4\u0121\1\u01a4\7\u0121\1\0" + "\1\u01a5\1\u0122\1\u014a\3\u0122\1\u01a5\1\u0146\26\u0122\1\u01a5" + "\2\u0122\1\u01a5\2\u0122\1\u01a5\10\u0122\1\u01a5\4\u0122\1\u01a5" + "\7\u0122\47\0\1\u01a6\24\0\2\341\1\342\1\341\1\0" + "\2\341\1\0\1\341\1\u0103\1\341\3\0\2\341\2\0" + "\3\341\1\0\1\341\7\0\11\341\1\0\4\341\1\0" + "\2\341\1\0\1\341\1\0\3\341\6\0\1\u01a7\1\u010a" + "\1\u010b\1\u010a\1\0\1\u010a\1\u01a7\1\0\1\u010a\1\u010e" + "\13\u010a\1\0\10\u010a\1\u01a7\2\u010a\1\u01a7\2\u010a\1\u01a7" + "\10\u010a\1\u01a7\4\u010a\1\u01a7\7\u010a\1\0\1\u01a8\1\u010c" + "\1\u0135\1\u010c\1\u0132\1\u010c\1\u01a8\27\u010c\1\u01a8\2\u010c"
+ + "\1\u01a8\2\u010c\1\u01a8\10\u010c\1\u01a8\4\u010c\1\u01a8\7\u010c" + "\1\0\1\u01a9\1\u010d\1\u0136\3\u010d\1\u01a9\1\u0132\26\u010d" + "\1\u01a9\2\u010d\1\u01a9\2\u010d\1\u01a9\10\u010d\1\u01a9\4\u010d" + "\1\u01a9\7\u010d\1\0\1\u01aa\1\u011e\1\u011f\1\u011e\1\0" + "\1\u011e\1\u01aa\1\0\1\u011e\1\u0123\13\u011e\1\0\10\u011e" + "\1\u01aa\2\u011e\1\u01aa\2\u011e\1\u01aa\10\u011e\1\u01aa\4\u011e" + "\1\u01aa\7\u011e\1\0\1\u01ab\1\u0121\1\u0149\1\u0121\1\u0146" + "\1\u0121\1\u01ab\27\u0121\1\u01ab\2\u0121\1\u01ab\2\u0121\1\u01ab" + "\10\u0121\1\u01ab\4\u0121\1\u01ab\7\u0121\1\0\1\u01ac\1\u0122" + "\1\u014a\3\u0122\1\u01ac\1\u0146\26\u0122\1\u01ac\2\u0122\1\u01ac" + "\2\u0122\1\u01ac\10\u0122\1\u01ac\4\u0122\1\u01ac\7\u0122\1\0" + "\2\u010a\1\u010b\1\u010a\1\0\2\u010a\1\0\1\u010a\1\u010e" + "\13\u010a\1\0\44\u010a\1\0\1\u01ad\1\u010c\1\u0135\1\u010c" + "\1\u0132\1\u010c\1\u01ad\27\u010c\1\u01ad\2\u010c\1\u01ad\2\u010c"
+ + "\1\u01ad\10\u010c\1\u01ad\4\u010c\1\u01ad\7\u010c\1\0\1\u01ae" + "\1\u010d\1\u0136\3\u010d\1\u01ae\1\u0132\26\u010d\1\u01ae\2\u010d" + "\1\u01ae\2\u010d\1\u01ae\10\u010d\1\u01ae\4\u010d\1\u01ae\7\u010d" + "\1\0\2\u011e\1\u011f\1\u011e\1\0\2\u011e\1\0\1\u011e" + "\1\u0123\13\u011e\1\0\44\u011e\1\0\1\u01af\1\u0121\1\u0149" + "\1\u0121\1\u0146\1\u0121\1\u01af\27\u0121\1\u01af\2\u0121\1\u01af" + "\2\u0121\1\u01af\10\u0121\1\u01af\4\u0121\1\u01af\7\u0121\1\0" + "\1\u01b0\1\u0122\1\u014a\3\u0122\1\u01b0\1\u0146\26\u0122\1\u01b0" + "\2\u0122\1\u01b0\2\u0122\1\u01b0\10\u0122\1\u01b0\4\u0122\1\u01b0" + "\7\u0122\1\0\2\u010c\1\u0135\1\u010c\1\u0132\65\u010c\1\0" + "\2\u010d\1\u0136\4\u010d\1\u0132\62\u010d\1\0\2\u0121\1\u0149" + "\1\u0121\1\u0146\65\u0121\1\0\2\u0122\1\u014a\4\u0122\1\u0146" + "\62\u0122";
+
+ /**
+ * The transition table of the DFA
+ */
+ final private static int yytrans[] = yy_unpack(yy_packed);
+
+
+ /* error codes */
+ final private static int YY_UNKNOWN_ERROR = 0;
+ final private static int YY_ILLEGAL_STATE = 1;
+ final private static int YY_NO_MATCH = 2;
+ final private static int YY_PUSHBACK_2BIG = 3;
+
+ /* error messages for the codes above */
+ final private static String YY_ERROR_MSG[] = {"Unkown internal scanner error", "Internal error: unknown state", "Error: could not match input", "Error: pushback value was too large"};
+
+ /**
+ * YY_ATTRIBUTE[aState] contains the attributes of state
+ * <code>aState</code>
+ */
+ private final static byte YY_ATTRIBUTE[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 1, 1, 1, 1, 1, 1, 9, 1, 9, 1, 1, 9, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 9, 9, 1, 1, 1, 9, 1, 3, 9, 9, 1, 1, 1, 9, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 9, 3, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 13, 7, 0, 1, 1, 0, 1, 0, 0, 9, 0, 0, 1, 0, 1, 1, 1, 0, 0, 9, 0, 9, 1, 0, 0, 9, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 13, 7, 1, 9, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 9, 9, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 9, 0, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 9, 0, 1, 1, 1, 0, 0, 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 9, 0, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ /** the input device */
+ private java.io.Reader yy_reader;
+
+ /** the current state of the DFA */
+ private int yy_state;
+
+ /** the current lexical state */
+ private int yy_lexical_state = YYINITIAL;
+
+ /**
+ * this buffer contains the current text to be matched and is the source
+ * of the yytext() string
+ */
+ private char yy_buffer[] = new char[16384];
+
+ /** the textposition at the last accepting state */
+ private int yy_markedPos;
+
+ /** the textposition at the last state to be included in yytext */
+ private int yy_pushbackPos;
+
+ /** the current text position in the buffer */
+ private int yy_currentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int yy_startRead;
+
+ /**
+ * endRead marks the last character in the buffer, that has been read from
+ * input
+ */
+ private int yy_endRead;
+
+ /** number of newlines encountered up to the start of the matched text */
+ private int yyline;
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+ /**
+ * the number of characters from the last newline up to the start of the
+ * matched text
+ */
+ private int yycolumn;
+
+ /**
+ * yy_atBOL == true <=>the scanner is currently at the beginning of a
+ * line
+ */
+ private boolean yy_atBOL;
+
+ /** yy_atEOF == true <=>the scanner has returned a value for EOF */
+ private boolean yy_atEOF;
+
+ /* user code: */
+ private final static String UNDEFINED = "undefined";
+ private String fBufferedContext = null;
+ private int fBufferedStart;
+ // private int fBufferedTextLength;
+ private int fBufferedLength;
+ // private StringBuffer fBufferedText = null;
+ private CSSTextRegionFactory fRegionFactory = CSSTextRegionFactory.getInstance();
+ private int fInitialState = YYINITIAL;
+ public final static int BUFFER_SIZE_NORMAL = 16384;
+ public final static int BUFFER_SIZE_SMALL = 256;
+ private int fInitialBufferSize = BUFFER_SIZE_NORMAL;
+
+ public void setInitialState(int state) {
+ fInitialState = state;
+ }
+
+ public void setInitialBufferSize(int size) {
+ fInitialBufferSize = size;
+ }
+
+ /* user method */
+ public final ITextRegion getNextToken() throws IOException {
+ String context;
+ String nextTokenType;
+ boolean spaceFollows;
+ // StringBuffer text;
+ int start;
+ int textLength;
+ int length;
+ if (fBufferedContext != null) {
+ context = fBufferedContext;
+ // text = fBufferedText;
+ start = fBufferedStart;
+ textLength = length = fBufferedLength;
+
+ fBufferedContext = null;
+ }
+ else {
+ context = primGetNextToken();
+ // text = new StringBuffer(yytext());
+ start = yychar;
+ textLength = length = yylength();
+ }
+
+ if (context != null) {
+ if (context == UNDEFINED) {
+ // undef -> concatenate undef's
+ nextTokenType = primGetNextToken();
+ while (nextTokenType == UNDEFINED) {
+ // text.append(yytext());
+ textLength += yylength();
+ length = textLength;
+ nextTokenType = primGetNextToken();
+ }
+ fBufferedContext = nextTokenType;
+ // fBufferedText = new StringBuffer(yytext());
+ fBufferedStart = yychar;
+ fBufferedLength = yylength();
+ }
+ else {
+ nextTokenType = null;
+ spaceFollows = false;
+ if (CSSRegionUtil.isDeclarationValueType(context)) { // declaration
+ // value
+ // can
+ // contain
+ // VALUE_S
+ nextTokenType = primGetNextToken();
+ spaceFollows = (nextTokenType == CSS_DECLARATION_VALUE_S);
+ }
+ else if (canContainSpace(context)) {
+ nextTokenType = primGetNextToken();
+ spaceFollows = (nextTokenType == CSS_S);
+ }
+ if (nextTokenType != null) { // nextToken is retrieved
+ if (spaceFollows) {
+ // next is space -> append
+ // text.append(yytext());
+ length += yylength();
+ }
+ else {
+ // next is NOT space -> push this for next time,
+ // return itself
+ fBufferedContext = nextTokenType;
+ // fBufferedText = new StringBuffer(yytext());
+ fBufferedStart = yychar;
+ fBufferedLength = yylength();
+ }
+ }
+ }
+ }
+
+ if (context != null) {
+ if (context == UNDEFINED) {
+ context = CSS_UNKNOWN;
+ }
+ return fRegionFactory.createRegion(context, start, textLength, length);
+ }
+ else {
+ return null;
+ }
+ }
+
+ /* user method */
+ /* for standalone use */
+ public final List parseText() throws IOException {
+ List tokens = new ArrayList();
+
+ CSSTextToken token;
+ for (String kind = primGetNextToken(); kind != null; kind = primGetNextToken()) {
+ token = new CSSTextToken();
+ token.kind = kind;
+ token.start = yychar;
+ token.length = yylength();
+ token.image = yytext();
+ tokens.add(token);
+ }
+
+ return tokens;
+ }
+
+ /* user method */
+ private boolean canContainSpace(String type) {
+ if (type == CSS_DELIMITER || type == CSS_RBRACE || type == CSS_DECLARATION_DELIMITER) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ /* user method */
+ public final int getOffset() {
+ return yychar;
+ }
+
+ /* user method */
+ public final boolean isEOF() {
+ return yy_atEOF;
+ }
+
+ /* user method */
+ public void reset(char[] charArray) {
+ reset(new CharArrayReader(charArray), 0);
+ }
+
+ /* user method */
+ public final void reset(java.io.Reader in, int newOffset) {
+ /** the input device */
+ yy_reader = in;
+
+ /** the current state of the DFA */
+ yy_state = 0;
+
+ /** the current lexical state */
+ yy_lexical_state = fInitialState; // YYINITIAL;
+
+ /**
+ * this buffer contains the current text to be matched and is the
+ * source of the yytext() string
+ */
+ if (yy_buffer.length != fInitialBufferSize) {
+ yy_buffer = new char[fInitialBufferSize];
+ }
+ java.util.Arrays.fill(yy_buffer, (char) 0);
+
+ /** the textposition at the last accepting state */
+ yy_markedPos = 0;
+
+ /** the textposition at the last state to be included in yytext */
+ yy_pushbackPos = 0;
+
+ /** the current text position in the buffer */
+ yy_currentPos = 0;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ yy_startRead = 0;
+
+ /**
+ * endRead marks the last character in the buffer, that has been read
+ * from input
+ */
+ yy_endRead = 0;
+
+ /** number of newlines encountered up to the start of the matched text */
+ yyline = 0;
+
+ /** the number of characters up to the start of the matched text */
+ yychar = 0;
+
+ /**
+ * the number of characters from the last newline up to the start of
+ * the matched text
+ */
+ yycolumn = 0;
+
+ /**
+ * yy_atBOL == true <=>the scanner is currently at the beginning of a
+ * line
+ */
+ yy_atBOL = false;
+
+ /** yy_atEOF == true <=>the scanner has returned a value for EOF */
+ yy_atEOF = false;
+
+ /* user variables */
+ // fUndefined.delete(0, fUndefined.length());
+ }
+
+ /* user method */
+ public CSSTokenizer() {
+ super();
+ }
+
+
+
+ /**
+ * Creates a new scanner There is also a java.io.InputStream version of
+ * this constructor.
+ *
+ * @param in
+ * the java.io.Reader to read input from.
+ */
+ public CSSTokenizer(java.io.Reader in) {
+ this.yy_reader = in;
+ }
+
+ /**
+ * Creates a new scanner. There is also java.io.Reader version of this
+ * constructor.
+ *
+ * @param in
+ * the java.io.Inputstream to read input from.
+ */
+ public CSSTokenizer(java.io.InputStream in) {
+ this(new java.io.InputStreamReader(in));
+ }
+
+ /**
+ * Unpacks the compressed DFA transition table.
+ *
+ * @param packed
+ * the packed transition table
+ * @return the unpacked transition table
+ */
+ private static int[] yy_unpack(String packed) {
+ int[] trans = new int[21004];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 13906) {
+ int count = packed.charAt(i++);
+ int value = packed.charAt(i++);
+ value--;
+ do
+ trans[j++] = value;
+ while (--count > 0);
+ }
+ return trans;
+ }
+
+ /**
+ * Unpacks the compressed character translation table.
+ *
+ * @param packed
+ * the packed character translation table
+ * @return the unpacked character translation table
+ */
+ private static char[] yy_unpack_cmap(String packed) {
+ char[] map = new char[0x10000];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 170) {
+ int count = packed.charAt(i++);
+ char value = packed.charAt(i++);
+ do
+ map[j++] = value;
+ while (--count > 0);
+ }
+ return map;
+ }
+
+
+ /**
+ * Gets the next input character.
+ *
+ * @return the next character of the input stream, EOF if the end of the
+ * stream is reached.
+ * @exception IOException
+ * if any I/O-Error occurs
+ */
+ private int yy_advance() throws java.io.IOException {
+
+ /* standard case */
+ if (yy_currentPos < yy_endRead)
+ return yy_buffer[yy_currentPos++];
+
+ /* if the eof is reached, we don't need to work hard */
+ if (yy_atEOF)
+ return YYEOF;
+
+ /* otherwise: need to refill the buffer */
+
+ /* first: make room (if you can) */
+ if (yy_startRead > 0) {
+ System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0, yy_endRead - yy_startRead);
+
+ /* translate stored positions */
+ yy_endRead -= yy_startRead;
+ yy_currentPos -= yy_startRead;
+ yy_markedPos -= yy_startRead;
+ yy_pushbackPos -= yy_startRead;
+ yy_startRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (yy_currentPos >= yy_buffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[yy_currentPos * 2];
+ System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+ yy_buffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = yy_reader.read(yy_buffer, yy_endRead, yy_buffer.length - yy_endRead);
+
+ if (numRead == -1)
+ return YYEOF;
+
+ yy_endRead += numRead;
+
+ return yy_buffer[yy_currentPos++];
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ final public void yyclose() throws java.io.IOException {
+ yy_atEOF = true; /* indicate end of file */
+ yy_endRead = yy_startRead; /* invalidate buffer */
+ yy_reader.close();
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ final public int yystate() {
+ return yy_lexical_state;
+ }
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState
+ * the new lexical state
+ */
+ final public void yybegin(int newState) {
+ yy_lexical_state = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ final public String yytext() {
+ return new String(yy_buffer, yy_startRead, yy_markedPos - yy_startRead);
+ }
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ final public int yylength() {
+ return yy_markedPos - yy_startRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * @param errorCode
+ * the code of the errormessage to display
+ */
+ private void yy_ScanError(int errorCode) {
+ try {
+ System.out.println(YY_ERROR_MSG[errorCode]);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println(YY_ERROR_MSG[YY_UNKNOWN_ERROR]);
+ e.printStackTrace();
+
+ }
+
+ // System.exit(1);
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number
+ * the number of characters to be read again. This number must
+ * not be greater than yylength()!
+ */
+ private void yypushback(int number) {
+ if (number > yylength())
+ yy_ScanError(YY_PUSHBACK_2BIG);
+
+ yy_markedPos -= number;
+ }
+
+
+ /**
+ * Resumes scanning until the next regular expression is matched, the end
+ * of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception IOException
+ * if any I/O-Error occurs
+ */
+ public String primGetNextToken() throws java.io.IOException {
+ int yy_input;
+ int yy_action;
+
+ yy_pushbackPos = -1;
+ boolean yy_was_pushback;
+
+ while (true) {
+
+ yychar += yylength();
+
+ boolean yy_counted = false;
+ for (yy_currentPos = yy_startRead; yy_currentPos < yy_markedPos; yy_currentPos++) {
+ switch (yy_buffer[yy_currentPos]) {
+ case '\r' :
+ yyline++;
+ yy_counted = true;
+ break;
+ case '\n' :
+ if (yy_counted)
+ yy_counted = false;
+ else {
+ yyline++;
+ }
+ break;
+ default :
+ yy_counted = false;
+ }
+ }
+
+ if (yy_counted) {
+ if (yy_advance() == '\n')
+ yyline--;
+ if (!yy_atEOF)
+ yy_currentPos--;
+ }
+
+ yy_action = -1;
+
+ yy_currentPos = yy_startRead = yy_markedPos;
+
+ yy_state = yy_lexical_state;
+
+ yy_was_pushback = false;
+
+ yy_forAction : {
+ while (true) {
+
+ yy_input = yy_advance();
+
+ if (yy_input == YYEOF)
+ break yy_forAction;
+
+ int yy_next = yytrans[yy_rowMap[yy_state] + yycmap[yy_input]];
+ if (yy_next == -1)
+ break yy_forAction;
+ yy_state = yy_next;
+
+ int yy_attributes = YY_ATTRIBUTE[yy_state];
+ if ((yy_attributes & 2) > 0)
+ yy_pushbackPos = yy_currentPos;
+
+ if ((yy_attributes & 1) > 0) {
+ yy_was_pushback = (yy_attributes & 4) > 0;
+ yy_action = yy_state;
+ yy_markedPos = yy_currentPos;
+ if ((yy_attributes & 8) > 0)
+ break yy_forAction;
+ }
+
+ }
+ }
+
+ if (yy_was_pushback)
+ yy_markedPos = yy_pushbackPos;
+
+ switch (yy_action) {
+
+ case 421 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_IMPORTANT;
+ }
+ case 433 :
+ break;
+ case 412 : {
+ yybegin(ST_FONT_FACE_DELIMITER);
+ return CSS_FONT_FACE;
+ }
+ case 434 :
+ break;
+ case 375 : {
+ yybegin(ST_CHARSET_NAME);
+ return CSS_CHARSET;
+ }
+ case 435 :
+ break;
+ case 335 : {
+ yybegin(ST_IMPORT_URI);
+ return CSS_IMPORT;
+ }
+ case 436 :
+ break;
+ case 297 : {
+ yybegin(ST_MEDIA_MEDIUM);
+ return CSS_MEDIA;
+ }
+ case 437 :
+ break;
+ case 290 :
+ case 327 :
+ case 398 :
+ case 400 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_URI;
+ }
+ case 438 :
+ break;
+ case 269 :
+ case 307 :
+ case 385 :
+ case 387 : {
+ yybegin(ST_IMPORT_MEDIUM);
+ return CSS_URI;
+ }
+ case 439 :
+ break;
+ case 255 : {
+ yybegin(ST_PAGE_PSEUDO_PAGE);
+ return CSS_PAGE;
+ }
+ case 440 :
+ break;
+ case 218 : {
+ return CSS_COMMENT;
+ }
+ case 441 :
+ break;
+ case 217 : {
+ return CSS_CDO;
+ }
+ case 442 :
+ break;
+ case 211 :
+ case 245 :
+ case 283 :
+ case 284 :
+ case 323 :
+ case 324 :
+ case 363 :
+ case 364 :
+ case 394 :
+ case 395 :
+ case 407 :
+ case 417 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_UNICODE_RANGE;
+ }
+ case 443 :
+ break;
+ case 165 : {
+ return CSS_CDC;
+ }
+ case 444 :
+ break;
+ case 162 : {
+ return CSS_DECLARATION_VALUE_S;
+ }
+ case 445 :
+ break;
+ case 156 :
+ case 210 :
+ case 244 :
+ case 282 :
+ case 322 :
+ case 362 :
+ case 393 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_HASH;
+ }
+ case 446 :
+ break;
+ case 150 :
+ case 205 :
+ case 208 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_STRING;
+ }
+ case 447 :
+ break;
+ case 57 :
+ case 59 :
+ case 128 :
+ case 129 :
+ case 193 :
+ case 235 :
+ case 273 :
+ case 313 :
+ case 353 : {
+ yybegin(ST_SELECTOR_ATTRIBUTE_OPERATOR);
+ return CSS_SELECTOR_ATTRIBUTE_NAME;
+ }
+ case 448 :
+ break;
+ case 56 : {
+ yybegin(ST_SELECTOR);
+ return CSS_SELECTOR_SEPARATOR;
+ }
+ case 449 :
+ break;
+ case 55 :
+ case 125 : {
+ yybegin(ST_SELECTOR);
+ return CSS_SELECTOR_COMBINATOR;
+ }
+ case 450 :
+ break;
+ case 52 : {
+ yybegin(ST_DECLARATION);
+ return CSS_LBRACE;
+ }
+ case 451 :
+ break;
+ case 49 :
+ case 51 :
+ case 123 :
+ case 124 :
+ case 192 :
+ case 234 :
+ case 272 :
+ case 312 :
+ case 352 : {
+ yybegin(ST_PAGE_DELIMITER);
+ return CSS_PAGE_SELECTOR;
+ }
+ case 452 :
+ break;
+ case 48 : {
+ yybegin(YYINITIAL);
+ return CSS_LBRACE;
+ }
+ case 453 :
+ break;
+ case 47 : {
+ yybegin(ST_MEDIA_MEDIUM);
+ return CSS_MEDIA_SEPARATOR;
+ }
+ case 454 :
+ break;
+ case 44 :
+ case 46 :
+ case 120 :
+ case 121 :
+ case 191 :
+ case 233 :
+ case 271 :
+ case 311 :
+ case 351 : {
+ yybegin(ST_MEDIA_DELIMITER);
+ return CSS_MEDIUM;
+ }
+ case 455 :
+ break;
+ case 43 : {
+ yybegin(ST_IMPORT_MEDIUM);
+ return CSS_MEDIA_SEPARATOR;
+ }
+ case 456 :
+ break;
+ case 20 :
+ case 23 :
+ case 89 :
+ case 90 :
+ case 164 :
+ case 214 :
+ case 249 :
+ case 292 :
+ case 331 : {
+ yybegin(ST_SELECTOR_MODIFIER);
+ return CSS_SELECTOR_ELEMENT_NAME;
+ }
+ case 457 :
+ break;
+ case 22 :
+ case 54 :
+ case 87 :
+ case 126 :
+ case 163 : {
+ return CSS_S;
+ }
+ case 458 :
+ break;
+ case 27 : {
+ yybegin(YYINITIAL);
+ return CSS_RBRACE;
+ }
+ case 459 :
+ break;
+ case 29 : {
+ yybegin(ST_SELECTOR_MODIFIER);
+ return CSS_SELECTOR_UNIVERSAL;
+ }
+ case 460 :
+ break;
+ case 32 : {
+ yybegin(ST_SELECTOR_ATTRIBUTE_NAME);
+ return CSS_SELECTOR_ATTRIBUTE_START;
+ }
+ case 461 :
+ break;
+ case 36 : {
+ yybegin(YYINITIAL);
+ return CSS_DELIMITER;
+ }
+ case 462 :
+ break;
+ case 40 :
+ case 42 :
+ case 117 :
+ case 118 :
+ case 190 :
+ case 232 :
+ case 270 :
+ case 310 :
+ case 350 : {
+ yybegin(ST_IMPORT_DELIMITER);
+ return CSS_MEDIUM;
+ }
+ case 463 :
+ break;
+ case 60 : {
+ yybegin(ST_SELECTOR_ATTRIBUTE_VALUE);
+ return CSS_SELECTOR_ATTRIBUTE_OPERATOR;
+ }
+ case 464 :
+ break;
+ case 62 : {
+ yybegin(ST_SELECTOR_MODIFIER);
+ return CSS_SELECTOR_ATTRIBUTE_END;
+ }
+ case 465 :
+ break;
+ case 63 :
+ case 67 :
+ case 131 :
+ case 134 :
+ case 137 :
+ case 194 :
+ case 196 :
+ case 199 :
+ case 236 :
+ case 274 :
+ case 314 :
+ case 354 : {
+ yybegin(ST_SELECTOR_ATTRIBUTE_END);
+ return CSS_SELECTOR_ATTRIBUTE_VALUE;
+ }
+ case 466 :
+ break;
+ case 68 :
+ case 70 :
+ case 139 :
+ case 140 :
+ case 201 :
+ case 239 :
+ case 277 :
+ case 317 :
+ case 357 : {
+ yybegin(ST_DECLARATION_SEPARATOR);
+ return CSS_DECLARATION_PROPERTY;
+ }
+ case 467 :
+ break;
+ case 71 : {
+ yybegin(ST_DECLARATION);
+ return CSS_DECLARATION_DELIMITER;
+ }
+ case 468 :
+ break;
+ case 72 : {
+ yybegin(ST_DECLARATION_PRE_VALUE);
+ return CSS_DECLARATION_SEPARATOR;
+ }
+ case 469 :
+ break;
+ case 73 :
+ case 155 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_NUMBER;
+ }
+ case 470 :
+ break;
+ case 74 :
+ case 79 :
+ case 83 :
+ case 147 :
+ case 153 :
+ case 154 :
+ case 159 :
+ case 203 :
+ case 212 :
+ case 241 :
+ case 279 :
+ case 319 :
+ case 359 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_IDENT;
+ }
+ case 471 :
+ break;
+ case 78 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE;
+ }
+ case 472 :
+ break;
+ case 85 :
+ case 86 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_OPERATOR;
+ }
+ case 473 :
+ break;
+ case 91 :
+ case 166 :
+ case 215 :
+ case 250 :
+ case 293 :
+ case 332 :
+ case 373 : {
+ yybegin(ST_SELECTOR_MODIFIER);
+ return CSS_SELECTOR_CLASS;
+ }
+ case 474 :
+ break;
+ case 93 :
+ case 167 :
+ case 216 :
+ case 251 :
+ case 294 :
+ case 333 :
+ case 374 : {
+ yybegin(ST_SELECTOR_MODIFIER);
+ return CSS_SELECTOR_ID;
+ }
+ case 475 :
+ break;
+ case 102 :
+ case 176 :
+ case 226 :
+ case 258 :
+ case 260 :
+ case 300 :
+ case 338 :
+ case 378 : {
+ yybegin(ST_SELECTOR_MODIFIER);
+ return CSS_SELECTOR_PSEUDO;
+ }
+ case 476 :
+ break;
+ case 106 :
+ case 178 :
+ case 181 : {
+ yybegin(ST_CHARSET_DELIMITER);
+ return CSS_STRING;
+ }
+ case 477 :
+ break;
+ case 112 :
+ case 184 :
+ case 187 : {
+ yybegin(ST_IMPORT_MEDIUM);
+ return CSS_STRING;
+ }
+ case 478 :
+ break;
+ case 141 :
+ case 202 :
+ case 240 :
+ case 278 :
+ case 318 :
+ case 358 :
+ case 390 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_DIMENSION;
+ }
+ case 479 :
+ break;
+ case 144 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_PERCENTAGE;
+ }
+ case 480 :
+ break;
+ case 146 :
+ case 247 : {
+ yybegin(ST_DECLARATION_VALUE);
+ return CSS_DECLARATION_VALUE_FUNCTION;
+ }
+ case 481 :
+ break;
+ case 19 :
+ case 21 :
+ case 24 :
+ case 25 :
+ case 26 :
+ case 28 :
+ case 30 :
+ case 31 :
+ case 33 :
+ case 34 :
+ case 35 :
+ case 37 :
+ case 38 :
+ case 39 :
+ case 41 :
+ case 45 :
+ case 50 :
+ case 53 :
+ case 58 :
+ case 61 :
+ case 64 :
+ case 65 :
+ case 66 :
+ case 69 :
+ case 75 :
+ case 76 :
+ case 77 :
+ case 80 :
+ case 81 :
+ case 82 :
+ case 84 : {
+ return UNDEFINED;
+ }
+ case 482 :
+ break;
+ default :
+ if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+ yy_atEOF = true;
+ return null;
+ }
+ else {
+ yy_ScanError(YY_NO_MATCH);
+ }
+ }
+ }
+ }
+
+ /**
+ * Runs the scanner on input files.
+ *
+ * This main method is the debugging routine for the scanner. It prints
+ * each returned token to System.out until the end of file is reached, or
+ * an error occured.
+ *
+ * @param argv
+ * the command line, contains the filenames to run the scanner
+ * on.
+ */
+ public static void main(String argv[]) {
+ for (int i = 0; i < argv.length; i++) {
+ CSSTokenizer scanner = null;
+ try {
+ scanner = new CSSTokenizer(new java.io.FileReader(argv[i]));
+ }
+ catch (java.io.FileNotFoundException e) {
+ System.out.println("File not found : \"" + argv[i] + "\"");
+ System.exit(1);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("Usage : java CSSTokenizer <inputfile>");
+ System.exit(1);
+ }
+
+ try {
+ do {
+ System.out.println(scanner.primGetNextToken());
+ }
+ while (!scanner.yy_atEOF);
+
+ }
+ catch (java.io.IOException e) {
+ System.out.println("An I/O error occured while scanning :");
+ System.out.println(e);
+ System.exit(1);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSContextRegion.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSContextRegion.java
new file mode 100644
index 0000000000..1548f41cab
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSContextRegion.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.parser.regions;
+
+import org.eclipse.wst.sse.core.internal.parser.ContextRegion;
+
+public class CSSContextRegion extends ContextRegion {
+ public CSSContextRegion(String context, int start, int textLength, int length) {
+ fType = context;
+ fStart = start;
+ fTextLength = textLength;
+ fLength = length;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSTextRegionFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSTextRegionFactory.java
new file mode 100644
index 0000000000..2fcfa760c5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/parser/regions/CSSTextRegionFactory.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.parser.regions;
+
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+public class CSSTextRegionFactory {
+ public synchronized static CSSTextRegionFactory getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSTextRegionFactory();
+ }
+ return fInstance;
+ }
+
+ public ITextRegion createRegion(String context, int start, int textLength, int length) {
+ ITextRegion region = null;
+ region = new CSSContextRegion(context, start, textLength, length);
+ return region;
+ }
+
+ private CSSTextRegionFactory() {
+ super();
+ }
+
+ private static CSSTextRegionFactory fInstance = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/tasks/CSSTaskTagSeeker.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/tasks/CSSTaskTagSeeker.java
new file mode 100644
index 0000000000..95bb82eb73
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/tasks/CSSTaskTagSeeker.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.tasks;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.participants.TaskTagSeeker;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+public class CSSTaskTagSeeker extends TaskTagSeeker {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.builder.participants.TaskTagSeeker#getCommentedText(org.eclipse.jface.text.IDocument,
+ * int, int)
+ */
+ protected String getCommentedText(IDocument document, int begin, int length) throws BadLocationException {
+ String text = super.getCommentedText(document, begin, length);
+ if (text != null && text.endsWith("*/")) { //$NON-NLS-1$
+ text = text.substring(0, text.length() - 2);
+ }
+ return text;
+ }
+
+ protected boolean isCommentRegion(IStructuredDocumentRegion region, ITextRegion textRegion) {
+ return textRegion.getType().equals(CSSRegionContexts.CSS_COMMENT);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentReParser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentReParser.java
new file mode 100644
index 0000000000..804b480b4d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentReParser.java
@@ -0,0 +1,451 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.text;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.internal.text.StructuredDocumentReParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredTextReParser;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+
+/**
+ * This class provides a centralized place to put "reparsing" logic. This is
+ * the logic that reparses the text incrementally, as a user types in new
+ * characters, or DOM nodes are inserted or deleted. Note: it is not a thread
+ * safe class.
+ */
+public class CSSStructuredDocumentReParser extends StructuredDocumentReParser {
+
+ class ReparseRange {
+ ReparseRange() {
+ reset();
+ }
+
+ ReparseRange(int start, int end) {
+ fRangeStart = start;
+ fRangeEnd = end;
+ }
+
+ void setStart(int start) {
+ fRangeStart = start;
+ }
+
+ void setEnd(int end) {
+ fRangeEnd = end;
+ }
+
+ int getStart() {
+ return fRangeStart;
+ }
+
+ int getEnd() {
+ return fRangeEnd;
+ }
+
+ boolean isValid() {
+ return (0 < fRangeEnd - fRangeStart) ? true : false;
+ }
+
+ void reset() {
+ fRangeStart = Integer.MAX_VALUE;
+ fRangeEnd = 0;
+ }
+
+ void expand(ReparseRange range) {
+ if (range == null || !range.isValid()) {
+ return;
+ }
+ int start = range.getStart();
+ if (start < fRangeStart) {
+ fRangeStart = start;
+ }
+ int end = range.getEnd();
+ if (fRangeEnd < end) {
+ fRangeEnd = end;
+ }
+ }
+
+ private int fRangeStart;
+ private int fRangeEnd;
+ }
+
+ /**
+ *
+ */
+ public CSSStructuredDocumentReParser() {
+ super();
+ }
+
+ /**
+ *
+ */
+ // public StructuredDocumentEvent
+ // checkForCrossStructuredDocumentRegionBoundryCases2() {
+ // StructuredDocumentEvent result = specialPositionUpdate(fStart, fStart +
+ // fLengthToReplace - 1);
+ // if (result == null) {
+ // result = checkInsideBrace();
+ // }
+ // return result;
+ // }
+ protected StructuredDocumentEvent checkForCrossStructuredDocumentRegionSyntax() {
+ int checkStart = fStart;
+ int checkEnd = fStart + fLengthToReplace - 1;
+ IStructuredDocumentRegion endRegion = fStructuredDocument.getRegionAtCharacterOffset(checkEnd);
+ if (endRegion != null) {
+ checkEnd = endRegion.getEndOffset();
+ }
+
+ ReparseRange range = new ReparseRange(checkStart, checkEnd);
+
+ range.expand(getUpdateRangeForDelimiter(range.getStart(), range.getEnd()));
+ range.expand(getUpdateRangeForUnknownRegion(range.getStart(), range.getEnd()));
+
+ range.expand(getUpdateRangeForQuotes(range.getStart(), range.getEnd()));
+ range.expand(getUpdateRangeForComments(range.getStart(), range.getEnd()));
+ range.expand(getUpdateRangeForBraces(range.getStart(), range.getEnd()));
+
+ StructuredDocumentEvent result;
+
+ result = checkInsideBrace(range.getStart(), range.getEnd());
+
+ if (result == null) {
+ result = reparse(range.getStart(), range.getEnd());
+ }
+
+ return result;
+ }
+
+ private ReparseRange getUpdateRangeForUnknownRegion(int start, int end) {
+ int newStart = start;
+ RegionIterator iterator = new RegionIterator(fStructuredDocument, start - 1);
+ if (iterator.hasPrev()) {
+ iterator.prev(); // skip myself
+ }
+ while (iterator.hasPrev()) {
+ ITextRegion region = iterator.prev();
+ if (region != null && region.getType() == CSSRegionContexts.CSS_UNKNOWN) {
+ newStart = iterator.getStructuredDocumentRegion().getStartOffset(region);
+ }
+ else {
+ break;
+ }
+ }
+
+ if (start != newStart) {
+ return new ReparseRange(newStart, end);
+ }
+
+ return null;
+ }
+
+ private ReparseRange getUpdateRangeForDelimiter(int start, int end) {
+ if (dirtyStart != null && dirtyStart.getStart() < start) {
+ start = dirtyStart.getStart();
+ }
+ IStructuredDocumentRegion docRegion = fStructuredDocument.getRegionAtCharacterOffset(start);
+ if (docRegion == null) {
+ return null;
+ }
+ if (docRegion.getType() == CSSRegionContexts.CSS_DELIMITER) {
+ IStructuredDocumentRegion prevRegion = docRegion.getPrevious();
+ if (prevRegion != null) {
+ return new ReparseRange(prevRegion.getStart(), end);
+ }
+ }
+
+ return null;
+ }
+
+ private ReparseRange getUpdateRangeForQuotes(int start, int end) {
+ ReparseRange range = new ReparseRange();
+
+ range.expand(getUpdateRangeForPair(start, end, "\"", "\"")); //$NON-NLS-2$//$NON-NLS-1$
+ range.expand(getUpdateRangeForPair(start, end, "\'", "\'")); //$NON-NLS-2$//$NON-NLS-1$
+
+ return (range.isValid()) ? range : null;
+ }
+
+ private ReparseRange getUpdateRangeForComments(int start, int end) {
+ ReparseRange range = new ReparseRange();
+
+ range.expand(getUpdateRangeForPair(start, end, "/*", "*/")); //$NON-NLS-2$//$NON-NLS-1$
+ range.expand(getUpdateRangeForPair(start, end, "<%", "%>")); //$NON-NLS-2$//$NON-NLS-1$
+
+ return (range.isValid()) ? range : null;
+ }
+
+ private ReparseRange getUpdateRangeForBraces(int start, int end) {
+ ReparseRange range = new ReparseRange();
+
+ range.expand(getUpdateRangeForPair(start, end, "[", "]")); //$NON-NLS-2$//$NON-NLS-1$
+ range.expand(getUpdateRangeForPair(start, end, "(", ")")); //$NON-NLS-2$//$NON-NLS-1$
+ range.expand(getUpdateRangeForPair(start, end, "{", "}")); //$NON-NLS-2$//$NON-NLS-1$
+
+ return (range.isValid()) ? range : null;
+ }
+
+ private StructuredDocumentEvent checkInsideBrace(int start, int end) {
+ StructuredDocumentEvent result = null;
+ IStructuredDocumentRegion region = fStructuredDocument.getRegionAtCharacterOffset(start);
+ if (region == null) {
+ return null;
+ }
+ boolean bDeclaration = false;
+ String type = region.getType();
+ if (CSSRegionUtil.isDeclarationType(type) || type == CSSRegionContexts.CSS_LBRACE || type == CSSRegionContexts.CSS_RBRACE) {
+ bDeclaration = true;
+ }
+ if (!bDeclaration) {
+ IStructuredDocumentRegion prevRegion = CSSUtil.findPreviousSignificantNode(region);
+ if (prevRegion != null) {
+ type = prevRegion.getType();
+ if (CSSRegionUtil.isDeclarationType(type) || type == CSSRegionContexts.CSS_LBRACE) {
+ bDeclaration = true;
+ }
+ }
+ }
+ if (!bDeclaration) {
+ IStructuredDocumentRegion nextRegion = CSSUtil.findNextSignificantNode(region);
+ if (nextRegion != null) {
+ type = nextRegion.getType();
+ if (CSSRegionUtil.isDeclarationType(type) || type == CSSRegionContexts.CSS_RBRACE) {
+ bDeclaration = true;
+ }
+ }
+ }
+
+ if (bDeclaration) {
+ IStructuredDocumentRegion startRegion = findRuleStart(region);
+ if (startRegion != null) {
+ IStructuredDocumentRegion endRegion = fStructuredDocument.getRegionAtCharacterOffset(end);
+ if (endRegion != null) {
+ result = reparse(startRegion, endRegion);
+ }
+ }
+ }
+ return result;
+ }
+
+ private IStructuredDocumentRegion findRuleStart(IStructuredDocumentRegion startRegion) {
+ IStructuredDocumentRegion region = startRegion;
+ // find '{'
+ while (region != null && region.getType() != CSSRegionContexts.CSS_LBRACE) {
+ region = region.getPrevious();
+ }
+ // if (region == startRegion) {
+ // return null;
+ // }
+ // else
+ if (region != null) { // '{' is found
+ region = region.getPrevious();
+ if (isLeadingDeclarationType(region.getType())) {
+ return region;
+ }
+ }
+ return null;
+ }
+
+ private boolean isLeadingDeclarationType(String type) {
+ return (type == CSSRegionContexts.CSS_PAGE || type == CSSRegionContexts.CSS_FONT_FACE || CSSRegionUtil.isSelectorType(type));
+ }
+
+ // public StructuredDocumentEvent
+ // checkForCrossStructuredDocumentRegionBoundryCases() {
+ // return specialPositionUpdate(fStart, fStart + fLengthToReplace - 1);
+ // }
+ /**
+ *
+ */
+ private ReparseRange getUpdateRangeForPair(int start, int end, String opener, String closer) {
+ StringBuffer deletionBuf = new StringBuffer();
+ StringBuffer insertionBuf = new StringBuffer();
+ int quoteLen = Math.max(opener.length(), closer.length());
+ if (1 < quoteLen) {
+ /**
+ * ex) opener = "ABC", closer = "XYZ" model: ABCDEF.......UVWXYZ
+ * deletion: CDEF.......UVWX pre/post: AB / YZ
+ */
+ int addStart = start - (quoteLen - 1);
+ if (0 <= addStart) {
+ String addStr = fStructuredDocument.get(addStart, quoteLen - 1);
+ deletionBuf.append(addStr);
+ insertionBuf.append(addStr);
+ }
+ deletionBuf.append(fDeletedText);
+ insertionBuf.append(fChanges);
+ if (end + (quoteLen - 1) < fStructuredDocument.getLength()) {
+ String addStr = fStructuredDocument.get(end + 1, quoteLen - 1);
+ deletionBuf.append(addStr);
+ insertionBuf.append(addStr);
+ }
+ }
+ else {
+ deletionBuf.append(fDeletedText);
+ insertionBuf.append(fChanges);
+ }
+ String deletion = deletionBuf.toString();
+ String insertion = insertionBuf.toString();
+
+ int rangeStart = start;
+ int rangeEnd = end;
+
+ if (0 <= deletion.indexOf(opener) || 0 <= deletion.indexOf(closer) || 0 <= insertion.indexOf(opener) || 0 <= insertion.indexOf(closer)) {
+ int s, e;
+ try {
+ if (start <= fStructuredDocument.getLength()) {
+ IRegion startRegion = getFindReplaceDocumentAdapter().find(start - 1, opener, false, false, false, false);
+ if (startRegion != null) {
+ s = startRegion.getOffset();
+ }
+ else {
+ s = -1;
+ }
+ }
+ else {
+ s = -1;
+ }
+ if (end < fStructuredDocument.getLength() - 1) {
+ IRegion endRegion = getFindReplaceDocumentAdapter().find(end + 1, closer, true, false, false, false);
+ if (endRegion != null) {
+ e = endRegion.getOffset();
+ }
+ else {
+ e = -1;
+ }
+ }
+ else {
+ e = -1;
+ }
+ }
+ catch (BadLocationException ex) {
+ Logger.logException(ex);
+ return null;
+ }
+ if (0 <= s) {
+ rangeStart = Math.min(rangeStart, s);
+ }
+ if (0 <= e) {
+ rangeEnd = Math.max(rangeEnd, e);
+ }
+ }
+
+ if (rangeStart < start || end < rangeEnd) {
+ return new ReparseRange(rangeStart, rangeEnd);
+ }
+ else {
+ return null;
+ }
+ }
+
+ // /**
+ // * A method to allow any heuristic "quick checks" that might cover many
+ // * many cases, before expending the time on a full reparse.
+ // *
+ // */
+ // public StructuredDocumentEvent quickCheck2() {
+ // StructuredDocumentEvent result = null;
+ // int end = fStart + fLengthToReplace - 1;
+ //
+ // result = specialNodeUpdate(fStart, end);
+ //
+ // if (result == null) {
+ // result = super.quickCheck();
+ // }
+ //
+ // return result;
+ // }
+
+ // /**
+ // *
+ // */
+ // private StructuredDocumentEvent specialNodeUpdate(int start, int end) {
+ // int reparseStart = start;
+ // int reparseEnd = end;
+ // IStructuredDocumentRegion targetNode;
+ // IStructuredDocumentRegion node;
+ // // targetNode = skipLeadingBlank(node);
+ // // if (targetNode != null && targetNode != node &&
+ // // (targetNode instanceof
+ // // com.ibm.sed.structuredDocument.impl.IStructuredDocumentRegion)) {
+ // node = fStructuredDocument.getRegionAtCharacterOffset(start);
+ // targetNode = CSSUtil.findPreviousSignificantNode(node);
+ // if (targetNode != null && targetNode != node) {
+ // reparseStart = Math.min(reparseStart, targetNode.getStart());
+ // }
+ //
+ // // targetNode = skipTrailingBlank(node);
+ // // if (targetNode != null && targetNode != node &&
+ // // (targetNode instanceof
+ // // com.ibm.sed.structuredDocument.impl.IStructuredDocumentRegion)) {
+ // node = fStructuredDocument.getRegionAtCharacterOffset(end);
+ // targetNode = CSSUtil.findNextSignificantNode(node);
+ // if (targetNode != null && targetNode != node) {
+ // reparseEnd = Math.max(reparseEnd, targetNode.getEnd());
+ // }
+ //
+ // if (reparseStart != start || reparseEnd != end) {
+ // return reparse(reparseStart, reparseEnd);
+ // } else {
+ // return null;
+ // }
+ // }
+ // /**
+ // * If following charater(s) is in changes, It is necessary to parse
+ // nodes
+ // * which are in forward and/or backward.
+ // *
+ // * openers : [, (, \/\* closers : ], ), \*\/ quotes : ", '
+ // */
+ // private StructuredDocumentEvent specialPositionUpdate(int start, int
+ // end) {
+ // String[] openers = { "[", "(", "/*", "\"", "'", "<%" };
+ // //$NON-NLS-6$//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ // String[] closers = { "]", ")", "*/", "\"", "'", "%>" };
+ // //$NON-NLS-6$//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ //
+ // int rangeStart = Integer.MAX_VALUE;
+ // int rangeEnd = 0;
+ //
+ // for (int i = 0; i < openers.length && i < closers.length; i++) {
+ // ReparseRange range = getUpdateRangeForPair(start, end, openers[i],
+ // closers[i]);
+ // if (range != null) {
+ // rangeStart = Math.min(rangeStart, range.getStart());
+ // rangeEnd = Math.max(rangeEnd, range.getEnd());
+ // break;
+ // }
+ // }
+ //
+ // if (rangeStart < rangeEnd) {
+ // return reparse(rangeStart, rangeEnd);
+ // } else {
+ // return null;
+ // }
+ // }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.model.internal.text.StructuredDocumentReParser#newInstance()
+ */
+ public IStructuredTextReParser newInstance() {
+ return new CSSStructuredDocumentReParser();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentRegionFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentRegionFactory.java
new file mode 100644
index 0000000000..ad51596563
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/CSSStructuredDocumentRegionFactory.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.text;
+
+
+
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+/**
+ *
+ */
+public class CSSStructuredDocumentRegionFactory {
+
+ public static final int CSS_GENERIC = 101109;
+
+ /**
+ *
+ */
+ public static IStructuredDocumentRegion createStructuredDocumentRegion(int type) {
+ IStructuredDocumentRegion instance = null;
+ switch (type) {
+ case CSS_GENERIC :
+ instance = new BasicStructuredDocumentRegion();
+ break;
+ default :
+ break;
+ }
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/StructuredDocumentWalker.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/StructuredDocumentWalker.java
new file mode 100644
index 0000000000..bab57dd336
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/StructuredDocumentWalker.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.text;
+
+
+
+import java.util.Enumeration;
+
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.sse.core.util.Utilities;
+
+public class StructuredDocumentWalker {
+
+ IStructuredDocumentRegionList fOldStructuredDocumentRegionList = null;
+ IStructuredDocument fStructuredDocument = null;
+ String fOriginalChanges = null;
+ int fOriginalOffset = 0;
+ int fOriginalLengthToReplace = 0;
+ int fLengthDifference = 0;
+
+ /**
+ *
+ */
+ public StructuredDocumentWalker() {
+ }
+
+ /**
+ *
+ */
+ public StructuredDocumentWalker(StructuredDocumentEvent event) {
+ initialize(event);
+ }
+
+ /**
+ *
+ */
+ public IStructuredDocument getStructuredDocument() {
+ return fStructuredDocument;
+ }
+
+ /**
+ * Old Nodes: --[O1]--[O2]--[O3]--- : / \ Current Nodes:
+ * ---[C1]-----[C2]-----[C3]-----[C4]---
+ *
+ * Input: O1 -> Output: O2 Input: O2 -> Output: O3 Input: O3 -> Output: C4
+ * Input: Cn -> Output: Cn+1
+ */
+ public IStructuredDocumentRegion getNextNode(IStructuredDocumentRegion node) {
+ IStructuredDocumentRegion nextNode = null;
+ if (node != null) {
+ nextNode = node.getNext();
+ if (nextNode == null) {
+ if (isOldNode(node)) {
+ // this may be the end of old flatnodes
+ int newStart = node.getEnd() - fLengthDifference;
+ nextNode = fStructuredDocument.getRegionAtCharacterOffset(newStart);
+ }
+ }
+ }
+ return nextNode;
+ }
+
+ /**
+ * Old Nodes: --[O1]--[O2]--[O3]--- : / \ Current Nodes:
+ * ---[C1]-----[C2]-----[C3]-----[C4]---
+ *
+ * Input: O* -> Output: C4 Input: Cn -> Output: Cn+1
+ */
+ public IStructuredDocumentRegion getNextNodeInCurrent(IStructuredDocumentRegion node) {
+ IStructuredDocumentRegion nextNode = null;
+ if (isOldNode(node)) {
+ IStructuredDocumentRegion oldEndNode = fOldStructuredDocumentRegionList.item(fOldStructuredDocumentRegionList.getLength() - 1);
+ int newStart = oldEndNode.getEnd() - fLengthDifference;
+ nextNode = fStructuredDocument.getRegionAtCharacterOffset(newStart);
+ }
+ else if (node != null) {
+ nextNode = node.getNext();
+ }
+ return nextNode;
+ }
+
+ /**
+ * Old Nodes: --[O1]--[O2]--[O3]--- : / \ Current Nodes:
+ * ---[C1]-----[C2]-----[C3]-----[C4]---
+ *
+ * Input: O1 -> Output: C1 Input: O2 -> Output: O1 Input: O3 -> Output: O2
+ * Input: Cn -> Output: Cn-1
+ */
+ public IStructuredDocumentRegion getPrevNode(IStructuredDocumentRegion node) {
+ IStructuredDocumentRegion prevNode = null;
+ if (node != null) {
+ prevNode = node.getPrevious();
+ if (prevNode == null) {
+ if (isOldNode(node)) {
+ // this may be the start of old flatnodes
+ int newEnd = node.getStart() - 1;
+ prevNode = fStructuredDocument.getRegionAtCharacterOffset(newEnd);
+ }
+ }
+ }
+ return prevNode;
+ }
+
+ /**
+ * Old Nodes: --[O1]--[O2]--[O3]--- : / \ Current Nodes:
+ * ---[C1]-----[C2]-----[C3]-----[C4]---
+ *
+ * Input: O* -> Output: C1 Input: Cn -> Output: Cn-1
+ */
+ public IStructuredDocumentRegion getPrevNodeInCurrent(IStructuredDocumentRegion node) {
+ IStructuredDocumentRegion prevNode = null;
+ if (isOldNode(node)) {
+ IStructuredDocumentRegion oldStartNode = fOldStructuredDocumentRegionList.item(0);
+ int newEnd = oldStartNode.getStart() - 1;
+ prevNode = fStructuredDocument.getRegionAtCharacterOffset(newEnd);
+ }
+ else if (node != null) {
+ prevNode = node.getPrevious();
+ }
+ return prevNode;
+ }
+
+ /**
+ *
+ */
+ public void initialize(StructuredDocumentEvent event) {
+ fStructuredDocument = event.getStructuredDocument();
+ fOriginalChanges = event.getText();
+ fOriginalOffset = event.getOriginalStart();
+ fOriginalLengthToReplace = event.getLength();
+ fLengthDifference = Utilities.calculateLengthDifference(fOriginalChanges, fOriginalLengthToReplace);
+
+ if (event instanceof StructuredDocumentRegionsReplacedEvent) {
+ fOldStructuredDocumentRegionList = ((StructuredDocumentRegionsReplacedEvent) event).getOldStructuredDocumentRegions();
+ }
+ else {
+ fOldStructuredDocumentRegionList = null;
+ }
+ }
+
+ /**
+ *
+ */
+ public boolean isOldNode(IStructuredDocumentRegion node) {
+ boolean bOld = false;
+ if (fOldStructuredDocumentRegionList != null) {
+ Enumeration e = fOldStructuredDocumentRegionList.elements();
+ while (e.hasMoreElements()) {
+ if (e.nextElement() == node) {
+ bOld = true;
+ break;
+ }
+ }
+ }
+ return bOld;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/rules/StructuredTextPartitionerForCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/rules/StructuredTextPartitionerForCSS.java
new file mode 100644
index 0000000000..7366a2118b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/text/rules/StructuredTextPartitionerForCSS.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.internal.text.rules;
+
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner;
+
+public class StructuredTextPartitionerForCSS extends StructuredTextPartitioner {
+ public final static String ST_STYLE = "org.eclipse.wst.css.STYLE"; //$NON-NLS-1$
+ public final static String[] legalTypes = new String[]{ST_STYLE, StructuredTextPartitioner.ST_DEFAULT_PARTITION};
+
+ public StructuredTextPartitionerForCSS() {
+ super();
+ }
+
+ public String getDefault() {
+ return ST_STYLE;
+ }
+
+ public String[] getLegalContentTypes() {
+ return legalTypes;
+ }
+
+ public IDocumentPartitioner newInstance() {
+ return new StructuredTextPartitionerForCSS();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCategory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCategory.java
new file mode 100644
index 0000000000..86a57db021
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCategory.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+public interface CSSMMCategory extends CSSMMNode {
+
+ String getCaption();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCharsetRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCharsetRule.java
new file mode 100644
index 0000000000..226f26abd3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMCharsetRule.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMCharsetRule extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMContainer.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMContainer.java
new file mode 100644
index 0000000000..0dfe14c32d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMContainer.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMContainer extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMDescriptor.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMDescriptor.java
new file mode 100644
index 0000000000..91364d5da6
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMDescriptor.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+import java.util.Iterator;
+
+public interface CSSMMDescriptor extends CSSMMNode {
+
+ Iterator getValues();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFontFaceRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFontFaceRule.java
new file mode 100644
index 0000000000..6a96552c84
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFontFaceRule.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMFontFaceRule extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFunction.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFunction.java
new file mode 100644
index 0000000000..6b79c6c835
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMFunction.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMFunction extends CSSMMNode {
+
+ String getFunctionString();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMImportRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMImportRule.java
new file mode 100644
index 0000000000..ab0a0f3ccc
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMImportRule.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMImportRule extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMKeyword.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMKeyword.java
new file mode 100644
index 0000000000..143a1de83b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMKeyword.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMKeyword extends CSSMMNode {
+
+ String getKeywordString();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMMediaRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMMediaRule.java
new file mode 100644
index 0000000000..637c38bf7f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMMediaRule.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMMediaRule extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNode.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNode.java
new file mode 100644
index 0000000000..2432fac4a0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNode.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+import java.util.Iterator;
+
+public interface CSSMMNode {
+ String getType();
+
+ String getName();
+
+ String getDescription();
+
+ String getAttribute(String name);
+
+ Iterator getChildNodes();
+
+ Iterator getDescendants();
+
+
+ static final String _PREFIX = "CSSMM."; //$NON-NLS-1$
+ static final String TYPE_KEYWORD = _PREFIX + "Keyword"; //$NON-NLS-1$
+ static final String TYPE_UNIT = _PREFIX + "Unit"; //$NON-NLS-1$
+ static final String TYPE_FUNCTION = _PREFIX + "Function"; //$NON-NLS-1$
+ static final String TYPE_STRING = _PREFIX + "String"; //$NON-NLS-1$
+ static final String TYPE_STYLE_SHEET = _PREFIX + "StyleSheet"; //$NON-NLS-1$
+ static final String TYPE_PROPERTY = _PREFIX + "Property"; //$NON-NLS-1$
+ static final String TYPE_DESCRIPTOR = _PREFIX + "Descriptor"; //$NON-NLS-1$
+ static final String TYPE_CONTAINER = _PREFIX + "Container"; //$NON-NLS-1$
+ static final String TYPE_NUMBER = _PREFIX + "Number"; //$NON-NLS-1$
+ static final String TYPE_SEPARATOR = _PREFIX + "Separator"; //$NON-NLS-1$
+ static final String TYPE_CHARSET_RULE = _PREFIX + "CharsetRule"; //$NON-NLS-1$
+ static final String TYPE_IMPORT_RULE = _PREFIX + "ImportRule"; //$NON-NLS-1$
+ static final String TYPE_STYLE_RULE = _PREFIX + "StyleRule"; //$NON-NLS-1$
+ static final String TYPE_MEDIA_RULE = _PREFIX + "MediaRule"; //$NON-NLS-1$
+ static final String TYPE_PAGE_RULE = _PREFIX + "PageRule"; //$NON-NLS-1$
+ static final String TYPE_FONT_FACE_RULE = _PREFIX + "FontFaceRule"; //$NON-NLS-1$
+ static final String TYPE_CATEGORY = _PREFIX + "Category"; //$NON-NLS-1$
+ static final String TYPE_META_MODEL = _PREFIX + "MetaModel"; //$NON-NLS-1$
+ static final String TYPE_SELECTOR = _PREFIX + "Selector"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNumber.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNumber.java
new file mode 100644
index 0000000000..ab80143f45
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMNumber.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMNumber extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMPageRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMPageRule.java
new file mode 100644
index 0000000000..5018390b4d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMPageRule.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMPageRule extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMProperty.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMProperty.java
new file mode 100644
index 0000000000..6b9a6b016a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMProperty.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+import java.util.Iterator;
+
+public interface CSSMMProperty extends CSSMMNode {
+
+ String getCategoryName();
+
+ Iterator getValues();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMSelector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMSelector.java
new file mode 100644
index 0000000000..058c9e889f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMSelector.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+public interface CSSMMSelector extends CSSMMNode {
+ String getSelectorType();
+
+ String getSelectorString();
+
+
+ static final String TYPE_EXPRESSION = "Expression"; //$NON-NLS-1$
+ static final String TYPE_PSEUDO_CLASS = "PseudoClass"; //$NON-NLS-1$
+ static final String TYPE_PSEUDO_ELEMENT = "PseudoElement"; //$NON-NLS-1$
+
+ // embedded expression type
+ static final String EXPRESSION_DESCENDANT = "descendant"; //$NON-NLS-1$
+ static final String EXPRESSION_CHILD = "child"; //$NON-NLS-1$
+ static final String EXPRESSION_ADJACENT = "adjacent"; //$NON-NLS-1$
+ static final String EXPRESSION_UNIVERSAL = "universal"; //$NON-NLS-1$
+ static final String EXPRESSION_ATTRIBUTE = "attribute"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMString.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMString.java
new file mode 100644
index 0000000000..024a98aac1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMString.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMString extends CSSMMNode {
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleRule.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleRule.java
new file mode 100644
index 0000000000..3257cc2229
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleRule.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMStyleRule extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleSheet.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleSheet.java
new file mode 100644
index 0000000000..f37b11ca3a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMStyleSheet.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMStyleSheet extends CSSMMNode {
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMUnit.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMUnit.java
new file mode 100644
index 0000000000..798591f086
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMMUnit.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+public interface CSSMMUnit extends CSSMMNode {
+
+ String getUnitString();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMetaModel.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMetaModel.java
new file mode 100644
index 0000000000..1ced2a9fba
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSMetaModel.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+import java.util.Iterator;
+
+public interface CSSMetaModel extends CSSMMNode {
+
+ // public interface CSSMetaModel {
+ CSSMMStyleSheet getStyleSheet();
+
+ /*
+ * Shortcut to access property node
+ */
+ // Iterator getProperties();
+ // Iterator getDescriptors();
+ // CSSMMProperty getProperty(String propertyName);
+ /*
+ * access to category information
+ */
+ Iterator getCategories();
+
+ /*
+ * Utilities
+ */
+ // Iterator collectNodesByType(String type);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfile.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfile.java
new file mode 100644
index 0000000000..231504278d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfile.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+import java.net.URL;
+
+
+public interface CSSProfile {
+
+ String getProfileID();
+
+ String getProfileName();
+
+ URL getProfileURL();
+
+ CSSMetaModel getMetaModel();
+
+ boolean isDefault();
+
+ String getOwnerPluginID();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfileRegistry.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfileRegistry.java
new file mode 100644
index 0000000000..870b793804
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/CSSProfileRegistry.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel;
+
+
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.wst.css.core.internal.metamodel.RegistryReader;
+
+
+
+public class CSSProfileRegistry {
+ public synchronized static CSSProfileRegistry getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSProfileRegistry();
+ }
+ return fInstance;
+ }
+
+ public Iterator getProfiles() {
+ return Collections.unmodifiableCollection(fProfiles.values()).iterator();
+ }
+
+ public CSSProfile getProfile(String profileID) {
+ return (CSSProfile) fProfiles.get(profileID);
+ }
+
+ public CSSProfile getDefaultProfile() {
+ Iterator i = getProfiles();
+ while (i.hasNext()) {
+ CSSProfile profile = (CSSProfile) i.next();
+ if (profile.isDefault()) {
+ return profile;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Constructor for CSSProfileRegistry.
+ */
+ private CSSProfileRegistry() {
+ super();
+ fProfiles = new HashMap();
+ Iterator i = new RegistryReader().enumProfiles();
+ while (i.hasNext()) {
+ Object profile = i.next();
+ if (profile instanceof CSSProfile) {
+ fProfiles.put(((CSSProfile) profile).getProfileID(), profile);
+ }
+ }
+ }
+
+
+ private static CSSProfileRegistry fInstance = null;
+ private Map fProfiles = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSFunctionID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSFunctionID.java
new file mode 100644
index 0000000000..9adc8da12c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSFunctionID.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSFunctionID {
+
+ final static String F_ATTR = "attr"; //$NON-NLS-1$
+ final static String F_COUNTER = "counter"; //$NON-NLS-1$
+ final static String F_RGB = "rgb"; //$NON-NLS-1$
+ final static String F_RECT = "rect"; //$NON-NLS-1$
+ final static String F_URI = "uri"; //$NON-NLS-1$
+ final static String F_FORMAT = "format"; //$NON-NLS-1$
+ final static String F_LOCAL = "local"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSKeywordID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSKeywordID.java
new file mode 100644
index 0000000000..f2e1ce123d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSKeywordID.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSKeywordID {
+
+ final static String K_100 = "100"; //$NON-NLS-1$
+ final static String K_200 = "200"; //$NON-NLS-1$
+ final static String K_300 = "300"; //$NON-NLS-1$
+ final static String K_400 = "400"; //$NON-NLS-1$
+ final static String K_500 = "500"; //$NON-NLS-1$
+ final static String K_600 = "600"; //$NON-NLS-1$
+ final static String K_700 = "700"; //$NON-NLS-1$
+ final static String K_800 = "800"; //$NON-NLS-1$
+ final static String K_900 = "900"; //$NON-NLS-1$
+ final static String K_ABOVE = "above"; //$NON-NLS-1$
+ final static String K_ABSOLUTE = "absolute"; //$NON-NLS-1$
+ final static String K_ACTIVEBORDER = "ActiveBorder"; //$NON-NLS-1$
+ final static String K_ACTIVECAPTION = "ActiveCaption"; //$NON-NLS-1$
+ final static String K_ALL = "all"; //$NON-NLS-1$
+ final static String K_ALWAYS = "always"; //$NON-NLS-1$
+ final static String K_APPWORKSPACE = "AppWorkspace"; //$NON-NLS-1$
+ final static String K_AQUA = "aqua"; //$NON-NLS-1$
+ final static String K_ARMENIAN = "armenian"; //$NON-NLS-1$
+ final static String K_AUTO = "auto"; //$NON-NLS-1$
+ final static String K_AVOID = "avoid"; //$NON-NLS-1$
+ final static String K_BACKGROUND = "Background"; //$NON-NLS-1$
+ final static String K_BASELINE = "baseline"; //$NON-NLS-1$
+ final static String K_BEHIND = "behind"; //$NON-NLS-1$
+ final static String K_BELOW = "below"; //$NON-NLS-1$
+ final static String K_BIDI_OVERRIDE = "bidi-override"; //$NON-NLS-1$
+ final static String K_BLACK = "black"; //$NON-NLS-1$
+ final static String K_BLINK = "blink"; //$NON-NLS-1$
+ final static String K_BLOCK = "block"; //$NON-NLS-1$
+ final static String K_BLUE = "blue"; //$NON-NLS-1$
+ final static String K_BOLD = "bold"; //$NON-NLS-1$
+ final static String K_BOLDER = "bolder"; //$NON-NLS-1$
+ final static String K_BOTH = "both"; //$NON-NLS-1$
+ final static String K_BOTTOM = "bottom"; //$NON-NLS-1$
+ final static String K_BUTTONFACE = "ButtonFace"; //$NON-NLS-1$
+ final static String K_BUTTONHIGHLIGHT = "ButtonHighlight"; //$NON-NLS-1$
+ final static String K_BUTTONSHADOW = "ButtonShadow"; //$NON-NLS-1$
+ final static String K_BUTTONTEXT = "ButtonText"; //$NON-NLS-1$
+ final static String K_CAPITALIZE = "capitalize"; //$NON-NLS-1$
+ final static String K_CAPTION = "caption"; //$NON-NLS-1$
+ final static String K_CAPTIONTEXT = "CaptionText"; //$NON-NLS-1$
+ final static String K_CENTER = "center"; //$NON-NLS-1$
+ final static String K_CENTER_LEFT = "center-left"; //$NON-NLS-1$
+ final static String K_CENTER_RIGHT = "center-right"; //$NON-NLS-1$
+ final static String K_CHILD = "child"; //$NON-NLS-1$
+ final static String K_CIRCLE = "circle"; //$NON-NLS-1$
+ final static String K_CJK_IDEOGRAPHIC = "cjk-ideographic"; //$NON-NLS-1$
+ final static String K_CLOSE_QUOTE = "close-quote"; //$NON-NLS-1$
+ final static String K_CODE = "code"; //$NON-NLS-1$
+ final static String K_CONDENSED = "condensed"; //$NON-NLS-1$
+ final static String K_COLLAPSE = "collapse"; //$NON-NLS-1$
+ final static String K_COMPACT = "compact"; //$NON-NLS-1$
+ final static String K_CONTINUOUS = "continuous"; //$NON-NLS-1$
+ final static String K_CROP = "crop"; //$NON-NLS-1$
+ final static String K_CROSS = "cross"; //$NON-NLS-1$
+ final static String K_CROSSHAIR = "crosshair"; //$NON-NLS-1$
+ final static String K_CURSIVE = "cursive"; //$NON-NLS-1$
+ final static String K_DASHED = "dashed"; //$NON-NLS-1$
+ final static String K_DECIMAL = "decimal"; //$NON-NLS-1$
+ final static String K_DECIMAL_LEADING_ZERO = "decimal-leading-zero"; //$NON-NLS-1$
+ final static String K_DEFAULT = "default"; //$NON-NLS-1$
+ final static String K_DIGITS = "digits"; //$NON-NLS-1$
+ final static String K_DISC = "disc"; //$NON-NLS-1$
+ final static String K_DOTTED = "dotted"; //$NON-NLS-1$
+ final static String K_DOUBLE = "double"; //$NON-NLS-1$
+ final static String K_E_RESIZE = "e-resize"; //$NON-NLS-1$
+ final static String K_EMBED = "embed"; //$NON-NLS-1$
+ final static String K_EXPANDED = "expanded"; //$NON-NLS-1$
+ final static String K_EXTRA_CONDENSED = "extra-condensed"; //$NON-NLS-1$
+ final static String K_EXTRA_EXPANDED = "extra-expanded"; //$NON-NLS-1$
+ final static String K_FANTASY = "fantasy"; //$NON-NLS-1$
+ final static String K_FAR_LEFT = "far-left"; //$NON-NLS-1$
+ final static String K_FAR_RIGHT = "far-right"; //$NON-NLS-1$
+ final static String K_FAST = "fast"; //$NON-NLS-1$
+ final static String K_FASTER = "faster"; //$NON-NLS-1$
+ final static String K_FEMALE = "female"; //$NON-NLS-1$
+ final static String K_FIXED = "fixed"; //$NON-NLS-1$
+ final static String K_FUCHSIA = "fuchsia"; //$NON-NLS-1$
+ final static String K_GEORGIAN = "georgian"; //$NON-NLS-1$
+ final static String K_GRAY = "gray"; //$NON-NLS-1$
+ final static String K_GRAYTEXT = "GrayText"; //$NON-NLS-1$
+ final static String K_GREEN = "green"; //$NON-NLS-1$
+ final static String K_GROOVE = "groove"; //$NON-NLS-1$
+ final static String K_HEBREW = "hebrew"; //$NON-NLS-1$
+ final static String K_HELP = "help"; //$NON-NLS-1$
+ final static String K_HIDDEN = "hidden"; //$NON-NLS-1$
+ final static String K_HIDE = "hide"; //$NON-NLS-1$
+ final static String K_HIGH = "high"; //$NON-NLS-1$
+ final static String K_HIGHLIGHT = "Highlight"; //$NON-NLS-1$
+ final static String K_HIGHLIGHTTEXT = "HighlightText"; //$NON-NLS-1$
+ final static String K_HIGHER = "higher"; //$NON-NLS-1$
+ final static String K_HIRAGANA = "hiragana"; //$NON-NLS-1$
+ final static String K_HIRAGANA_IROHA = "hiragana-iroha"; //$NON-NLS-1$
+ final static String K_ICON = "icon"; //$NON-NLS-1$
+ final static String K_INACTIVEBORDER = "InactiveBorder"; //$NON-NLS-1$
+ final static String K_INACTIVECAPTION = "InactiveCaption"; //$NON-NLS-1$
+ final static String K_INACTIVECAPTIONTEXT = "InactiveCaptionText"; //$NON-NLS-1$
+ final static String K_INFOBACKGROUND = "InfoBackground"; //$NON-NLS-1$
+ final static String K_INFOTEXT = "InfoText"; //$NON-NLS-1$
+ final static String K_INLINE = "inline"; //$NON-NLS-1$
+ final static String K_INLINE_TABLE = "inline-table"; //$NON-NLS-1$
+ final static String K_INSET = "inset"; //$NON-NLS-1$
+ final static String K_INSIDE = "inside"; //$NON-NLS-1$
+ final static String K_INVERT = "invert"; //$NON-NLS-1$
+ final static String K_ITALIC = "italic"; //$NON-NLS-1$
+ final static String K_JUSTIFY = "justify"; //$NON-NLS-1$
+ final static String K_KATAKANA = "katakana"; //$NON-NLS-1$
+ final static String K_KATAKANA_IROHA = "katakana-iroha"; //$NON-NLS-1$
+ final static String K_LANDSCAPE = "landscape"; //$NON-NLS-1$
+ final static String K_LARGE = "large"; //$NON-NLS-1$
+ final static String K_LARGER = "larger"; //$NON-NLS-1$
+ final static String K_LEFT = "left"; //$NON-NLS-1$
+ final static String K_LEFT_SIDE = "left-side"; //$NON-NLS-1$
+ final static String K_LEFTWARDS = "leftwards"; //$NON-NLS-1$
+ final static String K_LEVEL = "level"; //$NON-NLS-1$
+ final static String K_LIGHTER = "lighter"; //$NON-NLS-1$
+ final static String K_LIME = "lime"; //$NON-NLS-1$
+ final static String K_LINE_THROUGH = "line-through"; //$NON-NLS-1$
+ final static String K_LIST_ITEM = "list-item"; //$NON-NLS-1$
+ final static String K_LOUD = "loud"; //$NON-NLS-1$
+ final static String K_LOW = "low"; //$NON-NLS-1$
+ final static String K_LOWER = "lower"; //$NON-NLS-1$
+ final static String K_LOWER_ALPHA = "lower-alpha"; //$NON-NLS-1$
+ final static String K_LOWER_GREEK = "lower-greek"; //$NON-NLS-1$
+ final static String K_LOWER_LATIN = "lower-latin"; //$NON-NLS-1$
+ final static String K_LOWER_ROMAN = "lower-roman"; //$NON-NLS-1$
+ final static String K_LOWERCASE = "lowercase"; //$NON-NLS-1$
+ final static String K_LTR = "ltr"; //$NON-NLS-1$
+ final static String K_MALE = "male"; //$NON-NLS-1$
+ final static String K_MARKER = "marker"; //$NON-NLS-1$
+ final static String K_MAROON = "maroon"; //$NON-NLS-1$
+ final static String K_MEDIUM = "medium"; //$NON-NLS-1$
+ final static String K_MENU = "menu"; //$NON-NLS-1$
+ final static String K_MENUTEXT = "MenuText"; //$NON-NLS-1$
+ final static String K_MESSAGE_BOX = "message-box"; //$NON-NLS-1$
+ final static String K_MIDDLE = "middle"; //$NON-NLS-1$
+ final static String K_MIX = "mix"; //$NON-NLS-1$
+ final static String K_MONOSPACE = "monospace"; //$NON-NLS-1$
+ final static String K_MOVE = "move"; //$NON-NLS-1$
+ final static String K_N_RESIZE = "n-resize"; //$NON-NLS-1$
+ final static String K_NARROWER = "narrower"; //$NON-NLS-1$
+ final static String K_NAVY = "navy"; //$NON-NLS-1$
+ final static String K_NE_RESIZE = "ne-resize"; //$NON-NLS-1$
+ final static String K_NO_CLOSE_QUOTE = "no-close-quote"; //$NON-NLS-1$
+ final static String K_NO_OPEN_QUOTE = "no-open-quote"; //$NON-NLS-1$
+ final static String K_NO_REPEAT = "no-repeat"; //$NON-NLS-1$
+ final static String K_NONE = "none"; //$NON-NLS-1$
+ final static String K_NORMAL = "normal"; //$NON-NLS-1$
+ final static String K_NOWRAP = "nowrap"; //$NON-NLS-1$
+ final static String K_NW_RESIZE = "nw-resize"; //$NON-NLS-1$
+ final static String K_OBLIQUE = "oblique"; //$NON-NLS-1$
+ final static String K_OLIVE = "olive"; //$NON-NLS-1$
+ final static String K_ONCE = "once"; //$NON-NLS-1$
+ final static String K_OPEN_QUOTE = "open-quote"; //$NON-NLS-1$
+ final static String K_OUTSET = "outset"; //$NON-NLS-1$
+ final static String K_OUTSIDE = "outside"; //$NON-NLS-1$
+ final static String K_OVERLINE = "overline"; //$NON-NLS-1$
+ final static String K_POINTER = "pointer"; //$NON-NLS-1$
+ final static String K_PORTRAIT = "portrait"; //$NON-NLS-1$
+ final static String K_PRE = "pre"; //$NON-NLS-1$
+ final static String K_PURPLE = "purple"; //$NON-NLS-1$
+ final static String K_RED = "red"; //$NON-NLS-1$
+ final static String K_RELATIVE = "relative"; //$NON-NLS-1$
+ final static String K_REPEAT = "repeat"; //$NON-NLS-1$
+ final static String K_REPEAT_X = "repeat-x"; //$NON-NLS-1$
+ final static String K_REPEAT_Y = "repeat-y"; //$NON-NLS-1$
+ final static String K_RIDGE = "ridge"; //$NON-NLS-1$
+ final static String K_RIGHT = "right"; //$NON-NLS-1$
+ final static String K_RIGHT_SIDE = "right-side"; //$NON-NLS-1$
+ final static String K_RIGHTWARDS = "rightwards"; //$NON-NLS-1$
+ final static String K_RTL = "rtl"; //$NON-NLS-1$
+ final static String K_RUN_IN = "run-in"; //$NON-NLS-1$
+ final static String K_S_RESIZE = "s-resize"; //$NON-NLS-1$
+ final static String K_SANS_SERIF = "sans-serif"; //$NON-NLS-1$
+ final static String K_SCROLL = "scroll"; //$NON-NLS-1$
+ final static String K_SCROLLBAR = "Scrollbar"; //$NON-NLS-1$
+ final static String K_SE_RESIZE = "se-resize"; //$NON-NLS-1$
+ final static String K_SEMI_CONDENSED = "semi-condensed"; //$NON-NLS-1$
+ final static String K_SEMI_EXPANDED = "semi-expanded"; //$NON-NLS-1$
+ final static String K_SEPARATE = "separate"; //$NON-NLS-1$
+ final static String K_SERIF = "serif"; //$NON-NLS-1$
+ final static String K_SHOW = "show"; //$NON-NLS-1$
+ final static String K_SILENT = "silent"; //$NON-NLS-1$
+ final static String K_SILVER = "silver"; //$NON-NLS-1$
+ final static String K_SLOW = "slow"; //$NON-NLS-1$
+ final static String K_SLOWER = "slower"; //$NON-NLS-1$
+ final static String K_SMALL = "small"; //$NON-NLS-1$
+ final static String K_SMALL_CAPS = "small-caps"; //$NON-NLS-1$
+ final static String K_SMALL_CAPTION = "small-caption"; //$NON-NLS-1$
+ final static String K_SMALLER = "smaller"; //$NON-NLS-1$
+ final static String K_SOFT = "soft"; //$NON-NLS-1$
+ final static String K_SOLID = "solid"; //$NON-NLS-1$
+ final static String K_SPELL_OUT = "spell-out"; //$NON-NLS-1$
+ final static String K_SQUARE = "square"; //$NON-NLS-1$
+ final static String K_STATIC = "static"; //$NON-NLS-1$
+ final static String K_STATUS_BAR = "status-bar"; //$NON-NLS-1$
+ final static String K_SUB = "sub"; //$NON-NLS-1$
+ final static String K_SUPER = "super"; //$NON-NLS-1$
+ final static String K_SW_RESIZE = "sw-resize"; //$NON-NLS-1$
+ final static String K_TABLE = "table"; //$NON-NLS-1$
+ final static String K_TABLE_CAPTION = "table-caption"; //$NON-NLS-1$
+ final static String K_TABLE_CELL = "table-cell"; //$NON-NLS-1$
+ final static String K_TABLE_COLUMN = "table-column"; //$NON-NLS-1$
+ final static String K_TABLE_COLUMN_GROUP = "table-column-group"; //$NON-NLS-1$
+ final static String K_TABLE_FOOTER_GROUP = "table-footer-group"; //$NON-NLS-1$
+ final static String K_TABLE_HEADER_GROUP = "table-header-group"; //$NON-NLS-1$
+ final static String K_TABLE_ROW = "table-row"; //$NON-NLS-1$
+ final static String K_TABLE_ROW_GROUP = "table-row-group"; //$NON-NLS-1$
+ final static String K_TEAL = "teal"; //$NON-NLS-1$
+ final static String K_TEXT = "text"; //$NON-NLS-1$
+ final static String K_TEXT_TOP = "text-top"; //$NON-NLS-1$
+ final static String K_TEXT_BOTTOM = "text-bottom"; //$NON-NLS-1$
+ final static String K_THICK = "thick"; //$NON-NLS-1$
+ final static String K_THIN = "thin"; //$NON-NLS-1$
+ final static String K_THREEDDARKSHADOW = "ThreeDDarkShadow"; //$NON-NLS-1$
+ final static String K_THREEDFACE = "ThreeDFace"; //$NON-NLS-1$
+ final static String K_THREEDHIGHLIGHT = "ThreeDHighlight"; //$NON-NLS-1$
+ final static String K_THREEDLIGHTSHADOW = "ThreeDLightShadow"; //$NON-NLS-1$
+ final static String K_THREEDSHADOW = "ThreeDShadow"; //$NON-NLS-1$
+ final static String K_TOP = "top"; //$NON-NLS-1$
+ final static String K_TRANSPARENT = "transparent"; //$NON-NLS-1$
+ final static String K_ULTRA_CONDENSED = "ultra-condensed"; //$NON-NLS-1$
+ final static String K_ULTRA_EXPANDED = "ultra-expanded"; //$NON-NLS-1$
+ final static String K_UNDERLINE = "underline"; //$NON-NLS-1$
+ final static String K_UPPER_ALPHA = "upper-alpha"; //$NON-NLS-1$
+ final static String K_UPPER_LATIN = "upper-latin"; //$NON-NLS-1$
+ final static String K_UPPER_ROMAN = "upper-roman"; //$NON-NLS-1$
+ final static String K_UPPERCASE = "uppercase"; //$NON-NLS-1$
+ final static String K_VISIBLE = "visible"; //$NON-NLS-1$
+ final static String K_W_RESIZE = "w-resize"; //$NON-NLS-1$
+ final static String K_WAIT = "wait"; //$NON-NLS-1$
+ final static String K_WHITE = "white"; //$NON-NLS-1$
+ final static String K_WIDER = "wider"; //$NON-NLS-1$
+ final static String K_WINDOW = "Window"; //$NON-NLS-1$
+ final static String K_WINDOWFRAME = "WindowFrame"; //$NON-NLS-1$
+ final static String K_WINDOWTEXT = "WindowText"; //$NON-NLS-1$
+ final static String K_X_FAST = "x-fast"; //$NON-NLS-1$
+ final static String K_X_HIGH = "x-high"; //$NON-NLS-1$
+ final static String K_X_LARGE = "x-large"; //$NON-NLS-1$
+ final static String K_X_LOUD = "x-loud"; //$NON-NLS-1$
+ final static String K_X_LOW = "x-low"; //$NON-NLS-1$
+ final static String K_X_SLOW = "x-slow"; //$NON-NLS-1$
+ final static String K_X_SMALL = "x-small"; //$NON-NLS-1$
+ final static String K_X_SOFT = "x-soft"; //$NON-NLS-1$
+ final static String K_XX_SMALL = "xx-small"; //$NON-NLS-1$
+ final static String K_XX_LARGE = "xx-large"; //$NON-NLS-1$
+ final static String K_YELLOW = "yellow"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMMTypeCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMMTypeCollector.java
new file mode 100644
index 0000000000..881ca877fb
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMMTypeCollector.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+
+public class CSSMMTypeCollector extends CSSMetaModelTraverser {
+
+ /**
+ * Constructor for TypeCollector.
+ */
+ public CSSMMTypeCollector() {
+ super();
+ }
+
+ public void apply(CSSMMNode node, String type) {
+ fType = type;
+ fNodes = new ArrayList();
+ apply(node);
+ }
+
+ public void collectNestedType(boolean nested) {
+ fNested = nested;
+ }
+
+ protected short preNode(CSSMMNode node) {
+ short rc = TRAV_CONT;
+ if (node != null) {
+ if (fType == node.getType()) {
+ if (!fNodes.contains(node)) {
+ fNodes.add(node);
+ }
+ if (!fNested) {
+ rc = TRAV_PRUNE;
+ }
+ }
+ }
+ return rc;
+ }
+
+ public Iterator getNodes() {
+ return fNodes.iterator();
+ }
+
+
+ private boolean fNested = false;
+ private String fType = null;
+ List fNodes = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMediaGroupID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMediaGroupID.java
new file mode 100644
index 0000000000..ee42d64687
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMediaGroupID.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSMediaGroupID {
+
+ final static String M_CONTINUOUS = "continuous"; //$NON-NLS-1$
+ final static String M_PAGED = "paged"; //$NON-NLS-1$
+
+ final static String M_VISUAL = "visual"; //$NON-NLS-1$
+ final static String M_AURAL = "aural"; //$NON-NLS-1$
+ final static String M_TACTILE = "tactile"; //$NON-NLS-1$
+
+ final static String M_GRID = "grid"; //$NON-NLS-1$
+ final static String M_BITMAP = "bitmap"; //$NON-NLS-1$
+
+ final static String M_INTERACTIVE = "interactive"; //$NON-NLS-1$
+ final static String M_STATIC = "static"; //$NON-NLS-1$
+
+ final static String M_ALL = "all"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelFinder.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelFinder.java
new file mode 100644
index 0000000000..934e05ec9b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelFinder.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.eclipse.wst.sse.core.IStructuredModel;
+
+
+public class CSSMetaModelFinder {
+ /**
+ * Constructor for CSSMetaModelFinder.
+ */
+ private CSSMetaModelFinder() {
+ super();
+ }
+
+ static synchronized public CSSMetaModelFinder getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSMetaModelFinder();
+ }
+ return fInstance;
+ }
+
+ public CSSMetaModel findMetaModelFor(ICSSNode node) {
+ return CSSProfileFinder.getInstance().findProfileFor(node).getMetaModel();
+ }
+
+ public CSSMetaModel findMetaModelFor(IStructuredModel model) {
+ return CSSProfileFinder.getInstance().findProfileFor(model).getMetaModel();
+
+ }
+
+ // findMetaModelFor(Node) is not used.
+ // Even if it is used, it can be replaced with
+ // findMetaModelFor(IStructuredModel) easily
+
+ public CSSMetaModel findMetaModelFor(String baseLocation) {
+ return CSSProfileFinder.getInstance().findProfileFor(baseLocation).getMetaModel();
+ }
+
+ static private CSSMetaModelFinder fInstance = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelTraverser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelTraverser.java
new file mode 100644
index 0000000000..436087008b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelTraverser.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+import java.util.Iterator;
+import java.util.Stack;
+
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+
+
+
+abstract public class CSSMetaModelTraverser {
+
+ /**
+ * Constructor for Traverser.
+ */
+ public CSSMetaModelTraverser() {
+ super();
+ }
+
+ public final void apply(CSSMMNode node) {
+ fTravStack = new Stack();
+
+ begin(node);
+ traverse(node);
+ end(node);
+ }
+
+ private final short traverse(CSSMMNode node) {
+ if (node == null) {
+ return TRAV_CONT;
+ }
+
+ fTravStack.push(node);
+
+ short rc;
+ rc = preNode(node);
+
+ if (rc == TRAV_CONT) {
+ Iterator i = node.getChildNodes();
+ while (i.hasNext()) {
+ CSSMMNode child = (CSSMMNode) i.next();
+ short rcChild = traverse(child);
+ if (rcChild == TRAV_STOP) {
+ fTravStack.pop();
+ return TRAV_STOP;
+ }
+ }
+ }
+ else if (rc == TRAV_STOP) {
+ fTravStack.pop();
+ return TRAV_STOP;
+ }
+
+ rc = postNode(node);
+
+ fTravStack.pop();
+ return (rc == TRAV_PRUNE) ? TRAV_CONT : rc;
+ }
+
+ protected void begin(CSSMMNode node) {
+
+ }
+
+ protected void end(CSSMMNode node) {
+
+ }
+
+ protected short preNode(CSSMMNode node) {
+ return TRAV_CONT;
+ }
+
+ protected short postNode(CSSMMNode node) {
+ return TRAV_CONT;
+ }
+
+
+ Stack fTravStack = null;
+
+ protected static final short TRAV_CONT = 0;
+ protected static final short TRAV_STOP = 1;
+ protected static final short TRAV_PRUNE = 2;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelUtil.java
new file mode 100644
index 0000000000..901a0cd3a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSMetaModelUtil.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.metamodel.CSSMMDescriptor;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMProperty;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.w3c.dom.css.CSSFontFaceRule;
+
+
+public class CSSMetaModelUtil {
+ public CSSMetaModelUtil(CSSMetaModel metamodel) {
+ super();
+ fMetaModel = metamodel;
+ }
+
+ public Iterator getProperties() {
+ return collectNodesByType(CSSMMNode.TYPE_PROPERTY);
+ }
+
+ public Iterator getDescriptors() {
+ return collectNodesByType(CSSMMNode.TYPE_DESCRIPTOR);
+ }
+
+ public Iterator collectNodesByType(String type) {
+ CSSMMTypeCollector collector = new CSSMMTypeCollector();
+ collector.apply(fMetaModel, type);
+ return collector.getNodes();
+ }
+
+ public CSSMMProperty getProperty(String propertyName) {
+ Iterator iProperty = getProperties();
+ while (iProperty.hasNext()) {
+ CSSMMNode node = (CSSMMNode) iProperty.next();
+ if (node.getName().equalsIgnoreCase(propertyName)) {
+ return (CSSMMProperty) node;
+ }
+ }
+ return null;
+ }
+
+ public CSSMMDescriptor getDescriptor(String descriptorName) {
+ Iterator iDescriptor = getDescriptors();
+ while (iDescriptor.hasNext()) {
+ CSSMMNode node = (CSSMMNode) iDescriptor.next();
+ if (node.getName().equalsIgnoreCase(descriptorName)) {
+ return (CSSMMDescriptor) node;
+ }
+ }
+ return null;
+ }
+
+ public CSSMMNode getMetaModelNodeFor(ICSSNode node) {
+ if (node instanceof ICSSStyleDeclaration) {
+ node = node.getParentNode();
+ }
+ if (node instanceof ICSSStyleDeclItem) {
+ ICSSNode parent = node.getParentNode();
+ if (parent != null) {
+ parent = parent.getParentNode();
+ }
+ if (parent instanceof ICSSStyleRule) {
+ return getProperty(((ICSSStyleDeclItem) node).getPropertyName());
+ }
+ else if (parent instanceof CSSFontFaceRule) {
+ return getDescriptor(((ICSSStyleDeclItem) node).getPropertyName());
+ }
+ }
+ if (node == null) {
+ return null;
+ }
+
+ if (fTypeMap == null) {
+ fTypeMap = new HashMap();
+ fTypeMap.put(new Short(ICSSNode.STYLERULE_NODE), CSSMMNode.TYPE_STYLE_RULE);
+ fTypeMap.put(new Short(ICSSNode.FONTFACERULE_NODE), CSSMMNode.TYPE_FONT_FACE_RULE);
+ fTypeMap.put(new Short(ICSSNode.PAGERULE_NODE), CSSMMNode.TYPE_PAGE_RULE);
+ }
+
+ String nodeType = (String) fTypeMap.get(new Short(node.getNodeType()));
+ if (nodeType == null) {
+ return null;
+ }
+
+ Iterator iNodes = collectNodesByType(nodeType);
+ if (iNodes.hasNext()) {
+ CSSMMNode targetNode = (CSSMMNode) iNodes.next();
+ if (!iNodes.hasNext()) { // it's only one
+ return targetNode;
+ }
+ }
+
+ return null;
+ }
+
+ public CSSMetaModel getMetaModel() {
+ return fMetaModel;
+ }
+
+
+ private CSSMetaModel fMetaModel = null;
+ private Map fTypeMap = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSNumberID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSNumberID.java
new file mode 100644
index 0000000000..5bd9b1ed5a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSNumberID.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSNumberID {
+
+ final static java.lang.String N_ANGLE = "angle";//$NON-NLS-1$
+ final static java.lang.String N_FREQUENCY = "frequency";//$NON-NLS-1$
+ final static java.lang.String N_INTEGER = "integer";//$NON-NLS-1$
+ final static java.lang.String N_LENGTH = "length";//$NON-NLS-1$
+ final static java.lang.String N_PERCENTAGE = "percentage";//$NON-NLS-1$
+ final static java.lang.String N_TIME = "time";//$NON-NLS-1$
+ final static java.lang.String N_HASH = "hash"; //$NON-NLS-1$
+ final static java.lang.String N_NUM = "number";//$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSProfileFinder.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSProfileFinder.java
new file mode 100644
index 0000000000..edb9d131f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSProfileFinder.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+import org.eclipse.wst.css.core.metamodel.CSSProfileRegistry;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.ui.contentproperties.ContentSettingsCreator;
+import org.eclipse.wst.sse.ui.contentproperties.IContentSettings;
+
+
+public class CSSProfileFinder {
+
+ final static private String CSS_PROFILE = "css-profile"; //$NON-NLS-1$
+
+ /**
+ * Constructor for CSSProfileFinder.
+ */
+ private CSSProfileFinder() {
+ super();
+ }
+
+ static synchronized public CSSProfileFinder getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSProfileFinder();
+ }
+ return fInstance;
+ }
+
+ public CSSProfile findProfileFor(ICSSNode node) {
+ ICSSModel model = null;
+ if (node != null) {
+ ICSSDocument doc = node.getOwnerDocument();
+ if (doc != null) {
+ model = doc.getModel();
+ }
+ }
+ return findProfileFor(model);
+ }
+
+ public CSSProfile findProfileFor(IStructuredModel model) {
+ String baseLocation = null;
+ if (model instanceof ICSSModel) {
+ Object modelType = ((ICSSModel) model).getStyleSheetType();
+ if (modelType == ICSSModel.EXTERNAL) {
+ baseLocation = model.getBaseLocation();
+ }
+ else if (modelType == ICSSModel.EMBEDDED || modelType == ICSSModel.INLINE) {
+ baseLocation = model.getBaseLocation(); // may be null
+ }
+ }
+ else if (model != null) {
+ baseLocation = model.getBaseLocation();
+ }
+ return findProfileFor(baseLocation);
+ }
+
+ public CSSProfile findProfileFor(String baseLocation) {
+ CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
+ CSSProfile profile = null;
+
+ if (baseLocation != null) {
+ IContentSettings cs = ContentSettingsCreator.create();
+ IPath path = new Path(baseLocation);
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+ if (resource != null) {
+ IProject project = resource.getProject();
+ // at first, initialized with project settings
+ if (project != null) {
+ String profileID = cs.getProperty(project, CSS_PROFILE);
+ if (profileID != null && 0 < profileID.length()) {
+ profile = reg.getProfile(profileID);
+ }
+ }
+ // if resource settings exist, overwrite with project settings
+ String profileID = cs.getProperty(resource, CSS_PROFILE);
+ if (profileID != null && 0 < profileID.length()) {
+ profile = reg.getProfile(profileID);
+ }
+ }
+ }
+
+ return (profile != null) ? profile : reg.getDefaultProfile();
+ }
+
+ static private CSSProfileFinder fInstance = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSPropertyID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSPropertyID.java
new file mode 100644
index 0000000000..252d6379f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSPropertyID.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSPropertyID {
+
+ final static String P_AZIMUTH = "azimuth"; //$NON-NLS-1$
+ final static String P_BG = "background"; //$NON-NLS-1$
+ final static String P_BG_ATTACHMENT = "background-attachment"; //$NON-NLS-1$
+ final static String P_BG_COLOR = "background-color"; //$NON-NLS-1$
+ final static String P_BG_IMAGE = "background-image"; //$NON-NLS-1$
+ final static String P_BG_POSITION = "background-position"; //$NON-NLS-1$
+ final static String P_BG_REPEAT = "background-repeat"; //$NON-NLS-1$
+ final static String P_BORDER = "border"; //$NON-NLS-1$
+ final static String P_BORDER_COLLAPSE = "border-collapse"; //$NON-NLS-1$
+ final static String P_BORDER_COLOR = "border-color"; //$NON-NLS-1$
+ final static String P_BORDER_SPACING = "border-spacing"; //$NON-NLS-1$
+ final static String P_BORDER_STYLE = "border-style"; //$NON-NLS-1$
+ final static String P_BORDER_TOP = "border-top"; //$NON-NLS-1$
+ final static String P_BORDER_RIGHT = "border-right"; //$NON-NLS-1$
+ final static String P_BORDER_BOTTOM = "border-bottom"; //$NON-NLS-1$
+ final static String P_BORDER_LEFT = "border-left"; //$NON-NLS-1$
+ final static String P_BORDER_TOP_COLOR = "border-top-color"; //$NON-NLS-1$
+ final static String P_BORDER_RIGHT_COLOR = "border-right-color"; //$NON-NLS-1$
+ final static String P_BORDER_BOTTOM_COLOR = "border-bottom-color"; //$NON-NLS-1$
+ final static String P_BORDER_LEFT_COLOR = "border-left-color"; //$NON-NLS-1$
+ final static String P_BORDER_TOP_STYLE = "border-top-style"; //$NON-NLS-1$
+ final static String P_BORDER_RIGHT_STYLE = "border-right-style"; //$NON-NLS-1$
+ final static String P_BORDER_BOTTOM_STYLE = "border-bottom-style"; //$NON-NLS-1$
+ final static String P_BORDER_LEFT_STYLE = "border-left-style"; //$NON-NLS-1$
+ final static String P_BORDER_TOP_WIDTH = "border-top-width"; //$NON-NLS-1$
+ final static String P_BORDER_RIGHT_WIDTH = "border-right-width"; //$NON-NLS-1$
+ final static String P_BORDER_BOTTOM_WIDTH = "border-bottom-width"; //$NON-NLS-1$
+ final static String P_BORDER_LEFT_WIDTH = "border-left-width"; //$NON-NLS-1$
+ final static String P_BORDER_WIDTH = "border-width"; //$NON-NLS-1$
+ final static String P_BOTTOM = "bottom"; //$NON-NLS-1$
+ final static String P_CAPTION_SIDE = "caption-side"; //$NON-NLS-1$
+ final static String P_CLEAR = "clear"; //$NON-NLS-1$
+ final static String P_CLIP = "clip"; //$NON-NLS-1$
+ final static String P_COLOR = "color"; //$NON-NLS-1$
+ final static String P_CONTENT = "content"; //$NON-NLS-1$
+ final static String P_COUNTER_INCREMENT = "counter-increment"; //$NON-NLS-1$
+ final static String P_COUNTER_RESET = "counter-reset"; //$NON-NLS-1$
+ final static String P_CUE = "cue"; //$NON-NLS-1$
+ final static String P_CUE_AFTER = "cue-after"; //$NON-NLS-1$
+ final static String P_CUE_BEFORE = "cue-before"; //$NON-NLS-1$
+ final static String P_CURSOR = "cursor"; //$NON-NLS-1$
+ final static String P_DIRECTION = "direction"; //$NON-NLS-1$
+ final static String P_DISPLAY = "display"; //$NON-NLS-1$
+ final static String P_ELEVATION = "elevation"; //$NON-NLS-1$
+ final static String P_EMPTY_CELLS = "empty-cells"; //$NON-NLS-1$
+ final static String P_FLOAT = "float"; //$NON-NLS-1$
+ final static String P_FONT = "font"; //$NON-NLS-1$
+ final static String P_FONT_FAMILY = "font-family"; //$NON-NLS-1$
+ final static String P_FONT_SIZE = "font-size"; //$NON-NLS-1$
+ final static String P_FONT_SIZE_ADJUST = "font-size-adjust"; //$NON-NLS-1$
+ final static String P_FONT_STRETCH = "font-stretch"; //$NON-NLS-1$
+ final static String P_FONT_STYLE = "font-style"; //$NON-NLS-1$
+ final static String P_FONT_VARIANT = "font-variant"; //$NON-NLS-1$
+ final static String P_FONT_WEIGHT = "font-weight"; //$NON-NLS-1$
+ final static String P_HEIGHT = "height"; //$NON-NLS-1$
+ final static String P_LEFT = "left"; //$NON-NLS-1$
+ final static String P_LETTER_SPACING = "letter-spacing"; //$NON-NLS-1$
+ final static String P_LINE_HEIGHT = "line-height"; //$NON-NLS-1$
+ final static String P_LIST_STYLE = "list-style"; //$NON-NLS-1$
+ final static String P_LIST_STYLE_IMAGE = "list-style-image"; //$NON-NLS-1$
+ final static String P_LIST_STYLE_POSITION = "list-style-position"; //$NON-NLS-1$
+ final static String P_LIST_STYLE_TYPE = "list-style-type"; //$NON-NLS-1$
+ final static String P_MARGIN = "margin"; //$NON-NLS-1$
+ final static String P_MARGIN_TOP = "margin-top"; //$NON-NLS-1$
+ final static String P_MARGIN_RIGHT = "margin-right"; //$NON-NLS-1$
+ final static String P_MARGIN_BOTTOM = "margin-bottom"; //$NON-NLS-1$
+ final static String P_MARGIN_LEFT = "margin-left"; //$NON-NLS-1$
+ final static String P_MARKER_OFFSET = "marker-offset"; //$NON-NLS-1$
+ final static String P_MARKS = "marks"; //$NON-NLS-1$
+ final static String P_MAX_HEIGHT = "max-height"; //$NON-NLS-1$
+ final static String P_MAX_WIDTH = "max-width"; //$NON-NLS-1$
+ final static String P_MIN_HEIGHT = "min-height"; //$NON-NLS-1$
+ final static String P_MIN_WIDTH = "min-width"; //$NON-NLS-1$
+ final static String P_ORPHANS = "orphans"; //$NON-NLS-1$
+ final static String P_OUTLINE = "outline"; //$NON-NLS-1$
+ final static String P_OUTLINE_COLOR = "outline-color"; //$NON-NLS-1$
+ final static String P_OUTLINE_STYLE = "outline-style"; //$NON-NLS-1$
+ final static String P_OUTLINE_WIDTH = "outline-width"; //$NON-NLS-1$
+ final static String P_OVERFLOW = "overflow"; //$NON-NLS-1$
+ final static String P_PADDING = "padding"; //$NON-NLS-1$
+ final static String P_PADDING_TOP = "padding-top"; //$NON-NLS-1$
+ final static String P_PADDING_RIGHT = "padding-right"; //$NON-NLS-1$
+ final static String P_PADDING_BOTTOM = "padding-bottom"; //$NON-NLS-1$
+ final static String P_PADDING_LEFT = "padding-left"; //$NON-NLS-1$
+ final static String P_PAGE = "page"; //$NON-NLS-1$
+ final static String P_PAGE_BREAK_AFTER = "page-break-after"; //$NON-NLS-1$
+ final static String P_PAGE_BREAK_BEFORE = "page-break-before"; //$NON-NLS-1$
+ final static String P_PAGE_BREAK_INSIDE = "page-break-inside"; //$NON-NLS-1$
+ final static String P_PAUSE = "pause"; //$NON-NLS-1$
+ final static String P_PAUSE_AFTER = "pause-after"; //$NON-NLS-1$
+ final static String P_PAUSE_BEFORE = "pause-before"; //$NON-NLS-1$
+ final static String P_PITCH = "pitch"; //$NON-NLS-1$
+ final static String P_PITCH_RANGE = "pitch-range"; //$NON-NLS-1$
+ final static String P_PLAY_DURING = "play-during"; //$NON-NLS-1$
+ final static String P_POSITION = "position"; //$NON-NLS-1$
+ final static String P_QUOTES = "quotes"; //$NON-NLS-1$
+ final static String P_RICHNESS = "richness"; //$NON-NLS-1$
+ final static String P_RIGHT = "right"; //$NON-NLS-1$
+ final static String P_SIZE = "size"; //$NON-NLS-1$
+ final static String P_SPEAK = "speak"; //$NON-NLS-1$
+ final static String P_SPEAK_HEADER = "speak-header"; //$NON-NLS-1$
+ final static String P_SPEAK_NUMERAL = "speak-numeral"; //$NON-NLS-1$
+ final static String P_SPEAK_PUNCTUATION = "speak-punctuation"; //$NON-NLS-1$
+ final static String P_SPEECH_RATE = "speech-rate"; //$NON-NLS-1$
+ final static String P_STRESS = "stress"; //$NON-NLS-1$
+ final static String P_TABLE_LAYOUT = "table-layout"; //$NON-NLS-1$
+ final static String P_TEXT_ALIGN = "text-align"; //$NON-NLS-1$
+ final static String P_TEXT_DECORATION = "text-decoration"; //$NON-NLS-1$
+ final static String P_TEXT_INDENT = "text-indent"; //$NON-NLS-1$
+ final static String P_TEXT_SHADOW = "text-shadow"; //$NON-NLS-1$
+ final static String P_TEXT_TRANSFORM = "text-transform"; //$NON-NLS-1$
+ final static String P_TOP = "top"; //$NON-NLS-1$
+ final static String P_UNICODE_BIDI = "unicode-bidi"; //$NON-NLS-1$
+ final static String P_VERTICAL_ALIGN = "vertical-align"; //$NON-NLS-1$
+ final static String P_VISIBILITY = "visibility"; //$NON-NLS-1$
+ final static String P_VOICE_FAMILY = "voice-family"; //$NON-NLS-1$
+ final static String P_VOLUME = "volume"; //$NON-NLS-1$
+ final static String P_WHITE_SPACE = "white-space"; //$NON-NLS-1$
+ final static String P_WIDOWS = "widows"; //$NON-NLS-1$
+ final static String P_WIDTH = "width"; //$NON-NLS-1$
+ final static String P_WORD_SPACING = "word-spacing"; //$NON-NLS-1$
+ final static String P_Z_INDEX = "z-index"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSStringID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSStringID.java
new file mode 100644
index 0000000000..6157886591
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSStringID.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSStringID {
+
+ final static String S_ANY = "any"; //$NON-NLS-1$
+ final static String S_COUNTER_IDENTIFIER = "counter-identifier"; //$NON-NLS-1$
+ final static String S_FAMILY_NAME = "family-name"; //$NON-NLS-1$
+ final static String S_FONT_FACE_NAME = "font-face-name"; //$NON-NLS-1$
+ final static String S_PAGE_IDENTIFIER = "page-identifier"; //$NON-NLS-1$
+ final static String S_SPECIFIC_VOICE = "specific-voice"; //$NON-NLS-1$
+ final static String S_URANGE = "urange"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSUnitID.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSUnitID.java
new file mode 100644
index 0000000000..76cfac95ea
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/metamodel/util/CSSUnitID.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.metamodel.util;
+
+public interface CSSUnitID {
+
+ final static String U_CM = "cm";//$NON-NLS-1$
+ final static String U_DEG = "deg";//$NON-NLS-1$
+ final static String U_EMS = "em";//$NON-NLS-1$
+ final static String U_EXS = "ex";//$NON-NLS-1$
+ final static String U_GRAD = "grad";//$NON-NLS-1$
+ final static String U_HASH = "#";//$NON-NLS-1$
+ final static String U_HZ = "Hz";//$NON-NLS-1$
+ final static String U_IN = "in";//$NON-NLS-1$
+ // final static String U_INTEGER = "INTEGER";//$NON-NLS-1$
+ final static String U_KHZ = "kHz";//$NON-NLS-1$
+ final static String U_MM = "mm";//$NON-NLS-1$
+ final static String U_MS = "ms";//$NON-NLS-1$
+ // final static String U_NUMBER = "NUMBER";//$NON-NLS-1$
+ final static String U_PC = "pc";//$NON-NLS-1$
+ final static String U_PERCENTAGE = "%";//$NON-NLS-1$
+ final static String U_PT = "pt";//$NON-NLS-1$
+ final static String U_PX = "px";//$NON-NLS-1$
+ final static String U_RAD = "rad";//$NON-NLS-1$
+ final static String U_S = "s";//$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/CSSModelLoader.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/CSSModelLoader.java
new file mode 100644
index 0000000000..476b7b2116
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/CSSModelLoader.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.modelhandler;
+
+
+import org.eclipse.wst.css.core.internal.document.CSSModelImpl;
+import org.eclipse.wst.css.core.internal.encoding.CSSDocumentLoader;
+import org.eclipse.wst.sse.core.AbstractModelLoader;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.ModelLoader;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+
+
+/**
+ *
+ */
+public class CSSModelLoader extends AbstractModelLoader {
+ /**
+ * CSSLoader constructor comment.
+ */
+ public CSSModelLoader() {
+ super();
+ }
+
+ /*
+ * @see ModelLoader#newModel()
+ */
+ public IStructuredModel newModel() {
+ IStructuredModel model = new CSSModelImpl();
+ // now done in create
+ // model.setStructuredDocument(createNewStructuredDocument());
+ // model.setFactoryRegistry(defaultFactoryRegistry());
+ return model;
+ }
+
+ public ModelLoader newInstance() {
+ return new CSSModelLoader();
+ }
+
+ public IDocumentLoader getDocumentLoader() {
+ if (documentLoaderInstance == null) {
+ documentLoaderInstance = new CSSDocumentLoader();
+ }
+ return documentLoaderInstance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/ModelHandlerForCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/ModelHandlerForCSS.java
new file mode 100644
index 0000000000..27502e3b54
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/modelhandler/ModelHandlerForCSS.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.modelhandler;
+
+import org.eclipse.wst.css.core.internal.encoding.CSSDocumentCharsetDetector;
+import org.eclipse.wst.css.core.internal.encoding.CSSDocumentLoader;
+import org.eclipse.wst.sse.core.ModelLoader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.modelhandler.AbstractModelHandler;
+import org.eclipse.wst.sse.core.modelhandler.IModelHandler;
+
+
+public class ModelHandlerForCSS extends AbstractModelHandler implements IModelHandler {
+
+ /**
+ * Needs to match what's in plugin registry. In fact, can be overwritten
+ * at run time with what's in registry! (so should never be 'final')
+ */
+ static String AssociatedContentTypeID = "org.eclipse.wst.css.core.csssource"; //$NON-NLS-1$
+ /**
+ * Needs to match what's in plugin registry. In fact, can be overwritten
+ * at run time with what's in registry! (so should never be 'final')
+ */
+ private static String ModelHandlerID = "org.eclipse.wst.css.core.modelhandler"; //$NON-NLS-1$
+
+ public ModelHandlerForCSS() {
+ super();
+ setId(ModelHandlerID);
+ setAssociatedContentTypeId(AssociatedContentTypeID);
+ }
+
+ public IDocumentCharsetDetector getEncodingDetector() {
+ return new CSSDocumentCharsetDetector();
+ }
+
+ public IDocumentLoader getDocumentLoader() {
+ return new CSSDocumentLoader();
+ }
+
+ /*
+ * @see ContentTypeDescription#getModelLoader()
+ */
+ public ModelLoader getModelLoader() {
+ return new CSSModelLoader();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSRegionContexts.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSRegionContexts.java
new file mode 100644
index 0000000000..8b43dfb216
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSRegionContexts.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.parser;
+
+/**
+ */
+public interface CSSRegionContexts {
+ public static final String CSS_COMMENT = "COMMENT"; //$NON-NLS-1$
+ public static final String CSS_CDO = "CDO"; //$NON-NLS-1$
+ public static final String CSS_CDC = "CDC"; //$NON-NLS-1$
+ public static final String CSS_S = "S"; //$NON-NLS-1$
+
+ public static final String CSS_DELIMITER = "DELIMITER"; //$NON-NLS-1$
+ public static final String CSS_LBRACE = "LBRACE"; //$NON-NLS-1$
+ public static final String CSS_RBRACE = "RBRACE"; //$NON-NLS-1$
+
+ public static final String CSS_IMPORT = "IMPORT"; //$NON-NLS-1$
+ public static final String CSS_PAGE = "PAGE"; //$NON-NLS-1$
+ public static final String CSS_MEDIA = "MEDIA"; //$NON-NLS-1$
+ public static final String CSS_FONT_FACE = "FONT_FACE"; //$NON-NLS-1$
+ public static final String CSS_CHARSET = "CHARSET"; //$NON-NLS-1$
+ public static final String CSS_ATKEYWORD = "ATKEYWORD"; //$NON-NLS-1$
+
+ public static final String CSS_STRING = "STRING"; //$NON-NLS-1$
+ public static final String CSS_URI = "URI"; //$NON-NLS-1$
+ public static final String CSS_MEDIUM = "MEDIUM"; //$NON-NLS-1$
+ public static final String CSS_MEDIA_SEPARATOR = "MEDIA_SEPARATOR"; //$NON-NLS-1$
+
+ public static final String CSS_CHARSET_NAME = "CHARSET_NAME"; //$NON-NLS-1$
+
+ public static final String CSS_PAGE_SELECTOR = "CSS_PAGE_SELECTOR"; //$NON-NLS-1$
+
+ public static final String CSS_SELECTOR_ELEMENT_NAME = "SELECTOR_ELEMENT_NAME"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_UNIVERSAL = "SELECTOR_UNIVERSAL"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_PSEUDO = "SELECTOR_PSEUDO"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_CLASS = "SELECTOR_CLASS"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_ID = "SELECTOR_ID"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_COMBINATOR = "SELECTOR_COMBINATOR"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_SEPARATOR = "SELECTOR_SEPARATOR"; //$NON-NLS-1$
+
+ public static final String CSS_SELECTOR_ATTRIBUTE_START = "SELECTOR_ATTRIBUTE_START"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_ATTRIBUTE_END = "SELECTOR_ATTRIBUTE_END"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_ATTRIBUTE_NAME = "SELECTOR_ATTRIBUTE_NAME"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_ATTRIBUTE_VALUE = "SELECTOR_ATTRIBUTE_VALUE"; //$NON-NLS-1$
+ public static final String CSS_SELECTOR_ATTRIBUTE_OPERATOR = "SELECTOR_ATTRIBUTE_OPERATOR"; //$NON-NLS-1$
+
+ public static final String CSS_DECLARATION_PROPERTY = "DECLARATION_PROPERTY"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_SEPARATOR = "DECLARATION_SEPARATOR"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_DELIMITER = "DECLARATION_DELIMITER"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_IDENT = "DECLARATION_VALUE_IDENT"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_DIMENSION = "DECLARATION_VALUE_DIMENSION"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_PERCENTAGE = "DECLARATION_VALUE_PERCENTAGE"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_NUMBER = "DECLARATION_VALUE_NUMBER"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_FUNCTION = "DECLARATION_VALUE_FUNCTION"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE = "DECLARATION_VALUE_PARENTHESIS_CLOSE"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_STRING = "DECLARATION_VALUE_STRING"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_URI = "DECLARATION_VALUE_URI"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_HASH = "DECLARATION_VALUE_HASH"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_UNICODE_RANGE = "DECLARATION_VALUE_UNICODE_RANGE"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_IMPORTANT = "CSS_DECLARATION_VALUE_IMPORTANT"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_OPERATOR = "DECLARATION_VALUE_OPERATOR"; //$NON-NLS-1$
+ public static final String CSS_DECLARATION_VALUE_S = "DECLARATION_VALUE_S"; //$NON-NLS-1$
+
+ public static final String CSS_UNKNOWN = "UNKNOWN"; //$NON-NLS-1$
+
+ // For null object : CSSTokenizer never set this value
+ public static final String CSS_UNDEFINED = "UNDEFINED"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextParser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextParser.java
new file mode 100644
index 0000000000..20cba6c0da
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextParser.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.parser;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.wst.css.core.internal.parser.CSSTokenizer;
+
+
+
+public class CSSTextParser {
+ public static final int MODE_STYLESHEET = 0;
+ public static final int MODE_DECLARATION = 1;
+ public static final int MODE_DECLARATION_VALUE = 2;
+
+ public CSSTextParser(int parserMode) {
+ initializeParserMode(parserMode);
+ }
+
+ public CSSTextParser(int parserMode, Reader reader) {
+ initializeParserMode(parserMode);
+ reset(reader);
+ }
+
+ public CSSTextParser(int parserMode, String input) {
+ initializeParserMode(parserMode);
+ reset(input);
+ }
+
+ public void reset(Reader reader) {
+ getTokenizer().reset(reader, 0);
+ }
+
+ public void reset(String input) {
+ getTokenizer().reset(new StringReader(input), 0);
+ }
+
+ public CSSTextToken[] getTokens() {
+ List tokenList = getTokenList();
+ CSSTextToken[] tokens = new CSSTextToken[tokenList.size()];
+ return (CSSTextToken[]) tokenList.toArray(tokens);
+ }
+
+ public List getTokenList() {
+ List tokens;
+ try {
+ tokens = getTokenizer().parseText();
+ }
+ catch (IOException e) {
+ tokens = Collections.EMPTY_LIST;
+ }
+ return tokens;
+ }
+
+ private void initializeParserMode(int parserMode) {
+ int initialState;
+ int bufsize;
+ switch (parserMode) {
+ case MODE_STYLESHEET :
+ initialState = CSSTokenizer.YYINITIAL;
+ bufsize = CSSTokenizer.BUFFER_SIZE_NORMAL;
+ break;
+ case MODE_DECLARATION :
+ initialState = CSSTokenizer.ST_DECLARATION;
+ bufsize = CSSTokenizer.BUFFER_SIZE_NORMAL;
+ break;
+ case MODE_DECLARATION_VALUE :
+ initialState = CSSTokenizer.ST_DECLARATION_PRE_VALUE;
+ bufsize = CSSTokenizer.BUFFER_SIZE_SMALL;
+ break;
+ default :
+ return;
+ }
+ if (0 < initialState) {
+ CSSTokenizer tokenizer = getTokenizer();
+ tokenizer.setInitialState(initialState);
+ tokenizer.setInitialBufferSize(bufsize);
+ }
+ }
+
+ private CSSTokenizer getTokenizer() {
+ if (fTokenizer == null) {
+ fTokenizer = new CSSTokenizer();
+ }
+ return fTokenizer;
+ }
+
+ private CSSTokenizer fTokenizer = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextToken.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextToken.java
new file mode 100644
index 0000000000..e68b858c8a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/parser/CSSTextToken.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.parser;
+
+
+public class CSSTextToken {
+ public String kind;
+ public String image;
+ public int start;
+ public int length;
+
+ public String toString() {
+ return (image != null) ? image : ""; //$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSModelPreferenceNames.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSModelPreferenceNames.java
new file mode 100644
index 0000000000..69ca736e70
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSModelPreferenceNames.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.preferences;
+
+public interface CSSModelPreferenceNames {
+ public static final String CASE_IDENTIFIER = "identifierCase"; //$NON-NLS-1$
+ public static final String CASE_PRESERVE_CASE = "preserveCase"; //$NON-NLS-1$
+ public static final String CASE_PROPERTY_NAME = "propNameCase"; //$NON-NLS-1$
+ public static final String CASE_PROPERTY_VALUE = "propValueCase"; //$NON-NLS-1$
+ public static final String FORMAT_BETWEEN_VALUE = "betweenValue"; //$NON-NLS-1$
+ public static final String FORMAT_PROP_POST_DELIM = "postDelim"; //$NON-NLS-1$
+ public static final String FORMAT_PROP_PRE_DELIM = "preDelim"; //$NON-NLS-1$
+ public static final String FORMAT_QUOTE = "quote"; //$NON-NLS-1$
+ public static final String FORMAT_QUOTE_IN_URI = "quoteInURI"; //$NON-NLS-1$
+ public static final String WRAPPING_NEWLINE_ON_OPEN_BRACE = "newLineOnOpenBrace"; //$NON-NLS-1$
+ public static final String WRAPPING_ONE_PER_LINE = "onePropertyPerLine"; //$NON-NLS-1$
+ public static final String WRAPPING_PROHIBIT_WRAP_ON_ATTR = "prohibitWrapOnAttr"; //$NON-NLS-1$
+
+ // CSS cleanup preference names
+ public static final String CLEANUP_CASE_IDENTIFIER = "cleanupIdentifierCase"; //$NON-NLS-1$
+ public static final String CLEANUP_CASE_PROPERTY_NAME = "cleanupPropNameCase"; //$NON-NLS-1$
+ public static final String CLEANUP_CASE_PROPERTY_VALUE = "cleanupPropValueCase"; //$NON-NLS-1$
+ public static final String CLEANUP_CASE_SELECTOR = "cleanupSelectorCase"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSPreferenceHelper.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSPreferenceHelper.java
new file mode 100644
index 0000000000..5cfb5a3008
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/preferences/CSSPreferenceHelper.java
@@ -0,0 +1,278 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.preferences;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.css.core.CSSCorePlugin;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+
+
+/**
+ * this a temp dummy class to map to ModelPreferences
+ */
+public class CSSPreferenceHelper {
+
+ /**
+ *
+ */
+ public synchronized static CSSPreferenceHelper getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSPreferenceHelper();
+ }
+ return fInstance;
+ }
+
+ /**
+ *
+ */
+ public static void createDefaultPreferences(Preferences prefs) {
+ // setBooleanAttribute(COLOR_ENABLED, true);
+ prefs.setDefault(CSSModelPreferenceNames.FORMAT_PROP_PRE_DELIM, 0);
+ prefs.setDefault(CSSModelPreferenceNames.FORMAT_PROP_POST_DELIM, 1);
+ prefs.setDefault(CSSModelPreferenceNames.FORMAT_QUOTE, "\"");//$NON-NLS-1$
+ prefs.setDefault(CSSModelPreferenceNames.FORMAT_BETWEEN_VALUE, " ");//$NON-NLS-1$
+ prefs.setDefault(CSSModelPreferenceNames.FORMAT_QUOTE_IN_URI, true);
+ prefs.setDefault(CSSModelPreferenceNames.WRAPPING_ONE_PER_LINE, true);
+ prefs.setDefault(CSSModelPreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, true);
+ prefs.setDefault(CSSModelPreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE, false);
+ prefs.setDefault(CSSModelPreferenceNames.CASE_IDENTIFIER, CommonModelPreferenceNames.UPPER);
+ prefs.setDefault(CSSModelPreferenceNames.CASE_PROPERTY_NAME, CommonModelPreferenceNames.LOWER);
+ prefs.setDefault(CSSModelPreferenceNames.CASE_PROPERTY_VALUE, CommonModelPreferenceNames.LOWER);
+ prefs.setDefault(CSSModelPreferenceNames.CASE_PRESERVE_CASE, true);
+ // setBooleanAttribute(ASSIST_CATEGORIZE, true);
+
+ // CSS cleanup preferences
+ prefs.setDefault(CSSModelPreferenceNames.CLEANUP_CASE_IDENTIFIER, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CSSModelPreferenceNames.CLEANUP_CASE_PROPERTY_NAME, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CSSModelPreferenceNames.CLEANUP_CASE_PROPERTY_VALUE, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CSSModelPreferenceNames.CLEANUP_CASE_SELECTOR, CommonModelPreferenceNames.ASIS);
+ }
+
+ /**
+ *
+ */
+ public String getBetweenValueString() {
+ return getPreferences().getString(CSSModelPreferenceNames.FORMAT_BETWEEN_VALUE);
+ }
+
+ /**
+ *
+ */
+ public String getIndentString() {
+ Preferences prefs = getPreferences();
+ boolean bUseTab = prefs.getBoolean(CommonModelPreferenceNames.INDENT_USING_TABS);
+ if (bUseTab) {
+ return "\t"; //$NON-NLS-1$
+ }
+ else {
+ int n = getModelManagerPlugin().getPluginPreferences().getInt(CommonModelPreferenceNames.TAB_WIDTH);
+ StringBuffer buf = new StringBuffer();
+ while (0 < n--) {
+ buf.append(" "); //$NON-NLS-1$
+ }
+ return buf.toString();
+ }
+ }
+
+ /**
+ *
+ */
+ public int getMaxLineWidth() {
+ Preferences prefs = getPreferences();
+ return prefs.getInt(CommonModelPreferenceNames.LINE_WIDTH);
+ }
+
+ /**
+ *
+ */
+ public String getQuoteString(ICSSModel model) {
+ // nakamori_TODO css pref transition
+ return getPreferences().getString(CSSModelPreferenceNames.FORMAT_QUOTE);
+ }
+
+ /**
+ *
+ */
+ public int getSpacesPostDelimiter() {
+ return getPreferences().getInt(CSSModelPreferenceNames.FORMAT_PROP_POST_DELIM);
+ }
+
+ /**
+ *
+ */
+ public int getSpacesPreDelimiter() {
+ return getPreferences().getInt(CSSModelPreferenceNames.FORMAT_PROP_PRE_DELIM);
+ }
+
+ /**
+ *
+ */
+ public boolean isIdentUpperCase() {
+ if (getPreferences().getInt(CSSModelPreferenceNames.CASE_IDENTIFIER) == CommonModelPreferenceNames.UPPER)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ *
+ */
+ public boolean isNewLineOnOpenBrace() {
+ return getPreferences().getBoolean(CSSModelPreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE);
+ }
+
+ /**
+ *
+ */
+ public boolean isOnePropertyPerLine() {
+ return getPreferences().getBoolean(CSSModelPreferenceNames.WRAPPING_ONE_PER_LINE);
+ }
+
+ /**
+ *
+ */
+ public boolean isPreserveCase() {
+ return getPreferences().getBoolean(CSSModelPreferenceNames.CASE_PRESERVE_CASE);
+ }
+
+ /**
+ *
+ */
+ public boolean isProhibitWrapOnAttr() {
+ return getPreferences().getBoolean(CSSModelPreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR);
+ }
+
+ /**
+ *
+ */
+ public boolean isPropNameUpperCase() {
+ if (getPreferences().getInt(CSSModelPreferenceNames.CASE_PROPERTY_NAME) == CommonModelPreferenceNames.UPPER)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ *
+ */
+ public boolean isPropValueUpperCase() {
+ if (getPreferences().getInt(CSSModelPreferenceNames.CASE_PROPERTY_VALUE) == CommonModelPreferenceNames.UPPER)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ *
+ */
+ public boolean isQuoteInURI() {
+ return getPreferences().getBoolean(CSSModelPreferenceNames.FORMAT_QUOTE_IN_URI);
+ }
+
+ /**
+ *
+ */
+ protected void setBetweenValueString(String newBetweenValueString) {
+ getPreferences().setValue(CSSModelPreferenceNames.FORMAT_BETWEEN_VALUE, newBetweenValueString);
+ }
+
+ /**
+ *
+ */
+ protected void setIdentUpperCase(boolean newIdentUpperCase) {
+ int theCase = CommonModelPreferenceNames.LOWER;
+ if (newIdentUpperCase)
+ theCase = CommonModelPreferenceNames.UPPER;
+ getPreferences().setValue(CSSModelPreferenceNames.CASE_IDENTIFIER, theCase);
+ }
+
+ /**
+ *
+ */
+ protected void setOnePropertyPerLine(boolean newOnePropertyPerLine) {
+ getPreferences().setValue(CSSModelPreferenceNames.WRAPPING_ONE_PER_LINE, newOnePropertyPerLine);
+ }
+
+ /**
+ *
+ */
+ protected void setPreserveCase(boolean newPreserveCase) {
+ getPreferences().setValue(CSSModelPreferenceNames.CASE_PRESERVE_CASE, newPreserveCase);
+ }
+
+ /**
+ *
+ */
+ protected void setProhibitWrapOnAttr(boolean newProhibitWrapOnAttr) {
+ getPreferences().setValue(CSSModelPreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, newProhibitWrapOnAttr);
+ }
+
+ /**
+ *
+ */
+ protected void setPropNameUpperCase(boolean newPropNameUpperCase) {
+ int theCase = CommonModelPreferenceNames.LOWER;
+ if (newPropNameUpperCase)
+ theCase = CommonModelPreferenceNames.UPPER;
+ getPreferences().setValue(CSSModelPreferenceNames.CASE_PROPERTY_NAME, theCase);
+ }
+
+ /**
+ *
+ */
+ protected void setPropValueUpperCase(boolean newPropValueUpperCase) {
+ int theCase = CommonModelPreferenceNames.LOWER;
+ if (newPropValueUpperCase)
+ theCase = CommonModelPreferenceNames.UPPER;
+ getPreferences().setValue(CSSModelPreferenceNames.CASE_PROPERTY_VALUE, theCase);
+ }
+
+ /**
+ *
+ */
+ public void setQuoteString(String quote) {
+ getPreferences().setValue(CSSModelPreferenceNames.FORMAT_QUOTE, quote);
+ }
+
+ /**
+ *
+ */
+ public void setSpacesPostDelimiter(int num) {
+ getPreferences().setValue(CSSModelPreferenceNames.FORMAT_PROP_POST_DELIM, num);
+ }
+
+ /**
+ *
+ */
+ public void setSpacesPreDelimiter(int num) {
+ getPreferences().setValue(CSSModelPreferenceNames.FORMAT_PROP_PRE_DELIM, num);
+ }
+
+ private Preferences getPreferences() {
+ CSSCorePlugin cssModelPlugin = (CSSCorePlugin) Platform.getPlugin("org.eclipse.wst.css.core"); //$NON-NLS-1$
+ return cssModelPlugin.getPluginPreferences();
+ }
+
+ private CSSPreferenceHelper() {
+ super();
+ }
+
+ private static CSSPreferenceHelper fInstance = null;
+
+ private IModelManagerPlugin getModelManagerPlugin() {
+
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ return plugin;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/AbstractCssTraverser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/AbstractCssTraverser.java
new file mode 100644
index 0000000000..b418efe034
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/AbstractCssTraverser.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+import java.util.ArrayList;
+import java.util.Stack;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+
+
+
+/**
+ *
+ */
+public abstract class AbstractCssTraverser {
+
+ public static short TRAV_CONT = 0;
+ public static short TRAV_PRUNE = 1;
+ public static short TRAV_STOP = 2;
+ protected java.util.Stack travStack;
+ private boolean fTraverseImported = false;
+ private boolean fTraverseImportFirst = false;
+ private java.util.Vector traversedSheets;
+
+ /**
+ * CssPropCMNode constructor comment.
+ */
+ public AbstractCssTraverser() {
+ super();
+ }
+
+ /**
+ * @param model
+ * org.eclipse.wst.css.core.model.interfaces.ICSSModel
+ */
+ public final void apply(ICSSModel model) {
+ apply(model.getDocument());
+ }
+
+ /**
+ * @param root
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ public final void apply(ICSSNode root) {
+ travStack = new Stack();
+ if (fTraverseImported) {
+ traversedSheets = new Vector();
+ if (root != null && root.getOwnerDocument() != null && root.getOwnerDocument().getNodeType() == ICSSNode.STYLESHEET_NODE) {
+ traversedSheets.add(root.getOwnerDocument());
+ }
+ }
+
+ // first call begin()
+ begin(root);
+
+ // traverse
+ traverse(root);
+
+ // last call end()
+ end(root);
+ }
+
+ /**
+ * @return short
+ * @param node
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ protected void begin(ICSSNode node) {
+ }
+
+ /**
+ * @param node
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ protected void end(ICSSNode node) {
+ }
+
+ /**
+ * @return boolean
+ */
+ public final boolean isTraverseImported() {
+ return fTraverseImported;
+ }
+
+ /**
+ * @return short
+ * @param node
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ protected short postNode(ICSSNode node) {
+ return (short) 0;
+ }
+
+ /**
+ * @return short
+ * @param node
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ protected short preNode(ICSSNode node) {
+ return (short) 0;
+ }
+
+ /**
+ * @param newTraverseImported
+ * boolean
+ */
+ public final void setTraverseImported(boolean newTraverseImported) {
+ fTraverseImported = newTraverseImported;
+ }
+
+ /**
+ * @param newTraverseImportFirst
+ * boolean
+ */
+ public final void setTraverseImportFirst(boolean newTraverseImportFirst) {
+ fTraverseImportFirst = newTraverseImportFirst;
+ }
+
+ /**
+ * @return short
+ * @param node
+ * com.ibm.sed.css.interfaces.ICSSNode
+ */
+ private final short traverse(ICSSNode node) {
+ if (node == null)
+ return TRAV_CONT;
+
+ travStack.push(node);
+
+ // pre-action
+ short ret = preNode(node);
+
+ if (ret == TRAV_CONT) {
+ if (fTraverseImported && (node.getNodeType() == ICSSNode.IMPORTRULE_NODE)) {
+ ICSSImportRule rule = (ICSSImportRule) node;
+ // traverse external style-sheet
+ ICSSStyleSheet sheet = (ICSSStyleSheet) rule.getStyleSheet();
+ if (sheet != null && !traversedSheets.contains(sheet)) { // prevent
+ // loop
+ traversedSheets.add(sheet);
+ short retExt = traverse(sheet);
+ if (retExt == TRAV_STOP) {
+ travStack.pop();
+ return retExt;
+ }
+ }
+ }
+
+ // collect children
+ ArrayList children = new ArrayList();
+ ICSSNode child = node.getFirstChild();
+ if (fTraverseImportFirst) {
+ ArrayList others = new ArrayList();
+
+ while (child != null) {
+ if (child.getNodeType() == ICSSNode.IMPORTRULE_NODE)
+ children.add(child);
+ else
+ others.add(child);
+ child = child.getNextSibling();
+ }
+ children.addAll(others);
+ }
+ else {
+ while (child != null) {
+ children.add(child);
+ child = child.getNextSibling();
+ }
+ }
+
+ // traverse children
+ for (int i = 0; i < children.size(); i++) {
+ child = (ICSSNode) children.get(i);
+ short retChild = traverse(child);
+ if (retChild == TRAV_STOP) {
+ travStack.pop();
+ return retChild;
+ }
+ }
+ }
+ else if (ret == TRAV_STOP) {
+ travStack.pop();
+ return ret;
+ }
+
+ // post-action
+ ret = postNode(node);
+
+ travStack.pop();
+ return (ret == TRAV_PRUNE) ? TRAV_CONT : ret;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSClassTraverser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSClassTraverser.java
new file mode 100644
index 0000000000..042a314d52
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSClassTraverser.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorItem;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+
+
+/**
+ *
+ */
+public class CSSClassTraverser extends AbstractCssTraverser {
+
+ ArrayList fClassNames;
+
+ /**
+ *
+ */
+ public CSSClassTraverser() {
+ super();
+ }
+
+ /**
+ *
+ */
+ private void addClassNames(ICSSStyleRule rule) {
+ ICSSSelectorList selectorList = rule.getSelectors();
+ Iterator iSelector = selectorList.getIterator();
+ while (iSelector.hasNext()) {
+ ICSSSelector selector = (ICSSSelector) iSelector.next();
+ Iterator iItem = selector.getIterator();
+ while (iItem.hasNext()) {
+ ICSSSelectorItem item = (ICSSSelectorItem) iItem.next();
+ if (item.getItemType() == ICSSSelectorItem.SIMPLE) {
+ ICSSSimpleSelector sel = (ICSSSimpleSelector) item;
+ int nClasses = sel.getNumOfClasses();
+ for (int iClass = 0; iClass < nClasses; iClass++) {
+ String className = sel.getClass(iClass);
+ if (!fClassNames.contains(className))
+ fClassNames.add(className);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void begin(ICSSNode node) {
+ if (fClassNames == null)
+ fClassNames = new ArrayList();
+ }
+
+ /**
+ *
+ */
+ protected void end(ICSSNode node) {
+ }
+
+ /**
+ *
+ */
+ public Collection getClassNames() {
+ return (fClassNames != null) ? fClassNames : Collections.EMPTY_LIST;
+ }
+
+ /**
+ *
+ */
+ protected short postNode(ICSSNode node) {
+ return TRAV_CONT;
+ }
+
+ /**
+ *
+ */
+ protected short preNode(ICSSNode node) {
+ short ret;
+ if (node instanceof ICSSStyleRule) {
+ addClassNames((ICSSStyleRule) node);
+ ret = TRAV_PRUNE;
+ }
+ else if (node instanceof ICSSStyleSheet || node instanceof ICSSMediaRule || node instanceof ICSSImportRule) {
+ ret = TRAV_CONT;
+ }
+ else {
+ ret = TRAV_PRUNE;
+ }
+ return ret;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSLinkConverter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSLinkConverter.java
new file mode 100644
index 0000000000..84a8a8168e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSLinkConverter.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.CSSValue;
+
+
+/**
+ *
+ */
+public class CSSLinkConverter extends org.eclipse.wst.css.core.util.AbstractCssTraverser {
+ private static final String URL_BEGIN = "url("; //$NON-NLS-1$
+ private static final String URL_END = ")"; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String D_QUOTE = "\""; //$NON-NLS-1$
+ private static final String S_QUOTE = "\'"; //$NON-NLS-1$
+
+ IStructuredModel baseModel;
+
+ /**
+ *
+ */
+ public CSSLinkConverter(IStructuredModel model) {
+ super();
+ baseModel = model;
+ if (model instanceof ICSSModel && ((ICSSModel) model).getStyleSheetType() != ICSSModel.EXTERNAL) {
+ XMLNode node = (XMLNode) ((ICSSModel) model).getOwnerDOMNode();
+ baseModel = node.getModel();
+ }
+ }
+
+ /**
+ *
+ */
+ public static String addFunc(String value) {
+ if (!value.trim().toLowerCase().startsWith(URL_BEGIN)) {
+ // pa_TODO css pref
+ CSSPreferenceHelper mgr = CSSPreferenceHelper.getInstance();
+ String quote = mgr.getQuoteString(null);
+ value = CSSUtil.stripQuotes(value);
+ quote = CSSUtil.detectQuote(value, quote);
+ String str = URL_BEGIN;
+ if (mgr.isPropValueUpperCase())
+ str = str.toUpperCase();
+ StringBuffer buf = new StringBuffer(str);
+ buf.append(quote);
+ buf.append(value);
+ buf.append(quote);
+ buf.append(URL_END);
+ return buf.toString();
+ }
+ else
+ return value;
+ }
+
+
+
+ /**
+ *
+ */
+ protected void begin(ICSSNode node) {
+ if (baseModel == null) {
+ baseModel = node.getOwnerDocument().getModel();
+ if (baseModel instanceof ICSSModel && ((ICSSModel) baseModel).getStyleSheetType() != ICSSModel.EXTERNAL) {
+ XMLNode xmlNode = (XMLNode) ((ICSSModel) baseModel).getOwnerDOMNode();
+ baseModel = xmlNode.getModel();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private static boolean isUrl(String source) {
+ if (source == null)
+ return false;
+ source = source.trim().toLowerCase();
+ return source.startsWith(URL_BEGIN);
+ }
+
+ /**
+ *
+ */
+ protected short preNode(ICSSNode node) {
+ if (node.getNodeType() == ICSSNode.PRIMITIVEVALUE_NODE) {
+ toAbsolute((CSSValue) node);
+ }
+ else if (node.getNodeType() == ICSSNode.IMPORTRULE_NODE) {
+ ICSSImportRule iRule = (ICSSImportRule) node;
+ iRule.setHref(toAbsolute(addFunc(iRule.getHref())));
+ }
+ return TRAV_CONT;
+ }
+
+ /**
+ *
+ * @return java.lang.String
+ * @param value
+ * java.lang.String
+ */
+ public static String removeFunc(String value) {
+ if (value == null)
+ return EMPTY;
+ String field = value.trim();
+ // first : tear "url(....)"
+ if (field.toLowerCase().startsWith(URL_BEGIN)) {
+ int url = field.toLowerCase().indexOf(URL_BEGIN);
+ int endParenthesis = field.lastIndexOf(URL_END);
+ if (endParenthesis > url) {
+ field = field.substring(url + 4, endParenthesis);
+ }
+ else
+ field = field.substring(url + 4);
+ }
+ return field.trim();
+ }
+
+ /**
+ *
+ */
+ public static String stripFunc(String value) {
+ if (value == null)
+ return EMPTY;
+ // first : tear "url(....)"
+ String field = removeFunc(value);
+ // second : tear quotations
+ if (field.toLowerCase().startsWith(D_QUOTE)) {
+ int quote = field.indexOf(D_QUOTE);
+ int end = field.lastIndexOf(D_QUOTE);
+ if (end > quote) {
+ field = field.substring(quote + 1, end);
+ }
+ else
+ field = field.substring(quote + 1);
+ }
+ else if (field.toLowerCase().startsWith(S_QUOTE)) {
+ int quote = field.indexOf(S_QUOTE);
+ int end = field.lastIndexOf(S_QUOTE);
+ if (end > quote) {
+ field = field.substring(quote + 1, end);
+ }
+ else
+ field = field.substring(quote + 1);
+ }
+
+ return field.trim();
+ }
+
+ /**
+ *
+ */
+ public String toAbsolute(String source) {
+ if (isUrl(source)) {
+ String url = CSSPathService.getAbsoluteURL(baseModel, stripFunc(source));
+ return (url != null) ? addFunc(url) : (URL_BEGIN + URL_END);
+ }
+ return source;
+ }
+
+ /**
+ *
+ */
+ public boolean toAbsolute(CSSValue node) {
+ if (node instanceof ICSSPrimitiveValue) {
+ ICSSPrimitiveValue value = (ICSSPrimitiveValue) node;
+ if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
+ value.setValue(stripFunc(toAbsolute(URL_BEGIN + value.getStringValue() + URL_END)));
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSPathService.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSPathService.java
new file mode 100644
index 0000000000..72b2d0b584
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSPathService.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.sse.core.IStructuredModel;
+
+/**
+ *
+ */
+public class CSSPathService {
+
+ // Constants
+ private static final String FILEURLSCHEME = "file";//$NON-NLS-1$
+ private static final String URLCOLON = ":"; //$NON-NLS-1$
+ private static final String FILEURLPREFIX = FILEURLSCHEME + URLCOLON + "//";//$NON-NLS-1$
+ private static final String URLSEPARATOR = "/"; //$NON-NLS-1$
+
+ /**
+ * @return java.lang.String
+ * @param baseModel
+ * com.ibm.sed.model.IStructuredModel
+ * @param ref
+ * java.lang.String
+ */
+ public static String getAbsoluteURL(IStructuredModel baseModel, String ref) {
+ String absLink = URLModelProviderCSS.resolveURI(baseModel, ref, true);
+ String url = absLink;
+ if (absLink != null) { // if it has not scheme, we must add "file"
+ // scheme
+ try {
+ new java.net.URL(absLink);
+ }
+ catch (java.net.MalformedURLException e) {
+ IPath path = new Path(absLink);
+ if (path != null)
+ url = toURL(path);
+ }
+ }
+ return url;
+ }
+
+ /**
+ *
+ * @return org.eclipse.core.resources.IFile
+ * @param location
+ * java.lang.String
+ */
+ public static IFile location2File(String location) {
+ Path path = new Path(location);
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+ }
+
+ /**
+ * Gets a file URL for the path.
+ */
+ private static String toURL(IPath path) {
+ path = new Path(path.toFile().getAbsolutePath());
+ if (path.isUNC() == true) {
+ // it's UNC. return file://host/foo/bar/baz.html
+ return FILEURLSCHEME + URLCOLON + path.toString();
+ }
+ return FILEURLPREFIX + URLSEPARATOR + path.toString();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSSelectorListFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSSelectorListFactory.java
new file mode 100644
index 0000000000..633e1fc8c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSSelectorListFactory.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.internal.document.CSSSelectorListImpl;
+
+
+public class CSSSelectorListFactory {
+ static synchronized public CSSSelectorListFactory getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSSelectorListFactory();
+ }
+ return fInstance;
+ }
+
+ public ICSSSelectorList createSelectorList(String selectorString) {
+ return new CSSSelectorListImpl(selectorString);
+ }
+
+
+ private CSSSelectorListFactory() {
+ super();
+ }
+
+ private static CSSSelectorListFactory fInstance;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSStyleDeclarationFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSStyleDeclarationFactory.java
new file mode 100644
index 0000000000..0aec11a558
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSStyleDeclarationFactory.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.internal.document.CSSStyleDeclarationFactoryContext;
+
+
+/**
+ *
+ */
+public class CSSStyleDeclarationFactory extends CSSStyleDeclarationFactoryContext {
+
+ private static CSSStyleDeclarationFactory fInstance = null;
+
+ /**
+ * CSSStyleDeclarationFactory constructor comment.
+ */
+ private CSSStyleDeclarationFactory() {
+ super();
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.model.interfaces.ICSSStyleDeclaration
+ * @param decl
+ * org.eclipse.wst.css.core.model.interfaces.ICSSStyleDeclaration
+ */
+ public ICSSStyleDeclaration createStyleDeclaration(ICSSStyleDeclaration decl) {
+ if (decl == null) {
+ return null;
+ }
+ // 11/22/2004, nsd, nothing's done with this variable
+// ICSSStyleDeclaration newNode = createStyleDeclaration();
+
+ // 05/11/2004, dmw, unnecessary cast, looks like it was always
+ // returning null!
+ // so something is probably amiss
+ // if (!(newNode instanceof ICSSDocument)) {
+ return null;
+ // }
+ // fOwnerDocument = newNode;
+ // cloneChildNodes(decl, newNode);
+ // return newNode;
+ }
+
+ /**
+ *
+ */
+ public synchronized static CSSStyleDeclarationFactory getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSStyleDeclarationFactory();
+ }
+ return fInstance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSUtil.java
new file mode 100644
index 0000000000..34805eaaf4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/CSSUtil.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.internal.Logger;
+import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+
+
+public class CSSUtil {
+
+ /**
+ *
+ */
+ public static void debugOut(String str) {
+ Logger.log(Logger.WARNING, "css warning: " + str); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ // public static Vector extractMediaContents(Vector regions) {
+ // Vector media = new Vector();
+ // if (regions == null) { return media; }
+ //
+ // boolean bReady = true;
+ // for (Iterator i = regions.iterator(); i.hasNext(); ) {
+ // ITextRegion region = (ITextRegion)i.next();
+ // if (region == null) { continue; }
+ // String type = region.getType();
+ // if (bReady) {
+ // if (type == IDENT) {
+ // media.addElement(region.getText());
+ // bReady = false;
+ // }
+ // } else {
+ // if (type == COMMA) {
+ // bReady = true;
+ // }
+ // }
+ // }
+ //
+ // return media;
+ // }
+ /**
+ *
+ */
+ public static String extractStringContents(String text) {
+ return stripQuotes(text);
+ }
+
+ /**
+ *
+ */
+ public static String extractUriContents(String text) {
+ String contents = text.trim();
+ if (contents.toLowerCase().startsWith("url(") && //$NON-NLS-1$
+ contents.toLowerCase().endsWith(")")) {//$NON-NLS-1$
+ // strip "url(", ")"
+ contents = contents.substring(4, contents.length() - 1);
+ }
+ contents = stripQuotes(contents);
+
+ return contents;
+ }
+
+ /**
+ *
+ */
+ public static IStructuredDocumentRegion findNextSignificantNode(IStructuredDocumentRegion startNode) {
+ if (startNode == null) {
+ return null;
+ }
+ IStructuredDocumentRegion node = startNode.getNext();
+ while (node != null) {
+ String type = getStructuredDocumentRegionType(node);
+ if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) {
+ return node;
+ }
+ node = node.getNext();
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ public static IStructuredDocumentRegion findNodeBackward(IStructuredDocumentRegion startNode, IStructuredDocumentRegion endNode, String type) {
+ IStructuredDocumentRegion node;
+ for (node = startNode; node != null; node = node.getPrevious()) {
+ if (node.getStartOffset() < endNode.getStartOffset()) {
+ node = null;
+ break;
+ }
+ else if (getStructuredDocumentRegionType(node) == type) {
+ break;
+ }
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ public static IStructuredDocumentRegion findNodeForward(IStructuredDocumentRegion startNode, IStructuredDocumentRegion endNode, String type) {
+ IStructuredDocumentRegion node;
+ for (node = startNode; node != null; node = node.getNext()) {
+ if (endNode.getStartOffset() < node.getStartOffset()) {
+ node = null;
+ break;
+ }
+ else if (getStructuredDocumentRegionType(node) == type) {
+ break;
+ }
+ }
+ return node;
+ }
+
+ /**
+ *
+ */
+ public static IStructuredDocumentRegion findPreviousSignificantNode(IStructuredDocumentRegion startNode) {
+ if (startNode == null) {
+ return null;
+ }
+ IStructuredDocumentRegion node = startNode.getPrevious();
+ while (node != null) {
+ String type = getStructuredDocumentRegionType(node);
+ if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) {
+ return node;
+ }
+ node = node.getPrevious();
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ public static String getClassString(Object object) {
+ if (object == null) {
+ return "null"; //$NON-NLS-1$
+ }
+ else {
+ String name = object.getClass().toString();
+ int lastPeriod = name.lastIndexOf('.');
+ return name.substring(lastPeriod + 1);
+ }
+ }
+
+ /**
+ *
+ */
+ public static String getStructuredDocumentRegionType(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null) {
+ return CSSRegionContexts.CSS_UNDEFINED;
+ }
+ ITextRegionList regions = flatNode.getRegions();
+ if (regions == null || regions.size() == 0) {
+ return CSSRegionContexts.CSS_UNDEFINED;
+ }
+ ITextRegion region = regions.get(0);
+ return region.getType();
+ }
+
+ /**
+ *
+ */
+ public static int getLengthDifference(IStructuredDocumentRegionList newNodes, IStructuredDocumentRegionList oldNodes) {
+ int newLen = getTextLength(newNodes);
+ int oldLen = getTextLength(oldNodes);
+ return newLen - oldLen;
+ }
+
+ /**
+ *
+ */
+ public static String getRegionText(IStructuredDocumentRegion flatNode, ITextRegionList regions) {
+ StringBuffer buf = new StringBuffer();
+ if (regions != null) {
+ for (Iterator i = regions.iterator(); i.hasNext();) {
+ ITextRegion region = (ITextRegion) i.next();
+ if (region == null) {
+ continue;
+ }
+ buf.append(flatNode.getText(region));
+ }
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ *
+ */
+ public static int getTextLength(IStructuredDocumentRegionList nodes) {
+ int length = 0;
+
+ if (nodes != null) {
+ for (Enumeration e = nodes.elements(); e.hasMoreElements();) {
+ IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) e.nextElement();
+ if (flatNode != null) {
+ length += flatNode.getText().length();
+ }
+ }
+ }
+
+ return length;
+ }
+
+ /**
+ *
+ * @param token
+ * @return
+ */
+ public static boolean isLength(CSSTextToken token) {
+ if (token == null)
+ return false;
+ if (token.kind == CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION)
+ return true;
+ if (token.kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ double number = Double.parseDouble(token.image);
+ if (number == 0.0)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ public static boolean isSelectorText(IStructuredDocumentRegion region) {
+ String type = getStructuredDocumentRegionType(region);
+ if (CSSRegionUtil.isSelectorBegginingType(type)) {
+ return true;
+ }
+ else if (type == CSSRegionContexts.CSS_UNKNOWN) {
+ // String text = flatNode.getText();
+ // if (text != null && text.indexOf('.') == 0) {
+ return true;
+ // }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ public static String stripQuotes(String text) {
+ if (text == null)
+ return null;
+ String contents = text.trim();
+ if (2 <= contents.length()) {
+ char first = contents.charAt(0);
+ char last = contents.charAt(contents.length() - 1);
+ if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) {
+ contents = contents.substring(1, contents.length() - 1);
+ }
+ }
+ return contents;
+ }
+
+ public static String detectQuote(String source, String defaultQuote) {
+ if (source == null)
+ return defaultQuote;
+ final String D_QUOTE = "\""; //$NON-NLS-1$
+ final String S_QUOTE = "\'"; //$NON-NLS-1$
+
+ int dIndex = source.indexOf(D_QUOTE);
+ int sIndex = source.indexOf(S_QUOTE);
+ if (dIndex < 0 && sIndex < 0) {
+ return defaultQuote;
+ }
+ else if (dIndex < 0) {
+ return D_QUOTE;
+ }
+ else if (sIndex < 0) {
+ return S_QUOTE;
+ }
+ else if (dIndex < sIndex) {
+ return S_QUOTE;
+ }
+ else {
+ return D_QUOTE;
+ }
+ }
+
+ /**
+ *
+ */
+ public static void stripSurroundingSpace(ITextRegionList regions) {
+ if (regions == null) {
+ return;
+ }
+ while (!regions.isEmpty()) {
+ ITextRegion region = regions.get(0);
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) {
+ regions.remove(0);
+ }
+ else {
+ break;
+ }
+ }
+ while (!regions.isEmpty()) {
+ ITextRegion region = regions.get(regions.size() - 1);
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) {
+ regions.remove(region);
+ }
+ else {
+ break;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportRuleCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportRuleCollector.java
new file mode 100644
index 0000000000..429f892e64
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportRuleCollector.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+
+
+/**
+ *
+ */
+public class ImportRuleCollector extends org.eclipse.wst.css.core.util.AbstractCssTraverser {
+
+ protected java.util.Vector rules = new Vector();
+ protected ICSSStyleSheet target = null;
+
+ /**
+ *
+ */
+ public ImportRuleCollector() {
+ super();
+ setTraverseImported(false);
+ }
+
+ /**
+ *
+ */
+ public ImportRuleCollector(ICSSStyleSheet sheet) {
+ super();
+ target = sheet;
+ }
+
+ /**
+ *
+ */
+ public java.util.Vector getRules() {
+ return rules;
+ }
+
+ /**
+ *
+ */
+ protected short preNode(ICSSNode node) {
+ if (node.getNodeType() == ICSSNode.MEDIARULE_NODE || node.getNodeType() == ICSSNode.STYLESHEET_NODE) {
+ return TRAV_CONT;
+ }
+ if (node.getNodeType() == ICSSNode.IMPORTRULE_NODE) {
+ if (target != null) {
+ ICSSImportRule imp = (ICSSImportRule) node;
+ if (imp.getStyleSheet() != target)
+ return TRAV_PRUNE;
+ }
+ if (!rules.contains(node))
+ rules.add(node);
+ }
+ return TRAV_PRUNE;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportedCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportedCollector.java
new file mode 100644
index 0000000000..86dfc67c3a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/ImportedCollector.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+
+
+/**
+ *
+ */
+public class ImportedCollector extends org.eclipse.wst.css.core.util.AbstractCssTraverser {
+
+ protected java.util.Vector externals = new Vector();
+
+ /**
+ *
+ */
+ public ImportedCollector() {
+ super();
+ setTraverseImported(true);
+ }
+
+ /**
+ *
+ */
+ public List getExternals() {
+ return externals;
+ }
+
+ /**
+ *
+ */
+ protected short preNode(ICSSNode node) {
+ if (node.getNodeType() == ICSSNode.MEDIARULE_NODE) {
+ return TRAV_CONT;
+ }
+ if (node.getNodeType() == ICSSNode.STYLESHEET_NODE) {
+ if (!externals.contains(node)) {
+ externals.add(node);
+ }
+ return TRAV_CONT;
+ }
+ if (node.getNodeType() == ICSSNode.IMPORTRULE_NODE) {
+ return TRAV_CONT;
+ }
+ return TRAV_PRUNE;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/RegionIterator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/RegionIterator.java
new file mode 100644
index 0000000000..572f87dcfe
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/RegionIterator.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+/**
+ *
+ */
+public class RegionIterator {
+
+ private IStructuredDocumentRegion documentRegion = null;
+ private IStructuredDocumentRegion curDocumentRegion = null;
+ private int current = -1;
+
+ /**
+ *
+ */
+ public RegionIterator(IStructuredDocument structuredDocument, int index) {
+ super();
+
+ reset(structuredDocument, index);
+ }
+
+ /**
+ *
+ */
+ public RegionIterator(IStructuredDocumentRegion flatNode, ITextRegion region) {
+ super();
+ reset(flatNode, region);
+ }
+
+ /**
+ *
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion() {
+ return curDocumentRegion;
+ }
+
+ /**
+ *
+ */
+ public boolean hasNext() {
+ if (documentRegion == null)
+ return false;
+ if (current < 0)
+ return false;
+ if (current < documentRegion.getRegions().size())
+ return true;
+ return false;
+ }
+
+ /**
+ *
+ */
+ public boolean hasPrev() {
+ // the same as hasNext()
+ return hasNext();
+ }
+
+ /**
+ *
+ */
+ public ITextRegion next() {
+ if (documentRegion == null)
+ return null;
+ if (current < 0 || documentRegion.getRegions() == null || documentRegion.getRegions().size() <= current)
+ return null;
+
+ ITextRegion region = documentRegion.getRegions().get(current);
+ curDocumentRegion = documentRegion;
+
+ if (current >= documentRegion.getRegions().size() - 1) {
+ documentRegion = documentRegion.getNext();
+ current = -1;
+ }
+ current++;
+
+ return region;
+ }
+
+ /**
+ *
+ */
+ public ITextRegion prev() {
+ if (documentRegion == null)
+ return null;
+ if (current < 0 || documentRegion.getRegions() == null || documentRegion.getRegions().size() <= current)
+ return null;
+
+ ITextRegion region = documentRegion.getRegions().get(current);
+ curDocumentRegion = documentRegion;
+
+ if (current == 0) {
+ documentRegion = documentRegion.getPrevious();
+ if (documentRegion != null)
+ current = documentRegion.getRegions().size();
+ else
+ current = 0;
+ }
+ current--;
+
+ return region;
+ }
+
+ /**
+ *
+ */
+ public void reset(IStructuredDocument structuredDocument, int index) {
+ documentRegion = structuredDocument.getRegionAtCharacterOffset(index);
+ curDocumentRegion = documentRegion;
+ if (documentRegion != null) {
+ ITextRegion region = documentRegion.getRegionAtCharacterOffset(index);
+ current = documentRegion.getRegions().indexOf(region);
+ }
+ }
+
+ /**
+ *
+ */
+ public void reset(IStructuredDocumentRegion flatNode, ITextRegion region) {
+ if (region != null && flatNode != null) {
+ this.documentRegion = flatNode;
+ curDocumentRegion = flatNode;
+ current = flatNode.getRegions().indexOf(region);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectionCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectionCollector.java
new file mode 100644
index 0000000000..3f8dee934d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectionCollector.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IndexedRegion;
+
+
+/**
+ */
+public class SelectionCollector extends org.eclipse.wst.css.core.util.AbstractCssTraverser {
+
+ int start, end;
+ List selectedNodes;
+
+ /**
+ * SelectionCollector constructor comment.
+ */
+ public SelectionCollector() {
+ super();
+ }
+
+ /**
+ */
+ protected void begin(ICSSNode node) {
+ selectedNodes = new ArrayList();
+ }
+
+ /**
+ */
+ public List getSelectedNodes() {
+ if (selectedNodes == null)
+ return new ArrayList();
+ else
+ return new ArrayList(selectedNodes);
+ }
+
+ /**
+ */
+ protected short preNode(ICSSNode node) {
+ IndexedRegion iNode = (IndexedRegion) node;
+ if (iNode.getStartOffset() <= end && start < iNode.getEndOffset()) {
+ if (node.getNodeType() != ICSSNode.STYLESHEET_NODE) {
+ IndexedRegion iFirstChild = (IndexedRegion) node.getFirstChild();
+ IndexedRegion iLastChild = (IndexedRegion) node.getLastChild();
+ if (iFirstChild == null || start < iFirstChild.getStartOffset() || iLastChild.getEndOffset() <= end)
+ selectedNodes.add(node);
+ }
+ return TRAV_CONT;
+ }
+ if (iNode.getStartOffset() > end)
+ return TRAV_STOP;
+ else
+ return TRAV_PRUNE;
+ }
+
+ /**
+ */
+ public void setRegion(int newStart, int newEnd) {
+ start = newStart;
+ end = newEnd;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorValidator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorValidator.java
new file mode 100644
index 0000000000..80ca47728b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorValidator.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorItem;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+import org.eclipse.wst.css.core.internal.document.CSSSelectorListImpl;
+
+
+public class SelectorValidator {
+
+ /**
+ * Constructor for SelectorValidator.
+ */
+ public SelectorValidator(String text) {
+ super();
+ fText = text;
+ }
+
+ /**
+ * Returns true if the text consists of one CLASS selector. syntax check
+ * is a little loose (.123 is passed)
+ *
+ * ".class" -> true ".123" -> true ".class , .class2" -> false
+ * ".class.class2" -> false ".123{}" -> false
+ */
+ public boolean isClass() {
+ ICSSSimpleSelector selector = getOnlyOneSimpleSelector();
+ if (selector != null) {
+ return (selector.getName().length() == 0 && selector.getNumOfAttributes() == 0 && selector.getNumOfClasses() == 1 && selector.getNumOfIDs() == 0 && selector.getNumOfPseudoNames() == 0);
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if the text consists of one ID selector.
+ *
+ * "#ID" -> true "H1#myID" -> false "#abc{}" -> false
+ */
+ public boolean isID() {
+ ICSSSimpleSelector selector = getOnlyOneSimpleSelector();
+ if (selector != null) {
+ return (selector.getName().length() == 0 && selector.getNumOfAttributes() == 0 && selector.getNumOfClasses() == 0 && selector.getNumOfIDs() == 1 && selector.getNumOfPseudoNames() == 0);
+ }
+ return false;
+ }
+
+ /**
+ * overall check
+ *
+ * "P#hoge98 + *:hover > A:link, A.external:visited" -> true "H1 H2 {}" ->
+ * false
+ */
+ public boolean isValid() {
+ parse();
+ return (fSelectorList != null && fSelectorList.getErrorCount() == 0);
+ }
+
+ private ICSSSimpleSelector getOnlyOneSimpleSelector() {
+ parse();
+ if (fSelectorList != null && fSelectorList.getLength() == 1) {
+ ICSSSelector selector = fSelectorList.getSelector(0);
+ int nItem = selector.getLength();
+ if (nItem == 1) {
+ ICSSSelectorItem item = selector.getItem(0);
+ if (item instanceof ICSSSimpleSelector) {
+ return (ICSSSimpleSelector) item;
+ }
+ }
+ }
+ return null;
+ }
+
+ private void parse() {
+ if (fSelectorList == null) {
+ if (fText != null) {
+ fSelectorList = new CSSSelectorListImpl(fText);
+ }
+ }
+ }
+
+
+ private String fText = null;
+ private ICSSSelectorList fSelectorList = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorsCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorsCollector.java
new file mode 100644
index 0000000000..26143c0c45
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/SelectorsCollector.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+
+
+/**
+ *
+ */
+public class SelectorsCollector extends AbstractCssTraverser {
+
+ protected Vector selectors = new Vector();
+ protected Vector selectorsToAvoid = null;
+
+ /**
+ *
+ */
+ public SelectorsCollector() {
+ super();
+ setTraverseImported(false);
+ }
+
+ /**
+ *
+ */
+ public void addSelectorToAvoid(ICSSSelector selToAvoid) {
+ if (selToAvoid == null)
+ return;
+ if (selectorsToAvoid == null)
+ selectorsToAvoid = new Vector();
+
+ if (!selectorsToAvoid.contains(selToAvoid))
+ selectorsToAvoid.add(selToAvoid);
+ }
+
+ /**
+ *
+ */
+ public void addSelectorToAvoid(ICSSStyleRule rule) {
+ ICSSSelectorList list = rule.getSelectors();
+ Iterator it = list.getIterator();
+ while (it.hasNext()) {
+ ICSSSelector sel = (ICSSSelector) it.next();
+ addSelectorToAvoid(sel);
+ }
+ }
+
+ /**
+ *
+ */
+ public java.util.List getSelectors() {
+ return selectors;
+ }
+
+ /**
+ *
+ */
+ protected short preNode(ICSSNode node) {
+ if (node.getNodeType() == ICSSNode.STYLERULE_NODE) {
+ ICSSStyleRule rule = (ICSSStyleRule) node;
+ ICSSSelectorList list = rule.getSelectors();
+ Iterator it = list.getIterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (selectorsToAvoid != null && selectorsToAvoid.contains(obj))
+ continue;
+ if (!selectors.contains(obj))
+ selectors.add(obj);
+ }
+ return TRAV_PRUNE;
+ }
+ else if (node.getNodeType() == ICSSNode.STYLESHEET_NODE) {
+ return TRAV_CONT;
+ }
+ return TRAV_PRUNE;
+ }
+
+ /**
+ *
+ */
+ public void setSelectorsToAvoid(java.util.Vector newSelectorsToAvoid) {
+ selectorsToAvoid = newSelectorsToAvoid;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLHelper.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLHelper.java
new file mode 100644
index 0000000000..d4a3a0e776
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLHelper.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.wst.sse.core.util.PathHelper;
+
+/**
+ * Hyperlink manager. Proved useful services like link conversion An utility
+ * class to help other parsre modules to convert links
+ */
+public class URLHelper {
+
+ private static final String FILE_PROTOCOL_SEARCH_SIG = "file:/";//$NON-NLS-1$
+ private static final String FILE_PROTOCOL_SIG = "file:///";//$NON-NLS-1$
+ private static String RELATIVE_PATH_SIG = "..";//$NON-NLS-1$
+ private static final String FORWARD_SLASH = "/";//$NON-NLS-1$
+ private URL fBaseUrl = null; // base url. assumed to a absulute url
+ private String fBaseUrlString = null;
+ private URL fDocRoot = null;
+ private String fDocRootString = null;
+
+ public URLHelper(String baseUrl) {
+ initialize(baseUrl, null);
+ }
+
+ public URLHelper(String baseUrl, String docRoot) {
+ initialize(baseUrl, docRoot);
+ }
+
+ /**
+ * Special adujust for file url
+ */
+ public String adjustFileProtocolUrl(String url) {
+ if (url.startsWith(FILE_PROTOCOL_SEARCH_SIG)) {
+ url = FILE_PROTOCOL_SIG + url.substring(FILE_PROTOCOL_SEARCH_SIG.length());
+ }
+ return url;
+ }
+
+ private String convert(String url, URL baseUrl, String urlString) {
+ String absUrl = url;
+ if (baseUrl != null) {
+ try {
+ // do special thing file protocol
+ if (baseUrl.getProtocol().equalsIgnoreCase("file")) {//$NON-NLS-1$
+ // remove the fist
+ if (url.startsWith("/"))//$NON-NLS-1$
+ url = url.substring(1);
+ // empty string causes malformed exception
+ String tempUrl = url;
+ if ("".equals(url))//$NON-NLS-1$
+ tempUrl = " ";//$NON-NLS-1$
+ URL newUrl = new URL(baseUrl, tempUrl);
+ // do extra math for file protocol to support ie based
+ absUrl = adjustFileProtocolUrl(newUrl.toString());
+ }
+ else {
+ URL newUrl = new URL(fBaseUrl, url);
+ absUrl = newUrl.toString();
+ }
+ }
+ catch (MalformedURLException me) {
+ }
+ // convert everything to forward slash
+ absUrl = PathHelper.switchToForwardSlashes(absUrl);
+ }
+ else {
+ // the given may be based on file
+ if (urlString != null) {
+ // swich the url to proper direction
+ url = PathHelper.removeLeadingSeparator(url);
+ File fle = new File(urlString, url);
+ absUrl = fle.getPath();
+
+ }
+ // convert everything to forward slash
+ absUrl = PathHelper.switchToForwardSlashes(absUrl);
+
+ // if the path ends with ".." we need to add a terminating slash
+ // or
+ // else the link will not be resolved correctly. (it will look
+ // like
+ // /url/path/to/somewhere/.. instead of /url/path/to/
+ if (absUrl.endsWith(FORWARD_SLASH + RELATIVE_PATH_SIG)) {
+ absUrl += FORWARD_SLASH;
+ }
+ }
+
+ // resolve relative path to absolute
+ absUrl = PathHelper.adjustPath(absUrl);
+ return absUrl;
+ }
+
+ private void initialize(String baseUrl, String docRoot) {
+ //
+ // Find out whether baes url is a url or file name
+ //
+ try {
+ String temp = PathHelper.appendTrailingURLSlash(baseUrl);
+ fBaseUrl = new URL(temp);
+ }
+ catch (MalformedURLException mue) {
+ }
+ if (fBaseUrl == null) {
+ // it is a file based url
+ fBaseUrlString = baseUrl;
+ }
+
+ // do the same for doc root
+ if (docRoot != null) {
+ try {
+ String temp = PathHelper.appendTrailingURLSlash(docRoot);
+ fDocRoot = new URL(temp);
+
+ }
+ catch (MalformedURLException mue) {
+ }
+ if (fDocRoot == null) {
+ // it is a file based url
+ fDocRootString = docRoot;
+ }
+ }
+ }
+
+ /**
+ * Convert the given url to a abolute url using the base url Input url can
+ * be of any othe following format Absolute urls -------------- .
+ * http://www.foo.com/ . http://www.foo.com . http://www.foo.com/folder .
+ * http://www.foo.com/folder/ . http://www.foo.com/index.html .
+ * http://www.foo.com/folder/index.html .
+ * http://www.foo.com/folder/../index.html Url relative on document root
+ * ------------------------- . / . /folder . /index.html .
+ * /folder/index.html . /folder/../index.html
+ *
+ * Self relative ------------------------- . index.html . ./index.html .
+ * ../index.html . folder/index.html . folder/../index.html
+ *
+ * file based url adds another dimension since it doesn't have a document
+ * root So uses fDocRoot if provided
+ */
+ public String toAbsolute(String url) {
+ String absUrl = url;
+
+ URL newUrl = null;
+ // try to see it is a absolute url
+ try {
+ newUrl = new URL(url);
+ }
+ catch (MalformedURLException me) {
+ }
+ // if document root is provided
+ // do special case
+ if (newUrl == null) {
+ if (fDocRoot == null && fDocRootString == null) {
+ // try to check relative url
+ absUrl = convert(url, fBaseUrl, fBaseUrlString);
+ }
+ else {
+ // doc root is provided
+ // if the url is a doc root based use doc root
+
+ if (url.startsWith("/"))//$NON-NLS-1$
+ absUrl = convert(url, fDocRoot, fDocRootString);
+ else
+ absUrl = convert(url, fBaseUrl, fBaseUrlString);
+
+ }
+ }
+ return absUrl;
+ }
+
+ /**
+ * Convert from an absolute url to relative url based on the given url
+ * Both are assumed to be ablsute url
+ */
+ public String toRelative(String url, String documentUrl) {
+ String output = url;
+ // assuming both urls are absolute
+ try {
+ URL inputUrl = new URL(url);
+ URL docUrl = new URL(documentUrl);
+ // filter out if the urls are not fro the same domain
+ if (!inputUrl.getProtocol().equals(docUrl.getProtocol()) || !inputUrl.getHost().equals(docUrl.getHost()) || inputUrl.getPort() != docUrl.getPort())
+ return output;
+ // both url are coming form the same place
+ // strip off the domain parts
+ String inputName = inputUrl.getFile();
+ String docName = docUrl.getFile();
+ output = PathHelper.convertToRelative(inputName, docName);
+ }
+ catch (MalformedURLException me) {
+ output = null;
+ }
+ return output;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLModelProviderCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLModelProviderCSS.java
new file mode 100644
index 0000000000..ade39421bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/URLModelProviderCSS.java
@@ -0,0 +1,387 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util;
+
+
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.UnsupportedCharsetException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.encoding.EncodingRule;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.exceptions.ResourceAlreadyExists;
+import org.eclipse.wst.sse.core.exceptions.ResourceInUse;
+import org.eclipse.wst.sse.core.util.PathHelper;
+import org.eclipse.wst.sse.core.util.ProjectResolver;
+import org.eclipse.wst.sse.core.util.URIResolver;
+
+/**
+ */
+public class URLModelProviderCSS {
+
+ private static final int GET_MODEL_FOR_READ = 1;
+ // private static final int GET_NEW_MODEL_FOR_READ = 2;
+ private static final int GET_MODEL_FOR_EDIT = 3;
+ // private static final int GET_NEW_MODEL_FOR_EDIT = 4;
+ // private static final int READ_BUFFER_SIZE = 4096;
+ // IModelManager
+ private IModelManager modelManager = null;
+
+ /**
+ */
+ public URLModelProviderCSS() {
+ super();
+
+ // obtain model manager
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ modelManager = plugin.getModelManager();
+ }
+
+ /**
+ * Calculate ID from a filename. This must be same as
+ * FileModelProvider.calculateId(IFile)
+ */
+ private static String calculateId(IPath fullIPath) {
+ return fullIPath.toString();
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ */
+ private IStructuredModel getCommonModelFor(final IStructuredModel baseModel, final String ref, final int which) throws IOException {
+ // first, create absolute url
+ String absURL = resolveURI(baseModel, ref, true);
+ if ((absURL == null) || (absURL.length() == 0)) {
+ return null;
+ }
+
+ // need to remove file:// scheme if necessary
+ // see com.ibm.sed.util.ProjectResolver.getLocationByURI()
+ try {
+ final java.net.URL aURL = new java.net.URL(absURL);
+ // An actual URL was given, only file:/// is supported
+ // resolve it by finding the file it points to
+ if (!aURL.getProtocol().equals("platform")) { //$NON-NLS-1$
+ if (aURL.getProtocol().equals("file") && (aURL.getHost().equals("localhost") || aURL.getHost().length() == 0)) { //$NON-NLS-2$//$NON-NLS-1$
+ absURL = aURL.getFile();
+ final IPath ipath = new Path(absURL);
+ // if path has a device, and if it begins with
+ // IPath.SEPARATOR, remove it
+ final String device = ipath.getDevice();
+ if ((device != null) && (device.length() > 0)) {
+ if (device.charAt(0) == IPath.SEPARATOR) {
+ final String newDevice = device.substring(1);
+ absURL = ipath.setDevice(newDevice).toString();
+ }
+ }
+
+ }
+ }
+ }
+ catch (java.net.MalformedURLException mfuExc) {
+ }
+
+ // next, decide project
+ IProject project = null;
+ final IPath fullIPath = new Path(absURL);
+ IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot();
+ IContainer container = workspace.getContainerForLocation(fullIPath);
+ if (container != null) {
+ // fullIPath doesn't exist in workspace
+ project = container.getProject();
+ }
+
+ // If HTML document has a link to an extern CSS which is not in
+ // IProject
+ // workspace.getContainerForLoation() may return null. We need to take
+ // care
+ // of this case
+
+ // now, get absURL's IFile
+ if ((project != null) && (project.getLocation().isPrefixOf(fullIPath) == false)) {
+ // it's at outside of Project
+ return null;
+ }
+
+ IStructuredModel model = null;
+ if (project != null) {
+ IPath filePath = fullIPath.removeFirstSegments(project.getLocation().segmentCount());
+ IFile file = (filePath != null && !filePath.isEmpty()) ? project.getFile(filePath) : null;
+ if (file == null) {
+ return null;
+ }
+
+ // obtain model
+ if (which == GET_MODEL_FOR_EDIT) {
+ model = getModelForEdit(file);
+ }
+ else if (which == GET_MODEL_FOR_READ) {
+ model = getModelForRead(file);
+ }
+
+ // setting synchronization stamp is IModelManager's client's
+ // responsibility
+ if (model != null && model.getSynchronizationStamp() == IResource.NULL_STAMP)
+ model.resetSynchronizationStamp(file);
+ }
+ else {
+ String id = null;
+ InputStream inStream = null;
+ // obtain resolver
+ URIResolver resolver = (project != null) ? (URIResolver) project.getAdapter(URIResolver.class) : null;
+ if (resolver == null) {
+ // ProjectResolver can take care of the case if project is
+ // null.
+ resolver = new ProjectResolver(project);
+ }
+ if (resolver == null) {
+ return null;
+ }
+
+ // there is no project. we can't expect IProject help to create
+ // id/inputStream
+ java.io.File file = fullIPath.toFile();
+
+ // obatin id
+ id = calculateId(fullIPath);
+
+ // obtain InputStream
+ try {
+ inStream = new FileInputStream(file);
+ }
+ catch (FileNotFoundException fnfe) {
+ // the file does not exist, or we don't have read permission
+ return null;
+ }
+
+ // obtain model
+ try {
+ if (which == GET_MODEL_FOR_EDIT) {
+ model = getModelManager().getModelForEdit(id, inStream, resolver);
+ }
+ else if (which == GET_MODEL_FOR_READ) {
+ model = getModelManager().getModelForRead(id, inStream, resolver);
+ }
+ }
+ catch (UnsupportedEncodingException ue) {
+ }
+ catch (IOException ioe) {
+ }
+ finally {
+ // close now !
+ if (inStream != null) {
+ inStream.close();
+ }
+ }
+ }
+
+ // set locationid
+ if (model != null && model.getBaseLocation() == null) {
+ model.setBaseLocation(fullIPath.toString());
+ }
+
+ return model;
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ */
+ public IStructuredModel getModelForEdit(IStructuredModel baseModel, String ref) throws IOException {
+ return getCommonModelFor(baseModel, ref, GET_MODEL_FOR_EDIT);
+ }
+
+ /**
+ */
+ private IStructuredModel getModelForEdit(IFile file) throws IOException {
+ if (file == null)
+ return null;
+ IModelManager manager = getModelManager();
+
+ // create a fake InputStream
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForEdit(file);
+ }
+ catch (UnsupportedCharsetException ex) {
+ try {
+ model = manager.getModelForEdit(file, EncodingRule.FORCE_DEFAULT);
+ }
+ catch (IOException ioe) {
+ }
+ catch (CoreException ce) {
+ }
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ */
+ public IStructuredModel getModelForRead(IStructuredModel baseModel, String ref) throws UnsupportedEncodingException, IOException {
+ return getCommonModelFor(baseModel, ref, GET_MODEL_FOR_READ);
+ }
+
+ /**
+ */
+ private IStructuredModel getModelForRead(IFile file) throws IOException {
+ if (file == null)
+ return null;
+ IModelManager manager = getModelManager();
+
+ // create a fake InputStream
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ }
+ catch (UnsupportedCharsetException ex) {
+ try {
+ model = manager.getModelForRead(file, EncodingRule.FORCE_DEFAULT);
+ }
+ catch (IOException ioe) {
+ }
+ catch (CoreException ce) {
+ }
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ /**
+ */
+ private IModelManager getModelManager() {
+ return modelManager;
+ }
+
+ public IStructuredModel getNewModelForEdit(IFile iFile) {
+ if (iFile == null)
+ return null;
+ IModelManager manager = getModelManager();
+ if (manager == null)
+ return null;
+
+ IStructuredModel model = null;
+ try {
+ model = manager.getNewModelForEdit(iFile, false);
+ }
+ catch (IOException ex) {
+ }
+ catch (ResourceInUse riu) {
+ }
+ catch (ResourceAlreadyExists rae) {
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ public IStructuredModel getNewModelForRead(IFile iFile) {
+ if (iFile == null)
+ return null;
+ IModelManager manager = getModelManager();
+ if (manager == null)
+ return null;
+
+ IStructuredModel model = null;
+ try {
+ model = manager.getNewModelForEdit(iFile, false);
+ }
+ catch (IOException ex) {
+ }
+ catch (ResourceInUse riu) {
+ }
+ catch (ResourceAlreadyExists rae) {
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ * <code>resolveCrossProjectLinks</code>: If resolveCrossProjectLinks
+ * is set to true, then this method will properly resolve the URI if it is
+ * a valid URI pointing to another (appropriate) project.
+ */
+ public static String resolveURI(IStructuredModel baseModel, String ref, boolean resolveCrossProjectLinks) {
+ if (baseModel == null)
+ return null;
+
+ // get resolver in Model
+ final URIResolver resolver = baseModel.getResolver();
+
+ // resolve to absolute url
+ final String absurl = (resolver != null) ? resolver.getLocationByURI(ref, resolveCrossProjectLinks) : null;
+ if ((resolver != null) && (absurl == null) && (ref != null) && (ref.trim().length() > 0) && (ref.trim().charAt(0) == '/')) {
+ // to reach here means :
+ // ref is a Docroot relative
+ // resolver can't resolve ref
+ // so that href is a broken and should not create model
+ return null;
+ }
+ if ((absurl != null) && (absurl.length() > 0)) {
+ return absurl;
+ }
+
+ // maybe ref is at outside of the Project
+ // obtain docroot;
+ final IContainer container = (resolver != null) ? resolver.getRootLocation() : null;
+ String docroot = null;
+ if (container != null) {
+ docroot = container.getLocation().toString();
+ }
+ if (docroot == null) {
+ docroot = baseModel.getBaseLocation();
+ }
+ if (docroot == null) {
+ // should not be
+ return null;
+ }
+
+ // obtain document url
+ String modelBaseLocation = baseModel.getBaseLocation();
+ if ((modelBaseLocation == null) || (modelBaseLocation.length() == 0)) {
+ // fallback...
+ modelBaseLocation = baseModel.getId();
+ }
+ if ((modelBaseLocation == null) || (modelBaseLocation.length() == 0)) {
+ // i can't resolve uri !
+ return null;
+ }
+
+ // resolve url
+ URLHelper helper = new URLHelper(PathHelper.getContainingFolderPath(modelBaseLocation), PathHelper.getContainingFolderPath(PathHelper.appendTrailingURLSlash(docroot)));
+ return helper.toAbsolute(ref);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionXSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionXSubStyleAdapter.java
new file mode 100644
index 0000000000..edf94f0d4b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionXSubStyleAdapter.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.core.document.ICSSValueList;
+import org.eclipse.wst.css.core.internal.contentmodel.IValID;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.CSSValue;
+
+
+/**
+ * for horizontal value of 'background-position'
+ */
+public class BackgroundPositionXSubStyleAdapter implements ISubPropertyAdapter {
+
+ /**
+ *
+ */
+ public BackgroundPositionXSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected CSSTextToken[] correctMeaningToken(CSSTextToken[] src) {
+ java.util.ArrayList list = new java.util.ArrayList();
+ for (int i = 0; i < src.length; i++) {
+ if (src[i].kind != CSSRegionContexts.CSS_S && src[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S && src[i].kind != CSSRegionContexts.CSS_COMMENT)
+ list.add(src[i]);
+ }
+ CSSTextToken[] ret = new CSSTextToken[list.size()];
+ list.toArray(ret);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public String get(ICSS2Properties properties) {
+ String str = null;
+ Object obj = properties.get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION));
+ if (obj != null) {
+ PropCMProperty propX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X);
+ PropCMProperty propY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y);
+ if (obj instanceof ICSSValueList) {
+ ICSSValueList list = (ICSSValueList) obj;
+ ICSSValue value = (ICSSValue) list.item(0);
+ if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value;
+ if (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
+ // check not top or bottom
+ if (!propX.canHave(prim.getStringValue()) && propY.canHave(prim.getStringValue())) {
+ // case order is vertical -> horizontal
+ value = (ICSSValue) list.item(1);
+ }
+ }
+ }
+ str = value.getCSSValueText();
+ }
+ else if (obj instanceof ICSSValue) {
+ str = ((ICSSValue) obj).getCSSValueText();
+ if (str.equalsIgnoreCase(IValID.V_BOTTOM) || str.equalsIgnoreCase(IValID.V_TOP))
+ str = "";//$NON-NLS-1$
+ }
+ else {
+ str = obj.toString();
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, str);
+ CSSTextToken[] tokens = parser.getTokens();
+
+ tokens = correctMeaningToken(tokens);
+ if (tokens.length == 0)
+ str = "";//$NON-NLS-1$
+ else if (tokens.length == 1 && (tokens[0].image.equalsIgnoreCase(IValID.V_BOTTOM) || tokens[0].image.equalsIgnoreCase(IValID.V_TOP)))
+ str = "";//$NON-NLS-1$
+ else
+ str = tokens[0].image;
+ }
+ }
+ return (str != null) ? str : "";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ String newValue = null;
+ String valH = value;
+ String valV = properties.getBackgroundPositionY();
+ if (valV == null || valV.length() == 0)
+ newValue = valH;
+ else if (valH == null || valH.length() == 0) {
+ Collection valX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues();
+ Collection valY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues();
+ PropCMUtil.minus(valY, valX);
+ Iterator it = valY.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj.toString().equals(valV.toLowerCase())) {
+ // need not compensate for ...
+ newValue = valV;
+ break;
+ }
+ }
+ // compensate for Horizontal value
+ if (newValue == null) {
+ // check valV is length or not
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, valV.trim());
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens != null && tokens.length > 0 && tokens[0].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ newValue = IValID.V_LEFT + " " + valV;//$NON-NLS-1$
+ }
+ else
+ newValue = "0% " + valV;//$NON-NLS-1$
+ }
+ }
+ else
+ newValue = valH + " " + valV;//$NON-NLS-1$
+ properties.setBackgroundPosition(newValue);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionYSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionYSubStyleAdapter.java
new file mode 100644
index 0000000000..4023462f08
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundPositionYSubStyleAdapter.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.core.document.ICSSValueList;
+import org.eclipse.wst.css.core.internal.contentmodel.IValID;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.CSSValue;
+
+
+/**
+ * for vertical value of 'background-position'
+ */
+public class BackgroundPositionYSubStyleAdapter implements ISubPropertyAdapter {
+
+ /**
+ *
+ */
+ public BackgroundPositionYSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ protected CSSTextToken[] correctMeaningToken(CSSTextToken[] src) {
+ java.util.ArrayList list = new java.util.ArrayList();
+ for (int i = 0; i < src.length; i++) {
+ if (src[i].kind != CSSRegionContexts.CSS_S && src[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S && src[i].kind != CSSRegionContexts.CSS_COMMENT)
+ list.add(src[i]);
+ }
+ CSSTextToken[] ret = new CSSTextToken[list.size()];
+ list.toArray(ret);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public String get(ICSS2Properties properties) {
+ String str = null;
+ Object obj = properties.get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION));
+ if (obj != null) {
+ PropCMProperty propX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X);
+ PropCMProperty propY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y);
+ if (obj instanceof ICSSValueList) {
+ ICSSValueList list = (ICSSValueList) obj;
+ int index = 1;
+ ICSSValue value = (ICSSValue) list.item(0);
+ if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value;
+ if (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
+ // check not top or bottom
+ if (!propX.canHave(prim.getStringValue()) && propY.canHave(prim.getStringValue())) {
+ // case order is vertical -> horizontal
+ index = 0;
+ }
+ }
+ }
+ str = ((ICSSValue) list.item(index)).getCSSValueText();
+ }
+ else if (obj instanceof ICSSValue) {
+ str = ((ICSSValue) obj).getCSSValueText();
+ if (!str.equalsIgnoreCase(IValID.V_BOTTOM) && !str.equalsIgnoreCase(IValID.V_TOP))
+ str = "";//$NON-NLS-1$
+ }
+ else {
+ str = obj.toString();
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, str);
+ CSSTextToken[] tokens = parser.getTokens();
+
+ tokens = correctMeaningToken(tokens);
+ if (tokens.length == 1 && (tokens[0].image.equalsIgnoreCase(IValID.V_BOTTOM) || tokens[0].image.equalsIgnoreCase(IValID.V_TOP)))
+ str = tokens[0].image;
+ else if (tokens.length > 1)
+ str = tokens[1].image;
+ else
+ str = "";//$NON-NLS-1$
+ }
+ }
+ return (str != null) ? str : "";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ String newValue = null;
+ String valH = properties.getBackgroundPositionX();
+ String valV = value;
+ if (valH != null && (valH.trim().equals("0%") /* default value */|| //$NON-NLS-1$
+ valH.trim().equalsIgnoreCase(IValID.V_LEFT) /*
+ * another
+ * default
+ * value
+ */))
+ valH = null;
+ if (valV == null || valV.length() == 0)
+ newValue = valH;
+ else if (valH == null || valH.length() == 0) {
+ Collection valX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues();
+ Collection valY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues();
+ PropCMUtil.minus(valY, valX);
+ Iterator it = valY.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj.toString().equals(valV.toLowerCase())) {
+ // need not compensate for ...
+ newValue = valV;
+ break;
+ }
+ }
+ // compensate for Horizontal value
+ if (newValue == null) {
+ // check valV is length or not
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, valV.trim());
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens != null && tokens.length > 0 && tokens[0].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ newValue = IValID.V_LEFT + " " + valV;//$NON-NLS-1$
+ }
+ else
+ newValue = "0% " + valV;//$NON-NLS-1$
+ }
+ }
+ else
+ newValue = valH + " " + valV;//$NON-NLS-1$
+ properties.setBackgroundPosition(newValue);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundShorthandAdapter.java
new file mode 100644
index 0000000000..bc42dd28e8
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BackgroundShorthandAdapter.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'background' property 'background' will be expanded to
+ * 'background-attachment', 'background-color', 'background-image',
+ * 'background-position', 'background-repeat',
+ */
+public class BackgroundShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BackgroundShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String color = "", image = "", repeat = "", attach = "", pos = "";//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR);
+ PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE);
+ PropCMProperty propRepeat = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT);
+ PropCMProperty propAttach = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT);
+ PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ else if (propImage.canHave(tokens[i].image))
+ image = tokens[i].image;
+ else if (propRepeat.canHave(tokens[i].image))
+ repeat = tokens[i].image;
+ else if (propAttach.canHave(tokens[i].image))
+ attach = tokens[i].image;
+ else if (propPos.canHave(tokens[i].image)) {
+ if (pos == null || pos.length() <= 0)
+ pos = tokens[i].image;
+ else
+ pos = pos + " " + tokens[i].image;//$NON-NLS-1$
+ }
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) {
+ if (pos == null || pos.length() <= 0)
+ pos = tokens[i].image;
+ else
+ pos = pos + " " + tokens[i].image;//$NON-NLS-1$
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) {
+ image = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ dest.set(propColor.getName(), color);
+ dest.set(propImage.getName(), image);
+ dest.set(propRepeat.getName(), repeat);
+ dest.set(propAttach.getName(), attach);
+ dest.set(propPos.getName(), pos);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String color = null, image = null, repeat = null, attach = null, pos = null;
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR);
+ PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE);
+ PropCMProperty propRepeat = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT);
+ PropCMProperty propAttach = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT);
+ PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ else if (propImage.canHave(tokens[i].image))
+ image = tokens[i].image;
+ else if (propRepeat.canHave(tokens[i].image))
+ repeat = tokens[i].image;
+ else if (propAttach.canHave(tokens[i].image))
+ attach = tokens[i].image;
+ else if (propPos.canHave(tokens[i].image)) {
+ if (pos == null)
+ pos = tokens[i].image;
+ else
+ pos = pos + " " + tokens[i].image;//$NON-NLS-1$
+ }
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) {
+ if (pos == null)
+ pos = tokens[i].image;
+ else
+ pos = pos + " " + tokens[i].image;//$NON-NLS-1$
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) {
+ image = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ if (propColor == propDest)
+ return color;
+ else if (propImage == propDest)
+ return image;
+ else if (propRepeat == propDest)
+ return repeat;
+ else if (propAttach == propDest)
+ return attach;
+ else if (propPos == propDest)
+ return pos;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderBottomShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderBottomShorthandAdapter.java
new file mode 100644
index 0000000000..95f851c614
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderBottomShorthandAdapter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-bottom' property 'border-bottom' will be expanded to
+ * 'border-bottom-color', 'border-bottom-style', 'border-bottom-width',
+ */
+public class BorderBottomShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderBottomShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ dest.set(propColor.getName(), color);
+ dest.set(propStyle.getName(), style);
+ dest.set(propWidth.getName(), width);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String color = null, style = null, width = null;
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ if (propColor == propDest)
+ return color;
+ else if (propStyle == propDest)
+ return style;
+ else if (propWidth == propDest)
+ return width;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderColorShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderColorShorthandAdapter.java
new file mode 100644
index 0000000000..fe81a31766
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderColorShorthandAdapter.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-color' property 'border-color' will be expanded to
+ * 'border-top-color', 'border-right-color', 'border-bottom-color',
+ * 'border-left-color',
+ */
+public class BorderColorShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderColorShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH)
+ idents[j++] = tokens[i].image;
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ idents[j++] = buf.toString();
+ }
+ if (j == 4)
+ break;
+ }
+
+ String[] dests = new String[4];
+ if (j == 0)
+ return true;
+ else if (j == 1) {
+ dests[0] = dests[1] = dests[2] = dests[3] = idents[0];
+ }
+ else if (j == 2) {
+ dests[0] = dests[2] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ }
+ else if (j == 3) {
+ dests[0] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ dests[2] = idents[2];
+ }
+ else {
+ for (int k = 0; k < 4; k++)
+ dests[k] = idents[k];
+ }
+ dest.set(PropCMProperty.P_BORDER_TOP_COLOR, dests[0]);
+ dest.set(PropCMProperty.P_BORDER_RIGHT_COLOR, dests[1]);
+ dest.set(PropCMProperty.P_BORDER_BOTTOM_COLOR, dests[2]);
+ dest.set(PropCMProperty.P_BORDER_LEFT_COLOR, dests[3]);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH)
+ idents[j++] = tokens[i].image;
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ idents[j++] = buf.toString();
+ }
+ if (j == 4)
+ break;
+ }
+
+ if (j == 0)
+ return null;
+ else if (j == 1)
+ return idents[0];
+ else if (j == 2) {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_COLOR || propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_COLOR)
+ return idents[0];
+ else
+ return idents[1];
+ }
+ else if (j == 3) {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_COLOR)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_COLOR)
+ return idents[2];
+ else
+ return idents[1];
+ }
+ else {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_COLOR)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_RIGHT_COLOR)
+ return idents[1];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_COLOR)
+ return idents[2];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_LEFT_COLOR)
+ return idents[3];
+ else
+ return null;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderLeftShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderLeftShorthandAdapter.java
new file mode 100644
index 0000000000..23564e68c0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderLeftShorthandAdapter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-left' property 'border-left' will be expanded to
+ * 'border-left-color', 'border-left-style', 'border-left-width',
+ */
+public class BorderLeftShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderLeftShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ dest.set(propColor.getName(), color);
+ dest.set(propStyle.getName(), style);
+ dest.set(propWidth.getName(), width);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String color = null, style = null, width = null;
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ if (propColor == propDest)
+ return color;
+ else if (propStyle == propDest)
+ return style;
+ else if (propWidth == propDest)
+ return width;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderRightShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderRightShorthandAdapter.java
new file mode 100644
index 0000000000..a62197b4f7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderRightShorthandAdapter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-right' property 'border-right' will be expanded to
+ * 'border-right-color', 'border-right-style', 'border-right-width',
+ */
+public class BorderRightShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderRightShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ dest.set(propColor.getName(), color);
+ dest.set(propStyle.getName(), style);
+ dest.set(propWidth.getName(), width);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String color = null, style = null, width = null;
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ if (propColor == propDest)
+ return color;
+ else if (propStyle == propDest)
+ return style;
+ else if (propWidth == propDest)
+ return width;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderShorthandAdapter.java
new file mode 100644
index 0000000000..6f82189ce4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderShorthandAdapter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border' property 'border' will be expanded to 'border-color',
+ * 'border-style', 'border-width',
+ */
+public class BorderShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ dest.set(propColor.getName(), color);
+ dest.set(propStyle.getName(), style);
+ dest.set(propWidth.getName(), width);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String color = null, style = null, width = null;
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ if (propColor == propDest)
+ return color;
+ else if (propStyle == propDest)
+ return style;
+ else if (propWidth == propDest)
+ return width;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderStyleShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderStyleShorthandAdapter.java
new file mode 100644
index 0000000000..337560a1a0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderStyleShorthandAdapter.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-style' property 'border-style' will be expanded to
+ * 'border-top-style', 'border-right-style', 'border-bottom-style',
+ * 'border-left-style',
+ */
+public class BorderStyleShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderStyleShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ String[] dests = new String[4];
+ if (j == 0)
+ return true;
+ else if (j == 1) {
+ dests[0] = dests[1] = dests[2] = dests[3] = idents[0];
+ }
+ else if (j == 2) {
+ dests[0] = dests[2] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ }
+ else if (j == 3) {
+ dests[0] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ dests[2] = idents[2];
+ }
+ else {
+ for (int k = 0; k < 4; k++)
+ dests[k] = idents[k];
+ }
+ dest.set(PropCMProperty.P_BORDER_TOP_STYLE, dests[0]);
+ dest.set(PropCMProperty.P_BORDER_RIGHT_STYLE, dests[1]);
+ dest.set(PropCMProperty.P_BORDER_BOTTOM_STYLE, dests[2]);
+ dest.set(PropCMProperty.P_BORDER_LEFT_STYLE, dests[3]);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ if (j == 0)
+ return null;
+ else if (j == 1)
+ return idents[0];
+ else if (j == 2) {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_STYLE || propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_STYLE)
+ return idents[0];
+ else
+ return idents[1];
+ }
+ else if (j == 3) {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_STYLE)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_STYLE)
+ return idents[2];
+ else
+ return idents[1];
+ }
+ else {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_STYLE)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_RIGHT_STYLE)
+ return idents[1];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_STYLE)
+ return idents[2];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_LEFT_STYLE)
+ return idents[3];
+ else
+ return null;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderTopShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderTopShorthandAdapter.java
new file mode 100644
index 0000000000..c619eebba9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderTopShorthandAdapter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-top' property 'border-top' will be expanded to
+ * 'border-top-color', 'border-top-style', 'border-top-width',
+ */
+public class BorderTopShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderTopShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ dest.set(propColor.getName(), color);
+ dest.set(propStyle.getName(), style);
+ dest.set(propWidth.getName(), width);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String color = null, style = null, width = null;
+ PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE);
+ PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propWidth.canHave(tokens[i].image))
+ width = tokens[i].image;
+ else if (propColor.canHave(tokens[i].image))
+ color = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) {
+ width = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) {
+ color = tokens[i].image;
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ StringBuffer buf = new StringBuffer();
+ while (i < tokens.length) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) {
+ i++;
+ continue;
+ }
+ buf.append(tokens[i].image);
+ if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ break;
+ }
+ i--;
+ color = buf.toString();
+ }
+ }
+
+ if (propColor == propDest)
+ return color;
+ else if (propStyle == propDest)
+ return style;
+ else if (propWidth == propDest)
+ return width;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderWidthShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderWidthShorthandAdapter.java
new file mode 100644
index 0000000000..8c41ad739a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/BorderWidthShorthandAdapter.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'border-width' property 'border-width' will be expanded to
+ * 'border-top-width', 'border-right-width', 'border-bottom-width',
+ * 'border-left-width',
+ */
+public class BorderWidthShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public BorderWidthShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ String[] dests = new String[4];
+ if (j == 0)
+ return true;
+ else if (j == 1) {
+ dests[0] = dests[1] = dests[2] = dests[3] = idents[0];
+ }
+ else if (j == 2) {
+ dests[0] = dests[2] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ }
+ else if (j == 3) {
+ dests[0] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ dests[2] = idents[2];
+ }
+ else {
+ for (int k = 0; k < 4; k++)
+ dests[k] = idents[k];
+ }
+ dest.set(PropCMProperty.P_BORDER_TOP_WIDTH, dests[0]);
+ dest.set(PropCMProperty.P_BORDER_RIGHT_WIDTH, dests[1]);
+ dest.set(PropCMProperty.P_BORDER_BOTTOM_WIDTH, dests[2]);
+ dest.set(PropCMProperty.P_BORDER_LEFT_WIDTH, dests[3]);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ if (j == 0)
+ return null;
+ else if (j == 1)
+ return idents[0];
+ else if (j == 2) {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_WIDTH || propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_WIDTH)
+ return idents[0];
+ else
+ return idents[1];
+ }
+ else if (j == 3) {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_WIDTH)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_WIDTH)
+ return idents[2];
+ else
+ return idents[1];
+ }
+ else {
+ if (propDest.getName() == PropCMProperty.P_BORDER_TOP_WIDTH)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_RIGHT_WIDTH)
+ return idents[1];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_WIDTH)
+ return idents[2];
+ else if (propDest.getName() == PropCMProperty.P_BORDER_LEFT_WIDTH)
+ return idents[3];
+ else
+ return null;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/CSSPropertyContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/CSSPropertyContext.java
new file mode 100644
index 0000000000..55f20ea74a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/CSSPropertyContext.java
@@ -0,0 +1,2998 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.css.CSSValue;
+
+
+/**
+ *
+ */
+public class CSSPropertyContext implements ICSS2Properties {
+
+ protected Hashtable fProperties = new Hashtable();
+ HashSet fModified = null;
+ private static java.util.Hashtable subPropertyAdapters;
+ private static java.util.Hashtable shorthandAdapters;
+
+ /**
+ *
+ */
+ public CSSPropertyContext() {
+ super();
+ initShorthandAdapters();
+ initSubPropertyAdapters();
+ }
+
+ /**
+ *
+ */
+ public CSSPropertyContext(ICSSStyleDeclaration decl) {
+ super();
+ initShorthandAdapters();
+ initSubPropertyAdapters();
+ initialize(decl);
+ }
+
+ /**
+ * This function exports all property/value pairs to 'decl' declaration
+ */
+ public void applyFull(ICSSStyleDeclaration decl) {
+ if (decl == null)
+ return;
+ Enumeration keys = fProperties.keys();
+ while (keys.hasMoreElements()) {
+ Object key = keys.nextElement();
+ Object val = fProperties.get(key);
+ String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : val.toString();
+
+ if (value == null || value.length() <= 0)
+ decl.removeProperty(key.toString());
+ else
+ decl.setProperty(key.toString(), value.trim(), (val instanceof ValueData && ((ValueData) val).important) ? "!important" : "");//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * This function exports modified property/value pairs to 'decl'
+ * declaration
+ */
+ public void applyModified(ICSSStyleDeclaration decl) {
+ if (decl == null || fModified == null)
+ return;
+ Iterator it = fModified.iterator();
+ while (it.hasNext()) {
+ Object key = it.next();
+ Object val = fProperties.get(key);
+ String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : ((val != null) ? val.toString() : null);
+
+ if (value == null || value.length() <= 0)
+ decl.removeProperty(key.toString());
+ else
+ decl.setProperty(key.toString(), value.trim(), (val instanceof ValueData && ((ValueData) val).important) ? "!important" : "");//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+
+ /**
+ * create clone of this context
+ */
+ public Object clone() {
+ CSSPropertyContext clone = new CSSPropertyContext();
+ if (this.fModified != null)
+ clone.fModified = (HashSet) this.fModified.clone();
+ else
+ clone.fModified = null;
+ clone.fProperties = (Hashtable) this.fProperties.clone();
+ return clone;
+ }
+
+ /**
+ * This function expands a short-hand property's value to each leaf
+ * property's value and set them to 'foreign'
+ *
+ * For example, given [prop=border-top, value="solid 1px yellow"] will be
+ * expanded to [border-top-color=yellow, border-top-style=solid,
+ * border-top-width=1px] and they are stored to 'foreign' context.
+ *
+ * Note that recursively shorthanded property like 'border' will be
+ * expanded to all descendant leaf properties like
+ * 'border-[top/right/bottom/left]-[color/style/width]'
+ *
+ * @param prop
+ * org.eclipse.wst.css.core.contentmodel.PropCMProperty
+ * @param value
+ * java.lang.String
+ * @param foreign
+ * org.eclipse.wst.css.core.util.declaration.CSSPropertyContext
+ */
+ protected static void expandToLeaf(PropCMProperty prop, String value, CSSPropertyContext foreign) {
+ // expand shorthand property
+ if (value != null && value.trim().length() > 0) {
+ IShorthandAdapter adapter = (IShorthandAdapter) shorthandAdapters.get(prop);
+ if (adapter != null) {
+ adapter.expand(value, foreign);
+ foreign.set(prop.getName(), "");//$NON-NLS-1$
+ for (int i = 0; i < prop.getNumChild(); i++) {
+ Object obj = prop.getChildAt(i);
+ if (obj instanceof PropCMProperty && !(obj instanceof PropCMSubProperty)) {
+ PropCMProperty expandedProp = (PropCMProperty) obj;
+ value = foreign.get(expandedProp.getName());
+ expandToLeaf(expandedProp, value, foreign);
+ }
+ }
+ }
+ else if (!value.equals(foreign.get(prop.getName()))) {
+ foreign.set(prop.getName(), value);
+ }
+ }
+ }
+
+ /**
+ * This function returns value of 'prop'. Querying value mechanism checks
+ * short-hand properties.
+ *
+ * For example, given "background=fixed white" is set in this insatnce and
+ * param "prop=background-color", the return value will be "white".
+ *
+ */
+ public java.lang.String get(org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty prop) {
+ if (prop instanceof PropCMSubProperty) {
+ ISubPropertyAdapter adapter = (ISubPropertyAdapter) subPropertyAdapters.get(prop.getName());
+ if (adapter != null)
+ return adapter.get(this);
+ }
+ String str = get(prop.getName());
+ if ((str == null || str.length() == 0) && prop.getShorthandContainerCount() > 0) {
+ // get expanded property
+ for (int i = 0; i < prop.getShorthandContainerCount(); i++) {
+ PropCMProperty propParent = prop.shorthandContainerAt(i);
+ String strParent = get(propParent);
+ if (strParent != null && strParent.trim().length() > 0) {
+ IShorthandAdapter adapter = (IShorthandAdapter) shorthandAdapters.get(propParent);
+ if (adapter != null) {
+ String extractedValue = adapter.extract(strParent, prop);
+ return (extractedValue != null) ? extractedValue : "";//$NON-NLS-1$
+ }
+ }
+ }
+ }
+ return str;
+ }
+
+ /**
+ * This function returns value of 'prop'. Querying value mechanism does
+ * not care shorthand properties.
+ */
+ protected String get(String propName) {
+ String str = null;
+ Object obj = fProperties.get(propName);
+ if (obj != null) {
+ if (obj instanceof ICSSValue)
+ str = ((ICSSValue) obj).getCSSValueText();
+ else
+ str = obj.toString();
+ }
+ return (str != null) ? str : "";//$NON-NLS-1$
+ }
+
+ /**
+ * See the azimuth property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getAzimuth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_AZIMUTH));
+ }
+
+ /**
+ * See the background property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackground() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG));
+ }
+
+ /**
+ * See the background-attachment property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundAttachment() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT));
+ }
+
+ /**
+ * See the background-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR));
+ }
+
+ /**
+ * See the background-image property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundImage() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE));
+ }
+
+ /**
+ * See the background-position property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundPosition() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION));
+ }
+
+ /**
+ *
+ */
+ public java.lang.String getBackgroundPositionX() {
+ return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X));
+ /*
+ * String str = null; Object obj =
+ * fProperties.get(PropCMProperty.P_BG_POSITION); if (obj != null) {
+ * PropCMProperty propX =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X);
+ * PropCMProperty propY =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y);
+ * if (obj instanceof ICSSValueList) { ICSSValueList list =
+ * (ICSSValueList) obj; ICSSValue value = (ICSSValue) list.item(0); if
+ * (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ * ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value; if
+ * (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { // check
+ * not top or bottom if (!propX.canHave(prim.getStringValue()) &&
+ * propY.canHave(prim.getStringValue())) { // case order is vertical ->
+ * horizontal value = (ICSSValue) list.item(1); } } } str =
+ * value.getCSSValueText(); } else if (obj instanceof ICSSValue) { str =
+ * ((ICSSValue)obj).getCSSValueText(); } else str = obj.toString(); }
+ * return (str != null) ? str : "";
+ */
+ }
+
+ /**
+ *
+ */
+ public java.lang.String getBackgroundPositionY() {
+ return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y));
+ /*
+ * String str = null; Object obj =
+ * fProperties.get(PropCMProperty.P_BG_POSITION); if (obj != null) {
+ * PropCMProperty propX =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X);
+ * PropCMProperty propY =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y);
+ * if (obj instanceof ICSSValueList) { ICSSValueList list =
+ * (ICSSValueList) obj; int index = 1; ICSSValue value = (ICSSValue)
+ * list.item(0); if (value.getCssValueType() ==
+ * CSSValue.CSS_PRIMITIVE_VALUE) { ICSSPrimitiveValue prim =
+ * (ICSSPrimitiveValue) value; if (prim.getPrimitiveType() ==
+ * CSSPrimitiveValue.CSS_IDENT) { // check not top or bottom if
+ * (!propX.canHave(prim.getStringValue()) &&
+ * propY.canHave(prim.getStringValue())) { // case order is vertical ->
+ * horizontal index = 0; } } } str =
+ * ((ICSSValue)list.item(index)).getCSSValueText(); } else if (obj
+ * instanceof ICSSValue) { // do nothing --- value is null } else str =
+ * obj.toString(); } return (str != null) ? str : "";
+ */
+ }
+
+ /**
+ * See the background-repeat property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundRepeat() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT));
+ }
+
+ /**
+ * See the border property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorder() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER));
+ }
+
+ /**
+ * See the border-bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottom() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM));
+ }
+
+ /**
+ * See the border-bottom-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottomColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR));
+ }
+
+ /**
+ * See the border-bottom-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottomStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE));
+ }
+
+ /**
+ * See the border-bottom-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottomWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH));
+ }
+
+ /**
+ * See the border-collapse property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderCollapse() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLLAPSE));
+ }
+
+ /**
+ * See the border-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR));
+ }
+
+ /**
+ * See the border-left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeft() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT));
+ }
+
+ /**
+ * See the border-left-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeftColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR));
+ }
+
+ /**
+ * See the border-left-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeftStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE));
+ }
+
+ /**
+ * See the border-left-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeftWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH));
+ }
+
+ /**
+ * See the border-right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT));
+ }
+
+ /**
+ * See the border-right-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRightColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR));
+ }
+
+ /**
+ * See the border-right-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRightStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE));
+ }
+
+ /**
+ * See the border-right-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRightWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH));
+ }
+
+ /**
+ * See the border-spacing property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderSpacing() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_SPACING));
+ }
+
+ /**
+ * See the border-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE));
+ }
+
+ /**
+ * See the border-top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTop() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP));
+ }
+
+ /**
+ * See the border-top-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTopColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR));
+ }
+
+ /**
+ * See the border-top-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTopStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE));
+ }
+
+ /**
+ * See the border-top-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTopWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH));
+ }
+
+ /**
+ * See the border-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH));
+ }
+
+ /**
+ * See the bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBottom() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BOTTOM));
+ }
+
+ /**
+ * See the caption-side property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCaptionSide() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CAPTION_SIDE));
+ }
+
+ /**
+ * See the clear property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getClear() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CLEAR));
+ }
+
+ /**
+ * See the clip property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getClip() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP));
+ }
+
+ /**
+ *
+ */
+ public String getClipBottom() {
+ return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM));
+ }
+
+ /**
+ *
+ */
+ public String getClipLeft() {
+ return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT));
+ }
+
+ /**
+ *
+ */
+ public String getClipRight() {
+ return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT));
+ }
+
+ /**
+ *
+ */
+ public String getClipTop() {
+ return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP));
+ }
+
+ /**
+ * See the color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_COLOR));
+ }
+
+ /**
+ * See the content property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getContent() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CONTENT));
+ }
+
+ /**
+ * See the counter-increment property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCounterIncrement() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_INCREMENT));
+ }
+
+ /**
+ * See the counter-reset property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCounterReset() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_RESET));
+ }
+
+ /**
+ * See the float property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCssFloat() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FLOAT));
+ }
+
+ /**
+ * See the cue property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCue() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE));
+ }
+
+ /**
+ * See the cue-after property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCueAfter() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_AFTER));
+ }
+
+ /**
+ * See the cue-before property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCueBefore() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_BEFORE));
+ }
+
+ /**
+ * See the cursor property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCursor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CURSOR));
+ }
+
+ /**
+ * See the direction property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getDirection() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_DIRECTION));
+ }
+
+ /**
+ * See the display property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getDisplay() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_DISPLAY));
+ }
+
+ /**
+ * See the elevation property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getElevation() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_ELEVATION));
+ }
+
+ /**
+ * See the empty-cells property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getEmptyCells() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_EMPTY_CELLS));
+ }
+
+ /**
+ * See the font property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFont() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT));
+ }
+
+ /**
+ * See the font-family property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontFamily() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY));
+ }
+
+ /**
+ * See the font-size property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontSize() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE));
+ }
+
+ /**
+ * See the font-size-adjust property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontSizeAdjust() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE_ADJUST));
+ }
+
+ /**
+ * See the font-stretch property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontStretch() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STRETCH));
+ }
+
+ /**
+ * See the font-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE));
+ }
+
+ /**
+ * See the font-variant property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontVariant() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT));
+ }
+
+ /**
+ * See the font-weight property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontWeight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT));
+ }
+
+ /**
+ * See the height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getHeight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_HEIGHT));
+ }
+
+ /**
+ * See the left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getLeft() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LEFT));
+ }
+
+ /**
+ * See the letter-spacing property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getLetterSpacing() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LETTER_SPACING));
+ }
+
+ /**
+ * See the line-height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getLineHeight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT));
+ }
+
+ /**
+ * See the list-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE));
+ }
+
+ /**
+ * See the list-style-image property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStyleImage() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE));
+ }
+
+ /**
+ * See the list-style-position property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStylePosition() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION));
+ }
+
+ /**
+ * See the list-style-type property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStyleType() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE));
+ }
+
+ /**
+ * See the margin property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMargin() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN));
+ }
+
+ /**
+ * See the margin-bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginBottom() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_BOTTOM));
+ }
+
+ /**
+ * See the margin-left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginLeft() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_LEFT));
+ }
+
+ /**
+ * See the margin-right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginRight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_RIGHT));
+ }
+
+ /**
+ * See the margin-top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginTop() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_TOP));
+ }
+
+ /**
+ * See the marker-offset property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarkerOffset() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKER_OFFSET));
+ }
+
+ /**
+ * See the marks property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarks() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKS));
+ }
+
+ /**
+ * See the max-height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMaxHeight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_HEIGHT));
+ }
+
+ /**
+ * See the max-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMaxWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_WIDTH));
+ }
+
+ /**
+ * See the min-height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMinHeight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_HEIGHT));
+ }
+
+ /**
+ * See the min-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMinWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_WIDTH));
+ }
+
+ /**
+ * See the orphans property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOrphans() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_ORPHANS));
+ }
+
+ /**
+ * See the outline property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutline() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE));
+ }
+
+ /**
+ * See the outline-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutlineColor() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_COLOR));
+ }
+
+ /**
+ * See the outline-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutlineStyle() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_STYLE));
+ }
+
+ /**
+ * See the outline-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutlineWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_WIDTH));
+ }
+
+ /**
+ * See the overflow property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOverflow() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OVERFLOW));
+ }
+
+ /**
+ * See the padding property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPadding() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING));
+ }
+
+ /**
+ * See the padding-bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingBottom() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_BOTTOM));
+ }
+
+ /**
+ * See the padding-left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingLeft() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_LEFT));
+ }
+
+ /**
+ * See the padding-right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingRight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_RIGHT));
+ }
+
+ /**
+ * See the padding-top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingTop() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_TOP));
+ }
+
+ /**
+ * See the page property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPage() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE));
+ }
+
+ /**
+ * See the page-break-after property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPageBreakAfter() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_AFTER));
+ }
+
+ /**
+ * See the page-break-before property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPageBreakBefore() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_BEFORE));
+ }
+
+ /**
+ * See the page-break-inside property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPageBreakInside() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_INSIDE));
+ }
+
+ /**
+ * See the pause property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPause() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE));
+ }
+
+ /**
+ * See the pause-after property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPauseAfter() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_AFTER));
+ }
+
+ /**
+ * See the pause-before property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPauseBefore() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_BEFORE));
+ }
+
+ /**
+ * See the pitch property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPitch() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH));
+ }
+
+ /**
+ * See the pitch-range property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPitchRange() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH_RANGE));
+ }
+
+ /**
+ * See the play-during property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPlayDuring() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PLAY_DURING));
+ }
+
+ /**
+ * See the position property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPosition() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_POSITION));
+ }
+
+ /**
+ * See the quotes property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getQuotes() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_QUOTES));
+ }
+
+ /**
+ * See the richness property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getRichness() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_RICHNESS));
+ }
+
+ /**
+ * See the right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getRight() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_RIGHT));
+ }
+
+ /**
+ * @return org.eclipse.wst.css.core.util.declaration.IShorthandAdapter
+ * @param org.eclipse.wst.css.core.contentmodel.PropCMProperty
+ */
+ public static IShorthandAdapter getShorthandAdapter(PropCMProperty prop) {
+ return (IShorthandAdapter) shorthandAdapters.get(prop);
+ }
+
+ /**
+ * See the size property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSize() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SIZE));
+ }
+
+ /**
+ * See the speak property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeak() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK));
+ }
+
+ /**
+ * See the speak-header property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeakHeader() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_HEADER));
+ }
+
+ /**
+ * See the speak-numeral property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeakNumeral() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_NUMERAL));
+ }
+
+ /**
+ * See the speak-punctuation property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeakPunctuation() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_PUNCTUATION));
+ }
+
+ /**
+ * See the speech-rate property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeechRate() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEECH_RATE));
+ }
+
+ /**
+ * See the stress property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getStress() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_STRESS));
+ }
+
+ /**
+ * See the table-layout property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTableLayout() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TABLE_LAYOUT));
+ }
+
+ /**
+ * See the text-align property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextAlign() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_ALIGN));
+ }
+
+ /**
+ * See the text-decoration property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextDecoration() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_DECORATION));
+ }
+
+ /**
+ * See the text-indent property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextIndent() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_INDENT));
+ }
+
+ /**
+ * See the text-shadow property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextShadow() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_SHADOW));
+ }
+
+ /**
+ * See the text-transform property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextTransform() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_TRANSFORM));
+ }
+
+ /**
+ * See the top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTop() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TOP));
+ }
+
+ /**
+ * See the unicode-bidi property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getUnicodeBidi() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_UNICODE_BIDI));
+ }
+
+ /**
+ * See the vertical-align property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVerticalAlign() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VERTICAL_ALIGN));
+ }
+
+ /**
+ * See the visibility property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVisibility() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VISIBILITY));
+ }
+
+ /**
+ * See the voice-family property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVoiceFamily() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VOICE_FAMILY));
+ }
+
+ /**
+ * See the volume property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVolume() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VOLUME));
+ }
+
+ /**
+ * See the white-space property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWhiteSpace() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WHITE_SPACE));
+ }
+
+ /**
+ * See the widows property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWidows() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDOWS));
+ }
+
+ /**
+ * See the width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWidth() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDTH));
+ }
+
+ /**
+ * See the word-spacing property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWordSpacing() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WORD_SPACING));
+ }
+
+ /**
+ * See the z-index property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getZIndex() {
+ return get(PropCMProperty.getInstanceOf(PropCMProperty.P_Z_INDEX));
+ }
+
+ /**
+ *
+ */
+ public void initialize(ICSSStyleDeclaration decl) {
+ fProperties.clear();
+ if (fModified != null)
+ fModified.clear();
+ if (decl == null)
+ return;
+
+ int nProperties = decl.getLength();
+ for (int i = 0; i < nProperties; i++) {
+ String propName = decl.item(i);
+ if (propName != null) {
+ String propN = propName.trim().toLowerCase();
+ if (propN.length() != 0) {
+ CSSValue val = decl.getPropertyCSSValue(propName);
+ if (val != null)
+ fProperties.put(propN, val);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ static void initShorthandAdapters() {
+ if (shorthandAdapters == null) {
+ shorthandAdapters = new Hashtable();
+ // register
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BG), new BackgroundShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER), new BorderShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR), new BorderColorShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE), new BorderStyleShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH), new BorderWidthShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP), new BorderTopShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT), new BorderRightShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM), new BorderBottomShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT), new BorderLeftShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT), new FontShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE), new ListStyleShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN), new MarginShorthandAdapter());
+ shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING), new PaddingShorthandAdapter());
+
+ }
+ }
+
+ /**
+ *
+ */
+ static void initSubPropertyAdapters() {
+ if (subPropertyAdapters == null) {
+ subPropertyAdapters = new Hashtable();
+
+ // register
+ subPropertyAdapters.put(PropCMSubProperty.PSUB_BG_POSITION_X, new BackgroundPositionXSubStyleAdapter());
+ subPropertyAdapters.put(PropCMSubProperty.PSUB_BG_POSITION_Y, new BackgroundPositionYSubStyleAdapter());
+ subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_TOP, new ClipTopSubStyleAdapter());
+ subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_RIGHT, new ClipRightSubStyleAdapter());
+ subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_BOTTOM, new ClipBottomSubStyleAdapter());
+ subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_LEFT, new ClipLeftSubStyleAdapter());
+ }
+ }
+
+ /**
+ *
+ */
+ public boolean isModified() {
+ return (fModified != null && fModified.size() != 0);
+ }
+
+ /**
+ *
+ */
+ public Enumeration properties() {
+ return fProperties.keys();
+ }
+
+ /**
+ *
+ */
+ public Iterator propertiesModified() {
+ if (fModified != null) {
+ return ((Collection) fModified.clone()).iterator();
+ }
+ else
+ return new Iterator() {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ };
+ }
+
+ /**
+ * This function expands the value of shorthand 'prop' to 'foreign'
+ * context. Note that if this has parent shorthand properties of 'prop',
+ * they are all expanded to 'foreign' context.
+ */
+ protected void recursiveExtract(PropCMProperty prop, CSSPropertyContext foreign) {
+ // expand shorthand property
+ for (int i = 0; i < prop.getShorthandContainerCount(); i++) {
+ recursiveExtract(prop.shorthandContainerAt(i), foreign);
+ }
+ String str = get(prop.getName());
+ if (str == null || str.trim().length() == 0)
+ str = foreign.get(prop.getName());
+ if (str != null && str.trim().length() > 0) {
+ IShorthandAdapter adapter = (IShorthandAdapter) shorthandAdapters.get(prop);
+ if (adapter != null) {
+ adapter.expand(str, foreign);
+ foreign.set(prop.getName(), "");//$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ protected void removeDescendants(PropCMProperty prop) {
+ if (prop.isShorthand()) {
+ // remove properties
+ int n = prop.getNumChild();
+ for (int i = 0; i < n; i++) {
+ Object obj = prop.getChildAt(i);
+ if (obj instanceof PropCMProperty) {
+ removeDescendants((PropCMProperty) obj);
+
+ String str = get(obj.toString());
+ if (str != null && str.length() > 0)
+ set(obj.toString(), "");//$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void resetModified() {
+ if (fModified != null)
+ fModified.clear();
+ }
+
+ /**
+ * This function sets the pair of 'prop'/'value'. If shorthand properties
+ * related to 'prop' are already defined, they will be expanded to avoid
+ * property confliction. If descendant properties of 'prop' are already
+ * defined, they will be removed to avoid property confliction.
+ *
+ */
+ public void set(org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty prop, java.lang.String value) throws org.w3c.dom.DOMException {
+ if (prop instanceof PropCMSubProperty) {
+ ISubPropertyAdapter adapter = (ISubPropertyAdapter) subPropertyAdapters.get(prop.getName());
+ if (adapter != null) {
+ adapter.set(this, value);
+ return;
+ }
+ }
+ if (prop.getShorthandContainerCount() > 0) {
+ // expand shorthand property
+ CSSPropertyContext context = new CSSPropertyContext();
+ for (int i = 0; i < prop.getShorthandContainerCount(); i++) {
+ recursiveExtract(prop.shorthandContainerAt(i), context);
+ }
+ Enumeration properties = context.properties();
+ while (properties.hasMoreElements()) {
+ String propForeign = properties.nextElement().toString();
+ set(propForeign, context.get(propForeign));
+ }
+ }
+
+ removeDescendants(prop);
+
+ set(prop.getName(), value);
+ }
+
+ /**
+ * This function sets the pair of 'propName'/'value' regardless of its
+ * shorthand properties.
+ */
+ protected void set(String propName, String value) throws org.w3c.dom.DOMException {
+ String key = propName;
+ if (value == null)
+ fProperties.remove(key);
+ else
+ fProperties.put(key, value);
+ if (fModified == null)
+ fModified = new HashSet();
+ fModified.add(key);
+ }
+
+ /**
+ *
+ */
+ public void setAzimuth(String azimuth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_AZIMUTH), azimuth);
+ }
+
+ /**
+ *
+ */
+ public void setBackground(String background) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG), background);
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundAttachment(String backgroundAttachment) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT), backgroundAttachment);
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundColor(String backgroundColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR), backgroundColor);
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundImage(String backgroundImage) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE), backgroundImage);
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundPosition(String backgroundPosition) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION), backgroundPosition);
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundPositionX(java.lang.String backgroundPositionX) throws org.w3c.dom.DOMException {
+ set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X), backgroundPositionX);
+ /*
+ * String newValue = null; String valH = backgroundPositionX; String
+ * valV = getBackgroundPositionY(); if (valV == null ||
+ * valV.length()== 0) newValue = valH; else if (valH == null ||
+ * valH.length() == 0) { Collection valX =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues();
+ * Collection valY =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues();
+ * PropCMUtil.minus(valY,valX); Iterator it = valY.iterator();
+ * while(it.hasNext()) { Object obj = it.next(); if
+ * (obj.toString().equals(valV.toLowerCase())) { // need not
+ * compensate for ... newValue = valV; break; } } // compensate for
+ * Horizontal value if (newValue == null) newValue = "0% " + valV; }
+ * else newValue = valH + " " + valV; setBackgroundPosition(newValue);
+ */
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundPositionY(java.lang.String backgroundPositionY) throws org.w3c.dom.DOMException {
+ set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y), backgroundPositionY);
+ /*
+ * String newValue = null; String valH = getBackgroundPositionX();
+ * String valV = backgroundPositionY; if (valV == null ||
+ * valV.length()== 0) newValue = valH; else if (valH == null ||
+ * valH.length() == 0) { Collection valX =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues();
+ * Collection valY =
+ * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues();
+ * PropCMUtil.minus(valY,valX); Iterator it = valY.iterator();
+ * while(it.hasNext()) { Object obj = it.next(); if
+ * (obj.toString().equals(valV.toLowerCase())) { // need not
+ * compensate for ... newValue = valV; break; } } // compensate for
+ * Horizontal value if (newValue == null) newValue = "0% " + valV; }
+ * else newValue = valH + " " + valV; setBackgroundPosition(newValue);
+ */
+ }
+
+ /**
+ *
+ */
+ public void setBackgroundRepeat(String backgroundRepeat) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT), backgroundRepeat);
+ }
+
+ /**
+ *
+ */
+ public void setBorder(String border) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER), border);
+ }
+
+ /**
+ *
+ */
+ public void setBorderBottom(String borderBottom) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM), borderBottom);
+ }
+
+ /**
+ *
+ */
+ public void setBorderBottomColor(String borderBottomColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR), borderBottomColor);
+ }
+
+ /**
+ *
+ */
+ public void setBorderBottomStyle(String borderBottomStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE), borderBottomStyle);
+ }
+
+ /**
+ *
+ */
+ public void setBorderBottomWidth(String borderBottomWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH), borderBottomWidth);
+ }
+
+ /**
+ *
+ */
+ public void setBorderCollapse(String borderCollapse) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLLAPSE), borderCollapse);
+ }
+
+ /**
+ *
+ */
+ public void setBorderColor(String borderColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR), borderColor);
+ }
+
+ /**
+ *
+ */
+ public void setBorderLeft(String borderLeft) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT), borderLeft);
+ }
+
+ /**
+ *
+ */
+ public void setBorderLeftColor(String borderLeftColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR), borderLeftColor);
+ }
+
+ /**
+ *
+ */
+ public void setBorderLeftStyle(String borderLeftStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE), borderLeftStyle);
+ }
+
+ /**
+ *
+ */
+ public void setBorderLeftWidth(String borderLeftWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH), borderLeftWidth);
+ }
+
+ /**
+ *
+ */
+ public void setBorderRight(String borderRight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT), borderRight);
+ }
+
+ /**
+ *
+ */
+ public void setBorderRightColor(String borderRightColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR), borderRightColor);
+ }
+
+ /**
+ *
+ */
+ public void setBorderRightStyle(String borderRightStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE), borderRightStyle);
+ }
+
+ /**
+ *
+ */
+ public void setBorderRightWidth(String borderRightWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH), borderRightWidth);
+ }
+
+ /**
+ *
+ */
+ public void setBorderSpacing(String borderSpacing) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_SPACING), borderSpacing);
+ }
+
+ /**
+ *
+ */
+ public void setBorderStyle(String borderStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE), borderStyle);
+ }
+
+ /**
+ *
+ */
+ public void setBorderTop(String borderTop) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP), borderTop);
+ }
+
+ /**
+ *
+ */
+ public void setBorderTopColor(String borderTopColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR), borderTopColor);
+ }
+
+ /**
+ *
+ */
+ public void setBorderTopStyle(String borderTopStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE), borderTopStyle);
+ }
+
+ /**
+ *
+ */
+ public void setBorderTopWidth(String borderTopWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH), borderTopWidth);
+ }
+
+ /**
+ *
+ */
+ public void setBorderWidth(String borderWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH), borderWidth);
+ }
+
+ /**
+ *
+ */
+ public void setBottom(String bottom) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_BOTTOM), bottom);
+ }
+
+ /**
+ *
+ */
+ public void setCaptionSide(String captionSide) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CAPTION_SIDE), captionSide);
+ }
+
+ /**
+ *
+ */
+ public void setClear(String clear) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLEAR), clear);
+ }
+
+ /**
+ *
+ */
+ public void setClip(String clip) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP), clip);
+ }
+
+ /**
+ *
+ */
+ public void setClipBottom(java.lang.String clip) throws org.w3c.dom.DOMException {
+ set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM), clip);
+ }
+
+ /**
+ *
+ */
+ public void setClipLeft(java.lang.String clip) throws org.w3c.dom.DOMException {
+ set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT), clip);
+ }
+
+ /**
+ *
+ */
+ public void setClipRight(java.lang.String clip) throws org.w3c.dom.DOMException {
+ set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT), clip);
+ }
+
+ /**
+ *
+ */
+ public void setClipTop(java.lang.String clip) throws org.w3c.dom.DOMException {
+ set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP), clip);
+ }
+
+ /**
+ *
+ */
+ public void setColor(String color) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_COLOR), color);
+ }
+
+ /**
+ *
+ */
+ public void setContent(String content) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CONTENT), content);
+ }
+
+ /**
+ *
+ */
+ public void setCounterIncrement(String counterIncrement) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_INCREMENT), counterIncrement);
+ }
+
+ /**
+ *
+ */
+ public void setCounterReset(String counterReset) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_RESET), counterReset);
+ }
+
+ /**
+ *
+ */
+ public void setCssFloat(String cssFloat) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FLOAT), cssFloat);
+ }
+
+ /**
+ *
+ */
+ public void setCue(String cue) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE), cue);
+ }
+
+ /**
+ *
+ */
+ public void setCueAfter(String cueAfter) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_AFTER), cueAfter);
+ }
+
+ /**
+ *
+ */
+ public void setCueBefore(String cueBefore) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_BEFORE), cueBefore);
+ }
+
+ /**
+ *
+ */
+ public void setCursor(String cursor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_CURSOR), cursor);
+ }
+
+ /**
+ *
+ */
+ public void setDirection(String direction) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_DIRECTION), direction);
+ }
+
+ /**
+ *
+ */
+ public void setDisplay(String display) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_DISPLAY), display);
+ }
+
+ /**
+ *
+ */
+ public void setElevation(String elevation) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_ELEVATION), elevation);
+ }
+
+ /**
+ *
+ */
+ public void setEmptyCells(String emptyCells) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_EMPTY_CELLS), emptyCells);
+ }
+
+ /**
+ *
+ */
+ public void setFont(String font) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT), font);
+ }
+
+ /**
+ *
+ */
+ public void setFontFamily(String fontFamily) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY), fontFamily);
+ }
+
+ /**
+ *
+ */
+ public void setFontSize(String fontSize) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE), fontSize);
+ }
+
+ /**
+ *
+ */
+ public void setFontSizeAdjust(String fontSizeAdjust) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE_ADJUST), fontSizeAdjust);
+ }
+
+ /**
+ *
+ */
+ public void setFontStretch(String fontStretch) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STRETCH), fontStretch);
+ }
+
+ /**
+ *
+ */
+ public void setFontStyle(String fontStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE), fontStyle);
+ }
+
+ /**
+ *
+ */
+ public void setFontVariant(String fontVariant) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT), fontVariant);
+ }
+
+ /**
+ *
+ */
+ public void setFontWeight(String fontWeight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT), fontWeight);
+ }
+
+ /**
+ *
+ */
+ public void setHeight(String height) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_HEIGHT), height);
+ }
+
+ /**
+ *
+ */
+ public void setLeft(String left) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LEFT), left);
+ }
+
+ /**
+ *
+ */
+ public void setLetterSpacing(String letterSpacing) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LETTER_SPACING), letterSpacing);
+ }
+
+ /**
+ *
+ */
+ public void setLineHeight(String lineHeight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT), lineHeight);
+ }
+
+ /**
+ *
+ */
+ public void setListStyle(String listStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE), listStyle);
+ }
+
+ /**
+ *
+ */
+ public void setListStyleImage(String listStyleImage) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE), listStyleImage);
+ }
+
+ /**
+ *
+ */
+ public void setListStylePosition(String listStylePosition) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION), listStylePosition);
+ }
+
+ /**
+ *
+ */
+ public void setListStyleType(String listStyleType) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE), listStyleType);
+ }
+
+ /**
+ *
+ */
+ public void setMargin(String margin) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN), margin);
+ }
+
+ /**
+ *
+ */
+ public void setMarginBottom(String marginBottom) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_BOTTOM), marginBottom);
+ }
+
+ /**
+ *
+ */
+ public void setMarginLeft(String marginLeft) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_LEFT), marginLeft);
+ }
+
+ /**
+ *
+ */
+ public void setMarginRight(String marginRight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_RIGHT), marginRight);
+ }
+
+ /**
+ *
+ */
+ public void setMarginTop(String marginTop) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_TOP), marginTop);
+ }
+
+ /**
+ *
+ */
+ public void setMarkerOffset(String markerOffset) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKER_OFFSET), markerOffset);
+ }
+
+ /**
+ *
+ */
+ public void setMarks(String marks) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKS), marks);
+ }
+
+ /**
+ *
+ */
+ public void setMaxHeight(String maxHeight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_HEIGHT), maxHeight);
+ }
+
+ /**
+ *
+ */
+ public void setMaxWidth(String maxWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_WIDTH), maxWidth);
+ }
+
+ /**
+ *
+ */
+ public void setMinHeight(String minHeight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_HEIGHT), minHeight);
+ }
+
+ /**
+ *
+ */
+ public void setMinWidth(String minWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_WIDTH), minWidth);
+ }
+
+ /**
+ *
+ */
+ public void setOrphans(String orphans) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_ORPHANS), orphans);
+ }
+
+ /**
+ *
+ */
+ public void setOutline(String outline) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE), outline);
+ }
+
+ /**
+ *
+ */
+ public void setOutlineColor(String outlineColor) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_COLOR), outlineColor);
+ }
+
+ /**
+ *
+ */
+ public void setOutlineStyle(String outlineStyle) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_STYLE), outlineStyle);
+ }
+
+ /**
+ *
+ */
+ public void setOutlineWidth(String outlineWidth) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_WIDTH), outlineWidth);
+ }
+
+ /**
+ *
+ */
+ public void setOverflow(String overflow) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_OVERFLOW), overflow);
+ }
+
+ /**
+ *
+ */
+ public void setPadding(String padding) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING), padding);
+ }
+
+ /**
+ *
+ */
+ public void setPaddingBottom(String paddingBottom) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_BOTTOM), paddingBottom);
+ }
+
+ /**
+ *
+ */
+ public void setPaddingLeft(String paddingLeft) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_LEFT), paddingLeft);
+ }
+
+ /**
+ *
+ */
+ public void setPaddingRight(String paddingRight) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_RIGHT), paddingRight);
+ }
+
+ /**
+ *
+ */
+ public void setPaddingTop(String paddingTop) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_TOP), paddingTop);
+ }
+
+ /**
+ *
+ */
+ public void setPage(String page) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE), page);
+ }
+
+ /**
+ *
+ */
+ public void setPageBreakAfter(String pageBreakAfter) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_AFTER), pageBreakAfter);
+ }
+
+ /**
+ *
+ */
+ public void setPageBreakBefore(String pageBreakBefore) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_BEFORE), pageBreakBefore);
+ }
+
+ /**
+ *
+ */
+ public void setPageBreakInside(String pageBreakInside) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_INSIDE), pageBreakInside);
+ }
+
+ /**
+ *
+ */
+ public void setPause(String pause) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE), pause);
+ }
+
+ /**
+ *
+ */
+ public void setPauseAfter(String pauseAfter) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_AFTER), pauseAfter);
+ }
+
+ /**
+ *
+ */
+ public void setPauseBefore(String pauseBefore) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_BEFORE), pauseBefore);
+ }
+
+ /**
+ *
+ */
+ public void setPitch(String pitch) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH), pitch);
+ }
+
+ /**
+ *
+ */
+ public void setPitchRange(String pitchRange) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH_RANGE), pitchRange);
+ }
+
+ /**
+ *
+ */
+ public void setPlayDuring(String playDuring) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_PLAY_DURING), playDuring);
+ }
+
+ /**
+ *
+ */
+ public void setPosition(String position) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_POSITION), position);
+ }
+
+ /**
+ *
+ */
+ public void setQuotes(String quotes) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_QUOTES), quotes);
+ }
+
+ /**
+ *
+ */
+ public void setRichness(String richness) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_RICHNESS), richness);
+ }
+
+ /**
+ *
+ */
+ public void setRight(String right) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_RIGHT), right);
+ }
+
+ /**
+ *
+ */
+ public void setSize(String size) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_SIZE), size);
+ }
+
+ /**
+ *
+ */
+ public void setSpeak(String speak) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK), speak);
+ }
+
+ /**
+ *
+ */
+ public void setSpeakHeader(String speakHeader) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_HEADER), speakHeader);
+ }
+
+ /**
+ *
+ */
+ public void setSpeakNumeral(String speakNumeral) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_NUMERAL), speakNumeral);
+ }
+
+ /**
+ *
+ */
+ public void setSpeakPunctuation(String speakPunctuation) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_PUNCTUATION), speakPunctuation);
+ }
+
+ /**
+ *
+ */
+ public void setSpeechRate(String speechRate) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEECH_RATE), speechRate);
+ }
+
+ /**
+ *
+ */
+ public void setStress(String stress) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_STRESS), stress);
+ }
+
+ /**
+ *
+ */
+ public void setTableLayout(String tableLayout) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TABLE_LAYOUT), tableLayout);
+ }
+
+ /**
+ *
+ */
+ public void setTextAlign(String textAlign) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_ALIGN), textAlign);
+ }
+
+ /**
+ *
+ */
+ public void setTextDecoration(String textDecoration) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_DECORATION), textDecoration);
+ }
+
+ /**
+ *
+ */
+ public void setTextIndent(String textIndent) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_INDENT), textIndent);
+ }
+
+ /**
+ *
+ */
+ public void setTextShadow(String textShadow) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_SHADOW), textShadow);
+ }
+
+ /**
+ *
+ */
+ public void setTextTransform(String textTransform) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_TRANSFORM), textTransform);
+ }
+
+ /**
+ *
+ */
+ public void setTop(String top) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_TOP), top);
+ }
+
+ /**
+ *
+ */
+ public void setUnicodeBidi(String unicodeBidi) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_UNICODE_BIDI), unicodeBidi);
+ }
+
+ /**
+ *
+ */
+ public void setVerticalAlign(String verticalAlign) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_VERTICAL_ALIGN), verticalAlign);
+ }
+
+ /**
+ *
+ */
+ public void setVisibility(String visibility) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_VISIBILITY), visibility);
+ }
+
+ /**
+ *
+ */
+ public void setVoiceFamily(String voiceFamily) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_VOICE_FAMILY), voiceFamily);
+ }
+
+ /**
+ *
+ */
+ public void setVolume(String volume) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_VOLUME), volume);
+ }
+
+ /**
+ *
+ */
+ public void setWhiteSpace(String whiteSpace) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_WHITE_SPACE), whiteSpace);
+ }
+
+ /**
+ *
+ */
+ public void setWidows(String widows) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDOWS), widows);
+ }
+
+ /**
+ *
+ */
+ public void setWidth(String width) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDTH), width);
+ }
+
+ /**
+ *
+ */
+ public void setWordSpacing(String wordSpacing) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_WORD_SPACING), wordSpacing);
+ }
+
+ /**
+ *
+ */
+ public void setZIndex(String zIndex) throws org.w3c.dom.DOMException {
+ set(PropCMProperty.getInstanceOf(PropCMProperty.P_Z_INDEX), zIndex);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipBottomSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipBottomSubStyleAdapter.java
new file mode 100644
index 0000000000..dc3dfcc901
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipBottomSubStyleAdapter.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+
+/**
+ * For bottom value of 'clip' property's rect() function
+ */
+public class ClipBottomSubStyleAdapter extends ClipSubStyleAdapter {
+
+ /**
+ *
+ */
+ public ClipBottomSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ String get(org.w3c.dom.css.Rect rect) {
+ return rect.getBottom().getCssText();
+ }
+
+ /**
+ *
+ */
+ int index() {
+ return 2;
+ }
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ String top = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP));
+ String right = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT));
+ String left = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT));
+
+ set(properties, top, right, value, left, value == null || value.length() == 0);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipLeftSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipLeftSubStyleAdapter.java
new file mode 100644
index 0000000000..cf2110dfde
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipLeftSubStyleAdapter.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+
+/**
+ * For left value of 'clip' property's rect() function
+ */
+public class ClipLeftSubStyleAdapter extends ClipSubStyleAdapter {
+
+ /**
+ *
+ */
+ public ClipLeftSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ String get(org.w3c.dom.css.Rect rect) {
+ return rect.getLeft().getCssText();
+ }
+
+ /**
+ *
+ */
+ int index() {
+ return 3;
+ }
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ String top = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP));
+ String right = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT));
+ String bottom = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM));
+
+ set(properties, top, right, bottom, value, value == null || value.length() == 0);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipRightSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipRightSubStyleAdapter.java
new file mode 100644
index 0000000000..bd796745c9
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipRightSubStyleAdapter.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+
+/**
+ * For right value of 'clip' property's rect() function
+ */
+public class ClipRightSubStyleAdapter extends ClipSubStyleAdapter {
+
+ /**
+ *
+ */
+ public ClipRightSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ String get(org.w3c.dom.css.Rect rect) {
+ return rect.getRight().getCssText();
+ }
+
+ /**
+ *
+ */
+ int index() {
+ return 1;
+ }
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ String top = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP));
+ String bottom = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM));
+ String left = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT));
+
+ set(properties, top, value, bottom, left, value == null || value.length() == 0);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipSubStyleAdapter.java
new file mode 100644
index 0000000000..dc7792f3ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipSubStyleAdapter.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.core.internal.contentmodel.IValID;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.w3c.dom.css.Rect;
+
+
+/**
+ * Abstract class for clip sub-properties
+ */
+abstract public class ClipSubStyleAdapter implements ISubPropertyAdapter {
+
+ /**
+ *
+ */
+ public ClipSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public String get(ICSS2Properties properties) {
+ String str = null;
+ Object obj = properties.get(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP));
+ if (obj != null) {
+ if (obj instanceof org.w3c.dom.css.Rect) {
+ str = get((org.w3c.dom.css.Rect) obj);
+ }
+ else {
+ if (obj instanceof ICSSValue) {
+ str = ((ICSSValue) obj).getCSSValueText();
+ }
+ else {
+ str = obj.toString();
+ }
+ str = str.trim().toLowerCase();
+ int pos = str.indexOf("rect(");//$NON-NLS-1$
+ if (pos >= 0) {
+ String subStr = null;
+ pos += 5;
+ int i = 0;
+ do {
+ int posEnd = str.indexOf(",", pos);//$NON-NLS-1$
+ if (posEnd < 0)
+ posEnd = str.indexOf(")", pos);//$NON-NLS-1$
+ if (posEnd < 0 && pos < str.length())
+ posEnd = str.length();
+ if (posEnd >= pos) {
+ subStr = str.substring(pos, posEnd);
+ pos = posEnd + 1;
+ }
+ else
+ pos = -1;
+ }
+ while (i++ < index() && pos > 0);
+
+ if (pos > 0)
+ str = subStr.trim();
+ else
+ str = null;
+ }
+ else
+ str = null;
+ }
+ }
+ return (str != null) ? str : "";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ abstract String get(Rect rect);
+
+ /**
+ *
+ */
+ abstract int index();
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/10/04
+ * 19:25:46)
+ *
+ * @param properties
+ * org.eclipse.wst.css.core.util.declaration.ICSS2Properties
+ * @param top
+ * java.lang.String
+ * @param right
+ * java.lang.String
+ * @param bottom
+ * java.lang.String
+ * @param left
+ * java.lang.String
+ * @param removeCheck
+ * boolean
+ */
+ void set(ICSS2Properties properties, String top, String right, String bottom, String left, boolean removeCheck) {
+ if (top == null || top.length() == 0)
+ top = IValID.V_AUTO;
+ if (right == null || right.length() == 0)
+ right = IValID.V_AUTO;
+ if (bottom == null || bottom.length() == 0)
+ bottom = IValID.V_AUTO;
+ if (left == null || left.length() == 0)
+ left = IValID.V_AUTO;
+
+ if (removeCheck && top.trim().equalsIgnoreCase(IValID.V_AUTO) && right.trim().equalsIgnoreCase(IValID.V_AUTO) && bottom.trim().equalsIgnoreCase(IValID.V_AUTO) && left.trim().equalsIgnoreCase(IValID.V_AUTO)) {
+ properties.set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP), null);
+ }
+ else
+ properties.set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP), "rect(" + top + ", " + right + ", " + bottom + ", " + left + ")");//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipTopSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipTopSubStyleAdapter.java
new file mode 100644
index 0000000000..1786db845f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ClipTopSubStyleAdapter.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty;
+
+/**
+ * For top value of 'clip' property's rect() function
+ */
+public class ClipTopSubStyleAdapter extends ClipSubStyleAdapter {
+
+ /**
+ *
+ */
+ public ClipTopSubStyleAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ String get(org.w3c.dom.css.Rect rect) {
+ return rect.getTop().getCssText();
+ }
+
+ /**
+ *
+ */
+ int index() {
+ return 0;
+ }
+
+ /**
+ *
+ */
+ public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException {
+ String right = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT));
+ String bottom = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM));
+ String left = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT));
+
+ set(properties, value, right, bottom, left, value == null || value.length() == 0);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/FontShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/FontShorthandAdapter.java
new file mode 100644
index 0000000000..dbfbebd9db
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/FontShorthandAdapter.java
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.IValID;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'font' property 'font' will be expanded to 'font-family', 'font-size',
+ * 'font-style', 'font-variant', 'font-weight', 'line-height',
+ */
+public class FontShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public FontShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String style = null, variant = null, weight = null, size = null, height = null, family = null;
+ PropCMProperty propFont = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE);
+ PropCMProperty propVariant = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT);
+ PropCMProperty propWeight = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT);
+ PropCMProperty propSize = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE);
+ boolean bNormalSpecified = false;
+
+ int i = 0;
+ for (; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ // first of all, check font idents
+ if (i == 0) {
+ for (int j = 0; j < propFont.getNumChild(); j++) {
+ Object obj = propFont.getChildAt(i);
+ if (obj instanceof String && tokens[i].image.compareToIgnoreCase(obj.toString()) == 0)
+ return false;
+ }
+ }
+ // value "normal" is shared !!
+ if (tokens[i].image.equalsIgnoreCase(IValID.V_NORMAL)) {
+ bNormalSpecified = true;
+ }
+ else {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propVariant.canHave(tokens[i].image))
+ variant = tokens[i].image;
+ else if (propWeight.canHave(tokens[i].image))
+ weight = tokens[i].image;
+ else if (propSize.canHave(tokens[i].image)) {
+ size = tokens[i].image;
+ break; // if size found, break loop
+ }
+ }
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER && weight == null && propWeight.canHave(tokens[i].image)) {
+ weight = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) {
+ size = tokens[i].image;
+ break; // if size found, break loop
+ }
+ }
+
+ if (bNormalSpecified) {
+ if (style == null)
+ style = IValID.V_NORMAL;
+ if (variant == null)
+ variant = IValID.V_NORMAL;
+ if (weight == null)
+ weight = IValID.V_NORMAL;
+ }
+
+ // skip whitespace
+ for (i++; i < tokens.length; i++) {
+ if (tokens[i].kind != CSSRegionContexts.CSS_S || tokens[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S)
+ break;
+ }
+
+ // line-height ?
+ if (i < tokens.length && tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && tokens[i].image.equals("/")) { //$NON-NLS-1$
+ for (i++; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ height = tokens[i++].image;
+ break;
+ }
+ }
+ }
+
+ // font-family
+ StringBuffer buf = new StringBuffer();
+ for (; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT)
+ buf.append(" ");//$NON-NLS-1$
+ else
+ buf.append(tokens[i].image);
+ }
+ family = buf.toString().trim();
+
+ dest.set(PropCMProperty.P_FONT_STYLE, style);
+ dest.set(PropCMProperty.P_FONT_VARIANT, variant);
+ dest.set(PropCMProperty.P_FONT_WEIGHT, weight);
+ dest.set(PropCMProperty.P_FONT_SIZE, size);
+ dest.set(PropCMProperty.P_LINE_HEIGHT, height);
+ dest.set(PropCMProperty.P_FONT_FAMILY, family);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String style = null, variant = null, weight = null, size = null, height = null, family = null;
+ PropCMProperty propFont = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT);
+ PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE);
+ PropCMProperty propVariant = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT);
+ PropCMProperty propWeight = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT);
+ PropCMProperty propSize = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE);
+ PropCMProperty propHeight = PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT);
+ PropCMProperty propFamily = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY);
+ boolean bNormalSpecified = false;
+
+ int i = 0;
+ for (; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ // first of all, check font idents
+ if (i == 0) {
+ for (int j = 0; j < propFont.getNumChild(); j++) {
+ Object obj = propFont.getChildAt(i);
+ if (obj instanceof String && tokens[i].image.compareToIgnoreCase(obj.toString()) == 0)
+ return null;
+ }
+ }
+ // value "normal" is shared !!
+ if (tokens[i].image.equalsIgnoreCase(IValID.V_NORMAL)) {
+ bNormalSpecified = true;
+ }
+ else {
+ if (propStyle.canHave(tokens[i].image))
+ style = tokens[i].image;
+ else if (propVariant.canHave(tokens[i].image))
+ variant = tokens[i].image;
+ else if (propWeight.canHave(tokens[i].image))
+ weight = tokens[i].image;
+ else if (propSize.canHave(tokens[i].image)) {
+ size = tokens[i].image;
+ break; // if size found, break loop
+ }
+ }
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER && weight == null && propWeight.canHave(tokens[i].image)) {
+ weight = tokens[i].image;
+ }
+ else if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) {
+ size = tokens[i].image;
+ break; // if size found, break loop
+ }
+ }
+
+ if (bNormalSpecified) {
+ if (style == null)
+ style = IValID.V_NORMAL;
+ if (variant == null)
+ variant = IValID.V_NORMAL;
+ if (weight == null)
+ weight = IValID.V_NORMAL;
+ }
+
+ // skip whitespace
+ for (i++; i < tokens.length; i++) {
+ if (tokens[i].kind != CSSRegionContexts.CSS_S || tokens[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S)
+ break;
+ }
+
+ // line-height ?
+ if (i < tokens.length && tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && tokens[i].image.equals("/")) { //$NON-NLS-1$
+ for (i++; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ height = tokens[i++].image;
+ break;
+ }
+ }
+ }
+
+ // font-family
+ StringBuffer buf = new StringBuffer();
+ for (; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT)
+ buf.append(" ");//$NON-NLS-1$
+ else
+ buf.append(tokens[i].image);
+ }
+ family = buf.toString().trim();
+
+ if (propStyle == propDest)
+ return style;
+ else if (propVariant == propDest)
+ return variant;
+ else if (propWeight == propDest)
+ return weight;
+ else if (propSize == propDest)
+ return size;
+ else if (propHeight == propDest)
+ return height;
+ else if (propFamily == propDest)
+ return family;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ICSS2Properties.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ICSS2Properties.java
new file mode 100644
index 0000000000..743b1c13a5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ICSS2Properties.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.w3c.dom.css.CSS2Properties;
+
+
+/**
+ *
+ */
+public interface ICSS2Properties extends CSS2Properties {
+
+ /**
+ *
+ */
+ void applyFull(ICSSStyleDeclaration decl);
+
+ /**
+ *
+ */
+ void applyModified(ICSSStyleDeclaration decl);
+
+ /**
+ *
+ */
+ String get(PropCMProperty prop);
+
+ /**
+ *
+ */
+ String getBackgroundPositionX();
+
+ /**
+ *
+ */
+ String getBackgroundPositionY();
+
+ /**
+ *
+ */
+ String getClipBottom();
+
+ /**
+ *
+ */
+ String getClipLeft();
+
+ /**
+ *
+ */
+ String getClipRight();
+
+ /**
+ *
+ */
+ String getClipTop();
+
+ /**
+ *
+ */
+ boolean isModified();
+
+ /**
+ *
+ */
+ Enumeration properties();
+
+ /**
+ *
+ */
+ Iterator propertiesModified();
+
+ /**
+ *
+ */
+ void resetModified();
+
+ /**
+ *
+ */
+ void set(PropCMProperty prop, String value) throws org.w3c.dom.DOMException;
+
+ /**
+ *
+ */
+ void setBackgroundPositionX(String backgroundPosition) throws org.w3c.dom.DOMException;
+
+ /**
+ *
+ */
+ void setBackgroundPositionY(String backgroundPosition) throws org.w3c.dom.DOMException;
+
+ /**
+ *
+ */
+ void setClipBottom(String backgroundPosition) throws org.w3c.dom.DOMException;
+
+ /**
+ *
+ */
+ void setClipLeft(String backgroundPosition) throws org.w3c.dom.DOMException;
+
+ /**
+ *
+ */
+ void setClipRight(String backgroundPosition) throws org.w3c.dom.DOMException;
+
+ /**
+ *
+ */
+ void setClipTop(String backgroundPosition) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/IShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/IShorthandAdapter.java
new file mode 100644
index 0000000000..1a03f2aad1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/IShorthandAdapter.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+
+/**
+ *
+ */
+public interface IShorthandAdapter {
+
+ /**
+ *
+ */
+ boolean expand(String source, CSSPropertyContext dest);
+
+ /**
+ *
+ */
+ String extract(String source, PropCMProperty propDest);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ISubPropertyAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ISubPropertyAdapter.java
new file mode 100644
index 0000000000..90e19ce5f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ISubPropertyAdapter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+/**
+ *
+ */
+public interface ISubPropertyAdapter {
+
+ /**
+ *
+ */
+ String get(ICSS2Properties properties);
+
+ /**
+ *
+ */
+ void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ListStyleShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ListStyleShorthandAdapter.java
new file mode 100644
index 0000000000..dbf2018722
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ListStyleShorthandAdapter.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'list-style' property 'list-style' will be expanded to
+ * 'list-style-image', 'list-style-position', 'list-style-type',
+ */
+public class ListStyleShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public ListStyleShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String image = "", pos = "", type = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION);
+ PropCMProperty propType = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE);
+ PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propPos.canHave(tokens[i].image))
+ pos = tokens[i].image;
+ else { // value="none" is shared !!
+ if (propType.canHave(tokens[i].image))
+ type = tokens[i].image;
+ if (propImage.canHave(tokens[i].image))
+ image = tokens[i].image;
+ }
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) {
+ image = tokens[i].image;
+ }
+ }
+
+ dest.set(propPos.getName(), pos);
+ dest.set(propType.getName(), type);
+ dest.set(propImage.getName(), image);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String image = null, pos = null, type = null;
+ PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION);
+ PropCMProperty propType = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE);
+ PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE);
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) {
+ if (propPos.canHave(tokens[i].image))
+ pos = tokens[i].image;
+ else { // value="none" is shared !!
+ if (propType.canHave(tokens[i].image))
+ type = tokens[i].image;
+ if (propImage.canHave(tokens[i].image))
+ image = tokens[i].image;
+ }
+ }
+ else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) {
+ image = tokens[i].image;
+ }
+ }
+
+ if (propPos == propDest)
+ return pos;
+ else if (propType == propDest)
+ return type;
+ else if (propImage == propDest)
+ return image;
+ else
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/MarginShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/MarginShorthandAdapter.java
new file mode 100644
index 0000000000..287abb50b7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/MarginShorthandAdapter.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'margin' property 'margin' will be expanded to 'margin-top',
+ * 'margin-right', 'margin-bottom', 'margin-left',
+ */
+public class MarginShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public MarginShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ String[] dests = new String[4];
+ if (j == 0)
+ return true;
+ else if (j == 1) {
+ dests[0] = dests[1] = dests[2] = dests[3] = idents[0];
+ }
+ else if (j == 2) {
+ dests[0] = dests[2] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ }
+ else if (j == 3) {
+ dests[0] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ dests[2] = idents[2];
+ }
+ else {
+ for (int k = 0; k < 4; k++)
+ dests[k] = idents[k];
+ }
+ dest.set(PropCMProperty.P_MARGIN_TOP, dests[0]);
+ dest.set(PropCMProperty.P_MARGIN_RIGHT, dests[1]);
+ dest.set(PropCMProperty.P_MARGIN_BOTTOM, dests[2]);
+ dest.set(PropCMProperty.P_MARGIN_LEFT, dests[3]);
+
+ return true;
+
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ if (j == 0)
+ return null;
+ else if (j == 1)
+ return idents[0];
+ else if (j == 2) {
+ if (propDest.getName() == PropCMProperty.P_MARGIN_TOP || propDest.getName() == PropCMProperty.P_MARGIN_BOTTOM)
+ return idents[0];
+ else
+ return idents[1];
+ }
+ else if (j == 3) {
+ if (propDest.getName() == PropCMProperty.P_MARGIN_TOP)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_MARGIN_BOTTOM)
+ return idents[2];
+ else
+ return idents[1];
+ }
+ else {
+ if (propDest.getName() == PropCMProperty.P_MARGIN_TOP)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_MARGIN_RIGHT)
+ return idents[1];
+ else if (propDest.getName() == PropCMProperty.P_MARGIN_BOTTOM)
+ return idents[2];
+ else if (propDest.getName() == PropCMProperty.P_MARGIN_LEFT)
+ return idents[3];
+ else
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/PaddingShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/PaddingShorthandAdapter.java
new file mode 100644
index 0000000000..7e0dd4d184
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/PaddingShorthandAdapter.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+
+
+/**
+ * For 'padding' property 'padding' will be expanded to 'padding-top',
+ * 'padding-right', 'padding-bottom', 'padding-left',
+ */
+public class PaddingShorthandAdapter implements IShorthandAdapter {
+
+ /**
+ *
+ */
+ public PaddingShorthandAdapter() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean expand(String source, CSSPropertyContext dest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return false;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ String[] dests = new String[4];
+ if (j == 0)
+ return true;
+ else if (j == 1) {
+ dests[0] = dests[1] = dests[2] = dests[3] = idents[0];
+ }
+ else if (j == 2) {
+ dests[0] = dests[2] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ }
+ else if (j == 3) {
+ dests[0] = idents[0];
+ dests[1] = dests[3] = idents[1];
+ dests[2] = idents[2];
+ }
+ else {
+ for (int k = 0; k < 4; k++)
+ dests[k] = idents[k];
+ }
+ dest.set(PropCMProperty.P_PADDING_TOP, dests[0]);
+ dest.set(PropCMProperty.P_PADDING_RIGHT, dests[1]);
+ dest.set(PropCMProperty.P_PADDING_BOTTOM, dests[2]);
+ dest.set(PropCMProperty.P_PADDING_LEFT, dests[3]);
+
+ return true;
+ }
+
+ /**
+ *
+ */
+ public String extract(String source, PropCMProperty propDest) {
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source);
+ CSSTextToken[] tokens = parser.getTokens();
+ if (tokens.length <= 0) {
+ return null;
+ }
+ String[] idents = new String[4];
+ int j = 0;
+ for (int i = 0; i < tokens.length; i++) {
+ if (org.eclipse.wst.css.core.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE)
+ idents[j++] = tokens[i].image;
+ if (j == 4)
+ break;
+ }
+
+ if (j == 0)
+ return null;
+ else if (j == 1)
+ return idents[0];
+ else if (j == 2) {
+ if (propDest.getName() == PropCMProperty.P_PADDING_TOP || propDest.getName() == PropCMProperty.P_PADDING_BOTTOM)
+ return idents[0];
+ else
+ return idents[1];
+ }
+ else if (j == 3) {
+ if (propDest.getName() == PropCMProperty.P_PADDING_TOP)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_PADDING_BOTTOM)
+ return idents[2];
+ else
+ return idents[1];
+ }
+ else {
+ if (propDest.getName() == PropCMProperty.P_PADDING_TOP)
+ return idents[0];
+ else if (propDest.getName() == PropCMProperty.P_PADDING_RIGHT)
+ return idents[1];
+ else if (propDest.getName() == PropCMProperty.P_PADDING_BOTTOM)
+ return idents[2];
+ else if (propDest.getName() == PropCMProperty.P_PADDING_LEFT)
+ return idents[3];
+ else
+ return null;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ValueData.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ValueData.java
new file mode 100644
index 0000000000..05a2079ff0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/util/declaration/ValueData.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.core.util.declaration;
+
+
+
+/**
+ *
+ */
+public class ValueData {
+
+ public String value;
+ public boolean important = false;
+
+ /**
+ *
+ */
+ public ValueData() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public ValueData(String val, boolean imp) {
+ super();
+ value = val;
+ important = imp;
+ }
+
+ /**
+ *
+ */
+ public String toString() {
+ return value;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSS2Properties.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSS2Properties.java
new file mode 100644
index 0000000000..821e2a91ac
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSS2Properties.java
@@ -0,0 +1,1666 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSS2Properties</code> interface represents a convenience
+ * mechanism for retrieving and setting properties within a
+ * <code>CSSStyleDeclaration</code>. The attributes of this interface
+ * correspond to all the properties specified in CSS2. Getting an attribute of
+ * this interface is equivalent to calling the <code>getPropertyValue</code>
+ * method of the <code>CSSStyleDeclaration</code> interface. Setting an
+ * attribute of this interface is equivalent to calling the
+ * <code>setProperty</code> method of the <code>CSSStyleDeclaration</code>
+ * interface.
+ * <p>
+ * A conformant implementation of the CSS module is not required to implement
+ * the <code>CSS2Properties</code> interface. If an implementation does
+ * implement this interface, the expectation is that language-specific methods
+ * can be used to cast from an instance of the
+ * <code>CSSStyleDeclaration</code> interface to the
+ * <code>CSS2Properties</code> interface.
+ * <p>
+ * If an implementation does implement this interface, it is expected to
+ * understand the specific syntax of the shorthand properties, and apply their
+ * semantics; when the <code>margin</code> property is set, for example, the
+ * <code>marginTop</code>,<code>marginRight</code>,
+ * <code>marginBottom</code> and <code>marginLeft</code> properties are
+ * actually being set by the underlying implementation.
+ * <p>
+ * When dealing with CSS "shorthand" properties, the shorthand properties
+ * should be decomposed into their component longhand properties as
+ * appropriate, and when querying for their value, the form returned should be
+ * the shortest form exactly equivalent to the declarations made in the
+ * ruleset. However, if there is no shorthand declaration that could be added
+ * to the ruleset without changing in any way the rules already declared in
+ * the ruleset (i.e., by adding longhand rules that were previously not
+ * declared in the ruleset), then the empty string should be returned for the
+ * shorthand property.
+ * <p>
+ * For example, querying for the <code>font</code> property should not
+ * return "normal normal normal 14pt/normal Arial, sans-serif", when "14pt
+ * Arial, sans-serif" suffices. (The normals are initial values, and are
+ * implied by use of the longhand property.)
+ * <p>
+ * If the values for all the longhand properties that compose a particular
+ * string are the initial values, then a string consisting of all the initial
+ * values should be returned (e.g. a <code>border-width</code> value of
+ * "medium" should be returned as such, not as "").
+ * <p>
+ * For some shorthand properties that take missing values from other sides,
+ * such as the <code>margin</code>,<code>padding</code>, and
+ * <code>border-[width|style|color]</code> properties, the minimum number of
+ * sides possible should be used; i.e., "0px 10px" will be returned instead of
+ * "0px 10px 0px 10px".
+ * <p>
+ * If the value of a shorthand property can not be decomposed into its
+ * component longhand properties, as is the case for the <code>font</code>
+ * property with a value of "menu", querying for the values of the component
+ * longhand properties should return the empty string.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSS2Properties {
+ /**
+ * See the azimuth property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getAzimuth();
+
+ public void setAzimuth(String azimuth) throws DOMException;
+
+ /**
+ * See the background property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackground();
+
+ public void setBackground(String background) throws DOMException;
+
+ /**
+ * See the background-attachment property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundAttachment();
+
+ public void setBackgroundAttachment(String backgroundAttachment) throws DOMException;
+
+ /**
+ * See the background-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundColor();
+
+ public void setBackgroundColor(String backgroundColor) throws DOMException;
+
+ /**
+ * See the background-image property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundImage();
+
+ public void setBackgroundImage(String backgroundImage) throws DOMException;
+
+ /**
+ * See the background-position property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundPosition();
+
+ public void setBackgroundPosition(String backgroundPosition) throws DOMException;
+
+ /**
+ * See the background-repeat property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBackgroundRepeat();
+
+ public void setBackgroundRepeat(String backgroundRepeat) throws DOMException;
+
+ /**
+ * See the border property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorder();
+
+ public void setBorder(String border) throws DOMException;
+
+ /**
+ * See the border-collapse property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderCollapse();
+
+ public void setBorderCollapse(String borderCollapse) throws DOMException;
+
+ /**
+ * See the border-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderColor();
+
+ public void setBorderColor(String borderColor) throws DOMException;
+
+ /**
+ * See the border-spacing property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderSpacing();
+
+ public void setBorderSpacing(String borderSpacing) throws DOMException;
+
+ /**
+ * See the border-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderStyle();
+
+ public void setBorderStyle(String borderStyle) throws DOMException;
+
+ /**
+ * See the border-top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTop();
+
+ public void setBorderTop(String borderTop) throws DOMException;
+
+ /**
+ * See the border-right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRight();
+
+ public void setBorderRight(String borderRight) throws DOMException;
+
+ /**
+ * See the border-bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottom();
+
+ public void setBorderBottom(String borderBottom) throws DOMException;
+
+ /**
+ * See the border-left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeft();
+
+ public void setBorderLeft(String borderLeft) throws DOMException;
+
+ /**
+ * See the border-top-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTopColor();
+
+ public void setBorderTopColor(String borderTopColor) throws DOMException;
+
+ /**
+ * See the border-right-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRightColor();
+
+ public void setBorderRightColor(String borderRightColor) throws DOMException;
+
+ /**
+ * See the border-bottom-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottomColor();
+
+ public void setBorderBottomColor(String borderBottomColor) throws DOMException;
+
+ /**
+ * See the border-left-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeftColor();
+
+ public void setBorderLeftColor(String borderLeftColor) throws DOMException;
+
+ /**
+ * See the border-top-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTopStyle();
+
+ public void setBorderTopStyle(String borderTopStyle) throws DOMException;
+
+ /**
+ * See the border-right-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRightStyle();
+
+ public void setBorderRightStyle(String borderRightStyle) throws DOMException;
+
+ /**
+ * See the border-bottom-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottomStyle();
+
+ public void setBorderBottomStyle(String borderBottomStyle) throws DOMException;
+
+ /**
+ * See the border-left-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeftStyle();
+
+ public void setBorderLeftStyle(String borderLeftStyle) throws DOMException;
+
+ /**
+ * See the border-top-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderTopWidth();
+
+ public void setBorderTopWidth(String borderTopWidth) throws DOMException;
+
+ /**
+ * See the border-right-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderRightWidth();
+
+ public void setBorderRightWidth(String borderRightWidth) throws DOMException;
+
+ /**
+ * See the border-bottom-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderBottomWidth();
+
+ public void setBorderBottomWidth(String borderBottomWidth) throws DOMException;
+
+ /**
+ * See the border-left-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderLeftWidth();
+
+ public void setBorderLeftWidth(String borderLeftWidth) throws DOMException;
+
+ /**
+ * See the border-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBorderWidth();
+
+ public void setBorderWidth(String borderWidth) throws DOMException;
+
+ /**
+ * See the bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getBottom();
+
+ public void setBottom(String bottom) throws DOMException;
+
+ /**
+ * See the caption-side property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCaptionSide();
+
+ public void setCaptionSide(String captionSide) throws DOMException;
+
+ /**
+ * See the clear property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getClear();
+
+ public void setClear(String clear) throws DOMException;
+
+ /**
+ * See the clip property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getClip();
+
+ public void setClip(String clip) throws DOMException;
+
+ /**
+ * See the color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getColor();
+
+ public void setColor(String color) throws DOMException;
+
+ /**
+ * See the content property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getContent();
+
+ public void setContent(String content) throws DOMException;
+
+ /**
+ * See the counter-increment property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCounterIncrement();
+
+ public void setCounterIncrement(String counterIncrement) throws DOMException;
+
+ /**
+ * See the counter-reset property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCounterReset();
+
+ public void setCounterReset(String counterReset) throws DOMException;
+
+ /**
+ * See the cue property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCue();
+
+ public void setCue(String cue) throws DOMException;
+
+ /**
+ * See the cue-after property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCueAfter();
+
+ public void setCueAfter(String cueAfter) throws DOMException;
+
+ /**
+ * See the cue-before property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCueBefore();
+
+ public void setCueBefore(String cueBefore) throws DOMException;
+
+ /**
+ * See the cursor property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCursor();
+
+ public void setCursor(String cursor) throws DOMException;
+
+ /**
+ * See the direction property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getDirection();
+
+ public void setDirection(String direction) throws DOMException;
+
+ /**
+ * See the display property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getDisplay();
+
+ public void setDisplay(String display) throws DOMException;
+
+ /**
+ * See the elevation property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getElevation();
+
+ public void setElevation(String elevation) throws DOMException;
+
+ /**
+ * See the empty-cells property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getEmptyCells();
+
+ public void setEmptyCells(String emptyCells) throws DOMException;
+
+ /**
+ * See the float property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getCssFloat();
+
+ public void setCssFloat(String cssFloat) throws DOMException;
+
+ /**
+ * See the font property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFont();
+
+ public void setFont(String font) throws DOMException;
+
+ /**
+ * See the font-family property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontFamily();
+
+ public void setFontFamily(String fontFamily) throws DOMException;
+
+ /**
+ * See the font-size property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontSize();
+
+ public void setFontSize(String fontSize) throws DOMException;
+
+ /**
+ * See the font-size-adjust property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontSizeAdjust();
+
+ public void setFontSizeAdjust(String fontSizeAdjust) throws DOMException;
+
+ /**
+ * See the font-stretch property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontStretch();
+
+ public void setFontStretch(String fontStretch) throws DOMException;
+
+ /**
+ * See the font-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontStyle();
+
+ public void setFontStyle(String fontStyle) throws DOMException;
+
+ /**
+ * See the font-variant property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontVariant();
+
+ public void setFontVariant(String fontVariant) throws DOMException;
+
+ /**
+ * See the font-weight property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getFontWeight();
+
+ public void setFontWeight(String fontWeight) throws DOMException;
+
+ /**
+ * See the height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getHeight();
+
+ public void setHeight(String height) throws DOMException;
+
+ /**
+ * See the left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getLeft();
+
+ public void setLeft(String left) throws DOMException;
+
+ /**
+ * See the letter-spacing property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getLetterSpacing();
+
+ public void setLetterSpacing(String letterSpacing) throws DOMException;
+
+ /**
+ * See the line-height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getLineHeight();
+
+ public void setLineHeight(String lineHeight) throws DOMException;
+
+ /**
+ * See the list-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStyle();
+
+ public void setListStyle(String listStyle) throws DOMException;
+
+ /**
+ * See the list-style-image property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStyleImage();
+
+ public void setListStyleImage(String listStyleImage) throws DOMException;
+
+ /**
+ * See the list-style-position property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStylePosition();
+
+ public void setListStylePosition(String listStylePosition) throws DOMException;
+
+ /**
+ * See the list-style-type property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getListStyleType();
+
+ public void setListStyleType(String listStyleType) throws DOMException;
+
+ /**
+ * See the margin property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMargin();
+
+ public void setMargin(String margin) throws DOMException;
+
+ /**
+ * See the margin-top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginTop();
+
+ public void setMarginTop(String marginTop) throws DOMException;
+
+ /**
+ * See the margin-right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginRight();
+
+ public void setMarginRight(String marginRight) throws DOMException;
+
+ /**
+ * See the margin-bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginBottom();
+
+ public void setMarginBottom(String marginBottom) throws DOMException;
+
+ /**
+ * See the margin-left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarginLeft();
+
+ public void setMarginLeft(String marginLeft) throws DOMException;
+
+ /**
+ * See the marker-offset property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarkerOffset();
+
+ public void setMarkerOffset(String markerOffset) throws DOMException;
+
+ /**
+ * See the marks property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMarks();
+
+ public void setMarks(String marks) throws DOMException;
+
+ /**
+ * See the max-height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMaxHeight();
+
+ public void setMaxHeight(String maxHeight) throws DOMException;
+
+ /**
+ * See the max-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMaxWidth();
+
+ public void setMaxWidth(String maxWidth) throws DOMException;
+
+ /**
+ * See the min-height property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMinHeight();
+
+ public void setMinHeight(String minHeight) throws DOMException;
+
+ /**
+ * See the min-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getMinWidth();
+
+ public void setMinWidth(String minWidth) throws DOMException;
+
+ /**
+ * See the orphans property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOrphans();
+
+ public void setOrphans(String orphans) throws DOMException;
+
+ /**
+ * See the outline property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutline();
+
+ public void setOutline(String outline) throws DOMException;
+
+ /**
+ * See the outline-color property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutlineColor();
+
+ public void setOutlineColor(String outlineColor) throws DOMException;
+
+ /**
+ * See the outline-style property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutlineStyle();
+
+ public void setOutlineStyle(String outlineStyle) throws DOMException;
+
+ /**
+ * See the outline-width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOutlineWidth();
+
+ public void setOutlineWidth(String outlineWidth) throws DOMException;
+
+ /**
+ * See the overflow property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getOverflow();
+
+ public void setOverflow(String overflow) throws DOMException;
+
+ /**
+ * See the padding property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPadding();
+
+ public void setPadding(String padding) throws DOMException;
+
+ /**
+ * See the padding-top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingTop();
+
+ public void setPaddingTop(String paddingTop) throws DOMException;
+
+ /**
+ * See the padding-right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingRight();
+
+ public void setPaddingRight(String paddingRight) throws DOMException;
+
+ /**
+ * See the padding-bottom property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingBottom();
+
+ public void setPaddingBottom(String paddingBottom) throws DOMException;
+
+ /**
+ * See the padding-left property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPaddingLeft();
+
+ public void setPaddingLeft(String paddingLeft) throws DOMException;
+
+ /**
+ * See the page property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPage();
+
+ public void setPage(String page) throws DOMException;
+
+ /**
+ * See the page-break-after property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPageBreakAfter();
+
+ public void setPageBreakAfter(String pageBreakAfter) throws DOMException;
+
+ /**
+ * See the page-break-before property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPageBreakBefore();
+
+ public void setPageBreakBefore(String pageBreakBefore) throws DOMException;
+
+ /**
+ * See the page-break-inside property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPageBreakInside();
+
+ public void setPageBreakInside(String pageBreakInside) throws DOMException;
+
+ /**
+ * See the pause property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPause();
+
+ public void setPause(String pause) throws DOMException;
+
+ /**
+ * See the pause-after property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPauseAfter();
+
+ public void setPauseAfter(String pauseAfter) throws DOMException;
+
+ /**
+ * See the pause-before property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPauseBefore();
+
+ public void setPauseBefore(String pauseBefore) throws DOMException;
+
+ /**
+ * See the pitch property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPitch();
+
+ public void setPitch(String pitch) throws DOMException;
+
+ /**
+ * See the pitch-range property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPitchRange();
+
+ public void setPitchRange(String pitchRange) throws DOMException;
+
+ /**
+ * See the play-during property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPlayDuring();
+
+ public void setPlayDuring(String playDuring) throws DOMException;
+
+ /**
+ * See the position property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getPosition();
+
+ public void setPosition(String position) throws DOMException;
+
+ /**
+ * See the quotes property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getQuotes();
+
+ public void setQuotes(String quotes) throws DOMException;
+
+ /**
+ * See the richness property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getRichness();
+
+ public void setRichness(String richness) throws DOMException;
+
+ /**
+ * See the right property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getRight();
+
+ public void setRight(String right) throws DOMException;
+
+ /**
+ * See the size property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSize();
+
+ public void setSize(String size) throws DOMException;
+
+ /**
+ * See the speak property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeak();
+
+ public void setSpeak(String speak) throws DOMException;
+
+ /**
+ * See the speak-header property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeakHeader();
+
+ public void setSpeakHeader(String speakHeader) throws DOMException;
+
+ /**
+ * See the speak-numeral property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeakNumeral();
+
+ public void setSpeakNumeral(String speakNumeral) throws DOMException;
+
+ /**
+ * See the speak-punctuation property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeakPunctuation();
+
+ public void setSpeakPunctuation(String speakPunctuation) throws DOMException;
+
+ /**
+ * See the speech-rate property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getSpeechRate();
+
+ public void setSpeechRate(String speechRate) throws DOMException;
+
+ /**
+ * See the stress property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getStress();
+
+ public void setStress(String stress) throws DOMException;
+
+ /**
+ * See the table-layout property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTableLayout();
+
+ public void setTableLayout(String tableLayout) throws DOMException;
+
+ /**
+ * See the text-align property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextAlign();
+
+ public void setTextAlign(String textAlign) throws DOMException;
+
+ /**
+ * See the text-decoration property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextDecoration();
+
+ public void setTextDecoration(String textDecoration) throws DOMException;
+
+ /**
+ * See the text-indent property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextIndent();
+
+ public void setTextIndent(String textIndent) throws DOMException;
+
+ /**
+ * See the text-shadow property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextShadow();
+
+ public void setTextShadow(String textShadow) throws DOMException;
+
+ /**
+ * See the text-transform property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTextTransform();
+
+ public void setTextTransform(String textTransform) throws DOMException;
+
+ /**
+ * See the top property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getTop();
+
+ public void setTop(String top) throws DOMException;
+
+ /**
+ * See the unicode-bidi property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getUnicodeBidi();
+
+ public void setUnicodeBidi(String unicodeBidi) throws DOMException;
+
+ /**
+ * See the vertical-align property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVerticalAlign();
+
+ public void setVerticalAlign(String verticalAlign) throws DOMException;
+
+ /**
+ * See the visibility property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVisibility();
+
+ public void setVisibility(String visibility) throws DOMException;
+
+ /**
+ * See the voice-family property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVoiceFamily();
+
+ public void setVoiceFamily(String voiceFamily) throws DOMException;
+
+ /**
+ * See the volume property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getVolume();
+
+ public void setVolume(String volume) throws DOMException;
+
+ /**
+ * See the white-space property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWhiteSpace();
+
+ public void setWhiteSpace(String whiteSpace) throws DOMException;
+
+ /**
+ * See the widows property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWidows();
+
+ public void setWidows(String widows) throws DOMException;
+
+ /**
+ * See the width property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWidth();
+
+ public void setWidth(String width) throws DOMException;
+
+ /**
+ * See the word-spacing property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getWordSpacing();
+
+ public void setWordSpacing(String wordSpacing) throws DOMException;
+
+ /**
+ * See the z-index property definition in CSS2.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the new value has a syntax error
+ * and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public String getZIndex();
+
+ public void setZIndex(String zIndex) throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSCharsetRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSCharsetRule.java
new file mode 100644
index 0000000000..cc44b3040f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSCharsetRule.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSCharsetRule</code> interface represents a
+ *
+ * @charset rule in a CSS style sheet. The value of the <code>encoding</code>
+ * attribute does not affect the encoding of text data in the DOM
+ * objects; this encoding is always UTF-16. After a stylesheet is
+ * loaded, the value of the <code>encoding</code> attribute is the
+ * value found in the <code>@charset</code> rule. If there was no <code>@charset</code> in the original document, then no
+ * <code>CSSCharsetRule</code> is created. The value of the
+ * <code>encoding</code> attribute may also be used as a hint for
+ * the encoding used on serialization of the style sheet.
+ * <p>
+ * The value of the
+ * @charset rule (and therefore of the <code>CSSCharsetRule</code>) may not
+ * correspond to the encoding the document actually came in;
+ * character encoding information e.g. in an HTTP header, has
+ * priority (see CSS document representation) but this is not
+ * reflected in the <code>CSSCharsetRule</code>.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ * @since DOM Level 2
+ */
+public interface CSSCharsetRule extends CSSRule {
+ /**
+ * The encoding information used in this <code>@charset</code> rule.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified encoding value has a
+ * syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding
+ * rule is readonly.
+ */
+ public String getEncoding();
+
+ public void setEncoding(String encoding) throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSFontFaceRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSFontFaceRule.java
new file mode 100644
index 0000000000..48aff6e4ee
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSFontFaceRule.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>CSSFontFaceRule</code> interface represents a
+ *
+ * @font-face rule in a CSS style sheet. The <code>@font-face</code> rule is used to hold a set of font descriptions.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ * @since DOM Level 2
+ */
+public interface CSSFontFaceRule extends CSSRule {
+ /**
+ * The declaration-block of this rule.
+ */
+ public CSSStyleDeclaration getStyle();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSImportRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSImportRule.java
new file mode 100644
index 0000000000..9708d084ee
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSImportRule.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.stylesheets.MediaList;
+
+/**
+ * The <code>CSSImportRule</code> interface represents a
+ *
+ * @import rule within a CSS style sheet. The <code>@import</code> rule is used to import style rules from other style sheets.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ * @since DOM Level 2
+ */
+public interface CSSImportRule extends CSSRule {
+ /**
+ * The location of the style sheet to be imported. The attribute will not
+ * contain the <code>"url(...)"</code> specifier around the URI.
+ */
+ public String getHref();
+
+ /**
+ * A list of media types for which this style sheet may be used.
+ */
+ public MediaList getMedia();
+
+ /**
+ * The style sheet referred to by this rule, if it has been loaded. The
+ * value of this attribute is <code>null</code> if the style sheet has
+ * not yet been loaded or if it will not be loaded (e.g. if the style
+ * sheet is for a media type not supported by the user agent).
+ */
+ public CSSStyleSheet getStyleSheet();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSMediaRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSMediaRule.java
new file mode 100644
index 0000000000..ce1c5aa1e7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSMediaRule.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.stylesheets.MediaList;
+
+/**
+ * The <code>CSSMediaRule</code> interface represents a
+ *
+ * @media rule in a CSS style sheet. A <code>@media</code> rule can be used to delimit style rules for specific media
+ * types.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ * @since DOM Level 2
+ */
+public interface CSSMediaRule extends CSSRule {
+ /**
+ * A list of media types for this rule.
+ */
+ public MediaList getMedia();
+
+ /**
+ * A list of all CSS rules contained within the media block.
+ */
+ public CSSRuleList getCssRules();
+
+ /**
+ * Used to insert a new rule into the media block.
+ *
+ * @param rule
+ * The parsable text representing the rule. For rule sets this
+ * contains both the selector and the style declaration. For
+ * at-rules, this specifies both the at-identifier and the rule
+ * content.
+ * @param index
+ * The index within the media block's rule collection of the
+ * rule before which to insert the specified rule. If the
+ * specified index is equal to the length of the media blocks's
+ * rule collection, the rule will be added to the end of the
+ * media block.
+ * @return The index within the media block's rule collection of the newly
+ * inserted rule.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be
+ * inserted at the specified index, e.g., if an
+ * <code>@import</code> rule is inserted after a standard rule set or other
+ * at-rule. <br>
+ * INDEX_SIZE_ERR: Raised if the specified index is not a valid
+ * insertion point. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
+ * readonly. <br>
+ * SYNTAX_ERR: Raised if the specified rule has a syntax error and
+ * is unparsable.
+ */
+ public int insertRule(String rule, int index) throws DOMException;
+
+ /**
+ * Used to delete a rule from the media block.
+ *
+ * @param index
+ * The index within the media block's rule collection of the
+ * rule to remove.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified index does not
+ * correspond to a rule in the media rule list. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule
+ * is readonly.
+ */
+ public void deleteRule(int index) throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPageRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPageRule.java
new file mode 100644
index 0000000000..26cda33854
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPageRule.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSPageRule</code> interface represents a
+ *
+ * @page rule within a CSS style sheet. The <code>@page</code> rule is used to specify the dimensions, orientation, margins,
+ * etc. of a page box for paged media.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ * @since DOM Level 2
+ */
+public interface CSSPageRule extends CSSRule {
+ /**
+ * The parsable textual representation of the page selector for the rule.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is
+ * readonly.
+ */
+ public String getSelectorText();
+
+ public void setSelectorText(String selectorText) throws DOMException;
+
+ /**
+ * The declaration-block of this rule.
+ */
+ public CSSStyleDeclaration getStyle();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPrimitiveValue.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPrimitiveValue.java
new file mode 100644
index 0000000000..cf7f4ce589
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSPrimitiveValue.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSPrimitiveValue</code> interface represents a single CSS
+ * value . This interface may be used to determine the value of a specific
+ * style property currently set in a block or to set a specific style property
+ * explicitly within the block. An instance of this interface might be
+ * obtained from the <code>getPropertyCSSValue</code> method of the
+ * <code>CSSStyleDeclaration</code> interface. A
+ * <code>CSSPrimitiveValue</code> object only occurs in a context of a CSS
+ * property.
+ * <p>
+ * Conversions are allowed between absolute values (from millimeters to
+ * centimeters, from degrees to radians, and so on) but not between relative
+ * values. (For example, a pixel value cannot be converted to a centimeter
+ * value.) Percentage values can't be converted since they are relative to the
+ * parent value (or another property value). There is one exception for color
+ * percentage values: since a color percentage value is relative to the range
+ * 0-255, a color percentage value can be converted to a number; (see also the
+ * <code>RGBColor</code> interface).
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSPrimitiveValue extends CSSValue {
+ // UnitTypes
+ /**
+ * The value is not a recognized CSS2 value. The value can only be
+ * obtained by using the <code>cssText</code> attribute.
+ */
+ public static final short CSS_UNKNOWN = 0;
+ /**
+ * The value is a simple number. The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_NUMBER = 1;
+ /**
+ * The value is a percentage. The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_PERCENTAGE = 2;
+ /**
+ * The value is a length (ems). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_EMS = 3;
+ /**
+ * The value is a length (exs). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_EXS = 4;
+ /**
+ * The value is a length (px). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_PX = 5;
+ /**
+ * The value is a length (cm). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_CM = 6;
+ /**
+ * The value is a length (mm). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_MM = 7;
+ /**
+ * The value is a length (in). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_IN = 8;
+ /**
+ * The value is a length (pt). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_PT = 9;
+ /**
+ * The value is a length (pc). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_PC = 10;
+ /**
+ * The value is an angle (deg). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_DEG = 11;
+ /**
+ * The value is an angle (rad). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_RAD = 12;
+ /**
+ * The value is an angle (grad). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_GRAD = 13;
+ /**
+ * The value is a time (ms). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_MS = 14;
+ /**
+ * The value is a time (s). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_S = 15;
+ /**
+ * The value is a frequency (Hz). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_HZ = 16;
+ /**
+ * The value is a frequency (kHz). The value can be obtained by using the
+ * <code>getFloatValue</code> method.
+ */
+ public static final short CSS_KHZ = 17;
+ /**
+ * The value is a number with an unknown dimension. The value can be
+ * obtained by using the <code>getFloatValue</code> method.
+ */
+ public static final short CSS_DIMENSION = 18;
+ /**
+ * The value is a STRING. The value can be obtained by using the
+ * <code>getStringValue</code> method.
+ */
+ public static final short CSS_STRING = 19;
+ /**
+ * The value is a URI. The value can be obtained by using the
+ * <code>getStringValue</code> method.
+ */
+ public static final short CSS_URI = 20;
+ /**
+ * The value is an identifier. The value can be obtained by using the
+ * <code>getStringValue</code> method.
+ */
+ public static final short CSS_IDENT = 21;
+ /**
+ * The value is a attribute function. The value can be obtained by using
+ * the <code>getStringValue</code> method.
+ */
+ public static final short CSS_ATTR = 22;
+ /**
+ * The value is a counter or counters function. The value can be obtained
+ * by using the <code>getCounterValue</code> method.
+ */
+ public static final short CSS_COUNTER = 23;
+ /**
+ * The value is a rect function. The value can be obtained by using the
+ * <code>getRectValue</code> method.
+ */
+ public static final short CSS_RECT = 24;
+ /**
+ * The value is a RGB color. The value can be obtained by using the
+ * <code>getRGBColorValue</code> method.
+ */
+ public static final short CSS_RGBCOLOR = 25;
+
+ /**
+ * The type of the value as defined by the constants specified above.
+ */
+ public short getPrimitiveType();
+
+ /**
+ * A method to set the float value with a specified unit. If the property
+ * attached with this value can not accept the specified unit or the float
+ * value, the value will be unchanged and a <code>DOMException</code>
+ * will be raised.
+ *
+ * @param unitType
+ * A unit code as defined above. The unit code can only be a
+ * float unit type (i.e. <code>CSS_NUMBER</code>,
+ * <code>CSS_PERCENTAGE</code>,<code>CSS_EMS</code>,
+ * <code>CSS_EXS</code>,<code>CSS_PX</code>,
+ * <code>CSS_CM</code>,<code>CSS_MM</code>,
+ * <code>CSS_IN</code>,<code>CSS_PT</code>,
+ * <code>CSS_PC</code>,<code>CSS_DEG</code>,
+ * <code>CSS_RAD</code>,<code>CSS_GRAD</code>,
+ * <code>CSS_MS</code>,<code>CSS_S</code>,
+ * <code>CSS_HZ</code>,<code>CSS_KHZ</code>,
+ * <code>CSS_DIMENSION</code>).
+ * @param floatValue
+ * The new float value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the attached property
+ * doesn't support the float value or the unit type. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public void setFloatValue(short unitType, float floatValue) throws DOMException;
+
+ /**
+ * This method is used to get a float value in a specified unit. If this
+ * CSS value doesn't contain a float value or can't be converted into the
+ * specified unit, a <code>DOMException</code> is raised.
+ *
+ * @param unitType
+ * A unit code to get the float value. The unit code can only
+ * be a float unit type (i.e. <code>CSS_NUMBER</code>,
+ * <code>CSS_PERCENTAGE</code>,<code>CSS_EMS</code>,
+ * <code>CSS_EXS</code>,<code>CSS_PX</code>,
+ * <code>CSS_CM</code>,<code>CSS_MM</code>,
+ * <code>CSS_IN</code>,<code>CSS_PT</code>,
+ * <code>CSS_PC</code>,<code>CSS_DEG</code>,
+ * <code>CSS_RAD</code>,<code>CSS_GRAD</code>,
+ * <code>CSS_MS</code>,<code>CSS_S</code>,
+ * <code>CSS_HZ</code>,<code>CSS_KHZ</code>,
+ * <code>CSS_DIMENSION</code>).
+ * @return The float value in the specified unit.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a float value or if the float value can't be
+ * converted into the specified unit.
+ */
+ public float getFloatValue(short unitType) throws DOMException;
+
+ /**
+ * A method to set the string value with the specified unit. If the
+ * property attached to this value can't accept the specified unit or the
+ * string value, the value will be unchanged and a
+ * <code>DOMException</code> will be raised.
+ *
+ * @param stringType
+ * A string code as defined above. The string code can only be
+ * a string unit type (i.e. <code>CSS_STRING</code>,
+ * <code>CSS_URI</code>,<code>CSS_IDENT</code>, and
+ * <code>CSS_ATTR</code>).
+ * @param stringValue
+ * The new string value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a string value or if the string value can't be
+ * converted into the specified unit. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
+ * readonly.
+ */
+ public void setStringValue(short stringType, String stringValue) throws DOMException;
+
+ /**
+ * This method is used to get the string value. If the CSS value doesn't
+ * contain a string value, a <code>DOMException</code> is raised. Some
+ * properties (like 'font-family' or 'voice-family') convert a whitespace
+ * separated list of idents to a string.
+ *
+ * @return The string value in the current unit. The current
+ * <code>primitiveType</code> can only be a string unit type
+ * (i.e. <code>CSS_STRING</code>,<code>CSS_URI</code>,
+ * <code>CSS_IDENT</code> and <code>CSS_ATTR</code>).
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a string value.
+ */
+ public String getStringValue() throws DOMException;
+
+ /**
+ * This method is used to get the Counter value. If this CSS value doesn't
+ * contain a counter value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>Counter</code> interface.
+ *
+ * @return The Counter value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a Counter value (e.g. this is not
+ * <code>CSS_COUNTER</code>).
+ */
+ public Counter getCounterValue() throws DOMException;
+
+ /**
+ * This method is used to get the Rect value. If this CSS value doesn't
+ * contain a rect value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>Rect</code> interface.
+ *
+ * @return The Rect value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the CSS value doesn't
+ * contain a Rect value. (e.g. this is not
+ * <code>CSS_RECT</code>).
+ */
+ public Rect getRectValue() throws DOMException;
+
+ /**
+ * This method is used to get the RGB color. If this CSS value doesn't
+ * contain a RGB color value, a <code>DOMException</code> is raised.
+ * Modification to the corresponding style property can be achieved using
+ * the <code>RGBColor</code> interface.
+ *
+ * @return the RGB color value.
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if the attached property
+ * can't return a RGB color value (e.g. this is not
+ * <code>CSS_RGBCOLOR</code>).
+ */
+ public RGBColor getRGBColorValue() throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRule.java
new file mode 100644
index 0000000000..18e3b29d11
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRule.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSRule</code> interface is the abstract base interface for any
+ * type of CSS statement. This includes both rule sets and at-rules. An
+ * implementation is expected to preserve all rules specified in a CSS style
+ * sheet, even if the rule is not recognized by the parser. Unrecognized rules
+ * are represented using the <code>CSSUnknownRule</code> interface.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSRule {
+ // RuleType
+ /**
+ * The rule is a <code>CSSUnknownRule</code>.
+ */
+ public static final short UNKNOWN_RULE = 0;
+ /**
+ * The rule is a <code>CSSStyleRule</code>.
+ */
+ public static final short STYLE_RULE = 1;
+ /**
+ * The rule is a <code>CSSCharsetRule</code>.
+ */
+ public static final short CHARSET_RULE = 2;
+ /**
+ * The rule is a <code>CSSImportRule</code>.
+ */
+ public static final short IMPORT_RULE = 3;
+ /**
+ * The rule is a <code>CSSMediaRule</code>.
+ */
+ public static final short MEDIA_RULE = 4;
+ /**
+ * The rule is a <code>CSSFontFaceRule</code>.
+ */
+ public static final short FONT_FACE_RULE = 5;
+ /**
+ * The rule is a <code>CSSPageRule</code>.
+ */
+ public static final short PAGE_RULE = 6;
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the <code>CSSRule</code> interface to the specific
+ * derived interface implied by the <code>type</code>.
+ */
+ public short getType();
+
+ /**
+ * The parsable textual representation of the rule. This reflects the
+ * current state of the rule and not its initial value.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error and is unparsable. <br>
+ * INVALID_MODIFICATION_ERR: Raised if the specified CSS
+ * string value represents a different type of rule than
+ * the current one. <br>
+ * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be
+ * inserted at this point in the style sheet. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is
+ * readonly.
+ */
+ public String getCssText();
+
+ public void setCssText(String cssText) throws DOMException;
+
+ /**
+ * The style sheet that contains this rule.
+ */
+ public CSSStyleSheet getParentStyleSheet();
+
+ /**
+ * If this rule is contained inside another rule (e.g. a style rule inside
+ * an
+ *
+ * @media block), this is the containing rule. If this rule is not nested
+ * inside any other rules, this returns <code>null</code>.
+ */
+ public CSSRule getParentRule();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRuleList.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRuleList.java
new file mode 100644
index 0000000000..8fed1c330f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSRuleList.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>CSSRuleList</code> interface provides the abstraction of an
+ * ordered collection of CSS rules.
+ * <p>
+ * The items in the <code>CSSRuleList</code> are accessible via an integral
+ * index, starting from 0.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSRuleList {
+ /**
+ * The number of <code>CSSRules</code> in the list. The range of valid
+ * child rule indices is <code>0</code> to <code>length-1</code>
+ * inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve a CSS rule by ordinal index. The order in this
+ * collection represents the order of the rules in the CSS style sheet. If
+ * index is greater than or equal to the number of rules in the list, this
+ * returns <code>null</code>.
+ *
+ * @param indexIndex
+ * into the collection
+ * @return The style rule at the <code>index</code> position in the
+ * <code>CSSRuleList</code>, or <code>null</code> if that is
+ * not a valid index.
+ */
+ public CSSRule item(int index);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleDeclaration.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleDeclaration.java
new file mode 100644
index 0000000000..c2c3b61661
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleDeclaration.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSStyleDeclaration</code> interface represents a single CSS
+ * declaration block. This interface may be used to determine the style
+ * properties currently set in a block or to set style properties explicitly
+ * within the block.
+ * <p>
+ * While an implementation may not recognize all CSS properties within a CSS
+ * declaration block, it is expected to provide access to all specified
+ * properties in the style sheet through the <code>CSSStyleDeclaration</code>
+ * interface. Furthermore, implementations that support a specific level of
+ * CSS should correctly handle CSS shorthand properties for that level. For a
+ * further discussion of shorthand properties, see the
+ * <code>CSS2Properties</code> interface.
+ * <p>
+ * This interface is also used to provide a read-only access to the computed
+ * values of an element. See also the <code>ViewCSS</code> interface. The
+ * CSS Object Model doesn't provide an access to the specified or actual
+ * values of the CSS cascade.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSStyleDeclaration {
+ /**
+ * The parsable textual representation of the declaration block (excluding
+ * the surrounding curly braces). Setting this attribute will result in
+ * the parsing of the new value and resetting of all the properties in the
+ * declaration block including the removal or addition of properties.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration
+ * is readonly or a property is readonly.
+ */
+ public String getCssText();
+
+ public void setCssText(String cssText) throws DOMException;
+
+ /**
+ * Used to retrieve the value of a CSS property if it has been explicitly
+ * set within this declaration block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return Returns the value of the property if it has been explicitly set
+ * for this declaration block. Returns the empty string if the
+ * property has not been set.
+ */
+ public String getPropertyValue(String propertyName);
+
+ /**
+ * Used to retrieve the object representation of the value of a CSS
+ * property if it has been explicitly set within this declaration block.
+ * This method returns <code>null</code> if the property is a shorthand
+ * property. Shorthand property values can only be accessed and modified
+ * as strings, using the <code>getPropertyValue</code> and
+ * <code>setProperty</code> methods.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return Returns the value of the property if it has been explicitly set
+ * for this declaration block. Returns <code>null</code> if the
+ * property has not been set.
+ */
+ public CSSValue getPropertyCSSValue(String propertyName);
+
+ /**
+ * Used to remove a CSS property if it has been explicitly set within this
+ * declaration block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return Returns the value of the property if it has been explicitly set
+ * for this declaration block. Returns the empty string if the
+ * property has not been set or the property name does not
+ * correspond to a known CSS property.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration
+ * is readonly or the property is readonly.
+ */
+ public String removeProperty(String propertyName) throws DOMException;
+
+ /**
+ * Used to retrieve the priority of a CSS property (e.g. the
+ * <code>"important"</code> qualifier) if the property has been
+ * explicitly set in this declaration block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @return A string representing the priority (e.g.
+ * <code>"important"</code>) if one exists. The empty string if
+ * none exists.
+ */
+ public String getPropertyPriority(String propertyName);
+
+ /**
+ * Used to set a property value and priority within this declaration
+ * block.
+ *
+ * @param propertyName
+ * The name of the CSS property. See the CSS property index.
+ * @param value
+ * The new value of the property.
+ * @param priority
+ * The new priority of the property (e.g.
+ * <code>"important"</code>).
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified value has a syntax
+ * error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration
+ * is readonly or the property is readonly.
+ */
+ public void setProperty(String propertyName, String value, String priority) throws DOMException;
+
+ /**
+ * The number of properties that have been explicitly set in this
+ * declaration block. The range of valid indices is 0 to length-1
+ * inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve the properties that have been explicitly set in this
+ * declaration block. The order of the properties retrieved using this
+ * method does not have to be the order in which they were set. This
+ * method can be used to iterate over all properties in this declaration
+ * block.
+ *
+ * @param index
+ * Index of the property name to retrieve.
+ * @return The name of the property at this ordinal position. The empty
+ * string if no property exists at this position.
+ */
+ public String item(int index);
+
+ /**
+ * The CSS rule that contains this declaration block or <code>null</code>
+ * if this <code>CSSStyleDeclaration</code> is not attached to a
+ * <code>CSSRule</code>.
+ */
+ public CSSRule getParentRule();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleRule.java
new file mode 100644
index 0000000000..df24630611
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleRule.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSStyleRule</code> interface represents a single rule set in a
+ * CSS style sheet.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSStyleRule extends CSSRule {
+ /**
+ * The textual representation of the selector for the rule set. The
+ * implementation may have stripped out insignificant whitespace while
+ * parsing the selector.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is
+ * readonly.
+ */
+ public String getSelectorText();
+
+ public void setSelectorText(String selectorText) throws DOMException;
+
+ /**
+ * The declaration-block of this rule set.
+ */
+ public CSSStyleDeclaration getStyle();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleSheet.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleSheet.java
new file mode 100644
index 0000000000..20b593ea03
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSStyleSheet.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.stylesheets.StyleSheet;
+
+/**
+ * The <code>CSSStyleSheet</code> interface is a concrete interface used to
+ * represent a CSS style sheet i.e., a style sheet whose content type is
+ * "text/css".
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSStyleSheet extends StyleSheet {
+ /**
+ * If this style sheet comes from an <code>@import</code> rule, the <code>ownerRule</code> attribute will
+ * contain the <code>CSSImportRule</code>. In that case, the
+ * <code>ownerNode</code> attribute in the
+ * <code>StyleSheet</code> interface will be <code>null</code>.
+ * If the style sheet comes from an element or a processing
+ * instruction, the <code>ownerRule</code> attribute will be
+ * <code>null</code> and the <code>ownerNode</code> attribute
+ * will contain the <code>Node</code>.
+ */
+ public CSSRule getOwnerRule();
+
+ /**
+ * The list of all CSS rules contained within the style sheet. This
+ * includes both rule sets and at-rules.
+ */
+ public CSSRuleList getCssRules();
+
+ /**
+ * Used to insert a new rule into the style sheet. The new rule now
+ * becomes part of the cascade.
+ *
+ * @param rule
+ * The parsable text representing the rule. For rule sets this
+ * contains both the selector and the style declaration. For
+ * at-rules, this specifies both the at-identifier and the rule
+ * content.
+ * @param index
+ * The index within the style sheet's rule list of the rule
+ * before which to insert the specified rule. If the specified
+ * index is equal to the length of the style sheet's rule
+ * collection, the rule will be added to the end of the style
+ * sheet.
+ * @return The index within the style sheet's rule collection of the newly
+ * inserted rule.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be
+ * inserted at the specified index e.g. if an
+ * <code>@import</code> rule is inserted after a standard rule set or other
+ * at-rule. <br>
+ * INDEX_SIZE_ERR: Raised if the specified index is not a valid
+ * insertion point. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
+ * readonly. <br>
+ * SYNTAX_ERR: Raised if the specified rule has a syntax error and
+ * is unparsable.
+ */
+ public int insertRule(String rule, int index) throws DOMException;
+
+ /**
+ * Used to delete a rule from the style sheet.
+ *
+ * @param index
+ * The index within the style sheet's rule list of the rule to
+ * remove.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified index does not
+ * correspond to a rule in the style sheet's rule list.
+ * <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet
+ * is readonly.
+ */
+ public void deleteRule(int index) throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSUnknownRule.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSUnknownRule.java
new file mode 100644
index 0000000000..c6e20e3c93
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSUnknownRule.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>CSSUnknownRule</code> interface represents an at-rule not
+ * supported by this user agent.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSUnknownRule extends CSSRule {
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValue.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValue.java
new file mode 100644
index 0000000000..6ba0466625
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValue.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>CSSValue</code> interface represents a simple or a complex
+ * value. A <code>CSSValue</code> object only occurs in a context of a CSS
+ * property.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSValue {
+ // UnitTypes
+ /**
+ * The value is inherited and the <code>cssText</code> contains
+ * "inherit".
+ */
+ public static final short CSS_INHERIT = 0;
+ /**
+ * The value is a primitive value and an instance of the
+ * <code>CSSPrimitiveValue</code> interface can be obtained by using
+ * binding-specific casting methods on this instance of the
+ * <code>CSSValue</code> interface.
+ */
+ public static final short CSS_PRIMITIVE_VALUE = 1;
+ /**
+ * The value is a <code>CSSValue</code> list and an instance of the
+ * <code>CSSValueList</code> interface can be obtained by using
+ * binding-specific casting methods on this instance of the
+ * <code>CSSValue</code> interface.
+ */
+ public static final short CSS_VALUE_LIST = 2;
+ /**
+ * The value is a custom value.
+ */
+ public static final short CSS_CUSTOM = 3;
+
+ /**
+ * A string representation of the current value.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has
+ * a syntax error (according to the attached property) or
+ * is unparsable. <br>
+ * INVALID_MODIFICATION_ERR: Raised if the specified CSS
+ * string value represents a different type of values than
+ * the values allowed by the CSS property. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this value is
+ * readonly.
+ */
+ public String getCssText();
+
+ public void setCssText(String cssText) throws DOMException;
+
+ /**
+ * A code defining the type of the value as defined above.
+ */
+ public short getCssValueType();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValueList.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValueList.java
new file mode 100644
index 0000000000..1813cc0f35
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/CSSValueList.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>CSSValueList</code> interface provides the abstraction of an
+ * ordered collection of CSS values.
+ * <p>
+ * Some properties allow an empty list into their syntax. In that case, these
+ * properties take the <code>none</code> identifier. So, an empty list means
+ * that the property has the value <code>none</code>.
+ * <p>
+ * The items in the <code>CSSValueList</code> are accessible via an integral
+ * index, starting from 0.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface CSSValueList extends CSSValue {
+ /**
+ * The number of <code>CSSValues</code> in the list. The range of valid
+ * values of the indices is <code>0</code> to <code>length-1</code>
+ * inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve a <code>CSSValue</code> by ordinal index. The order
+ * in this collection represents the order of the values in the CSS style
+ * property. If index is greater than or equal to the number of values in
+ * the list, this returns <code>null</code>.
+ *
+ * @param indexIndex
+ * into the collection.
+ * @return The <code>CSSValue</code> at the <code>index</code>
+ * position in the <code>CSSValueList</code>, or
+ * <code>null</code> if that is not a valid index.
+ */
+ public CSSValue item(int index);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Counter.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Counter.java
new file mode 100644
index 0000000000..aee88cf4f5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Counter.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>Counter</code> interface is used to represent any counter or
+ * counters function value. This interface reflects the values in the
+ * underlying style property.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface Counter {
+ /**
+ * This attribute is used for the identifier of the counter.
+ */
+ public String getIdentifier();
+
+ /**
+ * This attribute is used for the style of the list.
+ */
+ public String getListStyle();
+
+ /**
+ * This attribute is used for the separator of the nested counters.
+ */
+ public String getSeparator();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DOMImplementationCSS.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DOMImplementationCSS.java
new file mode 100644
index 0000000000..7cbdf98600
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DOMImplementationCSS.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+
+/**
+ * This interface allows the DOM user to create a <code>CSSStyleSheet</code>
+ * outside the context of a document. There is no way to associate the new
+ * <code>CSSStyleSheet</code> with a document in DOM Level 2.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface DOMImplementationCSS extends DOMImplementation {
+ /**
+ * Creates a new <code>CSSStyleSheet</code>.
+ *
+ * @param title
+ * The advisory title. See also the section.
+ * @param media
+ * The comma-separated list of media associated with the new
+ * style sheet. See also the section.
+ * @return A new CSS style sheet.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified media string value
+ * has a syntax error and is unparsable.
+ */
+ public CSSStyleSheet createCSSStyleSheet(String title, String media) throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DocumentCSS.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DocumentCSS.java
new file mode 100644
index 0000000000..60d34510f8
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/DocumentCSS.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.stylesheets.DocumentStyle;
+
+/**
+ * This interface represents a document with a CSS view.
+ * <p>
+ * The <code>getOverrideStyle</code> method provides a mechanism through
+ * which a DOM author could effect immediate change to the style of an element
+ * without modifying the explicitly linked style sheets of a document or the
+ * inline style of elements in the style sheets. This style sheet comes after
+ * the author style sheet in the cascade algorithm and is called override
+ * style sheet. The override style sheet takes precedence over author style
+ * sheets. An "!important" declaration still takes precedence over a normal
+ * declaration. Override, author, and user style sheets all may contain
+ * "!important" declarations. User "!important" rules take precedence over
+ * both override and author "!important" rules, and override "!important"
+ * rules take precedence over author "!important" rules.
+ * <p>
+ * The expectation is that an instance of the <code>DocumentCSS</code>
+ * interface can be obtained by using binding-specific casting methods on an
+ * instance of the <code>Document</code> interface.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface DocumentCSS extends DocumentStyle {
+ /**
+ * This method is used to retrieve the override style declaration for a
+ * specified element and a specified pseudo-element.
+ *
+ * @param elt
+ * The element whose style is to be modified. This parameter
+ * cannot be null.
+ * @param pseudoElt
+ * The pseudo-element or <code>null</code> if none.
+ * @return The override style declaration.
+ */
+ public CSSStyleDeclaration getOverrideStyle(Element elt, String pseudoElt);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ElementCSSInlineStyle.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ElementCSSInlineStyle.java
new file mode 100644
index 0000000000..ba90ee412d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ElementCSSInlineStyle.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * Inline style information attached to elements is exposed through the
+ * <code>style</code> attribute. This represents the contents of the STYLE
+ * attribute for HTML elements (or elements in other schemas or DTDs which use
+ * the STYLE attribute in the same way). The expectation is that an instance
+ * of the ElementCSSInlineStyle interface can be obtained by using
+ * binding-specific casting methods on an instance of the Element interface
+ * when the element supports inline CSS style informations.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface ElementCSSInlineStyle {
+ /**
+ * The style attribute.
+ */
+ public CSSStyleDeclaration getStyle();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/RGBColor.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/RGBColor.java
new file mode 100644
index 0000000000..5766f1af99
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/RGBColor.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>RGBColor</code> interface is used to represent any RGB color
+ * value. This interface reflects the values in the underlying style property.
+ * Hence, modifications made to the <code>CSSPrimitiveValue</code> objects
+ * modify the style property.
+ * <p>
+ * A specified RGB color is not clipped (even if the number is outside the
+ * range 0-255 or 0%-100%). A computed RGB color is clipped depending on the
+ * device.
+ * <p>
+ * Even if a style sheet can only contain an integer for a color value, the
+ * internal storage of this integer is a float, and this can be used as a
+ * float in the specified or the computed style.
+ * <p>
+ * A color percentage value can always be converted to a number and vice
+ * versa.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface RGBColor {
+ /**
+ * This attribute is used for the red value of the RGB color.
+ */
+ public CSSPrimitiveValue getRed();
+
+ /**
+ * This attribute is used for the green value of the RGB color.
+ */
+ public CSSPrimitiveValue getGreen();
+
+ /**
+ * This attribute is used for the blue value of the RGB color.
+ */
+ public CSSPrimitiveValue getBlue();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Rect.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Rect.java
new file mode 100644
index 0000000000..c745c92b6c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/Rect.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The <code>Rect</code> interface is used to represent any rect value. This
+ * interface reflects the values in the underlying style property. Hence,
+ * modifications made to the <code>CSSPrimitiveValue</code> objects modify
+ * the style property.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface Rect {
+ /**
+ * This attribute is used for the top of the rect.
+ */
+ public CSSPrimitiveValue getTop();
+
+ /**
+ * This attribute is used for the right of the rect.
+ */
+ public CSSPrimitiveValue getRight();
+
+ /**
+ * This attribute is used for the bottom of the rect.
+ */
+ public CSSPrimitiveValue getBottom();
+
+ /**
+ * This attribute is used for the left of the rect.
+ */
+ public CSSPrimitiveValue getLeft();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ViewCSS.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ViewCSS.java
new file mode 100644
index 0000000000..cf5739f1e3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/css/ViewCSS.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.views.AbstractView;
+
+/**
+ * This interface represents a CSS view. The <code>getComputedStyle</code>
+ * method provides a read only access to the computed values of an element.
+ * <p>
+ * The expectation is that an instance of the <code>ViewCSS</code> interface
+ * can be obtained by using binding-specific casting methods on an instance of
+ * the <code>AbstractView</code> interface.
+ * <p>
+ * Since a computed style is related to an <code>Element</code> node, if
+ * this element is removed from the document, the associated
+ * <code>CSSStyleDeclaration</code> and <code>CSSValue</code> related to
+ * this declaration are no longer valid.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface ViewCSS extends AbstractView {
+ /**
+ * This method is used to get the computed style as it is defined in .
+ *
+ * @param elt
+ * The element whose style is to be computed. This parameter
+ * cannot be null.
+ * @param pseudoElt
+ * The pseudo-element or <code>null</code> if none.
+ * @return The computed style. The <code>CSSStyleDeclaration</code> is
+ * read-only and contains only absolute values.
+ */
+ public CSSStyleDeclaration getComputedStyle(Element elt, String pseudoElt);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/DocumentStyle.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/DocumentStyle.java
new file mode 100644
index 0000000000..9cc04d1cda
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/DocumentStyle.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+/**
+ * The <code>DocumentStyle</code> interface provides a mechanism by which
+ * the style sheets embedded in a document can be retrieved. The expectation
+ * is that an instance of the <code>DocumentStyle</code> interface can be
+ * obtained by using binding-specific casting methods on an instance of the
+ * <code>Document</code> interface.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface DocumentStyle {
+ /**
+ * A list containing all the style sheets explicitly linked into or
+ * embedded in a document. For HTML documents, this includes external
+ * style sheets, included via the HTML LINK element, and inline STYLE
+ * elements. In XML, this includes external style sheets, included via
+ * style sheet processing instructions (see ).
+ */
+ public StyleSheetList getStyleSheets();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/LinkStyle.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/LinkStyle.java
new file mode 100644
index 0000000000..b71119b659
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/LinkStyle.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+/**
+ * The <code>LinkStyle</code> interface provides a mechanism by which a
+ * style sheet can be retrieved from the node responsible for linking it into
+ * a document. An instance of the <code>LinkStyle</code> interface can be
+ * obtained using binding-specific casting methods on an instance of a linking
+ * node (<code>HTMLLinkElement</code>,<code>HTMLStyleElement</code> or
+ * <code>ProcessingInstruction</code> in DOM Level 2).
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface LinkStyle {
+ /**
+ * The style sheet.
+ */
+ public StyleSheet getSheet();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/MediaList.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/MediaList.java
new file mode 100644
index 0000000000..1df07c2468
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/MediaList.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>MediaList</code> interface provides the abstraction of an
+ * ordered collection of media, without defining or constraining how this
+ * collection is implemented. An empty list is the same as a list that
+ * contains the medium <code>"all"</code>.
+ * <p>
+ * The items in the <code>MediaList</code> are accessible via an integral
+ * index, starting from 0.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface MediaList {
+ /**
+ * The parsable textual representation of the media list. This is a
+ * comma-separated list of media.
+ *
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified string value has a
+ * syntax error and is unparsable. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this media list
+ * is readonly.
+ */
+ public String getMediaText();
+
+ public void setMediaText(String mediaText) throws DOMException;
+
+ /**
+ * The number of media in the list. The range of valid media is
+ * <code>0</code> to <code>length-1</code> inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Returns the <code>index</code> th in the list. If <code>index</code>
+ * is greater than or equal to the number of media in the list, this
+ * returns <code>null</code>.
+ *
+ * @param index
+ * Index into the collection.
+ * @return The medium at the <code>index</code> th position in the
+ * <code>MediaList</code>, or <code>null</code> if that is
+ * not a valid index.
+ */
+ public String item(int index);
+
+ /**
+ * Deletes the medium indicated by <code>oldMedium</code> from the list.
+ *
+ * @param oldMediumThe
+ * medium to delete in the media list.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is
+ * readonly. <br>
+ * NOT_FOUND_ERR: Raised if <code>oldMedium</code> is not
+ * in the list.
+ */
+ public void deleteMedium(String oldMedium) throws DOMException;
+
+ /**
+ * Adds the medium <code>newMedium</code> to the end of the list. If the
+ * <code>newMedium</code> is already used, it is first removed.
+ *
+ * @param newMediumThe
+ * new medium to add.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: If the medium contains characters
+ * that are invalid in the underlying style language. <br>
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is
+ * readonly.
+ */
+ public void appendMedium(String newMedium) throws DOMException;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheet.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheet.java
new file mode 100644
index 0000000000..bccea60b1d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheet.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+import org.w3c.dom.Node;
+
+/**
+ * The <code>StyleSheet</code> interface is the abstract base interface for
+ * any type of style sheet. It represents a single style sheet associated with
+ * a structured document. In HTML, the StyleSheet interface represents either
+ * an external style sheet, included via the HTML LINK element, or an inline
+ * STYLE element. In XML, this interface represents an external style sheet,
+ * included via a style sheet processing instruction.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface StyleSheet {
+ /**
+ * This specifies the style sheet language for this style sheet. The style
+ * sheet language is specified as a content type (e.g. "text/css"). The
+ * content type is often specified in the <code>ownerNode</code>. Also
+ * see the type attribute definition for the <code>LINK</code> element
+ * in HTML 4.0, and the type pseudo-attribute for the XML style sheet
+ * processing instruction.
+ */
+ public String getType();
+
+ /**
+ * <code>false</code> if the style sheet is applied to the document.
+ * <code>true</code> if it is not. Modifying this attribute may cause a
+ * new resolution of style for the document. A stylesheet only applies if
+ * both an appropriate medium definition is present and the disabled
+ * attribute is false. So, if the media doesn't apply to the current user
+ * agent, the <code>disabled</code> attribute is ignored.
+ */
+ public boolean getDisabled();
+
+ public void setDisabled(boolean disabled);
+
+ /**
+ * The node that associates this style sheet with the document. For HTML,
+ * this may be the corresponding <code>LINK</code> or <code>STYLE</code>
+ * element. For XML, it may be the linking processing instruction. For
+ * style sheets that are included by other style sheets, the value of this
+ * attribute is <code>null</code>.
+ */
+ public Node getOwnerNode();
+
+ /**
+ * For style sheet languages that support the concept of style sheet
+ * inclusion, this attribute represents the including style sheet, if one
+ * exists. If the style sheet is a top-level style sheet, or the style
+ * sheet language does not support inclusion, the value of this attribute
+ * is <code>null</code>.
+ */
+ public StyleSheet getParentStyleSheet();
+
+ /**
+ * If the style sheet is a linked style sheet, the value of its attribute
+ * is its location. For inline style sheets, the value of this attribute
+ * is <code>null</code>. See the href attribute definition for the
+ * <code>LINK</code> element in HTML 4.0, and the href pseudo-attribute
+ * for the XML style sheet processing instruction.
+ */
+ public String getHref();
+
+ /**
+ * The advisory title. The title is often specified in the
+ * <code>ownerNode</code>. See the title attribute definition for the
+ * <code>LINK</code> element in HTML 4.0, and the title pseudo-attribute
+ * for the XML style sheet processing instruction.
+ */
+ public String getTitle();
+
+ /**
+ * The intended destination media for style information. The media is
+ * often specified in the <code>ownerNode</code>. If no media has been
+ * specified, the <code>MediaList</code> will be empty. See the media
+ * attribute definition for the <code>LINK</code> element in HTML 4.0,
+ * and the media pseudo-attribute for the XML style sheet processing
+ * instruction . Modifying the media list may cause a change to the
+ * attribute <code>disabled</code>.
+ */
+ public MediaList getMedia();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheetList.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheetList.java
new file mode 100644
index 0000000000..a791de6e7a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/stylesheets/StyleSheetList.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+/**
+ * The <code>StyleSheetList</code> interface provides the abstraction of an
+ * ordered collection of style sheets.
+ * <p>
+ * The items in the <code>StyleSheetList</code> are accessible via an
+ * integral index, starting from 0.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document
+ * Object Model (DOM) Level 2 Style Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface StyleSheetList {
+ /**
+ * The number of <code>StyleSheets</code> in the list. The range of
+ * valid child stylesheet indices is <code>0</code> to
+ * <code>length-1</code> inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve a style sheet by ordinal index. If index is greater
+ * than or equal to the number of style sheets in the list, this returns
+ * <code>null</code>.
+ *
+ * @param indexIndex
+ * into the collection
+ * @return The style sheet at the <code>index</code> position in the
+ * <code>StyleSheetList</code>, or <code>null</code> if that
+ * is not a valid index.
+ */
+ public StyleSheet item(int index);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/AbstractView.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/AbstractView.java
new file mode 100644
index 0000000000..799ce7e70a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/AbstractView.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.views;
+
+/**
+ * A base interface that all views shall derive from.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113'>Document
+ * Object Model (DOM) Level 2 Views Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface AbstractView {
+ /**
+ * The source <code>DocumentView</code> of which this is an
+ * <code>AbstractView</code>.
+ */
+ public DocumentView getDocument();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/DocumentView.java b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/DocumentView.java
new file mode 100644
index 0000000000..ce63f7b21d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.core/src/org/w3c/dom/views/DocumentView.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.views;
+
+/**
+ * The <code>DocumentView</code> interface is implemented by
+ * <code>Document</code> objects in DOM implementations supporting DOM
+ * Views. It provides an attribute to retrieve the default view of a document.
+ * <p>
+ * See also the <a
+ * href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113'>Document
+ * Object Model (DOM) Level 2 Views Specification </a>.
+ *
+ * @since DOM Level 2
+ */
+public interface DocumentView {
+ /**
+ * The default <code>AbstractView</code> for this <code>Document</code>,
+ * or <code>null</code> if none available.
+ */
+ public AbstractView getDefaultView();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/.classpath b/bundles/org.eclipse.wst.css.ui/.classpath
new file mode 100644
index 0000000000..df094ee4a7
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.css.ui/.compatibility b/bundles/org.eclipse.wst.css.ui/.compatibility
new file mode 100644
index 0000000000..6fcfaf32fb
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004
+.project=3769
diff --git a/bundles/org.eclipse.wst.css.ui/.cvsignore b/bundles/org.eclipse.wst.css.ui/.cvsignore
new file mode 100644
index 0000000000..4295133bac
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/.cvsignore
@@ -0,0 +1,5 @@
+csseditor.jar
+temp.folder
+build.xml
+dev.properties
+bin
diff --git a/bundles/org.eclipse.wst.css.ui/.project b/bundles/org.eclipse.wst.css.ui/.project
new file mode 100644
index 0000000000..d42035fc37
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.css.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.css.ui/build.properties b/bundles/org.eclipse.wst.css.ui/build.properties
new file mode 100644
index 0000000000..07de39b935
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+bin.includes = plugin.xml,\
+ *.jar,\
+ css.jar,\
+ icons/,\
+ plugin.properties
+src.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ build.xml,\
+ build.properties,\
+ README.txt
+source.csseditor.jar = src/
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/aural_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/aural_props.gif
new file mode 100644
index 0000000000..df1704e435
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/aural_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/boxmodel_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/boxmodel_props.gif
new file mode 100644
index 0000000000..7c050f5090
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/boxmodel_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/charset_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/charset_rule.gif
new file mode 100644
index 0000000000..0e93844d92
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/charset_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/class_selector.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/class_selector.gif
new file mode 100644
index 0000000000..f924d7a684
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/class_selector.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/colback_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/colback_props.gif
new file mode 100644
index 0000000000..5ca230b289
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/colback_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/content_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/content_props.gif
new file mode 100644
index 0000000000..2133ded0bd
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/content_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyname.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyname.gif
new file mode 100644
index 0000000000..ede58abb89
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyname.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_function.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_function.gif
new file mode 100644
index 0000000000..6cd12dada0
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_function.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_identifier.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_identifier.gif
new file mode 100644
index 0000000000..2adbdd83b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_identifier.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_unit.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_unit.gif
new file mode 100644
index 0000000000..308a3ae841
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/css_propertyvalue_unit.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/font_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/font_props.gif
new file mode 100644
index 0000000000..aca5f8920b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/font_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/fontface_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/fontface_rule.gif
new file mode 100644
index 0000000000..71f59e8b7a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/fontface_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/id_selector.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/id_selector.gif
new file mode 100644
index 0000000000..f0857d284f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/id_selector.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_rule.gif
new file mode 100644
index 0000000000..94d89cd59e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_selector.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_selector.gif
new file mode 100644
index 0000000000..d85b78f29d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/link_selector.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/media_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/media_rule.gif
new file mode 100644
index 0000000000..3391f19bee
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/media_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/other_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/other_props.gif
new file mode 100644
index 0000000000..920c228d4a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/other_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/page_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/page_rule.gif
new file mode 100644
index 0000000000..525f64bc57
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/page_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/pagedmedia_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/pagedmedia_props.gif
new file mode 100644
index 0000000000..6b635b03d8
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/pagedmedia_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/pseudo.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/pseudo.gif
new file mode 100644
index 0000000000..1b6a6dc6aa
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/pseudo.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/sort.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/sort.gif
new file mode 100644
index 0000000000..23c5d0b11c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/sort.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/style_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/style_rule.gif
new file mode 100644
index 0000000000..3176ff8c5c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/style_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/stylesheet.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/stylesheet.gif
new file mode 100644
index 0000000000..d8fde00545
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/stylesheet.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/table_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/table_props.gif
new file mode 100644
index 0000000000..bcc76cd635
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/table_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/tag_selector.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/tag_selector.gif
new file mode 100644
index 0000000000..69850faf9a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/tag_selector.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/text_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/text_props.gif
new file mode 100644
index 0000000000..abf63f8568
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/text_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/ui_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/ui_props.gif
new file mode 100644
index 0000000000..99a8b96f98
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/ui_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/unknown_rule.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/unknown_rule.gif
new file mode 100644
index 0000000000..857e4e50ee
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/unknown_rule.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/full/obj16/visual_props.gif b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/visual_props.gif
new file mode 100644
index 0000000000..c1a8b34ed8
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/full/obj16/visual_props.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/icons/sourceEditor.gif b/bundles/org.eclipse.wst.css.ui/icons/sourceEditor.gif
new file mode 100644
index 0000000000..75ebdb8586
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/icons/sourceEditor.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.css.ui/plugin.properties b/bundles/org.eclipse.wst.css.ui/plugin.properties
new file mode 100644
index 0000000000..93720fea0a
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/plugin.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+SSE_CSS_Source_Editor.name=SSE CSS Source Editor
+SSE_CSS_Source_Editor_NL_Support.name=SSE CSS Source Editor NL Support
+CSS_Source_Page_Editor.name=CSS Source Page Editor
+CSS_Files.name=CSS Files
+CSS_Source.name=CSS Source
+CSS_Styles.name=CSS Styles
+CSS_Annotations.name=CSS Annotations
+WebContentSettings.name=Web Content Settings
diff --git a/bundles/org.eclipse.wst.css.ui/plugin.xml b/bundles/org.eclipse.wst.css.ui/plugin.xml
new file mode 100644
index 0000000000..72e53af13f
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/plugin.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.wst.css.ui"
+ name="%SSE_CSS_Source_Editor.name"
+ version="1.0.0"
+ provider-name="IBM"
+ class="org.eclipse.wst.css.ui.CSSEditorPlugin">
+
+ <runtime>
+ <library name="csseditor.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.core.runtime.compatibility"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.views"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.wst.xml.ui"/>
+ <import plugin="org.eclipse.wst.sse.ui"/>
+ <import plugin="org.eclipse.wst.css.core"/>
+ <import plugin="org.eclipse.wst.sse.core"/>
+ <import plugin="org.eclipse.wst.common.contentmodel"/>
+ <import plugin="org.eclipse.wst.html.core"/>
+ <import plugin="org.eclipse.wst.xml.core"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.wst.common.encoding"/>
+ </requires>
+
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="%CSS_Source_Page_Editor.name"
+ icon="icons/sourceEditor.gif"
+ extensions="css"
+ contributorClass="org.eclipse.wst.css.ui.ActionContributorCSS"
+ class="org.eclipse.wst.css.ui.StructuredTextEditorCSS"
+ symbolicFontName="org.eclipse.wst.sse.ui.textfont"
+ id="org.eclipse.wst.css.ui.StructuredTextEditorCSS">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.ui.extendedconfiguration">
+ <contentoutlineconfiguration
+ class="org.eclipse.wst.css.ui.views.contentoutline.CSSContentOutlineConfiguration"
+ target="org.eclipse.wst.css.core.csssource">
+ </contentoutlineconfiguration>
+ <textviewerconfiguration
+ class="org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS"
+ target="org.eclipse.wst.css.core.csssource">
+ </textviewerconfiguration>
+ <propertysheetconfiguration
+ class="org.eclipse.wst.css.ui.views.properties.CSSPropertySheetConfiguration"
+ target="org.eclipse.wst.css.core.csssource">
+ </propertysheetconfiguration>
+ <characterpairmatcher
+ class="org.eclipse.wst.css.ui.text.CSSDocumentRegionEdgeMatcher"
+ target="org.eclipse.wst.css.core.csssource">
+ </characterpairmatcher>
+ <preferencepages
+ preferenceids="org.eclipse.wst.sse.ui.preferences/org.eclipse.wst.sse.ui.preferences.css"
+ target="org.eclipse.wst.css.core.csssource">
+ </preferencepages>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
+ <adapterFactoryDescription
+ class="org.eclipse.wst.css.ui.registry.AdapterFactoryProviderCSS">
+ <contentType id="org.eclipse.wst.css.core.csssource"/>
+ </adapterFactoryDescription>
+ </extension>
+ <extension
+ point="org.eclipse.core.filebuffers.annotationModelCreation">
+ <factory
+ contentTypeId="org.eclipse.wst.css.core.csssource"
+ class="org.eclipse.wst.sse.ui.StructuredResourceMarkerAnnotationModelFactory"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ name="%CSS_Files.name"
+ category="org.eclipse.wst.sse.ui.preferences"
+ class="org.eclipse.wst.css.ui.preferences.ui.CSSFilesPreferencePage"
+ id="org.eclipse.wst.sse.ui.preferences.css">
+ </page>
+ <page
+ name="%CSS_Source.name"
+ category="org.eclipse.wst.sse.ui.preferences.css"
+ class="org.eclipse.wst.css.ui.preferences.ui.CSSSourcePreferencePage"
+ id="org.eclipse.wst.sse.ui.preferences.css.source">
+ </page>
+ <page
+ name="%CSS_Styles.name"
+ category="org.eclipse.wst.sse.ui.preferences.css"
+ class="org.eclipse.wst.css.ui.preferences.ui.CSSColorPage"
+ id="org.eclipse.wst.sse.ui.preferences.css.styles">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.css"
+ class="org.eclipse.wst.css.ui.contentproperties.ui.CSSContentSettingsPropertyPage"
+ id="org.eclipse.wst.css.ui.csspropertypage">
+ </page>
+ </extension>
+<!-- Editor actionsets -->
+ <extension
+ point="org.eclipse.ui.actionSetPartAssociations">
+ <actionSetPartAssociation
+ targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
+ <part
+ id="org.eclipse.wst.css.ui.StructuredTextEditorCSS">
+ </part>
+ </actionSetPartAssociation>
+ <actionSetPartAssociation
+ targetID="org.eclipse.ui.NavigateActionSet">
+ <part
+ id="org.eclipse.wst.css.ui.StructuredTextEditorCSS">
+ </part>
+ </actionSetPartAssociation>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.wst.css.ui/src/EditingCSS.properties b/bundles/org.eclipse.wst.css.ui/src/EditingCSS.properties
new file mode 100644
index 0000000000..2fa1626e12
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/EditingCSS.properties
@@ -0,0 +1,50 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+INFO_Not_Categorized_1=Not Categorized
+
+## CSS Preferences -- source ##
+PrefsLabel.WrappingWithoutAttr=Disable wrapping in style &attribute of HTML
+PrefsLabel.WrappingInsertLineBreak=Insert &line break between properties
+
+PrefsLabel.CaseGroup=Capitalization style
+PrefsLabel.CaseIdent=Identifier:
+PrefsLabel.CasePropName=Property name:
+PrefsLabel.CasePropValue=Property value:
+
+PrefsLabel.CaseIdentUpper=&Uppercase
+PrefsLabel.CaseIdentLower=L&owercase
+PrefsLabel.CasePropNameUpper=U&ppercase
+PrefsLabel.CasePropNameLower=Lo&wercase
+PrefsLabel.CasePropValueUpper=Upp&ercase
+PrefsLabel.CasePropValueLower=Lowe&rcase
+
+## CSS Preferences -- color ##
+
+## The following line is a sample CSS document. Please translate only the following parts:
+## Sample Styles
+PrefsLabel.ColorSample=@import url("../sample2.css");\n\n/* Sample Styles */\n\nBODY {\n\tcolor : black;\n\tbackground-color : rgb(181, 253, 211);\n\ttext-align : center;\n\tfont-family : "Heisei Mincho W3", serif\n}\n\n@page :left { margin-left : 4cm }\n\n@media aural {\n\tP.heidi {\n\t\tazimuth : center-left;\n\t\televation : 12.3deg;\n\t\tpause : 30ms 1.6s\n\t}\n}\n
+
+PrefsLabel.ColorNormal=Default
+PrefsLabel.ColorAtmarkRule=At-Rule
+PrefsLabel.ColorSelector=Selector
+PrefsLabel.ColorMedia=Media Name
+PrefsLabel.ColorComment=Comment
+PrefsLabel.ColorPropertyName=Property Name
+PrefsLabel.ColorPropertyValue=Property Value
+PrefsLabel.ColorUri=URI
+PrefsLabel.ColorString=Quoted String
+PrefsLabel.ColorColon=Property Delimiter
+PrefsLabel.ColorSemiColon=SemiColon
+PrefsLabel.ColorCurlyBrace=Curly Brace
+PrefsLabel.ColorError=Error
+#
+SortAction.0=Sort
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/ActionContributorCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/ActionContributorCSS.java
new file mode 100644
index 0000000000..3f6861c093
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/ActionContributorCSS.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.RetargetTextEditorAction;
+import org.eclipse.wst.sse.ui.edit.util.ActionContributor;
+import org.eclipse.wst.sse.ui.edit.util.ActionDefinitionIds;
+import org.eclipse.wst.sse.ui.edit.util.StructuredTextEditorActionConstants;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+
+/**
+ * ActionContributorCSS
+ *
+ * This class should not be used inside multi page editor's
+ * ActionBarContributor, since cascaded init() call from the
+ * ActionBarContributor will causes exception and it leads to lose whole
+ * toolbars.
+ *
+ * Instead, use SourcePageActionContributor for source page contributor of
+ * multi page editor.
+ *
+ * Note that this class is still valid for single page editor.
+ */
+public class ActionContributorCSS extends ActionContributor {
+ private static final String[] EDITOR_IDS = {"org.eclipse.wst.css.ui.StructuredTextEditorCSS", "org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$ //$NON-NLS-2$
+
+ protected RetargetTextEditorAction fContentAssist = null;
+ protected RetargetTextEditorAction fCleanupDocument = null;
+ protected MenuManager fFormatMenu = null;
+ protected RetargetTextEditorAction fFormatDocument = null;
+ protected RetargetTextEditorAction fFormatActiveElements = null;
+
+ public ActionContributorCSS() {
+ super();
+
+ ResourceBundle resourceBundle = ResourceHandler.getResourceBundle();
+
+ // edit commands
+ fContentAssist = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
+ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+
+ // source commands
+ fCleanupDocument = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
+ fCleanupDocument.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
+
+ fFormatDocument = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
+ fFormatDocument.setActionDefinitionId(ActionDefinitionIds.FORMAT_DOCUMENT);
+
+ fFormatActiveElements = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
+ fFormatActiveElements.setActionDefinitionId(ActionDefinitionIds.FORMAT_ACTIVE_ELEMENTS);
+
+ fFormatMenu = new MenuManager(ResourceHandler.getString("FormatMenu.label")); //$NON-NLS-1$
+ fFormatMenu.add(fFormatDocument);
+ fFormatMenu.add(fFormatActiveElements);
+ }
+
+ protected String[] getExtensionIDs() {
+ return EDITOR_IDS;
+ }
+
+ protected void addToMenu(IMenuManager menu) {
+ // edit commands
+ IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ if (editMenu != null) {
+ editMenu.add(fCommandsSeparator);
+ editMenu.add(fToggleInsertModeAction);
+ editMenu.add(fCommandsSeparator);
+ editMenu.add(fExpandSelectionToMenu);
+ editMenu.add(fCommandsSeparator);
+ editMenu.add(fContentAssist);
+ editMenu.add(fMenuAdditionsGroupMarker);
+ }
+
+ // source commands
+ String sourceMenuLabel = ResourceHandler.getString("SourceMenu.label"); //$NON-NLS-1$
+ String sourceMenuId = "sourceMenuId"; // This is just a menu id. No
+ // need to translate.
+ // //$NON-NLS-1$
+ IMenuManager sourceMenu = new MenuManager(sourceMenuLabel, sourceMenuId);
+ menu.insertAfter(IWorkbenchActionConstants.M_EDIT, sourceMenu);
+ if (sourceMenu != null) {
+ sourceMenu.add(fCommandsSeparator);
+ sourceMenu.add(fShiftRight);
+ sourceMenu.add(fShiftLeft);
+ sourceMenu.add(fCleanupDocument);
+ sourceMenu.add(fFormatMenu);
+ sourceMenu.add(fCommandsSeparator);
+ }
+ }
+
+ public void setActiveEditor(IEditorPart activeEditor) {
+ super.setActiveEditor(activeEditor);
+
+ ITextEditor textEditor = getTextEditor(activeEditor);
+
+ fContentAssist.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS));
+
+ fCleanupDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT));
+ fFormatDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT));
+ fFormatActiveElements.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/CSSEditorPlugin.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/CSSEditorPlugin.java
new file mode 100644
index 0000000000..fba4083373
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/CSSEditorPlugin.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.ui.style.IStyleConstantsCSS;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorHelper;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class CSSEditorPlugin extends AbstractUIPlugin {
+ public final static String ID = "org.eclipse.wst.css.ui"; //$NON-NLS-1$
+ //The shared instance.
+ private static CSSEditorPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public CSSEditorPlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.css.ui.CSSEditorPluginResources"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ // reference the preference store so
+ // initializeDefaultPreferences(IPreferenceStore preferenceStore) is
+ // called
+ getPreferenceStore();
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static CSSEditorPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = CSSEditorPlugin.getDefault().getResourceBundle();
+ try {
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+
+ // ignore this preference store
+ // use EditorPlugin preference store
+ IPreferenceStore editorStore = ((AbstractUIPlugin) Platform.getPlugin(EditorPlugin.ID)).getPreferenceStore();
+ EditorPlugin.initializeDefaultEditorPreferences(editorStore);
+
+ initializeDefaultCSSPreferences(editorStore);
+ }
+
+ private void initializeDefaultCSSPreferences(IPreferenceStore store) {
+ String ctId = IContentTypeIdentifier.ContentTypeID_CSS;
+
+ // CSS Style Preferences
+ String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$
+ String styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.NORMAL, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(63, 127, 127) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.ATMARK_RULE, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.SELECTOR, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(42, 0, 225) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.MEDIA, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(63, 95, 191) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.COMMENT, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(127, 0, 127) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.PROPERTY_NAME, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(42, 0, 225) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.PROPERTY_VALUE, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.URI, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.STRING, ctId), styleValue);
+
+ styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.COLON, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.SEMI_COLON, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.CURLY_BRACE, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(191, 63, 63) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsCSS.ERROR, ctId), styleValue);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextEditorCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextEditorCSS.java
new file mode 100644
index 0000000000..a929d5376d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextEditorCSS.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2001, 2004 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.wst.css.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.wst.css.ui.edit.ui.CleanupActionCSS;
+import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.css.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.css.ui.internal.selection.StructureSelectEnclosingCSSAction;
+import org.eclipse.wst.css.ui.internal.selection.StructureSelectNextCSSAction;
+import org.eclipse.wst.css.ui.internal.selection.StructureSelectPreviousCSSAction;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.edit.util.ActionDefinitionIds;
+import org.eclipse.wst.sse.ui.edit.util.StructuredTextEditorActionConstants;
+import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
+import org.eclipse.wst.sse.ui.internal.selection.StructureSelectHistoryAction;
+
+
+public class StructuredTextEditorCSS extends StructuredTextEditor {
+ protected void createActions() {
+ super.createActions();
+
+ ResourceBundle resourceBundle = ResourceHandler.getResourceBundle();
+
+ Action action = new CleanupActionCSS(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT + DOT, this);
+ action.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT, action);
+
+ SelectionHistory selectionHistory = new SelectionHistory(this);
+ action = new StructureSelectEnclosingCSSAction(this, selectionHistory);
+ action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_ENCLOSING);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_ENCLOSING, action);
+
+ action = new StructureSelectNextCSSAction(this, selectionHistory);
+ action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_NEXT);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_NEXT, action);
+
+ action = new StructureSelectPreviousCSSAction(this, selectionHistory);
+ action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_PREVIOUS);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_PREVIOUS, action);
+
+ action = new StructureSelectHistoryAction(this, selectionHistory);
+ action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_HISTORY);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_HISTORY, action);
+ selectionHistory.setHistoryAction((StructureSelectHistoryAction) action);
+ }
+
+ protected void initializeEditor() {
+ super.initializeEditor();
+ setHelpContextId(IHelpContextIds.CSS_SOURCEVIEW_HELPID);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
new file mode 100644
index 0000000000..dbc1089cc4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.text.IAutoEditStrategy;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.formatter.IContentFormatter;
+import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.wst.css.core.format.FormatProcessorCSS;
+import org.eclipse.wst.css.core.internal.text.rules.StructuredTextPartitionerForCSS;
+import org.eclipse.wst.css.ui.autoedit.StructuredAutoEditStrategyCSS;
+import org.eclipse.wst.css.ui.contentassist.CSSContentAssistProcessor;
+import org.eclipse.wst.css.ui.style.LineStyleProviderForCSS;
+import org.eclipse.wst.css.ui.taginfo.CSSBestMatchHoverProcessor;
+import org.eclipse.wst.sse.core.format.StructuredFormattingStrategy;
+import org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.style.IHighlighter;
+import org.eclipse.wst.sse.ui.taginfo.AnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.taginfo.ProblemAnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.util.EditorUtility;
+
+public class StructuredTextViewerConfigurationCSS extends StructuredTextViewerConfiguration {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.StructuredTextViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public Map getAutoEditStrategies(ISourceViewer sourceViewer) {
+ Map result = super.getAutoEditStrategies(sourceViewer);
+
+ if (result.get(StructuredTextPartitionerForCSS.ST_STYLE) == null)
+ result.put(StructuredTextPartitionerForCSS.ST_STYLE, new ArrayList(1));
+
+ IAutoEditStrategy autoEditStrategy = new StructuredAutoEditStrategyCSS();
+ List strategies = (List) result.get(StructuredTextPartitionerForCSS.ST_STYLE);
+ strategies.add(autoEditStrategy);
+
+ return result;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ if (configuredContentTypes == null) {
+ configuredContentTypes = new String[]{StructuredTextPartitionerForCSS.ST_STYLE, StructuredTextPartitioner.ST_DEFAULT_PARTITION, StructuredTextPartitioner.ST_UNKNOWN_PARTITION};
+ }
+ return configuredContentTypes;
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ IContentAssistant contentAssistant = super.getContentAssistant(sourceViewer);
+
+ if (contentAssistant != null && contentAssistant instanceof ContentAssistant) {
+ //((ContentAssistant)
+ // contentAssistant).setContentAssistProcessor(new
+ // CSSContentAssistProcessor(),
+ // StructuredTextPartitionerForCSS.ST_STYLE);
+ IContentAssistProcessor cssProcessor = new CSSContentAssistProcessor();
+ addContentAssistProcessor((ContentAssistant) contentAssistant, cssProcessor, StructuredTextPartitionerForCSS.ST_STYLE);
+ addContentAssistProcessor((ContentAssistant) contentAssistant, cssProcessor, StructuredTextPartitioner.ST_UNKNOWN_PARTITION);
+ }
+
+ return contentAssistant;
+ }
+
+ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
+ final MultiPassContentFormatter formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), StructuredTextPartitionerForCSS.ST_STYLE);
+
+ formatter.setMasterStrategy(new StructuredFormattingStrategy(new FormatProcessorCSS()));
+
+ return formatter;
+ }
+
+ public IHighlighter getHighlighter(ISourceViewer sourceViewer) {
+ IHighlighter highlighter = super.getHighlighter(sourceViewer);
+
+ if (highlighter != null) {
+ highlighter.addProvider(StructuredTextPartitionerForCSS.ST_STYLE, new LineStyleProviderForCSS());
+ }
+
+ return highlighter;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer,
+ * java.lang.String, int)
+ */
+ public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
+ // content type does not really matter since only combo, problem,
+ // annotation hover is available
+ TextHoverManager.TextHoverDescriptor[] hoverDescs = EditorPlugin.getDefault().getTextHoverManager().getTextHovers();
+ int i = 0;
+ while (i < hoverDescs.length) {
+ if (hoverDescs[i].isEnabled() && EditorUtility.computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+ String hoverType = hoverDescs[i].getId();
+ if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
+ return new CSSBestMatchHoverProcessor();
+ else if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
+ return new ProblemAnnotationHoverProcessor();
+ else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
+ return new AnnotationHoverProcessor();
+ }
+ i++;
+ }
+ return super.getTextHover(sourceViewer, contentType, stateMask);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/autoedit/StructuredAutoEditStrategyCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/autoedit/StructuredAutoEditStrategyCSS.java
new file mode 100644
index 0000000000..de3b80885d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/autoedit/StructuredAutoEditStrategyCSS.java
@@ -0,0 +1,501 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.autoedit;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentCommand;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.texteditor.ITextEditorExtension3;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.css.ui.internal.Logger;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.ui.edit.util.BasicAutoEditStrategy;
+
+public class StructuredAutoEditStrategyCSS extends BasicAutoEditStrategy {
+ protected IStructuredDocument structuredDocument = null;
+
+ class CompoundRegion {
+
+ CompoundRegion(IStructuredDocumentRegion documentRegion, ITextRegion textRegion) {
+ super();
+ this.documentRegion = documentRegion;
+ this.textRegion = textRegion;
+ }
+
+ IStructuredDocumentRegion getDocumentRegion() {
+ return documentRegion;
+ }
+
+ ITextRegion getTextRegion() {
+ return textRegion;
+ }
+
+ int getStart() {
+ return textRegion.getStart();
+ }
+
+ int getEnd() {
+ return textRegion.getEnd();
+ }
+
+ String getType() {
+ return textRegion.getType();
+ }
+
+ String getText() {
+ return documentRegion.getText(textRegion);
+ }
+
+ int getStartOffset() {
+ return documentRegion.getStartOffset(textRegion);
+ }
+
+ int getEndOffset() {
+ return documentRegion.getEndOffset(textRegion);
+ }
+
+ private IStructuredDocumentRegion documentRegion;
+ private ITextRegion textRegion;
+
+ }
+
+ /**
+ */
+ protected void autoIndentAfterClose(DocumentCommand command, String regionType) {
+ if (!setRangeForClose(command))
+ return;
+
+ int position = command.offset + command.length;
+
+ if (position == -1 || structuredDocument.getLength() == 0) {
+ return;
+ }
+
+ // get open brace region
+ CompoundRegion region = prevCorrespondence(position, regionType);
+
+ // get indentation
+ String str = getIndentFor(region, false);
+
+ // append to input
+ if (str != null)
+ command.text = str + command.text;
+ }
+
+ /**
+ * Copies the indentation of the previous line.
+ */
+ protected void autoIndentAfterNewLine(DocumentCommand command) {
+ // select nearest white spaces to replace with new-line
+ setRangeForNewLine(command);
+
+ // get position
+ int position = command.offset;
+
+ if (position == -1 || structuredDocument.getLength() == 0) {
+ return;
+ }
+
+ // get current region
+ CompoundRegion currentRegion = getRegion(command.offset + command.length);
+
+ // get key region
+ CompoundRegion keyRegion = getPrevKeyRegion(position, currentRegion);
+
+ // get indent string
+ String str = getIndentFor(keyRegion, true);
+
+ // check another indentation
+ int shift = needShift(keyRegion, command.offset + command.length);
+
+ // create text to replace
+ StringBuffer buf = new StringBuffer(command.text);
+ if (str != null)
+ buf.append(str);
+ while (shift-- != 0)
+ buf.append(CSSPreferenceHelper.getInstance().getIndentString());
+ command.text = buf.toString();
+
+ }
+
+ /**
+ */
+ public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
+ Object textEditor = getActiveTextEditor();
+ if (!(textEditor instanceof ITextEditorExtension3 && ((ITextEditorExtension3) textEditor).getInsertMode() == ITextEditorExtension3.SMART_INSERT))
+ return;
+
+ //return;
+ ///*
+ structuredDocument = (IStructuredDocument) document;
+
+ if (command.length == 0 && command.text != null) {
+ if (endsWith(document.getLegalLineDelimiters(), command.text) != -1) {
+ autoIndentAfterNewLine(command);
+ } else if (command.text.equals("}")) {//$NON-NLS-1$
+ autoIndentAfterClose(command, CSSRegionContexts.CSS_RBRACE);
+ } else if (command.text.equals("]")) {//$NON-NLS-1$
+ autoIndentAfterClose(command, CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END);
+ } else if (command.text.equals(")")) {//$NON-NLS-1$
+ autoIndentAfterClose(command, CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE);
+ }
+ }
+ //*/
+ }
+
+ /**
+ */
+ protected String getIndentFor(CompoundRegion region, boolean indentForNextRegion) {
+ if (region == null)
+ return null;
+ IStructuredDocumentRegion flatNode = region.getDocumentRegion();
+ if (flatNode == null)
+ return null;
+
+ try {
+ if (region.getType() == CSSRegionContexts.CSS_LBRACE || region.getType() == CSSRegionContexts.CSS_DELIMITER || region.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ // get meanful flat node
+ RegionIterator it = new RegionIterator(flatNode, region.getTextRegion());
+ it.prev();
+ while (it.hasPrev()) {
+ ITextRegion r = it.prev();
+ region = new CompoundRegion(it.getStructuredDocumentRegion(), r);
+ if (region.getType() != CSSRegionContexts.CSS_S)
+ break;
+ }
+ flatNode = region.getDocumentRegion();
+ // get indent string
+ int position = flatNode.getStart();
+ int line = structuredDocument.getLineOfOffset(position);
+ int start = structuredDocument.getLineOffset(line);
+ int end = findEndOfWhiteSpace(structuredDocument, start, position);
+ return structuredDocument.get(start, end - start);
+ } else if (region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START ||
+ //region.getType() == CSSRegionContexts.CSS_PARENTHESIS_OPEN ||
+ region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION || region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
+ int position = flatNode.getStart() + region.getStart();
+ int line = structuredDocument.getLineOfOffset(position);
+ int start = structuredDocument.getLineOffset(line);
+ int end = findEndOfWhiteSpace(structuredDocument, start, position);
+ StringBuffer buf = new StringBuffer(structuredDocument.get(start, end - start));
+ position += region.getText().length();
+ if (indentForNextRegion) {
+ int tokenStart = findEndOfWhiteSpace(structuredDocument, position, structuredDocument.getLineOffset(line) + structuredDocument.getLineLength(line) - 1);
+ if (tokenStart < structuredDocument.getLineOffset(line) + structuredDocument.getLineLength(line) - 1) {
+ position = tokenStart;
+ }
+ }
+ while (position - end > 0) {
+ buf.append(" ");//$NON-NLS-1$
+ end++;
+ }
+ return buf.toString();
+ } else
+ return "";//$NON-NLS-1$
+ } catch (BadLocationException excp) {
+ Logger.logException(excp);
+ }
+ return null;
+ }
+
+ /**
+ */
+ protected CompoundRegion getPrevKeyRegion(int position, CompoundRegion currentRegion) {
+ if (currentRegion == null) {
+ if (structuredDocument.getLastStructuredDocumentRegion() == null)
+ return null;
+ }
+
+ if (currentRegion != null && (currentRegion.getType() == CSSRegionContexts.CSS_RBRACE || currentRegion.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END || currentRegion.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)) {
+ return prevCorrespondence(currentRegion);
+ }
+
+ RegionIterator it = new RegionIterator(structuredDocument, position - 1);
+ while (it.hasPrev()) {
+ ITextRegion r = it.prev();
+ CompoundRegion region = new CompoundRegion(it.getStructuredDocumentRegion(), r);
+ if (region.getType() == CSSRegionContexts.CSS_LBRACE ||
+ // region.getType() == CSSRegionContexts.CSS_RBRACE ||
+ region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START ||
+ // region.getType() ==
+ // CSSRegionContexts.CSS_BRACKET_CLOSE ||
+ //// region.getType() ==
+ // CSSRegionContexts.CSS_PARENTHESIS_OPEN ||
+ // region.getType() ==
+ // CSSRegionContexts.CSS_PARENTHESIS_CLOSE ||
+ region.getType() == CSSRegionContexts.CSS_DELIMITER || region.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER ||
+ // region.getType() == CSSRegionContexts.CSS_COLON ||
+ // region.getType() == CSSRegionContexts.CSS_COMMENT
+ // ||
+ region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
+ return region;
+ } else if (region.getType() == CSSRegionContexts.CSS_RBRACE || region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END || region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
+ // skip to LBRACE
+ CompoundRegion pc = prevCorrespondence(region);
+ it.reset(pc.getDocumentRegion(), pc.getTextRegion());
+ it.prev();
+ } else if (region.getType() == CSSRegionContexts.CSS_STRING) {
+ RegionIterator itTmp = new RegionIterator(structuredDocument, position);
+ if (region == itTmp.prev())
+ return region; // position is inside of string
+ } else if (region.getType() == CSSRegionContexts.CSS_COMMENT) {
+ RegionIterator itTmp = new RegionIterator(structuredDocument, position);
+ if (region == itTmp.prev())
+ return region; // position is inside of comment
+ } else if (region.getType() == CSSRegionContexts.CSS_UNKNOWN) {
+ String str = region.getText();
+ if (str.charAt(str.length() - 1) == '\\')
+ return region;
+ } else if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
+ RegionIterator itPrev = new RegionIterator(region.getDocumentRegion(), region.getTextRegion());
+ while (itPrev.hasPrev()) {
+ ITextRegion regionPrev = itPrev.prev();
+ if (regionPrev.getType() == CSSRegionContexts.CSS_RBRACE) {
+ break;
+ } else if (regionPrev.getType() == CSSRegionContexts.CSS_DELIMITER || regionPrev.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ return region;
+ } else if (regionPrev.getType() == CSSRegionContexts.CSS_LBRACE) {
+ while (itPrev.hasPrev()) {
+ regionPrev = itPrev.prev();
+ if (regionPrev.getType() == CSSRegionContexts.CSS_MEDIA)
+ break;
+ if (regionPrev.getType() == CSSRegionContexts.CSS_LBRACE || regionPrev.getType() == CSSRegionContexts.CSS_RBRACE || regionPrev.getType() == CSSRegionContexts.CSS_DELIMITER || regionPrev.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER)
+ return region;
+ }
+ if (regionPrev.getType() == CSSRegionContexts.CSS_MEDIA)
+ break;
+ else
+ return region;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ */
+ protected CompoundRegion getRegion(int position) {
+ IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(position);
+ if (flatNode != null)
+ return new CompoundRegion(flatNode, flatNode.getRegionAtCharacterOffset(position));
+ return null;
+ }
+
+ /**
+ */
+ protected int needShift(CompoundRegion region, int position) {
+ int shift = 0;
+ if (region == null || region.getType() == CSSRegionContexts.CSS_DELIMITER || region.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER || region.getType() == CSSRegionContexts.CSS_LBRACE) {
+ // get non space region
+ CompoundRegion cr = getRegion(position - 1);
+ RegionIterator it = new RegionIterator(cr.getDocumentRegion(), cr.getTextRegion());
+ ITextRegion nearestRegion = null;
+ while (it.hasPrev()) {
+ nearestRegion = it.prev();
+ if (nearestRegion.getType() != CSSRegionContexts.CSS_S && nearestRegion.getType() != CSSRegionContexts.CSS_COMMENT)
+ break;
+ }
+ if (nearestRegion != null && (nearestRegion.getType() == CSSRegionContexts.CSS_LBRACE || nearestRegion.getType() == CSSRegionContexts.CSS_RBRACE || nearestRegion.getType() == CSSRegionContexts.CSS_DELIMITER || nearestRegion.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER))
+ shift--;
+ else if (region == null)
+ shift--;
+ shift++;
+ }
+ if (region != null && region.getType() == CSSRegionContexts.CSS_LBRACE) {
+ RegionIterator it = new RegionIterator(structuredDocument, position);
+ if (!it.hasPrev() || it.prev().getType() != CSSRegionContexts.CSS_RBRACE)
+ shift++;
+ else
+ shift = 0;
+ }
+ return shift;
+ }
+
+ /**
+ */
+ protected CompoundRegion prevCorrespondence(int position, String regionType) {
+ RegionIterator it = new RegionIterator(structuredDocument, position - 1);
+ ITextRegion region = null;
+ int nest = 1;
+ if (regionType == CSSRegionContexts.CSS_RBRACE) {
+ // skip to LBRACE
+ while (it.hasPrev()) {
+ region = it.prev();
+ if (region.getType() == CSSRegionContexts.CSS_LBRACE)
+ nest--;
+ else if (region.getType() == CSSRegionContexts.CSS_RBRACE)
+ nest++;
+ if (nest <= 0)
+ break;
+ }
+ if (nest == 0)
+ return new CompoundRegion(it.getStructuredDocumentRegion(), region);
+ }
+ if (regionType == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END) {
+ // skip to BRACKET_OPEN
+ while (it.hasPrev()) {
+ region = it.prev();
+ if (region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START)
+ nest--;
+ else if (region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END)
+ nest++;
+ if (nest <= 0)
+ break;
+ }
+ if (nest == 0)
+ return new CompoundRegion(it.getStructuredDocumentRegion(), region);
+ }
+ if (regionType == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
+ // skip to PARENTHESIS_OPEN
+ while (it.hasPrev()) {
+ region = it.prev();
+ if (//region.getType() ==
+ // CSSRegionContexts.CSS_PARENTHESIS_OPEN ||
+ region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
+ nest--;
+ else if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
+ nest++;
+ if (nest <= 0)
+ break;
+ }
+ if (nest == 0)
+ return new CompoundRegion(it.getStructuredDocumentRegion(), region);
+ }
+ return null;
+ }
+
+ /**
+ */
+ protected CompoundRegion prevCorrespondence(CompoundRegion region) {
+ if (region == null)
+ return null;
+
+ IStructuredDocumentRegion flatNode = region.getDocumentRegion();
+ int position = flatNode.getStart() + region.getStart();
+ return prevCorrespondence(position, region.getType());
+ }
+
+ /**
+ * Insert the method's description here.
+ *
+ * @return boolean
+ * @param command
+ * org.eclipse.jface.text.DocumentCommand
+ */
+ protected boolean setRangeForClose(DocumentCommand command) {
+ int position = command.offset;
+
+ if (position == -1 || structuredDocument.getLength() == 0) {
+ return false;
+ }
+
+ try {
+ // find start of line
+ int p = (position == structuredDocument.getLength() ? position - 1 : position);
+
+ int line = structuredDocument.getLineOfOffset(p);
+ int start = structuredDocument.getLineOffset(line);
+ RegionIterator it = new RegionIterator(structuredDocument, start);
+ boolean allWhiteSpace = false;
+ // check whether the text from lStart to position is white space
+ // or not
+ while (it.hasNext()) {
+ ITextRegion region = it.next();
+ if (region.getType() != CSSRegionContexts.CSS_S)
+ break;
+ if (it.getStructuredDocumentRegion().getEndOffset(region) > p) {
+ allWhiteSpace = true;
+ break;
+ }
+ }
+ if (allWhiteSpace) {
+ command.length = command.length - (start - command.offset);
+ command.offset = start;
+ return true;
+ }
+ } catch (BadLocationException excp) {
+ Logger.logException(excp);
+ }
+ return false;
+ }
+
+ /**
+ */
+ protected void setRangeForNewLine(DocumentCommand command) {
+ int position = command.offset;
+
+ if (position == -1 || structuredDocument.getLength() == 0) {
+ return;
+ }
+
+ try {
+ // add pre-nearest white spaces to replace target
+ if (position > 0) {
+ IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(position - 1);
+ if (flatNode != null) {
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(position - 1);
+ if (region.getType() == CSSRegionContexts.CSS_S) {
+ int end = command.offset + command.length;
+ int nLine = structuredDocument.getLineOfOffset(position);
+ int nStartPos = structuredDocument.getLineOffset(nLine);
+ if (nStartPos < flatNode.getStartOffset(region))
+ nStartPos = flatNode.getStartOffset(region);
+ command.offset = nStartPos;
+ command.length = end - command.offset;
+ }
+ }
+ }
+
+ // add post-nearest white spaces to replace target
+ if (position < structuredDocument.getLength()) {
+ IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(position);
+ if (flatNode != null) {
+ ITextRegion region = flatNode.getRegionAtCharacterOffset(position);
+ if (region.getType() == CSSRegionContexts.CSS_S) {
+ int nLine = structuredDocument.getLineOfOffset(position);
+ String currentLineDelim = structuredDocument.getLineDelimiter(nLine);
+ int nEndPos = structuredDocument.getLineOffset(nLine) + structuredDocument.getLineLength(nLine) - ((currentLineDelim != null) ? currentLineDelim.length() : 0);
+ if (nEndPos > flatNode.getEndOffset(region))
+ nEndPos = flatNode.getEndOffset(region);
+ command.length = nEndPos - command.offset;
+ }
+ }
+ }
+ } catch (BadLocationException e) {
+ // do not customize command
+ }
+
+ }
+
+ private static int endsWith(String[] searchStrings, String text) {
+ for (int i = 0; i < searchStrings.length; i++) {
+ if (text.endsWith(searchStrings[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ private static int findEndOfWhiteSpace(IDocument document, int offset, int end) throws BadLocationException {
+ while (offset < end) {
+ char c = document.getChar(offset);
+ if (c != ' ' && c != '\t') {
+ return offset;
+ }
+ offset++;
+ }
+ return end;
+ }
+
+}
+
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSCACandidate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSCACandidate.java
new file mode 100644
index 0000000000..2987933e44
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSCACandidate.java
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import org.eclipse.wst.css.ui.image.CSSImageType;
+
+class CSSCACandidate {
+
+ private String fReplacementString = null;
+ private int fCursorPosition = 0;
+ private String fDisplayString = null;
+ private CSSImageType fImageType = null;
+
+ /**
+ * CSSCACandidate constructor comment.
+ */
+ CSSCACandidate() {
+ super();
+ }
+
+ /**
+ *
+ */
+ int getCursorPosition() {
+ return fCursorPosition;
+ }
+
+ /**
+ *
+ */
+ String getDisplayString() {
+ return fDisplayString;
+ }
+
+ /**
+ *
+ */
+ CSSImageType getImageType() {
+ return fImageType;
+ }
+
+ /**
+ *
+ */
+ String getReplacementString() {
+ return fReplacementString;
+ }
+
+ /**
+ *
+ */
+ void setCursorPosition(int cursorPosition) {
+ fCursorPosition = cursorPosition;
+ }
+
+ /**
+ *
+ */
+ void setDisplayString(String displayString) {
+ fDisplayString = displayString;
+ }
+
+ /**
+ *
+ */
+ void setImageType(CSSImageType imageType) {
+ fImageType = imageType;
+ }
+
+ /**
+ *
+ */
+ void setReplacementString(String replacementString) {
+ fReplacementString = replacementString;
+ }
+
+ /**
+ * Returns a String that represents the value of this object.
+ *
+ * @return a string representation of the receiver
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getReplacementString());
+ buf.append("\"");//$NON-NLS-1$
+ buf.append(getDisplayString());
+ buf.append("\"");//$NON-NLS-1$
+ buf.append("(");//$NON-NLS-1$
+ buf.append(getCursorPosition());
+ buf.append(")");//$NON-NLS-1$
+
+ return buf.toString();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistContext.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistContext.java
new file mode 100644
index 0000000000..3d1baeda6e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistContext.java
@@ -0,0 +1,454 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelFinder;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+class CSSContentAssistContext {
+
+ private int fReplaceBegin = -1;
+ private String fTextToReplace = null;
+ private String fTextToCompare = null;
+ private int fTargetPos = -1;
+ private ICSSNode fTargetNode = null;
+ private int fCursorPos = -1;
+ private IStructuredDocument fStructuredDocument = null;
+ private int fDocumentOffset = 0;
+ private char fQuote = 0;
+ private ICSSModel fModel = null;
+
+ /**
+ *
+ */
+ private CSSContentAssistContext() {
+ super();
+ }
+
+ /**
+ *
+ */
+ CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, char quote) {
+ super();
+ fCursorPos = documentPosition;
+ fDocumentOffset = documentOffset;
+ fQuote = quote;
+ initialize(node.getOwnerDocument());
+ }
+
+ /**
+ * @return int
+ */
+ int getCursorPos() {
+ return fCursorPos;
+ }
+
+ /**
+ * @return int
+ */
+ int getDocumentOffset() {
+ return fDocumentOffset;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.IStructuredDocument
+ */
+ IStructuredDocument getStructuredDocument() {
+ return fStructuredDocument;
+ }
+
+ /**
+ * @return com.ibm.sse.model.css.model.ICSSModel
+ */
+ ICSSModel getModel() {
+ return fModel;
+ }
+
+ private ICSSNode getNodeAt(int offset) {
+ return (ICSSNode) ((fModel != null) ? fModel.getIndexedRegion(offset) : null);
+ }
+
+ /**
+ *
+ * @return char
+ */
+ char getQuoteOfStyleAttribute() {
+ return fQuote;
+ }
+
+ /**
+ *
+ */
+ ITextRegion getRegionByOffset(int offset) {
+ ITextRegion region = null;
+ if (fStructuredDocument != null) {
+ IStructuredDocumentRegion flatNode = fStructuredDocument.getRegionAtCharacterOffset(offset);
+ if (flatNode != null) {
+ region = flatNode.getRegionAtCharacterOffset(offset);
+ }
+ }
+ return region;
+ }
+
+ /**
+ *
+ */
+ // String getRegionText() {
+ // ITextRegion targetRegion = getTargetRegion();
+ // if (targetRegion != null) {
+ // return targetRegion.getText();
+ // } else {
+ // return ""; //$NON-NLS-1$
+ // }
+ // }
+ /**
+ *
+ */
+ int getReplaceBegin() {
+ return fReplaceBegin;
+ }
+
+ /**
+ *
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ */
+ // ITextRegion getSignificantTargetRegion() {
+ // ITextRegion targetRegion = getTargetRegion();
+ // RegionIterator iterator = null;
+ // if (targetRegion == null) {
+ // if (0 < fCursorPos) {
+ // iterator = new RegionIterator(fStructuredDocument, fCursorPos - 1);
+ // }
+ // } else {
+ // iterator = getRegionIterator();
+ // }
+ // if (iterator != null) {
+ // while (iterator.hasPrev()) {
+ // ITextRegion region = iterator.prev();
+ // String type = region.getType();
+ // if (type != CSSRegionContexts.CSS_S && type !=
+ // CSSRegionContexts.CSS_COMMENT &&
+ // type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC)
+ // {
+ // targetRegion = region;
+ // break;
+ // }
+ // }
+ // }
+ //
+ // return targetRegion;
+ // }
+ /**
+ *
+ */
+ ICSSNode getTargetNode() {
+ return fTargetNode;
+ }
+
+ /**
+ *
+ */
+ private int getTargetPos() {
+ return fTargetPos;
+ }
+
+ /**
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ */
+ ITextRegion getTargetRegion() {
+ return getRegionByOffset(getTargetPos());
+ }
+
+ private IStructuredDocumentRegion getTargetDocumentRegion() {
+ return getDocumentRegionByOffset(getTargetPos());
+ }
+
+ private IStructuredDocumentRegion getDocumentRegionByOffset(int offset) {
+ return (fStructuredDocument != null) ? fStructuredDocument.getRegionAtCharacterOffset(offset) : null;
+ }
+
+ /**
+ *
+ * @return com.ibm.sed.structuredDocument.ITextRegion
+ */
+ ITextRegion getTargetRegionPrevious() {
+ ITextRegion previousRegion = null;
+ ITextRegion targetRegion = getTargetRegion();
+ RegionIterator iterator = null;
+ if (targetRegion == null) {
+ if (0 < fCursorPos) {
+ iterator = new RegionIterator(fStructuredDocument, fCursorPos - 1);
+ }
+ } else {
+ iterator = getRegionIterator();
+ if (iterator.hasPrev()) {
+ iterator.prev();
+ } else {
+ iterator = null;
+ }
+ }
+ if (iterator != null) {
+ while (iterator.hasPrev()) {
+ ITextRegion region = iterator.prev();
+ String type = region.getType();
+ if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) {
+ previousRegion = region;
+ break;
+ }
+ }
+ }
+
+ return previousRegion;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ String getTextToCompare() {
+ return fTextToCompare;
+ }
+
+ /**
+ *
+ */
+ String getTextToReplace() {
+ return fTextToReplace;
+ }
+
+ /**
+ *
+ */
+ private void initialize(ICSSDocument doc) {
+ if (doc == null) {
+ return;
+ }
+ ICSSModel model = doc.getModel();
+ fModel = model;
+ fStructuredDocument = model.getStructuredDocument();
+
+ initializeTargetPos();
+ initializeTargetText();
+ initializeTargetNode();
+ }
+
+ /**
+ *
+ */
+ private void initializeTargetNode() {
+ if (fCursorPos == 0) {
+ fTargetNode = fModel.getDocument();
+ return;
+ }
+
+ // find edge of tree node
+ ICSSNode cursorNode = getNodeAt(fCursorPos);
+ if (cursorNode == null) { // end of document
+ cursorNode = fModel.getDocument();
+ }
+ ICSSNode node = null;
+ IStructuredDocumentRegion flatNode = fStructuredDocument.getRegionAtCharacterOffset(fCursorPos - 1);
+ while (flatNode != null && (node = getNodeAt(flatNode.getStartOffset())) == cursorNode && ((IndexedRegion) node).getStartOffset() != flatNode.getStartOffset()) {
+ flatNode = flatNode.getPrevious();
+ }
+ if (flatNode == null) { // top of document
+ fTargetNode = (node == null) ? fModel.getDocument() : node;
+ return;
+ }
+ // v<--|
+ // AAAAAA
+ // BBBBBBBBBB cursorNode:A , node:B -> target is A
+ if (cursorNode != null) {
+ for (ICSSNode parent = cursorNode.getParentNode(); parent != null; parent = parent.getParentNode()) {
+ if (parent == cursorNode) {
+ fTargetNode = cursorNode;
+ return;
+ }
+ }
+ }
+ // v<--|
+ // AAA
+ // BBBBBBBBBB cursorNode:B , node:A -> depend on A's node type
+ short nodeType = node.getNodeType();
+ if (nodeType == ICSSNode.STYLEDECLITEM_NODE || nodeType == ICSSNode.CHARSETRULE_NODE || nodeType == ICSSNode.IMPORTRULE_NODE) {
+ String type = CSSUtil.getStructuredDocumentRegionType(flatNode);
+ if (type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ fTargetNode = node.getParentNode();
+ } else {
+ fTargetNode = node;
+ }
+ // fTargetNode = (bOverSemiColon) ? node.getParentNode() : node;
+ } else if (CSSUtil.getStructuredDocumentRegionType(flatNode) == CSSRegionContexts.CSS_RBRACE) {
+ fTargetNode = node.getParentNode();
+ } else {
+ fTargetNode = node;
+ }
+
+ return;
+ }
+
+ /**
+ *
+ */
+ private void initializeTargetPos() {
+ if (fCursorPos == 0 || isSpecialDelimiterRegion(fCursorPos - 1)) {
+ fTargetPos = fCursorPos;
+ } else {
+ fTargetPos = fCursorPos - 1;
+ }
+ }
+
+ /**
+ *
+ */
+ private void initializeTargetText() {
+ ITextRegion targetRegion = getTargetRegion();
+ IStructuredDocumentRegion documentRegion = getTargetDocumentRegion();
+ if (targetRegion == null) {
+ fReplaceBegin = fCursorPos;
+ fTextToReplace = ""; //$NON-NLS-1$
+ fTextToCompare = ""; //$NON-NLS-1$
+ } else {
+ String regionText = documentRegion.getText(targetRegion);
+ int regionStart = documentRegion.getStartOffset(targetRegion);
+ if (regionStart == fCursorPos || regionText.trim().length() == 0 || regionStart + regionText.length() - 1 < fTargetPos) {
+ // to insertion
+ fReplaceBegin = fCursorPos;
+ fTextToReplace = ""; //$NON-NLS-1$
+ fTextToCompare = ""; //$NON-NLS-1$
+ } else {
+ // to replace
+ fReplaceBegin = regionStart;
+ fTextToReplace = regionText;
+ fTextToCompare = regionText.substring(0, fCursorPos - fReplaceBegin);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private boolean isSpecialDelimiterRegion(int pos) {
+ ITextRegion region = getRegionByOffset(pos);
+ String type = region.getType();
+ return (type == CSSRegionContexts.CSS_LBRACE || type == CSSRegionContexts.CSS_RBRACE || type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR);
+ }
+
+ /**
+ *
+ */
+ boolean isTargetPosAfterOf(String regionType) {
+ int start = ((IndexedRegion) fTargetNode).getStartOffset();
+ if (start < 0 || ((IndexedRegion) fTargetNode).getEndOffset() <= 0) {
+ return false;
+ }
+
+ RegionIterator iRegion = new RegionIterator(fStructuredDocument, start);
+ while (iRegion.hasNext()) {
+ ITextRegion region = iRegion.next();
+ if (fTargetPos < iRegion.getStructuredDocumentRegion().getTextEndOffset(region)) {
+ break;
+ }
+ if (region.getType() == regionType) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ boolean isTargetPosBeforeOf(String regionType) {
+ return !isTargetPosAfterOf(regionType);
+ }
+
+ /**
+ * @return boolean
+ * @param regionType
+ * java.lang.String
+ */
+ boolean targetFollows(String regionType) {
+ RegionIterator iRegion;
+ ITextRegion region = null;
+ if (fStructuredDocument.getLength() <= fTargetPos) {
+ iRegion = new RegionIterator(fStructuredDocument, fStructuredDocument.getLength() - 1);
+ } else {
+ iRegion = new RegionIterator(fStructuredDocument, fTargetPos);
+ try {
+ if (!Character.isWhitespace(fStructuredDocument.getChar(fTargetPos)) && iRegion.hasPrev()) {
+ region = iRegion.prev();
+ }
+ } catch (BadLocationException e) {
+ iRegion = new RegionIterator(fStructuredDocument, fStructuredDocument.getLength() - 1);
+ }
+ }
+ while (iRegion.hasPrev()) {
+ region = iRegion.prev();
+ String type = region.getType();
+ if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ if (region != null && region.getType() == regionType) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ *
+ */
+ boolean targetHas(String regionType) {
+ int start = ((IndexedRegion) fTargetNode).getStartOffset();
+ int end = ((IndexedRegion) fTargetNode).getEndOffset();
+ if (start < 0 || end <= 0) {
+ return false;
+ }
+ RegionIterator iRegion = new RegionIterator(fStructuredDocument, start);
+ while (iRegion.hasNext()) {
+ ITextRegion region = iRegion.next();
+ if (end <= iRegion.getStructuredDocumentRegion().getStartOffset(region)) {
+ break;
+ }
+ if (region.getType() == regionType) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ RegionIterator getRegionIterator() {
+ return new RegionIterator(getStructuredDocument(), getTargetPos());
+ }
+
+ /**
+ *
+ */
+ CSSMetaModel getMetaModel() {
+ CSSMetaModelFinder finder = CSSMetaModelFinder.getInstance();
+ return finder.findMetaModelFor(getModel());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistProcessor.java
new file mode 100644
index 0000000000..50f1d6ddec
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSContentAssistProcessor.java
@@ -0,0 +1,273 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.wst.css.core.adapters.ICSSModelAdapter;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.html.core.htmlcss.StyleAdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.ui.contentassist.XMLContentAssistUtilities;
+import org.eclipse.wst.xml.ui.util.SharedXMLEditorPluginImageHelper;
+
+public class CSSContentAssistProcessor implements IContentAssistProcessor {
+
+ private int fDocumentOffset = 0;
+ private char fQuote = 0;
+
+ /**
+ * Return a list of proposed code completions based on the specified
+ * location within the document that corresponds to the current cursor
+ * position within the text-editor control.
+ *
+ * @param documentPosition
+ * a location within the document
+ * @return an array of code-assist items
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentPosition) {
+
+ IndexedRegion indexedNode = ContentAssistUtils.getNodeAt((StructuredTextViewer) viewer, documentPosition + fDocumentOffset);
+ IndexedRegion keyIndexedNode = null;
+ XMLNode xNode = null;
+ XMLNode parent = null;
+ IStructuredModel cssModel = null;
+ CSSProposalArranger arranger = null;
+
+ // bail if we couldn't get an indexed node
+ //if(indexedNode == null) return new ICompletionProposal[0];
+ if (indexedNode instanceof XMLNode) {
+ xNode = (XMLNode) indexedNode;
+ parent = (XMLNode) xNode.getParentNode();
+ }
+ // need to get in here if there in the no 0 region <style>|</style>
+ // case
+ if (xNode != null && xNode.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
+ // now we know the cursor is in a <style> tag w/out region
+ cssModel = getCSSModel(xNode);
+ if (cssModel == null)
+ return new ICompletionProposal[0];
+
+ // adjust offsets for embedded style
+ int offset = documentPosition;
+ int pos = 0;
+ keyIndexedNode = cssModel.getIndexedRegion(pos);
+ if (keyIndexedNode == null) {
+ keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
+ }
+ arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, (char) 0);
+
+ } else if (parent != null && parent.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
+ // now we know the cursor is in a <style> tag with a region
+ // use the parent because that will be the <style> tag
+ cssModel = getCSSModel(parent);
+ if (cssModel == null)
+ return new ICompletionProposal[0];
+
+ // adjust offsets for embedded style
+ int offset = indexedNode.getStartOffset();
+ int pos = documentPosition - offset;
+ keyIndexedNode = cssModel.getIndexedRegion(pos);
+ if (keyIndexedNode == null) {
+ keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
+ }
+ arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, (char) 0);
+ } else if (indexedNode instanceof XMLNode) {
+ // get model for node w/ style attribute
+ cssModel = getCSSModel((XMLNode) indexedNode);
+ } else if (indexedNode instanceof ICSSNode) {
+ // when editing external CSS using CSS Designer, ICSSNode is
+ // passed.
+ ICSSDocument cssdoc = ((ICSSNode) indexedNode).getOwnerDocument();
+ if (cssdoc != null) {
+ cssModel = cssdoc.getModel();
+ }
+ } else if (indexedNode == null && isViewerEmpty(viewer) && viewer instanceof StructuredTextViewer) {
+ // the top of empty CSS Document
+ IStructuredModel model = ((StructuredTextViewer) viewer).getModel();
+ if (model instanceof ICSSModel) {
+ cssModel = (ICSSModel) model;
+ }
+ }
+
+ if (cssModel == null)
+ return new ICompletionProposal[0];
+
+ keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset);
+ if (keyIndexedNode == null) {
+ keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
+ }
+
+ if (!(keyIndexedNode instanceof ICSSNode)) {
+ return new ICompletionProposal[0];
+ }
+
+ if (arranger == null) {
+ // if it's null at this point, it must be inline style for a tag,
+ // not embedded
+ arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote);
+ }
+ fDocumentOffset = 0;
+ ICompletionProposal[] temp = arranger.getProposals();
+
+ // add end tag if parent is not closed
+ ICompletionProposal endTag = XMLContentAssistUtilities.computeXMLEndTagProposal(viewer, documentPosition, indexedNode, HTML40Namespace.ElementName.STYLE, SharedXMLEditorPluginImageHelper.IMG_OBJ_TAG_GENERIC); //$NON-NLS-1$
+ if (endTag == null)
+ return temp;
+ else {
+ ICompletionProposal[] plusOne = new ICompletionProposal[temp.length + 1];
+ System.arraycopy(temp, 0, plusOne, 1, temp.length);
+ plusOne[0] = endTag;
+ return plusOne;
+ }
+ }
+
+ /**
+ * Returns true if there is no text or it's all white space, otherwise
+ * returns false
+ *
+ * @param treeNode
+ * @param textViewer
+ * @return boolean
+ */
+ private boolean isViewerEmpty(ITextViewer textViewer) {
+ boolean isEmpty = false;
+ String text = textViewer.getTextWidget().getText();
+ if (text == null || (text != null && text.trim().equals(""))) //$NON-NLS-1$
+ isEmpty = true;
+ return isEmpty;
+ }
+
+ /**
+ * Get CSSModel for an indexed node
+ *
+ * @param indexedNode
+ * @return IStructuredModel
+ */
+ // private IStructuredModel getCSSModel(IndexedRegion indexedNode) {
+ // if (indexedNode == null) return null;
+ // Node node = (Node)indexedNode;
+ // INodeNotifier notifier = (INodeNotifier)node.getParentNode();
+ // if (notifier == null) return null;
+ // INodeAdapter adapter =
+ // StyleAdapterFactory.getInstance().adapt(notifier);
+ // if (adapter == null || !(adapter instanceof CSSModelAdapter)) return
+ // null;
+ // CSSModelAdapter modelAdapter = (CSSModelAdapter)adapter;
+ // return modelAdapter.getModel();
+ // }
+ /**
+ * Returns the CSSmodel for a given XML node.
+ *
+ * @param element
+ * @return IStructuredModel
+ */
+ private IStructuredModel getCSSModel(XMLNode element) {
+ if (element == null)
+ return null;
+ INodeAdapter adapter = StyleAdapterFactory.getInstance().adapt(element);
+ if (adapter == null || !(adapter instanceof ICSSModelAdapter))
+ return null;
+ ICSSModelAdapter modelAdapter = (ICSSModelAdapter) adapter;
+ return modelAdapter.getModel();
+ }
+
+ /**
+ * Returns information about possible contexts based on the specified
+ * location within the document that corresponds to the current cursor
+ * position within the text viewer.
+ *
+ * @param viewer
+ * the viewer whose document is used to compute the possible
+ * contexts
+ * @param documentPosition
+ * an offset within the document for which context information
+ * should be computed
+ * @return an array of context information objects or <code>null</code>
+ * if no context could be found
+ */
+ public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer, int documentOffset) {
+ return null;
+ }
+
+ /**
+ * Returns the characters which when entered by the user should
+ * automatically trigger the presentation of possible completions.
+ *
+ * @return the auto activation characters for completion proposal or
+ * <code>null</code> if no auto activation is desired
+ */
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return null;
+ }
+
+ /**
+ * Returns the characters which when entered by the user should
+ * automatically trigger the presentation of context information.
+ *
+ * @return the auto activation characters for presenting context
+ * information or <code>null</code> if no auto activation is
+ * desired
+ */
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
+
+ /**
+ * Returns a validator used to determine when displayed context
+ * information should be dismissed. May only return <code>null</code> if
+ * the processor is incapable of computing context information.
+ *
+ * @return a context information validator, or <code>null</code> if the
+ * processor is incapable of computing context information
+ */
+ public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator() {
+ return null;
+ }
+
+ /**
+ * Return the reason why computeProposals was not able to find any
+ * completions.
+ *
+ * @return an error message or null if no error occurred
+ */
+ public String getErrorMessage() {
+ return null;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (2001/05/22
+ * 10:37:05)
+ *
+ * @param offset
+ * int
+ */
+ public void setDocumentOffset(int offset) {
+ fDocumentOffset = offset;
+ }
+
+ /**
+ *
+ * @param quote
+ * char
+ */
+ public void setQuoteCharOfStyleAttribute(char quote) {
+ fQuote = quote;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalArranger.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalArranger.java
new file mode 100644
index 0000000000..854e87d1ca
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalArranger.java
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.w3c.dom.css.CSSFontFaceRule;
+
+class CSSProposalArranger {
+
+ private List fProposals = new ArrayList();
+ private CSSContentAssistContext fContext = null;
+
+ /**
+ * CSSProposalArranger constructor comment.
+ */
+ private CSSProposalArranger() {
+ super();
+ }
+
+ /**
+ * CSSProposalArranger constructor comment.
+ */
+ CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, char quote) {
+ super();
+ fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, quote);
+ }
+
+ /**
+ *
+ */
+ void buildProposals() {
+ fProposals.clear();
+
+ /*
+ * String text; ICompletionProposal item; text = "---- Test
+ * Information ----"; item = new CompletionProposal("",
+ * fContext.getReplaceBegin(), 0, 0, null, text, null, null);
+ * fProposals.add(item);
+ *
+ * text = "Target: \"" + fContext.getRegionText() + "\"";
+ *
+ * item = new CompletionProposal("", fContext.getReplaceBegin(), 0, 0,
+ * null, text, null, null); fProposals.add(item);
+ *
+ * text = fContext.getTargetNode().getClass().toString(); int
+ * lastPeriodPos = text.lastIndexOf('.'); text = "Node: " +
+ * text.substring(lastPeriodPos + 1); item = new
+ * CompletionProposal("", fContext.getReplaceBegin(), 0, 0, null,
+ * text, null, null); fProposals.add(item);
+ */
+
+ ICSSNode targetNode = fContext.getTargetNode();
+ //int targetPos = fContext.getTargetPos();
+ if (targetNode instanceof ICSSStyleSheet) {
+ buildProposalsForAnyRule();
+ } else if ((targetNode instanceof ICSSMediaRule && fContext.isTargetPosAfterOf(CSSRegionContexts.CSS_LBRACE)) || (targetNode instanceof ICSSStyleRule && fContext.isTargetPosBeforeOf(CSSRegionContexts.CSS_LBRACE))) {
+ buildProposalsForAnyRule();
+ // buildProposalsForStyleRule();
+ } else if ((targetNode instanceof ICSSPageRule && fContext.isTargetPosBeforeOf(CSSRegionContexts.CSS_LBRACE))) {
+ buildProposalsForPageRulePseudoClass();
+ } else if ((targetNode instanceof ICSSStyleRule || targetNode instanceof CSSFontFaceRule || targetNode instanceof ICSSPageRule || targetNode instanceof ICSSStyleDeclaration) && (targetNode.getOwnerDocument() instanceof ICSSStyleDeclaration || fContext.targetFollows(CSSRegionContexts.CSS_DECLARATION_DELIMITER) || fContext.targetFollows(CSSRegionContexts.CSS_LBRACE))) {
+ buildProposalsForDeclarationName();
+ } else if (targetNode instanceof ICSSStyleDeclItem) {
+ if (fContext.isTargetPosAfterOf(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) {
+ buildProposalsForDeclarationValue();
+ } else {
+ buildProposalsForDeclarationName();
+ }
+ } else if (targetNode instanceof ICSSPrimitiveValue) {
+ buildProposalsForDeclarationValue();
+ }
+ /*
+ * else if (targetNode instanceof ICSSPrimitiveValue || ((targetNode
+ * instanceof ICSSStyleRule || targetNode instanceof CSSFontFaceRule ||
+ * targetNode instanceof ICSSStyleDeclaration || targetNode instanceof
+ * ICSSStyleDeclItem) &&
+ * fContext.isTargetPosAfterOf(CSSRegionContexts.COLON))) {
+ * buildProposalsForDeclarationValue(); }
+ */
+
+ // for Test
+ }
+
+ /**
+ *
+ */
+ void buildProposalsForAnyRule() {
+ CSSProposalGenerator generator;
+ generator = new CSSProposalGeneratorForAtmarkRule(fContext);
+ fProposals.addAll(generator.getProposals());
+ generator = new CSSProposalGeneratorForHTMLTag(fContext);
+ fProposals.addAll(generator.getProposals());
+ generator = new CSSProposalGeneratorForPseudoSelector(fContext);
+ fProposals.addAll(generator.getProposals());
+ }
+
+ /**
+ *
+ */
+ void buildProposalsForDeclarationName() {
+ CSSProposalGenerator generator;
+ generator = new CSSProposalGeneratorForDeclarationName(fContext);
+ fProposals.addAll(generator.getProposals());
+ }
+
+ /**
+ *
+ */
+ void buildProposalsForDeclarationValue() {
+ CSSProposalGenerator generator;
+ generator = new CSSProposalGeneratorForDeclarationValue(fContext);
+ fProposals.addAll(generator.getProposals());
+ }
+
+ /**
+ *
+ */
+ void buildProposalsForPageRulePseudoClass() {
+ CSSProposalGenerator generator;
+ generator = new CSSProposalGeneratorForPseudoSelector(fContext);
+ fProposals.addAll(generator.getProposals());
+ }
+
+ /**
+ *
+ */
+ void buildProposalsForStyleRule() {
+ CSSProposalGenerator generator;
+ generator = new CSSProposalGeneratorForHTMLTag(fContext);
+ fProposals.addAll(generator.getProposals());
+ generator = new CSSProposalGeneratorForPseudoSelector(fContext);
+ fProposals.addAll(generator.getProposals());
+ }
+
+ /**
+ *
+ */
+ ICompletionProposal[] getProposals() {
+ buildProposals();
+ ICompletionProposal[] proposalArray = new CompletionProposal[fProposals.size()];
+ Iterator iItem = fProposals.iterator();
+ for (int i = 0; iItem.hasNext(); i++) {
+ proposalArray[i] = (ICompletionProposal) iItem.next();
+ }
+ return proposalArray;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGenerator.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGenerator.java
new file mode 100644
index 0000000000..483645adfe
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGenerator.java
@@ -0,0 +1,209 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.css.ui.image.CSSImageHelper;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+abstract class CSSProposalGenerator {
+
+
+ protected class StringAndOffset {
+ StringAndOffset(String string, int offset) {
+ this.fString = string;
+ this.fOffset = offset;
+ }
+
+ String fString;
+ int fOffset;
+ }
+
+ protected CSSContentAssistContext fContext = null;
+
+ /**
+ * CSSProposalGenerator constructor comment.
+ */
+ private CSSProposalGenerator() {
+ super();
+ }
+
+ CSSProposalGenerator(CSSContentAssistContext context) {
+ super();
+ fContext = context;
+ }
+
+ /**
+ *
+ */
+ protected boolean checkLeadingColon() {
+ boolean hasLeadingColon = false;
+ ITextRegion targetRegion = fContext.getTargetRegion();
+ if (targetRegion == null && 0 < fContext.getCursorPos()) {
+ targetRegion = fContext.getRegionByOffset(fContext.getCursorPos() - 1);
+ if (targetRegion != null && targetRegion.getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) {
+ hasLeadingColon = true;
+ }
+ } else if (targetRegion != null) {
+ RegionIterator iterator = fContext.getRegionIterator();
+ if (iterator.hasPrev()) {
+ iterator.prev();
+ if (iterator.hasPrev() && iterator.prev().getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) {
+ hasLeadingColon = true;
+ }
+ }
+ }
+ return hasLeadingColon;
+ }
+
+ /**
+ *
+ */
+ protected StringAndOffset generateBraces() {
+ StringBuffer buf = new StringBuffer();
+ String lineDelimiter = fContext.getStructuredDocument().getLineDelimiter();
+ CSSPreferenceHelper prefs = CSSPreferenceHelper.getInstance();
+ String indentStr = prefs.getIndentString();
+ if (prefs.isNewLineOnOpenBrace()) {
+ buf.append(lineDelimiter);
+ }
+ buf.append("{");//$NON-NLS-1$
+ if (prefs.isOnePropertyPerLine()) {
+ buf.append(lineDelimiter);
+ buf.append(indentStr);
+ } else {
+ buf.append(" ");//$NON-NLS-1$
+ }
+ int offset = buf.length();
+ if (prefs.isOnePropertyPerLine()) {
+ buf.append(lineDelimiter);
+ } else {
+ buf.append(" ");//$NON-NLS-1$
+ }
+ buf.append("}");//$NON-NLS-1$
+ return new StringAndOffset(buf.toString(), offset);
+ }
+
+ /**
+ *
+ */
+ protected StringAndOffset generateParenthesis() {
+ StringBuffer buf = new StringBuffer();
+ int offset;
+ buf.append("(");//$NON-NLS-1$
+ offset = 1;
+ buf.append(")");//$NON-NLS-1$
+ return new StringAndOffset(buf.toString(), offset);
+ }
+
+ /**
+ *
+ */
+ protected StringAndOffset generateQuotes() {
+ StringBuffer buf = new StringBuffer();
+ char quoteChar = getQuoteChar();
+ buf.append(quoteChar);
+ buf.append(quoteChar);
+ return new StringAndOffset(buf.toString(), 1);
+ }
+
+ /**
+ *
+ */
+ protected StringAndOffset generateSemicolon() {
+ StringBuffer buf = new StringBuffer();
+ int offset;
+ buf.append(";");//$NON-NLS-1$
+ offset = 0;
+ return new StringAndOffset(buf.toString(), offset);
+ }
+
+ /**
+ *
+ */
+ protected StringAndOffset generateURI() {
+ StringBuffer buf = new StringBuffer();
+ CSSPreferenceHelper prefs = CSSPreferenceHelper.getInstance();
+ char quoteChar = getQuoteChar();
+ buf.append("url(");//$NON-NLS-1$
+ if (prefs.isQuoteInURI()) {
+ buf.append(quoteChar);
+ }
+ int offset = buf.length();
+ if (prefs.isQuoteInURI()) {
+ buf.append(quoteChar);
+ }
+ buf.append(")");//$NON-NLS-1$
+ return new StringAndOffset(buf.toString(), offset);
+ }
+
+ abstract protected Iterator getCandidates();
+
+ List getProposals() {
+ List proposals = new ArrayList();
+
+ CSSImageHelper imageHelper = CSSImageHelper.getInstance();
+ Iterator i = getCandidates();
+ while (i.hasNext()) {
+ CSSCACandidate candidate = (CSSCACandidate) i.next();
+ Image image = imageHelper.getImage(candidate.getImageType());
+ ICompletionProposal item = new CompletionProposal(candidate.getReplacementString(), fContext.getReplaceBegin() + fContext.getDocumentOffset(), fContext.getTextToReplace().length(), candidate.getCursorPosition(), image, candidate.getDisplayString(), null, null);
+ proposals.add(item);
+ }
+
+ return proposals;
+ }
+
+ /**
+ *
+ * @return char
+ */
+ private char getQuoteChar() {
+ CSSPreferenceHelper prefs = CSSPreferenceHelper.getInstance();
+ String quoteStr = prefs.getQuoteString(fContext.getModel());
+ char quoteChar = (quoteStr != null && 0 < quoteStr.length()) ? quoteStr.charAt(0) : '"';
+ char attrQuote = fContext.getQuoteOfStyleAttribute();
+ if (attrQuote != 0) {
+ if (attrQuote == '"' && quoteChar == '"') {
+ quoteChar = '\'';
+ } else if (attrQuote == '\'' && quoteChar == '\'') {
+ quoteChar = '"';
+ }
+ }
+ return quoteChar;
+ }
+
+ /**
+ *
+ */
+ protected boolean isMatch(String text) {
+ String textToCompare = fContext.getTextToCompare();
+ if (textToCompare.length() == 0) {
+ return true;
+ } else {
+ return (text.toUpperCase().indexOf(textToCompare.toUpperCase()) == 0);
+ }
+ /*
+ * String textToReplace = fContext.getTextToReplace(); if
+ * (textToReplace.length() == 0) { return true; } else { return
+ * (text.toUpperCase().indexOf(textToReplace.toUpperCase()) == 0); }
+ */
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForAtmarkRule.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForAtmarkRule.java
new file mode 100644
index 0000000000..1539037d77
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForAtmarkRule.java
@@ -0,0 +1,293 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSCharsetRule;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.SelectionCollector;
+import org.eclipse.wst.css.ui.image.CSSImageType;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+class CSSProposalGeneratorForAtmarkRule extends CSSProposalGenerator {
+
+ private boolean fUseUpperCase = false;
+ private static final String CHARSET = "@charset";//$NON-NLS-1$
+ private static final String FONT_FACE = "@font-face";//$NON-NLS-1$
+ private static final String IMPORT = "@import";//$NON-NLS-1$
+ private static final String MEDIA = "@media";//$NON-NLS-1$
+ private static final String PAGE = "@page";//$NON-NLS-1$
+
+ /**
+ * CSSAtmarkRuleProposalGenerator constructor comment.
+ *
+ * @param context
+ * com.ibm.sed.contentassist.old.css.CSSContentAssistContext
+ */
+ CSSProposalGeneratorForAtmarkRule(CSSContentAssistContext context) {
+ super(context);
+ fUseUpperCase = CSSPreferenceHelper.getInstance().isIdentUpperCase();
+ }
+
+ /**
+ *
+ */
+ private CSSCACandidate getCandidateCharsetRule() {
+ // check content model
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ if (!util.collectNodesByType(CSSMMNode.TYPE_CHARSET_RULE).hasNext()) {
+ return null;
+ }
+
+ // check if embedded or not
+ if (fContext.getModel().getStyleSheetType() == ICSSModel.EMBEDDED) {
+ return null;
+ }
+
+ // check if caret precede all other rules.
+ int offset = fContext.getCursorPos();
+ if (0 < offset) {
+ SelectionCollector trav = new SelectionCollector();
+ trav.setRegion(0, offset - 1);
+ trav.apply(fContext.getModel().getDocument());
+ Iterator i = trav.getSelectedNodes().iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof ICSSNode && !(obj instanceof ICSSDocument)) {
+ return null;
+ }
+ }
+ }
+
+ int cursorPos = 0;
+ String ident = (fUseUpperCase) ? CHARSET.toUpperCase() : CHARSET.toLowerCase();
+ StringBuffer buf = new StringBuffer();
+ buf.append(ident);
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos = buf.length();
+ StringAndOffset sao;
+ sao = generateQuotes();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+ sao = generateSemicolon();
+ buf.append(sao.fString);
+
+ String text = buf.toString();
+
+ if (isMatch(text)) {
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(text);
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(ident);
+ item.setImageType(CSSImageType.RULE_CHARSET);
+ return item;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSCACandidate getCandidateFontFaceRule() {
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ if (!util.collectNodesByType(CSSMMNode.TYPE_FONT_FACE_RULE).hasNext()) {
+ return null;
+ }
+
+ int cursorPos = 0;
+ String ident = (fUseUpperCase) ? FONT_FACE.toUpperCase() : FONT_FACE.toLowerCase();
+ StringBuffer buf = new StringBuffer();
+ buf.append(ident);
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos = buf.length();
+ StringAndOffset sao;
+ sao = generateBraces();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+
+ String text = buf.toString();
+
+ if (isMatch(text)) {
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(ident);
+ item.setImageType(CSSImageType.RULE_FONTFACE);
+ return item;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSCACandidate getCandidateImportRule() {
+ // check content model
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ if (!util.collectNodesByType(CSSMMNode.TYPE_IMPORT_RULE).hasNext()) {
+ return null;
+ }
+
+ // charset and import can precede import rule.
+ int offset = fContext.getCursorPos();
+ if (0 < offset) {
+ SelectionCollector trav = new SelectionCollector();
+ trav.setRegion(0, offset - 1);
+ trav.apply(fContext.getModel().getDocument());
+ Iterator i = trav.getSelectedNodes().iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof ICSSNode && !(obj instanceof ICSSDocument || obj instanceof ICSSCharsetRule || obj instanceof ICSSImportRule)) {
+ return null;
+ }
+ }
+ }
+
+ int cursorPos = 0;
+ String ident = (fUseUpperCase) ? IMPORT.toUpperCase() : IMPORT.toLowerCase();
+ StringBuffer buf = new StringBuffer();
+ buf.append(ident);
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos = buf.length();
+ StringAndOffset sao;
+ sao = generateURI();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+ sao = generateSemicolon();
+ buf.append(sao.fString);
+
+ String text = buf.toString();
+
+ if (isMatch(text)) {
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(ident);
+ item.setImageType(CSSImageType.RULE_IMPORT);
+ return item;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSCACandidate getCandidateMediaRule() {
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ if (!util.collectNodesByType(CSSMMNode.TYPE_MEDIA_RULE).hasNext()) {
+ return null;
+ }
+
+ int cursorPos = 0;
+ String ident = (fUseUpperCase) ? MEDIA.toUpperCase() : MEDIA.toLowerCase();
+ StringBuffer buf = new StringBuffer();
+ buf.append(ident);
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos = buf.length() - 1;
+ StringAndOffset sao;
+ sao = generateBraces();
+ buf.append(sao.fString);
+
+ String text = buf.toString();
+
+ if (isMatch(text)) {
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(ident);
+ item.setImageType(CSSImageType.RULE_MEDIA);
+ return item;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private CSSCACandidate getCandidatePageRule() {
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ if (!util.collectNodesByType(CSSMMNode.TYPE_PAGE_RULE).hasNext()) {
+ return null;
+ }
+
+ int cursorPos = 0;
+ String ident = (fUseUpperCase) ? PAGE.toUpperCase() : PAGE.toLowerCase();
+ StringBuffer buf = new StringBuffer();
+ buf.append(ident);
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos = buf.length();
+ StringAndOffset sao;
+ sao = generateBraces();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+
+ String text = buf.toString();
+
+ if (isMatch(text)) {
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(ident);
+ item.setImageType(CSSImageType.RULE_PAGE);
+ return item;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * getCandidates method comment.
+ */
+ protected Iterator getCandidates() {
+ List candidates = new ArrayList();
+
+ ITextRegion region = fContext.getTargetRegionPrevious();
+ // ITextRegion region = fContext.getSignificantTargetRegion();
+ if (region != null) {
+ String type = region.getType();
+ if (type != CSSRegionContexts.CSS_RBRACE && type != CSSRegionContexts.CSS_DELIMITER) {
+ return candidates.iterator();
+ }
+ }
+
+ CSSCACandidate item;
+ if ((item = getCandidateImportRule()) != null) {
+ candidates.add(item);
+ }
+ if ((item = getCandidateCharsetRule()) != null) {
+ candidates.add(item);
+ }
+ if ((item = getCandidateMediaRule()) != null) {
+ candidates.add(item);
+ }
+ if ((item = getCandidatePageRule()) != null) {
+ candidates.add(item);
+ }
+ if ((item = getCandidateFontFaceRule()) != null) {
+ candidates.add(item);
+ }
+ return candidates.iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationName.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationName.java
new file mode 100644
index 0000000000..6bf20406c4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationName.java
@@ -0,0 +1,171 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.ui.image.CSSImageType;
+import org.eclipse.wst.css.ui.preferences.CSSPreferenceManager;
+
+class CSSProposalGeneratorForDeclarationName extends CSSProposalGenerator {
+
+ /**
+ * CSSProposalGeneratorForDeclaration constructor comment.
+ *
+ * @param context
+ * com.ibm.sed.contentassist.old.css.CSSContentAssistContext
+ */
+ CSSProposalGeneratorForDeclarationName(CSSContentAssistContext context) {
+ super(context);
+ }
+
+ /**
+ * getCandidates method comment.
+ */
+ protected Iterator getCandidates() {
+ List candidates = new ArrayList();
+
+ CSSPreferenceHelper prefs = CSSPreferenceHelper.getInstance();
+ String preDelim = "";//$NON-NLS-1$
+ for (int i = 0; i < prefs.getSpacesPreDelimiter(); i++) {
+ preDelim += ' ';//$NON-NLS-1$
+ }
+ String postDelim = "";//$NON-NLS-1$
+ for (int i = 0; i < prefs.getSpacesPostDelimiter(); i++) {
+ postDelim += ' ';//$NON-NLS-1$
+ }
+
+ ICSSNode targetNode = fContext.getTargetNode();
+ boolean bFontRule = false;
+ for (ICSSNode node = targetNode; node != null; node = node.getParentNode()) {
+ if (node instanceof org.w3c.dom.css.CSSFontFaceRule) {
+ bFontRule = true;
+ break;
+ }
+ }
+
+ List names = new ArrayList();
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ Iterator iNames = util.collectNodesByType((bFontRule) ? CSSMMNode.TYPE_DESCRIPTOR : CSSMMNode.TYPE_PROPERTY);
+ while (iNames.hasNext()) {
+ CSSMMNode node = (CSSMMNode) iNames.next();
+ names.add(node);
+ }
+ sortNames(names);
+ //Collections.sort(names);
+
+ boolean bAddColon = true;
+ if (targetNode instanceof ICSSStyleDeclItem && fContext.targetHas(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) {
+ bAddColon = false;
+ }
+
+ Iterator i = names.iterator();
+ while (i.hasNext()) {
+ CSSMMNode node = (CSSMMNode) i.next();
+ String text = node.getName();
+ text = (prefs.isPropNameUpperCase()) ? text.toUpperCase() : text.toLowerCase();
+ if (!isMatch(text)) {
+ continue;
+ }
+
+ int cursorPos = 0;
+ StringBuffer buf = new StringBuffer();
+ buf.append(text);
+ buf.append(preDelim);
+ cursorPos = buf.length();
+ if (bAddColon) {
+ buf.append(':');//$NON-NLS-1$
+ buf.append(postDelim);
+ cursorPos += 1 + postDelim.length();
+ }
+ // if (! (targetNode instanceof ICSSStyleDeclItem)) {
+ // buf.append(';');//$NON-NLS-1$
+ // }
+
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(text);
+ item.setImageType(getCategoryImageType(node));
+ candidates.add(item);
+ }
+
+ return candidates.iterator();
+ }
+
+ void sortNames(List names) {
+ CSSPreferenceManager prefMan = CSSPreferenceManager.getInstance();
+ final boolean categorize = prefMan.getContentAssistCategorize();
+
+ Collections.sort(names, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ CSSMMNode node1 = (CSSMMNode) o1;
+ CSSMMNode node2 = (CSSMMNode) o2;
+ if (node1 == null) {
+ return 1;
+ } else if (node2 == null) {
+ return -1;
+ }
+ int diff = 0;
+ if (categorize) {
+ String category1 = node1.getAttribute("category"); //$NON-NLS-1$
+ String category2 = node2.getAttribute("category"); //$NON-NLS-1$
+ if (category1 == null) {
+ if (category2 == null) {
+ diff = 0;
+ } else {
+ return 1;
+ }
+ } else if (category2 == null) {
+ return -1;
+ } else {
+ diff = category1.compareTo(category2);
+ }
+ }
+ if (diff == 0) {
+ String name = node1.getName();
+ if (name == null) {
+ return 1;
+ } else {
+ return name.compareTo(node2.getName());
+ }
+ } else {
+ return diff;
+ }
+ }
+ });
+ }
+
+ /*
+ * retrieve default category icon name TODO: if node has "icon"(?), use
+ * it.
+ */
+ CSSImageType getCategoryImageType(CSSMMNode node) {
+ CSSImageType imageType = null;
+ if (node != null) {
+ String category = node.getAttribute("category"); //$NON-NLS-1$
+ if (category != null) {
+ imageType = CSSImageType.getImageType(category);
+ }
+ }
+ return (imageType == null) ? CSSImageType.CATEGORY_DEFAULT : imageType;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationValue.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationValue.java
new file mode 100644
index 0000000000..f80c0f9575
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForDeclarationValue.java
@@ -0,0 +1,370 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.metamodel.CSSMMDescriptor;
+import org.eclipse.wst.css.core.metamodel.CSSMMFunction;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMNumber;
+import org.eclipse.wst.css.core.metamodel.CSSMMProperty;
+import org.eclipse.wst.css.core.metamodel.CSSMMUnit;
+import org.eclipse.wst.css.core.metamodel.util.CSSFunctionID;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelUtil;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.core.util.CSSUtil;
+import org.eclipse.wst.css.core.util.RegionIterator;
+import org.eclipse.wst.css.ui.image.CSSImageType;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.w3c.dom.css.CSSFontFaceRule;
+
+class CSSProposalGeneratorForDeclarationValue extends CSSProposalGenerator {
+
+ private static final String IMPORTANT = "!important"; //$NON-NLS-1$
+ private boolean fUseUpperCase;
+ private boolean fAppendSemiColon;
+
+ /**
+ * CSSProposalGeneratorForDeclarationValue constructor comment.
+ *
+ * @param context
+ * com.ibm.sed.contentassist.old.css.CSSContentAssistContext
+ */
+ CSSProposalGeneratorForDeclarationValue(CSSContentAssistContext context) {
+ super(context);
+ fUseUpperCase = CSSPreferenceHelper.getInstance().isPropValueUpperCase();
+ }
+
+ /**
+ *
+ */
+ private void addFunction(List candidates, CSSMMFunction prop) {
+ String text = prop.toString();
+ if (!isMatch(text)) {
+ return;
+ }
+
+ int cursorPos = 0;
+ StringBuffer buf = new StringBuffer();
+ if (prop.getName().equals(CSSFunctionID.F_URI)) {
+ StringAndOffset sao = generateURI();
+ buf.append(sao.fString);
+ cursorPos = sao.fOffset;
+ } else {
+ buf.append(prop.toString());
+ cursorPos = buf.length();
+ StringAndOffset sao = generateParenthesis();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+ }
+
+ text = buf.toString();
+ text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase();
+
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(text);
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(text);
+ item.setImageType(CSSImageType.VALUE_FUNCTION);
+ appendSemiColon(item);
+ candidates.add(item);
+ }
+
+ /**
+ *
+ */
+ private void addNumber(List candidates, CSSMMNumber prop) {
+ String fullText = fContext.getTextToReplace();
+ // skip number
+ int unitIndex = -1;
+ for (int i = 0; i < fullText.length(); i++) {
+ if (Character.isDigit(fullText.charAt(i))) {
+ unitIndex = i + 1;
+ } else {
+ break;
+ }
+ }
+
+ String unitSubText = ""; //$NON-NLS-1$
+ String numSubText = ""; //$NON-NLS-1$
+ if (0 <= unitIndex) {
+ numSubText = fullText.substring(0, unitIndex);
+ if (unitIndex < fullText.length()) {
+ unitSubText = fullText.substring(unitIndex);
+ }
+ } else {
+ unitSubText = fullText;
+ }
+
+ Iterator i = prop.getDescendants();
+ while (i.hasNext()) {
+ CSSMMUnit unit = (CSSMMUnit) i.next();
+ String unitString = unit.getUnitString();
+ if ((0 < unitSubText.length() && unitString.indexOf(unitSubText) != 0) || (0 < numSubText.length() && unitString.equals("#"))) { //$NON-NLS-1$
+ continue;
+ }
+
+ String text = numSubText + unitString;
+ text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase();
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(text);
+ if (0 < numSubText.length() || text.equals("#")) { //$NON-NLS-1$
+ item.setCursorPosition(text.length());
+ } else {
+ item.setCursorPosition(0);
+ }
+ item.setDisplayString(text);
+ item.setImageType(CSSImageType.VALUE_NUMBER);
+ appendSemiColon(item);
+ candidates.add(item);
+ }
+ }
+
+ /**
+ *
+ */
+ private void checkSemiColon() {
+ fAppendSemiColon = false;
+
+ ITextRegion targetRegion = fContext.getTargetRegion();
+ if (targetRegion != null && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ // find trailing ":" or ";"
+ // if ":" before ";" is found, add ";"
+ RegionIterator iterator = fContext.getRegionIterator();
+ IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion();
+ while (iterator.hasNext()) {
+ ITextRegion region = iterator.next();
+ if (iterator.getStructuredDocumentRegion() != container) {
+ break;
+ }
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
+ fAppendSemiColon = true;
+ break;
+ }
+ }
+ if (!fAppendSemiColon) {
+ // second chance:
+ // leading IStructuredDocumentRegion is not ";"
+ IStructuredDocumentRegion nextStructuredDocumentRegion = CSSUtil.findNextSignificantNode(container);
+ if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion) != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ fAppendSemiColon = true;
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private void appendSemiColon(CSSCACandidate item) {
+ if (fAppendSemiColon) {
+ String replacementString = item.getReplacementString();
+ item.setReplacementString(replacementString + ";"); //$NON-NLS-1$
+ int cursorPosition = item.getCursorPosition();
+ if (replacementString.length() <= cursorPosition) {
+ // cursorpos is tail of string
+ cursorPosition++;
+ item.setCursorPosition(cursorPosition);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private void addSemiColon(List candidates) {
+ ICSSNode targetNode = fContext.getTargetNode();
+ if (targetNode instanceof ICSSStyleDeclItem) {
+ ICSSNode firstChild = targetNode.getFirstChild();
+ if (firstChild == null) {
+ return;
+ }
+ if (firstChild instanceof IndexedRegion) {
+ int startOffset = ((IndexedRegion) firstChild).getStartOffset();
+ if (fContext.getCursorPos() <= startOffset) {
+ return;
+ }
+ }
+ }
+
+ boolean bAddCloser = false;
+
+ ITextRegion targetRegion = fContext.getTargetRegion();
+ if (targetRegion != null && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ // find trailing ":" or ";"
+ // if ":" before ";" is found, add ";"
+ RegionIterator iterator = fContext.getRegionIterator();
+ IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion();
+ while (iterator.hasNext()) {
+ ITextRegion region = iterator.next();
+ if (iterator.getStructuredDocumentRegion() != container) {
+ break;
+ }
+ if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
+ bAddCloser = true;
+ break;
+ }
+ }
+ if (!bAddCloser) {
+ // second chance:
+ // leading IStructuredDocumentRegion is not ";"
+ IStructuredDocumentRegion nextStructuredDocumentRegion = CSSUtil.findNextSignificantNode(container);
+ if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion) != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
+ bAddCloser = true;
+ }
+ }
+ }
+
+ if (bAddCloser) {
+ CSSCACandidate item = new CSSCACandidate();
+ String text = fContext.getTextToReplace() + ";";//$NON-NLS-1$
+ item.setReplacementString(text);
+ item.setCursorPosition(text.length());
+ item.setDisplayString(";");//$NON-NLS-1$
+ item.setImageType(null);
+ candidates.add(item);
+ }
+ }
+
+ /**
+ *
+ */
+ private void addString(List candidates, String text) {
+ if (!isMatch(text)) {
+ return;
+ }
+
+ text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase();
+
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(text);
+ item.setCursorPosition(text.length());
+ item.setDisplayString(text);
+ item.setImageType(CSSImageType.VALUE_STRING);
+ appendSemiColon(item);
+ candidates.add(item);
+ }
+
+ private void addImportant(List candidates) {
+ ICSSNode targetNode = fContext.getTargetNode();
+ while (targetNode instanceof ICSSPrimitiveValue) {
+ targetNode = targetNode.getParentNode();
+ }
+ if (!(targetNode instanceof ICSSStyleDeclItem)) {
+ return;
+ }
+ // 1. has no priority region
+ // 2. cursor position is after of last child
+ // 3. normal isMatch method
+ String priority = ((ICSSStyleDeclItem) targetNode).getPriority();
+ if (priority == null || priority.length() == 0) {
+ ICSSNode lastChild = targetNode.getLastChild();
+ if (lastChild instanceof IndexedRegion) {
+ int startOffset = ((IndexedRegion) lastChild).getStartOffset();
+ // int endOffset = ((IndexedRegion)lastChild).getEndOffset();
+ if (startOffset < fContext.getCursorPos() && isMatch(IMPORTANT)) {
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(IMPORTANT);
+ item.setCursorPosition(IMPORTANT.length());
+ item.setDisplayString(IMPORTANT);
+ item.setImageType(CSSImageType.VALUE_STRING);
+ appendSemiColon(item);
+ candidates.add(item);
+ }
+ }
+ }
+ }
+
+ /**
+ * getCandidates method comment.
+ */
+ protected Iterator getCandidates() {
+ List candidates = new ArrayList();
+
+ checkSemiColon(); // check should add semi-colon or not
+
+ String name = getPropertyName();
+ if (name != null) {
+ CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
+ Iterator i = Collections.EMPTY_LIST.iterator();
+ if (isFontFaceRule()) {
+ CSSMMDescriptor desc = util.getDescriptor(name);
+ if (desc != null) {
+ i = desc.getValues();
+ }
+ } else {
+ CSSMMProperty prop = util.getProperty(name);
+ if (prop != null) {
+ i = prop.getValues();
+ }
+ }
+ while (i.hasNext()) {
+ CSSMMNode val = (CSSMMNode) i.next();
+ String valueType = val.getType();
+ if (valueType == CSSMMNode.TYPE_KEYWORD) {
+ addString(candidates, val.toString());
+ } else if (valueType == CSSMMNode.TYPE_NUMBER) {
+ addNumber(candidates, (CSSMMNumber) val);
+ } else if (valueType == CSSMMNode.TYPE_FUNCTION) {
+ addFunction(candidates, (CSSMMFunction) val);
+ }
+ }
+ }
+
+ addImportant(candidates);
+ addSemiColon(candidates);
+
+ return candidates.iterator();
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ private String getPropertyName() {
+ ICSSNode targetNode = fContext.getTargetNode();
+ while (targetNode instanceof ICSSPrimitiveValue) {
+ targetNode = targetNode.getParentNode();
+ }
+ if (targetNode instanceof ICSSStyleDeclItem) {
+ return ((ICSSStyleDeclItem) targetNode).getPropertyName();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *
+ */
+ private boolean isFontFaceRule() {
+ ICSSNode targetNode = fContext.getTargetNode();
+ while (targetNode instanceof ICSSPrimitiveValue) {
+ targetNode = targetNode.getParentNode();
+ }
+ if (targetNode instanceof ICSSStyleDeclItem) {
+ targetNode = targetNode.getParentNode(); // get Declaration
+ if (targetNode != null) {
+ // inline style has no rule node
+ targetNode = targetNode.getParentNode(); // get rule
+ }
+ }
+ return (targetNode instanceof CSSFontFaceRule);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForHTMLTag.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForHTMLTag.java
new file mode 100644
index 0000000000..02f250123c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForHTMLTag.java
@@ -0,0 +1,157 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.ui.image.CSSImageType;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocumentFactory;
+import org.eclipse.wst.sse.core.contentmodel.CMDocType;
+import org.eclipse.wst.xml.core.document.DocumentTypeAdapter;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+class CSSProposalGeneratorForHTMLTag extends CSSProposalGenerator {
+
+ /**
+ * CSSStyleRuleProposalGenerator constructor comment.
+ *
+ * @param context
+ * com.ibm.sed.contentassist.old.css.CSSContentAssistContext
+ */
+ CSSProposalGeneratorForHTMLTag(CSSContentAssistContext context) {
+ super(context);
+
+ if (fHTMLTags == null) {
+ fHTMLTags = setupHTMLTags();
+ }
+ }
+
+ /**
+ * getCandidates method comment.
+ */
+ protected Iterator getCandidates() {
+ List candidates = new ArrayList();
+
+ if (checkLeadingColon()) {
+ return candidates.iterator();
+ }
+
+ // XHTML requires lower case
+ boolean bLowerCase = false;
+ if (fContext.getModel().getStyleSheetType() == ICSSModel.EMBEDDED) {
+ Node domNode = fContext.getModel().getOwnerDOMNode();
+ if (domNode != null && !(domNode instanceof Document)) {
+ domNode = domNode.getOwnerDocument();
+ if (domNode instanceof XMLDocument) {
+ DocumentTypeAdapter adapter = (DocumentTypeAdapter) ((XMLDocument) domNode).getAdapterFor(DocumentTypeAdapter.class);
+ if (adapter != null)
+ bLowerCase = (adapter.getTagNameCase() == DocumentTypeAdapter.LOWER_CASE);
+ }
+ }
+ }
+
+
+ int length = fHTMLTags.length;
+ for (int i = 0; i < length; i++) {
+ String tagText = fHTMLTags[i];
+ if (bLowerCase) {
+ tagText = tagText.toLowerCase();
+ }
+ if (!isMatch(tagText)) {
+ continue;
+ }
+
+ int cursorPos = 0;
+ StringBuffer buf = new StringBuffer();
+ buf.append(tagText);
+ cursorPos += tagText.length();
+ boolean inRule = (fContext.getTargetNode() instanceof ICSSStyleRule);
+ if (!inRule || fContext.getTextToReplace().length() == 0) {
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos += 1;
+ }
+ if (!inRule) {
+ StringAndOffset sao = generateBraces();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+ }
+
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(tagText);
+ item.setImageType(CSSImageType.SELECTOR_TAG);
+ candidates.add(item);
+ }
+
+ return candidates.iterator();
+ }
+
+ /**
+ *
+ */
+ private static String[] setupHTMLTags() {
+ CMDocument cmdoc = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);
+ CMNamedNodeMap elements = cmdoc.getElements();
+ Vector names = new Vector();
+ int nElements = elements.getLength();
+ for (int i = 0; i < nElements; i++) {
+ CMElementDeclaration edec = (CMElementDeclaration) elements.item(i);
+ if (isAttrDefined(edec, HTML40Namespace.ATTR_NAME_STYLE)) {
+ names.add(edec.getElementName());
+ }
+ }
+ Collections.sort(names);
+ String[] tags = new String[names.size()];
+ Iterator iNames = names.iterator();
+ for (int i = 0; iNames.hasNext(); i++) {
+ tags[i] = (String) iNames.next();
+ }
+ return tags;
+ }
+
+ /**
+ *
+ */
+ private static boolean isAttrDefined(CMElementDeclaration edec, String attrName) {
+ if (edec == null) {
+ return false;
+ }
+ CMNamedNodeMap attrs = edec.getAttributes();
+ if (attrs == null) {
+ return false;
+ }
+ for (int i = 0; i < attrs.getLength(); i++) {
+ CMAttributeDeclaration attr = (CMAttributeDeclaration) attrs.item(i);
+ if (attr == null) {
+ continue;
+ }
+ if (attr.getAttrName().equalsIgnoreCase(attrName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static String[] fHTMLTags = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForPseudoSelector.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForPseudoSelector.java
new file mode 100644
index 0000000000..a9c92a5851
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/CSSProposalGeneratorForPseudoSelector.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMMSelector;
+import org.eclipse.wst.css.core.metamodel.util.CSSMMTypeCollector;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.core.preferences.CSSPreferenceHelper;
+import org.eclipse.wst.css.ui.image.CSSImageType;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+/**
+ *
+ */
+class CSSProposalGeneratorForPseudoSelector extends CSSProposalGenerator {
+
+ /**
+ * CSSProposalGeneratorForPseudoSelector constructor comment.
+ *
+ * @param context
+ * com.ibm.sed.contentassist.old.css.CSSContentAssistContext
+ */
+ CSSProposalGeneratorForPseudoSelector(CSSContentAssistContext context) {
+ super(context);
+ }
+
+ /**
+ * getCandidates method comment.
+ */
+ protected Iterator getCandidates() {
+ List candidates = new ArrayList();
+
+ boolean hasLeadingColon = checkLeadingColon();
+ String textToReplace = fContext.getTextToReplace();
+ if (!hasLeadingColon && 0 < textToReplace.length() && !textToReplace.equals(fContext.getTextToCompare())) {
+ // cursor placed midpoint of the region
+ return candidates.iterator();
+ }
+ ITextRegion region = fContext.getTargetRegion();
+ if (region != null) {
+ String type = region.getType();
+ if (type != CSSRegionContexts.CSS_S && !CSSRegionUtil.isSelectorBegginingType(type)) {
+ return candidates.iterator();
+ }
+ }
+
+ boolean useUpperCase = CSSPreferenceHelper.getInstance().isIdentUpperCase();
+
+ List tags = getSelectorTags();
+ Collections.sort(tags);
+ Iterator i = tags.iterator();
+ while (i.hasNext()) {
+ String text = (String) i.next();
+ if (hasLeadingColon && !isMatch(text)) {
+ continue;
+ }
+ text = (useUpperCase) ? text.toUpperCase() : text.toLowerCase();
+
+ int cursorPos = 0;
+ StringBuffer buf = new StringBuffer();
+ if (hasLeadingColon) {
+ buf.append(text.substring(1));
+ } else {
+ buf.append(textToReplace);
+ buf.append(text);
+ }
+ cursorPos += buf.length();
+
+ if (0 < buf.length()) {
+ boolean inRule = (fContext.getTargetNode() instanceof ICSSStyleRule || fContext.getTargetNode() instanceof ICSSPageRule);
+ if (!inRule || (textToReplace.length() == 0 && !hasLeadingColon)) {
+ buf.append(" ");//$NON-NLS-1$
+ cursorPos += 1;
+ }
+ if (!inRule) {
+ StringAndOffset sao = generateBraces();
+ buf.append(sao.fString);
+ cursorPos += sao.fOffset;
+ }
+ CSSCACandidate item = new CSSCACandidate();
+ item.setReplacementString(buf.toString());
+ item.setCursorPosition(cursorPos);
+ item.setDisplayString(text);
+ item.setImageType(CSSImageType.SELECTOR_PSEUDO);
+ candidates.add(item);
+ }
+ }
+
+ return candidates.iterator();
+ }
+
+ /**
+ *
+ */
+ List getSelectorTags() {
+ List tagList = new ArrayList();
+ ICSSNode targetNode = fContext.getTargetNode();
+ String rootType = (targetNode instanceof ICSSPageRule) ? CSSMMNode.TYPE_PAGE_RULE : CSSMMNode.TYPE_STYLE_RULE;
+
+ CSSMMTypeCollector collector = new CSSMMTypeCollector();
+ collector.collectNestedType(false);
+ collector.apply(fContext.getMetaModel(), rootType);
+ Iterator i;
+ i = collector.getNodes();
+ if (!i.hasNext()) {
+ return tagList;
+ }
+ CSSMMNode node = (CSSMMNode) i.next();
+ i = node.getChildNodes();
+ while (i.hasNext()) {
+ CSSMMNode child = (CSSMMNode) i.next();
+ if (child.getType() == CSSMMNode.TYPE_SELECTOR) {
+ String selType = ((CSSMMSelector) child).getSelectorType();
+ if (selType == CSSMMSelector.TYPE_PSEUDO_CLASS || selType == CSSMMSelector.TYPE_PSEUDO_ELEMENT) {
+ tagList.add(((CSSMMSelector) child).getSelectorString());
+ }
+ }
+ }
+ return tagList;
+ }
+
+ /**
+ *
+ */
+ protected boolean isMatch(String text) {
+ if (!super.isMatch(text)) {
+ ITextRegion region = fContext.getTargetRegion();
+ if (region != null && region.getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/HTML40Namespace.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/HTML40Namespace.java
new file mode 100644
index 0000000000..2d4ce3253b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentassist/HTML40Namespace.java
@@ -0,0 +1,889 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentassist;
+
+
+
+/**
+ * Provide all names defined in the HTML 4.0? specification.
+ */
+public interface HTML40Namespace {
+
+ // Element names
+ public static interface ElementName {
+ public static final String A = "A"; //$NON-NLS-1$
+ public static final String ABBR = "ABBR"; //$NON-NLS-1$
+ public static final String ACRONYM = "ACRONYM"; //$NON-NLS-1$
+ public static final String ADDRESS = "ADDRESS"; //$NON-NLS-1$
+ public static final String APPLET = "APPLET"; //$NON-NLS-1$
+ public static final String AREA = "AREA"; //$NON-NLS-1$
+ public static final String B = "B"; //$NON-NLS-1$
+ public static final String BASE = "BASE"; //$NON-NLS-1$
+ public static final String BASEFONT = "BASEFONT"; //$NON-NLS-1$
+ public static final String BDO = "BDO"; //$NON-NLS-1$
+ public static final String BGSOUND = "BGSOUND"; // D205513
+ // //$NON-NLS-1$
+ public static final String BIG = "BIG"; //$NON-NLS-1$
+ public static final String BLINK = "BLINK"; //$NON-NLS-1$
+ public static final String BLOCKQUOTE = "BLOCKQUOTE"; //$NON-NLS-1$
+ public static final String BODY = "BODY"; //$NON-NLS-1$
+ public static final String BR = "BR"; //$NON-NLS-1$
+ public static final String BUTTON = "BUTTON"; //$NON-NLS-1$
+ public static final String CAPTION = "CAPTION"; //$NON-NLS-1$
+ public static final String CENTER = "CENTER"; //$NON-NLS-1$
+ public static final String CITE = "CITE"; //$NON-NLS-1$
+ public static final String CODE = "CODE"; //$NON-NLS-1$
+ public static final String COL = "COL"; //$NON-NLS-1$
+ public static final String COLGROUP = "COLGROUP"; //$NON-NLS-1$
+ public static final String DD = "DD"; //$NON-NLS-1$
+ public static final String DEL = "DEL"; //$NON-NLS-1$
+ public static final String DFN = "DFN"; //$NON-NLS-1$
+ public static final String DIR = "DIR"; //$NON-NLS-1$
+ public static final String DIV = "DIV"; //$NON-NLS-1$
+ public static final String DL = "DL"; //$NON-NLS-1$
+ public static final String DT = "DT"; //$NON-NLS-1$
+ public static final String EM = "EM"; //$NON-NLS-1$
+ public static final String EMBED = "EMBED"; //$NON-NLS-1$
+ public static final String FIELDSET = "FIELDSET"; //$NON-NLS-1$
+ public static final String FONT = "FONT"; //$NON-NLS-1$
+ public static final String FORM = "FORM"; //$NON-NLS-1$
+ public static final String FRAME = "FRAME"; //$NON-NLS-1$
+ public static final String FRAMESET = "FRAMESET"; //$NON-NLS-1$
+ public static final String H1 = "H1"; //$NON-NLS-1$
+ public static final String H2 = "H2"; //$NON-NLS-1$
+ public static final String H3 = "H3"; //$NON-NLS-1$
+ public static final String H4 = "H4"; //$NON-NLS-1$
+ public static final String H5 = "H5"; //$NON-NLS-1$
+ public static final String H6 = "H6"; //$NON-NLS-1$
+ public static final String HEAD = "HEAD"; //$NON-NLS-1$
+ public static final String HR = "HR"; //$NON-NLS-1$
+ public static final String HTML = "HTML"; //$NON-NLS-1$
+ public static final String I = "I"; //$NON-NLS-1$
+ public static final String IFRAME = "IFRAME"; //$NON-NLS-1$
+ public static final String IMG = "IMG"; //$NON-NLS-1$
+ public static final String INPUT = "INPUT"; //$NON-NLS-1$
+ public static final String INS = "INS"; //$NON-NLS-1$
+ public static final String ISINDEX = "ISINDEX"; //$NON-NLS-1$
+ public static final String KBD = "KBD"; //$NON-NLS-1$
+ public static final String LABEL = "LABEL"; //$NON-NLS-1$
+ public static final String LEGEND = "LEGEND"; //$NON-NLS-1$
+ public static final String LI = "LI"; //$NON-NLS-1$
+ public static final String LINK = "LINK"; //$NON-NLS-1$
+ public static final String MAP = "MAP"; //$NON-NLS-1$
+ public static final String MENU = "MENU"; //$NON-NLS-1$
+ public static final String META = "META"; //$NON-NLS-1$
+ public static final String NOBR = "NOBR"; // D205513 //$NON-NLS-1$
+ public static final String NOEMBED = "NOEMBED"; //$NON-NLS-1$
+ public static final String NOFRAMES = "NOFRAMES"; //$NON-NLS-1$
+ public static final String NOSCRIPT = "NOSCRIPT"; //$NON-NLS-1$
+ public static final String OBJECT = "OBJECT"; //$NON-NLS-1$
+ public static final String OL = "OL"; //$NON-NLS-1$
+ public static final String OPTGROUP = "OPTGROUP"; //$NON-NLS-1$
+ public static final String OPTION = "OPTION"; //$NON-NLS-1$
+ public static final String P = "P"; //$NON-NLS-1$
+ public static final String PARAM = "PARAM"; //$NON-NLS-1$
+ public static final String PRE = "PRE"; //$NON-NLS-1$
+ public static final String Q = "Q"; //$NON-NLS-1$
+ public static final String S = "S"; //$NON-NLS-1$
+ public static final String SAMP = "SAMP"; //$NON-NLS-1$
+ public static final String SCRIPT = "SCRIPT"; //$NON-NLS-1$
+ public static final String SELECT = "SELECT"; //$NON-NLS-1$
+ public static final String SMALL = "SMALL"; //$NON-NLS-1$
+ public static final String SPAN = "SPAN"; //$NON-NLS-1$
+ public static final String STRIKE = "STRIKE"; //$NON-NLS-1$
+ public static final String STRONG = "STRONG"; //$NON-NLS-1$
+ public static final String STYLE = "STYLE"; //$NON-NLS-1$
+ public static final String SUB = "SUB"; //$NON-NLS-1$
+ public static final String SUP = "SUP"; //$NON-NLS-1$
+ public static final String TABLE = "TABLE"; //$NON-NLS-1$
+ public static final String TBODY = "TBODY"; //$NON-NLS-1$
+ public static final String TD = "TD"; //$NON-NLS-1$
+ public static final String TEXTAREA = "TEXTAREA"; //$NON-NLS-1$
+ public static final String TFOOT = "TFOOT"; //$NON-NLS-1$
+ public static final String TH = "TH"; //$NON-NLS-1$
+ public static final String THEAD = "THEAD"; //$NON-NLS-1$
+ public static final String TITLE = "TITLE"; //$NON-NLS-1$
+ public static final String TR = "TR"; //$NON-NLS-1$
+ public static final String TT = "TT"; //$NON-NLS-1$
+ public static final String U = "U"; //$NON-NLS-1$
+ public static final String UL = "UL"; //$NON-NLS-1$
+ public static final String VAR = "VAR"; //$NON-NLS-1$
+ public static final String WBR = "WBR"; // D205513 //$NON-NLS-1$
+ public static final String MARQUEE = "MARQUEE"; //$NON-NLS-1$
+ public static final String SSI_CONFIG = "SSI:CONFIG"; // D210393
+ // //$NON-NLS-1$
+ public static final String SSI_ECHO = "SSI:ECHO"; //$NON-NLS-1$
+ public static final String SSI_EXEC = "SSI:EXEC"; //$NON-NLS-1$
+ public static final String SSI_FSIZE = "SSI:FSIZE"; //$NON-NLS-1$
+ public static final String SSI_FLASTMOD = "SSI:FLASTMOD"; //$NON-NLS-1$
+ public static final String SSI_INCLUDE = "SSI:INCLUDE"; //$NON-NLS-1$
+ public static final String SSI_PRINTENV = "SSI:PRINTENV"; //$NON-NLS-1$
+ public static final String SSI_SET = "SSI:SET"; //$NON-NLS-1$
+ public static final String WML_WML = "wml"; //$NON-NLS-1$
+ public static final String WML_CARD = "card"; //$NON-NLS-1$
+ public static final String WML_TEMPLATE = "template"; //$NON-NLS-1$
+ public static final String WML_ACCESS = "access"; //$NON-NLS-1$
+ public static final String WML_DO = "do"; //$NON-NLS-1$
+ public static final String WML_ONEVENT = "onevent"; //$NON-NLS-1$
+ public static final String WML_TIMER = "timer"; //$NON-NLS-1$
+ public static final String WML_ANCHOR = "anchor"; //$NON-NLS-1$
+ public static final String WML_PREV = "prev"; //$NON-NLS-1$
+ public static final String WML_REFRESH = "refresh"; //$NON-NLS-1$
+ public static final String WML_GO = "go"; //$NON-NLS-1$
+ public static final String WML_NOOP = "noop"; //$NON-NLS-1$
+ public static final String WML_SETVAR = "setvar"; //$NON-NLS-1$
+ public static final String WML_POSTFIELD = "postfield"; //$NON-NLS-1$
+ }
+
+ // Character Entities
+ public static interface EntityName {
+ public static final String AACUTE_U = "Aacute"; //$NON-NLS-1$
+ public static final String AACUTE_L = "aacute"; //$NON-NLS-1$
+ public static final String ACIRC_U = "Acirc"; //$NON-NLS-1$
+ public static final String ACIRC_L = "acirc"; //$NON-NLS-1$
+ public static final String ACUTE = "acute"; //$NON-NLS-1$
+ public static final String AELIG_U = "AElig"; //$NON-NLS-1$
+ public static final String AELIG_L = "aelig"; //$NON-NLS-1$
+ public static final String AGRAVE_U = "Agrave"; //$NON-NLS-1$
+ public static final String AGRAVE_L = "agrave"; //$NON-NLS-1$
+ public static final String ALEFSYM = "alefsym"; //$NON-NLS-1$
+ public static final String ALPHA_U = "Alpha"; //$NON-NLS-1$
+ public static final String ALPHA_L = "alpha"; //$NON-NLS-1$
+ public static final String AMP = "amp"; //$NON-NLS-1$
+ public static final String AND = "and"; //$NON-NLS-1$
+ public static final String ANG = "ang"; //$NON-NLS-1$
+ public static final String ARING_U = "Aring"; //$NON-NLS-1$
+ public static final String ARING_L = "aring"; //$NON-NLS-1$
+ public static final String ASYMP = "asymp"; //$NON-NLS-1$
+ public static final String ATILDE_U = "Atilde"; //$NON-NLS-1$
+ public static final String ATILDE_L = "atilde"; //$NON-NLS-1$
+ public static final String AUML_U = "Auml"; //$NON-NLS-1$
+ public static final String AUML_L = "auml"; //$NON-NLS-1$
+ public static final String BDQUO = "bdquo"; //$NON-NLS-1$
+ public static final String BETA_U = "Beta"; //$NON-NLS-1$
+ public static final String BETA_L = "beta"; //$NON-NLS-1$
+ public static final String BRVBAR = "brvbar"; //$NON-NLS-1$
+ public static final String BULL = "bull"; //$NON-NLS-1$
+ public static final String CAP = "cap"; //$NON-NLS-1$
+ public static final String CCEDIL_U = "Ccedil"; //$NON-NLS-1$
+ public static final String CCEDIL_L = "ccedil"; //$NON-NLS-1$
+ public static final String CEDIL = "cedil"; //$NON-NLS-1$
+ public static final String CENT = "cent"; //$NON-NLS-1$
+ public static final String CHI_U = "Chi"; //$NON-NLS-1$
+ public static final String CHI_L = "chi"; //$NON-NLS-1$
+ public static final String CIRC = "circ"; //$NON-NLS-1$
+ public static final String CLUBS = "clubs"; //$NON-NLS-1$
+ public static final String CONG = "cong"; //$NON-NLS-1$
+ public static final String COPY = "copy"; //$NON-NLS-1$
+ public static final String CRARR = "crarr"; //$NON-NLS-1$
+ public static final String CUP = "cup"; //$NON-NLS-1$
+ public static final String CURREN = "curren"; //$NON-NLS-1$
+ public static final String DAGGER_U = "Dagger"; //$NON-NLS-1$
+ public static final String DAGGER_L = "dagger"; //$NON-NLS-1$
+ public static final String DARR_U = "dArr"; //$NON-NLS-1$
+ public static final String DARR_L = "darr"; //$NON-NLS-1$
+ public static final String DEG = "deg"; //$NON-NLS-1$
+ public static final String DELTA_U = "Delta"; //$NON-NLS-1$
+ public static final String DELTA_L = "delta"; //$NON-NLS-1$
+ public static final String DIAMS = "diams"; //$NON-NLS-1$
+ public static final String DIVIDE = "divide"; //$NON-NLS-1$
+ public static final String EACUTE_U = "Eacute"; //$NON-NLS-1$
+ public static final String EACUTE_L = "eacute"; //$NON-NLS-1$
+ public static final String ECIRC_U = "Ecirc"; //$NON-NLS-1$
+ public static final String ECIRC_L = "ecirc"; //$NON-NLS-1$
+ public static final String EGRAVE_U = "Egrave"; //$NON-NLS-1$
+ public static final String EGRAVE_L = "egrave"; //$NON-NLS-1$
+ public static final String EMPTY = "empty"; //$NON-NLS-1$
+ public static final String EMSP = "emsp"; //$NON-NLS-1$
+ public static final String ENSP = "ensp"; //$NON-NLS-1$
+ public static final String EPSILON_U = "Epsilon"; //$NON-NLS-1$
+ public static final String EPSILON_L = "epsilon"; //$NON-NLS-1$
+ public static final String EQUIV = "equiv"; //$NON-NLS-1$
+ public static final String ETA_U = "Eta"; //$NON-NLS-1$
+ public static final String ETA_L = "eta"; //$NON-NLS-1$
+ public static final String ETH_U = "ETH"; //$NON-NLS-1$
+ public static final String ETH_L = "eth"; //$NON-NLS-1$
+ public static final String EUML_U = "Euml"; //$NON-NLS-1$
+ public static final String EUML_L = "euml"; //$NON-NLS-1$
+ public static final String EURO = "euro"; //$NON-NLS-1$
+ public static final String EXIST = "exist"; //$NON-NLS-1$
+ public static final String FNOF = "fnof"; //$NON-NLS-1$
+ public static final String FORALL = "forall"; //$NON-NLS-1$
+ public static final String FRAC12 = "frac12"; //$NON-NLS-1$
+ public static final String FRAC14 = "frac14"; //$NON-NLS-1$
+ public static final String FRAC34 = "frac34"; //$NON-NLS-1$
+ public static final String FRASL = "frasl"; //$NON-NLS-1$
+ public static final String GAMMA_U = "Gamma"; //$NON-NLS-1$
+ public static final String GAMMA_L = "gamma"; //$NON-NLS-1$
+ public static final String GE = "ge"; //$NON-NLS-1$
+ public static final String GT = "gt"; //$NON-NLS-1$
+ public static final String HARR_U = "hArr"; //$NON-NLS-1$
+ public static final String HARR_L = "harr"; //$NON-NLS-1$
+ public static final String HEARTS = "hearts"; //$NON-NLS-1$
+ public static final String HELLIP = "hellip"; //$NON-NLS-1$
+ public static final String IACUTE_U = "Iacute"; //$NON-NLS-1$
+ public static final String IACUTE_L = "iacute"; //$NON-NLS-1$
+ public static final String ICIRC_U = "Icirc"; //$NON-NLS-1$
+ public static final String ICIRC_L = "icirc"; //$NON-NLS-1$
+ public static final String IEXCL = "iexcl"; //$NON-NLS-1$
+ public static final String IGRAVE_U = "Igrave"; //$NON-NLS-1$
+ public static final String IGRAVE_L = "igrave"; //$NON-NLS-1$
+ public static final String IMAGE = "image"; //$NON-NLS-1$
+ public static final String INFIN = "infin"; //$NON-NLS-1$
+ public static final String INT = "int"; //$NON-NLS-1$
+ public static final String IOTA_U = "Iota"; //$NON-NLS-1$
+ public static final String IOTA_L = "iota"; //$NON-NLS-1$
+ public static final String IQUEST = "iquest"; //$NON-NLS-1$
+ public static final String ISIN = "isin"; //$NON-NLS-1$
+ public static final String IUML_U = "Iuml"; //$NON-NLS-1$
+ public static final String IUML_L = "iuml"; //$NON-NLS-1$
+ public static final String KAPPA_U = "Kappa"; //$NON-NLS-1$
+ public static final String KAPPA_L = "kappa"; //$NON-NLS-1$
+ public static final String LAMBDA_U = "Lambda"; //$NON-NLS-1$
+ public static final String LAMBDA_L = "lambda"; //$NON-NLS-1$
+ public static final String LANG = "lang"; //$NON-NLS-1$
+ public static final String LAQUO = "laquo"; //$NON-NLS-1$
+ public static final String LARR_U = "lArr"; //$NON-NLS-1$
+ public static final String LARR_L = "larr"; //$NON-NLS-1$
+ public static final String LCEIL = "lceil"; //$NON-NLS-1$
+ public static final String LDQUO = "ldquo"; //$NON-NLS-1$
+ public static final String LE = "le"; //$NON-NLS-1$
+ public static final String LFLOOR = "lfloor"; //$NON-NLS-1$
+ public static final String LOWAST = "lowast"; //$NON-NLS-1$
+ public static final String LOZ = "loz"; //$NON-NLS-1$
+ public static final String LRM = "lrm"; //$NON-NLS-1$
+ public static final String LSAQUO = "lsaquo"; //$NON-NLS-1$
+ public static final String LSQUO = "lsquo"; //$NON-NLS-1$
+ public static final String LT = "lt"; //$NON-NLS-1$
+ public static final String MACR = "macr"; //$NON-NLS-1$
+ public static final String MDASH = "mdash"; //$NON-NLS-1$
+ public static final String MICRO = "micro"; //$NON-NLS-1$
+ public static final String MIDDOT = "middot"; //$NON-NLS-1$
+ public static final String MINUS = "minus"; //$NON-NLS-1$
+ public static final String MU_U = "Mu"; //$NON-NLS-1$
+ public static final String MU_L = "mu"; //$NON-NLS-1$
+ public static final String NABLA = "nabla"; //$NON-NLS-1$
+ public static final String NBSP = "nbsp"; //$NON-NLS-1$
+ public static final String NDASH = "ndash"; //$NON-NLS-1$
+ public static final String NE = "ne"; //$NON-NLS-1$
+ public static final String NI = "ni"; //$NON-NLS-1$
+ public static final String NOT = "not"; //$NON-NLS-1$
+ public static final String NOTIN = "notin"; //$NON-NLS-1$
+ public static final String NSUB = "nsub"; //$NON-NLS-1$
+ public static final String NTILDE_U = "Ntilde"; //$NON-NLS-1$
+ public static final String NTILDE_L = "ntilde"; //$NON-NLS-1$
+ public static final String NU_U = "Nu"; //$NON-NLS-1$
+ public static final String NU_L = "nu"; //$NON-NLS-1$
+ public static final String OACUTE_U = "Oacute"; //$NON-NLS-1$
+ public static final String OACUTE_L = "oacute"; //$NON-NLS-1$
+ public static final String OCIRC_U = "Ocirc"; //$NON-NLS-1$
+ public static final String OCIRC_L = "ocirc"; //$NON-NLS-1$
+ public static final String OELIG_U = "OElig"; //$NON-NLS-1$
+ public static final String OELIG_L = "oelig"; //$NON-NLS-1$
+ public static final String OGRAVE_U = "Ograve"; //$NON-NLS-1$
+ public static final String OGRAVE_L = "ograve"; //$NON-NLS-1$
+ public static final String OLINE = "oline"; //$NON-NLS-1$
+ public static final String OMEGA_U = "Omega"; //$NON-NLS-1$
+ public static final String OMEGA_L = "omega"; //$NON-NLS-1$
+ public static final String OMICRON_U = "Omicron"; //$NON-NLS-1$
+ public static final String OMICRON_L = "omicron"; //$NON-NLS-1$
+ public static final String OPLUS = "oplus"; //$NON-NLS-1$
+ public static final String OR = "or"; //$NON-NLS-1$
+ public static final String ORDF = "ordf"; //$NON-NLS-1$
+ public static final String ORDM = "ordm"; //$NON-NLS-1$
+ public static final String OSLASH_U = "Oslash"; //$NON-NLS-1$
+ public static final String OSLASH_L = "oslash"; //$NON-NLS-1$
+ public static final String OTILDE_U = "Otilde"; //$NON-NLS-1$
+ public static final String OTILDE_L = "otilde"; //$NON-NLS-1$
+ public static final String OTIMES = "otimes"; //$NON-NLS-1$
+ public static final String OUML_U = "Ouml"; //$NON-NLS-1$
+ public static final String OUML_L = "ouml"; //$NON-NLS-1$
+ public static final String PARA = "para"; //$NON-NLS-1$
+ public static final String PART = "part"; //$NON-NLS-1$
+ public static final String PERMIL = "permil"; //$NON-NLS-1$
+ public static final String PERP = "perp"; //$NON-NLS-1$
+ public static final String PHI_U = "Phi"; //$NON-NLS-1$
+ public static final String PHI_L = "phi"; //$NON-NLS-1$
+ public static final String PI_U = "Pi"; //$NON-NLS-1$
+ public static final String PI_L = "pi"; //$NON-NLS-1$
+ public static final String PIV = "piv"; //$NON-NLS-1$
+ public static final String PLUSMN = "plusmn"; //$NON-NLS-1$
+ public static final String POUND = "pound"; //$NON-NLS-1$
+ public static final String PRIME_U = "Prime"; //$NON-NLS-1$
+ public static final String PRIME_L = "prime"; //$NON-NLS-1$
+ public static final String PROD = "prod"; //$NON-NLS-1$
+ public static final String PROP = "prop"; //$NON-NLS-1$
+ public static final String PSI_U = "Psi"; //$NON-NLS-1$
+ public static final String PSI_L = "psi"; //$NON-NLS-1$
+ public static final String QUOT = "quot"; //$NON-NLS-1$
+ public static final String RADIC = "radic"; //$NON-NLS-1$
+ public static final String RANG = "rang"; //$NON-NLS-1$
+ public static final String RAQUO = "raquo"; //$NON-NLS-1$
+ public static final String RARR_U = "rArr"; //$NON-NLS-1$
+ public static final String RARR_L = "rarr"; //$NON-NLS-1$
+ public static final String RCEIL = "rceil"; //$NON-NLS-1$
+ public static final String RDQUO = "rdquo"; //$NON-NLS-1$
+ public static final String REAL = "real"; //$NON-NLS-1$
+ public static final String REG = "reg"; //$NON-NLS-1$
+ public static final String RFLOOR = "rfloor"; //$NON-NLS-1$
+ public static final String RHO_U = "Rho"; //$NON-NLS-1$
+ public static final String RHO_L = "rho"; //$NON-NLS-1$
+ public static final String RLM = "rlm"; //$NON-NLS-1$
+ public static final String RSAQUO = "rsaquo"; //$NON-NLS-1$
+ public static final String RSQUO = "rsquo"; //$NON-NLS-1$
+ public static final String SBQUO = "sbquo"; //$NON-NLS-1$
+ public static final String SCARON_U = "Scaron"; //$NON-NLS-1$
+ public static final String SCARON_L = "scaron"; //$NON-NLS-1$
+ public static final String SDOT = "sdot"; //$NON-NLS-1$
+ public static final String SECT = "sect"; //$NON-NLS-1$
+ public static final String SHY = "shy"; //$NON-NLS-1$
+ public static final String SIGMA_U = "Sigma"; //$NON-NLS-1$
+ public static final String SIGMA_L = "sigma"; //$NON-NLS-1$
+ public static final String SIGMAF = "sigmaf"; //$NON-NLS-1$
+ public static final String SIM = "sim"; //$NON-NLS-1$
+ public static final String SPADES = "spades"; //$NON-NLS-1$
+ public static final String SUB = "sub"; //$NON-NLS-1$
+ public static final String SUBE = "sube"; //$NON-NLS-1$
+ public static final String SUM = "sum"; //$NON-NLS-1$
+ public static final String SUP = "sup"; //$NON-NLS-1$
+ public static final String SUP1 = "sup1"; //$NON-NLS-1$
+ public static final String SUP2 = "sup2"; //$NON-NLS-1$
+ public static final String SUP3 = "sup3"; //$NON-NLS-1$
+ public static final String SUPE = "supe"; //$NON-NLS-1$
+ public static final String SZLIG = "szlig"; //$NON-NLS-1$
+ public static final String TAU_U = "Tau"; //$NON-NLS-1$
+ public static final String TAU_L = "tau"; //$NON-NLS-1$
+ public static final String THERE4 = "there4"; //$NON-NLS-1$
+ public static final String THETA_U = "Theta"; //$NON-NLS-1$
+ public static final String THETA_L = "theta"; //$NON-NLS-1$
+ public static final String THETASYM = "thetasym"; //$NON-NLS-1$
+ public static final String THINSP = "thinsp"; //$NON-NLS-1$
+ public static final String THORN_U = "THORN"; //$NON-NLS-1$
+ public static final String THORN_L = "thorn"; //$NON-NLS-1$
+ public static final String TILDE = "tilde"; //$NON-NLS-1$
+ public static final String TIMES = "times"; //$NON-NLS-1$
+ public static final String TRADE = "trade"; //$NON-NLS-1$
+ public static final String UACUTE_U = "Uacute"; //$NON-NLS-1$
+ public static final String UACUTE_L = "uacute"; //$NON-NLS-1$
+ public static final String UARR_U = "uArr"; //$NON-NLS-1$
+ public static final String UARR_L = "uarr"; //$NON-NLS-1$
+ public static final String UCIRC_U = "Ucirc"; //$NON-NLS-1$
+ public static final String UCIRC_L = "ucirc"; //$NON-NLS-1$
+ public static final String UGRAVE_U = "Ugrave"; //$NON-NLS-1$
+ public static final String UGRAVE_L = "ugrave"; //$NON-NLS-1$
+ public static final String UML = "uml"; //$NON-NLS-1$
+ public static final String UPSIH = "upsih"; //$NON-NLS-1$
+ public static final String UPSILON_U = "Upsilon"; //$NON-NLS-1$
+ public static final String UPSILON_L = "upsilon"; //$NON-NLS-1$
+ public static final String UUML_U = "Uuml"; //$NON-NLS-1$
+ public static final String UUML_L = "uuml"; //$NON-NLS-1$
+ public static final String WEIERP = "weierp"; //$NON-NLS-1$
+ public static final String XI_U = "Xi"; //$NON-NLS-1$
+ public static final String XI_L = "xi"; //$NON-NLS-1$
+ public static final String YACUTE_U = "Yacute"; //$NON-NLS-1$
+ public static final String YACUTE_L = "yacute"; //$NON-NLS-1$
+ public static final String YEN = "yen"; //$NON-NLS-1$
+ public static final String YUML_U = "Yuml"; //$NON-NLS-1$
+ public static final String YUML_L = "yuml"; //$NON-NLS-1$
+ public static final String ZETA_U = "Zeta"; //$NON-NLS-1$
+ public static final String ZETA_L = "zeta"; //$NON-NLS-1$
+ public static final String ZWJ = "zwj"; //$NON-NLS-1$
+ public static final String ZWNJ = "zwnj"; //$NON-NLS-1$
+ }
+
+ public static final String HTML40_URI = "http://www.w3.org/TR/REC-html40/frameset.dtd"; //$NON-NLS-1$
+ public static final String HTML40_TAG_PREFIX = ""; //$NON-NLS-1$
+ // global attribute names
+ public static final String ATTR_NAME_ID = "id"; // %coreattrs;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CLASS = "class"; // %coreattrs;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_STYLE = "style"; // %coreattrs;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TITLE = "title"; // %coreattrs;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LANG = "lang"; // %i18n;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DIR = "dir"; // %i18n; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONCLICK = "onclick"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONDBLCLICK = "ondblclick"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEDOWN = "onmousedown"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEUP = "onmouseup"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEOVER = "onmouseover"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEMOVE = "onmousemove"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEOUT = "onmouseout"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONKEYPRESS = "onkeypress"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONKEYDOWN = "onkeydown"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONKEYUP = "onkeyup"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONHELP = "onhelp"; // %events;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_BGCOLOR = "bgcolor"; // %bodycolor;,
+ // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TEXT = "text"; // %bodycolor;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LINK = "link"; // %bodycolor;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VLINK = "vlink"; // %bodycolor;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ALINK = "alink"; // %bodycolor;
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VERSION = "version"; // HTML
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_PROFILE = "profile"; // HEAD
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONLOAD = "onload"; // BODY
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONUNLOAD = "onunload"; // BODY
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_BACKGROUND = "background"; // BODY,
+ // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SRC = "src"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_ALT = "alt"; // IMG,AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LONGDESC = "longdesc"; // IMG
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_NAME = "name"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_HEIGHT = "height"; // IMG, TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_WIDTH = "width"; // IMG, TABLE,HR
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_USEMAP = "usemap"; // IMG
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ISMAP = "ismap"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_ALIGN = "align"; // IMG, TABLE,HR
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_BORDER = "border"; // IMG, TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_HSPACE = "hspace"; // IMG
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VSPACE = "vspace"; // IMG
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MAPFILE = "mapfile"; // IMG
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SUMMARY = "summary"; // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_FRAME = "frame"; // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_RULES = "rules"; // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CELLSPACING = "cellspacing"; // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CELLPADDING = "cellpadding"; // TABLE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DATAPAGESIZE = "datapagesize"; // TABLE,HR
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_COLOR = "color"; // BASEFONT,FONT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_FACE = "face"; // BASEFONT,FONT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SIZE = "size"; // BASEFONT,FONT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CLEAR = "clear"; // BR //$NON-NLS-1$
+ public static final String ATTR_NAME_SHAPE = "shape"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_COORDS = "coords"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_HREF = "href"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_TARGET = "target"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_NOHREF = "nohref"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TABINDEX = "tabindex"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ACCESSKEY = "accesskey"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONFOCUS = "onfocus"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONBLUR = "onblur"; // AREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CHARSET = "charset"; // LINK
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_HREFLANG = "hreflang"; // LINK
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TYPE = "type"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_REL = "rel"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_REV = "rev"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_MEDIA = "media"; // LINK
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VALUE = "value"; // PARAM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VALUETYPE = "valuetype"; // PARAM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_NOSHADE = "noshade"; // HR
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CHECKED = "checked"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DISABLED = "disabled"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_READONLY = "readonly"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MAXLENGTH = "maxlength"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONSELECT = "onselect"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONCHANGE = "onchange"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ACCEPT = "accept"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ISTYLE = "istyle"; // INPUT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CHAR = "char"; // COL //$NON-NLS-1$
+ public static final String ATTR_NAME_CHAROFF = "charoff"; // COL
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VALIGN = "valign"; // COL
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SPAN = "span"; // COL //$NON-NLS-1$
+ public static final String ATTR_NAME_FRAMEBORDER = "frameborder"; // FRAME
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MARGINWIDTH = "marginwidth"; // FRAME
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MARGINHEIGHT = "marginheight"; // FRAME
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_NORESIZE = "noresize"; // FRAME
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SCROLLING = "scrolling"; // FRAME
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_PROMPT = "prompt"; // ISINDEX
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_HTTP_EQUIV = "http-equiv"; // META
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CONTENT = "content"; // META
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SCHEME = "scheme"; // META
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ERRMSG = "errmsg"; // ssi:config
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SIZEFMT = "sizefmt"; // ssi:config
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TIMEFMT = "timefmt"; // ssi:config
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VAR = "var"; // ssi:echo
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CGI = "cgi"; // ssi:exec
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CMD = "cmd"; // ssi:exec
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_FILE = "file"; // ssi:fsize
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VIRTUAL = "virtual"; // ssi:fsize
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SELECTED = "selected"; // OPTION
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LABEL = "label"; // OPTION
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ROWS = "rows"; // TEXTAREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_COLS = "cols"; // TEXTAREA
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LANGUAGE = "language"; // SCRIPT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DEFER = "defer"; // SCRIPT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_EVENT = "event"; // SCRIPT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_FOR = "for"; // SCRIPT //$NON-NLS-1$
+ public static final String ATTR_NAME_COMPACT = "compact"; // OL/UL
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_START = "start"; // OL/UL
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DIRECTKEY = "directkey"; // A
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CODEBASE = "codebase"; // APPLET
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ARCHIVE = "archive"; // APPLET
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CODE = "code"; // APPLET
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_OBJECT = "object"; // APPLET
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MAYSCRIPT = "mayscript"; // APPLET
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CITE = "cite"; // BLOCKQUOTE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MACRO = "macro"; // D2W //$NON-NLS-1$
+ public static final String ATTR_NAME_DATETIME = "datetime"; // INS/DEL
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LOOP = "loop"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_HIDDEN = "hidden"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_VOLUME = "volume"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOSTART = "autostart"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOPLAY = "autoplay"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOSIZE = "autosize"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CONTROLLER = "controller";// EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SCALE = "scale"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SHOWCONTROLS = "showcontrols";// EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_PLAYCOUNT = "playcount"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_REPEAT = "repeat"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_PANEL = "panel"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_PALETTE = "palette"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TEXTFOCUS = "textfocus"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ACTION = "action"; // FORM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_METHOD = "method"; // FORM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ENCTYPE = "enctype"; // FORM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONSUBMIT = "onsubmit"; // FORM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ONRESET = "onreset"; // FORM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ACCEPT_CHARSET = "accept-charset";// FORM
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_BEHAVIOR = "behavior"; // MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DIRECTION = "direction"; // MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SCROLLAMOUNT = "scrollamount";// MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SCROLLDELAY = "scrolldelay";// MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_TRUESPEED = "truespeed"; // MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DECLARE = "declare"; // OBJECT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CLASSID = "classid"; // OBJECT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_DATA = "data"; // OBJECT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_CODETYPE = "codetype"; // OBJECT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_STANDBY = "standby"; // OBJECT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_MULTIPLE = "multiple"; // SELECT
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ABBR = "abbr"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_AXIS = "axis"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_HEADERS = "headers"; // TH/TD
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_SCOPE = "scope"; // TH/TD
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_ROWSPAN = "rowspan"; // TH/TD
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_COLSPAN = "colspan"; // TH/TD
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_NOWRAP = "nowrap"; // TH/TD
+ // //$NON-NLS-1$
+ // <<D205514
+ public static final String ATTR_NAME_TOPMARGIN = "topmargin"; // BODY
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_BOTTOMMARGIN = "bottommargin"; // BODY
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_LEFTMARGIN = "leftmargin"; // BODY
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_RIGHTMARGIN = "rightmargin"; // BODY
+ // //$NON-NLS-1$
+ public static final String ATTR_NAME_BORDERCOLOR = "bordercolor"; // TABLE/TR/TH/TD/FRAMESET/FRAME
+ // //$NON-NLS-1$
+ // for WML
+ public static final String WML_ATTR_NAME_TITLE = "title"; // card
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_DOMAIN = "domain"; // access
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_PATH = "path"; // access
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONENTERFORWARD = "onenterforward"; // template,card
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONENTERBACKWARD = "onenterbackward"; // template,card
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONPICK = "onpick"; // option
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONTIMER = "ontimer"; // template,card
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_NEWCONTEXT = "newcontext"; // card
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ORDERED = "ordered"; // card
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_OPTIONAL = "optional"; // do
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_CACHE_CONTROL = "cache-control"; // go
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_SENDREFERER = "sendreferer"; // go
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_METHOD = "method"; // go
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ENCTYPE = "enctype"; // go
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ACCEPT_CHARSET = "accept-charset"; // go
+ // //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_COLUMNS = "columns"; // table
+ // //$NON-NLS-1$
+ // D205514
+ //<<D215684
+ public static final String ATTR_NAME_FRAMESPACING = "framespacing"; // FRAMESET
+ // //$NON-NLS-1$
+ //D215684
+ // global attribute values; mainly used in enumeration.
+ public static final String ATTR_VALUE_VERSION_TRANSITIONAL = "-//W3C//DTD HTML 4.01 Transitional//EN"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_VERSION_FRAMESET = "-//W3C//DTD HTML 4.01 Frameset//EN"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_LTR = "ltr"; // dir //$NON-NLS-1$
+ public static final String ATTR_VALUE_RTL = "rtl"; // dir //$NON-NLS-1$
+ // for align (top|middle|bottom|left|right)
+ public static final String ATTR_VALUE_TOP = "top"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_MIDDLE = "middle"; // align
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_BOTTOM = "bottom"; // align
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_LEFT = "left"; // align
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_CENTER = "center"; // align
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_RIGHT = "right"; // align
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_JUSTIFY = "justify"; // align
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_CHAR = "char"; // align
+ // //$NON-NLS-1$
+ // for valign (baseline)
+ public static final String ATTR_VALUE_BASELINE = "baseline"; // valign
+ // //$NON-NLS-1$
+ // for clear (left|all|right|none): left and right are already defined
+ // above.
+ public static final String ATTR_VALUE_ALL = "all"; // clear //$NON-NLS-1$
+ public static final String ATTR_VALUE_NONE = "none"; // clear
+ // //$NON-NLS-1$
+ // for shape (rect|circle|poly|default)
+ public static final String ATTR_VALUE_RECT = "rect"; // shape
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_CIRCLE = "circle"; // shape
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_POLY = "poly"; // shape
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_DEFAULT = "default"; // shape
+ // //$NON-NLS-1$
+ // for valuetype (data|ref|object)
+ public static final String ATTR_VALUE_DATA = "data"; // valuetype
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_REF = "ref"; // valuetype
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_OBJECT = "object"; // valuetype
+ // //$NON-NLS-1$
+ // for type of INPUT
+ // (text | password | checkbox | radio | submit | reset |
+ // file | hidden | image | button)
+ public static final String ATTR_VALUE_TEXT = "text"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_PASSWORD = "password"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_CHECKBOX = "checkbox"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_RADIO = "radio"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_SUBMIT = "submit"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_RESET = "reset"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_FILE = "file"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_HIDDEN = "hidden"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_IMAGE = "image"; // INPUT:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_BUTTON = "button"; // INPUT:type
+ // //$NON-NLS-1$
+ // for span, colspan, rowspan
+ public static final String ATTR_VALUE_1 = "1"; // span //$NON-NLS-1$
+ // for frameborder
+ public static final String ATTR_VALUE_0 = "0"; // FRAME //$NON-NLS-1$
+ // for scrolling
+ public static final String ATTR_VALUE_YES = "yes"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_VALUE_NO = "no"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_VALUE_AUTO = "auto"; // FRAME
+ // //$NON-NLS-1$
+ // for UL
+ public static final String ATTR_VALUE_DISC = "disc"; // UL:type
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_SQUARE = "square"; // UL:type
+ // //$NON-NLS-1$
+ // for frame of TABLE
+ public static final String ATTR_VALUE_VOID = "void"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_ABOVE = "above"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_BELOW = "below"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_HSIDES = "hsides"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_LHS = "lhs"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_RHS = "rhs"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_VSIDES = "vsides"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_BOX = "box"; // TABLE:frame
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_BORDER = "border"; // TABLE:frame
+ // //$NON-NLS-1$
+ // for rules of TABLE
+ public static final String ATTR_VALUE_GROUPS = "groups"; // TABLE:rules
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_ROWS = "rows"; // TEXTAREA
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_COLS = "cols"; // TEXTAREA
+ // //$NON-NLS-1$
+ // for method of FORM
+ public static final String ATTR_VALUE_GET = "get"; // FORM //$NON-NLS-1$
+ public static final String ATTR_VALUE_POST = "post"; // FORM //$NON-NLS-1$
+ public static final String ATTR_VALUE_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
+ // for scope of (TH | TD)
+ public static final String ATTR_VALUE_ROW = "row"; // (TH|TD):scope
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_COL = "col"; // (TH|TD):scope
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_ROWGROUP = "rowgroup";// (TH|TD):scope
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_COLGROUP = "colgroup";// (TH|TD):scope
+ // //$NON-NLS-1$
+ // for auto?? of EMBED
+ public static final String ATTR_VALUE_TRUE = "true"; // EMBED
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_FALSE = "false"; // EMBED
+ // //$NON-NLS-1$
+ // for behaviro of MARQUEE
+ public static final String ATTR_VALUE_SCROLL = "scroll"; // MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_SLIDE = "slide"; // MARQUEE
+ // //$NON-NLS-1$
+ public static final String ATTR_VALUE_ALTERNATE = "alternate"; // MARQUEE
+ // //$NON-NLS-1$
+ // for direction of MARQUEE
+ public static final String ATTR_VALUE_UP = "up"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_VALUE_DOWN = "down"; // MARQUEE
+ // //$NON-NLS-1$
+ // for type of LI (D19924)
+ public static final String ATTR_VALUE_NUMBER = "1"; // LI //$NON-NLS-1$
+ public static final String ATTR_VALUE_LOWER_ALPHA = "a"; // LI
+ // //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ContentSettingsRegistry.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ContentSettingsRegistry.java
new file mode 100644
index 0000000000..97638179f1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ContentSettingsRegistry.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentproperties;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+import org.eclipse.wst.css.core.metamodel.CSSProfileRegistry;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ComboList;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+
+public final class ContentSettingsRegistry {
+ private static final String NONE = ResourceHandler.getString("UI_none"); //$NON-NLS-1$
+
+ public static void setCSSMetaModelRegistryInto(ComboList combo) {
+ combo.add(NONE, ""); //$NON-NLS-1$
+ CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
+ Iterator i = reg.getProfiles();
+ while (i.hasNext()) {
+ CSSProfile profile = (CSSProfile) i.next();
+ String id = profile.getProfileID();
+ String name = profile.getProfileName();
+ combo.add(name, id);
+ }
+ combo.sortByKey(1);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ui/CSSContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ui/CSSContentSettingsPropertyPage.java
new file mode 100644
index 0000000000..e2c70ca078
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/contentproperties/ui/CSSContentSettingsPropertyPage.java
@@ -0,0 +1,101 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.contentproperties.ui;
+
+
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.css.ui.contentproperties.ContentSettingsRegistry;
+import org.eclipse.wst.css.ui.internal.Logger;
+import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.ui.contentproperties.IContentSettings;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ComboListOnPropertyPage;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ContentSettingsPropertyPage;
+
+public final class CSSContentSettingsPropertyPage extends ContentSettingsPropertyPage {
+
+ private final int N_CSS_PROFILE = 0;
+
+
+
+ public CSSContentSettingsPropertyPage() {
+ super();
+ numberOfCombo = 1;
+ numCols = 2;
+ numRows = 1;
+ combo = new ComboListOnPropertyPage[super.numberOfCombo];
+
+ }
+
+ protected void createCSSComboBox() {
+ super.combo[N_CSS_PROFILE] = super.createComboBoxOf(CSS_LABEL);
+ ContentSettingsRegistry.setCSSMetaModelRegistryInto(combo[N_CSS_PROFILE]);
+ if (combo[N_CSS_PROFILE].getItemCount() <= 0)
+ return;
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_CSS_PROFILE], initValue);
+ }
+
+
+
+ protected void createSettingsPageGUI() {
+
+ int type = ((IResource) getElement()).getType();
+ switch (type) {
+ case IResource.FILE :
+ //composite = createComposite(propertyPage,numCols,numRows);
+ createCSSComboBox();
+ WorkbenchHelp.setHelp(propertyPage, IHelpContextIds.CSS_CONTENT_SETTINGS_HELPID);
+ break;
+
+ default :
+ Logger.log(Logger.WARNING, "CSSContentSettingsPropertyPage is instantiated by resource except FILE");//$NON-NLS-1$
+ break;
+ }
+
+ }
+
+
+ protected void putSelectedPropertyInto(Map properties, String valueInCombo, int index) {
+
+ switch (index) {
+ case N_CSS_PROFILE :
+ // css
+ properties.put(IContentSettings.CSS_PROFILE, valueInCombo);
+ break;
+ default :
+ Logger.log(Logger.ERROR, "Index is out of range in putSelectedPropertyInto() in class CSSContentSettingsPropertyPage");//$NON-NLS-1$
+ break;
+ }
+
+ }
+
+ protected void deleteNoneProperty(int index) {
+ switch (index) {
+ case N_CSS_PROFILE :
+ // css
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
+ break;
+
+ default :
+ Logger.log(Logger.ERROR, "Index is out of range in deleteNoneProperty() in class CSSContentSettingsPropertyPage");//$NON-NLS-1$
+ break;
+ }
+ }
+
+}
+
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupActionCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupActionCSS.java
new file mode 100644
index 0000000000..529da96642
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupActionCSS.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.edit.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.css.core.cleanup.CleanupProcessorCSS;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupProcessor;
+import org.eclipse.wst.sse.ui.edit.util.CleanupAction;
+
+public class CleanupActionCSS extends CleanupAction {
+ protected IStructuredCleanupProcessor fCleanupProcessor;
+
+ public CleanupActionCSS(ResourceBundle bundle, String prefix, ITextEditor editor) {
+ super(bundle, prefix, editor);
+ }
+
+ protected Dialog getCleanupDialog(Shell shell) {
+ if (fCleanupDialog == null)
+ fCleanupDialog = new CleanupDialogCSS(shell);
+
+ return fCleanupDialog;
+ }
+
+ protected IStructuredCleanupProcessor getCleanupProcessor() {
+ if (fCleanupProcessor == null)
+ fCleanupProcessor = new CleanupProcessorCSS();
+
+ return fCleanupProcessor;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupDialogCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupDialogCSS.java
new file mode 100644
index 0000000000..bb901ea12c
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/edit/ui/CleanupDialogCSS.java
@@ -0,0 +1,292 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.edit.ui;
+
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategy;
+import org.eclipse.wst.css.core.cleanup.CSSCleanupStrategyImpl;
+import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+
+public class CleanupDialogCSS extends Dialog {
+
+ private boolean embeddedCSS;
+ protected Button fRadioButtonIdentCaseAsis;
+ protected Button fRadioButtonIdentCaseLower;
+ protected Button fRadioButtonIdentCaseUpper;
+ protected Button fRadioButtonPropNameCaseAsis;
+ protected Button fRadioButtonPropNameCaseLower;
+ protected Button fRadioButtonPropNameCaseUpper;
+ protected Button fRadioButtonPropValueCaseAsis;
+ protected Button fRadioButtonPropValueCaseLower;
+ protected Button fRadioButtonPropValueCaseUpper;
+ protected Button fRadioButtonSelectorTagCaseAsis;
+ protected Button fRadioButtonSelectorTagCaseLower;
+ protected Button fRadioButtonSelectorTagCaseUpper;
+ protected Button fCheckBoxQuoteValues;
+ protected Button fCheckBoxFormatSource;
+
+ /**
+ * CSSCleanupDialog constructor comment.
+ *
+ * @param parentShell
+ * org.eclipse.swt.widgets.Shell
+ */
+ public CleanupDialogCSS(Shell parentShell) {
+ super(parentShell);
+ }
+
+ /**
+ *
+ * @return org.eclipse.swt.widgets.Control
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
+ */
+ public Control createDialogArea(Composite parent) {
+ if (isEmbeddedCSS())
+ getShell().setText(ResourceHandler.getString("CSS_Cleanup_UI_")); //$NON-NLS-1$ = "CSS Cleanup"
+ else
+ getShell().setText(ResourceHandler.getString("Cleanup_UI_")); //$NON-NLS-1$ = "Cleanup"
+
+ Composite panel = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.makeColumnsEqualWidth = true;
+ panel.setLayout(layout);
+
+ WorkbenchHelp.setHelp(panel, IHelpContextIds.CSS_CLEANUP_HELPID);
+
+ // Convert ident case
+ // ACC: Group radio buttons together so associated label is read
+ // Label identCaseLabel = new Label(panel, SWT.NULL);
+ // identCaseLabel.setText(ResourceHandler.getString("Identifier_case__UI_"));
+ // //$NON-NLS-1$ = "Identifier case:"
+ // Canvas identCase = new Canvas(panel, SWT.NULL);
+ Group identCase = new Group(panel, SWT.NULL);
+ identCase.setText(ResourceHandler.getString("Identifier_case__UI_")); //$NON-NLS-1$ = "Identifier case:"
+ GridLayout hLayout = new GridLayout();
+ hLayout.numColumns = 3;
+ identCase.setLayout(hLayout);
+ fRadioButtonIdentCaseAsis = new Button(identCase, SWT.RADIO);
+ fRadioButtonIdentCaseAsis.setText(ResourceHandler.getString("As-is_UI_")); //$NON-NLS-1$ = "As-is"
+ fRadioButtonIdentCaseLower = new Button(identCase, SWT.RADIO);
+ fRadioButtonIdentCaseLower.setText(ResourceHandler.getString("Lower_UI_")); //$NON-NLS-1$ = "Lower"
+ fRadioButtonIdentCaseUpper = new Button(identCase, SWT.RADIO);
+ fRadioButtonIdentCaseUpper.setText(ResourceHandler.getString("Upper_UI_")); //$NON-NLS-1$ = "Upper"
+
+ // Convert property name case
+ // ACC: Group radio buttons together so associated label is read
+ // Label propNameCaseLabel = new Label(panel, SWT.NULL);
+ // propNameCaseLabel.setText(ResourceHandler.getString("Property_name_case__UI_"));
+ // //$NON-NLS-1$ = "Property name case:"
+ // Canvas propNameCase = new Canvas(panel, SWT.NULL);
+ Group propNameCase = new Group(panel, SWT.NULL);
+ propNameCase.setText(ResourceHandler.getString("Property_name_case__UI_")); //$NON-NLS-1$ = "Property name case:"
+ hLayout = new GridLayout();
+ hLayout.numColumns = 3;
+ propNameCase.setLayout(hLayout);
+ fRadioButtonPropNameCaseAsis = new Button(propNameCase, SWT.RADIO);
+ fRadioButtonPropNameCaseAsis.setText(ResourceHandler.getString("As-is_UI_")); //$NON-NLS-1$ = "As-is"
+ fRadioButtonPropNameCaseLower = new Button(propNameCase, SWT.RADIO);
+ fRadioButtonPropNameCaseLower.setText(ResourceHandler.getString("Lower_UI_")); //$NON-NLS-1$ = "Lower"
+ fRadioButtonPropNameCaseUpper = new Button(propNameCase, SWT.RADIO);
+ fRadioButtonPropNameCaseUpper.setText(ResourceHandler.getString("Upper_UI_")); //$NON-NLS-1$ = "Upper"
+
+ // Convert property Value case
+ // ACC: Group radio buttons together so associated label is read
+ // Label propValueCaseLabel = new Label(panel, SWT.NULL);
+ // propValueCaseLabel.setText(ResourceHandler.getString("Property_value_case__UI_"));
+ // //$NON-NLS-1$ = "Property value case:"
+ // Canvas propValueCase = new Canvas(panel, SWT.NULL);
+ Group propValueCase = new Group(panel, SWT.NULL);
+ propValueCase.setText(ResourceHandler.getString("Property_value_case__UI_")); //$NON-NLS-1$ = "Property value case:"
+ hLayout = new GridLayout();
+ hLayout.numColumns = 3;
+ propValueCase.setLayout(hLayout);
+ fRadioButtonPropValueCaseAsis = new Button(propValueCase, SWT.RADIO);
+ fRadioButtonPropValueCaseAsis.setText(ResourceHandler.getString("As-is_UI_")); //$NON-NLS-1$ = "As-is"
+ fRadioButtonPropValueCaseLower = new Button(propValueCase, SWT.RADIO);
+ fRadioButtonPropValueCaseLower.setText(ResourceHandler.getString("Lower_UI_")); //$NON-NLS-1$ = "Lower"
+ fRadioButtonPropValueCaseUpper = new Button(propValueCase, SWT.RADIO);
+ fRadioButtonPropValueCaseUpper.setText(ResourceHandler.getString("Upper_UI_")); //$NON-NLS-1$ = "Upper"
+
+ if (!isEmbeddedCSS()) {
+ // Convert selector tag case
+ // ACC: Group radio buttons together so associated label is read
+ // Label selectorTagCaseLabel = new Label(panel, SWT.NULL);
+ // selectorTagCaseLabel.setText(ResourceHandler.getString("Selector_tag_name_case__UI_"));
+ // //$NON-NLS-1$ = "Selector tag name case:"
+ // Canvas selectorTagCase = new Canvas(panel, SWT.NULL);
+ Group selectorTagCase = new Group(panel, SWT.NULL);
+ selectorTagCase.setText(ResourceHandler.getString("Selector_tag_name_case__UI_")); //$NON-NLS-1$ = "Selector tag name case:"
+ hLayout = new GridLayout();
+ hLayout.numColumns = 3;
+ selectorTagCase.setLayout(hLayout);
+ fRadioButtonSelectorTagCaseAsis = new Button(selectorTagCase, SWT.RADIO);
+ fRadioButtonSelectorTagCaseAsis.setText(ResourceHandler.getString("As-is_UI_")); //$NON-NLS-1$ = "As-is"
+ fRadioButtonSelectorTagCaseLower = new Button(selectorTagCase, SWT.RADIO);
+ fRadioButtonSelectorTagCaseLower.setText(ResourceHandler.getString("Lower_UI_")); //$NON-NLS-1$ = "Lower"
+ fRadioButtonSelectorTagCaseUpper = new Button(selectorTagCase, SWT.RADIO);
+ fRadioButtonSelectorTagCaseUpper.setText(ResourceHandler.getString("Upper_UI_")); //$NON-NLS-1$ = "Upper"
+ }
+
+ // Quote attribute values
+ fCheckBoxQuoteValues = new Button(panel, SWT.CHECK);
+ fCheckBoxQuoteValues.setText(ResourceHandler.getString("Quote_values_UI_")); //$NON-NLS-1$ = "Quote values"
+
+ if (!isEmbeddedCSS()) {
+ // Format source
+ fCheckBoxFormatSource = new Button(panel, SWT.CHECK);
+ fCheckBoxFormatSource.setText(ResourceHandler.getString("Format_source_UI_")); //$NON-NLS-1$ = "Format source"
+ }
+
+ setCleanupOptions();
+
+ return panel;
+ }
+
+ /**
+ * Insert the method's description here.
+ *
+ * @return boolean
+ */
+ public boolean isEmbeddedCSS() {
+ return embeddedCSS;
+ }
+
+ /**
+ *
+ */
+ protected void okPressed() {
+ updateCleanupOptions();
+ super.okPressed();
+ }
+
+ /**
+ *
+ */
+ protected void setCleanupOptions() {
+ CSSCleanupStrategy stgy = CSSCleanupStrategyImpl.getInstance();
+
+ if (fRadioButtonIdentCaseAsis != null) {
+ if (stgy.getIdentCase() == CSSCleanupStrategy.UPPER)
+ fRadioButtonIdentCaseUpper.setSelection(true);
+ else if (stgy.getIdentCase() == CSSCleanupStrategy.LOWER)
+ fRadioButtonIdentCaseLower.setSelection(true);
+ else
+ fRadioButtonIdentCaseAsis.setSelection(true);
+ }
+
+ if (fRadioButtonPropNameCaseAsis != null) {
+ if (stgy.getPropNameCase() == CSSCleanupStrategy.UPPER)
+ fRadioButtonPropNameCaseUpper.setSelection(true);
+ else if (stgy.getPropNameCase() == CSSCleanupStrategy.LOWER)
+ fRadioButtonPropNameCaseLower.setSelection(true);
+ else
+ fRadioButtonPropNameCaseAsis.setSelection(true);
+ }
+
+ if (fRadioButtonPropValueCaseAsis != null) {
+ if (stgy.getPropValueCase() == CSSCleanupStrategy.UPPER)
+ fRadioButtonPropValueCaseUpper.setSelection(true);
+ else if (stgy.getPropValueCase() == CSSCleanupStrategy.LOWER)
+ fRadioButtonPropValueCaseLower.setSelection(true);
+ else
+ fRadioButtonPropValueCaseAsis.setSelection(true);
+ }
+
+ if (fRadioButtonSelectorTagCaseAsis != null) {
+ if (stgy.getSelectorTagCase() == CSSCleanupStrategy.UPPER)
+ fRadioButtonSelectorTagCaseUpper.setSelection(true);
+ else if (stgy.getSelectorTagCase() == CSSCleanupStrategy.LOWER)
+ fRadioButtonSelectorTagCaseLower.setSelection(true);
+ else
+ fRadioButtonSelectorTagCaseAsis.setSelection(true);
+ }
+
+ if (fCheckBoxQuoteValues != null)
+ fCheckBoxQuoteValues.setSelection(stgy.isQuoteValues());
+
+ if (fCheckBoxFormatSource != null)
+ fCheckBoxFormatSource.setSelection(stgy.isFormatSource());
+
+ }
+
+ /**
+ * Insert the method's description here.
+ *
+ * @param newEmbeddedCSS
+ * boolean
+ */
+ public void setEmbeddedCSS(boolean newEmbeddedCSS) {
+ embeddedCSS = newEmbeddedCSS;
+ }
+
+ /**
+ *
+ */
+ protected void updateCleanupOptions() {
+ CSSCleanupStrategy stgy = CSSCleanupStrategyImpl.getInstance();
+
+ if (fRadioButtonIdentCaseAsis != null) {
+ if (fRadioButtonIdentCaseUpper.getSelection())
+ stgy.setIdentCase(CSSCleanupStrategy.UPPER);
+ else if (fRadioButtonIdentCaseLower.getSelection())
+ stgy.setIdentCase(CSSCleanupStrategy.LOWER);
+ else
+ stgy.setIdentCase(CSSCleanupStrategy.ASIS);
+ }
+
+ if (fRadioButtonPropNameCaseAsis != null) {
+ if (fRadioButtonPropNameCaseUpper.getSelection())
+ stgy.setPropNameCase(CSSCleanupStrategy.UPPER);
+ else if (fRadioButtonPropNameCaseLower.getSelection())
+ stgy.setPropNameCase(CSSCleanupStrategy.LOWER);
+ else
+ stgy.setPropNameCase(CSSCleanupStrategy.ASIS);
+ }
+
+ if (fRadioButtonPropValueCaseAsis != null) {
+ if (fRadioButtonPropValueCaseUpper.getSelection())
+ stgy.setPropValueCase(CSSCleanupStrategy.UPPER);
+ else if (fRadioButtonPropValueCaseLower.getSelection())
+ stgy.setPropValueCase(CSSCleanupStrategy.LOWER);
+ else
+ stgy.setPropValueCase(CSSCleanupStrategy.ASIS);
+ }
+
+ if (fRadioButtonSelectorTagCaseAsis != null) {
+ if (fRadioButtonSelectorTagCaseUpper.getSelection())
+ stgy.setSelectorTagCase(CSSCleanupStrategy.UPPER);
+ else if (fRadioButtonSelectorTagCaseLower.getSelection())
+ stgy.setSelectorTagCase(CSSCleanupStrategy.LOWER);
+ else
+ stgy.setSelectorTagCase(CSSCleanupStrategy.ASIS);
+ }
+
+ if (fCheckBoxQuoteValues != null)
+ stgy.setQuoteValues(fCheckBoxQuoteValues.getSelection());
+
+ if (fCheckBoxFormatSource != null)
+ stgy.setFormatSource(fCheckBoxFormatSource.getSelection());
+
+ // save these values to preferences
+ ((CSSCleanupStrategyImpl) stgy).saveOptions();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageHelper.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageHelper.java
new file mode 100644
index 0000000000..47c3c888bb
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageHelper.java
@@ -0,0 +1,124 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.image;
+
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.css.ui.CSSEditorPlugin;
+import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages;
+
+
+public class CSSImageHelper {
+ /**
+ * singleton
+ */
+ public synchronized static CSSImageHelper getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSImageHelper();
+ }
+ return fInstance;
+ }
+
+ /**
+ * by relative path(from here)
+ */
+ public Image getImage(String resource) {
+ if (resource == null) {
+ return null;
+ }
+ Image image = getImageRegistry().get(resource);
+ if (image == null) {
+ image = createImage(resource);
+ }
+ return image;
+ }
+
+ /**
+ * by type
+ */
+ public Image getImage(CSSImageType type) {
+ if (fTypeMap == null) {
+ fTypeMap = new HashMap();
+ fTypeMap.put(CSSImageType.STYLESHEET, CSSEditorPluginImages.IMG_OBJ_STYLESHEET);
+
+ fTypeMap.put(CSSImageType.RULE_CHARSET, CSSEditorPluginImages.IMG_OBJ_RULE_CHARSET);
+ fTypeMap.put(CSSImageType.RULE_FONTFACE, CSSEditorPluginImages.IMG_OBJ_RULE_FONTFACE);
+ fTypeMap.put(CSSImageType.RULE_IMPORT, CSSEditorPluginImages.IMG_OBJ_RULE_IMPORT);
+ fTypeMap.put(CSSImageType.RULE_MEDIA, CSSEditorPluginImages.IMG_OBJ_RULE_MEDIA);
+ fTypeMap.put(CSSImageType.RULE_PAGE, CSSEditorPluginImages.IMG_OBJ_RULE_PAGE);
+ fTypeMap.put(CSSImageType.RULE_STYLE, CSSEditorPluginImages.IMG_OBJ_RULE_STYLE);
+ fTypeMap.put(CSSImageType.RULE_UNKNOWN, CSSEditorPluginImages.IMG_OBJ_RULE_UNKNOWN);
+
+ fTypeMap.put(CSSImageType.SELECTOR_CLASS, CSSEditorPluginImages.IMG_OBJ_SELECTOR_CLASS);
+ fTypeMap.put(CSSImageType.SELECTOR_ID, CSSEditorPluginImages.IMG_OBJ_SELECTOR_ID);
+ fTypeMap.put(CSSImageType.SELECTOR_PSEUDO, CSSEditorPluginImages.IMG_OBJ_SELECTOR_PSEUDO);
+ fTypeMap.put(CSSImageType.SELECTOR_TAG, CSSEditorPluginImages.IMG_OBJ_SELECTOR_TAG);
+ fTypeMap.put(CSSImageType.SELECTOR_LINK, CSSEditorPluginImages.IMG_OBJ_SELECTOR_LINK);
+ fTypeMap.put(CSSImageType.SELECTOR_DEFAULT, CSSEditorPluginImages.IMG_OBJ_SELECTOR_DEFAULT);
+
+ fTypeMap.put(CSSImageType.VALUE_FUNCTION, CSSEditorPluginImages.IMG_OBJ_VALUE_FUNCTION);
+ fTypeMap.put(CSSImageType.VALUE_NUMBER, CSSEditorPluginImages.IMG_OBJ_VALUE_NUMBER);
+ fTypeMap.put(CSSImageType.VALUE_STRING, CSSEditorPluginImages.IMG_OBJ_VALUE_STRING);
+
+ fTypeMap.put(CSSImageType.CATEGORY_AURAL, CSSEditorPluginImages.IMG_OBJ_CATEGORY_AURAL);
+ fTypeMap.put(CSSImageType.CATEGORY_BOX, CSSEditorPluginImages.IMG_OBJ_CATEGORY_BOX);
+ fTypeMap.put(CSSImageType.CATEGORY_COLORANDBACKGROUND, CSSEditorPluginImages.IMG_OBJ_CATEGORY_COLORANDBACKGROUND);
+ fTypeMap.put(CSSImageType.CATEGORY_CONTENT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_CONTENT);
+ fTypeMap.put(CSSImageType.CATEGORY_FONT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_FONT);
+ fTypeMap.put(CSSImageType.CATEGORY_PAGE, CSSEditorPluginImages.IMG_OBJ_CATEGORY_PAGE);
+ fTypeMap.put(CSSImageType.CATEGORY_TABLES, CSSEditorPluginImages.IMG_OBJ_CATEGORY_TABLES);
+ fTypeMap.put(CSSImageType.CATEGORY_TEXT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_TEXT);
+ fTypeMap.put(CSSImageType.CATEGORY_UI, CSSEditorPluginImages.IMG_OBJ_CATEGORY_UI);
+ fTypeMap.put(CSSImageType.CATEGORY_VISUAL, CSSEditorPluginImages.IMG_OBJ_CATEGORY_VISUAL);
+ fTypeMap.put(CSSImageType.CATEGORY_DEFAULT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_DEFAULT);
+ }
+ return getImage((String) fTypeMap.get(type));
+ }
+
+ /**
+ *
+ */
+ private CSSImageHelper() {
+ super();
+ }
+
+ /**
+ *
+ */
+ private Image createImage(String resource) {
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(CSSEditorPlugin.ID, resource);
+ Image image = null;
+
+ if (desc == null) {
+ desc = ImageDescriptor.getMissingImageDescriptor();
+ image = desc.createImage();
+ } else {
+ image = desc.createImage();
+ getImageRegistry().put(resource, image);
+ }
+
+ return image;
+ }
+
+ private ImageRegistry getImageRegistry() {
+ return JFaceResources.getImageRegistry();
+ }
+
+ private Map fTypeMap = null;
+ private static CSSImageHelper fInstance = null;
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageType.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageType.java
new file mode 100644
index 0000000000..9efa575dcf
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/image/CSSImageType.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.image;
+
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorItem;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.metamodel.CSSMMProperty;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelFinder;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelUtil;
+import org.w3c.dom.css.CSSCharsetRule;
+import org.w3c.dom.css.CSSFontFaceRule;
+import org.w3c.dom.css.CSSImportRule;
+import org.w3c.dom.css.CSSMediaRule;
+import org.w3c.dom.css.CSSPageRule;
+import org.w3c.dom.css.CSSPrimitiveValue;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+import org.w3c.dom.css.CSSValue;
+
+/**
+ */
+public class CSSImageType {
+
+ private final String fName;
+
+ private CSSImageType(String name) {
+ this.fName = name;
+ }
+
+ public String toString() {
+ return fName;
+ }
+
+ public static final CSSImageType STYLESHEET = new CSSImageType("STYLESHEET"); //$NON-NLS-1$
+
+ public static final CSSImageType RULE_CHARSET = new CSSImageType("RULE_CHARSET"); //$NON-NLS-1$
+ public static final CSSImageType RULE_FONTFACE = new CSSImageType("RULE_FONTFACE"); //$NON-NLS-1$
+ public static final CSSImageType RULE_IMPORT = new CSSImageType("RULE_IMPORT"); //$NON-NLS-1$
+ public static final CSSImageType RULE_MEDIA = new CSSImageType("RULE_MEDIA"); //$NON-NLS-1$
+ public static final CSSImageType RULE_PAGE = new CSSImageType("RULE_PAGE"); //$NON-NLS-1$
+ public static final CSSImageType RULE_STYLE = new CSSImageType("RULE_STYLE"); //$NON-NLS-1$
+ public static final CSSImageType RULE_UNKNOWN = new CSSImageType("RULE_UNKNOWN"); //$NON-NLS-1$
+
+ public static final CSSImageType SELECTOR_CLASS = new CSSImageType("SELECTOR_CLASS"); //$NON-NLS-1$
+ public static final CSSImageType SELECTOR_ID = new CSSImageType("SELECTOR_ID"); //$NON-NLS-1$
+ public static final CSSImageType SELECTOR_DEFAULT = new CSSImageType("SELECTOR_DEFAULT"); //$NON-NLS-1$
+ public static final CSSImageType SELECTOR_PSEUDO = new CSSImageType("SELECTOR_PSEUDO"); //$NON-NLS-1$
+ public static final CSSImageType SELECTOR_TAG = new CSSImageType("SELECTOR_TAG"); //$NON-NLS-1$
+ public static final CSSImageType SELECTOR_LINK = new CSSImageType("SELECTOR_LINK"); //$NON-NLS-1$
+
+ public static final CSSImageType VALUE_FUNCTION = new CSSImageType("VALUE_FUNCTION"); //$NON-NLS-1$
+ public static final CSSImageType VALUE_NUMBER = new CSSImageType("VALUE_NUMBER"); //$NON-NLS-1$
+ public static final CSSImageType VALUE_STRING = new CSSImageType("VALUE_STRING"); //$NON-NLS-1$
+
+ public static final CSSImageType CATEGORY_AURAL = new CSSImageType("CATEGORY_AURAL"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_BOX = new CSSImageType("CATEGORY_BOX"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_COLORANDBACKGROUND = new CSSImageType("CATEGORY_COLORANDBACKGROUND"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_CONTENT = new CSSImageType("CATEGORY_CONTENT"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_FONT = new CSSImageType("CATEGORY_FONT"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_PAGE = new CSSImageType("CATEGORY_PAGE"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_TABLES = new CSSImageType("CATEGORY_TABLES"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_TEXT = new CSSImageType("CATEGORY_TEXT"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_UI = new CSSImageType("CATEGORY_UI"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_VISUAL = new CSSImageType("CATEGORY_VISUAL"); //$NON-NLS-1$
+ public static final CSSImageType CATEGORY_DEFAULT = new CSSImageType("CATEGORY_DEFAULT"); //$NON-NLS-1$
+
+ /**
+ * by node
+ */
+ public static CSSImageType getImageType(ICSSNode node) {
+ CSSImageType imageType = null;
+ if (node instanceof CSSCharsetRule) {
+ imageType = RULE_CHARSET;
+ } else if (node instanceof CSSFontFaceRule) {
+ imageType = RULE_FONTFACE;
+ } else if (node instanceof CSSImportRule) {
+ imageType = RULE_IMPORT;
+ } else if (node instanceof CSSMediaRule) {
+ imageType = RULE_MEDIA;
+ } else if (node instanceof CSSPageRule) {
+ imageType = RULE_PAGE;
+ } else if (node instanceof CSSStyleRule) {
+ imageType = getImageType(((ICSSStyleRule) node).getSelectors());
+ } else if (node instanceof CSSStyleDeclaration) {
+ ICSSNode parent = node.getParentNode();
+ if (parent != null) {
+ return getImageType(parent);
+ }
+ } else if (node instanceof ICSSStyleDeclItem) {
+ String name = ((ICSSStyleDeclItem) node).getPropertyName();
+ ICSSDocument doc = node.getOwnerDocument();
+ ICSSModel model = (doc != null) ? doc.getModel() : null;
+ CSSMetaModelFinder finder = CSSMetaModelFinder.getInstance();
+ CSSMetaModel metaModel = finder.findMetaModelFor(model);
+ // is font-face rule ?
+ ICSSNode parent = node.getParentNode();
+ if (parent != null) {
+ parent = parent.getParentNode();
+ if (parent instanceof CSSFontFaceRule) {
+ imageType = CSSImageType.CATEGORY_FONT;
+ }
+ }
+ if (imageType == null) {
+ CSSMMProperty prop = new CSSMetaModelUtil(metaModel).getProperty(name);
+ if (prop != null) {
+ String category = prop.getAttribute("category"); //$NON-NLS-1$
+ imageType = getImageType(category);
+ }
+ if (imageType == null) {
+ imageType = CSSImageType.CATEGORY_DEFAULT;
+ }
+ }
+ } else if (node instanceof CSSValue) {
+ switch (((CSSValue) node).getCssValueType()) {
+ case CSSPrimitiveValue.CSS_NUMBER :
+ case CSSPrimitiveValue.CSS_PERCENTAGE :
+ case CSSPrimitiveValue.CSS_EMS :
+ case CSSPrimitiveValue.CSS_EXS :
+ case CSSPrimitiveValue.CSS_PX :
+ case CSSPrimitiveValue.CSS_CM :
+ case CSSPrimitiveValue.CSS_MM :
+ case CSSPrimitiveValue.CSS_IN :
+ case CSSPrimitiveValue.CSS_PT :
+ case CSSPrimitiveValue.CSS_PC :
+ case CSSPrimitiveValue.CSS_DEG :
+ case CSSPrimitiveValue.CSS_RAD :
+ case CSSPrimitiveValue.CSS_GRAD :
+ case CSSPrimitiveValue.CSS_MS :
+ case CSSPrimitiveValue.CSS_S :
+ case CSSPrimitiveValue.CSS_HZ :
+ case CSSPrimitiveValue.CSS_KHZ :
+ case CSSPrimitiveValue.CSS_DIMENSION :
+ case ICSSPrimitiveValue.CSS_INTEGER :
+ case ICSSPrimitiveValue.CSS_HASH :
+ imageType = VALUE_NUMBER;
+ break;
+ case CSSPrimitiveValue.CSS_ATTR :
+ case CSSPrimitiveValue.CSS_COUNTER :
+ case CSSPrimitiveValue.CSS_RECT :
+ case CSSPrimitiveValue.CSS_RGBCOLOR :
+ case CSSPrimitiveValue.CSS_URI :
+ case ICSSPrimitiveValue.CSS_FORMAT :
+ case ICSSPrimitiveValue.CSS_LOCAL :
+ imageType = VALUE_FUNCTION;
+ break;
+ default :
+ imageType = VALUE_STRING;
+ break;
+ }
+ }
+ return imageType;
+ }
+
+ public static CSSImageType getImageType(ICSSSelectorList selectorList) {
+ if (selectorList == null || selectorList.getLength() == 0) {
+ return SELECTOR_DEFAULT;
+ }
+ CSSImageType imageType = null;
+ int nSelectors = selectorList.getLength();
+ for (int i = 0; i < nSelectors; i++) {
+ CSSImageType candidate = getImageType(selectorList.getSelector(i));
+ if (imageType == null) {
+ imageType = candidate;
+ } else if (imageType != candidate) {
+ imageType = null;
+ break;
+ }
+ }
+
+ return (imageType == null) ? SELECTOR_DEFAULT : imageType;
+ }
+
+ public static CSSImageType getImageType(ICSSSelector selector) {
+ CSSImageType imageType = SELECTOR_DEFAULT;
+ if (selector == null || selector.getLength() == 0) {
+ return imageType;
+ }
+ ICSSSelectorItem item = selector.getItem(selector.getLength() - 1);
+ if (item.getItemType() == ICSSSelectorItem.SIMPLE) {
+ ICSSSimpleSelector ss = (ICSSSimpleSelector) item;
+ if (0 < ss.getNumOfIDs()) {
+ imageType = SELECTOR_ID;
+ } else if (0 < ss.getNumOfClasses()) {
+ imageType = SELECTOR_CLASS;
+ } else if (0 < ss.getNumOfPseudoNames()) {
+ imageType = SELECTOR_PSEUDO;
+ } else {
+ imageType = SELECTOR_TAG;
+ }
+ }
+ return imageType;
+ }
+
+ public static CSSImageType getImageType(String category) {
+ if (fCategoryMap == null) {
+ fCategoryMap = new HashMap();
+ fCategoryMap.put("aural", CATEGORY_AURAL); //$NON-NLS-1$
+ fCategoryMap.put("box", CATEGORY_BOX); //$NON-NLS-1$
+ fCategoryMap.put("colorandbackground", CATEGORY_COLORANDBACKGROUND); //$NON-NLS-1$
+ fCategoryMap.put("content", CATEGORY_CONTENT); //$NON-NLS-1$
+ fCategoryMap.put("font", CATEGORY_FONT); //$NON-NLS-1$
+ fCategoryMap.put("page", CATEGORY_PAGE); //$NON-NLS-1$
+ fCategoryMap.put("tables", CATEGORY_TABLES); //$NON-NLS-1$
+ fCategoryMap.put("text", CATEGORY_TEXT); //$NON-NLS-1$
+ fCategoryMap.put("ui", CATEGORY_UI); //$NON-NLS-1$
+ fCategoryMap.put("visual", CATEGORY_VISUAL); //$NON-NLS-1$
+ }
+ CSSImageType imageType = (CSSImageType) fCategoryMap.get(category);
+ return (imageType == null) ? CATEGORY_DEFAULT : imageType;
+ }
+
+ private static Map fCategoryMap = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java
new file mode 100644
index 0000000000..480a5a6acc
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal;
+
+
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.css.ui.CSSEditorPlugin;
+
+/**
+ * Small convenience class to log messages to plugin's log file and also, if
+ * desired, the console. This class should only be used by classes in this
+ * plugin. Other plugins should make their own copy, with appropriate ID.
+ */
+public class Logger {
+ private static Plugin fPlugin = CSSEditorPlugin.getDefault();
+ private static final String fPluginId = fPlugin.getDescriptor().getUniqueIdentifier();
+
+ private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
+
+ public static final int OK = IStatus.OK; // 0
+ public static final int INFO = IStatus.INFO; // 1
+ public static final int WARNING = IStatus.WARNING; // 2
+ public static final int ERROR = IStatus.ERROR; // 4
+
+ public static final int OK_DEBUG = 200 + OK;
+ public static final int INFO_DEBUG = 200 + INFO;
+ public static final int WARNING_DEBUG = 200 + WARNING;
+ public static final int ERROR_DEBUG = 200 + ERROR;
+
+ /**
+ * Adds message to log.
+ *
+ * @param level
+ * severity level of the message (OK, INFO, WARNING, ERROR,
+ * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
+ * @param message
+ * text to add to the log
+ * @param exception
+ * exception thrown
+ */
+ protected static void _log(int level, String message, Throwable exception) {
+ if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
+ if (!isDebugging())
+ return;
+ }
+
+ int severity = IStatus.OK;
+ switch (level) {
+ case INFO_DEBUG :
+ case INFO :
+ severity = IStatus.INFO;
+ break;
+ case WARNING_DEBUG :
+ case WARNING :
+ severity = IStatus.WARNING;
+ break;
+ case ERROR_DEBUG :
+ case ERROR :
+ severity = IStatus.ERROR;
+ }
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(severity, fPluginId, severity, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+
+ /**
+ * Prints message to log if category matches /debug/tracefilter option.
+ *
+ * @param message
+ * text to print
+ * @param category
+ * category of the message, to be compared with
+ * /debug/tracefilter
+ */
+ protected static void _trace(String category, String message, Throwable exception) {
+ if (isTracing(category)) {
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(IStatus.OK, fPluginId, IStatus.OK, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+ }
+
+ /**
+ * @return true if the plugin for this logger is debugging
+ */
+ public static boolean isDebugging() {
+ return fPlugin.isDebugging();
+ }
+
+ /**
+ * Determines if currently tracing a category
+ *
+ * @param category
+ * @return true if tracing category, false otherwise
+ */
+ public static boolean isTracing(String category) {
+ if (!isDebugging())
+ return false;
+
+ String traceFilter = Platform.getDebugOption(fPluginId + TRACEFILTER_LOCATION);
+ if (traceFilter != null) {
+ StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String cat = tokenizer.nextToken().trim();
+ if (category.equals(cat)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void log(int level, String message) {
+ _log(level, message, null);
+ }
+
+ public static void log(int level, String message, Throwable exception) {
+ _log(level, message, exception);
+ }
+
+ public static void logException(String message, Throwable exception) {
+ _log(ERROR, message, exception);
+ }
+
+ public static void logException(Throwable exception) {
+ _log(ERROR, exception.getMessage(), exception);
+ }
+
+ public static void traceException(String category, String message, Throwable exception) {
+ _trace(category, message, exception);
+ }
+
+ public static void traceException(String category, Throwable exception) {
+ _trace(category, exception.getMessage(), exception);
+ }
+
+ public static void trace(String category, String message) {
+ _trace(category, message, null);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java
new file mode 100644
index 0000000000..c7d179fb39
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.editor;
+
+
+/**
+ * Bundle of most images used by the CSS Source Editor plug-in.
+ */
+public class CSSEditorPluginImages {
+ public static final String IMG_OBJ_SORT = "icons/full/obj16/sort.gif"; //$NON-NLS-1$
+
+ public static final String IMG_OBJ_STYLESHEET = "icons/full/obj16/stylesheet.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_CHARSET = "icons/full/obj16/charset_rule.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_FONTFACE = "icons/full/obj16/fontface_rule.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_IMPORT = "icons/full/obj16/link_rule.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_MEDIA = "icons/full/obj16/media_rule.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_PAGE = "icons/full/obj16/page_rule.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_STYLE = "icons/full/obj16/style_rule.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_RULE_UNKNOWN = "icons/full/obj16/unknown_rule.gif"; //$NON-NLS-1$
+
+ public static final String IMG_OBJ_SELECTOR_CLASS = "icons/full/obj16/class_selector.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_SELECTOR_ID = "icons/full/obj16/id_selector.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_SELECTOR_PSEUDO = "icons/full/obj16/pseudo.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_SELECTOR_TAG = "icons/full/obj16/tag_selector.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_SELECTOR_LINK = "icons/full/obj16/link_selector.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_SELECTOR_DEFAULT = "icons/full/obj16/tag_selector.gif"; //$NON-NLS-1$
+
+ public static final String IMG_OBJ_VALUE_FUNCTION = "icons/full/obj16/css_propertyvalue_function.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_VALUE_NUMBER = "icons/full/obj16/css_propertyvalue_unit.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_VALUE_STRING = "icons/full/obj16/css_propertyvalue_identifier.gif"; //$NON-NLS-1$
+
+ public static final String IMG_OBJ_CATEGORY_AURAL = "icons/full/obj16/aural_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_BOX = "icons/full/obj16/boxmodel_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_COLORANDBACKGROUND = "icons/full/obj16/colback_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_CONTENT = "icons/full/obj16/content_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_FONT = "icons/full/obj16/font_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_PAGE = "icons/full/obj16/pagedmedia_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_TABLES = "icons/full/obj16/table_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_TEXT = "icons/full/obj16/text_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_UI = "icons/full/obj16/ui_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_VISUAL = "icons/full/obj16/visual_props.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_CATEGORY_DEFAULT = "icons/full/obj16/other_props.gif"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java
new file mode 100644
index 0000000000..598c776ecc
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.editor;
+
+import org.eclipse.wst.css.ui.CSSEditorPlugin;
+
+/**
+ * Help context ids for the CSS Source Editor.
+ * <p>
+ * This interface contains constants only; it is not intended to be
+ * implemented.
+ * </p>
+ *
+ */
+public interface IHelpContextIds {
+ // org.eclipse.wst.css.ui.
+ public static final String PREFIX = CSSEditorPlugin.ID + "."; //$NON-NLS-1$
+
+ // CSS Source page editor
+ public static final String CSS_SOURCEVIEW_HELPID = PREFIX + "ecss0000"; //$NON-NLS-1$
+
+ // CSS Files Preference page
+ public static final String CSS_PREFWEBX_FILES_HELPID = PREFIX + "webx0010"; //$NON-NLS-1$
+ // CSS Source Preference page
+ public static final String CSS_PREFWEBX_SOURCE_HELPID = PREFIX + "webx0011"; //$NON-NLS-1$
+ // CSS Styles Preference page
+ public static final String CSS_PREFWEBX_STYLES_HELPID = PREFIX + "webx0012"; //$NON-NLS-1$
+
+ // CSS Cleanup dialog
+ public static final String CSS_CLEANUP_HELPID = PREFIX + "xmlm1300"; //$NON-NLS-1$
+
+ // CSS Content Settings
+ public static final String CSS_CONTENT_SETTINGS_HELPID = PREFIX + "misc0180"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/nls/ResourceHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/nls/ResourceHandler.java
new file mode 100644
index 0000000000..a14f3f636b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/nls/ResourceHandler.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.nls;
+
+
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ResourceHandler {
+
+
+ private static ResourceBundle fgResourceBundle;
+
+ /**
+ * Returns the resource bundle used by all classes in this Project
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("EditingCSS");//$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ // does nothing - this method will return null and
+ // getString(String) will return the key
+ // it was called with
+ }
+ return null;
+ }
+
+ public static String getString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle = getResourceBundle();
+ }
+
+ if (fgResourceBundle != null) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ } else {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+
+ public static String getString(String key, Object[] args) {
+
+ try {
+ return MessageFormat.format(getString(key), args);
+ } catch (IllegalArgumentException e) {
+ return getString(key);
+ }
+
+ }
+
+ public static String getString(String key, Object[] args, int x) {
+
+ return getString(key);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java
new file mode 100644
index 0000000000..cf318d6c58
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
+import org.eclipse.wst.sse.ui.internal.selection.StructureSelectAction;
+
+public abstract class StructureSelectCSSAction extends StructureSelectAction {
+ public StructureSelectCSSAction(StructuredTextEditor editor, SelectionHistory history) {
+ super(editor, history);
+ }
+
+ public void run() {
+ Region currentRegion = new Region(fViewer.getSelectedRange().x, fViewer.getSelectedRange().y);
+ if (currentRegion.getLength() == fViewer.getDocument().getLength())
+ return;
+
+ IndexedRegion cursorIndexedRegion = getCursorIndexedRegion();
+ if (cursorIndexedRegion instanceof ICSSNode) {
+ ICSSNode cursorNode = (ICSSNode) cursorIndexedRegion;
+
+ Region cursorNodeRegion = new Region(cursorIndexedRegion.getStartOffset(), cursorIndexedRegion.getEndOffset() - cursorIndexedRegion.getStartOffset());
+
+ Region newRegion = null;
+ if (cursorNodeRegion.getOffset() >= currentRegion.getOffset() && cursorNodeRegion.getOffset() <= currentRegion.getOffset() + currentRegion.getLength() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentRegion.getOffset() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentRegion.getOffset() + currentRegion.getLength())
+ newRegion = getNewSelectionRegion(cursorNode, currentRegion);
+ else
+ newRegion = cursorNodeRegion;
+
+ if (newRegion != null) {
+ fHistory.remember(currentRegion);
+ try {
+ fHistory.ignoreSelectionChanges();
+ fEditor.selectAndReveal(newRegion.getOffset(), newRegion.getLength());
+ } finally {
+ fHistory.listenToSelectionChanges();
+ }
+ }
+ }
+ }
+
+ abstract protected Region getNewSelectionRegion(ICSSNode node, Region region);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java
new file mode 100644
index 0000000000..62b67c2583
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+import org.w3c.dom.Node;
+
+public class StructureSelectEnclosingCSSAction extends StructureSelectCSSAction {
+ public StructureSelectEnclosingCSSAction(StructuredTextEditor editor, SelectionHistory history) {
+ super(editor, history);
+ setText(ResourceHandler.getString("StructureSelectEnclosing.label")); //$NON-NLS-1$
+ setToolTipText(ResourceHandler.getString("StructureSelectEnclosing.tooltip")); //$NON-NLS-1$
+ setDescription(ResourceHandler.getString("StructureSelectEnclosing.description")); //$NON-NLS-1$
+ }
+
+ protected IndexedRegion getCursorIndexedRegion() {
+ return getIndexedRegion(fViewer.getSelectedRange().x);
+ }
+
+ protected Region getNewSelectionRegion(Node node, Region region) {
+ return null;
+ }
+
+ protected Region getNewSelectionRegion(ICSSNode node, Region region) {
+ Region newRegion = null;
+
+ ICSSNode newNode = node.getParentNode();
+
+ if (newNode instanceof IndexedRegion) {
+ IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+ newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+ }
+
+ return newRegion;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java
new file mode 100644
index 0000000000..7e469265ec
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+import org.w3c.dom.Node;
+
+public class StructureSelectNextCSSAction extends StructureSelectCSSAction {
+ public StructureSelectNextCSSAction(StructuredTextEditor editor, SelectionHistory history) {
+ super(editor, history);
+ setText(ResourceHandler.getString("StructureSelectNext.label")); //$NON-NLS-1$
+ setToolTipText(ResourceHandler.getString("StructureSelectNext.tooltip")); //$NON-NLS-1$
+ setDescription(ResourceHandler.getString("StructureSelectNext.description")); //$NON-NLS-1$
+ }
+
+ protected IndexedRegion getCursorIndexedRegion() {
+ int offset = fViewer.getSelectedRange().x + fViewer.getSelectedRange().y - 1;
+
+ if (offset < 0)
+ offset = 0;
+
+ return getIndexedRegion(offset);
+ }
+
+ protected Region getNewSelectionRegion(Node node, Region region) {
+ return null;
+ }
+
+ protected Region getNewSelectionRegion(ICSSNode node, Region region) {
+ Region newRegion = null;
+
+ ICSSNode newNode = node.getNextSibling();
+ if (newNode == null) {
+ newNode = node.getParentNode();
+
+ if (newNode instanceof IndexedRegion) {
+ IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+ newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+ }
+ } else {
+ if (newNode instanceof IndexedRegion) {
+ IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+ newRegion = new Region(region.getOffset(), newIndexedRegion.getEndOffset() - region.getOffset());
+ }
+ }
+
+ return newRegion;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java
new file mode 100644
index 0000000000..762eb0b6a4
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+import org.w3c.dom.Node;
+
+public class StructureSelectPreviousCSSAction extends StructureSelectCSSAction {
+ public StructureSelectPreviousCSSAction(StructuredTextEditor editor, SelectionHistory history) {
+ super(editor, history);
+ setText(ResourceHandler.getString("StructureSelectPrevious.label")); //$NON-NLS-1$
+ setToolTipText(ResourceHandler.getString("StructureSelectPrevious.tooltip")); //$NON-NLS-1$
+ setDescription(ResourceHandler.getString("StructureSelectPrevious.description")); //$NON-NLS-1$
+ }
+
+ protected IndexedRegion getCursorIndexedRegion() {
+ return getIndexedRegion(fViewer.getSelectedRange().x);
+ }
+
+ protected Region getNewSelectionRegion(Node node, Region region) {
+ return null;
+ }
+
+ protected Region getNewSelectionRegion(ICSSNode node, Region region) {
+ Region newRegion = null;
+
+ ICSSNode newNode = node.getPreviousSibling();
+ if (newNode == null) {
+ newNode = node.getParentNode();
+
+ if (newNode instanceof IndexedRegion) {
+ IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+ newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+ }
+ } else {
+ if (newNode instanceof IndexedRegion) {
+ IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+ newRegion = new Region(newIndexedRegion.getStartOffset(), region.getOffset() + region.getLength() - newIndexedRegion.getStartOffset());
+ }
+ }
+
+ return newRegion;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/CSSPreferenceManager.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/CSSPreferenceManager.java
new file mode 100644
index 0000000000..433a9bab57
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/CSSPreferenceManager.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.preferences;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @deprecated preference management has moved to base preferences
+ */
+public class CSSPreferenceManager extends PreferenceManager {
+
+ private static CSSPreferenceManager fInstance = null;
+ //
+ private final static String GROUP_COLOR = "color";//$NON-NLS-1$
+ private final static String COLOR_ENABLED = "useColor";//$NON-NLS-1$
+ //
+ private final static String GROUP_ASSIST = "contentAssist"; //$NON-NLS-1$
+ private final static String ASSIST_CATEGORIZE = "categorize"; //$NON-NLS-1$
+
+ protected Document fallbackDocument = null;
+
+ /**
+ *
+ */
+ protected CSSPreferenceManager() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public Document createDefaultPreferences() {
+ Document doc = super.createDefaultPreferences();
+ if (doc == null) {
+ return doc;
+ }
+
+ Node preference = doc.getFirstChild();
+
+ Element color = doc.createElement(GROUP_COLOR);
+ setBooleanAttribute(color, COLOR_ENABLED, true);
+ preference.appendChild(color);
+
+ Element contentAssist = doc.createElement(GROUP_ASSIST);
+ setBooleanAttribute(contentAssist, ASSIST_CATEGORIZE, true);
+ preference.appendChild(contentAssist);
+
+ return doc;
+ }
+
+ public boolean getContentAssistCategorize() {
+ return getBooleanAttribute(getGroupElement(GROUP_ASSIST), ASSIST_CATEGORIZE);
+ }
+
+ public void setContentAssistCategorize(boolean categorize) {
+ setBooleanAttribute(getGroupElement(GROUP_ASSIST), ASSIST_CATEGORIZE, categorize);
+ }
+
+ /**
+ *
+ */
+ protected boolean getBooleanAttribute(Element element, String name) {
+ String str = element.getAttribute(name);
+ if (str == null || str.length() <= 0) {
+ element = getDefaultGroupElement(element.getTagName());
+ if (element != null)
+ str = element.getAttribute(name);
+ }
+ return (str == null) ? false : str.equals(Boolean.TRUE.toString());
+ }
+
+ /**
+ *
+ */
+ public boolean getColorEnabled() {
+ return getBooleanAttribute(getGroupElement(GROUP_COLOR), COLOR_ENABLED);
+ }
+
+ /**
+ *
+ */
+ protected String getFilename() {
+ if (fileName == null) {
+ fileName = Platform.getPlugin(IModelManagerPlugin.ID).getStateLocation().toString() + "/cssprefs.xml";//$NON-NLS-1$
+ }
+ return fileName;
+ }
+
+ /**
+ *
+ */
+ protected Element getGroupElement(String name) {
+ Node node = getNamedChild(getRootElement(), name);
+ return (node instanceof Element) ? (Element) node : getDefaultGroupElement(name);
+ }
+
+ /**
+ *
+ */
+ protected Element getDefaultGroupElement(String name) {
+ Node node = getNamedChild(getDefaultRootElement(), name);
+ return (node instanceof Element) ? (Element) node : null;
+ }
+
+ /**
+ *
+ */
+ protected Node getDefaultRootElement() {
+ if (fallbackDocument == null)
+ fallbackDocument = createDefaultPreferences();
+ return getRootElement(fallbackDocument);
+ }
+
+ /**
+ *
+ */
+ public synchronized static CSSPreferenceManager getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSPreferenceManager();
+ }
+ return fInstance;
+ }
+
+ /**
+ *
+ */
+ protected int getIntAttribute(Element element, String name) {
+ int value = 0;
+ try {
+ value = Integer.parseInt(element.getAttribute(name));
+ } catch (NumberFormatException e) {
+ element = getDefaultGroupElement(element.getTagName());
+ try {
+ value = Integer.parseInt(element.getAttribute(name));
+ } catch (NumberFormatException ee) {
+ }
+ }
+ return value;
+ }
+
+ /**
+ *
+ */
+ protected String getStringAttribute(Element element, String name) {
+ if (element.getAttributeNode(name) == null) {
+ element = getDefaultGroupElement(element.getTagName());
+ }
+ return element.getAttribute(name);
+ }
+
+ /**
+ *
+ */
+ protected void setBooleanAttribute(Element element, String name, boolean value) {
+ element.setAttribute(name, new Boolean(value).toString());
+ }
+
+ /**
+ *
+ */
+ public void setColorEnabled(boolean enabled) {
+ setBooleanAttribute(getGroupElement(GROUP_COLOR), COLOR_ENABLED, enabled);
+ }
+
+ /**
+ *
+ */
+ protected void setStringAttribute(Element element, String name, String value) {
+ element.setAttribute(name, value);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorManager.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorManager.java
new file mode 100644
index 0000000000..e3c1eac472
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorManager.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.preferences.ui;
+
+
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.wst.css.ui.internal.Logger;
+import org.eclipse.wst.css.ui.style.IStyleConstantsCSS;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceManager;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorNames;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @deprecated color preference management has moved to base preferences
+ */
+public class CSSColorManager extends PreferenceManager {
+
+ private static CSSColorManager fInstance = null;
+ // highlighting types
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String NORMAL = "NORMAL";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String ATMARK_RULE = "ATMARK_RULE";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String SELECTOR = "SELECTOR";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String MEDIA = "MEDIA"; //$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String COMMENT = "COMMENT";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String PROPERTY_NAME = "PROPERTY_NAME";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String PROPERTY_VALUE = "PROPERTY_VALUE";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String URI = "URI";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String STRING = "STRING";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String COLON = "COLON";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String SEMI_COLON = "SEMI_COLON";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String CURLY_BRACE = "CURLY_BRACE";//$NON-NLS-1$
+ /** @deprecated use IStyleConstantsCSS instead TODO remove in C5 or earlier */
+ public static final String ERROR = "ERROR";//$NON-NLS-1$
+ // names for preference elements ... non-NLS
+ public static final String FOREGROUND = "foreground";//$NON-NLS-1$
+ public static final String BACKGROUND = "background";//$NON-NLS-1$
+ public static final String BOLD = "bold";//$NON-NLS-1$
+ public static final String ITALIC = "italic";//$NON-NLS-1$
+ public static final String NAME = "name";//$NON-NLS-1$
+ public static final String COLOR = "color";//$NON-NLS-1$
+
+ private CSSColorManager() {
+ super();
+ }
+
+ protected Element addColor(Node colors, String name, String foreground, String background) {
+ Element newColor = newColor(colors.getOwnerDocument(), name, foreground, background);
+ colors.appendChild(newColor);
+ return newColor;
+ }
+
+ /**
+ * <!ELEMENT colors (color) > <!ELEMENT color EMPTY > <!ATTLIST color name
+ * CDATA #REQUIRED foreground CDATA #IMPLIED background CDATA #IMPLIED
+ * bold CDATA #REQUIRED >
+ *
+ */
+ public Document createDefaultPreferences() {
+ Document prefDocument = super.createDefaultPreferences();
+ if (prefDocument == null)
+ return prefDocument;
+
+ while (prefDocument.getChildNodes().getLength() > 0)
+ prefDocument.removeChild(prefDocument.getLastChild());
+ Element colors = prefDocument.createElement(getRootElementName());
+ prefDocument.appendChild(colors);
+
+ // current as of 2001-8-13
+ addColor(colors, IStyleConstantsCSS.NORMAL, null, null);
+ addColor(colors, IStyleConstantsCSS.ATMARK_RULE, getColorString(63, 127, 127), null);
+ addColor(colors, IStyleConstantsCSS.SELECTOR, getColorString(63, 127, 127), null);
+ addColor(colors, IStyleConstantsCSS.MEDIA, getColorString(42, 0, 225), null);
+ addColor(colors, IStyleConstantsCSS.COMMENT, getColorString(63, 95, 191), null);
+ addColor(colors, IStyleConstantsCSS.PROPERTY_NAME, getColorString(127, 0, 127), null);
+ addColor(colors, IStyleConstantsCSS.PROPERTY_VALUE, getColorString(42, 0, 225), null);
+ addColor(colors, IStyleConstantsCSS.URI, getColorString(42, 0, 225), null);
+ addColor(colors, IStyleConstantsCSS.STRING, getColorString(42, 0, 225), null);
+ addColor(colors, IStyleConstantsCSS.COLON, null, null);
+ addColor(colors, IStyleConstantsCSS.SEMI_COLON, null, null);
+ addColor(colors, IStyleConstantsCSS.CURLY_BRACE, null, null);
+ addColor(colors, IStyleConstantsCSS.ERROR, getColorString(191, 63, 63), null);
+
+ return prefDocument;
+ }
+
+ public RGB getBackgroundRGB(String name) {
+ Element element = getColorElement(name);
+ if (element != null) {
+ return getRGB(element.getAttribute(BACKGROUND));
+ } else {
+ return new RGB(255, 255, 255);
+ }
+ }
+
+ private Element getColorElement(String name) {
+ Node colorsElement = getRootElement();
+ NodeList colors = colorsElement.getChildNodes();
+ for (int i = 0; i < colors.getLength(); i++) {
+ Node node = colors.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE && ((Element) node).getAttribute(NAME).equals(name)) {
+ return (Element) node;
+ }
+ }
+ return null;
+ }
+
+ public static String getColorString(int r, int g, int b) {
+ return "#" + getHexString(r, 2) + getHexString(g, 2) + getHexString(b, 2);//$NON-NLS-1$
+ }
+
+ public String getFilename() {
+ if (fileName == null) {
+ fileName = Platform.getPlugin(IModelManagerPlugin.ID).getStateLocation().toString() + "/csssourcecolors.xml";//$NON-NLS-1$
+ }
+ return fileName;
+ }
+
+ public RGB getForegroundRGB(String name) {
+ Element element = getColorElement(name);
+ if (element != null) {
+ return getRGB(element.getAttribute(FOREGROUND));
+ } else {
+ return new RGB(0, 0, 0);
+ }
+ }
+
+ public static String getHexString(int value, int minWidth) {
+ String hexString = Integer.toHexString(value);
+ for (int i = hexString.length(); i < minWidth; i++) {
+ hexString = "0" + hexString;//$NON-NLS-1$
+ }
+ return hexString;
+ }
+
+ public synchronized static CSSColorManager getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSColorManager();
+ }
+ return fInstance;
+ }
+
+ private RGB getRGB(String rgbStr) {
+ RGB result = null;
+ if (6 < rgbStr.length() && rgbStr.charAt(0) == '#') {
+ try {
+ int r = Integer.valueOf(rgbStr.substring(1, 3), 16).intValue();
+ int g = Integer.valueOf(rgbStr.substring(3, 5), 16).intValue();
+ int b = Integer.valueOf(rgbStr.substring(5, 7), 16).intValue();
+ result = new RGB(r, g, b);
+ } catch (NumberFormatException e) {
+ Logger.logException("Invalid color string " + rgbStr, e); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The intended name for the root Element of the Document; what is also
+ * listed within the DOCTYPE declaration.
+ *
+ * @return String
+ */
+ public String getRootElementName() {
+ return ColorNames.COLORS;
+ }
+
+ public int getStyle(String name) {
+ int style = SWT.NORMAL;
+ Element element = getColorElement(name);
+ if (element != null) {
+ if (Boolean.valueOf(element.getAttribute(BOLD)).booleanValue()) {
+ style |= SWT.BOLD;
+ }
+ if (Boolean.valueOf(element.getAttribute(ITALIC)).booleanValue()) {
+ style |= SWT.ITALIC;
+ }
+ }
+ return style;
+ }
+
+ protected Element newColor(Document doc, String name, String foreground, String background) {
+ if (doc == null || name == null || name.length() < 1)
+ return null;
+ Element newColor = doc.createElement(ColorNames.COLOR);
+ newColor.setAttribute(ColorNames.NAME, name);
+ if (foreground != null)
+ newColor.setAttribute(ColorNames.FOREGROUND, foreground);
+ if (background != null)
+ newColor.setAttribute(ColorNames.BACKGROUND, background);
+ return newColor;
+ }
+
+ protected Element newColor(Document doc, String name, String foreground, String background, boolean bold, boolean italic) {
+ Element newColor = newColor(doc, name, foreground, background);
+ if (newColor == null)
+ return null;
+ newColor.setAttribute(ColorNames.BOLD, String.valueOf(bold));
+ newColor.setAttribute(ColorNames.ITALIC, String.valueOf(italic));
+ return newColor;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorPage.java
new file mode 100644
index 0000000000..bbbbad30c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSColorPage.java
@@ -0,0 +1,236 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.preferences.ui;
+
+
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.internal.parser.CSSSourceParser;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.css.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.css.ui.style.IStyleConstantsCSS;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
+import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.AbstractColorPage;
+import org.eclipse.wst.sse.ui.preferences.ui.StyledTextColorPicker;
+
+public class CSSColorPage extends AbstractColorPage {
+
+ /**
+ * Set up all the style preference keys in the overlay store
+ */
+ protected OverlayKey[] createOverlayStoreKeys() {
+ ArrayList overlayKeys = new ArrayList();
+
+ ArrayList styleList = new ArrayList();
+ initStyleList(styleList);
+ Iterator i = styleList.iterator();
+ while (i.hasNext()) {
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceKeyGenerator.generateKey((String) i.next(), IContentTypeIdentifier.ContentTypeID_CSS)));
+ }
+
+ OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
+ overlayKeys.toArray(keys);
+ return keys;
+ }
+
+ protected Control createContents(Composite parent) {
+ Composite pageComponent = createComposite(parent, 1);
+ ((GridData) pageComponent.getLayoutData()).horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
+
+ super.createContents(pageComponent);
+
+ // assigning one help for whole group
+ // WorkbenchHelp.setHelp(pageComponent,
+ // "com.ibm.etools.webedit.core.cssp2000"); //$NON-NLS-1$
+ WorkbenchHelp.setHelp(pageComponent, IHelpContextIds.CSS_PREFWEBX_STYLES_HELPID);
+
+ return pageComponent;
+ }
+
+ protected Composite createColoringComposite(Composite parent) {
+ Composite coloringComposite = super.createColoringComposite(parent);
+
+ // assigning one help for whole group
+ // WorkbenchHelp.setHelp(coloringComposite,
+ // "com.ibm.etools.webedit.core.cssp2100"); //$NON-NLS-1$
+
+ return coloringComposite;
+ }
+
+ /**
+ * getSampleText method comment.
+ */
+ public String getSampleText() {
+ return ResourceHandler.getString("PrefsLabel.ColorSample"); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param contextStyleMap
+ * java.util.Dictionary
+ */
+ protected void initContextStyleMap(Dictionary contextStyleMap) {
+ contextStyleMap.put(CSSRegionContexts.CSS_COMMENT, IStyleConstantsCSS.COMMENT);
+ contextStyleMap.put(CSSRegionContexts.CSS_CDO, IStyleConstantsCSS.COMMENT);
+ contextStyleMap.put(CSSRegionContexts.CSS_CDC, IStyleConstantsCSS.COMMENT);
+ contextStyleMap.put(CSSRegionContexts.CSS_S, IStyleConstantsCSS.NORMAL);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
+ contextStyleMap.put(CSSRegionContexts.CSS_LBRACE, IStyleConstantsCSS.CURLY_BRACE);
+ contextStyleMap.put(CSSRegionContexts.CSS_RBRACE, IStyleConstantsCSS.CURLY_BRACE);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_IMPORT, IStyleConstantsCSS.ATMARK_RULE);
+ contextStyleMap.put(CSSRegionContexts.CSS_PAGE, IStyleConstantsCSS.ATMARK_RULE);
+ contextStyleMap.put(CSSRegionContexts.CSS_MEDIA, IStyleConstantsCSS.ATMARK_RULE);
+ contextStyleMap.put(CSSRegionContexts.CSS_FONT_FACE, IStyleConstantsCSS.ATMARK_RULE);
+ contextStyleMap.put(CSSRegionContexts.CSS_CHARSET, IStyleConstantsCSS.ATMARK_RULE);
+ contextStyleMap.put(CSSRegionContexts.CSS_ATKEYWORD, IStyleConstantsCSS.ATMARK_RULE);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_STRING, IStyleConstantsCSS.STRING);
+ contextStyleMap.put(CSSRegionContexts.CSS_URI, IStyleConstantsCSS.URI);
+ contextStyleMap.put(CSSRegionContexts.CSS_MEDIUM, IStyleConstantsCSS.MEDIA);
+ contextStyleMap.put(CSSRegionContexts.CSS_MEDIA_SEPARATOR, IStyleConstantsCSS.MEDIA);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_CHARSET_NAME, IStyleConstantsCSS.STRING);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_PAGE_SELECTOR, IStyleConstantsCSS.MEDIA);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_UNIVERSAL, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_PSEUDO, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_CLASS, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ID, IStyleConstantsCSS.SELECTOR);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_COMBINATOR, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_SEPARATOR, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE, IStyleConstantsCSS.SELECTOR);
+ contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR, IStyleConstantsCSS.SELECTOR);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_PROPERTY, IStyleConstantsCSS.PROPERTY_NAME);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_STRING, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_URI, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_HASH, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_S, IStyleConstantsCSS.PROPERTY_VALUE);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_SEPARATOR, IStyleConstantsCSS.COLON);
+ contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
+
+ contextStyleMap.put(CSSRegionContexts.CSS_UNKNOWN, IStyleConstantsCSS.ERROR);
+ }
+
+ /**
+ *
+ * @param descriptions
+ * java.util.Dictionary
+ */
+ protected void initDescriptions(Dictionary descriptions) {
+ // create descriptions for hilighting types
+ descriptions.put(IStyleConstantsCSS.NORMAL, ResourceHandler.getString("PrefsLabel.ColorNormal"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.ATMARK_RULE, ResourceHandler.getString("PrefsLabel.ColorAtmarkRule"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.SELECTOR, ResourceHandler.getString("PrefsLabel.ColorSelector"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.MEDIA, ResourceHandler.getString("PrefsLabel.ColorMedia"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.COMMENT, ResourceHandler.getString("PrefsLabel.ColorComment"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.PROPERTY_NAME, ResourceHandler.getString("PrefsLabel.ColorPropertyName"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.PROPERTY_VALUE, ResourceHandler.getString("PrefsLabel.ColorPropertyValue"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.URI, ResourceHandler.getString("PrefsLabel.ColorUri"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.STRING, ResourceHandler.getString("PrefsLabel.ColorString"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.COLON, ResourceHandler.getString("PrefsLabel.ColorColon"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.SEMI_COLON, ResourceHandler.getString("PrefsLabel.ColorSemiColon"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.CURLY_BRACE, ResourceHandler.getString("PrefsLabel.ColorCurlyBrace"));//$NON-NLS-1$
+ descriptions.put(IStyleConstantsCSS.ERROR, ResourceHandler.getString("PrefsLabel.ColorError"));//$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param list
+ * java.util.ArrayList
+ */
+ protected void initStyleList(ArrayList list) {
+ list.add(IStyleConstantsCSS.NORMAL);
+ list.add(IStyleConstantsCSS.ATMARK_RULE);
+ list.add(IStyleConstantsCSS.SELECTOR);
+ list.add(IStyleConstantsCSS.MEDIA);
+ list.add(IStyleConstantsCSS.COMMENT);
+ list.add(IStyleConstantsCSS.PROPERTY_NAME);
+ list.add(IStyleConstantsCSS.PROPERTY_VALUE);
+ list.add(IStyleConstantsCSS.URI);
+ list.add(IStyleConstantsCSS.STRING);
+ list.add(IStyleConstantsCSS.COLON);
+ list.add(IStyleConstantsCSS.SEMI_COLON);
+ list.add(IStyleConstantsCSS.CURLY_BRACE);
+ list.add(IStyleConstantsCSS.ERROR);
+ }
+
+ /**
+ * setupPicker method comment.
+ */
+ protected void setupPicker(StyledTextColorPicker picker) {
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ if (plugin != null) {
+ IModelManager mmanager = plugin.getModelManager();
+ picker.setParser(mmanager.createStructuredDocumentFor(IContentTypeIdentifier.ContentTypeID_CSS).getParser());
+ } else {
+ picker.setParser(new CSSSourceParser());
+ }
+
+ Dictionary descriptions = new Hashtable();
+ initDescriptions(descriptions);
+
+ Dictionary contextStyleMap = new Hashtable();
+ initContextStyleMap(contextStyleMap);
+
+ ArrayList styleList = new ArrayList();
+ initStyleList(styleList);
+
+ picker.setContextStyleMap(contextStyleMap);
+ picker.setDescriptions(descriptions);
+ picker.setStyleList(styleList);
+
+ picker.setGeneratorKey(IContentTypeIdentifier.ContentTypeID_CSS);
+ }
+
+ protected IPreferenceStore doGetPreferenceStore() {
+ return EditorPlugin.getDefault().getPreferenceStore();
+ }
+
+ public boolean performOk() {
+ super.performOk();
+
+ EditorPlugin.getDefault().savePluginPreferences();
+ return true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSFilesPreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSFilesPreferencePage.java
new file mode 100644
index 0000000000..681a3834aa
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSFilesPreferencePage.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.preferences.ui;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.css.core.CSSCorePlugin;
+import org.eclipse.wst.css.ui.CSSEditorPlugin;
+import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.xml.ui.preferences.XMLFilesPreferencePage;
+
+public class CSSFilesPreferencePage extends XMLFilesPreferencePage {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return CSSEditorPlugin.getDefault().getPreferenceStore();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#doSavePreferenceStore()
+ */
+ protected void doSavePreferenceStore() {
+ CSSCorePlugin.getDefault().savePluginPreferences(); // model
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.preferences.ui.AbstractPreferencePage#getModelPreferences()
+ */
+ protected Preferences getModelPreferences() {
+ return CSSCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ WorkbenchHelp.setHelp(c, IHelpContextIds.CSS_PREFWEBX_FILES_HELPID);
+ return c;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSSourcePreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSSourcePreferencePage.java
new file mode 100644
index 0000000000..ce5f660442
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/preferences/ui/CSSSourcePreferencePage.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.preferences.ui;
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.CSSCorePlugin;
+import org.eclipse.wst.css.core.preferences.CSSModelPreferenceNames;
+import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.css.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.xml.ui.preferences.XMLSourcePreferencePage;
+
+/**
+ */
+public class CSSSourcePreferencePage extends XMLSourcePreferencePage {
+ // Formatting
+ private final static String FORMATTING_GROUP = ResourceHandler.getString("Formatting_UI_"); //$NON-NLS-1$
+ // private final static String FORMATTING_SPLIT_LINES = "Split lines";
+ private final static String FORMATTING_LINE_WIDTH = ResourceHandler.getString("Line_width__UI_"); //$NON-NLS-1$;
+ private final static String FORMATTING_INSERT_LINE_BREAK = ResourceHandler.getString("PrefsLabel.WrappingInsertLineBreak"); //$NON-NLS-1$
+ private final static String FORMATTING_WRAPPING_WITHOUT_ATTR = ResourceHandler.getString("PrefsLabel.WrappingWithoutAttr");//$NON-NLS-1$
+ private final static String FORMATTING_INDENT_USING_TABS = ResourceHandler.getString("&Indent_using_tabs_3"); //$NON-NLS-1$
+
+ // Case
+ private final static String CASE_GROUP = ResourceHandler.getString("PrefsLabel.CaseGroup"); //$NON-NLS-1$
+ private final static String CASE_IDENT = ResourceHandler.getString("PrefsLabel.CaseIdent"); //$NON-NLS-1$
+ private final static String CASE_PROP_NAME = ResourceHandler.getString("PrefsLabel.CasePropName"); //$NON-NLS-1$
+ private final static String CASE_PROP_VALUE = ResourceHandler.getString("PrefsLabel.CasePropValue"); //$NON-NLS-1$
+ private final static String CASE_IDENT_UPPER = ResourceHandler.getString("PrefsLabel.CaseIdentUpper"); //$NON-NLS-1$
+ private final static String CASE_IDENT_LOWER = ResourceHandler.getString("PrefsLabel.CaseIdentLower"); //$NON-NLS-1$
+ private final static String CASE_PROP_NAME_UPPER = ResourceHandler.getString("PrefsLabel.CasePropNameUpper"); //$NON-NLS-1$
+ private final static String CASE_PROP_NAME_LOWER = ResourceHandler.getString("PrefsLabel.CasePropNameLower"); //$NON-NLS-1$
+ private final static String CASE_PROP_VALUE_UPPER = ResourceHandler.getString("PrefsLabel.CasePropValueUpper"); //$NON-NLS-1$
+ private final static String CASE_PROP_VALUE_LOWER = ResourceHandler.getString("PrefsLabel.CasePropValueLower"); //$NON-NLS-1$
+
+ // one property per one line
+ protected Button fPropertyPerLine;
+ // prohibit wrapping if style attribute
+ protected Button fNowrapAttr;
+
+ // case of output character
+ // case of identifier
+ protected Button fIdentUpper;
+ protected Button fIdentLower;
+ // case of property name
+ protected Button fPropNameUpper;
+ protected Button fPropNameLower;
+ // case of property value
+ protected Button fPropValueUpper;
+ protected Button fPropValueLower;
+
+ protected void createContentsForFormattingGroup(Composite parent) {
+ Group formattingGroup = createGroup(parent, 2);
+ formattingGroup.setText(FORMATTING_GROUP);
+ // // assigning one help for whole group
+ // WorkbenchHelp.setHelp(formattingGroup,
+ // "com.ibm.etools.webedit.core.cssp1200"); //$NON-NLS-1$
+
+ fLineWidthLabel = createLabel(formattingGroup, FORMATTING_LINE_WIDTH);
+ fLineWidthText = new Text(formattingGroup, SWT.SINGLE | SWT.BORDER);
+ GridData gData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.BEGINNING);
+ gData.widthHint = 25;
+ fLineWidthText.setLayoutData(gData);
+ fLineWidthText.addModifyListener(this);
+
+ fPropertyPerLine = createCheckBox(formattingGroup, FORMATTING_INSERT_LINE_BREAK);
+ ((GridData) fPropertyPerLine.getLayoutData()).horizontalSpan = 2;
+
+ fIndentUsingTabs = createCheckBox(formattingGroup, FORMATTING_INDENT_USING_TABS);
+ ((GridData) fIndentUsingTabs.getLayoutData()).horizontalSpan = 2;
+
+ fNowrapAttr = createCheckBox(formattingGroup, FORMATTING_WRAPPING_WITHOUT_ATTR);
+ ((GridData) fNowrapAttr.getLayoutData()).horizontalSpan = 2;
+ }
+
+ protected void performDefaultsForFormattingGroup() {
+ // Formatting
+ Preferences prefs = getModelPreferences();
+ fLineWidthText.setText(prefs.getDefaultString(CommonModelPreferenceNames.LINE_WIDTH));
+ fPropertyPerLine.setSelection(prefs.getDefaultBoolean(CSSModelPreferenceNames.WRAPPING_ONE_PER_LINE));
+ fIndentUsingTabs.setSelection(prefs.getDefaultBoolean(CommonModelPreferenceNames.INDENT_USING_TABS));
+ fNowrapAttr.setSelection(prefs.getDefaultBoolean(CSSModelPreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR));
+ }
+
+ protected void initializeValuesForFormattingGroup() {
+ // Formatting
+ Preferences prefs = getModelPreferences();
+ fLineWidthText.setText(prefs.getString(CommonModelPreferenceNames.LINE_WIDTH));
+ fPropertyPerLine.setSelection(prefs.getBoolean(CSSModelPreferenceNames.WRAPPING_ONE_PER_LINE));
+ fIndentUsingTabs.setSelection(prefs.getBoolean(CommonModelPreferenceNames.INDENT_USING_TABS));
+ fNowrapAttr.setSelection(prefs.getBoolean(CSSModelPreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR));
+ }
+
+ protected void storeValuesForFormattingGroup() {
+ // Formatting
+ Preferences prefs = getModelPreferences();
+ prefs.setValue(CommonModelPreferenceNames.LINE_WIDTH, fLineWidthText.getText());
+ prefs.setValue(CSSModelPreferenceNames.WRAPPING_ONE_PER_LINE, fPropertyPerLine.getSelection());
+ prefs.setValue(CommonModelPreferenceNames.INDENT_USING_TABS, fIndentUsingTabs.getSelection());
+ prefs.setValue(CSSModelPreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, fNowrapAttr.getSelection());
+ }
+
+ protected void createContentsForContentAssistGroup(Composite parent) {
+ // not content assist, but preferred case
+ Group caseGroup = createGroup(parent, 3);
+ caseGroup.setText(CASE_GROUP);
+ // WorkbenchHelp.setHelp(caseGroup,
+ // "com.ibm.etools.webedit.core.cssp1400"); //$NON-NLS-1$
+
+ // createLabel(caseGroup, CASE_IDENT);
+ // createLabel(caseGroup, CASE_PROP_NAME);
+ // createLabel(caseGroup, CASE_PROP_VALUE);
+
+ // use group for radio buttons so that associated label is read
+ // Composite identGroup = createComposite(caseGroup, 1);
+ Group identGroup = createGroup(caseGroup, 1);
+ identGroup.setText(CASE_IDENT);
+ fIdentUpper = createRadioButton(identGroup, CASE_IDENT_UPPER);
+ fIdentLower = createRadioButton(identGroup, CASE_IDENT_LOWER);
+
+ // use group for radio buttons so that associated label is read
+ // Composite propNameGroup = createComposite(caseGroup, 1);
+ Group propNameGroup = createGroup(caseGroup, 1);
+ propNameGroup.setText(CASE_PROP_NAME);
+ fPropNameUpper = createRadioButton(propNameGroup, CASE_PROP_NAME_UPPER);
+ fPropNameLower = createRadioButton(propNameGroup, CASE_PROP_NAME_LOWER);
+
+ // use group for radio buttons so that associated label is read
+ // Composite propValueGroup = createComposite(caseGroup, 1);
+ Group propValueGroup = createGroup(caseGroup, 1);
+ propValueGroup.setText(CASE_PROP_VALUE);
+ fPropValueUpper = createRadioButton(propValueGroup, CASE_PROP_VALUE_UPPER);
+ fPropValueLower = createRadioButton(propValueGroup, CASE_PROP_VALUE_LOWER);
+ }
+
+ protected void performDefaultsForContentAssistGroup() {
+ // not content assist, but preferred case
+ Preferences prefs = getModelPreferences();
+ fIdentUpper.setSelection(prefs.getDefaultInt(CSSModelPreferenceNames.CASE_IDENTIFIER) == CommonModelPreferenceNames.UPPER);
+ fIdentLower.setSelection(prefs.getDefaultInt(CSSModelPreferenceNames.CASE_IDENTIFIER) == CommonModelPreferenceNames.LOWER);
+ fPropNameUpper.setSelection(prefs.getDefaultInt(CSSModelPreferenceNames.CASE_PROPERTY_NAME) == CommonModelPreferenceNames.UPPER);
+ fPropNameLower.setSelection(prefs.getDefaultInt(CSSModelPreferenceNames.CASE_PROPERTY_NAME) == CommonModelPreferenceNames.LOWER);
+ fPropValueUpper.setSelection(prefs.getDefaultInt(CSSModelPreferenceNames.CASE_PROPERTY_VALUE) == CommonModelPreferenceNames.UPPER);
+ fPropValueLower.setSelection(prefs.getDefaultInt(CSSModelPreferenceNames.CASE_PROPERTY_VALUE) == CommonModelPreferenceNames.LOWER);
+ }
+
+ protected void initializeValuesForContentAssistGroup() {
+ // not content assist, but preferred case
+ Preferences prefs = getModelPreferences();
+ fIdentUpper.setSelection(prefs.getInt(CSSModelPreferenceNames.CASE_IDENTIFIER) == CommonModelPreferenceNames.UPPER);
+ fIdentLower.setSelection(prefs.getInt(CSSModelPreferenceNames.CASE_IDENTIFIER) == CommonModelPreferenceNames.LOWER);
+ fPropNameUpper.setSelection(prefs.getInt(CSSModelPreferenceNames.CASE_PROPERTY_NAME) == CommonModelPreferenceNames.UPPER);
+ fPropNameLower.setSelection(prefs.getInt(CSSModelPreferenceNames.CASE_PROPERTY_NAME) == CommonModelPreferenceNames.LOWER);
+ fPropValueUpper.setSelection(prefs.getInt(CSSModelPreferenceNames.CASE_PROPERTY_VALUE) == CommonModelPreferenceNames.UPPER);
+ fPropValueLower.setSelection(prefs.getInt(CSSModelPreferenceNames.CASE_PROPERTY_VALUE) == CommonModelPreferenceNames.LOWER);
+ }
+
+ protected void storeValuesForContentAssistGroup() {
+ // not content assist, but preferred case
+ Preferences prefs = getModelPreferences();
+ prefs.setValue(CSSModelPreferenceNames.CASE_IDENTIFIER, (fIdentUpper.getSelection()) ? CommonModelPreferenceNames.UPPER : CommonModelPreferenceNames.LOWER);
+ prefs.setValue(CSSModelPreferenceNames.CASE_PROPERTY_NAME, (fPropNameUpper.getSelection()) ? CommonModelPreferenceNames.UPPER : CommonModelPreferenceNames.LOWER);
+ prefs.setValue(CSSModelPreferenceNames.CASE_PROPERTY_VALUE, (fPropValueUpper.getSelection()) ? CommonModelPreferenceNames.UPPER : CommonModelPreferenceNames.LOWER);
+ }
+
+ protected void createContentsForGrammarConstraintsGroup(Composite parent) {
+ // do nothing
+ }
+
+ protected void performDefaultsForGrammarConstraintsGroup() {
+ // do nothing
+ }
+
+ protected void initializeValuesForGrammarConstraintsGroup() {
+ // do nothing
+ }
+
+ protected void storeValuesForGrammarConstraintsGroup() {
+ // do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ // protected IPreferenceStore doGetPreferenceStore() {
+ // return CSSEditorPlugin.getDefault().getPreferenceStore();
+ // }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#doSavePreferenceStore()
+ */
+ protected void doSavePreferenceStore() {
+ EditorPlugin.getDefault().savePluginPreferences();
+ CSSCorePlugin.getDefault().savePluginPreferences(); // model
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.preferences.ui.AbstractPreferencePage#getModelPreferences()
+ */
+ protected Preferences getModelPreferences() {
+ return CSSCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ /*
+ * helper method to generate content type id specific preference keys
+ */
+ protected String getKey(String key) {
+ String contentTypeId = IContentTypeIdentifier.ContentTypeID_CSS;
+ return PreferenceKeyGenerator.generateKey(key, contentTypeId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ WorkbenchHelp.setHelp(c, IHelpContextIds.CSS_PREFWEBX_SOURCE_HELPID);
+ return c;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/registry/AdapterFactoryProviderCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/registry/AdapterFactoryProviderCSS.java
new file mode 100644
index 0000000000..f5f854f233
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/registry/AdapterFactoryProviderCSS.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.registry;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.wst.css.core.modelhandler.ModelHandlerForCSS;
+import org.eclipse.wst.css.ui.views.contentoutline.JFaceNodeAdapterFactoryCSS;
+import org.eclipse.wst.css.ui.views.properties.CSSPropertySourceAdapterFactory;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.IFactoryRegistry;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.modelhandler.IDocumentTypeHandler;
+import org.eclipse.wst.sse.ui.registry.AdapterFactoryProvider;
+import org.eclipse.wst.sse.ui.util.Assert;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapter;
+
+public class AdapterFactoryProviderCSS implements AdapterFactoryProvider {
+ public boolean isFor(IDocumentTypeHandler contentTypeDescription) {
+ return (contentTypeDescription instanceof ModelHandlerForCSS);
+ }
+
+ public void addAdapterFactories(IStructuredModel structuredModel) {
+ // add the normal content based factories to model's registry
+ addContentBasedFactories(structuredModel);
+ }
+
+ protected void addContentBasedFactories(IStructuredModel structuredModel) {
+ IFactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
+ Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$
+ AdapterFactory factory = null;
+
+ factory = factoryRegistry.getFactoryFor(IPropertySource.class);
+ if (factory == null) {
+ factory = new CSSPropertySourceAdapterFactory(IPropertySource.class, true);
+ factoryRegistry.addFactory(factory);
+ }
+
+ factory = factoryRegistry.getFactoryFor(IJFaceNodeAdapter.class);
+ if (factory == null) {
+ factory = new JFaceNodeAdapterFactoryCSS(IJFaceNodeAdapter.class, true);
+ factoryRegistry.addFactory(factory);
+ }
+ }
+
+ public void reinitializeFactories(IStructuredModel structuredModel) {
+
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/CSSTextColors.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/CSSTextColors.java
new file mode 100644
index 0000000000..8bf4594aab
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/CSSTextColors.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.style;
+
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.wst.css.ui.preferences.CSSPreferenceManager;
+import org.eclipse.wst.css.ui.preferences.ui.CSSColorManager;
+import org.eclipse.wst.sse.ui.util.EditorUtility;
+
+/**
+ * @deprecated Most methods and constants moved to LineStyleProviderForCSS or
+ * IStyleConstantsCSS. TODO remove in C5 or earlier
+ */
+public class CSSTextColors {
+ class TextColors {
+
+ TextColors() {
+ super();
+ }
+
+ void setTextAttribute(Object key, RGB foreground, RGB background, int style) {
+ TextAttribute attribute = new TextAttribute(EditorUtility.getColor(foreground), EditorUtility.getColor(background), style);
+ setTextAttribute(key, attribute);
+ }
+
+ void setTextAttribute(Object key, TextAttribute attribute) {
+ TextAttribute oldAttribute = (TextAttribute) fAttributeTable.get(key);
+ if (oldAttribute != null) {
+ fAttributeTable.remove(key);
+ }
+ fAttributeTable.put(key, attribute);
+ }
+
+ TextAttribute getTextAttribute(Object key) {
+ return (TextAttribute) fAttributeTable.get(key);
+ }
+
+ private Map fAttributeTable = new HashMap();
+ }
+
+ // color types
+ public static final String NORMAL = "NORMAL"; //$NON-NLS-1$
+ public static final String ATMARK_RULE = "ATMARK_RULE"; //$NON-NLS-1$
+ public static final String SELECTOR = "SELECTOR"; //$NON-NLS-1$
+ public static final String MEDIA = "MEDIA"; //$NON-NLS-1$
+ public static final String COMMENT = "COMMENT"; //$NON-NLS-1$
+ public static final String PROPERTY_NAME = "PROPERTY_NAME"; //$NON-NLS-1$
+ public static final String PROPERTY_VALUE = "PROPERTY_VALUE"; //$NON-NLS-1$
+ public static final String URI = "URI"; //$NON-NLS-1$
+ public static final String STRING = "STRING"; //$NON-NLS-1$
+ public static final String COLON = "COLON"; //$NON-NLS-1$
+ public static final String SEMI_COLON = "SEMI_COLON"; //$NON-NLS-1$
+ public static final String CURLY_BRACE = "CURLY_BRACE"; //$NON-NLS-1$
+ public static final String ERROR = "ERROR"; //$NON-NLS-1$
+ private static CSSTextColors fInstance = null;
+ private TextColors fTextColors = null;
+ private Map fPrefToType = null;
+
+ protected CSSTextColors() {
+ super();
+ applyPreference();
+ }
+
+ public synchronized static CSSTextColors getInstance() {
+ if (fInstance == null) {
+ fInstance = new CSSTextColors();
+ }
+ return fInstance;
+ }
+
+ public void applyPreference() {
+ if (fTextColors == null) {
+ fTextColors = new TextColors();
+ }
+
+ if (fPrefToType == null) {
+ fPrefToType = new HashMap();
+ fPrefToType.put(NORMAL, CSSColorManager.NORMAL);
+ fPrefToType.put(ATMARK_RULE, CSSColorManager.ATMARK_RULE);
+ fPrefToType.put(SELECTOR, CSSColorManager.SELECTOR);
+ fPrefToType.put(MEDIA, CSSColorManager.MEDIA);
+ fPrefToType.put(COMMENT, CSSColorManager.COMMENT);
+ fPrefToType.put(PROPERTY_NAME, CSSColorManager.PROPERTY_NAME);
+ fPrefToType.put(PROPERTY_VALUE, CSSColorManager.PROPERTY_VALUE);
+ fPrefToType.put(URI, CSSColorManager.URI);
+ fPrefToType.put(STRING, CSSColorManager.STRING);
+ fPrefToType.put(COLON, CSSColorManager.COLON);
+ fPrefToType.put(SEMI_COLON, CSSColorManager.SEMI_COLON);
+ fPrefToType.put(CURLY_BRACE, CSSColorManager.CURLY_BRACE);
+ fPrefToType.put(ERROR, CSSColorManager.ERROR);
+ }
+ boolean bEnabled = CSSPreferenceManager.getInstance().getColorEnabled();
+ CSSColorManager pref = CSSColorManager.getInstance();
+
+ Iterator i = fPrefToType.keySet().iterator();
+ while (i.hasNext()) {
+ String key = (String) i.next();
+ if (bEnabled) {
+ String type = (String) fPrefToType.get(key);
+ setTextAttribute(key, pref.getForegroundRGB(type), pref.getBackgroundRGB(type), pref.getStyle(type));
+ } else {
+ setTextAttribute(key, null);
+ }
+ }
+ }
+
+ public void dispose() {
+ }
+
+ public TextAttribute getTextAttribute(String type) {
+ if (fTextColors == null) {
+ applyPreference();
+ }
+ return fTextColors.getTextAttribute(type);
+ }
+
+ private void setTextAttribute(String type, RGB foreground) {
+ setTextAttribute(type, foreground, null, SWT.NORMAL);
+ }
+
+ private void setTextAttribute(String type, RGB foreground, RGB background, int style) {
+ if (fTextColors == null) {
+ return;
+ }
+ fTextColors.setTextAttribute(type, foreground, background, style);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/IStyleConstantsCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/IStyleConstantsCSS.java
new file mode 100644
index 0000000000..31eb84e7ed
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/IStyleConstantsCSS.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.style;
+
+/**
+ * Contains the symbolic name of styles used by LineStyleProvider,
+ * ColorManager, and any others who may be interested
+ */
+public interface IStyleConstantsCSS {
+ public static final String NORMAL = "NORMAL"; //$NON-NLS-1$
+ public static final String ATMARK_RULE = "ATMARK_RULE"; //$NON-NLS-1$
+ public static final String SELECTOR = "SELECTOR"; //$NON-NLS-1$
+ public static final String MEDIA = "MEDIA"; //$NON-NLS-1$
+ public static final String COMMENT = "COMMENT"; //$NON-NLS-1$
+ public static final String PROPERTY_NAME = "PROPERTY_NAME"; //$NON-NLS-1$
+ public static final String PROPERTY_VALUE = "PROPERTY_VALUE"; //$NON-NLS-1$
+ public static final String URI = "URI"; //$NON-NLS-1$
+ public static final String STRING = "STRING"; //$NON-NLS-1$
+ public static final String COLON = "COLON"; //$NON-NLS-1$
+ public static final String SEMI_COLON = "SEMI_COLON"; //$NON-NLS-1$
+ public static final String CURLY_BRACE = "CURLY_BRACE"; //$NON-NLS-1$
+ public static final String ERROR = "ERROR"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForCSS.java
new file mode 100644
index 0000000000..27bf5378cd
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForCSS.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.style;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.style.AbstractLineStyleProvider;
+import org.eclipse.wst.sse.ui.style.LineStyleProvider;
+
+/**
+ */
+public class LineStyleProviderForCSS extends AbstractLineStyleProvider implements LineStyleProvider {
+ /** Contains region to style mapping */
+ private Map fColorTypes;
+
+ /**
+ * LineStyleProviderForEmbeddedCSS constructor comment.
+ */
+ public LineStyleProviderForCSS() {
+ super();
+ initAttributes();
+ loadColors();
+ }
+
+ protected TextAttribute getAttributeFor(ITextRegion region) {
+ if (region != null) {
+ String type = region.getType();
+ if (type != null) {
+ return getAttributeFor(type);
+ }
+ }
+ return (TextAttribute) getTextAttributes().get(IStyleConstantsCSS.NORMAL);
+ }
+
+ protected TextAttribute getAttributeFor(String type) {
+ return (TextAttribute) getTextAttributes().get(fColorTypes.get(type));
+ }
+
+ private void initAttributes() {
+ if (fColorTypes == null) {
+ fColorTypes = new HashMap();
+ }
+ fColorTypes.put(CSSRegionContexts.CSS_COMMENT, IStyleConstantsCSS.COMMENT);
+ fColorTypes.put(CSSRegionContexts.CSS_CDO, IStyleConstantsCSS.COMMENT);
+ fColorTypes.put(CSSRegionContexts.CSS_CDC, IStyleConstantsCSS.COMMENT);
+ fColorTypes.put(CSSRegionContexts.CSS_S, IStyleConstantsCSS.NORMAL);
+
+ fColorTypes.put(CSSRegionContexts.CSS_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
+ fColorTypes.put(CSSRegionContexts.CSS_LBRACE, IStyleConstantsCSS.CURLY_BRACE);
+ fColorTypes.put(CSSRegionContexts.CSS_RBRACE, IStyleConstantsCSS.CURLY_BRACE);
+
+ fColorTypes.put(CSSRegionContexts.CSS_IMPORT, IStyleConstantsCSS.ATMARK_RULE);
+ fColorTypes.put(CSSRegionContexts.CSS_PAGE, IStyleConstantsCSS.ATMARK_RULE);
+ fColorTypes.put(CSSRegionContexts.CSS_MEDIA, IStyleConstantsCSS.ATMARK_RULE);
+ fColorTypes.put(CSSRegionContexts.CSS_FONT_FACE, IStyleConstantsCSS.ATMARK_RULE);
+ fColorTypes.put(CSSRegionContexts.CSS_CHARSET, IStyleConstantsCSS.ATMARK_RULE);
+ fColorTypes.put(CSSRegionContexts.CSS_ATKEYWORD, IStyleConstantsCSS.ATMARK_RULE);
+
+ fColorTypes.put(CSSRegionContexts.CSS_STRING, IStyleConstantsCSS.STRING);
+ fColorTypes.put(CSSRegionContexts.CSS_URI, IStyleConstantsCSS.URI);
+ fColorTypes.put(CSSRegionContexts.CSS_MEDIUM, IStyleConstantsCSS.MEDIA);
+ fColorTypes.put(CSSRegionContexts.CSS_MEDIA_SEPARATOR, IStyleConstantsCSS.MEDIA);
+
+ fColorTypes.put(CSSRegionContexts.CSS_CHARSET_NAME, IStyleConstantsCSS.STRING);
+
+ fColorTypes.put(CSSRegionContexts.CSS_PAGE_SELECTOR, IStyleConstantsCSS.MEDIA);
+
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_UNIVERSAL, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_PSEUDO, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_CLASS, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ID, IStyleConstantsCSS.SELECTOR);
+
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_COMBINATOR, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_SEPARATOR, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE, IStyleConstantsCSS.SELECTOR);
+ fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR, IStyleConstantsCSS.SELECTOR);
+
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_PROPERTY, IStyleConstantsCSS.PROPERTY_NAME);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_STRING, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_URI, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_HASH, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_S, IStyleConstantsCSS.PROPERTY_VALUE);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_SEPARATOR, IStyleConstantsCSS.COLON);
+ fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
+
+ fColorTypes.put(CSSRegionContexts.CSS_UNKNOWN, IStyleConstantsCSS.NORMAL);
+ }
+
+ protected void handlePropertyChange(PropertyChangeEvent event) {
+ String styleKey = null;
+
+ if (event != null) {
+ String prefKey = event.getProperty();
+ // check if preference changed is a style preference
+ if (getPreferenceKey(IStyleConstantsCSS.ATMARK_RULE).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.ATMARK_RULE;
+ } else if (getPreferenceKey(IStyleConstantsCSS.COLON).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.COLON;
+ } else if (getPreferenceKey(IStyleConstantsCSS.COMMENT).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.COMMENT;
+ } else if (getPreferenceKey(IStyleConstantsCSS.CURLY_BRACE).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.CURLY_BRACE;
+ } else if (getPreferenceKey(IStyleConstantsCSS.ERROR).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.ERROR;
+ } else if (getPreferenceKey(IStyleConstantsCSS.MEDIA).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.MEDIA;
+ } else if (getPreferenceKey(IStyleConstantsCSS.NORMAL).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.NORMAL;
+ } else if (getPreferenceKey(IStyleConstantsCSS.PROPERTY_NAME).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.PROPERTY_NAME;
+ } else if (getPreferenceKey(IStyleConstantsCSS.PROPERTY_VALUE).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.PROPERTY_VALUE;
+ } else if (getPreferenceKey(IStyleConstantsCSS.SELECTOR).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.SELECTOR;
+ } else if (getPreferenceKey(IStyleConstantsCSS.SEMI_COLON).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.SEMI_COLON;
+ } else if (getPreferenceKey(IStyleConstantsCSS.STRING).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.STRING;
+ } else if (getPreferenceKey(IStyleConstantsCSS.URI).equals(prefKey)) {
+ styleKey = IStyleConstantsCSS.URI;
+ }
+ } else {
+ // this is around for old deprecated preferencesChanged() method
+ // TODO remove when preferencesChanged() is removed
+ loadColors();
+ super.handlePropertyChange(event);
+ }
+
+ if (styleKey != null) {
+ // overwrite style preference with new value
+ addTextAttribute(styleKey);
+ super.handlePropertyChange(event);
+ }
+ }
+
+ public void release() {
+ if (fColorTypes != null) {
+ fColorTypes.clear();
+ }
+ super.release();
+ }
+
+ public void loadColors() {
+ clearColors();
+ addTextAttribute(IStyleConstantsCSS.ATMARK_RULE);
+ addTextAttribute(IStyleConstantsCSS.COLON);
+ addTextAttribute(IStyleConstantsCSS.COMMENT);
+ addTextAttribute(IStyleConstantsCSS.CURLY_BRACE);
+ addTextAttribute(IStyleConstantsCSS.ERROR);
+ addTextAttribute(IStyleConstantsCSS.MEDIA);
+ addTextAttribute(IStyleConstantsCSS.NORMAL);
+ addTextAttribute(IStyleConstantsCSS.PROPERTY_NAME);
+ addTextAttribute(IStyleConstantsCSS.PROPERTY_VALUE);
+ addTextAttribute(IStyleConstantsCSS.SELECTOR);
+ addTextAttribute(IStyleConstantsCSS.SEMI_COLON);
+ addTextAttribute(IStyleConstantsCSS.STRING);
+ addTextAttribute(IStyleConstantsCSS.URI);
+ }
+
+ protected void clearColors() {
+ getTextAttributes().clear();
+ }
+
+ protected String getPreferenceKey(String key) {
+ String contentTypeId = IContentTypeIdentifier.ContentTypeID_CSS;
+ return PreferenceKeyGenerator.generateKey(key, contentTypeId);
+ }
+
+ protected IPreferenceStore getColorPreferences() {
+ return EditorPlugin.getDefault().getPreferenceStore();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForEmbeddedCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForEmbeddedCSS.java
new file mode 100644
index 0000000000..71bc4b2a49
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/style/LineStyleProviderForEmbeddedCSS.java
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.style;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.wst.css.core.parser.CSSTextParser;
+import org.eclipse.wst.css.core.parser.CSSTextToken;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+
+public class LineStyleProviderForEmbeddedCSS extends LineStyleProviderForCSS {
+
+ public boolean prepareRegions(ITypedRegion typedRegion, int lineRequestStart, int lineRequestLength, Collection holdResults) {
+ int regionStart = typedRegion.getOffset();
+ int regionEnd = regionStart + typedRegion.getLength();
+ IStructuredDocumentRegion wholeRegion = getDocument().getRegionAtCharacterOffset(regionStart);
+
+ List tokens;
+ int offset;
+
+ ParserCache cache = getCachedParsingResult(wholeRegion);
+ if (cache == null) {
+ offset = wholeRegion.getStartOffset();
+ String content;
+ content = wholeRegion.getText();
+
+ CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_STYLESHEET, content);
+ tokens = parser.getTokenList();
+ cacheParsingResult(wholeRegion, new ParserCache(offset, tokens));
+ } else {
+ tokens = cache.tokens;
+ offset = cache.offset;
+ }
+
+ boolean result = false;
+
+ if (0 < tokens.size()) {
+ int start = offset;
+ Iterator i = tokens.iterator();
+ while (i.hasNext()) {
+ CSSTextToken token = (CSSTextToken) i.next();
+ if (regionStart <= start && start < regionEnd) {
+ TextAttribute attribute = getAttributeFor(token.kind);
+ holdResults.add(new StyleRange(start, token.length, attribute.getForeground(), attribute.getBackground()));
+ }
+ start += token.length;
+ }
+ result = true;
+ }
+
+ return result;
+ }
+
+ protected TextAttribute getAttributeFor(ITextRegion region) {
+ return null;
+ }
+
+ private void cleanupCache() {
+ fCacheKey = -1;
+ fCacheResult = null;
+ }
+
+ private ParserCache getCachedParsingResult(IStructuredDocumentRegion region) {
+ if (fCacheKey == region.getText().hashCode()) {
+ return fCacheResult;
+ }
+ return null;
+ }
+
+ private void cacheParsingResult(IStructuredDocumentRegion region, ParserCache result) {
+ fCacheKey = region.getText().hashCode();
+ fCacheResult = result;
+ }
+
+ public void release() {
+ super.release();
+ cleanupCache();
+ }
+
+ private class ParserCache {
+ ParserCache(int newOffset, List newTokens) {
+ offset = newOffset;
+ tokens = newTokens;
+ }
+
+ int offset;
+ List tokens;
+ }
+
+ int fCacheKey = -1;
+ ParserCache fCacheResult = null;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/taginfo/CSSBestMatchHoverProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/taginfo/CSSBestMatchHoverProcessor.java
new file mode 100644
index 0000000000..2c4a0feb23
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/taginfo/CSSBestMatchHoverProcessor.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.taginfo;
+
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.wst.sse.ui.taginfo.AbstractBestMatchHoverProcessor;
+
+/**
+ * Provides the best css hover help documentation (by using other hover help
+ * processors) Priority of hover help processors is: ProblemHoverProcessor,
+ * AnnotationHoverProcessor
+ */
+public class CSSBestMatchHoverProcessor extends AbstractBestMatchHoverProcessor {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.taginfo.AbstractBestMatchHoverProcessor#getTagInfoHover()
+ */
+ protected ITextHover getTagInfoHover() {
+ // CSS has no taginfo hover
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/text/CSSDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/text/CSSDocumentRegionEdgeMatcher.java
new file mode 100644
index 0000000000..ce975a9b81
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/text/CSSDocumentRegionEdgeMatcher.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.text;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.source.ICharacterPairMatcher;
+import org.eclipse.wst.css.core.parser.CSSRegionContexts;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+public class CSSDocumentRegionEdgeMatcher implements ICharacterPairMatcher {
+
+ private int fAnchor = ICharacterPairMatcher.LEFT;
+
+ /**
+ * @param validContexts
+ * @param nextMatcher
+ */
+ public CSSDocumentRegionEdgeMatcher() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.source.ICharacterPairMatcher#clear()
+ */
+ public void clear() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.source.ICharacterPairMatcher#dispose()
+ */
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.source.ICharacterPairMatcher#getAnchor()
+ */
+ public int getAnchor() {
+ return fAnchor;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.ui.text.DocumentRegionEdgeMatcher#match(org.eclipse.jface.text.IDocument,
+ * int)
+ */
+
+
+ public IRegion match(IDocument document, int offset) {
+ if (document instanceof IStructuredDocument) {
+ IStructuredDocumentRegion r = ((IStructuredDocument) document).getRegionAtCharacterOffset(offset);
+ if (r != null) {
+ if (r.getPrevious() != null && r.getStartOffset() == offset && r.getPrevious().getType().equals(CSSRegionContexts.CSS_RBRACE)) {
+ r = r.getPrevious();
+ }
+ if (r.getType().equals(CSSRegionContexts.CSS_RBRACE)) {
+ while (r != null && !r.getType().equals(CSSRegionContexts.CSS_LBRACE)) {
+ r = r.getPrevious();
+ }
+ if (r != null) {
+ return new Region(r.getStartOffset(), 1);
+ }
+ } else if (r.getType().equals(CSSRegionContexts.CSS_LBRACE)) {
+ while (r != null && !r.getType().equals(CSSRegionContexts.CSS_RBRACE)) {
+ r = r.getNext();
+ }
+ if (r != null) {
+ return new Region(r.getEndOffset() - 1, 1);
+ }
+ }
+ }
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java
new file mode 100644
index 0000000000..82f94e504e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java
@@ -0,0 +1,118 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.contentoutline;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.ui.CSSEditorPlugin;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.view.events.NodeSelectionChangedEvent;
+import org.eclipse.wst.sse.ui.views.contentoutline.PropertyChangeUpdateActionContributionItem;
+import org.eclipse.wst.sse.ui.views.contentoutline.StructuredContentOutlineConfiguration;
+
+public class CSSContentOutlineConfiguration extends StructuredContentOutlineConfiguration {
+ private final String OUTLINE_SORT_PREF = "outline-sort"; //$NON-NLS-1$
+
+ public CSSContentOutlineConfiguration() {
+ super();
+ }
+
+ public IContributionItem[] createToolbarContributions(TreeViewer viewer) {
+ IContributionItem[] items = super.createToolbarContributions(viewer);
+
+ SortAction sortAction = new SortAction(viewer, CSSEditorPlugin.getDefault().getPreferenceStore(), getSortPreferenceKey());
+ IContributionItem sortItem = new PropertyChangeUpdateActionContributionItem(sortAction);
+
+ if (items == null) {
+ items = new IContributionItem[1];
+ items[0] = sortItem;
+ } else {
+ IContributionItem[] combinedItems = new IContributionItem[items.length + 1];
+ combinedItems[0] = sortItem;
+ System.arraycopy(items, 0, combinedItems, 1, items.length);
+ items = combinedItems;
+ }
+ return items;
+ }
+
+ /**
+ * @see com.ibm.sse.editor.views.contentoutline.ContentOutlineConfiguration#getContentProvider(org.eclipse.jface.viewers.TreeViewer)
+ */
+ public IContentProvider getContentProvider(TreeViewer viewer) {
+ if (fContentProvider == null && getFactory() != null)
+ fContentProvider = new JFaceNodeContentProviderCSS((AdapterFactory) getFactory());
+ return fContentProvider;
+ }
+
+ /**
+ * @see com.ibm.sse.editor.views.contentoutline.ContentOutlineConfiguration#getLabelProvider(org.eclipse.jface.viewers.TreeViewer)
+ */
+ public ILabelProvider getLabelProvider(TreeViewer viewer) {
+ if (fLabelProvider == null && getFactory() != null)
+ fLabelProvider = new JFaceNodeLabelProviderCSS((AdapterFactory) getFactory());
+ return fLabelProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.views.contentoutline.ContentOutlineConfiguration#getNodes(java.util.List)
+ */
+ public List getNodes(List nodes) {
+ List filteredNodes = new ArrayList(nodes);
+
+ List targetNodes = new ArrayList();
+ Iterator i = filteredNodes.iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof ICSSNode) {
+ ICSSNode node = (ICSSNode) obj;
+ short nodeType = node.getNodeType();
+ if (node instanceof ICSSValue) {
+ while (node != null && !(node instanceof ICSSStyleDeclItem)) {
+ node = node.getParentNode();
+ }
+ } else if (nodeType == ICSSNode.STYLEDECLARATION_NODE) {
+ node = node.getParentNode();
+ } else if (nodeType == ICSSNode.MEDIALIST_NODE) {
+ node = node.getParentNode();
+ }
+ if (node != null) {
+ obj = node;
+ }
+ }
+ targetNodes.add(obj);
+ }
+
+ return targetNodes;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.views.contentoutline.ContentOutlineConfiguration#getSelectedNodes(com.ibm.sse.editor.view.events.NodeSelectionChangedEvent)
+ */
+ public List getSelectedNodes(NodeSelectionChangedEvent event) {
+ return getNodes(event.getSelectedNodes());
+ }
+
+ public String getSortPreferenceKey() {
+ return PreferenceKeyGenerator.generateKey(OUTLINE_SORT_PREF, getDeclaringID());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSNodeAdapter.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSNodeAdapter.java
new file mode 100644
index 0000000000..d012df085d
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSNodeAdapter.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.contentoutline;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.document.ICSSStyleSheet;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapter;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapterFactory;
+
+/**
+ * Adapts a DOM node to a JFace viewer.
+ */
+//public class CSSNodeAdapter extends JFaceNodeAdapter {
+public class CSSNodeAdapter implements INodeAdapter, Runnable {
+ class NotifyContext {
+ NotifyContext(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ this.notifier = notifier;
+ this.eventType = eventType;
+ this.changedFeature = changedFeature;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ this.pos = pos;
+ }
+
+ void fire() {
+ internalNotifyChanged(notifier, eventType, changedFeature, oldValue, newValue, pos);
+ }
+
+ INodeNotifier notifier;
+ int eventType;
+ Object changedFeature;
+ Object oldValue;
+ Object newValue;
+ int pos;
+ }
+
+ class StyleViewUpdater implements Runnable {
+ public void run() {
+ if (lastUpdater == this) {
+ internalActionPerformed();
+ lastUpdater = null;
+ }
+ }
+ }
+
+ protected AdapterFactory adapterFactory;
+ private Vector notifyQueue;
+ StyleViewUpdater lastUpdater;
+ protected int delayMSecs = 500;
+ final static Class ADAPTER_KEY = IJFaceNodeAdapter.class;
+
+ public CSSNodeAdapter(AdapterFactory adapterFactory) {
+ super();
+ this.adapterFactory = adapterFactory;
+ }
+
+ /**
+ * Insert the method's description here.
+ */
+ protected void internalActionPerformed() {
+ if (notifyQueue == null) {
+ return;
+ }
+ boolean refresh_all = false;
+ boolean refresh_rule = false;
+ int pos_all = 0;
+ List targets = new ArrayList();
+ for (int i = 0; i < notifyQueue.size(); i++) {
+ NotifyContext context = (NotifyContext) notifyQueue.get(i);
+ if (context.notifier instanceof ICSSStyleSheet) {
+ refresh_all = true;
+ pos_all = i;
+ }
+ if (context.notifier instanceof ICSSStyleDeclaration) {
+ refresh_rule = true;
+ targets.add(context);
+ // pos_rule = i;
+ }
+ // ((NotifyContext) notifyQueue.get(i)).fire();
+ }
+ if (refresh_all) {
+ ((NotifyContext) notifyQueue.get(pos_all)).fire();
+ } else if (refresh_rule) {
+ Iterator i = targets.iterator();
+ while (i.hasNext()) {
+ ((NotifyContext) i.next()).fire();
+ }
+ // else if (refresh_rule) internalRefreshAll();
+ } else {
+ for (int i = 0; i < notifyQueue.size(); i++) {
+ ((NotifyContext) notifyQueue.get(i)).fire();
+ }
+ }
+ notifyQueue.clear();
+ }
+
+ /**
+ * Called by the object being adapter (the notifier) when something has
+ * changed.
+ */
+ public void internalNotifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ Iterator iterator = ((IJFaceNodeAdapterFactory) adapterFactory).getListeners().iterator();
+ while (iterator.hasNext()) {
+ Object listener = iterator.next();
+ if (listener instanceof StructuredViewer) {
+ notifyChangedForStructuredViewer((StructuredViewer) listener, notifier, eventType, changedFeature, oldValue, newValue, pos);
+ } else if (listener instanceof PropertySheetPage) {
+ notifyChangedForPropertySheetPage((PropertySheetPage) listener, notifier, eventType, changedFeature, oldValue, newValue, pos);
+ }
+ }
+ }
+
+ private void notifyChangedForPropertySheetPage(PropertySheetPage page, INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (page.getControl() == null || page.getControl().isDisposed()) {
+ return;
+ }
+ if (eventType == INodeNotifier.CHANGE || eventType == INodeNotifier.ADD || eventType == INodeNotifier.REMOVE) {
+ page.refresh();
+ }
+ }
+
+ private void notifyChangedForStructuredViewer(StructuredViewer viewer, INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (viewer.getControl() == null || viewer.getControl().isDisposed()) {
+ return;
+ }
+ if (eventType == INodeNotifier.CHANGE) {
+ if (notifier instanceof ICSSStyleSheet) {
+ ICSSNode temp = (changedFeature != null) ? (ICSSNode) changedFeature : (ICSSNode) newValue;
+ if (temp instanceof ICSSStyleRule) {
+ viewer.refresh();
+ } else {
+ for (;;) {
+ if (temp instanceof ICSSStyleRule) {
+ break;
+ }
+ temp = temp.getParentNode();
+ if (temp == null) {
+ break;
+ }
+ }
+ if (temp == null || temp instanceof ICSSStyleSheet) {
+ viewer.refresh();
+ } else {
+ viewer.refresh(temp);
+ }
+ }
+ } else {
+ ICSSNode temp = (ICSSNode) notifier;
+ if (temp != null) {
+ temp = temp.getParentNode();
+ }
+ if (temp == null || temp instanceof ICSSStyleSheet) {
+ viewer.refresh();
+ } else {
+ viewer.refresh(temp);
+ }
+ }
+ }
+ if (eventType == INodeNotifier.ADD) {
+ if (notifier instanceof ICSSStyleSheet) {
+ ICSSNode temp = (changedFeature != null) ? (ICSSNode) changedFeature : (ICSSNode) newValue;
+ if (temp instanceof ICSSStyleRule) {
+ viewer.refresh();
+ } else {
+ for (;;) {
+ if (temp instanceof ICSSStyleRule) {
+ break;
+ }
+ temp = temp.getParentNode();
+ if (temp == null) {
+ break;
+ }
+ }
+ }
+ if (temp == null || (temp instanceof ICSSStyleSheet)) {
+ viewer.refresh();
+ } else {
+ viewer.refresh(temp);
+ }
+ } else {
+ if (newValue != null && (newValue instanceof ICSSStyleDeclItem)) {
+ viewer.refresh(((ICSSNode) newValue).getParentNode());
+ } else {
+ ICSSNode temp = (ICSSNode) notifier;
+ if (temp != null) {
+ temp = temp.getParentNode();
+ }
+ if (temp == null || (temp instanceof ICSSStyleSheet)) {
+ viewer.refresh();
+ } else {
+ viewer.refresh(temp);
+ }
+ }
+ }
+ } else if (eventType == INodeNotifier.REMOVE) {
+ if (notifier instanceof ICSSStyleSheet) {
+ ICSSNode temp = (changedFeature != null) ? (ICSSNode) changedFeature : (ICSSNode) newValue;
+ if (temp instanceof ICSSStyleRule) {
+ viewer.refresh();
+ } else {
+ for (;;) {
+ if (temp instanceof ICSSStyleRule) {
+ break;
+ }
+ temp = temp.getParentNode();
+ if (temp == null) {
+ break;
+ }
+ }
+ if (temp == null || (temp instanceof ICSSStyleSheet)) {
+ viewer.refresh();
+ } else {
+ viewer.refresh(temp);
+ }
+ }
+ } else {
+ // viewer.refresh(notifier);
+ ICSSNode temp = (ICSSNode) notifier;
+ if (temp != null) {
+ temp = temp.getParentNode();
+ }
+ if (temp == null || (temp instanceof ICSSStyleSheet)) {
+ viewer.refresh();
+ } else {
+ viewer.refresh(temp);
+ }
+ }
+ }
+ // }
+ }
+
+ /**
+ *
+ */
+ public void internalRefreshAll() {
+ Collection listeners = ((JFaceNodeAdapterFactoryCSS) adapterFactory).getListeners();
+ Iterator iterator = listeners.iterator();
+ while (iterator.hasNext()) {
+ Object listener = iterator.next();
+ if (listener instanceof StructuredViewer) {
+ StructuredViewer viewer = (StructuredViewer) listener;
+ if (viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh();
+ }
+ } else if (listener instanceof PropertySheetPage) {
+ PropertySheetPage page = (PropertySheetPage) listener;
+ if (page.getControl() != null && !page.getControl().isDisposed()) {
+ page.refresh();
+ }
+ }
+ }
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type allows it
+ * to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return type.equals(ADAPTER_KEY);
+ }
+
+ /**
+ * Called by the object being adapter (the notifier) when something has
+ * changed.
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (notifyQueue == null)
+ notifyQueue = new Vector();
+ notifyQueue.add(new NotifyContext(notifier, eventType, changedFeature, oldValue, newValue, pos));
+ // TODO-future: there's probably a better way than relying on async
+ // exec
+ if (Thread.currentThread() == getDisplay().getThread())
+ getDisplay().timerExec(delayMSecs, this);
+ else
+ getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (getDisplay() != null) {
+ getDisplay().timerExec(delayMSecs, this);
+ }
+ }
+ });
+ }
+
+ Display getDisplay() {
+ return PlatformUI.getWorkbench().getDisplay();
+ }
+
+ /**
+ * this method is intended only for timerExec()
+ */
+ public void run() {
+ lastUpdater = new StyleViewUpdater();
+ getDisplay().asyncExec(lastUpdater);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeAdapterFactoryCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeAdapterFactoryCSS.java
new file mode 100644
index 0000000000..df96b82b76
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeAdapterFactoryCSS.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.contentoutline;
+
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapter;
+import org.eclipse.wst.xml.ui.views.contentoutline.JFaceNodeAdapterFactory;
+
+public class JFaceNodeAdapterFactoryCSS extends JFaceNodeAdapterFactory {
+ public JFaceNodeAdapterFactoryCSS() {
+ this(IJFaceNodeAdapter.class, true);
+ }
+
+ public JFaceNodeAdapterFactoryCSS(Object adapterKey, boolean registerAdapters) {
+ super(adapterKey, registerAdapters);
+ }
+
+
+ protected void initAdapter(INodeAdapter adapter, INodeNotifier node) {
+ }
+
+ protected INodeAdapter createAdapter(INodeNotifier node) {
+ if (singletonAdapter == null) {
+ // create the JFaceNodeAdapter
+ singletonAdapter = new CSSNodeAdapter(this);
+ initAdapter(singletonAdapter, node);
+ }
+ return singletonAdapter;
+ }
+
+ public void release() {
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java
new file mode 100644
index 0000000000..3235b9cae1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java
@@ -0,0 +1,263 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.contentoutline;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.css.core.document.ICSSDocument;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.ui.views.contentoutline.JFaceNodeContentProvider;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ * A Content provider for a JFace viewer used to display DOM nodes. This
+ * content provider takes an adapter factory to create JFace adapters for the
+ * nodes in the tree.
+ */
+public class JFaceNodeContentProviderCSS extends JFaceNodeContentProvider {
+ protected AdapterFactory adapterFactory;
+
+ //protected DomainNotifier domainNotifier;
+ /**
+ */
+ public JFaceNodeContentProviderCSS(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ this.adapterFactory = adapterFactory;
+ }
+
+ /**
+ */
+ protected void adaptElements(Object element) {
+
+ ICSSNode node;
+
+ if (element instanceof ICSSModel) {
+ ICSSDocument doc = ((ICSSModel) element).getDocument();
+ adapterFactory.adapt((INodeNotifier) doc);
+ node = doc.getFirstChild();
+ } else if (element instanceof ICSSNode) {
+ node = ((ICSSNode) element).getFirstChild();
+ } else {
+ return;
+ }
+
+ while (node != null) {
+ // if (node instanceof CSSRule) {
+ adapterFactory.adapt((INodeNotifier) node);
+ adaptElements(node);
+ // }
+ // else{
+ // adapterFactory.adapt((INodeNotifier) node);
+ // }
+
+ node = node.getNextSibling();
+ }
+ }
+
+ /**
+ */
+ protected void addElements(Object element, ArrayList v) {
+
+ ICSSNode node;
+
+ if (element instanceof ICSSModel) {
+ ICSSModel model = (ICSSModel) element;
+ ICSSDocument doc = model.getDocument();
+ // addAdapter((INodeNotifier) doc);
+ adapterFactory.adapt((INodeNotifier) doc);
+ node = doc.getFirstChild();
+ } else if (element instanceof ICSSNode) {
+ node = ((ICSSNode) element).getFirstChild();
+ } else
+ return;
+
+ while (node != null) {
+ if (node instanceof CSSRule) {
+ v.add(node);
+ }
+
+ node = node.getNextSibling();
+ }
+
+ }
+
+ /**
+ * The visual part that is using this content provider is about to be
+ * disposed. Deallocate all allocated SWT resources.
+ */
+ public void dispose() {
+ }
+
+ /**
+ * Returns an enumeration containing all child nodes of the given element,
+ * which represents a node in a tree. The difference to
+ * <code>IStructuredContentProvider.getElements(Object)</code> is as
+ * follows: <code>getElements</code> is called to obtain the tree
+ * viewer's root elements. Method <code>getChildren</code> is used to
+ * obtain the children of a given node in the tree, which can can be a
+ * root node, too.
+ */
+ public Object[] getChildren(Object object) {
+ if (object instanceof ICSSNode) {
+ ICSSNode node = (ICSSNode) object;
+ short nodeType = node.getNodeType();
+ if (nodeType == ICSSNode.STYLERULE_NODE || nodeType == ICSSNode.PAGERULE_NODE || nodeType == ICSSNode.FONTFACERULE_NODE) {
+ for (node = node.getFirstChild(); node != null && !(node instanceof ICSSStyleDeclaration); node.getNextSibling()) {
+ // nop
+ }
+ }
+ List children = new ArrayList();
+ ICSSNode child = (node != null) ? node.getFirstChild() : null;
+ while (child != null) {
+ if (!(child instanceof ICSSPrimitiveValue) && !(child instanceof MediaList)) {
+ children.add(child);
+ }
+ child = child.getNextSibling();
+ }
+ return children.toArray();
+ }
+ return new Object[0];
+ }
+
+ /**
+ * Returns an enumeration with the elements belonging to the passed
+ * element. These elements can be presented as rows in a table, items in a
+ * list etc.
+ */
+ public Object[] getElements(Object object) {
+ // The root is usually an instance of an XMLStructuredModel in
+ // which case we want to extract the document.
+
+ if (object instanceof ICSSModel) {
+ ArrayList v = new ArrayList();
+ // internalGetElements(object, v);
+ addElements(object, v);
+ adaptElements(object);
+ return v.toArray();
+ }
+ return new Object[0];
+
+ }
+
+ /**
+ * Returns the parent for the given element. This method can return
+ * <code>null</code> indicating that the parent can't be computed. In
+ * this case the tree viewer can't expand a given node correctly if
+ * requested.
+ */
+ public Object getParent(Object object) {
+ // IJFaceNodeAdapter adapter = getAdapter(object);
+ /*
+ * ICSSNodeAdapter adapter = (ICSSNodeAdapter)getAdapter(object); if
+ * (adapter != null) return adapter.getParent((ICSSNode) object); else
+ * return null;
+ */
+ if (object instanceof ICSSNode) {
+ ICSSNode node = ((ICSSNode) object).getParentNode();
+ if (node != null && node.getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
+ node = node.getParentNode();
+ }
+ return node;
+ }
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if the given element has children.
+ * Otherwise <code>false</code> is returned.
+ */
+ public boolean hasChildren(Object object) {
+ // return getAdapter(object).hasChildren((ICSSNode) object);
+ if (object instanceof ICSSNode) {
+ if (object instanceof ICSSStyleDeclItem)
+ return false;
+ else
+ return ((ICSSNode) object).hasChildNodes();
+ }
+ return false;
+ }
+
+ /**
+ * Called when the viewer's input is changing from <code>oldInput</code>
+ * to <code>newInput</code>. Both <code>newInput</code> and
+ * <code>oldInput</code> can be <code>null</code>. If
+ * <code>oldInput</code> is <code>null</code> it is the viewer's first
+ * connection to the content provider. If <code>newInput</code> is
+ * <code>null</code> the visual part is disconnected from any input. A
+ * typical implementation of this methods registers the content provider
+ * as a listener to changes on the new input, and deregisters the viewer
+ * from the old input. The content provider then updates the viewer in
+ * response to change notifications from the input.
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ //// If there was no old input, then we must be providing content for
+ // this part for the first time...
+ //if (oldInput == null) {
+ //// If the part is an IDomainListener then make the part start
+ // listening to us.
+ //if (viewer instanceof IDomainListener)
+ //domainNotifier.addDomainListener((IDomainListener) viewer);
+ //}
+ //// If there is no new input, we must clean ourselves up as if we'd
+ // never seen the viewer.
+ //else
+ //if (newInput == null) {
+ //// If the part is an IDomainListener, then we make it stop
+ // listening to us.
+ //if (viewer instanceof IDomainListener)
+ //domainNotifier.removeDomainListener((IDomainListener) viewer);
+
+ //}
+ }
+
+ /**
+ */
+ /*
+ * protected void internalGetElements(Object element, ArrayList v) {
+ *
+ * ICSSNode node;
+ *
+ * if (element instanceof ICSSModel) { ICSSModel model =
+ * (ICSSModel)element; ICSSDocument doc = model.getDocument();
+ * adapterFactory.adapt((INodeNotifier)doc); node = doc.getFirstChild(); }
+ * else if (element instanceof ICSSNode) { node =
+ * ((ICSSNode)element).getFirstChild(); } else { return; }
+ *
+ * while (node != null) { switch (node.getNodeType()) { case
+ * ICSSNode.STYLEDECLARATION_NODE: adapterFactory.adapt((INodeNotifier)
+ * node); break; case ICSSNode.STYLERULE_NODE: case
+ * ICSSNode.FONTFACERULE_NODE: case ICSSNode.PAGERULE_NODE: case
+ * ICSSNode.IMPORTRULE_NODE: case ICSSNode.MEDIARULE_NODE: v.add(node);
+ * adapterFactory.adapt((INodeNotifier) node); break; default:
+ * adapterFactory.adapt((INodeNotifier) node); break; }
+ *
+ * node = node.getNextSibling(); }
+ * }
+ */
+ /**
+ * Checks whether the given element is deleted or not.
+ */
+ public boolean isDeleted(Object element) {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java
new file mode 100644
index 0000000000..5df26448d5
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.contentoutline;
+
+
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.css.core.document.ICSSMediaRule;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSPageRule;
+import org.eclipse.wst.css.core.document.ICSSPrimitiveValue;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.ui.image.CSSImageHelper;
+import org.eclipse.wst.css.ui.image.CSSImageType;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapter;
+import org.w3c.dom.css.CSSImportRule;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.stylesheets.MediaList;
+
+
+/**
+ * A class that uses a JFaceNodeAdapterFactory to provide adapters to provide
+ * the labels and images for DOM nodes.
+ */
+public class JFaceNodeLabelProviderCSS implements ILabelProvider {
+ protected AdapterFactory fAdapterFactory;
+
+ /**
+ * JFaceNodeLabelProvider constructor comment.
+ */
+ public JFaceNodeLabelProviderCSS(AdapterFactory adapterFactory) {
+ super();
+ this.fAdapterFactory = adapterFactory;
+ }
+
+ /**
+ * Adds a listener to the label provider. A label provider should inform
+ * its listener about state changes that enforces rendering of the visual
+ * part that uses this label provider.
+ */
+ public void addListener(ILabelProviderListener listener) {
+ // The label provider state never changes so we do not have
+ // to implement this method.
+ }
+
+ /**
+ * The visual part that is using this label provider is about to be
+ * disposed. Deallocate all allocated SWT resources.
+ */
+ public void dispose() {
+ // Nothing to dispose
+ }
+
+ /**
+ * Returns the JFace adapter for the specified object.
+ *
+ * @return com.ibm.sed.view.tree.DOMJFaceAdapter The JFace adapter
+ * @param adaptable
+ * java.lang.Object The object to get the adapter for
+ */
+ //protected IJFaceNodeAdapter getAdapter(Object adaptable) {
+ // return (IJFaceNodeAdapter) adapterFactory.adapt((INodeNotifier)
+ // adaptable);
+ protected IJFaceNodeAdapter getAdapter(Object adaptable) {
+ return (IJFaceNodeAdapter) fAdapterFactory.adapt((INodeNotifier) adaptable);
+ }
+
+ /**
+ * Returns the image for the label of the given element, for use in the
+ * given viewer.
+ *
+ * @param viewer
+ * The viewer that displays the element.
+ * @param element
+ * The element for which to provide the label image. Element
+ * can be <code>null</code> indicating no input object is set
+ * to the viewer.
+ */
+ public Image getImage(Object element) {
+ // return getAdapter(element).getLabelImage((Node) element);
+
+
+ if (element instanceof ICSSNode) {
+ CSSImageHelper helper = CSSImageHelper.getInstance();
+ return helper.getImage(CSSImageType.getImageType((ICSSNode) element));
+ // Image image = getCSSNodeImage(element);
+ // return image;
+ // return getAdapter(element).getLabelImage((ICSSNode) element);
+ }
+ return null;
+ }
+
+ /**
+ * Insert the method's description here.
+ */
+ public String getLabelText(Viewer viewer, Object element) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the text for the label of the given element, for use in the
+ * given viewer.
+ *
+ * @param viewer
+ * The viewer that displays the element.
+ * @param element
+ * The element for which to provide the label text. Element can
+ * be <code>null</code> indicating no input object is set to
+ * the viewer.
+ */
+ public String getText(Object element) {
+ // This was returning null, on occasion ... probably should not be,
+ // but
+ // took the quick and easy way out for now. (dmw 3/8/01)
+
+ String result = "";//$NON-NLS-1$
+ String mediaText;
+ if (element instanceof ICSSNode) {
+ switch (((ICSSNode) element).getNodeType()) {
+ case ICSSNode.STYLERULE_NODE :
+ result = ((ICSSStyleRule) element).getSelectors().getString();
+ break;
+ case ICSSNode.FONTFACERULE_NODE :
+ result = "@font-face";//$NON-NLS-1$
+ break;
+ case ICSSNode.IMPORTRULE_NODE :
+ result = ((CSSImportRule) element).getHref();
+ mediaText = getMediaText((CSSImportRule) element);
+ if (mediaText != null && 0 < mediaText.length()) {
+ result += " (" + mediaText + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ break;
+ case ICSSNode.PAGERULE_NODE :
+ result = ((ICSSPageRule) element).getSelectors().getString();
+ break;
+ case ICSSNode.STYLEDECLARATION_NODE :
+ result = "properties";//$NON-NLS-1$
+ break;
+ case ICSSNode.STYLEDECLITEM_NODE :
+ result = ((ICSSStyleDeclItem) element).getPropertyName();
+ break;
+ case ICSSNode.PRIMITIVEVALUE_NODE :
+ result = ((ICSSPrimitiveValue) element).getStringValue();
+ break;
+ case ICSSNode.MEDIARULE_NODE :
+ result = "@media";//$NON-NLS-1$
+ mediaText = getMediaText((ICSSMediaRule) element);
+ if (mediaText != null && 0 < mediaText.length()) {
+ result += " (" + mediaText + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ break;
+ case ICSSNode.CHARSETRULE_NODE :
+ result = "@charset";//$NON-NLS-1$
+ break;
+ case ICSSNode.MEDIALIST_NODE :
+ result = ((MediaList) element).getMediaText();
+ break;
+ default :
+ break;
+ }
+ }
+
+ // if (element instanceof ICSSNode) {
+ // ICSSNode node = ((ICSSNode)element);
+ // result = getAdapter(element).getLabelText((ICSSNode) element);
+ // }
+ return result;
+ }
+
+ private String getMediaText(CSSRule rule) {
+ String result = ""; //$NON-NLS-1$
+ ICSSNode child = (rule != null) ? ((ICSSNode) rule).getFirstChild() : null;
+ while (child != null) {
+ if (child.getNodeType() == ICSSNode.MEDIALIST_NODE) {
+ result = ((MediaList) child).getMediaText();
+ break;
+ }
+ child = child.getNextSibling();
+ }
+ return result;
+ }
+
+ /**
+ * Checks whether this label provider is affected by the given domain
+ * event.
+ */
+ public boolean isAffected(Object dummy) {//DomainEvent event) {
+ //return event.isModifier(DomainEvent.NON_STRUCTURE_CHANGE);
+ return true;
+
+ }
+
+ /**
+ * Returns whether the label would be affected by a change to the given
+ * property of the given element. This can be used to optimize a
+ * non-structural viewer update. If the property mentioned in the update
+ * does not affect the label, then the viewer need not update the label.
+ *
+ * @param element
+ * the element
+ * @param property
+ * the property
+ * @return <code>true</code> if the label would be affected, and
+ * <code>false</code> if it would be unaffected
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ * Removes a listener from the label provider.
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ // The label provider state never changes so we do not have
+ // to implement this method.
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java
new file mode 100644
index 0000000000..3e6b16faa1
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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
+ *******************************************************************************/
+/*
+ * Created on Jan 22, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.wst.css.ui.views.contentoutline;
+
+import java.text.Collator;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.css.ui.CSSEditorPlugin;
+import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages;
+import org.eclipse.wst.css.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.sse.ui.views.contentoutline.PropertyChangeUpdateAction;
+
+/**
+ * Based on com.ibm.etools.dtd.editor.DTDContentOutlinePage#SortAction
+ */
+class SortAction extends PropertyChangeUpdateAction {
+ private TreeViewer treeViewer;
+
+ public SortAction(TreeViewer viewer, IPreferenceStore store, String preferenceKey) {
+ super(ResourceHandler.getString("SortAction.0"), store, preferenceKey, false); //$NON-NLS-1$
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(CSSEditorPlugin.ID, CSSEditorPluginImages.IMG_OBJ_SORT);
+ setImageDescriptor(desc);
+ setToolTipText(getText());
+ treeViewer = viewer;
+ if (isChecked()) {
+ treeViewer.setSorter(new ViewerSorter(Collator.getInstance()));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ public void update() {
+ super.update();
+ treeViewer.getControl().setVisible(false);
+ Object[] expandedElements = treeViewer.getExpandedElements();
+ if (isChecked()) {
+ treeViewer.setSorter(new ViewerSorter(Collator.getInstance()));
+ } else {
+ treeViewer.setSorter(null);
+ }
+ treeViewer.setInput(treeViewer.getInput());
+ treeViewer.setExpandedElements(expandedElements);
+ treeViewer.getControl().setVisible(true);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java
new file mode 100644
index 0000000000..5972406b2b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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
+ ****************************************************************************/
+/*
+ * Created on Jan 23, 2004
+ *
+ * To change the template for this generated file go to Window - Preferences -
+ * Java - Code Generation - Code and Comments
+ */
+package org.eclipse.wst.css.ui.views.properties;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.sse.ui.views.properties.StructuredPropertySheetConfiguration;
+
+public class CSSPropertySheetConfiguration extends StructuredPropertySheetConfiguration {
+ public CSSPropertySheetConfiguration() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.views.properties.StructuredPropertySheetConfiguration#getSelection(org.eclipse.jface.viewers.ISelection,
+ * org.eclipse.ui.IWorkbenchPart)
+ */
+ public ISelection getSelection(IWorkbenchPart selectingPart, ISelection selection) {
+ ISelection preferredSelection = super.getSelection(selectingPart, selection);
+ if (preferredSelection instanceof IStructuredSelection) {
+ Object[] objects = ((IStructuredSelection) preferredSelection).toArray();
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof ICSSNode) {
+ ICSSNode node = (ICSSNode) objects[i];
+ while (node.getNodeType() == ICSSNode.PRIMITIVEVALUE_NODE || node.getNodeType() == ICSSNode.STYLEDECLITEM_NODE) {
+ node = node.getParentNode();
+ objects[i] = node;
+
+ }
+ }
+ }
+ preferredSelection = new StructuredSelection(objects);
+ }
+ return preferredSelection;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySource.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySource.java
new file mode 100644
index 0000000000..41b771c5fc
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySource.java
@@ -0,0 +1,350 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.properties;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSNodeList;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.metamodel.CSSMMCategory;
+import org.eclipse.wst.css.core.metamodel.CSSMMNode;
+import org.eclipse.wst.css.core.metamodel.CSSMetaModel;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelFinder;
+import org.eclipse.wst.css.core.metamodel.util.CSSMetaModelUtil;
+import org.eclipse.wst.css.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.w3c.dom.css.CSSStyleDeclaration;
+
+/**
+ * A IPropertySource implementation for a JFace viewer used to display
+ * propreties of DOM nodes. This takes an adapter factory to create JFace
+ * adapters for the nodes in the tree.
+ */
+public class CSSPropertySource implements INodeAdapter, IPropertySource {
+ protected ICSSNode fNode = null;
+ // for performance...
+ final static Class ADAPTER_KEY = IPropertySource.class;
+
+ /**
+ * DOMPropertySource constructor comment.
+ */
+ public CSSPropertySource(INodeNotifier target) {
+ super();
+ fNode = (ICSSNode) target;
+ }
+
+ protected IPropertyDescriptor createDefaultPropertyDescriptor(String attributeName) {
+ // the displayName MUST be set
+ IPropertyDescriptor descriptor = new CSSTextPropertyDescriptor(attributeName, attributeName, fNode);
+ // IPropertyDescriptor descriptor = new
+ // TextPropertyDescriptor(attributeName, attributeName);
+ return descriptor;
+ }
+
+ protected IPropertyDescriptor createPropertyDescriptor(CSSMMNode node, String category) {
+ return createPropertyDescriptor(node.getName(), category);
+ }
+
+ protected IPropertyDescriptor createPropertyDescriptor(String name, String category) {
+ IPropertyDescriptor descriptor = null;
+ if (name != null && 0 < name.length()) {
+ name = name.toLowerCase();
+ if (category == null) {
+ category = ResourceHandler.getString("INFO_Not_Categorized_1"); //$NON-NLS-1$
+ }
+ descriptor = new CSSTextPropertyDescriptor(name, name, fNode, category);
+ // if (category == null) {
+ // descriptor = new CSSTextPropertyDescriptor(name, name, fNode);
+ // } else {
+ // descriptor = new CSSTextPropertyDescriptor(name, name, fNode,
+ // category);
+ // }
+ }
+ return descriptor;
+ }
+
+ /**
+ * Returns a value for this object that can be editted in a property
+ * sheet.
+ *
+ * @return a value that can be editted
+ */
+ public Object getEditableValue() {
+ return null;
+ }
+
+ /**
+ * Returns the current collection of property descriptors.
+ *
+ * @return a vector containing all descriptors.
+ */
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ CSSMetaModel metamodel = CSSMetaModelFinder.getInstance().findMetaModelFor(fNode);
+ Iterator iProperties = Collections.EMPTY_LIST.iterator();
+ switch (fNode.getNodeType()) {
+ case ICSSNode.STYLERULE_NODE :
+ case ICSSNode.FONTFACERULE_NODE :
+ case ICSSNode.PAGERULE_NODE :
+ case ICSSNode.STYLEDECLARATION_NODE :
+ CSSMMNode mmParent = new CSSMetaModelUtil(metamodel).getMetaModelNodeFor(fNode);
+ if (mmParent != null) {
+ iProperties = mmParent.getChildNodes();
+ }
+ break;
+ case ICSSNode.STYLEDECLITEM_NODE :
+ CSSMMNode mmNode = new CSSMetaModelUtil(metamodel).getMetaModelNodeFor(fNode);
+ if (mmNode != null) {
+ iProperties = Collections.singletonList(mmNode).iterator();
+ }
+ break;
+ default :
+ break;
+ }
+
+ // setup categories
+ Map categories = new HashMap();
+ Iterator iCategories = metamodel.getCategories();
+ while (iCategories.hasNext()) {
+ CSSMMCategory category = (CSSMMCategory) iCategories.next();
+ categories.put(category.getName(), category.getCaption());
+ }
+
+ // collect property names
+ Set declaredProperties = new HashSet();
+ if (iProperties.hasNext()) {
+ CSSStyleDeclaration declaration = getDeclarationNode();
+ if (declaration != null) {
+ ICSSNodeList nodeList = ((ICSSNode) declaration).getChildNodes();
+ int nProps = (nodeList != null) ? nodeList.getLength() : 0;
+ for (int i = 0; i < nProps; i++) {
+ ICSSNode node = nodeList.item(i);
+ if (node instanceof ICSSStyleDeclItem) {
+ String name = ((ICSSStyleDeclItem) node).getPropertyName();
+ if (name != null && 0 < name.length()) {
+ declaredProperties.add(name.toLowerCase());
+ }
+ }
+ }
+ }
+ }
+
+ List descriptors = new ArrayList();
+
+ // first: properties from content model
+ while (iProperties.hasNext()) {
+ CSSMMNode node = (CSSMMNode) iProperties.next();
+ if (node.getType() == CSSMMNode.TYPE_PROPERTY || node.getType() == CSSMMNode.TYPE_DESCRIPTOR) {
+ String category = (String) categories.get(node.getAttribute("category")); //$NON-NLS-1$
+ String name = node.getName().toLowerCase();
+ if (declaredProperties.contains(name)) {
+ declaredProperties.remove(name);
+ }
+ IPropertyDescriptor descriptor = createPropertyDescriptor(name, category);
+ if (descriptor != null) {
+ descriptors.add(descriptor);
+ }
+ }
+ }
+
+ // second: existing properties but not in content model
+ Iterator iRemains = declaredProperties.iterator();
+ while (iRemains.hasNext()) {
+ IPropertyDescriptor descriptor = createPropertyDescriptor((String) iRemains.next(), null);
+ if (descriptor != null) {
+ descriptors.add(descriptor);
+ }
+ }
+
+ IPropertyDescriptor[] resultArray = new IPropertyDescriptor[descriptors.size()];
+ return (IPropertyDescriptor[]) descriptors.toArray(resultArray);
+ }
+
+ /**
+ * Returns the current value for the named property.
+ *
+ * @param name
+ * the name of the property as named by its property descriptor
+ * @return the current value of the property
+ */
+ public Object getPropertyValue(Object name) {
+ if (name == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ String valueString = null;
+ String nameString = name.toString();
+
+ CSSStyleDeclaration declaration = null;
+
+ switch (fNode.getNodeType()) {
+ case ICSSNode.STYLEDECLITEM_NODE :
+ valueString = ((ICSSStyleDeclItem) fNode).getCSSValueText();
+ break;
+ case ICSSNode.STYLERULE_NODE :
+ case ICSSNode.FONTFACERULE_NODE :
+ case ICSSNode.PAGERULE_NODE :
+ declaration = (CSSStyleDeclaration) fNode.getFirstChild();
+ if (declaration != null) {
+ valueString = declaration.getPropertyValue(nameString);
+ }
+ break;
+ case ICSSNode.STYLEDECLARATION_NODE :
+ valueString = ((CSSStyleDeclaration) fNode).getPropertyValue(nameString);
+ break;
+ case ICSSNode.PRIMITIVEVALUE_NODE :
+ ICSSNode parent = fNode;
+ while (parent != null && !(parent instanceof ICSSStyleDeclItem)) {
+ parent = parent.getParentNode();
+ }
+ if (parent != null) {
+ valueString = ((ICSSStyleDeclItem) parent).getCSSValueText();
+ }
+ break;
+ default :
+ break;
+ }
+
+ if (valueString == null) {
+ valueString = ""; //$NON-NLS-1$
+ }
+
+ return valueString;
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type allows it
+ * to return true in more than one case.
+ */
+ public boolean isAdapterForType(java.lang.Object type) {
+ return type.equals(ADAPTER_KEY);
+ }
+
+ /**
+ * Returns whether the property value has changed from the default.
+ *
+ * @return <code>true</code> if the value of the specified property has
+ * changed from its original default value; <code>false</code>
+ * otherwise.
+ */
+ public boolean isPropertySet(Object property) {
+ if (property == null) {
+ return false;
+ }
+ CSSStyleDeclaration declaration = getDeclarationNode();
+ if (declaration != null) {
+ String value = declaration.getPropertyValue(property.toString());
+ if (value != null && 0 < value.length()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, java.lang.Object changedFeature, java.lang.Object oldValue, java.lang.Object newValue, int pos) {
+ }
+
+ /**
+ * Resets the specified property's value to its default value.
+ *
+ * @param property
+ * the property to reset
+ */
+ public void resetPropertyValue(Object str) {
+ if (str == null) {
+ return;
+ }
+ CSSStyleDeclaration declaration = getDeclarationNode();
+ if (declaration != null) {
+ declaration.removeProperty(str.toString());
+ }
+ }
+
+ /**
+ * Sets the named property to the given value.
+ *
+ * @param name
+ * the name of the property being set
+ * @param value
+ * the new value for the property
+ */
+ public void setPropertyValue(Object name, Object value) {
+ if (name == null) {
+ return;
+ }
+ String valueString = (value != null) ? value.toString() : null;
+ String nameString = name.toString();
+ CSSStyleDeclaration declaration = getDeclarationNode();
+ if (declaration != null) {
+ try {
+ if (valueString == null || valueString.length() <= 0) {
+ declaration.removeProperty(nameString);
+ } else {
+ declaration.setProperty(nameString, valueString, ""); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ String title = ResourceHandler.getString("Title.InvalidValue"); //$NON-NLS-1$
+ String message = ResourceHandler.getString("Message.InvalidValue"); //$NON-NLS-1$
+ MessageDialog.openWarning(window.getShell(), title, message);
+ }
+ }
+ }
+
+ private CSSStyleDeclaration getDeclarationNode() {
+ CSSStyleDeclaration declaration = null;
+
+ switch (fNode.getNodeType()) {
+ case ICSSNode.STYLEDECLITEM_NODE :
+ declaration = (CSSStyleDeclaration) fNode.getParentNode();
+ break;
+ case ICSSNode.STYLERULE_NODE :
+ case ICSSNode.FONTFACERULE_NODE :
+ case ICSSNode.PAGERULE_NODE :
+ declaration = (CSSStyleDeclaration) fNode.getFirstChild();
+ break;
+ case ICSSNode.STYLEDECLARATION_NODE :
+ declaration = (CSSStyleDeclaration) fNode;
+ break;
+ case ICSSNode.PRIMITIVEVALUE_NODE :
+ ICSSNode parent = fNode;
+ while (parent != null && !(parent instanceof CSSStyleDeclaration)) {
+ parent = parent.getParentNode();
+ }
+ if (parent != null) {
+ declaration = (CSSStyleDeclaration) parent;
+ }
+ break;
+ default :
+ break;
+ }
+
+ return declaration;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySourceAdapterFactory.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySourceAdapterFactory.java
new file mode 100644
index 0000000000..feed515d31
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySourceAdapterFactory.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.properties;
+
+import org.eclipse.wst.sse.core.AbstractAdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+
+
+
+//import com.ibm.sed.edit.xml.DOMPropertySource;
+public class CSSPropertySourceAdapterFactory extends AbstractAdapterFactory {
+ /**
+ * PropertySourceAdapterFactory constructor comment.
+ */
+ public CSSPropertySourceAdapterFactory() {
+ super();
+ }
+
+ /**
+ * PropertySourceAdapterFactory constructor comment.
+ *
+ * @param adapterKey
+ * java.lang.Object
+ * @param registerAdapters
+ * boolean
+ */
+ public CSSPropertySourceAdapterFactory(Object newAdapterKey, boolean newRegisterAdapters) {
+ super(newAdapterKey, newRegisterAdapters);
+ }
+
+ /**
+ * createAdapter method comment.
+ */
+ protected INodeAdapter createAdapter(INodeNotifier target) {
+ // at the moment, only one implementation exists
+ return new CSSPropertySource(target);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSTextPropertyDescriptor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSTextPropertyDescriptor.java
new file mode 100644
index 0000000000..4b6d0f2f1b
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSTextPropertyDescriptor.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.css.ui.views.properties;
+
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.util.CSSPathService;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+
+/**
+ */
+public class CSSTextPropertyDescriptor extends TextPropertyDescriptor {
+ private final ICSSNode fNode;
+
+ /**
+ * CSSTextPropertyDescriptor constructor comment.
+ *
+ * @param id
+ * java.lang.String
+ * @param displayName
+ * java.lang.String
+ */
+ public CSSTextPropertyDescriptor(String id, String displayName, ICSSNode node) {
+ super(id, displayName);
+ this.fNode = node;
+ }
+
+ public CSSTextPropertyDescriptor(String id, String displayName, ICSSNode node, String category) {
+ super(id, displayName);
+ this.fNode = node;
+ setCategory(category);
+ }
+
+ /**
+ * @return org.eclipse.jface.viewers.CellEditor
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
+ */
+ public CellEditor createPropertyEditor(Composite parent) {
+ ICSSModel model = fNode.getOwnerDocument().getModel();
+ if (model == null)
+ return null;
+ if (model.getStyleSheetType() == ICSSModel.EXTERNAL && findEditor(model) == null)
+ return null;
+ // check whether IFile is readonly to prohibit editing before
+ // validateEdit()
+ IStructuredModel structuredModel = model;
+ if (model.getStyleSheetType() != ICSSModel.EXTERNAL) {
+ structuredModel = ((XMLNode) model.getOwnerDOMNode()).getModel();
+ if (structuredModel == null)
+ return null;
+ }
+ IFile file = CSSPathService.location2File(structuredModel.getBaseLocation());
+ if (file == null || file.isReadOnly())
+ return null;
+
+ return super.createPropertyEditor(parent);
+ }
+
+ private static IEditorPart findEditor(ICSSModel model) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+ for (int i = 0; i < windows.length; i++) {
+ IWorkbenchPage[] pages = windows[i].getPages();
+ for (int j = 0; j < pages.length; j++) {
+ IEditorReference[] editors = pages[j].getEditorReferences();
+ for (int k = 0; k < editors.length; k++) {
+ IEditorPart editPart = editors[k].getEditor(false);
+ if (editPart != null) {
+ IEditorInput editorInput = editPart.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) editorInput).getFile();
+ if (file != null) {
+ //TODO Urgent needs to be fixed
+ // I think we need 'equals' (or 'equivalent'
+ // on model) for cases like this
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ if (plugin.getModelManager().calculateId(file).equals(model.getId())) {
+ return editPart;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/.classpath b/bundles/org.eclipse.wst.html.core/.classpath
new file mode 100644
index 0000000000..df094ee4a7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.html.core/.compatibility b/bundles/org.eclipse.wst.html.core/.compatibility
new file mode 100644
index 0000000000..8c1b1d39b9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004
+.project=9968
diff --git a/bundles/org.eclipse.wst.html.core/.cvsignore b/bundles/org.eclipse.wst.html.core/.cvsignore
new file mode 100644
index 0000000000..383b61c8dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/.cvsignore
@@ -0,0 +1,5 @@
+bin
+htmlmodel.jar
+temp.folder
+dev.properties
+build.xml
diff --git a/bundles/org.eclipse.wst.html.core/.options b/bundles/org.eclipse.wst.html.core/.options
new file mode 100644
index 0000000000..e66a59f041
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/.options
@@ -0,0 +1,2 @@
+org.eclipse.wst.html.core/debug=true
+org.eclipse.wst.html.core/debug/tracefilter= \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/.project b/bundles/org.eclipse.wst.html.core/.project
new file mode 100644
index 0000000000..13a9facdf9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.html.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.html.core/build.properties b/bundles/org.eclipse.wst.html.core/build.properties
new file mode 100644
index 0000000000..6c9636674a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+bin.includes = plugin.xml,\
+ *.jar,\
+ html.jar,\
+ .options,\
+ data/,\
+ plugin.properties
+src.includes = plugin.xml,\
+ build.xml,\
+ .options,\
+ data/,\
+ plugin.properties
+source.htmlmodel.jar = src/
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref.properties b/bundles/org.eclipse.wst.html.core/data/htmref.properties
new file mode 100644
index 0000000000..9cd460d81e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=A link if the href attribute is present, and the target for a link if the name attribute is present
+ABBRTagInfo=An abbreviation (for example, WWW, HTTP)
+ACRONYMTagInfo=An acronym (for example, SCUBA)
+ADDRESSTagInfo=Address information for the author of the page
+APPLETTagInfo=A Java applet
+AREATagInfo=Defines a client-side image map area
+BTagInfo=Displays contained text as bold
+BASETagInfo=The base URI for the page, to be used when calculating relative paths
+BASEFONTTagInfo=The base font size for the page
+BDOTagInfo=Overrides default bidirectional display. For use with bidirectional languages.
+BIGTagInfo=Displays contained text as large
+BGSOUNDTagInfo=Defines a sound file for the page. Not supported by W3C HTML 4.01.
+BLINKTagInfo=Displays text as blinking. Not supported by W3C HTML 4.01.
+BLOCKQUOTETagInfo=A long quotation
+BODYTagInfo=The document body. Contains all the content for the page.
+BRTagInfo=Forces a line break
+BUTTONTagInfo=Defines a push button
+CAPTIONTagInfo=Defines a table caption
+CENTERTagInfo=Displays contained text centered. Equivalent to DIV with align=center.
+CITETagInfo=A citation
+CODETagInfo=A computer code fragment
+COLTagInfo=A table column
+COLGROUPTagInfo=A group of table columns
+DDTagInfo=A definition or description in a definition or description list
+DELTagInfo=Displays text as deleted
+DFNTagInfo=A definition
+DIRTagInfo=A directory listing
+DIVTagInfo=A generic container, which can be used for defining language or style for the contents
+DLTagInfo=A definition or description list
+DTTagInfo=A term or subject in a definition or description list
+EMTagInfo=Displays text emphasized (generally italicized)
+EMBEDTagInfo=Defines an embedded plug-in. Not supported by W3C HTML 4.01.
+FIELDSETTagInfo=Defines a form control group
+FONTTagInfo=Displays text in the given font
+FORMTagInfo=Defines an interactive form
+FRAMETagInfo=Defines a frame within the current window
+FRAMESETTagInfo=Defines a frameset that divides the window into frames
+H1TagInfo=A top-level heading
+H2TagInfo=A second-level heading
+H3TagInfo=A third-level heading
+H4TagInfo=A fourth-level heading
+H5TagInfo=A fifth-level heading
+H6TagInfo=A sixth-level heading
+HEADTagInfo=Contains metadata and window title information for the document
+HRTagInfo=A horizontal rule
+HTMLTagInfo=The root element for the document.
+ITagInfo=Displays text as italic
+IFRAMETagInfo=Defines an inline subwindow
+IMGTagInfo=Displays the referenced image as embedded content
+INPUTTagInfo=Defines a form control for user input
+INSTagInfo=Defines inserted text
+ISINDEXTagInfo=Defines a single line prompt
+KBDTagInfo=Defines text to be entered by the user
+LABELTagInfo=Defines the label for a form field
+LEGENDTagInfo=Defines the label for a set of form fields
+LITagInfo=Defines a list item within a list
+LINKTagInfo=A media-independent link
+MAPTagInfo=Defines a client-side image map
+MARQUEETagInfo=Displays text as scrolling. Not supported by W3C HTML 4.01.
+MENUTagInfo=Defines a menu list
+METATagInfo=Defines metadata information for the document
+NOBRTagInfo=Overrides and prevents line breaks. Not supported by W3C HTML 4.01.
+NOFRAMESTagInfo=Provides information to display if the current browser does not support frames
+NOSCRIPTTagInfo=Provides information to display if the current browser does not support scripting
+OBJECTTagInfo=Defines a generic embedded object
+OLTagInfo=An ordered list
+OPTGROUPTagInfo=An option group
+OPTIONTagInfo=A selectable choice
+PTagInfo=A paragraph
+PARAMTagInfo=A named property value
+PRETagInfo=Preformatted text
+QTagInfo=A short inline quotation
+STagInfo=Display text in strike-through style
+SAMPTagInfo=Sample program output, scripts, etc. Displays in monospace font.
+SCRIPTTagInfo=Script statements
+SELECTTagInfo=An option selector
+SMALLTagInfo=Displays text as small
+SPANTagInfo=A generic container, which can be used for defining language or style for the contents
+STRIKETagInfo=Display text in strike-through style
+STRONGTagInfo=Displays text as strongly emphasized (generally bold)
+STYLETagInfo=Defines a style for the contained information
+SUBTagInfo=Display as subscript
+SUPTagInfo=Display as superscript
+TABLETagInfo=Defines a table
+TBODYTagInfo=The body of the table
+TDTagInfo=A cell within a table
+TEXTAREATagInfo=A multi-line text field
+TFOOTTagInfo=A table footer
+THTagInfo=A table header cell
+THEADTagInfo=A table header
+TITLETagInfo=The document title, displayed in the browser's title bar
+TRTagInfo=A table row
+TTTagInfo=Displays text in teletype or monospaced text style
+UTagInfo=Displays text as underlined
+ULTagInfo=An unordered list
+VARTagInfo=An instance of a variable or program argument
+WBRTagInfo=Allows a line break within <B>&lt;NOBR&gt;</B> tag. Not supported by W3C HTML 4.01.
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref.xml b/bundles/org.eclipse.wst.html.core/data/htmref.xml
new file mode 100644
index 0000000000..9a5b74c5ab
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref.xml
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<abstractGrammarAnnotations propertiesLocation="htmref" caseSensitive="false">
+ <annotation spec="A">
+ <property name="tagInfo">%ATagInfo</property>
+ </annotation>
+ <annotation spec="ABBR">
+ <property name="tagInfo">%ABBRTagInfo</property>
+ </annotation>
+ <annotation spec="ACRONYM">
+ <property name="tagInfo">%ACRONYMTagInfo</property>
+ </annotation>
+ <annotation spec="ADDRESS">
+ <property name="tagInfo">%ADDRESSTagInfo</property>
+ </annotation>
+ <annotation spec="APPLET">
+ <property name="tagInfo">%APPLETTagInfo</property>
+ </annotation>
+ <annotation spec="AREA">
+ <property name="tagInfo">%AREATagInfo</property>
+ </annotation>
+ <annotation spec="B">
+ <property name="tagInfo">%BTagInfo</property>
+ </annotation>
+ <annotation spec="BASE">
+ <property name="tagInfo">%BASETagInfo</property>
+ </annotation>
+ <annotation spec="BASEFONT">
+ <property name="tagInfo">%BASEFONTTagInfo</property>
+ </annotation>
+ <annotation spec="BDO">
+ <property name="tagInfo">%BDOTagInfo</property>
+ </annotation>
+ <annotation spec="BGSOUND">
+ <property name="tagInfo">%BGSOUNDTagInfo</property>
+ </annotation>
+ <annotation spec="BIG">
+ <property name="tagInfo">%BIGTagInfo</property>
+ </annotation>
+ <annotation spec="BLINK">
+ <property name="tagInfo">%BLINKTagInfo</property>
+ </annotation>
+ <annotation spec="BLOCKQUOTE">
+ <property name="tagInfo">%BLOCKQUOTETagInfo</property>
+ </annotation>
+ <annotation spec="BODY">
+ <property name="tagInfo">%BODYTagInfo</property>
+ </annotation>
+ <annotation spec="BR">
+ <property name="tagInfo">%BRTagInfo</property>
+ </annotation>
+ <annotation spec="BUTTON">
+ <property name="tagInfo">%BUTTONTagInfo</property>
+ </annotation>
+ <annotation spec="CAPTION">
+ <property name="tagInfo">%CAPTIONTagInfo</property>
+ </annotation>
+ <annotation spec="CENTER">
+ <property name="tagInfo">%CENTERTagInfo</property>
+ </annotation>
+ <annotation spec="CITE">
+ <property name="tagInfo">%CITETagInfo</property>
+ </annotation>
+ <annotation spec="CODE">
+ <property name="tagInfo">%CODETagInfo</property>
+ </annotation>
+ <annotation spec="COL">
+ <property name="tagInfo">%COLTagInfo</property>
+ </annotation>
+ <annotation spec="COLGROUP">
+ <property name="tagInfo">%COLGROUPTagInfo</property>
+ </annotation>
+ <annotation spec="DD">
+ <property name="tagInfo">%DDTagInfo</property>
+ </annotation>
+ <annotation spec="DEL">
+ <property name="tagInfo">%DELTagInfo</property>
+ </annotation>
+ <annotation spec="DFN">
+ <property name="tagInfo">%DFNTagInfo</property>
+ </annotation>
+ <annotation spec="DIR">
+ <property name="tagInfo">%DIRTagInfo</property>
+ </annotation>
+ <annotation spec="DIV">
+ <property name="tagInfo">%DIVTagInfo</property>
+ </annotation>
+ <annotation spec="DL">
+ <property name="tagInfo">%DLTagInfo</property>
+ </annotation>
+ <annotation spec="DT">
+ <property name="tagInfo">%DTTagInfo</property>
+ </annotation>
+ <annotation spec="EM">
+ <property name="tagInfo">%EMTagInfo</property>
+ </annotation>
+ <annotation spec="EMBED">
+ <property name="tagInfo">%EMBEDTagInfo</property>
+ </annotation>
+ <annotation spec="FIELDSET">
+ <property name="tagInfo">%FIELDSETTagInfo</property>
+ </annotation>
+ <annotation spec="FONT">
+ <property name="tagInfo">%FONTTagInfo</property>
+ </annotation>
+ <annotation spec="FORM">
+ <property name="tagInfo">%FORMTagInfo</property>
+ </annotation>
+ <annotation spec="FRAME">
+ <property name="tagInfo">%FRAMETagInfo</property>
+ </annotation>
+ <annotation spec="FRAMESET">
+ <property name="tagInfo">%FRAMESETTagInfo</property>
+ </annotation>
+ <annotation spec="H1">
+ <property name="tagInfo">%H1TagInfo</property>
+ </annotation>
+ <annotation spec="H2">
+ <property name="tagInfo">%H2TagInfo</property>
+ </annotation>
+ <annotation spec="H3">
+ <property name="tagInfo">%H3TagInfo</property>
+ </annotation>
+ <annotation spec="H4">
+ <property name="tagInfo">%H4TagInfo</property>
+ </annotation>
+ <annotation spec="H5">
+ <property name="tagInfo">%H5TagInfo</property>
+ </annotation>
+ <annotation spec="H6">
+ <property name="tagInfo">%H6TagInfo</property>
+ </annotation>
+ <annotation spec="HEAD">
+ <property name="tagInfo">%HEADTagInfo</property>
+ </annotation>
+ <annotation spec="HR">
+ <property name="tagInfo">%HRTagInfo</property>
+ </annotation>
+ <annotation spec="HTML">
+ <property name="tagInfo">%HTMLTagInfo</property>
+ </annotation>
+ <annotation spec="I">
+ <property name="tagInfo">%ITagInfo</property>
+ </annotation>
+ <annotation spec="IFRAME">
+ <property name="tagInfo">%IFRAMETagInfo</property>
+ </annotation>
+ <annotation spec="IMG">
+ <property name="tagInfo">%IMGTagInfo</property>
+ </annotation>
+ <annotation spec="INPUT">
+ <property name="tagInfo">%INPUTTagInfo</property>
+ </annotation>
+ <annotation spec="INS">
+ <property name="tagInfo">%INSTagInfo</property>
+ </annotation>
+ <annotation spec="ISINDEX">
+ <property name="tagInfo">%ISINDEXTagInfo</property>
+ </annotation>
+ <annotation spec="KBD">
+ <property name="tagInfo">%KBDTagInfo</property>
+ </annotation>
+ <annotation spec="LABEL">
+ <property name="tagInfo">%LABELTagInfo</property>
+ </annotation>
+ <annotation spec="LEGEND">
+ <property name="tagInfo">%LEGENDTagInfo</property>
+ </annotation>
+ <annotation spec="LI">
+ <property name="tagInfo">%LITagInfo</property>
+ </annotation>
+ <annotation spec="LINK">
+ <property name="tagInfo">%LINKTagInfo</property>
+ </annotation>
+ <annotation spec="MAP">
+ <property name="tagInfo">%MAPTagInfo</property>
+ </annotation>
+ <annotation spec="MARQUEE">
+ <property name="tagInfo">%MARQUEETagInfo</property>
+ </annotation>
+ <annotation spec="MENU">
+ <property name="tagInfo">%MENUTagInfo</property>
+ </annotation>
+ <annotation spec="META">
+ <property name="tagInfo">%METATagInfo</property>
+ </annotation>
+ <annotation spec="NOBR">
+ <property name="tagInfo">%NOBRTagInfo</property>
+ </annotation>
+ <annotation spec="NOFRAMES">
+ <property name="tagInfo">%NOFRAMESTagInfo</property>
+ </annotation>
+ <annotation spec="NOSCRIPT">
+ <property name="tagInfo">%NOSCRIPTTagInfo</property>
+ </annotation>
+ <annotation spec="OBJECT">
+ <property name="tagInfo">%OBJECTTagInfo</property>
+ </annotation>
+ <annotation spec="OL">
+ <property name="tagInfo">%OLTagInfo</property>
+ </annotation>
+ <annotation spec="OPTGROUP">
+ <property name="tagInfo">%OPTGROUPTagInfo</property>
+ </annotation>
+ <annotation spec="OPTION">
+ <property name="tagInfo">%OPTIONTagInfo</property>
+ </annotation>
+ <annotation spec="P">
+ <property name="tagInfo">%PTagInfo</property>
+ </annotation>
+ <annotation spec="PARAM">
+ <property name="tagInfo">%PARAMTagInfo</property>
+ </annotation>
+ <annotation spec="PRE">
+ <property name="tagInfo">%PRETagInfo</property>
+ </annotation>
+ <annotation spec="Q">
+ <property name="tagInfo">%QTagInfo</property>
+ </annotation>
+ <annotation spec="S">
+ <property name="tagInfo">%STagInfo</property>
+ </annotation>
+ <annotation spec="SAMP">
+ <property name="tagInfo">%SAMPTagInfo</property>
+ </annotation>
+ <annotation spec="SCRIPT">
+ <property name="tagInfo">%SCRIPTTagInfo</property>
+ </annotation>
+ <annotation spec="SELECT">
+ <property name="tagInfo">%SELECTTagInfo</property>
+ </annotation>
+ <annotation spec="SMALL">
+ <property name="tagInfo">%SMALLTagInfo</property>
+ </annotation>
+ <annotation spec="SPAN">
+ <property name="tagInfo">%SPANTagInfo</property>
+ </annotation>
+ <annotation spec="STRIKE">
+ <property name="tagInfo">%STRIKETagInfo</property>
+ </annotation>
+ <annotation spec="STRONG">
+ <property name="tagInfo">%STRONGTagInfo</property>
+ </annotation>
+ <annotation spec="STYLE">
+ <property name="tagInfo">%STYLETagInfo</property>
+ </annotation>
+ <annotation spec="SUB">
+ <property name="tagInfo">%SUBTagInfo</property>
+ </annotation>
+ <annotation spec="SUP">
+ <property name="tagInfo">%SUPTagInfo</property>
+ </annotation>
+ <annotation spec="TABLE">
+ <property name="tagInfo">%TABLETagInfo</property>
+ </annotation>
+ <annotation spec="TBODY">
+ <property name="tagInfo">%TBODYTagInfo</property>
+ </annotation>
+ <annotation spec="TD">
+ <property name="tagInfo">%TDTagInfo</property>
+ </annotation>
+ <annotation spec="TEXTAREA">
+ <property name="tagInfo">%TEXTAREATagInfo</property>
+ </annotation>
+ <annotation spec="TFOOT">
+ <property name="tagInfo">%TFOOTTagInfo</property>
+ </annotation>
+ <annotation spec="TH">
+ <property name="tagInfo">%THTagInfo</property>
+ </annotation>
+ <annotation spec="THEAD">
+ <property name="tagInfo">%THEADTagInfo</property>
+ </annotation>
+ <annotation spec="TITLE">
+ <property name="tagInfo">%TITLETagInfo</property>
+ </annotation>
+ <annotation spec="TR">
+ <property name="tagInfo">%TRTagInfo</property>
+ </annotation>
+ <annotation spec="TT">
+ <property name="tagInfo">%TTTagInfo</property>
+ </annotation>
+ <annotation spec="U">
+ <property name="tagInfo">%UTagInfo</property>
+ </annotation>
+ <annotation spec="UL">
+ <property name="tagInfo">%ULTagInfo</property>
+ </annotation>
+ <annotation spec="VAR">
+ <property name="tagInfo">%VARTagInfo</property>
+ </annotation>
+ <annotation spec="WBR">
+ <property name="tagInfo">%WBRTagInfo</property>
+ </annotation>
+</abstractGrammarAnnotations> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_de.properties b/bundles/org.eclipse.wst.html.core/data/htmref_de.properties
new file mode 100644
index 0000000000..56cbd6a57e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_de.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=Ein Link, falls das Attribut 'href' vorhanden ist, bzw. das Ziel f\u00fcr einen Link, wenn das Attribut 'name' vorhanden ist
+ABBRTagInfo=Abk\u00fcrzung (z. B. WWW, HTTP)
+ACRONYMTagInfo=Akronym (z. B. SCUBA)
+ADDRESSTagInfo=Adressinformationen f\u00fcr den Autor der Seite
+APPLETTagInfo=Java-Applet
+AREATagInfo=Definiert einen clientseitigen Imagezuordnungsbereich
+BTagInfo=Zeigt enthaltenen Text in Fettformatierung an
+BASETagInfo=Basis-URI f\u00fcr die Seite, wird bei der Berechnung relativer Pfade verwendet
+BASEFONTTagInfo=Basisschriftartgr\u00f6\u00dfe f\u00fcr die Seite
+BDOTagInfo=\u00dcberschreibt Standardanzeige im Bidirektionalformat, wird mit bidirektionalen Sprachen (BIDI-Sprachen) verwendet
+BIGTagInfo=Zeigt enthaltenen Text in gro\u00dfer Schrift an
+BGSOUNDTagInfo=Definiert eine Audiodatei f\u00fcr die Seite. Wird durch W3C HTML 4.01 nicht unterst\u00fctzt.
+BLINKTagInfo=Zeigt Text blinkend an. Wird durch W3C HTML 4.01 nicht unterst\u00fctzt.
+BLOCKQUOTETagInfo=Langes Zitat
+BODYTagInfo=Dokumenthauptteil, der den gesamten Inhalt f\u00fcr die Seite enth\u00e4lt
+BRTagInfo=Erzwingt einen Zeilenumbruch
+BUTTONTagInfo=Definiert eine Schaltfl\u00e4che
+CAPTIONTagInfo=Definiert eine Tabellen\u00fcberschrift
+CENTERTagInfo=Zeigt enthaltenen Text in zentriert an. Ist \u00e4quivalent zu DIV mit 'align=center'.
+CITETagInfo=Zitat
+CODETagInfo=Computer-Codefragment
+COLTagInfo=Tabellenspalte
+COLGROUPTagInfo=Gruppe von Tabellenspalten
+DDTagInfo=Definition oder Beschreibung in einer Definitions- oder Beschreibungsliste
+DELTagInfo=Zeigt Text als gel\u00f6scht an
+DFNTagInfo=Definition
+DIRTagInfo=Verzeichnisliste
+DIVTagInfo=Generischer Container, der zum Definieren von Sprache oder Darstellung f\u00fcr den Inhalt verwendet werden kann
+DLTagInfo=Definitions- oder Beschreibungsliste
+DTTagInfo=Begriff oder Thema in einer Definitions- oder Beschreibungsliste
+EMTagInfo=Zeigt Text hervorgehoben an (normalerweise kursiv)
+EMBEDTagInfo=Definiert ein eingebettetes Plug-in. Wird durch W3C HTML 4.01 nicht unterst\u00fctzt.
+FIELDSETTagInfo=Definiert eine Gruppe von Formularsteuerelementen
+FONTTagInfo=Zeigt Text in der angegebenen Schriftart an
+FORMTagInfo=Definiert ein interaktives Formular
+FRAMETagInfo=Definiert einen Frame im aktuellen Fenster
+FRAMESETTagInfo=Definiert ein Frameset, das das Fenster in zwei Frames unterteilt
+H1TagInfo=\u00dcberschrift der h\u00f6chsten Ebene
+H2TagInfo=\u00dcberschrift der zweiten Ebene
+H3TagInfo=\u00dcberschrift der dritten Ebene
+H4TagInfo=\u00dcberschrift der vierten Ebene
+H5TagInfo=\u00dcberschrift der f\u00fcnften Ebene
+H6TagInfo=\u00dcberschrift der sechsten Ebene
+HEADTagInfo=Enth\u00e4lt Metadaten und Fenstertitelinformationen f\u00fcr das Dokument
+HRTagInfo=Horizontale Skala (Lineal)
+HTMLTagInfo=Stammelement f\u00fcr das Dokument
+ITagInfo=Zeigt Text kursiv an.
+IFRAMETagInfo=Definiert ein Inline-Unterfenster
+IMGTagInfo=Zeigt das Image, auf das verwiesen wird, als eingebetteten Inhalt an
+INPUTTagInfo=Definiert ein Formularsteuerelement f\u00fcr die Benutzereingabe
+INSTagInfo=Definiert eingef\u00fcgten Text
+ISINDEXTagInfo=Definiert eine einzeilige Eingabeaufforderung
+KBDTagInfo=Definiert Text, der durch den Benutzer eingegeben werden muss
+LABELTagInfo=Definiert die Beschriftung f\u00fcr ein Formularfeld
+LEGENDTagInfo=Definiert die Beschriftung f\u00fcr eine Gruppe von Formularfeldern
+LITagInfo=Definiert einen Listeneintrag in einer Liste
+LINKTagInfo=Datentr\u00e4gerunabh\u00e4ngiger Link
+MAPTagInfo=Definiert eine clientseitige Imagezuordnung
+MARQUEETagInfo=Zeigt Text verschiebbar an. Wird durch W3C HTML 4.01 nicht unterst\u00fctzt.
+MENUTagInfo=Definiert eine Men\u00fcliste
+METATagInfo=Definiert Metadateninformationen f\u00fcr das Dokument
+NOBRTagInfo=\u00dcberschreibt und verhindert Zeilenumbr\u00fcche. Wird durch W3C HTML 4.01 nicht unterst\u00fctzt.
+NOFRAMESTagInfo=Stellt Informationen bereit, die angezeigt werden sollen, wenn der aktuelle Browser keine Frames unterst\u00fctzt
+NOSCRIPTTagInfo=Stellt Informationen bereit, die angezeigt werden sollen, wenn der aktuelle Browser keine Scripterstellung unterst\u00fctzt
+OBJECTTagInfo=Definiert ein generisches eingebettetes Objekt
+OLTagInfo=Sortierte Liste
+OPTGROUPTagInfo=Optionsgruppe
+OPTIONTagInfo=Ausw\u00e4hlbare Option
+PTagInfo=Absatz
+PARAMTagInfo=Benannter Eigenschaftswert
+PRETagInfo=Vorformatierter Text
+QTagInfo=Kurzes Inline-Zitat
+STagInfo=Zeigt Text in durchgestrichener Darstellung an
+SAMPTagInfo=Beispielprogrammausgabe, Skripts usw., wird in Monospaceschrift angezeigt
+SCRIPTTagInfo=Scriptanweisungen
+SELECTTagInfo=Optionsselektor
+SMALLTagInfo=Zeigt Text in kleiner Schrift an
+SPANTagInfo=Generischer Container, der zum Definieren von Sprache oder Darstellung f\u00fcr den Inhalt verwendet werden kann
+STRIKETagInfo=Zeigt Text in durchgestrichener Darstellung an
+STRONGTagInfo=Zeigt Text stark hervorgehoben an (normalerweise fett)
+STYLETagInfo=Definiert eine Darstellung f\u00fcr die enthaltenen Informationen
+SUBTagInfo=Zeigt Zeichen tiefgestellt an
+SUPTagInfo=Zeigt Zeichen hochgestellt an
+TABLETagInfo=Definiert eine Tabelle
+TBODYTagInfo=Hauptteil der Tabelle
+TDTagInfo=Zelle in einer Tabelle
+TEXTAREATagInfo=Mehrzeiliges Textfeld
+TFOOTTagInfo=Tabellenfu\u00dfzeile
+THTagInfo=Tabellen\u00fcberschriftszelle
+THEADTagInfo=Tabellen\u00fcberschrift
+TITLETagInfo=Dokumenttitel, der in der Titelleiste des Browsers angezeigt wird
+TRTagInfo=Tabellenzeile
+TTTagInfo=Zeigt Text in Teletype-Schriftart oder Monospaceschrift an
+UTagInfo=Zeigt Text unterstrichen an
+ULTagInfo=Ungeordnete Liste
+VARTagInfo=Exemplar einer Variablen oder eines Programmarguments
+WBRTagInfo=L\u00e4sst einen Zeilenumbruch in Tags <B>&lt;NOBR&gt;</B> zu. Wird durch W3C HTML 4.01 nicht unterst\u00fctzt.
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_es.properties b/bundles/org.eclipse.wst.html.core/data/htmref_es.properties
new file mode 100644
index 0000000000..2166de903b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_es.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=Enlace si est\u00e1 presente el atributo href, y destino de un enlace si est\u00e1 presente el atributo name
+ABBRTagInfo=Abreviatura (por ejemplo, WWW, HTTP)
+ACRONYMTagInfo=Acr\u00f3nimo (por ejemplo, SCUBA)
+ADDRESSTagInfo=Informaci\u00f3n de direcci\u00f3n para el autor de la p\u00e1gina
+APPLETTagInfo=Applet Java
+AREATagInfo=Define un \u00e1rea de mapa de imagen del lado del cliente
+BTagInfo=Visualiza texto contenido en negrita
+BASETagInfo=URI base de la p\u00e1gina, que debe utilizarse al calcular v\u00edas de acceso relativas
+BASEFONTTagInfo=Tama\u00f1o de font base de la p\u00e1gina
+BDOTagInfo=Altera temporalmente la visualizaci\u00f3n bidireccional predeterminada. Para utilizarlo con lenguajes bidireccionales.
+BIGTagInfo=Visualiza texto contenido en forma extensa
+BGSOUNDTagInfo=Define un archivo de sonido para la p\u00e1gina. No soportado en W3C HTML 4.01.
+BLINKTagInfo=Visualiza texto parpadeante. No soportado en W3C HTML 4.01.
+BLOCKQUOTETagInfo=Cita larga
+BODYTagInfo=Cuerpo del documento. Contiene todos los elementos de la p\u00e1gina.
+BRTagInfo=Fuerza un salto de l\u00ednea
+BUTTONTagInfo=Define un pulsador
+CAPTIONTagInfo=Define un t\u00edtulo de tabla
+CENTERTagInfo=Visualiza texto centrado. Equivalente a DIV con align=center.
+CITETagInfo=Cita
+CODETagInfo=Fragmento de c\u00f3digo de sistema
+COLTagInfo=Columna de tabla
+COLGROUPTagInfo=Grupo de columnas de tabla
+DDTagInfo=Definici\u00f3n o descripci\u00f3n de una lista de definiciones o descripciones
+DELTagInfo=Visualiza texto suprimido
+DFNTagInfo=Definici\u00f3n
+DIRTagInfo=Lista de directorios
+DIVTagInfo=Contenedor gen\u00e9rico, que puede utilizarse para definir el idioma o el estilo del contenido
+DLTagInfo=Lista de definiciones o descripciones
+DTTagInfo=T\u00e9rmino o tema de una lista de definiciones o descripciones
+EMTagInfo=Visualiza texto enfatizado (generalmente en cursiva)
+EMBEDTagInfo=Define un conector incorporado. No soportado en W3C HTML 4.01.
+FIELDSETTagInfo=Define un grupo de control de formularios
+FONTTagInfo=Visualiza texto en el font dado
+FORMTagInfo=Define un formulario interactivo
+FRAMETagInfo=Define un marco dentro de la ventana actual
+FRAMESETTagInfo=Define un conjunto de marcos que divide la ventana en marcos
+H1TagInfo=Cabecera de alto nivel
+H2TagInfo=Cabecera de segundo nivel
+H3TagInfo=Cabecera de tercer nivel
+H4TagInfo=Cabecera de cuarto nivel
+H5TagInfo=Cabecera de quinto nivel
+H6TagInfo=Cabecera de sexto nivel
+HEADTagInfo=Contiene metadatos e informaci\u00f3n de t\u00edtulo de ventanas para el documento
+HRTagInfo=Regla horizontal
+HTMLTagInfo=Elemento ra\u00edz para el documento
+ITagInfo=Visualiza texto en cursiva
+IFRAMETagInfo=Define una subventana incorporada
+IMGTagInfo=Visualiza la imagen a la que se hace referencia en forma de contenido intercalado
+INPUTTagInfo=Define un control de formulario para la entrada del usuario
+INSTagInfo=Define texto insertado
+ISINDEXTagInfo=Define una solicitud de una sola l\u00ednea
+KBDTagInfo=Define texto que el usuario debe especificar
+LABELTagInfo=Define la etiqueta de un campo de formulario
+LEGENDTagInfo=Define la etiqueta de un conjunto de campos de formulario
+LITagInfo=Define un elemento de lista de una lista
+LINKTagInfo=Enlace independiente de medios
+MAPTagInfo=Define un mapa de imagen del lado del cliente
+MARQUEETagInfo=Visualiza texto en forma desplazable. No soportado en W3C HTML 4.01.
+MENUTagInfo=Define una lista de men\u00fas
+METATagInfo=Define informaci\u00f3n de metadatos para el documento
+NOBRTagInfo=Altera temporalmente e impide los saltos de l\u00ednea. No soportado en W3C HTML 4.01.
+NOFRAMESTagInfo=Proporciona informaci\u00f3n de visualizaci\u00f3n si el navegador actual no da soporte a marcos.
+NOSCRIPTTagInfo=Proporciona informaci\u00f3n de visualizaci\u00f3n si el navegador actual no da soporte a scripts.
+OBJECTTagInfo=Define un objeto gen\u00e9rico incorporado
+OLTagInfo=Lista ordenada
+OPTGROUPTagInfo=Grupo de opciones
+OPTIONTagInfo=Opci\u00f3n seleccionable
+PTagInfo=P\u00e1rrafo
+PARAMTagInfo=Valor de propiedad con nombre
+PRETagInfo=Texto preformateado
+QTagInfo=Cita corta incorporada
+STagInfo=Visualiza texto en estilo tachado
+SAMPTagInfo=Salida de programa de ejemplo, scripts, etc. Se visualiza en font monoespacio.
+SCRIPTTagInfo=Sentencias de script
+SELECTTagInfo=Selector de opciones
+SMALLTagInfo=Visualiza texto en forma reducida
+SPANTagInfo=Contenedor gen\u00e9rico, que puede utilizarse para definir el idioma o el estilo del contenido
+STRIKETagInfo=Visualiza texto en estilo tachado
+STRONGTagInfo=Visualiza texto muy enfatizado (generalmente en negrita)
+STYLETagInfo=Define un estilo para la informaci\u00f3n que contiene
+SUBTagInfo=Visualizar como subscript
+SUPTagInfo=Visualizar como superscript
+TABLETagInfo=Define una tabla
+TBODYTagInfo=Cuerpo de la tabla
+TDTagInfo=Casilla de la tabla
+TEXTAREATagInfo=Campo de texto multil\u00ednea
+TFOOTTagInfo=Pie de de p\u00e1gina de tabla
+THTagInfo=Casilla de cabecera de tabla
+THEADTagInfo=Cabecera de tabla
+TITLETagInfo=T\u00edtulo del documento, visualizado en la barra de t\u00edtulo del navegador
+TRTagInfo=Fila de tabla
+TTTagInfo=Visualiza texto en estilo de texto teletipo o monoespacio
+UTagInfo=Visualiza texto subrayado
+ULTagInfo=Lista desordenada
+VARTagInfo=Instancia de una variable o argumento de programa
+WBRTagInfo=Permite un salto de l\u00ednea dentro del c\u00f3digo <B>&lt;NOBR&gt;</B>. No soportado en W3C HTML 4.01.
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_fr.properties b/bundles/org.eclipse.wst.html.core/data/htmref_fr.properties
new file mode 100644
index 0000000000..b8817bb94a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_fr.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=Lien si l'attribut "href" est indiqu\u00e9. Cible d'un lien si l'attribut "name" est indiqu\u00e9
+ABBRTagInfo=Abr\u00e9viation (par exemple, WWW, HTTP)
+ACRONYMTagInfo=Acronyme (par exemple, SCUBA)
+ADDRESSTagInfo=Informations relatives aux adresses de l'auteur de la page
+APPLETTagInfo=Applet Java
+AREATagInfo=D\u00e9finit la zone d'une image hypertexte c\u00f4t\u00e9 client
+BTagInfo=Affiche en gras le texte indiqu\u00e9
+BASETagInfo=URI de base de la page \u00e0 utiliser lors du calcul des chemins relatifs
+BASEFONTTagInfo=Taille de base de la police dans la page
+BDOTagInfo=Remplace l'affichage bidirectionnel par d\u00e9faut. S'applique aux langues bidirectionnelles
+BIGTagInfo=Affiche le texte en gros caract\u00e8res
+BGSOUNDTagInfo=D\u00e9finit un fichier son pour la page. Pas pris en charge par W3C HTML 4.0.1
+BLINKTagInfo=Affiche un texte qui clignote. Pas pris en charge par W3C HTML 4.0.1
+BLOCKQUOTETagInfo=Longue citation
+BODYTagInfo=Corps du document. Inclut tout le contenu de la page
+BRTagInfo=Force un retour \u00e0 la ligne
+BUTTONTagInfo=D\u00e9finit un bouton de fonction
+CAPTIONTagInfo=D\u00e9finit la l\u00e9gende d'un tableau
+CENTERTagInfo=Centre le texte indiqu\u00e9. Correspond \u00e0 DIV avec align=center
+CITETagInfo=Citation
+CODETagInfo=Fragment de code de l'ordinateur
+COLTagInfo=Colonne d'un tableau
+COLGROUPTagInfo=Groupe de colonnes d'un tableau
+DDTagInfo=D\u00e9finition ou description dans une liste de d\u00e9finitions ou de descriptions
+DELTagInfo=Affiche le texte comme \u00e9tant supprim\u00e9
+DFNTagInfo=D\u00e9finition
+DIRTagInfo=Liste de r\u00e9pertoires
+DIVTagInfo=Conteneur g\u00e9n\u00e9rique permettant de d\u00e9finir la langue ou le style du contenu
+DLTagInfo=Liste de d\u00e9finitions ou de descriptions
+DTTagInfo=Terme ou sujet dans une liste de d\u00e9finitions ou de descriptions
+EMTagInfo=Met le texte en \u00e9vidence (en g\u00e9n\u00e9ral en italique)
+EMBEDTagInfo=D\u00e9finit un plug-in imbriqu\u00e9. Pas pris en charge par W3C HTML 4.0.1
+FIELDSETTagInfo=D\u00e9finit un groupe de contr\u00f4le du formulaire
+FONTTagInfo=Affiche le texte dans la police indiqu\u00e9e
+FORMTagInfo=D\u00e9finit un formulaire interactif
+FRAMETagInfo=D\u00e9finit un cadre dans la fen\u00eatre en cours
+FRAMESETTagInfo=D\u00e9finit un ensemble de cadres qui divisent la fen\u00eatre en plusieurs cadres
+H1TagInfo=Titre de niveau sup\u00e9rieur
+H2TagInfo=Titre de deuxi\u00e8me niveau
+H3TagInfo=Titre de troisi\u00e8me niveau
+H4TagInfo=Titre de quatri\u00e8me niveau
+H5TagInfo=Titre de cinqui\u00e8me niveau
+H6TagInfo=Titre de sixi\u00e8me niveau
+HEADTagInfo=Contient des informations sur les m\u00e9tadonn\u00e9es et le titre de la fen\u00eatre d'un document
+HRTagInfo=R\u00e8gle horizontale
+HTMLTagInfo=El\u00e9ment racine du document
+ITagInfo=Affiche le texte en italique
+IFRAMETagInfo=D\u00e9finit une sous-fen\u00eatre int\u00e9gr\u00e9e
+IMGTagInfo=Affiche l'image r\u00e9f\u00e9renc\u00e9e sous la forme d'un contenu imbriqu\u00e9
+INPUTTagInfo=D\u00e9finit un contr\u00f4le de formulaire pour les donn\u00e9es entr\u00e9es par l'utilisateur
+INSTagInfo=D\u00e9finit le texte ins\u00e9r\u00e9
+ISINDEXTagInfo=D\u00e9finit un message d'une seule ligne
+KBDTagInfo=D\u00e9finit le texte que l'utilisateur doit entrer
+LABELTagInfo=D\u00e9finit le libell\u00e9 d'une zone du formulaire
+LEGENDTagInfo=D\u00e9finit le libell\u00e9 d'un ensemble de zones du formulaire
+LITagInfo=D\u00e9finit un \u00e9l\u00e9ment dans une liste
+LINKTagInfo=Lien ind\u00e9pendant d'un support
+MAPTagInfo=D\u00e9finit une image hypertexte c\u00f4t\u00e9 client
+MARQUEETagInfo=Affiche un texte qui d\u00e9file. Pas pris en charge par W3C HTML 4.0.1
+MENUTagInfo=D\u00e9finit une liste de type menu
+METATagInfo=D\u00e9finit des informations sur les m\u00e9tadonn\u00e9es du document
+NOBRTagInfo=Remplace et emp\u00eache les retours \u00e0 la ligne. Pas pris en charge par W3C HTML 4.0.1
+NOFRAMESTagInfo=Fournit les informations \u00e0 afficher si le navigateur en cours ne prend pas en charge les cadres
+NOSCRIPTTagInfo=Fournit les informations \u00e0 afficher si le navigateur en cours ne prend pas en charge le scriptage
+OBJECTTagInfo=D\u00e9finit un objet imbriqu\u00e9 g\u00e9n\u00e9rique
+OLTagInfo=Liste num\u00e9rot\u00e9e
+OPTGROUPTagInfo=Groupe d'options
+OPTIONTagInfo=Option disponible pour effectuer une s\u00e9lection
+PTagInfo=Paragraphe
+PARAMTagInfo=Valeur de la propri\u00e9t\u00e9 indiqu\u00e9e
+PRETagInfo=Texte pr\u00e9format\u00e9
+QTagInfo=Citation courte et ins\u00e9r\u00e9e
+STagInfo=Affiche un texte barr\u00e9
+SAMPTagInfo=Exemple de donn\u00e9es g\u00e9n\u00e9r\u00e9es par un programme, scripts, etc. Affiche les donn\u00e9es dans une police \u00e0 ch\u00e2sse fixe
+SCRIPTTagInfo=Instructions du script
+SELECTTagInfo=Fonction de s\u00e9lection d'options
+SMALLTagInfo=Affiche le texte en petits caract\u00e8res
+SPANTagInfo=Conteneur g\u00e9n\u00e9rique permettant de d\u00e9finir la langue ou le style du contenu
+STRIKETagInfo=Affiche un texte barr\u00e9
+STRONGTagInfo=Met le texte en \u00e9vidence (en g\u00e9n\u00e9ral en gras)
+STYLETagInfo=D\u00e9finit un style pour les informations indiqu\u00e9es
+SUBTagInfo=Affiche les donn\u00e9es sous la forme d'un indice
+SUPTagInfo=Affiche les donn\u00e9es sous la forme d'un exposant
+TABLETagInfo=D\u00e9finit un tableau
+TBODYTagInfo=Corps d'un tableau
+TDTagInfo=Cellule d'un tableau
+TEXTAREATagInfo=Zone de texte comportant plusieurs lignes
+TFOOTTagInfo=Pied de page d'un tableau
+THTagInfo=Cellule d'en-t\u00eate d'un tableau
+THEADTagInfo=En-t\u00eate d'un tableau
+TITLETagInfo=Titre du document affich\u00e9 dans la barre de titre du navigateur
+TRTagInfo=Ligne d'un tableau
+TTTagInfo=Affiche le texte en mode t\u00e9l\u00e9type ou avec une police \u00e0 ch\u00e2sse fixe
+UTagInfo=Souligne le texte
+ULTagInfo=Liste non num\u00e9rot\u00e9e
+VARTagInfo=Instance d'une variable ou d'un argument de programme
+WBRTagInfo=Permet un retour \u00e0 la ligne \u00e0 l'int\u00e9rieur de la balise <B>&lt;NOBR&gt;</B>. Pas pris en charge par W3C HTML 4.0.1
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_it.properties b/bundles/org.eclipse.wst.html.core/data/htmref_it.properties
new file mode 100644
index 0000000000..6e6e0da763
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_it.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=Collegamento, se \u00e8 presente l'attributo href, e destinazione per il collegamento, se \u00e8 presente l'attributo nome
+ABBRTagInfo=Abbreviazione (ad esempio, WWW, HTTP)
+ACRONYMTagInfo=Acronimo (ad esempio, SCUBA)
+ADDRESSTagInfo=Informazioni relative all'indirizzo dell'autore della pagina
+APPLETTagInfo=Applet Java
+AREATagInfo=Definisce un'area di mappe immagini sul lato client
+BTagInfo=Visualizza il testo contenuto come grassetto
+BASETagInfo=URI di base della pagina, da utilizzare durante il calcolo dei percorsi relativi
+BASEFONTTagInfo=Dimensione di base del tipo di carattere della pagina
+BDOTagInfo=Sostituisce la visualizzazione bidirezionale predefinita. Per l'utilizzo con linguaggi bidirezionali.
+BIGTagInfo=Visualizza il testo contenuto come grande
+BGSOUNDTagInfo=Definisce un file audio della pagina. Non supportato da W3C HTML 4.01.
+BLINKTagInfo=Visualizza il testo come lampeggiante. Non supportato da W3C HTML 4.01.
+BLOCKQUOTETagInfo=Lunga citazione
+BODYTagInfo=Corpo del documento. Racchiude tutto il contenuto della pagina.
+BRTagInfo=Determina un'interruzione di riga
+BUTTONTagInfo=Definisce un pulsante di comando
+CAPTIONTagInfo=Definisce la didascalia di una tabella
+CENTERTagInfo=Visualizza il testo contenuto come centrato. Equivalente a DIV con align=center.
+CITETagInfo=Citazione
+CODETagInfo=Frammento di codice del computer
+COLTagInfo=Colonna di tabella
+COLGROUPTagInfo=Gruppo di colonne di tabella
+DDTagInfo=Definizione o descrizione in un'elenco di definizioni o descrizioni
+DELTagInfo=Visualizza il testo come eliminato
+DFNTagInfo=Definizione
+DIRTagInfo=Elenco di directory
+DIVTagInfo=Contenitore generico, che pu\u00f2 essere utilizzato per la definizione del linguaggio o dello stile del contenuto
+DLTagInfo=Elenco di definizioni o descrizioni
+DTTagInfo=Termine o argomento in un elenco di definizioni o descrizioni
+EMTagInfo=Visualizza il testo evidenziato (in genere in corsivo)
+EMBEDTagInfo=Definisce un plugin incorporato. Non supportato da W3C HTML 4.01.
+FIELDSETTagInfo=Definisce un gruppo di controllo modulo
+FONTTagInfo=Visualizza il testo nel tipo di carattere dato
+FORMTagInfo=Definisce un form interattivo
+FRAMETagInfo=Definisce un frame all'interni della finestra corrente
+FRAMESETTagInfo=Definisce un frameset che divide la finestra in frame
+H1TagInfo=Intestazione di primo livello
+H2TagInfo=Intestazione di secondo livello
+H3TagInfo=Intestazione di terzo livello
+H4TagInfo=Intestazione di quarto livello
+H5TagInfo=Intestazione di quinto livello
+H6TagInfo=Intestazione di sesto livello
+HEADTagInfo=Contiene metadati e informazioni sul titolo della finestra del documento
+HRTagInfo=Riga orizzontale
+HTMLTagInfo=Elemento principale del documento.
+ITagInfo=Visualizza il testo come corsivo
+IFRAMETagInfo=Definisce una finestra secondaria incorporata
+IMGTagInfo=Visualizza l'immagine di riferimento come contenuto incorporato
+INPUTTagInfo=Definisce un controllo modulo per l'input dell'utente
+INSTagInfo=Definisce un testo inserito
+ISINDEXTagInfo=Definisce un prompt a riga singola
+KBDTagInfo=Definisce il testo che deve essere immesso dall'utente
+LABELTagInfo=Definisce l'etichetta per un campo modulo
+LEGENDTagInfo=Definisce l'etichetta per un insieme di campi modulo
+LITagInfo=Definisce una voce di elenco all'interno di un elenco
+LINKTagInfo=Collegamento indipendente dal supporto
+MAPTagInfo=Definisce una mappa immagini sul lato client
+MARQUEETagInfo=Visualizza il testo in scorrimento. Non supportato da W3C HTML 4.01.
+MENUTagInfo=Definisce un elenco di menu
+METATagInfo=Definisce le informazioni sui metadati del documento
+NOBRTagInfo=Sostituisce ed evita le interruzioni di riga. Non supportato da W3C HTML 4.01.
+NOFRAMESTagInfo=Fornisce informazioni per visualizzare se il browser corrente non supporta frame
+NOSCRIPTTagInfo=Fornisce informazioni per visualizzare se il browser corrente non supporta script
+OBJECTTagInfo=Definisce un oggetto incorporato generico
+OLTagInfo=Elenco ordinato
+OPTGROUPTagInfo=Gruppo di opzioni
+OPTIONTagInfo=Opzione selezionabile
+PTagInfo=Paragrafo
+PARAMTagInfo=Valore propriet\u00e0 denominata
+PRETagInfo=Testo preformattato
+QTagInfo=Breve citazione incorporata
+STagInfo=Visualizza il testo in stile barrato
+SAMPTagInfo=Output di programmi di esempio, script e cos\u00ec via. Viene visualizzato in un tipo di carattere monospazio.
+SCRIPTTagInfo=Istruzioni di script
+SELECTTagInfo=Selettore di opzioni
+SMALLTagInfo=Visualizza il testo come piccolo
+SPANTagInfo=Contenitore generico, che pu\u00f2 essere utilizzato per la definizione del linguaggio o dello stile del contenuto
+STRIKETagInfo=Visualizza il testo in stile barrato
+STRONGTagInfo=Visualizza il testo evidenziato in maniera netta (in genere in grassetto)
+STYLETagInfo=Definisce uno stile per le informazioni contenute
+SUBTagInfo=Visualizza come pedice
+SUPTagInfo=Visualizza come apice
+TABLETagInfo=Definisce una tabella
+TBODYTagInfo=Corpo della tabella
+TDTagInfo=Cella all'interno di una tabella
+TEXTAREATagInfo=Campo di testo a pi\u00f9 righe
+TFOOTTagInfo=Pi\u00e8 di pagina tabella
+THTagInfo=Cella di intestazione di una tabella
+THEADTagInfo=Intestazione tabella
+TITLETagInfo=Titolo del documento, visualizzato nella barra del titolo del browser
+TRTagInfo=Riga di tabella
+TTTagInfo=Visualizza il testo in stile testo telescrivente o monospazio
+UTagInfo=Visualizza il testo come sottolineato
+ULTagInfo=Elenco non ordinato
+VARTagInfo=Istanza di una variabile o di un argomento del programma
+WBRTagInfo=Consente un'interruzione di riga all'interno del tag <B>&lt;NOBR&gt;</B>. Non supportato da W3C HTML 4.01.
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_ja.properties b/bundles/org.eclipse.wst.html.core/data/htmref_ja.properties
new file mode 100644
index 0000000000..b997445907
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_ja.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=href \u5c5e\u6027\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306f\u30ea\u30f3\u30af\u3001\u304a\u3088\u3073 name \u5c5e\u6027\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306f\u30ea\u30f3\u30af\u306e\u30bf\u30fc\u30b2\u30c3\u30c8
+ABBRTagInfo=\u7701\u7565\u5f62 (\u305f\u3068\u3048\u3070 WWW\u3001HTTP \u306a\u3069)
+ACRONYMTagInfo=\u982d\u5b57\u8a9e (\u305f\u3068\u3048\u3070 SCUBA \u306a\u3069)
+ADDRESSTagInfo=\u30da\u30fc\u30b8\u4f5c\u6210\u8005\u306e\u30a2\u30c9\u30ec\u30b9\u60c5\u5831
+APPLETTagInfo=Java \u30a2\u30d7\u30ec\u30c3\u30c8
+AREATagInfo=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30fb\u30b5\u30a4\u30c9\u30fb\u30a4\u30e1\u30fc\u30b8\u30fb\u30de\u30c3\u30d7\u30fb\u30a8\u30ea\u30a2\u3092\u5b9a\u7fa9
+BTagInfo=\u542b\u307e\u308c\u3066\u3044\u308b\u30c6\u30ad\u30b9\u30c8\u3092\u592a\u5b57\u3067\u8868\u793a
+BASETagInfo=\u30da\u30fc\u30b8\u306e\u57fa\u672c URI (\u76f8\u5bfe\u30d1\u30b9\u306e\u8a08\u7b97\u6642\u306b\u4f7f\u7528\u3055\u308c\u308b)
+BASEFONTTagInfo=\u30da\u30fc\u30b8\u306e\u57fa\u672c\u30d5\u30a9\u30f3\u30c8\u30fb\u30b5\u30a4\u30ba
+BDOTagInfo=\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u53cc\u65b9\u5411\u8868\u793a\u3092\u6307\u5b9a\u5909\u66f4\u3002 \u53cc\u65b9\u5411\u8a00\u8a9e\u3068\u5171\u306b\u4f7f\u7528\u3002
+BIGTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u30e9\u30fc\u30b8\u30fb\u30d5\u30a9\u30f3\u30c8\u3067\u8868\u793a
+BGSOUNDTagInfo=\u30da\u30fc\u30b8\u306e\u30b5\u30a6\u30f3\u30c9\u30fb\u30d5\u30a1\u30a4\u30eb\u3092\u5b9a\u7fa9\u3002 W3C HTML 4.01 \u3067\u306f\u975e\u30b5\u30dd\u30fc\u30c8\u3002
+BLINKTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u660e\u6ec5\u3067\u8868\u793a\u3002 W3C HTML 4.01 \u3067\u306f\u975e\u30b5\u30dd\u30fc\u30c8\u3002
+BLOCKQUOTETagInfo=\u9577\u3044\u5f15\u7528
+BODYTagInfo=\u6587\u66f8\u672c\u6587\u3002\u30da\u30fc\u30b8\u306e\u3059\u3079\u3066\u306e\u5185\u5bb9\u3092\u542b\u3080\u3002
+BRTagInfo=\u6539\u884c\u3092\u5f37\u5236
+BUTTONTagInfo=\u30d7\u30c3\u30b7\u30e5\u30dc\u30bf\u30f3\u3092\u5b9a\u7fa9
+CAPTIONTagInfo=\u30c6\u30fc\u30d6\u30eb\u8868\u984c\u3092\u5b9a\u7fa9
+CENTERTagInfo=\u542b\u307e\u308c\u3066\u3044\u308b\u30c6\u30ad\u30b9\u30c8\u3092\u4e2d\u592e\u305d\u308d\u3048\u3067\u8868\u793a\u3002 align=center \u3092\u6301\u3064 DIV \u306b\u76f8\u5f53\u3002
+CITETagInfo=\u5f15\u7528
+CODETagInfo=\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u30fb\u30b3\u30fc\u30c9\u30fb\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8
+COLTagInfo=\u30c6\u30fc\u30d6\u30eb\u5217
+COLGROUPTagInfo=\u30c6\u30fc\u30d6\u30eb\u5217\u306e\u30b0\u30eb\u30fc\u30d7
+DDTagInfo=\u5b9a\u7fa9\u307e\u305f\u306f\u8a18\u8ff0\u30ea\u30b9\u30c8\u5185\u306e\u5b9a\u7fa9\u3042\u308b\u3044\u306f\u8a18\u8ff0
+DELTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u524a\u9664\u6e08\u307f\u3068\u3057\u3066\u8868\u793a
+DFNTagInfo=\u5b9a\u7fa9
+DIRTagInfo=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u30fb\u30ea\u30b9\u30c8
+DIVTagInfo=\u6c4e\u7528\u30b3\u30f3\u30c6\u30ca\u30fc (\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u8a00\u8a9e\u307e\u305f\u306f\u30b9\u30bf\u30a4\u30eb\u3092\u5b9a\u7fa9\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b)
+DLTagInfo=\u5b9a\u7fa9\u307e\u305f\u306f\u8a18\u8ff0\u30ea\u30b9\u30c8
+DTTagInfo=\u5b9a\u7fa9\u307e\u305f\u306f\u8a18\u8ff0\u30ea\u30b9\u30c8\u5185\u306e\u7528\u8a9e\u307e\u305f\u306f\u30b5\u30d6\u30b8\u30a7\u30af\u30c8
+EMTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u5f37\u8abf\u8868\u793a (\u4e00\u822c\u7684\u306b\u306f\u30a4\u30bf\u30ea\u30c3\u30af\u8868\u793a)
+EMBEDTagInfo=\u7d44\u307f\u8fbc\u307f\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u5b9a\u7fa9\u3002 W3C HTML 4.01 \u3067\u306f\u975e\u30b5\u30dd\u30fc\u30c8\u3002
+FIELDSETTagInfo=\u66f8\u5f0f\u5236\u5fa1\u30b0\u30eb\u30fc\u30d7\u3092\u5b9a\u7fa9
+FONTTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u6307\u5b9a\u306e\u30d5\u30a9\u30f3\u30c8\u3067\u8868\u793a
+FORMTagInfo=\u5bfe\u8a71\u5f0f\u66f8\u5f0f\u3092\u5b9a\u7fa9
+FRAMETagInfo=\u73fe\u884c\u30a6\u30a3\u30f3\u30c9\u30a6\u5185\u306e\u30d5\u30ec\u30fc\u30e0\u3092\u5b9a\u7fa9
+FRAMESETTagInfo=\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u5206\u5272\u3057\u3066\u30d5\u30ec\u30fc\u30e0\u306b\u3059\u308b\u30d5\u30ec\u30fc\u30e0\u30fb\u30bb\u30c3\u30c8\u3092\u5b9a\u7fa9
+H1TagInfo=\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u898b\u51fa\u3057
+H2TagInfo=2 \u6b21\u30ec\u30d9\u30eb\u898b\u51fa\u3057
+H3TagInfo=3 \u6b21\u30ec\u30d9\u30eb\u898b\u51fa\u3057
+H4TagInfo=4 \u6b21\u30ec\u30d9\u30eb\u898b\u51fa\u3057
+H5TagInfo=5 \u6b21\u30ec\u30d9\u30eb\u898b\u51fa\u3057
+H6TagInfo=6 \u6b21\u30ec\u30d9\u30eb\u898b\u51fa\u3057
+HEADTagInfo=\u6587\u66f8\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u3068\u30a6\u30a3\u30f3\u30c9\u30a6\u30fb\u30bf\u30a4\u30c8\u30eb\u306e\u60c5\u5831\u3092\u542b\u3080
+HRTagInfo=\u6c34\u5e73\u3051\u3044\u7dda
+HTMLTagInfo=\u6587\u66f8\u306e\u30eb\u30fc\u30c8\u30fb\u30a8\u30ec\u30e1\u30f3\u30c8
+ITagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u30a4\u30bf\u30ea\u30c3\u30af\u3067\u8868\u793a
+IFRAMETagInfo=\u30a4\u30f3\u30e9\u30a4\u30f3\u30fb\u30b5\u30d6\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u5b9a\u7fa9
+IMGTagInfo=\u7d44\u307f\u8fbc\u307f\u30b3\u30f3\u30c6\u30f3\u30c4\u3068\u3057\u3066\u53c2\u7167\u30a4\u30e1\u30fc\u30b8\u3092\u8868\u793a
+INPUTTagInfo=\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u7528\u306e\u66f8\u5f0f\u5236\u5fa1\u3092\u5b9a\u7fa9
+INSTagInfo=\u633f\u5165\u3055\u308c\u308b\u30c6\u30ad\u30b9\u30c8\u3092\u5b9a\u7fa9
+ISINDEXTagInfo=\u5358\u4e00\u884c\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u5b9a\u7fa9
+KBDTagInfo=\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3059\u308b\u30c6\u30ad\u30b9\u30c8\u3092\u5b9a\u7fa9
+LABELTagInfo=\u66f8\u5f0f\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30e9\u30d9\u30eb\u3092\u5b9a\u7fa9
+LEGENDTagInfo=\u66f8\u5f0f\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30bb\u30c3\u30c8\u306e\u30e9\u30d9\u30eb\u3092\u5b9a\u7fa9
+LITagInfo=\u30ea\u30b9\u30c8\u5185\u306e\u30ea\u30b9\u30c8\u9805\u76ee\u3092\u5b9a\u7fa9
+LINKTagInfo=\u30e1\u30c7\u30a3\u30a2\u975e\u4f9d\u5b58\u306e\u30ea\u30f3\u30af
+MAPTagInfo=\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30fb\u30b5\u30a4\u30c9\u306e\u30a4\u30e1\u30fc\u30b8\u30fb\u30de\u30c3\u30d7\u3092\u5b9a\u7fa9
+MARQUEETagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u30b9\u30af\u30ed\u30fc\u30eb\u8868\u793a\u3002 W3C HTML 4.01 \u3067\u306f\u975e\u30b5\u30dd\u30fc\u30c8\u3002
+MENUTagInfo=\u30e1\u30cb\u30e5\u30fc\u30fb\u30ea\u30b9\u30c8\u3092\u5b9a\u7fa9
+METATagInfo=\u6587\u66f8\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u60c5\u5831\u3092\u5b9a\u7fa9
+NOBRTagInfo=\u6539\u884c\u3092\u6307\u5b9a\u5909\u66f4\u304a\u3088\u3073\u9632\u6b62\u3002 W3C HTML 4.01 \u3067\u306f\u975e\u30b5\u30dd\u30fc\u30c8\u3002
+NOFRAMESTagInfo=\u73fe\u5728\u306e\u30d6\u30e9\u30a6\u30b6\u30fc\u304c\u30d5\u30ec\u30fc\u30e0\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u306a\u3044\u5834\u5408\u306b\u8868\u793a\u3059\u308b\u60c5\u5831\u3092\u63d0\u4f9b
+NOSCRIPTTagInfo=\u73fe\u5728\u306e\u30d6\u30e9\u30a6\u30b6\u30fc\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u306a\u3044\u5834\u5408\u306b\u8868\u793a\u3059\u308b\u60c5\u5831\u3092\u63d0\u4f9b
+OBJECTTagInfo=\u6c4e\u7528\u7d44\u307f\u8fbc\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5b9a\u7fa9
+OLTagInfo=\u9806\u5e8f\u4ed8\u304d\u30ea\u30b9\u30c8
+OPTGROUPTagInfo=\u30aa\u30d7\u30b7\u30e7\u30f3\u30fb\u30b0\u30eb\u30fc\u30d7
+OPTIONTagInfo=\u9078\u629e\u53ef\u80fd\u9805\u76ee
+PTagInfo=\u6bb5\u843d
+PARAMTagInfo=\u540d\u524d\u4ed8\u304d\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u5024
+PRETagInfo=\u30d9\u30bf\u66f8\u304d\u30c6\u30ad\u30b9\u30c8
+QTagInfo=\u77ed\u3044\u30a4\u30f3\u30e9\u30a4\u30f3\u5f15\u7528
+STagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u6253\u3061\u6d88\u3057\u7dda\u30b9\u30bf\u30a4\u30eb\u3067\u8868\u793a
+SAMPTagInfo=\u30b5\u30f3\u30d7\u30eb\u30fb\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u51fa\u529b\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3001\u305d\u306e\u4ed6\u3002 \u30e2\u30ce\u30b9\u30da\u30fc\u30b9\u30fb\u30d5\u30a9\u30f3\u30c8\u3067\u8868\u793a\u3002
+SCRIPTTagInfo=\u30b9\u30af\u30ea\u30d7\u30c8\u30fb\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8
+SELECTTagInfo=\u30aa\u30d7\u30b7\u30e7\u30f3\u30fb\u30bb\u30ec\u30af\u30bf\u30fc
+SMALLTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u30b9\u30e2\u30fc\u30eb\u30fb\u30d5\u30a9\u30f3\u30c8\u3067\u8868\u793a
+SPANTagInfo=\u6c4e\u7528\u30b3\u30f3\u30c6\u30ca\u30fc (\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u8a00\u8a9e\u307e\u305f\u306f\u30b9\u30bf\u30a4\u30eb\u3092\u5b9a\u7fa9\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u308b)
+STRIKETagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u6253\u3061\u6d88\u3057\u7dda\u30b9\u30bf\u30a4\u30eb\u3067\u8868\u793a
+STRONGTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u5f37\u8abf\u8868\u793a (\u4e00\u822c\u7684\u306b\u306f\u592a\u5b57\u8868\u793a)
+STYLETagInfo=\u542b\u307e\u308c\u3066\u3044\u308b\u60c5\u5831\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u5b9a\u7fa9
+SUBTagInfo=\u4e0b\u4ed8\u304d\u3068\u3057\u3066\u8868\u793a
+SUPTagInfo=\u4e0a\u4ed8\u304d\u3068\u3057\u3066\u8868\u793a
+TABLETagInfo=\u30c6\u30fc\u30d6\u30eb\u3092\u5b9a\u7fa9
+TBODYTagInfo=\u30c6\u30fc\u30d6\u30eb\u306e\u672c\u6587
+TDTagInfo=\u30c6\u30fc\u30d6\u30eb\u5185\u306e\u30bb\u30eb
+TEXTAREATagInfo=\u8907\u6570\u884c\u30c6\u30ad\u30b9\u30c8\u30fb\u30d5\u30a3\u30fc\u30eb\u30c9
+TFOOTTagInfo=\u30c6\u30fc\u30d6\u30eb\u30fb\u30d5\u30c3\u30bf\u30fc
+THTagInfo=\u30c6\u30fc\u30d6\u30eb\u30fb\u30d8\u30c3\u30c0\u30fc\u30fb\u30bb\u30eb
+THEADTagInfo=\u30c6\u30fc\u30d6\u30eb\u30fb\u30d8\u30c3\u30c0\u30fc
+TITLETagInfo=\u6587\u66f8\u30bf\u30a4\u30c8\u30eb (\u30d6\u30e9\u30a6\u30b6\u30fc\u306e\u30bf\u30a4\u30c8\u30eb\u30fb\u30d0\u30fc\u306b\u8868\u793a\u3055\u308c\u308b)
+TRTagInfo=\u30c6\u30fc\u30d6\u30eb\u884c
+TTTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u30c6\u30ec\u30bf\u30a4\u30d7\u307e\u305f\u306f\u30e2\u30ce\u30b9\u30da\u30fc\u30b9\u30fb\u30c6\u30ad\u30b9\u30c8\u30fb\u30b9\u30bf\u30a4\u30eb\u3067\u8868\u793a
+UTagInfo=\u30c6\u30ad\u30b9\u30c8\u3092\u4e0b\u7dda\u4ed8\u304d\u3067\u8868\u793a
+ULTagInfo=\u9806\u4e0d\u540c\u30ea\u30b9\u30c8
+VARTagInfo=\u5909\u6570\u307e\u305f\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u5f15\u304d\u6570\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9
+WBRTagInfo=<B>&lt;NOBR&gt;</B> \u30bf\u30b0\u5185\u306e\u6539\u884c\u3092\u8a8d\u3081\u308b\u3002 W3C HTML 4.01 \u3067\u306f\u975e\u30b5\u30dd\u30fc\u30c8\u3002
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_ko.properties b/bundles/org.eclipse.wst.html.core/data/htmref_ko.properties
new file mode 100644
index 0000000000..a6336137bb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_ko.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=href \uc18d\uc131\uc774 \uc788\ub294 \uacbd\uc6b0, \ub9c1\ud06c \uadf8\ub9ac\uace0 \uc774\ub984 \uc18d\uc131\uc774 \uc788\ub294 \uacbd\uc6b0, \ub9c1\ud06c\uc758 \ub300\uc0c1
+ABBRTagInfo=\uc57d\uc5b4(\uc608: WWW, HTTP)
+ACRONYMTagInfo=\uba38\ub9ac\uae00\uc790(\uc608: SCUBA)
+ADDRESSTagInfo=\ud398\uc774\uc9c0 \uc791\uc131\uc790\uc758 \uc8fc\uc18c \uc815\ubcf4
+APPLETTagInfo=Java \uc560\ud50c\ub9bf
+AREATagInfo=\ud074\ub77c\uc774\uc5b8\ud2b8\uce21 \uc774\ubbf8\uc9c0 \ub9f5 \uc601\uc5ed\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+BTagInfo=\ud3ec\ud568\ub41c \ud14d\uc2a4\ud2b8\ub97c \uad75\uc740\uccb4\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+BASETagInfo=\ud398\uc774\uc9c0\uc758 \uae30\uc900 URI(\uc0c1\ub300 \uacbd\ub85c \uacc4\uc0b0 \uc2dc \uc0ac\uc6a9\ub428)
+BASEFONTTagInfo=\ud398\uc774\uc9c0\uc758 \uae30\uc900 \uae00\uaf34 \ud06c\uae30
+BDOTagInfo=\uae30\ubcf8 \uc591\ubc29\ud5a5 \ud45c\uc2dc\ub97c \ub300\uccb4\ud569\ub2c8\ub2e4. \uc591\ubc29\ud5a5 \uc5b8\uc5b4\uc5d0 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.
+BIGTagInfo=\ud3ec\ud568\ub41c \ud14d\uc2a4\ud2b8\ub97c \ud06c\uac8c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+BGSOUNDTagInfo=\ud398\uc774\uc9c0\uc758 \uc0ac\uc6b4\ub4dc \ud30c\uc77c\uc744 \uc815\uc758\ud569\ub2c8\ub2e4. W3C HTML 4.01\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.
+BLINKTagInfo=\ud14d\uc2a4\ud2b8\ub97c \uae5c\ubc15\uc784\uc73c\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4. W3C HTML 4.01\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.
+BLOCKQUOTETagInfo=\uae34 \uc778\uc6a9\ubb38
+BODYTagInfo=\ubb38\uc11c \ubcf8\ubb38. \ud398\uc774\uc9c0\uc758 \ubaa8\ub4e0 \ucee8\ud150\uce20\ub97c \ud3ec\ud568\ud569\ub2c8\ub2e4.
+BRTagInfo=\ud589 \ubc14\uafb8\uae30\ub97c \uac15\uc81c \uc2e4\ud589\ud569\ub2c8\ub2e4.
+BUTTONTagInfo=\ub204\ub984 \ub2e8\ucd94\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+CAPTIONTagInfo=\ud14c\uc774\ube14 \ucea1\uc158\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+CENTERTagInfo=\ud3ec\ud568\ub41c \ud14d\uc2a4\ud2b8\uac00 \uac00\uc6b4\ub370\ub85c \uc624\ub3c4\ub85d \ud45c\uc2dc\ud569\ub2c8\ub2e4. align=center\ub97c \uc124\uc815\ud55c DIV \ud0dc\uadf8\uc640 \ub3d9\uc77c\ud569\ub2c8\ub2e4.
+CITETagInfo=\uc778\uc6a9\ubb38
+CODETagInfo=\ucef4\ud4e8\ud130 \ucf54\ub4dc \ub2e8\ud3b8
+COLTagInfo=\ud14c\uc774\ube14 \uc5f4
+COLGROUPTagInfo=\ud14c\uc774\ube14 \uc5f4\uc758 \uadf8\ub8f9
+DDTagInfo=\uc815\uc758 \ub610\ub294 \uc124\uba85 \ubaa9\ub85d\uc758 \uc124\uba85 \ub610\ub294 \uc815\uc758
+DELTagInfo=\ud14d\uc2a4\ud2b8\ub97c \uc0ad\uc81c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+DFNTagInfo=\uc815\uc758
+DIRTagInfo=\ub514\ub809\ud1a0\ub9ac \ubaa9\ub85d
+DIVTagInfo=\ucee8\ud150\uce20\uc758 \uc2a4\ud0c0\uc77c \ub610\ub294 \uc5b8\uc5b4\ub97c \uc815\uc758\ud558\ub294 \ub370 \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc77c\ubc18 \ucee8\ud14c\uc774\ub108
+DLTagInfo=\uc815\uc758 \ub610\ub294 \uc124\uba85 \ubaa9\ub85d
+DTTagInfo=\uc815\uc758 \ub610\ub294 \uc124\uba85 \ubaa9\ub85d\uc758 \uc6a9\uc5b4 \ub610\ub294 \uc8fc\uc81c
+EMTagInfo=\ud14d\uc2a4\ud2b8\ub97c \uac15\uc870\ud45c\uc2dc\ud569\ub2c8\ub2e4(\uc77c\ubc18\uc801\uc73c\ub85c \uae30\uc6b8\uc784\uccb4).
+EMBEDTagInfo=\uc784\ubca0\ub514\ub4dc \ud50c\ub7ec\uadf8\uc778\uc744 \uc815\uc758\ud569\ub2c8\ub2e4. W3C HTML 4.01\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.
+FIELDSETTagInfo=\uc591\uc2dd \uc81c\uc5b4 \uadf8\ub8f9 \uc815\uc758
+FONTTagInfo=\ud14d\uc2a4\ud2b8\ub97c \uc9c0\uc815\ub41c \uae00\uaf34\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+FORMTagInfo=\ub300\ud654\uc2dd \uc591\uc2dd\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+FRAMETagInfo=\ud604\uc7ac \ucc3d \ub0b4\ubd80\uc758 \ud504\ub808\uc784\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+FRAMESETTagInfo=\ucc3d\uc744 \ud504\ub808\uc784\uc73c\ub85c \ub098\ub204\ub294 \ud504\ub808\uc784\uc138\ud2b8\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+H1TagInfo=\ucd5c\uc0c1\uc704 \ub808\ubca8 \ud45c\uc81c
+H2TagInfo=\ub450 \ubc88\uc9f8 \ub808\ubca8 \ud45c\uc81c
+H3TagInfo=\uc138 \ubc88\uc9f8 \ub808\ubca8 \ud45c\uc81c
+H4TagInfo=\ub124 \ubc88\uc9f8 \ub808\ubca8 \ud45c\uc81c
+H5TagInfo=\ub2e4\uc12f \ubc88\uc9f8 \ub808\ubca8 \ud45c\uc81c
+H6TagInfo=\uc5ec\uc12f \ubc88\uc9f8 \ub808\ubca8 \ud45c\uc81c
+HEADTagInfo=\ubb38\uc11c\uc758 \uba54\ud0c0\ub370\uc774\ud130 \ubc0f \ucc3d \uc81c\ubaa9 \uc815\ubcf4\ub97c \ud3ec\ud568\ud569\ub2c8\ub2e4.
+HRTagInfo=\uc218\ud3c9 \uc790
+HTMLTagInfo=\ubb38\uc11c\uc758 \ub8e8\ud2b8 \uc694\uc18c
+ITagInfo=\ud14d\uc2a4\ud2b8\ub97c \uae30\uc6b8\uc784\uaf34\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+IFRAMETagInfo=\uc778\ub77c\uc778 \ud558\uc704 \ucc3d\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+IMGTagInfo=\ucc38\uc870\ub41c \uc774\ubbf8\uc9c0\ub97c \uc784\ubca0\ub514\ub4dc \ucee8\ud150\uce20\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+INPUTTagInfo=\uc0ac\uc6a9\uc790 \uc785\ub825\uc744 \uc704\ud55c \uc591\uc2dd \uc81c\uc5b4\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+INSTagInfo=\uc0bd\uc785\ub41c \ud14d\uc2a4\ud2b8\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+ISINDEXTagInfo=\ub2e8\uc77c \ud589 \ud504\ub86c\ud504\ud2b8\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+KBDTagInfo=\uc0ac\uc6a9\uc790\uac00 \uc785\ub825\ud560 \ud14d\uc2a4\ud2b8\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+LABELTagInfo=\uc591\uc2dd \ud544\ub4dc\uc758 \ub808\uc774\ube14\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+LEGENDTagInfo=\uc591\uc2dd \ud544\ub4dc \uc138\ud2b8\uc758 \ub808\uc774\ube14\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+LITagInfo=\ubaa9\ub85d \ub0b4\ubd80\uc758 \ubaa9\ub85d \ud56d\ubaa9\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+LINKTagInfo=\ub9e4\uccb4 \ub3c5\ub9bd\uc801 \ub9c1\ud06c
+MAPTagInfo=\ud074\ub77c\uc774\uc5b8\ud2b8\uce21 \uc774\ubbf8\uc9c0 \ub9f5\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+MARQUEETagInfo=\ud14d\uc2a4\ud2b8\uc5d0 \ud750\ub974\ub294 \ud6a8\uacfc\ub97c \uc90d\ub2c8\ub2e4. W3C HTML 4.01\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.
+MENUTagInfo=\uba54\ub274 \ubaa9\ub85d\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+METATagInfo=\ubb38\uc11c\uc758 \uba54\ud0c0\ub370\uc774\ud130 \uc815\ubcf4\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+NOBRTagInfo=\ud589 \ubc14\uafb8\uae30\ub97c \ub300\uccb4\ud558\uac70\ub098 \ubc29\uc9c0\ud569\ub2c8\ub2e4. W3C HTML 4.01\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.
+NOFRAMESTagInfo=\ud604\uc7ac \ube0c\ub77c\uc6b0\uc800\uac00 \ud504\ub808\uc784\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0 \ud45c\uc2dc\ud560 \uc815\ubcf4\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4.
+NOSCRIPTTagInfo=\ud604\uc7ac \ube0c\ub77c\uc6b0\uc800\uac00 \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0 \ud45c\uc2dc\ud560 \uc815\ubcf4\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4.
+OBJECTTagInfo=\uc784\ubca0\ub514\ub4dc \uc77c\ubc18 \uc624\ube0c\uc81d\ud2b8\ub97c \uc815\uc758\ud569\ub2c8\ub2e4.
+OLTagInfo=\uc21c\uc11c\ud654\ub41c \ubaa9\ub85d
+OPTGROUPTagInfo=\uc635\uc158 \uadf8\ub8f9
+OPTIONTagInfo=\uc120\ud0dd \uac00\ub2a5\ud55c \uc120\ud0dd\uc0ac\ud56d
+PTagInfo=\ub2e8\ub77d
+PARAMTagInfo=\uc774\ub984\uc774 \uc9c0\uc815\ub41c \ud2b9\uc131 \uac12
+PRETagInfo=\ubbf8\ub9ac \ud615\uc2dd\ud654\ub41c \ud14d\uc2a4\ud2b8
+QTagInfo=\ucd95\uc57d\ud615 \uc778\ub77c\uc778 \uc778\uc6a9\ubb38
+STagInfo=\ucde8\uc18c\uc120 \uc2a4\ud0c0\uc77c\ub85c \ud14d\uc2a4\ud2b8\ub97c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+SAMPTagInfo=\uc0d8\ud50c \ud504\ub85c\uadf8\ub7a8 \ucd9c\ub825, \uc2a4\ud06c\ub9bd\ud2b8 \ub4f1\uc5d0 \uc0ac\uc6a9\ud569\ub2c8\ub2e4. \ubaa8\ub178\uc2a4\ud398\uc774\uc2a4 \uae00\uaf34\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+SCRIPTTagInfo=\uc2a4\ud06c\ub9bd\ud2b8 \ubb38
+SELECTTagInfo=\uc635\uc158 \uc120\ud0dd\uae30
+SMALLTagInfo=\ud14d\uc2a4\ud2b8\ub97c \uc791\uac8c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+SPANTagInfo=\ucee8\ud150\uce20\uc758 \uc2a4\ud0c0\uc77c \ub610\ub294 \uc5b8\uc5b4\ub97c \uc815\uc758\ud558\ub294 \ub370 \uc0ac\uc6a9 \uac00\ub2a5\ud55c \uc77c\ubc18 \ucee8\ud14c\uc774\ub108
+STRIKETagInfo=\ucde8\uc18c\uc120 \uc2a4\ud0c0\uc77c\ub85c \ud14d\uc2a4\ud2b8\ub97c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+STRONGTagInfo=\ud14d\uc2a4\ud2b8\ub97c \uac15\uc870\ud45c\uc2dc\ud569\ub2c8\ub2e4(\uc77c\ubc18\uc801\uc73c\ub85c \uad75\uc740\uccb4).
+STYLETagInfo=\ud3ec\ud568\ub41c \uc815\ubcf4\uc758 \uc2a4\ud0c0\uc77c\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+SUBTagInfo=\uc544\ub798 \ucca8\uc790\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+SUPTagInfo=\uc704 \ucca8\uc790\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+TABLETagInfo=\ud14c\uc774\ube14\uc744 \uc815\uc758\ud569\ub2c8\ub2e4.
+TBODYTagInfo=\ud14c\uc774\ube14 \ubcf8\ubb38
+TDTagInfo=\ud14c\uc774\ube14 \ub0b4\uc758 \uc140
+TEXTAREATagInfo=\ub2e4\uc911 \ud589 \ud14d\uc2a4\ud2b8 \ud544\ub4dc
+TFOOTTagInfo=\ud14c\uc774\ube14 \ubc14\ub2e5\uae00
+THTagInfo=\ud14c\uc774\ube14 \ud5e4\ub354 \uc140
+THEADTagInfo=\ud14c\uc774\ube14 \ud5e4\ub354
+TITLETagInfo=\ube0c\ub77c\uc6b0\uc800 \uc81c\ubaa9 \ud45c\uc2dc\uc904\uc5d0 \ud45c\uc2dc\ub418\ub294 \ubb38\uc11c \uc81c\ubaa9
+TRTagInfo=\ud14c\uc774\ube14 \ud589
+TTTagInfo=\ud14d\uc2a4\ud2b8\ub97c \ud154\ub808\ud0c0\uc774\ud504 \ub610\ub294 \ubaa8\ub178\uc2a4\ud398\uc774\uc2a4 \ud14d\uc2a4\ud2b8 \uc2a4\ud0c0\uc77c\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+UTagInfo=\ud14d\uc2a4\ud2b8\uc5d0 \ubc11\uc904\uc744 \uadf8\uc5b4 \ud45c\uc2dc\ud569\ub2c8\ub2e4.
+ULTagInfo=\uc21c\uc11c \uc5c6\ub294 \ubaa9\ub85d
+VARTagInfo=\ubcc0\uc218 \ub610\ub294 \ud504\ub85c\uadf8\ub7a8 \uc778\uc218\uc758 \uc778\uc2a4\ud134\uc2a4
+WBRTagInfo=<B>&lt;NOBR&gt;</B> \ud0dc\uadf8 \ub0b4\uc5d0 \ud589 \ubc14\uafb8\uae30\ub97c \ud5c8\uc6a9\ud569\ub2c8\ub2e4. W3C HTML 4.01\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_pt_BR.properties b/bundles/org.eclipse.wst.html.core/data/htmref_pt_BR.properties
new file mode 100644
index 0000000000..b5e33068ac
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_pt_BR.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=Um link se o atributo href estiver presente e o destino de um link se o atributo name estiver presente.
+ABBRTagInfo=Uma abrevia\u00e7\u00e3o (por exemplo, WWW, HTTP)
+ACRONYMTagInfo=Um acr\u00f4nimo (por exemplo, SCUBA)
+ADDRESSTagInfo=Informa\u00e7\u00f5es sobre o endere\u00e7o do autor da p\u00e1gina
+APPLETTagInfo=Um applet Java
+AREATagInfo=Define uma \u00e1rea de mapa de imagem do lado do cliente
+BTagInfo=Exibe o texto contido como negrito
+BASETagInfo=O URI base para a p\u00e1gina a ser utilizado ao calcular caminhos relativos
+BASEFONTTagInfo=O tamanho da fonte base para a p\u00e1gina
+BDOTagInfo=Substitui a exibi\u00e7\u00e3o bidirecional padr\u00e3o. Para ser utilizado com idiomas bidirecionais.
+BIGTagInfo=Exibe o texto contido em tamanho grande
+BGSOUNDTagInfo=Define um arquivo de som para a p\u00e1gina. N\u00e3o suportado pelo W3C HTML 4.01.
+BLINKTagInfo=Exibe o texto piscando. N\u00e3o suportado pelo W3C HTML 4.01.
+BLOCKQUOTETagInfo=Uma cita\u00e7\u00e3o longa
+BODYTagInfo=O corpo do documento. Cont\u00e9m todo o conte\u00fado para a p\u00e1gina.
+BRTagInfo=For\u00e7a uma quebra de linha
+BUTTONTagInfo=Define um bot\u00e3o de comando
+CAPTIONTagInfo=Define uma legenda de tabela
+CENTERTagInfo=Exibe o texto contido centralizado. Equivalente a DIV com align=center.
+CITETagInfo=Uma cita\u00e7\u00e3o
+CODETagInfo=Um fragmento de c\u00f3digo de computador
+COLTagInfo=Uma coluna de tabela
+COLGROUPTagInfo=Um grupo de colunas da tabela
+DDTagInfo=Uma defini\u00e7\u00e3o ou descri\u00e7\u00e3o em uma lista de defini\u00e7\u00f5es ou descri\u00e7\u00f5es
+DELTagInfo=Exibe texto como exclu\u00eddo
+DFNTagInfo=Uma defini\u00e7\u00e3o
+DIRTagInfo=Uma listagem de diret\u00f3rios
+DIVTagInfo=Um cont\u00eainer gen\u00e9rico, que pode ser utilizado para definir idioma ou estilo do conte\u00fado
+DLTagInfo=Uma lista de defini\u00e7\u00f5es ou descri\u00e7\u00f5es
+DTTagInfo=Um termo ou assunto em uma lista de defini\u00e7\u00f5es ou descri\u00e7\u00f5es
+EMTagInfo=Exibe o texto enfatizado (geralmente em it\u00e1lico)
+EMBEDTagInfo=Define um plug-in incorporado. N\u00e3o suportado pelo W3C HTML 4.01.
+FIELDSETTagInfo=Define um grupo de controle de formul\u00e1rio
+FONTTagInfo=Exibe texto na fonte fornecida
+FORMTagInfo=Define um formul\u00e1rio interativo
+FRAMETagInfo=Define um quadro dentro da janela atual
+FRAMESETTagInfo=Define um conjunto de quadros que divide a janela em quadros
+H1TagInfo=Um t\u00edtulo de n\u00edvel superior
+H2TagInfo=Um t\u00edtulo de segundo n\u00edvel
+H3TagInfo=Um t\u00edtulo de terceiro n\u00edvel
+H4TagInfo=Um t\u00edtulo de quarto n\u00edvel
+H5TagInfo=Um t\u00edtulo de quinto n\u00edvel
+H6TagInfo=Um t\u00edtulo de sexto n\u00edvel
+HEADTagInfo=Cont\u00e9m metadados e informa\u00e7\u00f5es sobre o t\u00edtulo da janela para o documento
+HRTagInfo=Uma r\u00e9gua horizontal
+HTMLTagInfo=O elemento raiz do documento.
+ITagInfo=Exibe o texto em it\u00e1lico
+IFRAMETagInfo=Define uma subjanela em linha
+IMGTagInfo=Exibe a imagem referida como conte\u00fado incorporado
+INPUTTagInfo=Define um controle de formul\u00e1rio para entrada do usu\u00e1rio
+INSTagInfo=Define o texto inserido
+ISINDEXTagInfo=Define um prompt de linha \u00fanica
+KBDTagInfo=Define texto a ser inserido pelo usu\u00e1rio
+LABELTagInfo=Define o r\u00f3tulo para um campo de formul\u00e1rio
+LEGENDTagInfo=Define o r\u00f3tulo para um conjunto de campos de formul\u00e1rio
+LITagInfo=Define um item de lista dentro de uma lista
+LINKTagInfo=Um link independente de m\u00eddia
+MAPTagInfo=Define um mapa de imagem do lado do cliente
+MARQUEETagInfo=Exibe texto rolando. N\u00e3o suportado pelo W3C HTML 4.01.
+MENUTagInfo=Define uma lista de menus
+METATagInfo=Define informa\u00e7\u00f5es de metadados para o documento
+NOBRTagInfo=Substitui e impede quebras de linha. N\u00e3o suportado pelo W3C HTML 4.01.
+NOFRAMESTagInfo=Fornece informa\u00e7\u00f5es a serem exibidas se o navegador atual n\u00e3o suportar quadros
+NOSCRIPTTagInfo=Fornece informa\u00e7\u00f5es a serem exibidas se o navegador atual n\u00e3o suportar script
+OBJECTTagInfo=Define um objeto incorporado gen\u00e9rico
+OLTagInfo=Uma lista ordenada
+OPTGROUPTagInfo=Um grupo de op\u00e7\u00f5es
+OPTIONTagInfo=Uma op\u00e7\u00e3o selecion\u00e1vel
+PTagInfo=Um par\u00e1grafo
+PARAMTagInfo=O valor de uma propriedade denominada
+PRETagInfo=Texto pr\u00e9-formatado
+QTagInfo=Uma cita\u00e7\u00e3o curta em linha
+STagInfo=Exibir texto no estilo tachado
+SAMPTagInfo=Sa\u00edda, scripts, etc do programa de amostra. Exibe em fonte de espa\u00e7amento uniforme.
+SCRIPTTagInfo=Instru\u00e7\u00f5es de script
+SELECTTagInfo=Um seletor de op\u00e7\u00f5es
+SMALLTagInfo=Exibe texto em tamanho pequeno
+SPANTagInfo=Um cont\u00eainer gen\u00e9rico, que pode ser utilizado para definir idioma ou estilo do conte\u00fado
+STRIKETagInfo=Exibir texto no estilo tachado
+STRONGTagInfo=Exibe o texto muito enfatizado (geralmente em negrito)
+STYLETagInfo=Define um estilo para as informa\u00e7\u00f5es contidas
+SUBTagInfo=Exibe como subscrito
+SUPTagInfo=Exibe como sobrescrito
+TABLETagInfo=Define uma tabela
+TBODYTagInfo=O corpo da tabela
+TDTagInfo=Uma c\u00e9lula de uma tabela
+TEXTAREATagInfo=Um campo de texto de v\u00e1rias linhas
+TFOOTTagInfo=Um rodap\u00e9 de tabela
+THTagInfo=Uma c\u00e9lula de cabe\u00e7alho de tabela
+THEADTagInfo=Um cabe\u00e7alho de tabela
+TITLETagInfo=O t\u00edtulo do documento, exibido na barra de t\u00edtulo do navegador
+TRTagInfo=Uma linha da tabela
+TTTagInfo=Exibe o texto em teletipo ou em estilo de texto de espa\u00e7amento uniforme
+UTagInfo=Exibe texto como sublinhado
+ULTagInfo=Uma lista desordenada
+VARTagInfo=Uma inst\u00e2ncia de um argumento de vari\u00e1vel ou programa
+WBRTagInfo=Permite uma quebra de linha na marca\u00e7\u00e3o <B>&lt;NOBR&gt;</B>. N\u00e3o suportado pelo W3C HTML 4.01.
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_zh_CN.properties b/bundles/org.eclipse.wst.html.core/data/htmref_zh_CN.properties
new file mode 100644
index 0000000000..109f327160
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_zh_CN.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=\u5982\u679c href \u5c5e\u6027\u5b58\u5728\uff0c\u5219\u662f\u4e00\u4e2a\u94fe\u63a5\uff0c\u800c\u5982\u679c\u540d\u79f0\u5c5e\u6027\u5b58\u5728\uff0c\u5219\u662f\u94fe\u63a5\u7684\u76ee\u6807
+ABBRTagInfo=\u7f29\u5199\uff08\u4f8b\u5982\uff0cWWW \u548c HTTP\uff09
+ACRONYMTagInfo=\u9996\u5b57\u6bcd\u7f29\u5199\u8bcd\uff08\u4f8b\u5982\uff0cSCUBA\uff09
+ADDRESSTagInfo=\u9875\u9762\u7684\u4f5c\u8005\u7684\u5730\u5740\u4fe1\u606f
+APPLETTagInfo=Java applet
+AREATagInfo=\u5b9a\u4e49\u5ba2\u6237\u673a\u7aef\u56fe\u50cf\u6620\u5c04\u533a\u57df
+BTagInfo=\u7528\u7c97\u4f53\u5b57\u663e\u793a\u6240\u5305\u542b\u7684\u6587\u672c
+BASETagInfo=\u9875\u9762\u7684\u57fa\u51c6 URI\uff0c\u5728\u8ba1\u7b97\u76f8\u5bf9\u8def\u5f84\u65f6\u4f7f\u7528
+BASEFONTTagInfo=\u9875\u9762\u7684\u57fa\u672c\u5b57\u4f53\u5927\u5c0f
+BDOTagInfo=\u8986\u76d6\u7f3a\u7701\u53cc\u5411\u663e\u793a\u3002\u8981\u4e0e\u53cc\u5411\u8bed\u8a00\u914d\u5408\u4f7f\u7528\u3002
+BIGTagInfo=\u7528\u5927\u5b57\u4f53\u663e\u793a\u6240\u5305\u542b\u7684\u6587\u672c
+BGSOUNDTagInfo=\u4e3a\u9875\u9762\u5b9a\u4e49\u58f0\u97f3\u6587\u4ef6\u3002W3C HTML 4.01 \u4e0d\u652f\u6301\u5b83\u3002
+BLINKTagInfo=\u4ee5\u95ea\u70c1\u65b9\u5f0f\u663e\u793a\u6587\u672c\u3002W3C HTML 4.01 \u4e0d\u652f\u6301\u5b83\u3002
+BLOCKQUOTETagInfo=\u957f\u5f15\u7528
+BODYTagInfo=\u6587\u6863\u4e3b\u4f53\u3002\u5305\u542b\u9875\u9762\u7684\u6240\u6709\u5185\u5bb9\u3002
+BRTagInfo=\u5f3a\u5236\u6362\u884c
+BUTTONTagInfo=\u5b9a\u4e49\u6309\u94ae
+CAPTIONTagInfo=\u5b9a\u4e49\u8868\u6807\u9898
+CENTERTagInfo=\u5c45\u4e2d\u663e\u793a\u6240\u5305\u542b\u7684\u6587\u672c\u3002\u7b49\u4ef7\u4e8e\u8bbe\u7f6e\u4e86 align=center \u7684 DIV\u3002
+CITETagInfo=\u5f15\u7528
+CODETagInfo=\u8ba1\u7b97\u673a\u4ee3\u7801\u6bb5
+COLTagInfo=\u8868\u5217
+COLGROUPTagInfo=\u4e00\u7ec4\u8868\u5217
+DDTagInfo=\u5b9a\u4e49\u6216\u63cf\u8ff0\u5217\u8868\u4e2d\u7684\u5b9a\u4e49\u6216\u63cf\u8ff0
+DELTagInfo=\u5c06\u6587\u672c\u663e\u793a\u4e3a\u5df2\u5220\u9664
+DFNTagInfo=\u5b9a\u4e49
+DIRTagInfo=\u76ee\u5f55\u5217\u8868
+DIVTagInfo=\u4e00\u4e2a\u4e00\u822c\u5bb9\u5668\uff0c\u53ef\u7528\u4e8e\u4e3a\u5185\u5bb9\u5b9a\u4e49\u8bed\u8a00\u6216\u6837\u5f0f
+DLTagInfo=\u5b9a\u4e49\u6216\u63cf\u8ff0\u5217\u8868
+DTTagInfo=\u5b9a\u4e49\u6216\u63cf\u8ff0\u5217\u8868\u4e2d\u7684\u672f\u8bed\u6216\u4e3b\u9898
+EMTagInfo=\u4ee5\u5f3a\u8c03\u65b9\u5f0f\uff08\u901a\u5e38\u91c7\u7528\u659c\u4f53\uff09\u6765\u663e\u793a\u6587\u672c
+EMBEDTagInfo=\u5b9a\u4e49\u5d4c\u5165\u5f0f\u63d2\u4ef6\u3002W3C HTML 4.01 \u4e0d\u652f\u6301\u5b83\u3002
+FIELDSETTagInfo=\u5b9a\u4e49\u8868\u5355\u63a7\u4ef6\u7ec4
+FONTTagInfo=\u6309\u7ed9\u5b9a\u7684\u5b57\u4f53\u6765\u663e\u793a\u6587\u672c
+FORMTagInfo=\u5b9a\u4e49\u4ea4\u4e92\u5f0f\u8868\u5355
+FRAMETagInfo=\u5728\u5f53\u524d\u7a97\u53e3\u4e2d\u5b9a\u4e49\u6846\u67b6
+FRAMESETTagInfo=\u5b9a\u4e49\u5c06\u7a97\u53e3\u5206\u6210\u591a\u4e2a\u6846\u67b6\u7684\u6846\u67b6\u96c6
+H1TagInfo=\u9876\u7ea7\u6807\u9898
+H2TagInfo=\u7b2c\u4e8c\u7ea7\u6807\u9898
+H3TagInfo=\u7b2c\u4e09\u7ea7\u6807\u9898
+H4TagInfo=\u7b2c\u56db\u7ea7\u6807\u9898
+H5TagInfo=\u7b2c\u4e94\u7ea7\u6807\u9898
+H6TagInfo=\u7b2c\u516d\u7ea7\u6807\u9898
+HEADTagInfo=\u5305\u542b\u6587\u6863\u7684\u5143\u6570\u636e\u548c\u7a97\u53e3\u6807\u9898\u4fe1\u606f
+HRTagInfo=\u6c34\u5e73\u7ebf
+HTMLTagInfo=\u6587\u6863\u7684\u6839\u5143\u7d20\u3002
+ITagInfo=\u7528\u659c\u4f53\u663e\u793a\u6587\u672c
+IFRAMETagInfo=\u5b9a\u4e49\u76f4\u63a5\u63d2\u5165\u7684\u5b50\u7a97\u53e3
+IMGTagInfo=\u5c06\u5f15\u7528\u7684\u56fe\u50cf\u4f5c\u4e3a\u5d4c\u5165\u5185\u5bb9\u6765\u663e\u793a
+INPUTTagInfo=\u4e3a\u7528\u6237\u8f93\u5165\u5b9a\u4e49\u8868\u5355\u63a7\u4ef6
+INSTagInfo=\u5b9a\u4e49\u63d2\u5165\u7684\u6587\u672c
+ISINDEXTagInfo=\u5b9a\u4e49\u5355\u884c\u63d0\u793a\u7b26
+KBDTagInfo=\u5b9a\u4e49\u8981\u7531\u7528\u6237\u8f93\u5165\u7684\u6587\u672c
+LABELTagInfo=\u4e3a\u8868\u5355\u5b57\u6bb5\u5b9a\u4e49\u6807\u53f7
+LEGENDTagInfo=\u4e3a\u4e00\u7ec4\u8868\u5355\u5b57\u6bb5\u5b9a\u4e49\u6807\u53f7
+LITagInfo=\u5728\u5217\u8868\u4e2d\u5b9a\u4e49\u5217\u8868\u9879
+LINKTagInfo=\u4e0e\u4ecb\u8d28\u65e0\u5173\u7684\u94fe\u63a5
+MAPTagInfo=\u5b9a\u4e49\u5ba2\u6237\u673a\u7aef\u56fe\u50cf\u6620\u5c04
+MARQUEETagInfo=\u6eda\u52a8\u663e\u793a\u6587\u672c\u3002W3C HTML 4.01 \u4e0d\u652f\u6301\u5b83\u3002
+MENUTagInfo=\u5b9a\u4e49\u83dc\u5355\u5217\u8868
+METATagInfo=\u4e3a\u6587\u6863\u5b9a\u4e49\u5143\u6570\u636e\u4fe1\u606f
+NOBRTagInfo=\u8986\u76d6\u5e76\u9632\u6b62\u6362\u884c\u3002W3C HTML 4.01 \u4e0d\u652f\u6301\u5b83\u3002
+NOFRAMESTagInfo=\u82e5\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6846\u67b6\uff0c\u63d0\u4f9b\u663e\u793a\u7684\u4fe1\u606f
+NOSCRIPTTagInfo=\u82e5\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u811a\u672c\u7f16\u5236\uff0c\u63d0\u4f9b\u663e\u793a\u7684\u4fe1\u606f
+OBJECTTagInfo=\u5b9a\u4e49\u4e00\u822c\u5d4c\u5165\u5f0f\u5bf9\u8c61
+OLTagInfo=\u6709\u5e8f\u5217\u8868
+OPTGROUPTagInfo=\u9009\u9879\u7ec4
+OPTIONTagInfo=\u53ef\u9009\u62e9\u7684\u9009\u9879
+PTagInfo=\u6bb5\u843d
+PARAMTagInfo=\u5df2\u547d\u540d\u7684\u5c5e\u6027\u503c
+PRETagInfo=\u9884\u5148\u683c\u5f0f\u5316\u7684\u6587\u672c
+QTagInfo=\u77ed\u7684\u76f4\u63a5\u63d2\u5165\u7684\u5f15\u7528
+STagInfo=\u7528\u5220\u9664\u7ebf\u6837\u5f0f\u663e\u793a\u6587\u672c
+SAMPTagInfo=\u6837\u672c\u7a0b\u5e8f\u8f93\u51fa\u548c\u811a\u672c\u7b49\u7b49\u3002\u7528\u7b49\u5bbd\u5b57\u4f53\u663e\u793a\u3002
+SCRIPTTagInfo=\u811a\u672c\u8bed\u53e5
+SELECTTagInfo=\u9009\u9879\u9009\u62e9\u5668
+SMALLTagInfo=\u7528\u5c0f\u5b57\u4f53\u663e\u793a\u6587\u672c
+SPANTagInfo=\u4e00\u4e2a\u4e00\u822c\u5bb9\u5668\uff0c\u53ef\u7528\u4e8e\u4e3a\u5185\u5bb9\u5b9a\u4e49\u8bed\u8a00\u6216\u6837\u5f0f
+STRIKETagInfo=\u7528\u5220\u9664\u7ebf\u6837\u5f0f\u663e\u793a\u6587\u672c
+STRONGTagInfo=\u4ee5\u7279\u522b\u5f3a\u8c03\u65b9\u5f0f\uff08\u901a\u5e38\u91c7\u7528\u7c97\u4f53\u5b57\uff09\u6765\u663e\u793a\u6587\u672c
+STYLETagInfo=\u4e3a\u5305\u542b\u7684\u4fe1\u606f\u5b9a\u4e49\u6837\u5f0f
+SUBTagInfo=\u663e\u793a\u4e3a\u4e0b\u6807
+SUPTagInfo=\u663e\u793a\u4e3a\u4e0a\u6807
+TABLETagInfo=\u5b9a\u4e49\u8868
+TBODYTagInfo=\u8868\u7684\u4e3b\u4f53
+TDTagInfo=\u8868\u4e2d\u7684\u5355\u5143
+TEXTAREATagInfo=\u591a\u884c\u6587\u672c\u5b57\u6bb5
+TFOOTTagInfo=\u8868\u9875\u811a
+THTagInfo=\u8868\u9875\u7709\u5355\u5143
+THEADTagInfo=\u8868\u9875\u7709
+TITLETagInfo=\u663e\u793a\u5728\u6d4f\u89c8\u5668\u7684\u6807\u9898\u680f\u4e2d\u7684\u6587\u6863\u6807\u9898
+TRTagInfo=\u8868\u884c
+TTTagInfo=\u4ee5\u7535\u4f20\u6253\u5b57\u673a\u6216\u7b49\u5bbd\u6587\u672c\u6837\u5f0f\u6765\u663e\u793a\u6587\u672c
+UTagInfo=\u4ee5\u52a0\u4e0b\u5212\u7ebf\u7684\u65b9\u5f0f\u6765\u663e\u793a\u6587\u672c
+ULTagInfo=\u65e0\u5e8f\u5217\u8868
+VARTagInfo=\u53d8\u91cf\u6216\u7a0b\u5e8f\u81ea\u53d8\u91cf\u7684\u5b9e\u4f8b
+WBRTagInfo=<B>&lt;NOBR&gt;</B> \u6807\u8bb0\u4e2d\u5141\u8bb8\u6362\u884c\u3002W3C HTML 4.01 \u4e0d\u652f\u6301\u5b83\u3002
diff --git a/bundles/org.eclipse.wst.html.core/data/htmref_zh_TW.properties b/bundles/org.eclipse.wst.html.core/data/htmref_zh_TW.properties
new file mode 100644
index 0000000000..2d445d9aab
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/data/htmref_zh_TW.properties
@@ -0,0 +1,108 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+
+ATagInfo=\u5982\u679c\u51fa\u73fe href \u5c6c\u6027\u7684\u8a71\uff0c\u5247\u70ba\u4e00\u500b\u93c8\u7d50\uff1b\u5982\u679c\u51fa\u73fe name \u5c6c\u6027\u7684\u8a71\uff0c\u5247\u70ba\u4e00\u500b\u93c8\u7d50\u76ee\u6a19
+ABBRTagInfo=\u7e2e\u5beb\uff08\u5982 WWW\u3001HTTP\uff09
+ACRONYMTagInfo=\u5b57\u9996\u8a9e\uff08\u5982 SCUBA\uff09
+ADDRESSTagInfo=\u9801\u9762\u4f5c\u8005\u7684\u4f4d\u5740\u8cc7\u8a0a
+APPLETTagInfo=Java Applet
+AREATagInfo=\u5b9a\u7fa9\u7528\u6236\u7aef\u5f71\u50cf\u93c8\u7d50\u5716\u5340
+BTagInfo=\u7528\u7c97\u9ad4\u5b57\u986f\u793a\u5167\u542b\u7684\u6587\u5b57
+BASETagInfo=\u8a08\u7b97\u76f8\u5c0d\u8def\u5f91\u6642\u8981\u7528\u7684\u9801\u9762\u57fa\u790e URI
+BASEFONTTagInfo=\u9801\u9762\u57fa\u790e\u5b57\u578b\u5927\u5c0f
+BDOTagInfo=\u7f6e\u63db\u9810\u8a2d\u96d9\u5411\u986f\u793a\u3002\u4f9b\u96d9\u5411\u8a9e\u8a00\u4f7f\u7528\u3002
+BIGTagInfo=\u7528\u5927\u5b57\u578b\u986f\u793a\u5167\u542b\u7684\u6587\u5b57
+BGSOUNDTagInfo=\u5b9a\u7fa9\u9801\u9762\u7684\u97f3\u6548\u6a94\u3002\u4e0d\u53d7 W3C HTML 4.01 \u652f\u63f4\u3002
+BLINKTagInfo=\u7528\u9583\u720d\u65b9\u5f0f\u986f\u793a\u6587\u5b57\u3002\u4e0d\u53d7 W3C HTML 4.01 \u652f\u63f4\u3002
+BLOCKQUOTETagInfo=\u4e0d\u9577\u7684\u5f15\u6587
+BODYTagInfo=\u6587\u4ef6\u4e3b\u9ad4\u3002\u542b\u6709\u9801\u9762\u7684\u6240\u6709\u5167\u5bb9\u3002
+BRTagInfo=\u5f37\u5236\u63db\u884c
+BUTTONTagInfo=\u5b9a\u7fa9\u6309\u9215
+CAPTIONTagInfo=\u5b9a\u7fa9\u8868\u683c\u6a19\u984c
+CENTERTagInfo=\u7f6e\u4e2d\u5c0d\u9f4a\u986f\u793a\u5167\u542b\u7684\u6587\u5b57\u3002\u76f8\u7576\u65bc align=center \u7684 DIV\u3002
+CITETagInfo=\u5f15\u7528
+CODETagInfo=\u8a08\u7b97\u6a5f\u78bc\u7247\u6bb5
+COLTagInfo=\u8868\u683c\u76f4\u6b04
+COLGROUPTagInfo=\u8868\u683c\u76f4\u6b04\u7fa4\u7d44
+DDTagInfo=\u5b9a\u7fa9\u6216\u8aaa\u660e\u6e05\u55ae\u4e2d\u7684\u5b9a\u7fa9\u6216\u8aaa\u660e
+DELTagInfo=\u5c07\u6587\u5b57\u986f\u793a\u70ba\u5df2\u522a\u9664
+DFNTagInfo=\u5b9a\u7fa9
+DIRTagInfo=\u76ee\u9304\u6e05\u55ae
+DIVTagInfo=\u53ef\u7528\u4f86\u5b9a\u7fa9\u5167\u5bb9\u8a9e\u8a00\u6216\u6a23\u5f0f\u7684\u901a\u7528\u5132\u5b58\u5668\u3002
+DLTagInfo=\u5b9a\u7fa9\u6216\u8aaa\u660e\u6e05\u55ae
+DTTagInfo=\u5b9a\u7fa9\u6216\u8aaa\u660e\u6e05\u55ae\u4e2d\u7684\u8a5e\u5f59\u6216\u4e3b\u984c
+EMTagInfo=\u5f37\u8abf\u986f\u793a\u6587\u5b57\uff08\u901a\u5e38\u662f\u659c\u9ad4\uff09
+EMBEDTagInfo=\u5b9a\u7fa9\u5167\u5d4c\u5916\u639b\u7a0b\u5f0f\u3002\u4e0d\u53d7 W3C HTML 4.01 \u652f\u63f4\u3002
+FIELDSETTagInfo=\u5b9a\u7fa9\u8868\u55ae\u63a7\u5236\u9805\u7fa4\u7d44
+FONTTagInfo=\u4ee5\u7d66\u5b9a\u7684\u5b57\u578b\u4f86\u986f\u793a\u6587\u5b57
+FORMTagInfo=\u5b9a\u7fa9\u4e92\u52d5\u5f0f\u8868\u55ae
+FRAMETagInfo=\u5b9a\u7fa9\u73fe\u884c\u8996\u7a97\u5167\u7684\u9801\u6846
+FRAMESETTagInfo=\u5b9a\u7fa9\u5206\u5272\u8996\u7a97\u7684\u9801\u6846\u7d44
+H1TagInfo=\u6700\u4e0a\u5c64\u6a19\u984c
+H2TagInfo=\u7b2c\u4e8c\u5c64\u6a19\u984c
+H3TagInfo=\u7b2c\u4e09\u5c64\u6a19\u984c
+H4TagInfo=\u7b2c\u56db\u5c64\u6a19\u984c
+H5TagInfo=\u7b2c\u4e94\u5c64\u6a19\u984c
+H6TagInfo=\u7b2c\u516d\u5c64\u6a19\u984c
+HEADTagInfo=\u542b\u6709\u6587\u4ef6\u7684 Meta \u8cc7\u6599\u548c\u8996\u7a97\u6a19\u984c\u8cc7\u8a0a
+HRTagInfo=\u6c34\u5e73\u5c3a\u898f
+HTMLTagInfo=\u6587\u4ef6\u7684\u6839\u5143\u7d20\u3002
+ITagInfo=\u7528\u659c\u9ad4\u986f\u793a\u6587\u5b57
+IFRAMETagInfo=\u5b9a\u7fa9\u5217\u5165\u5b50\u8996\u7a97
+IMGTagInfo=\u5c07\u53c3\u7167\u7684\u5f71\u50cf\u986f\u793a\u6210\u5167\u5d4c\u5167\u5bb9
+INPUTTagInfo=\u5b9a\u7fa9\u4f7f\u7528\u8005\u8f38\u5165\u7684\u8868\u55ae\u63a7\u5236
+INSTagInfo=\u5b9a\u7fa9\u63d2\u5165\u7684\u6587\u5b57
+ISINDEXTagInfo=\u5b9a\u7fa9\u55ae\u884c\u63d0\u793a
+KBDTagInfo=\u5b9a\u7fa9\u4f7f\u7528\u8005\u8981\u8f38\u5165\u7684\u6587\u5b57
+LABELTagInfo=\u5b9a\u7fa9\u8868\u55ae\u6b04\u4f4d\u7684\u6a19\u7c64
+LEGENDTagInfo=\u5b9a\u7fa9\u4e00\u7d44\u8868\u55ae\u6b04\u4f4d\u7684\u6a19\u7c64
+LITagInfo=\u5b9a\u7fa9\u6e05\u55ae\u5167\u7684\u6e05\u55ae\u9805\u76ee
+LINKTagInfo=\u5a92\u9ad4\u7368\u7acb\u93c8\u7d50
+MAPTagInfo=\u5b9a\u7fa9\u7528\u6236\u7aef\u5f71\u50cf\u93c8\u7d50\u5716
+MARQUEETagInfo=\u7528\u6372\u52d5\u65b9\u5f0f\u986f\u793a\u6587\u5b57\u3002\u4e0d\u53d7 W3C HTML 4.01 \u652f\u63f4\u3002
+MENUTagInfo=\u5b9a\u7fa9\u529f\u80fd\u8868\u6e05\u55ae
+METATagInfo=\u5b9a\u7fa9\u6587\u4ef6\u7684 Meta \u8cc7\u6599\u8cc7\u8a0a
+NOBRTagInfo=\u7f6e\u63db\u548c\u9632\u6b62\u63db\u884c\u3002\u4e0d\u53d7 W3C HTML 4.01 \u652f\u63f4\u3002
+NOFRAMESTagInfo=\u63d0\u4f9b\u73fe\u884c\u700f\u89bd\u5668\u4e0d\u652f\u63f4\u9801\u6846\u6642\uff0c\u6240\u986f\u793a\u7684\u8cc7\u8a0a
+NOSCRIPTTagInfo=\u63d0\u4f9b\u73fe\u884c\u700f\u89bd\u5668\u4e0d\u652f\u63f4 Scripting \u6642\uff0c\u6240\u986f\u793a\u7684\u8cc7\u8a0a
+OBJECTTagInfo=\u5b9a\u7fa9\u901a\u7528\u5167\u5d4c\u7269\u4ef6
+OLTagInfo=\u6392\u5e8f\u6e05\u55ae
+OPTGROUPTagInfo=\u9078\u9805\u7fa4\u7d44
+OPTIONTagInfo=\u53ef\u9078\u53d6\u7684\u9078\u9805
+PTagInfo=\u6bb5\u843d
+PARAMTagInfo=\u5177\u540d\u5167\u5bb9\u503c
+PRETagInfo=\u9810\u5148\u683c\u5f0f\u5316\u7684\u6587\u5b57
+QTagInfo=\u77ed\u7684\u5217\u5165\u5f15\u6587
+STagInfo=\u7528 strike-through \u6a23\u5f0f\u986f\u793a\u6587\u5b57
+SAMPTagInfo=\u7bc4\u4f8b\u7a0b\u5f0f\u8f38\u51fa\u3001Script \u7b49\u3002\u7528\u55ae\u8ddd\u5b57\u578b\u986f\u793a\u3002
+SCRIPTTagInfo=Script \u9673\u8ff0\u5f0f
+SELECTTagInfo=\u9078\u9805\u9078\u53d6\u5143
+SMALLTagInfo=\u7528\u5c0f\u5b57\u578b\u986f\u793a\u6587\u5b57
+SPANTagInfo=\u53ef\u7528\u4f86\u5b9a\u7fa9\u5167\u5bb9\u8a9e\u8a00\u6216\u6a23\u5f0f\u7684\u901a\u7528\u5132\u5b58\u5668\u3002
+STRIKETagInfo=\u7528 strike-through \u6a23\u5f0f\u986f\u793a\u6587\u5b57
+STRONGTagInfo=\u7279\u5225\u5f37\u8abf\u986f\u793a\u6587\u5b57\uff08\u901a\u5e38\u662f\u7c97\u9ad4\uff09
+STYLETagInfo=\u5b9a\u7fa9\u5167\u542b\u8cc7\u8a0a\u7684\u6a23\u5f0f
+SUBTagInfo=\u986f\u793a\u6210\u4e0b\u6a19
+SUPTagInfo=\u986f\u793a\u6210\u4e0a\u6a19
+TABLETagInfo=\u5b9a\u7fa9\u8868\u683c
+TBODYTagInfo=\u8868\u683c\u4e3b\u9ad4
+TDTagInfo=\u8868\u683c\u5167\u7684\u8cc7\u6599\u683c
+TEXTAREATagInfo=\u591a\u884c\u6587\u5b57\u6b04\u4f4d
+TFOOTTagInfo=\u8868\u683c\u6a19\u5e95
+THTagInfo=\u8868\u683c\u6a19\u982d\u8cc7\u6599\u683c
+THEADTagInfo=\u8868\u683c\u6a19\u982d
+TITLETagInfo=\u986f\u793a\u5728\u700f\u89bd\u5668\u6a19\u984c\u5217\u7684\u6587\u4ef6\u6a19\u984c
+TRTagInfo=\u8868\u683c\u5217
+TTTagInfo=\u7528\u6253\u5b57\u6a5f\u5b57\u9ad4\u6216\u55ae\u8ddd\u6587\u5b57\u6a23\u5f0f\u4f86\u986f\u793a\u6587\u5b57
+UTagInfo=\u7528\u9644\u52a0\u5e95\u7dda\u4f86\u986f\u793a\u6587\u5b57
+ULTagInfo=\u975e\u6392\u5e8f\u6e05\u55ae
+VARTagInfo=\u8b8a\u6578\u6216\u7a0b\u5f0f\u5f15\u6578\u7684\u5be6\u4f8b
+WBRTagInfo=\u5141\u8a31\u5728 <B>&lt;NOBR&gt;</B> \u6a19\u793a\u5167\u63db\u884c\u3002\u4e0d\u53d7 W3C HTML 4.01 \u652f\u63f4\u3002
diff --git a/bundles/org.eclipse.wst.html.core/dtds/wml11.dtd b/bundles/org.eclipse.wst.html.core/dtds/wml11.dtd
new file mode 100644
index 0000000000..09835504bc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/wml11.dtd
@@ -0,0 +1,355 @@
+<!--
+Wireless Markup Language (WML) Document Type Definition.
+
+Copyright Wireless Application Protocol Forum Ltd., 1998,1999.
+ All rights reserved.
+
+WML is an XML language. Typical usage:
+ <?xml version="1.0"?>
+ <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
+ "http://www.wapforum.org/DTD/wml_1.1.xml">
+ <wml>
+ ...
+ </wml>
+
+Terms and conditions of use are available from the Wireless
+Application Protocol Forum Ltd. web site at
+http://www.wapforum.org/docs/copyright.htm.
+-->
+
+<!ENTITY % length "CDATA"> <!-- [0-9]+ for pixels or [0-9]+"%" for
+ percentage length -->
+<!ENTITY % vdata "CDATA"> <!-- attribute value possibly containing
+ variable references -->
+<!ENTITY % HREF "%vdata;"> <!-- URI, URL or URN designating a hypertext
+ node. May contain variable references -->
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % number "NMTOKEN"> <!-- a number, with format [0-9]+ -->
+<!ENTITY % coreattrs "id ID #IMPLIED
+ class CDATA #IMPLIED">
+
+
+
+<!ENTITY % emph "em | strong | b | i | u | big | small">
+<!ENTITY % layout "br">
+
+<!ENTITY % text "#PCDATA | %emph;">
+
+<!-- flow covers "card-level" elements, such as text and images -->
+<!ENTITY % flow "%text; | %layout; | img | anchor | a | table">
+
+<!-- Task types -->
+<!ENTITY % task "go | prev | noop | refresh">
+
+<!-- Navigation and event elements -->
+<!ENTITY % navelmts "do | onevent">
+
+<!--================ Decks and Cards ================-->
+
+<!ELEMENT wml ( head?, template?, card+ )>
+<!ATTLIST wml
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!-- card intrinsic events -->
+<!ENTITY % cardev
+ "onenterforward %HREF; #IMPLIED
+ onenterbackward %HREF; #IMPLIED
+ ontimer %HREF; #IMPLIED"
+ >
+
+<!-- card field types -->
+<!ENTITY % fields "%flow; | input | select | fieldset">
+
+<!ELEMENT card (onevent*, timer?, (do | p)*)>
+<!ATTLIST card
+ title %vdata; #IMPLIED
+ newcontext %boolean; "false"
+ ordered %boolean; "true"
+ xml:lang NMTOKEN #IMPLIED
+ %cardev;
+ %coreattrs;
+ >
+
+<!--================ Event Bindings ================-->
+
+<!ELEMENT do (%task;)>
+<!ATTLIST do
+ type CDATA #REQUIRED
+ label %vdata; #IMPLIED
+ name NMTOKEN #IMPLIED
+ optional %boolean; "false"
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT onevent (%task;)>
+<!ATTLIST onevent
+ type CDATA #REQUIRED
+ %coreattrs;
+ >
+
+<!--================ Deck-level declarations ================-->
+
+<!ELEMENT head ( access | meta )+>
+<!ATTLIST head
+ %coreattrs;
+ >
+
+<!ELEMENT template (%navelmts;)*>
+<!ATTLIST template
+ %cardev;
+ %coreattrs;
+ >
+
+<!ELEMENT access EMPTY>
+<!ATTLIST access
+ domain CDATA #IMPLIED
+ path CDATA #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ forua %boolean; #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ %coreattrs;
+ >
+
+<!--================ Tasks ================-->
+
+<!ELEMENT go (postfield | setvar)*>
+<!ATTLIST go
+ href %HREF; #REQUIRED
+ sendreferer %boolean; "false"
+ method (post|get) "get"
+ accept-charset CDATA #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT prev (setvar)*>
+<!ATTLIST prev
+ %coreattrs;
+ >
+
+<!ELEMENT refresh (setvar)*>
+<!ATTLIST refresh
+ %coreattrs;
+ >
+
+<!ELEMENT noop EMPTY>
+<!ATTLIST noop
+ %coreattrs;
+ >
+
+<!--================ postfield ================-->
+
+<!ELEMENT postfield EMPTY>
+<!ATTLIST postfield
+ name %vdata; #REQUIRED
+ value %vdata; #REQUIRED
+ %coreattrs;
+ >
+
+<!--================ variables ================-->
+
+<!ELEMENT setvar EMPTY>
+<!ATTLIST setvar
+ name %vdata; #REQUIRED
+ value %vdata; #REQUIRED
+ %coreattrs;
+ >
+
+<!--================ Card Fields ================-->
+
+<!ELEMENT select (optgroup|option)+>
+<!ATTLIST select
+ title %vdata; #IMPLIED
+ name NMTOKEN #IMPLIED
+ value %vdata; #IMPLIED
+ iname NMTOKEN #IMPLIED
+ ivalue %vdata; #IMPLIED
+ multiple %boolean; "false"
+ tabindex %number; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT optgroup (optgroup|option)+ >
+<!ATTLIST optgroup
+ title %vdata; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT option (#PCDATA | onevent)*>
+<!ATTLIST option
+ value %vdata; #IMPLIED
+ title %vdata; #IMPLIED
+ onpick %HREF; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT input EMPTY>
+<!ATTLIST input
+ name NMTOKEN #REQUIRED
+ type (text|password) "text"
+ value %vdata; #IMPLIED
+ format CDATA #IMPLIED
+ emptyok %boolean; "false"
+ size %number; #IMPLIED
+ maxlength %number; #IMPLIED
+ tabindex %number; #IMPLIED
+ title %vdata; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT fieldset (%fields; | do)* >
+<!ATTLIST fieldset
+ title %vdata; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT timer EMPTY>
+<!ATTLIST timer
+ name NMTOKEN #IMPLIED
+ value %vdata; #REQUIRED
+ %coreattrs;
+ >
+
+<!--================ Images ================-->
+
+<!ENTITY % IAlign "(top|middle|bottom)" >
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ alt %vdata; #REQUIRED
+ src %HREF; #REQUIRED
+ localsrc %vdata; #IMPLIED
+ vspace %length; "0"
+ hspace %length; "0"
+ align %IAlign; "bottom"
+ height %length; #IMPLIED
+ width %length; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!--================ Anchor ================-->
+
+<!ELEMENT anchor ( #PCDATA | br | img | go | prev | refresh )*>
+<!ATTLIST anchor
+ title %vdata; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT a ( #PCDATA | br | img )*>
+<!ATTLIST a
+ href %HREF; #REQUIRED
+ title %vdata; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!--================ Tables ================-->
+
+<!ELEMENT table (tr)+>
+<!ATTLIST table
+ title %vdata; #IMPLIED
+ align CDATA #IMPLIED
+ columns %number; #REQUIRED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT tr (td)+>
+<!ATTLIST tr
+ %coreattrs;
+ >
+
+<!ELEMENT td ( %text; | %layout; | img | anchor | a )*>
+<!ATTLIST td
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!--================ Text layout and line breaks ================-->
+
+<!ELEMENT em (%flow;)*>
+<!ATTLIST em
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT strong (%flow;)*>
+<!ATTLIST strong
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT b (%flow;)*>
+<!ATTLIST b
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT i (%flow;)*>
+<!ATTLIST i
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT u (%flow;)*>
+<!ATTLIST u
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT big (%flow;)*>
+<!ATTLIST big
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT small (%flow;)*>
+<!ATTLIST small
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ENTITY % TAlign "(left|right|center)">
+<!ENTITY % WrapMode "(wrap|nowrap)" >
+<!ELEMENT p (%fields; | do)*>
+<!ATTLIST p
+ align %TAlign; "left"
+ mode %WrapMode; #IMPLIED
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ELEMENT br EMPTY>
+<!ATTLIST br
+ xml:lang NMTOKEN #IMPLIED
+ %coreattrs;
+ >
+
+<!ENTITY quot "&#34;"> <!-- quotation mark -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand -->
+<!ENTITY apos "&#39;"> <!-- apostrophe -->
+<!ENTITY lt "&#38;#60;"> <!-- less than -->
+<!ENTITY gt "&#62;"> <!-- greater than -->
+<!ENTITY nbsp "&#160;"> <!-- non-breaking space -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen (discretionary hyphen) -->
+
+<!--
+Copyright Wireless Application Protocol Forum Ltd., 1998,1999.
+ All rights reserved.
+-->
diff --git a/bundles/org.eclipse.wst.html.core/dtds/wml13.dtd b/bundles/org.eclipse.wst.html.core/dtds/wml13.dtd
new file mode 100644
index 0000000000..1b8a49b50e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/wml13.dtd
@@ -0,0 +1,4 @@
+<!-- Wireless Markup Language (WML) Document Type Definition. WML is an XML language. Typical usage: <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd"> <wml> ... </wml> Terms and conditions of use are available from the Wireless Application Protocol Forum Ltd. web site at http://www.wapforum.org/docs/copyright.htm.
+-->
+ <!ENTITY % length "CDATA"> <!-- [0-9]+ for pixels or [0-9]+"%" for
+percentage length --> <!ENTITY % vdata "CDATA"> <!-- attribute value possibly containing variable references --> <!ENTITY % HREF "%vdata;"> <!-- URI, URL or URN designating a hypertext node. May contain variable references --> <!ENTITY % boolean "(true|false)"> <!ENTITY % number "NMTOKEN"> <!-- a number, with format [0-9]+ --> <!ENTITY % coreattrs "id ID #IMPLIED class CDATA #IMPLIED"> <!ENTITY % ContentType "%vdata;"> <!-- media type. May contain variable references --> <!ENTITY % emph "em | strong |b |i |u |big |small"> <!ENTITY % layout "br"> <!ENTITY % text "#PCDATA | %emph;"> <!-- flow covers "card-level" elements, such as text and images --> <!ENTITY % flow "%text; | %layout; | img | anchor |a |table"> <!-- Task types --> <!ENTITY % task "go | prev | noop | refresh"> <!-- Navigation and event elements --> <!ENTITY % navelmts "do | onevent"> <!--================ Decks and Cards ================--> <!ELEMENT wml ( head?, template?, card+ )> <!ATTLIST wml xml:lang NMTOKEN #IMPLIED %coreattrs; > <!-- card intrinsic events --> <!ENTITY % cardev "onenterforward %HREF; #IMPLIED onenterbackward %HREF; #IMPLIED ontimer %HREF; #IMPLIED" > <!-- card field types --> <!ENTITY % fields "%flow; | input | select | fieldset"> <!ELEMENT card (onevent*, timer?, (do | p | pre)*)> <!ATTLIST card title %vdata; #IMPLIED newcontext %boolean; "false" ordered %boolean; "true" xml:lang NMTOKEN #IMPLIED %cardev; %coreattrs; > <!--================ Event Bindings ================--> <!ELEMENT do (%task;)> <!ATTLIST do type CDATA #REQUIRED label %vdata; #IMPLIED name NMTOKEN #IMPLIED optional %boolean; "false" xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT onevent (%task;)> <!ATTLIST onevent type CDATA #REQUIRED %coreattrs; > <!--================ Deck-level declarations ================--> <!ELEMENT head ( access | meta )+> <!ATTLIST head %coreattrs; > <!ELEMENT template (%navelmts;)*> <!ATTLIST template %cardev; %coreattrs; > <!ELEMENT access EMPTY> <!ATTLIST access domain CDATA #IMPLIED path CDATA #IMPLIED %coreattrs; > <!ELEMENT meta EMPTY> <!ATTLIST meta http-equiv CDATA #IMPLIED name CDATA #IMPLIED forua %boolean; "false" content CDATA #REQUIRED scheme CDATA #IMPLIED %coreattrs; > <!--================ Tasks ================--> <!ENTITY % cache-control "(no-cache)" > <!ELEMENT go (postfield | setvar)*> <!ATTLIST go href %HREF; #REQUIRED sendreferer %boolean; "false" method (post|get) "get" enctype %ContentType; "application/x-www-form-urlencoded" cache-control %cache-control; #IMPLIED accept-charset CDATA #IMPLIED %coreattrs; > <!ELEMENT prev (setvar)*> <!ATTLIST prev %coreattrs; > <!ELEMENT refresh (setvar)*> <!ATTLIST refresh %coreattrs; > <!ELEMENT noop EMPTY> <!ATTLIST noop %coreattrs; > <!--================ postfield ================--> <!ELEMENT postfield EMPTY> <!ATTLIST postfield name %vdata; #REQUIRED value %vdata; #REQUIRED %coreattrs; > <!--================ variables ================--> <!ELEMENT setvar EMPTY> <!ATTLIST setvar name %vdata; #REQUIRED value %vdata; #REQUIRED %coreattrs; > <!--================ Card Fields ================--> <!ELEMENT select (optgroup|option)+> <!ATTLIST select title %vdata; #IMPLIED name NMTOKEN #IMPLIED value %vdata; #IMPLIED iname NMTOKEN #IMPLIED ivalue %vdata; #IMPLIED multiple %boolean; "false" tabindex %number; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT optgroup (optgroup|option)+ > <!ATTLIST optgroup title %vdata; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT option (#PCDATA | onevent)*> <!ATTLIST option value %vdata; #IMPLIED title %vdata; #IMPLIED onpick %HREF; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT input EMPTY> <!ATTLIST input name NMTOKEN #REQUIRED type (text|password) "text" value %vdata; #IMPLIED format CDATA #IMPLIED emptyok %boolean; #IMPLIED size %number; #IMPLIED maxlength %number; #IMPLIED tabindex %number; #IMPLIED title %vdata; #IMPLIED accesskey %vdata; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT fieldset (%fields; | do)* > <!ATTLIST fieldset title %vdata; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT timer EMPTY> <!ATTLIST timer name NMTOKEN #IMPLIED value %vdata; #REQUIRED %coreattrs; > <!--================ Images ================--> <!ENTITY % IAlign "(top|middle|bottom)" > <!ELEMENT img EMPTY> <!ATTLIST img alt %vdata; #REQUIRED src %HREF; #REQUIRED localsrc %vdata; #IMPLIED vspace %length; "0" hspace %length; "0" align %IAlign; "bottom" height %length; #IMPLIED width %length; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!--================ Anchor ================--> <!ELEMENT anchor ( #PCDATA | br | img | go | prev | refresh )*> <!ATTLIST anchor title %vdata; #IMPLIED accesskey %vdata; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT a ( #PCDATA | br | img )*> <!ATTLIST a href %HREF; #REQUIRED title %vdata; #IMPLIED accesskey %vdata; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!--================ Tables ================--> <!ELEMENT table (tr)+> <!ATTLIST table title %vdata; #IMPLIED align CDATA #IMPLIED columns %number; #REQUIRED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT tr (td)+> <!ATTLIST tr %coreattrs; > <!ELEMENT td ( %text; | %layout; | img | anchor |a )*> <!ATTLIST td xml:lang NMTOKEN #IMPLIED %coreattrs; > <!--================ Text layout and line breaks ================--> <!ELEMENT em (%flow;)*> <!ATTLIST em xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT strong (%flow;)*> <!ATTLIST strong xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT b (%flow;)*> <!ATTLIST b xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT i (%flow;)*> <!ATTLIST i xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT u (%flow;)*> <!ATTLIST u xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT big (%flow;)*> <!ATTLIST big xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT small (%flow;)*> <!ATTLIST small xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ENTITY % TAlign "(left|right|center)"> <!ENTITY % WrapMode "(wrap|nowrap)" > <!ELEMENT p (%fields; | do)*> <!ATTLIST p align %TAlign; "left" mode %WrapMode; #IMPLIED xml:lang NMTOKEN #IMPLIED %coreattrs; > <!ELEMENT br EMPTY> <!ATTLIST br %coreattrs; > <!ELEMENT pre (#PCDATA | a | anchor | do | u | br | i | b | em | strong | input | select )*> <!ATTLIST pre xml:space CDATA #FIXED "preserve" %coreattrs; > <!ENTITY quot "&#34;"> <!-- quotation mark --> <!ENTITY amp "&#38;#38;"> <!-- ampersand --> <!ENTITY apos "&#39;"> <!-- apostrophe --> <!ENTITY lt "&#38;#60;"> <!-- less than --> <!ENTITY gt "&#62;"> <!-- greater than --> <!ENTITY nbsp "&#160;"> <!-- non-breaking space --> <!ENTITY shy "&#173;"> <!-- soft hyphen (discretionary hyphen) --> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml-basic10-f.dtd b/bundles/org.eclipse.wst.html.core/dtds/xhtml-basic10-f.dtd
new file mode 100644
index 0000000000..994406d58c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml-basic10-f.dtd
@@ -0,0 +1,3086 @@
+<!-- XHTML Basic 1.0 DTD ...................................................... -->
+<!-- file: xhtml-basic10.dtd -->
+
+<!-- XHTML Basic 1.0 DTD
+
+ This is XHTML Basic, a proper subset of XHTML.
+
+ The Extensible HyperText Markup Language (XHTML)
+ Copyright 1998-2000 World Wide Web Consortium
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University).
+ All Rights Reserved.
+
+ Permission to use, copy, modify and distribute the XHTML Basic DTD
+ and its accompanying documentation for any purpose and without fee is
+ hereby granted in perpetuity, provided that the above copyright notice
+ and this paragraph appear in all copies. The copyright holders make
+ no representation about the suitability of the DTD for any purpose.
+
+ It is provided "as is" without expressed or implied warranty.
+
+ Editors: Murray M. Altheim <mailto:altheim@eng.sun.com>
+ Peter Stark <mailto:Peter.Stark@ecs.ericsson.se>
+ Revision: $Id: xhtml-basic10.dtd,v 2.13 2000/12/18 12:56:23 mimasa Exp $ SMI
+
+-->
+<!-- This is the driver file for version 1.0 of the XHTML Basic DTD.
+
+ This DTD is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC: "-//W3C//DTD XHTML Basic 1.0//EN"
+ SYSTEM: "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"
+-->
+<!ENTITY % XHTML.version "-//W3C//DTD XHTML Basic 1.0//EN" >
+
+<!-- Use this URI to identify the default namespace:
+
+ "http://www.w3.org/1999/xhtml"
+
+ See the Qualified Names module for information
+ on the use of namespace prefixes in the DTD.
+-->
+<!ENTITY % NS.prefixed "IGNORE" >
+<!ENTITY % XHTML.prefix "" >
+
+<!-- Reserved for use with the XLink namespace:
+-->
+<!ENTITY % XLINK.xmlns "" >
+<!ENTITY % XLINK.xmlns.attrib "" >
+
+<!-- For example, if you are using XHTML Basic 1.0 directly, use
+ the FPI in the DOCTYPE declaration, with the xmlns attribute
+ on the document element to identify the default namespace:
+
+ <?xml version="1.0"?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
+ "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd" >
+ <html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en" >
+ ...
+ </html>
+-->
+
+<!-- reserved for future use with document profiles -->
+<!ENTITY % XHTML.profile "" >
+
+<!-- Bidirectional Text features
+ This feature-test entity is used to declare elements
+ and attributes used for bidirectional text support.
+-->
+<!ENTITY % XHTML.bidi "IGNORE" >
+
+<?doc type="doctype" role="title" { XHTML Basic 1.0 } ?>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+
+<!ENTITY % xhtml-events.module "IGNORE" >
+<!ENTITY % xhtml-bdo.module "%XHTML.bidi;" >
+
+<!ENTITY % xhtml-model.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Basic 1.0 Document Model 1.0//EN"
+ "xhtml-basic10-model-1.mod" >
+
+<!ENTITY % xhtml-framework.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
+ "xhtml-framework-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Modular Framework Module ...................................... -->
+<!-- file: xhtml-framework-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-framework-1.mod,v 1.12 2000/12/19 10:17:28 mimasa Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-framework-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Modular Framework
+
+ This required module instantiates the modules needed
+ to support the XHTML modularization model, including:
+
+ + notations
+ + datatypes
+ + namespace-qualified names
+ + common attributes
+ + document model
+ + character entities
+
+ The Intrinsic Events module is ignored by default but
+ occurs in this module because it must be instantiated
+ prior to Attributes but after Datatypes.
+-->
+
+<!ENTITY % xhtml-arch.module "INCLUDE" >
+<![%xhtml-arch.module;[
+<!ENTITY % xhtml-arch.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Architecture 1.0//EN"
+ "xhtml-arch-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Base Architecture Module ...................................... -->
+<!-- file: xhtml-arch-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-arch-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Architecture 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-arch-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- This optional module includes declarations that enable XHTML to be used
+ as a base architecture according to the 'Architectural Forms Definition
+ Requirements' (Annex A.3, ISO/IEC 10744, 2nd edition). For more information
+ on use of architectural forms, see the HyTime web site at:
+
+ http://www.hytime.org/
+-->
+
+<?IS10744 ArcBase xhtml ?>
+
+<!NOTATION xhtml PUBLIC "-//W3C//NOTATION AFDR ARCBASE XHTML 1.1//EN" >
+
+<!-- Entity declaration for associated Architectural DTD
+-->
+<!ENTITY xhtml-arch.dtd
+ PUBLIC "-//W3C//DTD XHTML Architecture 1.1//EN"
+ "xhtml11-arch.dtd" >
+
+<?IS10744:arch xhtml
+ public-id = "-//W3C//NOTATION AFDR ARCBASE XHTML 1.1//EN"
+ dtd-public-id = "-//W3C//DTD XHTML 1.1//EN"
+ dtd-system-id = "xhtml11.dtd"
+ doc-elem-form = "html"
+ form-att = "html"
+ renamer-att = "htnames"
+ suppressor-att = "htsupp"
+ data-ignore-att = "htign"
+ auto = "ArcAuto"
+ options = "HtModReq HtModOpt"
+ HtModReq = "Framework Text Hypertext Lists Structure"
+ HtModOpt = "Standard"
+?>
+
+<!-- end of xhtml-arch-1.mod -->
+]]>
+
+<!ENTITY % xhtml-notations.module "INCLUDE" >
+<![%xhtml-notations.module;[
+<!ENTITY % xhtml-notations.mod
+ PUBLIC "-//W3C//NOTATIONS XHTML Notations 1.0//EN"
+ "xhtml-notations-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Notations Module .............................................. -->
+<!-- file: xhtml-notations-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-notations-1.mod,v 1.8 2000/10/16 21:15:23 radams Exp $
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//NOTATIONS XHTML Notations 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-notations-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Notations
+
+ defines the following notations, many of these imported from
+ other specifications and standards. When an existing FPI is
+ known, it is incorporated here.
+-->
+
+<!-- XML Notations ..................................... -->
+<!-- SGML and XML Notations ............................ -->
+
+<!-- W3C XML 1.0 Recommendation -->
+<!NOTATION w3c-xml
+ PUBLIC "ISO 8879//NOTATION Extensible Markup Language (XML) 1.0//EN" >
+
+<!-- XML 1.0 CDATA -->
+<!NOTATION cdata
+ PUBLIC "-//W3C//NOTATION XML 1.0: CDATA//EN" >
+
+<!-- SGML Formal Public Identifiers -->
+<!NOTATION fpi
+ PUBLIC "ISO 8879:1986//NOTATION Formal Public Identifier//EN" >
+
+<!-- XHTML Notations ................................... -->
+
+<!-- Length defined for cellpadding/cellspacing -->
+
+<!-- nn for pixels or nn% for percentage length -->
+<!NOTATION length
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Length//EN" >
+
+<!-- space-separated list of link types -->
+<!NOTATION linkTypes
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: LinkTypes//EN" >
+
+<!-- single or comma-separated list of media descriptors -->
+<!NOTATION mediaDesc
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: MediaDesc//EN" >
+
+<!-- pixel, percentage, or relative -->
+<!NOTATION multiLength
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: MultiLength//EN" >
+
+<!-- one or more digits (NUMBER) -->
+<!NOTATION number
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Number//EN" >
+
+<!-- integer representing length in pixels -->
+<!NOTATION pixels
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Pixels//EN" >
+
+<!-- script expression -->
+<!NOTATION script
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Script//EN" >
+
+<!-- textual content -->
+<!NOTATION text
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Text//EN" >
+
+<!-- Imported Notations ................................ -->
+
+<!-- a single character from [ISO10646] -->
+<!NOTATION character
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Character//EN" >
+
+<!-- a character encoding, as per [RFC2045] -->
+<!NOTATION charset
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Charset//EN" >
+
+<!-- a space separated list of character encodings, as per [RFC2045] -->
+<!NOTATION charsets
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Charsets//EN" >
+
+<!-- media type, as per [RFC2045] -->
+<!NOTATION contentType
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: ContentType//EN" >
+
+<!-- comma-separated list of media types, as per [RFC2045] -->
+<!NOTATION contentTypes
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: ContentTypes//EN" >
+
+<!-- date and time information. ISO date format -->
+<!NOTATION datetime
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Datetime//EN" >
+
+<!-- a language code, as per [RFC1766] -->
+<!NOTATION languageCode
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: LanguageCode//EN" >
+
+<!-- a Uniform Resource Identifier, see [URI] -->
+<!NOTATION uri
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: URI//EN" >
+
+<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
+<!NOTATION uris
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: URIs//EN" >
+
+<!-- end of xhtml-notations-1.mod -->
+]]>
+
+<!ENTITY % xhtml-datatypes.module "INCLUDE" >
+<![%xhtml-datatypes.module;[
+<!ENTITY % xhtml-datatypes.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
+ "xhtml-datatypes-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Datatypes Module .............................................. -->
+<!-- file: xhtml-datatypes-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-datatypes-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-datatypes-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Datatypes
+
+ defines containers for the following datatypes, many of
+ these imported from other specifications and standards.
+-->
+
+<!-- Length defined for cellpadding/cellspacing -->
+
+<!-- nn for pixels or nn% for percentage length -->
+<!ENTITY % Length.datatype "CDATA" >
+
+<!-- space-separated list of link types -->
+<!ENTITY % LinkTypes.datatype "NMTOKENS" >
+
+<!-- single or comma-separated list of media descriptors -->
+<!ENTITY % MediaDesc.datatype "CDATA" >
+
+<!-- pixel, percentage, or relative -->
+<!ENTITY % MultiLength.datatype "CDATA" >
+
+<!-- one or more digits (NUMBER) -->
+<!ENTITY % Number.datatype "CDATA" >
+
+<!-- integer representing length in pixels -->
+<!ENTITY % Pixels.datatype "CDATA" >
+
+<!-- script expression -->
+<!ENTITY % Script.datatype "CDATA" >
+
+<!-- textual content -->
+<!ENTITY % Text.datatype "CDATA" >
+
+<!-- Imported Datatypes ................................ -->
+
+<!-- a single character from [ISO10646] -->
+<!ENTITY % Character.datatype "CDATA" >
+
+<!-- a character encoding, as per [RFC2045] -->
+<!ENTITY % Charset.datatype "CDATA" >
+
+<!-- a space separated list of character encodings, as per [RFC2045] -->
+<!ENTITY % Charsets.datatype "CDATA" >
+
+<!-- media type, as per [RFC2045] -->
+<!ENTITY % ContentType.datatype "CDATA" >
+
+<!-- comma-separated list of media types, as per [RFC2045] -->
+<!ENTITY % ContentTypes.datatype "CDATA" >
+
+<!-- date and time information. ISO date format -->
+<!ENTITY % Datetime.datatype "CDATA" >
+
+<!-- formal public identifier, as per [ISO8879] -->
+<!ENTITY % FPI.datatype "CDATA" >
+
+<!-- a language code, as per [RFC1766] -->
+<!ENTITY % LanguageCode.datatype "NMTOKEN" >
+
+<!-- a Uniform Resource Identifier, see [URI] -->
+<!ENTITY % URI.datatype "CDATA" >
+
+<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
+<!ENTITY % URIs.datatype "CDATA" >
+
+<!-- end of xhtml-datatypes-1.mod -->
+]]>
+
+<!-- placeholder for XLink support module -->
+<!ENTITY % xhtml-xlink.mod "" >
+
+
+<!ENTITY % xhtml-qname.module "INCLUDE" >
+<![%xhtml-qname.module;[
+<!ENTITY % xhtml-qname.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
+ "xhtml-qname-1.mod" >
+<!-- ....................................................................... -->
+<!-- XHTML Qname Module ................................................... -->
+<!-- file: xhtml-qname-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-qname-1.mod,v 1.14 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-qname-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- XHTML Qname (Qualified Name) Module
+
+ This module is contained in two parts, labeled Section 'A' and 'B':
+
+ Section A declares parameter entities to support namespace-
+ qualified names, namespace declarations, and name prefixing
+ for XHTML and extensions.
+
+ Section B declares parameter entities used to provide
+ namespace-qualified names for all XHTML element types:
+
+ %applet.qname; the xmlns-qualified name for <applet>
+ %base.qname; the xmlns-qualified name for <base>
+ ...
+
+ XHTML extensions would create a module similar to this one.
+ Included in the XHTML distribution is a template module
+ ('template-qname-1.mod') suitable for this purpose.
+-->
+
+<!-- Section A: XHTML XML Namespace Framework :::::::::::::::::::: -->
+
+<!-- 1. Declare a %XHTML.prefixed; conditional section keyword, used
+ to activate namespace prefixing. The default value should
+ inherit '%NS.prefixed;' from the DTD driver, so that unless
+ overridden, the default behaviour follows the overall DTD
+ prefixing scheme.
+-->
+<!ENTITY % NS.prefixed "IGNORE" >
+<!ENTITY % XHTML.prefixed "%NS.prefixed;" >
+
+<!-- 2. Declare a parameter entity (eg., %XHTML.xmlns;) containing
+ the URI reference used to identify the XHTML namespace:
+-->
+<!ENTITY % XHTML.xmlns "http://www.w3.org/1999/xhtml" >
+
+<!-- 3. Declare parameter entities (eg., %XHTML.prefix;) containing
+ the default namespace prefix string(s) to use when prefixing
+ is enabled. This may be overridden in the DTD driver or the
+ internal subset of an document instance. If no default prefix
+ is desired, this may be declared as an empty string.
+
+ NOTE: As specified in [XMLNAMES], the namespace prefix serves
+ as a proxy for the URI reference, and is not in itself significant.
+-->
+<!ENTITY % XHTML.prefix "" >
+
+<!-- 4. Declare parameter entities (eg., %XHTML.pfx;) containing the
+ colonized prefix(es) (eg., '%XHTML.prefix;:') used when
+ prefixing is active, an empty string when it is not.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % XHTML.pfx "%XHTML.prefix;:" >
+]]>
+<!ENTITY % XHTML.pfx "" >
+
+<!-- declare qualified name extensions here ............ -->
+<!ENTITY % xhtml-qname-extra.mod "" >
+
+
+<!-- 5. The parameter entity %XHTML.xmlns.extra.attrib; may be
+ redeclared to contain any non-XHTML namespace declaration
+ attributes for namespaces embedded in XHTML. The default
+ is an empty string. XLink should be included here if used
+ in the DTD.
+-->
+<!ENTITY % XHTML.xmlns.extra.attrib "" >
+
+<!-- The remainder of Section A is only followed in XHTML, not extensions. -->
+
+<!-- Declare a parameter entity %NS.decl.attrib; containing
+ all XML Namespace declarations used in the DTD, plus the
+ xmlns declaration for XHTML, its form dependent on whether
+ prefixing is active.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % NS.decl.attrib
+ "xmlns:%XHTML.prefix; %URI.datatype; #FIXED '%XHTML.xmlns;'
+ %XHTML.xmlns.extra.attrib;"
+>
+]]>
+<!ENTITY % NS.decl.attrib
+ "%XHTML.xmlns.extra.attrib;"
+>
+
+<!-- This is a placeholder for future XLink support.
+-->
+<!ENTITY % XLINK.xmlns.attrib "" >
+
+<!-- Declare a parameter entity %NS.decl.attrib; containing all
+ XML namespace declaration attributes used by XHTML, including
+ a default xmlns attribute when prefixing is inactive.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % XHTML.xmlns.attrib
+ "%NS.decl.attrib;
+ %XLINK.xmlns.attrib;"
+>
+]]>
+<!ENTITY % XHTML.xmlns.attrib
+ "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;'
+ %XLINK.xmlns.attrib;"
+>
+
+<!-- placeholder for qualified name redeclarations -->
+<!ENTITY % xhtml-qname.redecl "" >
+
+
+<!-- Section B: XHTML Qualified Names ::::::::::::::::::::::::::::: -->
+
+<!-- 6. This section declares parameter entities used to provide
+ namespace-qualified names for all XHTML element types.
+-->
+
+<!-- module: xhtml-applet-1.mod -->
+<!ENTITY % applet.qname "%XHTML.pfx;applet" >
+
+<!-- module: xhtml-base-1.mod -->
+<!ENTITY % base.qname "%XHTML.pfx;base" >
+
+<!-- module: xhtml-bdo-1.mod -->
+<!ENTITY % bdo.qname "%XHTML.pfx;bdo" >
+
+<!-- module: xhtml-blkphras-1.mod -->
+<!ENTITY % address.qname "%XHTML.pfx;address" >
+<!ENTITY % blockquote.qname "%XHTML.pfx;blockquote" >
+<!ENTITY % pre.qname "%XHTML.pfx;pre" >
+<!ENTITY % h1.qname "%XHTML.pfx;h1" >
+<!ENTITY % h2.qname "%XHTML.pfx;h2" >
+<!ENTITY % h3.qname "%XHTML.pfx;h3" >
+<!ENTITY % h4.qname "%XHTML.pfx;h4" >
+<!ENTITY % h5.qname "%XHTML.pfx;h5" >
+<!ENTITY % h6.qname "%XHTML.pfx;h6" >
+
+<!-- module: xhtml-blkpres-1.mod -->
+<!ENTITY % hr.qname "%XHTML.pfx;hr" >
+
+<!-- module: xhtml-blkstruct-1.mod -->
+<!ENTITY % div.qname "%XHTML.pfx;div" >
+<!ENTITY % p.qname "%XHTML.pfx;p" >
+
+<!-- module: xhtml-edit-1.mod -->
+<!ENTITY % ins.qname "%XHTML.pfx;ins" >
+<!ENTITY % del.qname "%XHTML.pfx;del" >
+
+<!-- module: xhtml-form-1.mod -->
+<!ENTITY % form.qname "%XHTML.pfx;form" >
+<!ENTITY % label.qname "%XHTML.pfx;label" >
+<!ENTITY % input.qname "%XHTML.pfx;input" >
+<!ENTITY % select.qname "%XHTML.pfx;select" >
+<!ENTITY % optgroup.qname "%XHTML.pfx;optgroup" >
+<!ENTITY % option.qname "%XHTML.pfx;option" >
+<!ENTITY % textarea.qname "%XHTML.pfx;textarea" >
+<!ENTITY % fieldset.qname "%XHTML.pfx;fieldset" >
+<!ENTITY % legend.qname "%XHTML.pfx;legend" >
+<!ENTITY % button.qname "%XHTML.pfx;button" >
+
+<!-- module: xhtml-hypertext-1.mod -->
+<!ENTITY % a.qname "%XHTML.pfx;a" >
+
+<!-- module: xhtml-image-1.mod -->
+<!ENTITY % img.qname "%XHTML.pfx;img" >
+
+<!-- module: xhtml-inlphras-1.mod -->
+<!ENTITY % abbr.qname "%XHTML.pfx;abbr" >
+<!ENTITY % acronym.qname "%XHTML.pfx;acronym" >
+<!ENTITY % cite.qname "%XHTML.pfx;cite" >
+<!ENTITY % code.qname "%XHTML.pfx;code" >
+<!ENTITY % dfn.qname "%XHTML.pfx;dfn" >
+<!ENTITY % em.qname "%XHTML.pfx;em" >
+<!ENTITY % kbd.qname "%XHTML.pfx;kbd" >
+<!ENTITY % q.qname "%XHTML.pfx;q" >
+<!ENTITY % samp.qname "%XHTML.pfx;samp" >
+<!ENTITY % strong.qname "%XHTML.pfx;strong" >
+<!ENTITY % var.qname "%XHTML.pfx;var" >
+
+<!-- module: xhtml-inlpres-1.mod -->
+<!ENTITY % b.qname "%XHTML.pfx;b" >
+<!ENTITY % big.qname "%XHTML.pfx;big" >
+<!ENTITY % i.qname "%XHTML.pfx;i" >
+<!ENTITY % small.qname "%XHTML.pfx;small" >
+<!ENTITY % sub.qname "%XHTML.pfx;sub" >
+<!ENTITY % sup.qname "%XHTML.pfx;sup" >
+<!ENTITY % tt.qname "%XHTML.pfx;tt" >
+
+<!-- module: xhtml-inlstruct-1.mod -->
+<!ENTITY % br.qname "%XHTML.pfx;br" >
+<!ENTITY % span.qname "%XHTML.pfx;span" >
+
+<!-- module: xhtml-ismap-1.mod (also csismap, ssismap) -->
+<!ENTITY % map.qname "%XHTML.pfx;map" >
+<!ENTITY % area.qname "%XHTML.pfx;area" >
+
+<!-- module: xhtml-link-1.mod -->
+<!ENTITY % link.qname "%XHTML.pfx;link" >
+
+<!-- module: xhtml-list-1.mod -->
+<!ENTITY % dl.qname "%XHTML.pfx;dl" >
+<!ENTITY % dt.qname "%XHTML.pfx;dt" >
+<!ENTITY % dd.qname "%XHTML.pfx;dd" >
+<!ENTITY % ol.qname "%XHTML.pfx;ol" >
+<!ENTITY % ul.qname "%XHTML.pfx;ul" >
+<!ENTITY % li.qname "%XHTML.pfx;li" >
+
+<!-- module: xhtml-meta-1.mod -->
+<!ENTITY % meta.qname "%XHTML.pfx;meta" >
+
+<!-- module: xhtml-param-1.mod -->
+<!ENTITY % param.qname "%XHTML.pfx;param" >
+
+<!-- module: xhtml-object-1.mod -->
+<!ENTITY % object.qname "%XHTML.pfx;object" >
+
+<!-- module: xhtml-script-1.mod -->
+<!ENTITY % script.qname "%XHTML.pfx;script" >
+<!ENTITY % noscript.qname "%XHTML.pfx;noscript" >
+
+<!-- module: xhtml-struct-1.mod -->
+<!ENTITY % html.qname "%XHTML.pfx;html" >
+<!ENTITY % head.qname "%XHTML.pfx;head" >
+<!ENTITY % title.qname "%XHTML.pfx;title" >
+<!ENTITY % body.qname "%XHTML.pfx;body" >
+
+<!-- module: xhtml-style-1.mod -->
+<!ENTITY % style.qname "%XHTML.pfx;style" >
+
+<!-- module: xhtml-table-1.mod -->
+<!ENTITY % table.qname "%XHTML.pfx;table" >
+<!ENTITY % caption.qname "%XHTML.pfx;caption" >
+<!ENTITY % thead.qname "%XHTML.pfx;thead" >
+<!ENTITY % tfoot.qname "%XHTML.pfx;tfoot" >
+<!ENTITY % tbody.qname "%XHTML.pfx;tbody" >
+<!ENTITY % colgroup.qname "%XHTML.pfx;colgroup" >
+<!ENTITY % col.qname "%XHTML.pfx;col" >
+<!ENTITY % tr.qname "%XHTML.pfx;tr" >
+<!ENTITY % th.qname "%XHTML.pfx;th" >
+<!ENTITY % td.qname "%XHTML.pfx;td" >
+
+
+<!-- Provisional XHTML 2.0 Qualified Names ...................... -->
+
+<!-- module: xhtml-image-2.mod -->
+<!ENTITY % alt.qname "%XHTML.pfx;alt" >
+
+<!-- end of xhtml-qname-1.mod -->
+]]>
+
+<!ENTITY % xhtml-events.module "IGNORE" >
+<![%xhtml-events.module;[
+<!ENTITY % xhtml-events.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Intrinsic Events 1.0//EN"
+ "xhtml-events-1.mod" >
+%xhtml-events.mod;]]>
+
+<!ENTITY % xhtml-attribs.module "INCLUDE" >
+<![%xhtml-attribs.module;[
+<!ENTITY % xhtml-attribs.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Common Attributes 1.0//EN"
+ "xhtml-attribs-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Common Attributes Module ...................................... -->
+<!-- file: xhtml-attribs-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-attribs-1.mod,v 1.13 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Common Attributes 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-attribs-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Common Attributes
+
+ This module declares many of the common attributes for the XHTML DTD.
+ %NS.decl.attrib; is declared in the XHTML Qname module.
+-->
+
+<!ENTITY % id.attrib
+ "id ID #IMPLIED"
+>
+
+<!ENTITY % class.attrib
+ "class NMTOKENS #IMPLIED"
+>
+
+<!ENTITY % title.attrib
+ "title %Text.datatype; #IMPLIED"
+>
+
+<!ENTITY % Core.extra.attrib "" >
+
+<!ENTITY % Core.attrib
+ "%XHTML.xmlns.attrib;
+ %id.attrib;
+ %class.attrib;
+ %title.attrib;
+ %Core.extra.attrib;"
+>
+
+<!ENTITY % lang.attrib
+ "xml:lang %LanguageCode.datatype; #IMPLIED"
+>
+
+<![%XHTML.bidi;[
+<!ENTITY % dir.attrib
+ "dir ( ltr | rtl ) #IMPLIED"
+>
+
+<!ENTITY % I18n.attrib
+ "%dir.attrib;
+ %lang.attrib;"
+>
+
+]]>
+<!ENTITY % I18n.attrib
+ "%lang.attrib;"
+>
+
+<!ENTITY % Common.extra.attrib "" >
+
+<!-- intrinsic event attributes declared previously
+-->
+<!ENTITY % Events.attrib "" >
+
+<!ENTITY % Common.attrib
+ "%Core.attrib;
+ %I18n.attrib;
+ %Events.attrib;
+ %Common.extra.attrib;"
+>
+
+<!-- end of xhtml-attribs-1.mod -->
+]]>
+
+<!-- placeholder for content model redeclarations -->
+<!ENTITY % xhtml-model.redecl "" >
+
+
+<!ENTITY % xhtml-model.module "INCLUDE" >
+<![%xhtml-model.module;[
+<!-- instantiate the Document Model module declared in the DTD driver
+-->
+<!-- ....................................................................... -->
+<!-- XHTML Basic 1.0 Document Model Module .................................... -->
+<!-- file: xhtml-basic10-model-1.mod
+
+ This is XHTML Basic, a proper subset of XHTML.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-basic10-model-1.mod,v 2.8 2000/11/03 14:28:25 mimasa Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Basic 1.0 Document Model 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-basic/xhtml-basic10-model-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- XHTML Basic Document Model
+
+ This module describes the groupings of elements that make up
+ common content models for XHTML elements.
+-->
+
+<!-- Optional Elements in head .............. -->
+
+<!ENTITY % HeadOpts.mix
+ "( %meta.qname; | %link.qname; | %object.qname; )*" >
+
+<!-- Miscellaneous Elements ................. -->
+
+<!ENTITY % Misc.class "" >
+
+<!-- Inline Elements ........................ -->
+
+<!ENTITY % InlStruct.class "%br.qname; | %span.qname;" >
+
+<!ENTITY % InlPhras.class
+ "| %em.qname; | %strong.qname; | %dfn.qname; | %code.qname;
+ | %samp.qname; | %kbd.qname; | %var.qname; | %cite.qname;
+ | %abbr.qname; | %acronym.qname; | %q.qname;" >
+
+<!ENTITY % InlPres.class "" >
+
+<!ENTITY % I18n.class "" >
+
+<!ENTITY % Anchor.class "| %a.qname;" >
+
+<!ENTITY % InlSpecial.class "| %img.qname; | %object.qname;" >
+
+<!ENTITY % InlForm.class
+ "| %input.qname; | %select.qname; | %textarea.qname;
+ | %label.qname;"
+>
+
+<!ENTITY % Inline.extra "" >
+
+<!ENTITY % Inline.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %Anchor.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Inline.extra;"
+>
+
+<!ENTITY % InlNoAnchor.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Inline.extra;"
+>
+
+<!ENTITY % InlNoAnchor.mix
+ "%InlNoAnchor.class;
+ %Misc.class;"
+>
+
+<!ENTITY % Inline.mix
+ "%Inline.class;
+ %Misc.class;"
+>
+
+<!-- Block Elements ......................... -->
+
+<!ENTITY % Heading.class
+ "%h1.qname; | %h2.qname; | %h3.qname;
+ | %h4.qname; | %h5.qname; | %h6.qname;"
+>
+<!ENTITY % List.class "%ul.qname; | %ol.qname; | %dl.qname;" >
+
+<!ENTITY % Table.class "| %table.qname;" >
+
+<!ENTITY % Form.class "| %form.qname;" >
+
+<!ENTITY % BlkStruct.class "%p.qname; | %div.qname;" >
+
+<!ENTITY % BlkPhras.class
+ "| %pre.qname; | %blockquote.qname; | %address.qname;"
+>
+
+<!ENTITY % BlkPres.class "" >
+
+<!ENTITY % BlkSpecial.class
+ "%Table.class;
+ %Form.class;"
+>
+
+<!ENTITY % Block.extra "" >
+
+<!ENTITY % Block.class
+ "%BlkStruct.class;
+ %BlkPhras.class;
+ %BlkSpecial.class;
+ %Block.extra;"
+>
+
+<!ENTITY % Block.mix
+ "%Heading.class;
+ | %List.class;
+ | %Block.class;
+ %Misc.class;"
+>
+
+<!-- All Content Elements ................... -->
+
+<!-- declares all content except tables
+-->
+<!ENTITY % FlowNoTable.mix
+ "%Heading.class;
+ | %List.class;
+ | %BlkStruct.class;
+ %BlkPhras.class;
+ %Form.class;
+ %Block.extra;
+ | %Inline.class;
+ %Misc.class;"
+>
+
+<!ENTITY % Flow.mix
+ "%Heading.class;
+ | %List.class;
+ | %Block.class;
+ | %Inline.class;
+ %Misc.class;"
+>
+
+<!-- end of xhtml-basic10-model-1.mod -->
+]]>
+
+<!ENTITY % xhtml-charent.module "INCLUDE" >
+<![%xhtml-charent.module;[
+<!ENTITY % xhtml-charent.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Character Entities 1.0//EN"
+ "xhtml-charent-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Character Entities Module ......................................... -->
+<!-- file: xhtml-charent-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-charent-1.mod,v 1.13 2000/12/19 10:19:37 mimasa Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Character Entities 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-charent-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Character Entities for XHTML
+
+ This module declares the set of character entities for XHTML,
+ including the Latin 1, Symbol and Special character collections.
+-->
+
+<!ENTITY % xhtml-lat1
+ PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent" >
+<!ENTITY % xhtml-symbol
+ PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent" >
+<!ENTITY % xhtml-special
+ PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent" >
+
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+ %HTMLlat1;
+-->
+
+<!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space,
+ U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+ U+00A6 ISOnum -->
+<!ENTITY sect "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;"> <!-- diaeresis = spacing diaeresis,
+ U+00A8 ISOdia -->
+<!ENTITY copy "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;"> <!-- left-pointing double angle quotation mark
+ = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;"> <!-- not sign = discretionary hyphen,
+ U+00AC ISOnum -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen = discretionary hyphen,
+ U+00AD ISOnum -->
+<!ENTITY reg "&#174;"> <!-- registered sign = registered trade mark sign,
+ U+00AE ISOnum -->
+<!ENTITY macr "&#175;"> <!-- macron = spacing macron = overline
+ = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+ U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;"> <!-- superscript two = superscript digit two
+ = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;"> <!-- superscript three = superscript digit three
+ = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;"> <!-- acute accent = spacing acute,
+ U+00B4 ISOdia -->
+<!ENTITY micro "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;"> <!-- pilcrow sign = paragraph sign,
+ U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+ = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;"> <!-- superscript one = superscript digit one,
+ U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;"> <!-- masculine ordinal indicator,
+ U+00BA ISOnum -->
+<!ENTITY raquo "&#187;"> <!-- right-pointing double angle quotation mark
+ = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+ = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+ = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+ = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+ = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+ = latin capital letter A grave,
+ U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+ U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;"> <!-- latin capital letter A with circumflex,
+ U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+ U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;"> <!-- latin capital letter A with diaeresis,
+ U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;"> <!-- latin capital letter A with ring above
+ = latin capital letter A ring,
+ U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;"> <!-- latin capital letter AE
+ = latin capital ligature AE,
+ U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+ U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+ U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+ U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;"> <!-- latin capital letter E with circumflex,
+ U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;"> <!-- latin capital letter E with diaeresis,
+ U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+ U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+ U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;"> <!-- latin capital letter I with circumflex,
+ U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;"> <!-- latin capital letter I with diaeresis,
+ U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+ U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+ U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+ U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;"> <!-- latin capital letter O with circumflex,
+ U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+ U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;"> <!-- latin capital letter O with diaeresis,
+ U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+ = latin capital letter O slash,
+ U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+ U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+ U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;"> <!-- latin capital letter U with circumflex,
+ U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;"> <!-- latin capital letter U with diaeresis,
+ U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+ U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;"> <!-- latin capital letter THORN,
+ U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;"> <!-- latin small letter sharp s = ess-zed,
+ U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+ = latin small letter a grave,
+ U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+ U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;"> <!-- latin small letter a with circumflex,
+ U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+ U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;"> <!-- latin small letter a with diaeresis,
+ U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;"> <!-- latin small letter a with ring above
+ = latin small letter a ring,
+ U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;"> <!-- latin small letter ae
+ = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+ U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+ U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+ U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;"> <!-- latin small letter e with circumflex,
+ U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;"> <!-- latin small letter e with diaeresis,
+ U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+ U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+ U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;"> <!-- latin small letter i with circumflex,
+ U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;"> <!-- latin small letter i with diaeresis,
+ U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+ U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+ U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+ U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;"> <!-- latin small letter o with circumflex,
+ U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+ U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;"> <!-- latin small letter o with diaeresis,
+ U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+ = latin small letter o slash,
+ U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+ U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+ U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;"> <!-- latin small letter u with circumflex,
+ U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;"> <!-- latin small letter u with diaeresis,
+ U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+ U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;"> <!-- latin small letter thorn with,
+ U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;"> <!-- latin small letter y with diaeresis,
+ U+00FF ISOlat1 -->
+
+<!-- Mathematical, Greek and Symbolic characters for HTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+ %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- latin small f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;"> <!-- greek capital letter gamma,
+ U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;"> <!-- greek capital letter delta,
+ U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;"> <!-- greek capital letter theta,
+ U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;"> <!-- greek capital letter lambda,
+ U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;"> <!-- greek capital letter sigma,
+ U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;"> <!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;"> <!-- greek capital letter phi,
+ U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;"> <!-- greek capital letter psi,
+ U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;"> <!-- greek capital letter omega,
+ U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha "&#945;"> <!-- greek small letter alpha,
+ U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;"> <!-- greek small letter gamma,
+ U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;"> <!-- greek small letter delta,
+ U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;"> <!-- greek small letter epsilon,
+ U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;"> <!-- greek small letter theta,
+ U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;"> <!-- greek small letter kappa,
+ U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;"> <!-- greek small letter lambda,
+ U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;"> <!-- greek small letter final sigma,
+ U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;"> <!-- greek small letter sigma,
+ U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;"> <!-- greek small letter upsilon,
+ U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;"> <!-- greek small letter omega,
+ U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek small letter theta symbol,
+ U+03D1 NEW -->
+<!ENTITY upsih "&#978;"> <!-- greek upsilon with hook symbol,
+ U+03D2 NEW -->
+<!ENTITY piv "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- bullet = black small circle,
+ U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+ U+2026 ISOpub -->
+<!ENTITY prime "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;"> <!-- double prime = seconds = inches,
+ U+2033 ISOtech -->
+<!ENTITY oline "&#8254;"> <!-- overline = spacing overscore,
+ U+203E NEW -->
+<!ENTITY frasl "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- script capital P = power set
+ = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;"> <!-- blackletter capital I = imaginary part,
+ U+2111 ISOamso -->
+<!ENTITY real "&#8476;"> <!-- blackletter capital R = real part symbol,
+ U+211C ISOamso -->
+<!ENTITY trade "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+ U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+ U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;"> <!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So ? lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;"> <!-- rightwards double arrow,
+ U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so ?
+ rArr can be used for 'implies' as ISOtech suggests -->
+<!ENTITY dArr "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;"> <!-- left right double arrow,
+ U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;"> <!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;"> <!-- empty set = null set = diameter,
+ U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;"> <!-- nabla = backward difference,
+ U+2207 ISOtech -->
+<!ENTITY isin "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!-- should there be a more memorable name than 'ni'? -->
+<!ENTITY prod "&#8719;"> <!-- n-ary product = product sign,
+ U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;"> <!-- n-ary sumation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;"> <!-- square root = radical sign,
+ U+221A ISOtech -->
+<!ENTITY prop "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;"> <!-- tilde operator = varies with = similar to,
+ U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;"> <!-- almost equal to = asymptotic to,
+ U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;"> <!-- greater-than or equal to,
+ U+2265 ISOtech -->
+<!ENTITY sub "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
+ font encoding and is not included. Should it be, for symmetry?
+ It is in ISOamsn -->
+<!ENTITY nsub "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;"> <!-- superset of or equal to,
+ U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;"> <!-- circled plus = direct sum,
+ U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;"> <!-- circled times = vector product,
+ U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+ U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- left ceiling = apl upstile,
+ U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;"> <!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;"> <!-- left floor = apl downstile,
+ U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;"> <!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;"> <!-- left-pointing angle bracket = bra,
+ U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;"> <!-- right-pointing angle bracket = ket,
+ U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;"> <!-- black club suit = shamrock,
+ U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;"> <!-- black heart suit = valentine,
+ U+2665 ISOpub -->
+<!ENTITY diams "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
+
+<!-- Special characters for HTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+ %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- quotation mark = APL quote,
+ U+0022 ISOnum -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand, U+0026 ISOnum -->
+<!ENTITY lt "&#38;#60;"> <!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;"> <!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY apos "&#39;"> <!-- apostrophe mark, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- latin capital ligature OE,
+ U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;"> <!-- latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- latin capital letter S with caron,
+ U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;"> <!-- latin small letter s with caron,
+ U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;"> <!-- latin capital letter Y with diaeresis,
+ U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;"> <!-- modifier letter circumflex accent,
+ U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;"> <!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;"> <!-- zero width non-joiner,
+ U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;"> <!-- left single quotation mark,
+ U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;"> <!-- right single quotation mark,
+ U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;"> <!-- left double quotation mark,
+ U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;"> <!-- right double quotation mark,
+ U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo "&#8249;"> <!-- single left-pointing angle quotation mark,
+ U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- single right-pointing angle quotation mark,
+ U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+<!ENTITY euro "&#8364;"> <!-- euro sign, U+20AC NEW -->
+
+
+<!-- end of xhtml-charent-1.mod -->
+]]>
+
+<!-- end of xhtml-framework-1.mod -->
+
+
+<!ENTITY % pre.content
+ "( #PCDATA
+ | %InlStruct.class;
+ %InlPhras.class;
+ %Anchor.class;
+ %Inline.extra; )*"
+>
+
+<!ENTITY % xhtml-text.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
+ "xhtml-text-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Text Module ................................................... -->
+<!-- file: xhtml-text-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-text-1.mod,v 1.11 2000/12/19 10:26:19 mimasa Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-text-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Textual Content
+
+ The Text module includes declarations for all core
+ text container elements and their attributes.
+-->
+
+<!ENTITY % xhtml-inlstruct.module "INCLUDE" >
+<![%xhtml-inlstruct.module;[
+<!ENTITY % xhtml-inlstruct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN"
+ "xhtml-inlstruct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Structural Module ...................................... -->
+<!-- file: xhtml-inlstruct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlstruct-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-inlstruct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Structural
+
+ br, span
+
+ This module declares the elements and their attributes
+ used to support inline-level structural markup.
+-->
+
+<!-- br: forced line break ............................. -->
+
+<!ENTITY % br.element "INCLUDE" >
+<![%br.element;[
+
+<!ENTITY % br.content "EMPTY" >
+<!ENTITY % br.qname "br" >
+<!ELEMENT %br.qname; %br.content; >
+
+<!-- end of br.element -->]]>
+
+<!ENTITY % br.attlist "INCLUDE" >
+<![%br.attlist;[
+<!ATTLIST %br.qname;
+ %Core.attrib;
+>
+<!-- end of br.attlist -->]]>
+
+<!-- span: generic inline container .................... -->
+
+<!ENTITY % span.element "INCLUDE" >
+<![%span.element;[
+<!ENTITY % span.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % span.qname "span" >
+<!ELEMENT %span.qname; %span.content; >
+<!-- end of span.element -->]]>
+
+<!ENTITY % span.attlist "INCLUDE" >
+<![%span.attlist;[
+<!ATTLIST %span.qname;
+ %Common.attrib;
+>
+<!-- end of span.attlist -->]]>
+
+<!-- end of xhtml-inlstruct-1.mod -->
+]]>
+
+<!ENTITY % xhtml-inlphras.module "INCLUDE" >
+<![%xhtml-inlphras.module;[
+<!ENTITY % xhtml-inlphras.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN"
+ "xhtml-inlphras-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Phrasal Module ......................................... -->
+<!-- file: xhtml-inlphras-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlphras-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-inlphras-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Phrasal
+
+ abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var
+
+ This module declares the elements and their attributes used to
+ support inline-level phrasal markup.
+-->
+
+<!ENTITY % abbr.element "INCLUDE" >
+<![%abbr.element;[
+<!ENTITY % abbr.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % abbr.qname "abbr" >
+<!ELEMENT %abbr.qname; %abbr.content; >
+<!-- end of abbr.element -->]]>
+
+<!ENTITY % abbr.attlist "INCLUDE" >
+<![%abbr.attlist;[
+<!ATTLIST %abbr.qname;
+ %Common.attrib;
+>
+<!-- end of abbr.attlist -->]]>
+
+<!ENTITY % acronym.element "INCLUDE" >
+<![%acronym.element;[
+<!ENTITY % acronym.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % acronym.qname "acronym" >
+<!ELEMENT %acronym.qname; %acronym.content; >
+<!-- end of acronym.element -->]]>
+
+<!ENTITY % acronym.attlist "INCLUDE" >
+<![%acronym.attlist;[
+<!ATTLIST %acronym.qname;
+ %Common.attrib;
+>
+<!-- end of acronym.attlist -->]]>
+
+<!ENTITY % cite.element "INCLUDE" >
+<![%cite.element;[
+<!ENTITY % cite.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % cite.qname "cite" >
+<!ELEMENT %cite.qname; %cite.content; >
+<!-- end of cite.element -->]]>
+
+<!ENTITY % cite.attlist "INCLUDE" >
+<![%cite.attlist;[
+<!ATTLIST %cite.qname;
+ %Common.attrib;
+>
+<!-- end of cite.attlist -->]]>
+
+<!ENTITY % code.element "INCLUDE" >
+<![%code.element;[
+<!ENTITY % code.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % code.qname "code" >
+<!ELEMENT %code.qname; %code.content; >
+<!-- end of code.element -->]]>
+
+<!ENTITY % code.attlist "INCLUDE" >
+<![%code.attlist;[
+<!ATTLIST %code.qname;
+ %Common.attrib;
+>
+<!-- end of code.attlist -->]]>
+
+<!ENTITY % dfn.element "INCLUDE" >
+<![%dfn.element;[
+<!ENTITY % dfn.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % dfn.qname "dfn" >
+<!ELEMENT %dfn.qname; %dfn.content; >
+<!-- end of dfn.element -->]]>
+
+<!ENTITY % dfn.attlist "INCLUDE" >
+<![%dfn.attlist;[
+<!ATTLIST %dfn.qname;
+ %Common.attrib;
+>
+<!-- end of dfn.attlist -->]]>
+
+<!ENTITY % em.element "INCLUDE" >
+<![%em.element;[
+<!ENTITY % em.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % em.qname "em" >
+<!ELEMENT %em.qname; %em.content; >
+<!-- end of em.element -->]]>
+
+<!ENTITY % em.attlist "INCLUDE" >
+<![%em.attlist;[
+<!ATTLIST %em.qname;
+ %Common.attrib;
+>
+<!-- end of em.attlist -->]]>
+
+<!ENTITY % kbd.element "INCLUDE" >
+<![%kbd.element;[
+<!ENTITY % kbd.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % kbd.qname "kbd" >
+<!ELEMENT %kbd.qname; %kbd.content; >
+<!-- end of kbd.element -->]]>
+
+<!ENTITY % kbd.attlist "INCLUDE" >
+<![%kbd.attlist;[
+<!ATTLIST %kbd.qname;
+ %Common.attrib;
+>
+<!-- end of kbd.attlist -->]]>
+
+<!ENTITY % q.element "INCLUDE" >
+<![%q.element;[
+<!ENTITY % q.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % q.qname "q" >
+<!ELEMENT %q.qname; %q.content; >
+<!-- end of q.element -->]]>
+
+<!ENTITY % q.attlist "INCLUDE" >
+<![%q.attlist;[
+<!ATTLIST %q.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+>
+<!-- end of q.attlist -->]]>
+
+<!ENTITY % samp.element "INCLUDE" >
+<![%samp.element;[
+<!ENTITY % samp.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % samp.qname "samp" >
+<!ELEMENT %samp.qname; %samp.content; >
+<!-- end of samp.element -->]]>
+
+<!ENTITY % samp.attlist "INCLUDE" >
+<![%samp.attlist;[
+<!ATTLIST %samp.qname;
+ %Common.attrib;
+>
+<!-- end of samp.attlist -->]]>
+
+<!ENTITY % strong.element "INCLUDE" >
+<![%strong.element;[
+<!ENTITY % strong.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % strong.qname "strong" >
+<!ELEMENT %strong.qname; %strong.content; >
+<!-- end of strong.element -->]]>
+
+<!ENTITY % strong.attlist "INCLUDE" >
+<![%strong.attlist;[
+<!ATTLIST %strong.qname;
+ %Common.attrib;
+>
+<!-- end of strong.attlist -->]]>
+
+<!ENTITY % var.element "INCLUDE" >
+<![%var.element;[
+<!ENTITY % var.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % var.qname "var" >
+<!ELEMENT %var.qname; %var.content; >
+<!-- end of var.element -->]]>
+
+<!ENTITY % var.attlist "INCLUDE" >
+<![%var.attlist;[
+<!ATTLIST %var.qname;
+ %Common.attrib;
+>
+<!-- end of var.attlist -->]]>
+
+<!-- end of xhtml-inlphras-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkstruct.module "INCLUDE" >
+<![%xhtml-blkstruct.module;[
+<!ENTITY % xhtml-blkstruct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Structural 1.0//EN"
+ "xhtml-blkstruct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Structural Module ....................................... -->
+<!-- file: xhtml-blkstruct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkstruct-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Structural 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-blkstruct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Structural
+
+ div, p
+
+ This module declares the elements and their attributes used to
+ support block-level structural markup.
+-->
+
+<!ENTITY % div.element "INCLUDE" >
+<![%div.element;[
+<!ENTITY % div.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ENTITY % div.qname "div" >
+<!ELEMENT %div.qname; %div.content; >
+<!-- end of div.element -->]]>
+
+<!ENTITY % div.attlist "INCLUDE" >
+<![%div.attlist;[
+<!-- end of div.attlist -->]]>
+<!ATTLIST %div.qname;
+ %Common.attrib;
+>
+
+<!ENTITY % p.element "INCLUDE" >
+<![%p.element;[
+<!ENTITY % p.content
+ "( #PCDATA | %Inline.mix; )*" >
+<!ENTITY % p.qname "p" >
+<!ELEMENT %p.qname; %p.content; >
+<!-- end of p.element -->]]>
+
+<!ENTITY % p.attlist "INCLUDE" >
+<![%p.attlist;[
+<!ATTLIST %p.qname;
+ %Common.attrib;
+>
+<!-- end of p.attlist -->]]>
+
+<!-- end of xhtml-blkstruct-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkphras.module "INCLUDE" >
+<![%xhtml-blkphras.module;[
+<!ENTITY % xhtml-blkphras.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN"
+ "xhtml-blkphras-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Phrasal Module .......................................... -->
+<!-- file: xhtml-blkphras-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkphras-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-blkphras-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Phrasal
+
+ address, blockquote, pre, h1, h2, h3, h4, h5, h6
+
+ This module declares the elements and their attributes used to
+ support block-level phrasal markup.
+-->
+
+<!ENTITY % address.element "INCLUDE" >
+<![%address.element;[
+<!ENTITY % address.content
+ "( #PCDATA | %Inline.mix; )*" >
+<!ENTITY % address.qname "address" >
+<!ELEMENT %address.qname; %address.content; >
+<!-- end of address.element -->]]>
+
+<!ENTITY % address.attlist "INCLUDE" >
+<![%address.attlist;[
+<!ATTLIST %address.qname;
+ %Common.attrib;
+>
+<!-- end of address.attlist -->]]>
+
+<!ENTITY % blockquote.element "INCLUDE" >
+<![%blockquote.element;[
+<!ENTITY % blockquote.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % blockquote.qname "blockquote" >
+<!ELEMENT %blockquote.qname; %blockquote.content; >
+<!-- end of blockquote.element -->]]>
+
+<!ENTITY % blockquote.attlist "INCLUDE" >
+<![%blockquote.attlist;[
+<!ATTLIST %blockquote.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+>
+<!-- end of blockquote.attlist -->]]>
+
+<!ENTITY % pre.element "INCLUDE" >
+<![%pre.element;[
+<!ENTITY % pre.content
+ "( #PCDATA
+ | %InlStruct.class;
+ %InlPhras.class;
+ | %tt.qname; | %i.qname; | %b.qname;
+ %I18n.class;
+ %Anchor.class;
+ | %script.qname; | %map.qname;
+ %Inline.extra; )*"
+>
+<!ENTITY % pre.qname "pre" >
+<!ELEMENT %pre.qname; %pre.content; >
+<!-- end of pre.element -->]]>
+
+<!ENTITY % pre.attlist "INCLUDE" >
+<![%pre.attlist;[
+<!ATTLIST %pre.qname;
+ %Common.attrib;
+ xml:space ( preserve ) #FIXED 'preserve'
+>
+<!-- end of pre.attlist -->]]>
+
+<!-- ................... Heading Elements ................... -->
+
+<!ENTITY % Heading.content "( #PCDATA | %Inline.mix; )*" >
+
+<!ENTITY % h1.element "INCLUDE" >
+<![%h1.element;[
+<!ENTITY % h1.qname "h1" >
+<!ELEMENT %h1.qname; %Heading.content; >
+<!-- end of h1.element -->]]>
+
+<!ENTITY % h1.attlist "INCLUDE" >
+<![%h1.attlist;[
+<!ATTLIST %h1.qname;
+ %Common.attrib;
+>
+<!-- end of h1.attlist -->]]>
+
+<!ENTITY % h2.element "INCLUDE" >
+<![%h2.element;[
+<!ENTITY % h2.qname "h2" >
+<!ELEMENT %h2.qname; %Heading.content; >
+<!-- end of h2.element -->]]>
+
+<!ENTITY % h2.attlist "INCLUDE" >
+<![%h2.attlist;[
+<!ATTLIST %h2.qname;
+ %Common.attrib;
+>
+<!-- end of h2.attlist -->]]>
+
+<!ENTITY % h3.element "INCLUDE" >
+<![%h3.element;[
+<!ENTITY % h3.qname "h3" >
+<!ELEMENT %h3.qname; %Heading.content; >
+<!-- end of h3.element -->]]>
+
+<!ENTITY % h3.attlist "INCLUDE" >
+<![%h3.attlist;[
+<!ATTLIST %h3.qname;
+ %Common.attrib;
+>
+<!-- end of h3.attlist -->]]>
+
+<!ENTITY % h4.element "INCLUDE" >
+<![%h4.element;[
+<!ENTITY % h4.qname "h4" >
+<!ELEMENT %h4.qname; %Heading.content; >
+<!-- end of h4.element -->]]>
+
+<!ENTITY % h4.attlist "INCLUDE" >
+<![%h4.attlist;[
+<!ATTLIST %h4.qname;
+ %Common.attrib;
+>
+<!-- end of h4.attlist -->]]>
+
+<!ENTITY % h5.element "INCLUDE" >
+<![%h5.element;[
+<!ENTITY % h5.qname "h5" >
+<!ELEMENT %h5.qname; %Heading.content; >
+<!-- end of h5.element -->]]>
+
+<!ENTITY % h5.attlist "INCLUDE" >
+<![%h5.attlist;[
+<!ATTLIST %h5.qname;
+ %Common.attrib;
+>
+<!-- end of h5.attlist -->]]>
+
+<!ENTITY % h6.element "INCLUDE" >
+<![%h6.element;[
+<!ENTITY % h6.qname "h6" >
+<!ELEMENT %h6.qname; %Heading.content; >
+<!-- end of h6.element -->]]>
+
+<!ENTITY % h6.attlist "INCLUDE" >
+<![%h6.attlist;[
+<!ATTLIST %h6.qname;
+ %Common.attrib;
+>
+<!-- end of h6.attlist -->]]>
+
+<!-- end of xhtml-blkphras-1.mod -->
+]]>
+
+<!-- end of xhtml-text-1.mod -->
+
+
+<!ENTITY % xhtml-hypertext.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
+ "xhtml-hypertext-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Hypertext Module .............................................. -->
+<!-- file: xhtml-hypertext-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-hypertext-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-hypertext-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Hypertext
+
+ a
+
+ This module declares the anchor ('a') element type, which
+ defines the source of a hypertext link. The destination
+ (or link 'target') is identified via its 'id' attribute
+ rather than the 'name' attribute as was used in HTML.
+-->
+
+<!-- ............ Anchor Element ............ -->
+
+<!ENTITY % a.element "INCLUDE" >
+<![%a.element;[
+<!ENTITY % a.content
+ "( #PCDATA | %InlNoAnchor.mix; )*"
+>
+<!ENTITY % a.qname "a" >
+<!ELEMENT %a.qname; %a.content; >
+<!-- end of a.element -->]]>
+
+<!ENTITY % a.attlist "INCLUDE" >
+<![%a.attlist;[
+<!ATTLIST %a.qname;
+ %Common.attrib;
+ href %URI.datatype; #IMPLIED
+ charset %Charset.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ hreflang %LanguageCode.datatype; #IMPLIED
+ rel %LinkTypes.datatype; #IMPLIED
+ rev %LinkTypes.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of a.attlist -->]]>
+
+<!-- end of xhtml-hypertext-1.mod -->
+
+
+<!ENTITY % xhtml-list.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
+ "xhtml-list-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Lists Module .................................................. -->
+<!-- file: xhtml-list-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-list-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-list-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Lists
+
+ dl, dt, dd, ol, ul, li
+
+ This module declares the list-oriented element types
+ and their attributes.
+-->
+
+<!ENTITY % dl.qname "dl" >
+<!ENTITY % dt.qname "dt" >
+<!ENTITY % dd.qname "dd" >
+<!ENTITY % ol.qname "ol" >
+<!ENTITY % ul.qname "ul" >
+<!ENTITY % li.qname "li" >
+
+<!-- dl: Definition List ............................... -->
+
+<!ENTITY % dl.element "INCLUDE" >
+<![%dl.element;[
+<!ENTITY % dl.content "( %dt.qname; | %dd.qname; )+" >
+<!ELEMENT %dl.qname; %dl.content; >
+<!-- end of dl.element -->]]>
+
+<!ENTITY % dl.attlist "INCLUDE" >
+<![%dl.attlist;[
+<!ATTLIST %dl.qname;
+ %Common.attrib;
+>
+<!-- end of dl.attlist -->]]>
+
+<!-- dt: Definition Term ............................... -->
+
+<!ENTITY % dt.element "INCLUDE" >
+<![%dt.element;[
+<!ENTITY % dt.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %dt.qname; %dt.content; >
+<!-- end of dt.element -->]]>
+
+<!ENTITY % dt.attlist "INCLUDE" >
+<![%dt.attlist;[
+<!ATTLIST %dt.qname;
+ %Common.attrib;
+>
+<!-- end of dt.attlist -->]]>
+
+<!-- dd: Definition Description ........................ -->
+
+<!ENTITY % dd.element "INCLUDE" >
+<![%dd.element;[
+<!ENTITY % dd.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %dd.qname; %dd.content; >
+<!-- end of dd.element -->]]>
+
+<!ENTITY % dd.attlist "INCLUDE" >
+<![%dd.attlist;[
+<!ATTLIST %dd.qname;
+ %Common.attrib;
+>
+<!-- end of dd.attlist -->]]>
+
+<!-- ol: Ordered List (numbered styles) ................ -->
+
+<!ENTITY % ol.element "INCLUDE" >
+<![%ol.element;[
+<!ENTITY % ol.content "( %li.qname; )+" >
+<!ELEMENT %ol.qname; %ol.content; >
+<!-- end of ol.element -->]]>
+
+<!ENTITY % ol.attlist "INCLUDE" >
+<![%ol.attlist;[
+<!ATTLIST %ol.qname;
+ %Common.attrib;
+>
+<!-- end of ol.attlist -->]]>
+
+<!-- ul: Unordered List (bullet styles) ................ -->
+
+<!ENTITY % ul.element "INCLUDE" >
+<![%ul.element;[
+<!ENTITY % ul.content "( %li.qname; )+" >
+<!ELEMENT %ul.qname; %ul.content; >
+<!-- end of ul.element -->]]>
+
+<!ENTITY % ul.attlist "INCLUDE" >
+<![%ul.attlist;[
+<!ATTLIST %ul.qname;
+ %Common.attrib;
+>
+<!-- end of ul.attlist -->]]>
+
+<!-- li: List Item ..................................... -->
+
+<!ENTITY % li.element "INCLUDE" >
+<![%li.element;[
+<!ENTITY % li.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %li.qname; %li.content; >
+<!-- end of li.element -->]]>
+
+<!ENTITY % li.attlist "INCLUDE" >
+<![%li.attlist;[
+<!ATTLIST %li.qname;
+ %Common.attrib;
+>
+<!-- end of li.attlist -->]]>
+
+<!-- end of xhtml-list-1.mod -->
+
+
+<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+
+<!-- Image Module ............................................... -->
+<!ENTITY % xhtml-image.module "INCLUDE" >
+<![%xhtml-image.module;[
+<!ENTITY % xhtml-image.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
+ "xhtml-image-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Images Module ................................................. -->
+<!-- file: xhtml-image-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Rovision: $Id: xhtml-image-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-image-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Images
+
+ img
+
+ This module provides markup to support basic image embedding.
+-->
+
+<!-- To avoid problems with text-only UAs as well as to make
+ image content understandable and navigable to users of
+ non-visual UAs, you need to provide a description with
+ the 'alt' attribute, and avoid server-side image maps.
+-->
+
+<!ENTITY % img.element "INCLUDE" >
+<![%img.element;[
+<!ENTITY % img.content "EMPTY" >
+<!ENTITY % img.qname "img" >
+<!ELEMENT %img.qname; %img.content; >
+<!-- end of img.element -->]]>
+
+<!ENTITY % img.attlist "INCLUDE" >
+<![%img.attlist;[
+<!ATTLIST %img.qname;
+ %Common.attrib;
+ src %URI.datatype; #REQUIRED
+ alt %Text.datatype; #REQUIRED
+ longdesc %URI.datatype; #IMPLIED
+ height %Length.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+>
+<!-- end of img.attlist -->]]>
+
+<!-- end of xhtml-image-1.mod -->
+]]>
+
+<!-- Tables Module ............................................... -->
+<!ENTITY % xhtml-table.module "INCLUDE" >
+<![%xhtml-table.module;[
+<!ENTITY % xhtml-table.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Tables 1.0//EN"
+ "xhtml-basic-table-1.mod" >
+<!-- ....................................................................... -->
+<!-- XHTML Basic Table Module ............................................. -->
+<!-- file: xhtml-basic-table-1.mod
+
+ This is XHTML Basic, a proper subset of XHTML.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-basic-table-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Tables 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-basic-table-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Basic Tables
+
+ table, caption, tr, th, td
+
+ This table module declares elements and attributes defining
+ a table model based fundamentally on features found in the
+ widely-deployed HTML 3.2 table model. While this module
+ mimics the content model and table attributes of HTML 3.2
+ tables, the element types declared herein also includes all
+ HTML 4 common and most of the HTML 4 table attributes.
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % table.qname "table" >
+<!ENTITY % caption.qname "caption" >
+<!ENTITY % tr.qname "tr" >
+<!ENTITY % th.qname "th" >
+<!ENTITY % td.qname "td" >
+
+<!-- horizontal alignment attributes for cell contents
+-->
+<!ENTITY % CellHAlign.attrib
+ "align ( left
+ | center
+ | right ) #IMPLIED"
+>
+
+<!-- vertical alignment attributes for cell contents
+-->
+<!ENTITY % CellVAlign.attrib
+ "valign ( top
+ | middle
+ | bottom ) #IMPLIED"
+>
+
+<!-- scope is simpler than axes attribute for common tables
+-->
+<!ENTITY % scope.attrib
+ "scope ( row | col ) #IMPLIED"
+>
+
+<!-- table: Table Element .............................. -->
+
+<!ENTITY % table.element "INCLUDE" >
+<![%table.element;[
+<!ENTITY % table.content
+ "( %caption.qname;?, %tr.qname;+ )"
+>
+<!ELEMENT %table.qname; %table.content; >
+<!-- end of table.element -->]]>
+
+<!ENTITY % table.attlist "INCLUDE" >
+<![%table.attlist;[
+<!ATTLIST %table.qname;
+ %Common.attrib;
+ summary %Text.datatype; #IMPLIED
+>
+<!-- end of table.attlist -->]]>
+
+<!-- caption: Table Caption ............................ -->
+
+<!ENTITY % caption.element "INCLUDE" >
+<![%caption.element;[
+<!ENTITY % caption.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %caption.qname; %caption.content; >
+<!-- end of caption.element -->]]>
+
+<!ENTITY % caption.attlist "INCLUDE" >
+<![%caption.attlist;[
+<!ATTLIST %caption.qname;
+ %Common.attrib;
+>
+<!-- end of caption.attlist -->]]>
+
+<!-- tr: Table Row ..................................... -->
+
+<!ENTITY % tr.element "INCLUDE" >
+<![%tr.element;[
+<!ENTITY % tr.content "( %th.qname; | %td.qname; )+" >
+<!ELEMENT %tr.qname; %tr.content; >
+<!-- end of tr.element -->]]>
+
+<!ENTITY % tr.attlist "INCLUDE" >
+<![%tr.attlist;[
+<!ATTLIST %tr.qname;
+ %Common.attrib;
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of tr.attlist -->]]>
+
+<!-- th: Table Header Cell ............................. -->
+
+<!-- th is for header cells, td for data,
+ but for cells acting as both use td
+-->
+
+<!ENTITY % th.element "INCLUDE" >
+<![%th.element;[
+<!ENTITY % th.content
+ "( #PCDATA | %FlowNoTable.mix; )*"
+>
+<!ELEMENT %th.qname; %th.content; >
+<!-- end of th.element -->]]>
+
+<!ENTITY % th.attlist "INCLUDE" >
+<![%th.attlist;[
+<!ATTLIST %th.qname;
+ %Common.attrib;
+ abbr %Text.datatype; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ %scope.attrib;
+ rowspan %Number.datatype; '1'
+ colspan %Number.datatype; '1'
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of th.attlist -->]]>
+
+<!-- td: Table Data Cell ............................... -->
+
+<!ENTITY % td.element "INCLUDE" >
+<![%td.element;[
+<!ENTITY % td.content
+ "( #PCDATA | %FlowNoTable.mix; )*"
+>
+<!ELEMENT %td.qname; %td.content; >
+<!-- end of td.element -->]]>
+
+<!ENTITY % td.attlist "INCLUDE" >
+<![%td.attlist;[
+<!ATTLIST %td.qname;
+ %Common.attrib;
+ abbr %Text.datatype; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ %scope.attrib;
+ rowspan %Number.datatype; '1'
+ colspan %Number.datatype; '1'
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of td.attlist -->]]>
+
+<!-- end of xhtml-basic-table-1.mod -->
+]]>
+
+<!-- Forms Module ............................................... -->
+<!ENTITY % xhtml-form.module "INCLUDE" >
+<![%xhtml-form.module;[
+<!ENTITY % xhtml-form.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Forms 1.0//EN"
+ "xhtml-basic-form-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Simplified Forms Module ....................................... -->
+<!-- file: xhtml-basic-form-1.mod
+
+ This is XHTML Basic, a proper subset of XHTML.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-basic-form-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Forms 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-basic-form-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Basic Forms
+
+ This forms module is based on the HTML 3.2 forms model, with
+ the WAI-requested addition of the label element. While this
+ module essentially mimics the content model and attributes of
+ HTML 3.2 forms, the element types declared herein also include
+ all HTML 4 common attributes.
+
+ form, label, input, select, option, textarea
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % form.qname "form" >
+<!ENTITY % label.qname "label" >
+<!ENTITY % input.qname "input" >
+<!ENTITY % select.qname "select" >
+<!ENTITY % option.qname "option" >
+<!ENTITY % textarea.qname "textarea" >
+
+<!-- %BlkNoForm.mix; includes all non-form block elements,
+ plus %Misc.class;
+-->
+<!ENTITY % BlkNoForm.mix
+ "%Heading.class;
+ | %List.class;
+ | %BlkStruct.class;
+ %BlkPhras.class;
+ %BlkPres.class;
+ | %table.qname;
+ %Block.extra;
+ %Misc.class;"
+>
+
+<!-- form: Form Element ................................ -->
+
+<!ENTITY % form.element "INCLUDE" >
+<![%form.element;[
+<!ENTITY % form.content
+ "( %BlkNoForm.mix; )+"
+>
+<!ELEMENT %form.qname; %form.content; >
+<!-- end of form.element -->]]>
+
+<!ENTITY % form.attlist "INCLUDE" >
+<![%form.attlist;[
+<!ATTLIST %form.qname;
+ %Common.attrib;
+ action %URI.datatype; #REQUIRED
+ method ( get | post ) 'get'
+ enctype %ContentType.datatype; 'application/x-www-form-urlencoded'
+>
+<!-- end of form.attlist -->]]>
+
+<!-- label: Form Field Label Text ...................... -->
+
+<!ENTITY % label.element "INCLUDE" >
+<![%label.element;[
+<!-- Each label must not contain more than ONE field
+-->
+<!ENTITY % label.content
+ "( #PCDATA
+ | %input.qname; | %select.qname; | %textarea.qname;
+ | %InlStruct.class;
+ %InlPhras.class;
+ %I18n.class;
+ %InlPres.class;
+ %InlSpecial.class;
+ %Misc.class; )*"
+>
+<!ELEMENT %label.qname; %label.content; >
+<!-- end of label.element -->]]>
+
+<!ENTITY % label.attlist "INCLUDE" >
+<![%label.attlist;[
+<!ATTLIST %label.qname;
+ %Common.attrib;
+ for IDREF #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of label.attlist -->]]>
+
+<!-- input: Form Control ............................... -->
+
+<!ENTITY % input.element "INCLUDE" >
+<![%input.element;[
+<!ENTITY % input.content "EMPTY" >
+<!ELEMENT %input.qname; %input.content; >
+<!-- end of input.element -->]]>
+
+<!-- Basic Forms removes 'image' and 'file' input types.
+-->
+<!ENTITY % input.attlist "INCLUDE" >
+<![%input.attlist;[
+<!ENTITY % InputType.class
+ "( text | password | checkbox | radio
+ | submit | reset | hidden )"
+>
+<!-- attribute name required for all but submit & reset
+-->
+<!ATTLIST %input.qname;
+ %Common.attrib;
+ type %InputType.class; 'text'
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked ( checked ) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number.datatype; #IMPLIED
+ src %URI.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of input.attlist -->]]>
+
+<!-- select: Option Selector ........................... -->
+
+<!ENTITY % select.element "INCLUDE" >
+<![%select.element;[
+<!ENTITY % select.content "( %option.qname; )+" >
+<!ELEMENT %select.qname; %select.content; >
+<!-- end of select.element -->]]>
+
+<!ENTITY % select.attlist "INCLUDE" >
+<![%select.attlist;[
+<!ATTLIST %select.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ size %Number.datatype; #IMPLIED
+ multiple ( multiple ) #IMPLIED
+>
+<!-- end of select.attlist -->]]>
+
+<!-- option: Selectable Choice ......................... -->
+
+<!ENTITY % option.element "INCLUDE" >
+<![%option.element;[
+<!ENTITY % option.content "( #PCDATA )" >
+<!ELEMENT %option.qname; %option.content; >
+<!-- end of option.element -->]]>
+
+<!ENTITY % option.attlist "INCLUDE" >
+<![%option.attlist;[
+<!ATTLIST %option.qname;
+ %Common.attrib;
+ selected ( selected ) #IMPLIED
+ value CDATA #IMPLIED
+>
+<!-- end of option.attlist -->]]>
+
+<!-- textarea: Multi-Line Text Field ................... -->
+
+<!ENTITY % textarea.element "INCLUDE" >
+<![%textarea.element;[
+<!ENTITY % textarea.content "( #PCDATA )" >
+<!ELEMENT %textarea.qname; %textarea.content; >
+<!-- end of textarea.element -->]]>
+
+<!ENTITY % textarea.attlist "INCLUDE" >
+<![%textarea.attlist;[
+<!ATTLIST %textarea.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ rows %Number.datatype; #REQUIRED
+ cols %Number.datatype; #REQUIRED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of textarea.attlist -->]]>
+
+<!-- end of xhtml-basic-form-1.mod -->
+]]>
+
+<!-- Link Element Module ........................................ -->
+<!ENTITY % xhtml-link.module "INCLUDE" >
+<![%xhtml-link.module;[
+<!ENTITY % xhtml-link.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
+ "xhtml-link-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Link Element Module ........................................... -->
+<!-- file: xhtml-link-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-link-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-link-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Link element
+
+ link
+
+ This module declares the link element type and its attributes,
+ which could (in principle) be used to define document-level links
+ to external resources such as:
+
+ a) for document specific toolbars/menus, e.g. start, contents,
+ previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of html nodes are
+ rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a postscript or pdf version (rel="alternate" media="print")
+-->
+
+<!-- link: Media-Independent Link ...................... -->
+
+<!ENTITY % link.element "INCLUDE" >
+<![%link.element;[
+<!ENTITY % link.content "EMPTY" >
+<!ENTITY % link.qname "link" >
+<!ELEMENT %link.qname; %link.content; >
+<!-- end of link.element -->]]>
+
+<!ENTITY % link.attlist "INCLUDE" >
+<![%link.attlist;[
+<!ATTLIST %link.qname;
+ %Common.attrib;
+ charset %Charset.datatype; #IMPLIED
+ href %URI.datatype; #IMPLIED
+ hreflang %LanguageCode.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ rel %LinkTypes.datatype; #IMPLIED
+ rev %LinkTypes.datatype; #IMPLIED
+ media %MediaDesc.datatype; #IMPLIED
+>
+<!-- end of link.attlist -->]]>
+
+<!-- end of xhtml-link-1.mod -->
+]]>
+
+<!-- Document Metainformation Module ............................ -->
+<!ENTITY % xhtml-meta.module "INCLUDE" >
+<![%xhtml-meta.module;[
+<!ENTITY % xhtml-meta.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
+ "xhtml-meta-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Document Metainformation Module ............................... -->
+<!-- file: xhtml-meta-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-meta-1.mod,v 1.11 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-meta-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Meta Information
+
+ meta
+
+ This module declares the meta element type and its attributes,
+ used to provide declarative document metainformation.
+-->
+
+<!-- meta: Generic Metainformation ..................... -->
+
+<!ENTITY % meta.element "INCLUDE" >
+<![%meta.element;[
+<!ENTITY % meta.content "EMPTY" >
+<!ENTITY % meta.qname "meta" >
+<!ELEMENT %meta.qname; %meta.content; >
+<!-- end of meta.element -->]]>
+
+<!ENTITY % meta.attlist "INCLUDE" >
+<![%meta.attlist;[
+<!ATTLIST %meta.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+ http-equiv NMTOKEN #IMPLIED
+ name NMTOKEN #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+>
+<!-- end of meta.attlist -->]]>
+
+<!-- end of xhtml-meta-1.mod -->
+]]>
+
+<!-- Base Element Module ........................................ -->
+<!ENTITY % xhtml-base.module "INCLUDE" >
+<![%xhtml-base.module;[
+<!ENTITY % xhtml-base.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
+ "xhtml-base-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Base Element Module ........................................... -->
+<!-- file: xhtml-base-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-base-1.mod,v 1.11 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-base-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Base element
+
+ base
+
+ This module declares the base element type and its attributes,
+ used to define a base URI against which relative URIs in the
+ document will be resolved.
+
+ Note that this module also redeclares the content model for
+ the head element to include the base element.
+-->
+
+<!-- base: Document Base URI ........................... -->
+
+<!ENTITY % base.element "INCLUDE" >
+<![%base.element;[
+<!ENTITY % base.content "EMPTY" >
+<!ENTITY % base.qname "base" >
+<!ELEMENT %base.qname; %base.content; >
+<!-- end of base.element -->]]>
+
+<!ENTITY % base.attlist "INCLUDE" >
+<![%base.attlist;[
+<!ATTLIST %base.qname;
+ %XHTML.xmlns.attrib;
+ href %URI.datatype; #REQUIRED
+>
+<!-- end of base.attlist -->]]>
+
+<!ENTITY % head.content
+ "( %HeadOpts.mix;,
+ ( ( %title.qname;, %HeadOpts.mix;, ( %base.qname;, %HeadOpts.mix; )? )
+ | ( %base.qname;, %HeadOpts.mix;, ( %title.qname;, %HeadOpts.mix; ))))"
+>
+
+<!-- end of xhtml-base-1.mod -->
+]]>
+
+<!-- Param Element Module ....................................... -->
+<!ENTITY % xhtml-param.module "INCLUDE" >
+<![%xhtml-param.module;[
+<!ENTITY % xhtml-param.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
+ "xhtml-param-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Param Element Module ..................................... -->
+<!-- file: xhtml-param-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-param-1.mod,v 1.11 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-param-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Parameters for Java Applets and Embedded Objects
+
+ param
+
+ This module provides declarations for the param element,
+ used to provide named property values for the applet
+ and object elements.
+-->
+
+<!-- param: Named Property Value ....................... -->
+
+<!ENTITY % param.element "INCLUDE" >
+<![%param.element;[
+<!ENTITY % param.content "EMPTY" >
+<!ENTITY % param.qname "param" >
+<!ELEMENT %param.qname; %param.content; >
+<!-- end of param.element -->]]>
+
+<!ENTITY % param.attlist "INCLUDE" >
+<![%param.attlist;[
+<!ATTLIST %param.qname;
+ %XHTML.xmlns.attrib;
+ %id.attrib;
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype ( data | ref | object ) 'data'
+ type %ContentType.datatype; #IMPLIED
+>
+<!-- end of param.attlist -->]]>
+
+<!-- end of xhtml-param-1.mod -->
+]]>
+
+<!-- Embedded Object Module ..................................... -->
+<!ENTITY % xhtml-object.module "INCLUDE" >
+<![%xhtml-object.module;[
+<!ENTITY % xhtml-object.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
+ "xhtml-object-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Embedded Object Module ........................................ -->
+<!-- file: xhtml-object-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-object-1.mod,v 1.10 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-object-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Embedded Objects
+
+ object
+
+ This module declares the object element type and its attributes,
+ used to embed external objects as part of XHTML pages. In the
+ document, place param elements prior to the object elements
+ that require their content.
+
+ Note that use of this module requires instantiation of the
+ Param Element Module prior to this module.
+-->
+
+<!-- object: Generic Embedded Object ................... -->
+
+<!ENTITY % object.element "INCLUDE" >
+<![%object.element;[
+<!ENTITY % object.content
+ "( #PCDATA | %Flow.mix; | %param.qname; )*"
+>
+<!ENTITY % object.qname "object" >
+<!ELEMENT %object.qname; %object.content; >
+<!-- end of object.element -->]]>
+
+<!ENTITY % object.attlist "INCLUDE" >
+<![%object.attlist;[
+<!ATTLIST %object.qname;
+ %Common.attrib;
+ declare ( declare ) #IMPLIED
+ classid %URI.datatype; #IMPLIED
+ codebase %URI.datatype; #IMPLIED
+ data %URI.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ codetype %ContentType.datatype; #IMPLIED
+ archive %URIs.datatype; #IMPLIED
+ standby %Text.datatype; #IMPLIED
+ height %Length.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+ name CDATA #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of object.attlist -->]]>
+
+<!-- end of xhtml-object-1.mod -->
+]]>
+
+<!ENTITY % xhtml-struct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
+ "xhtml-struct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Structure Module .............................................. -->
+<!-- file: xhtml-struct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-struct-1.mod,v 1.11 2000/10/16 21:15:23 radams Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modulatization/DTD/xhtml-struct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Document Structure
+
+ title, head, body, html
+
+ The Structure Module defines the major structural elements and
+ their attributes.
+
+ Note that the content model of the head element type is redeclared
+ when the Base Module is included in the DTD.
+
+ The parameter entity containing the XML namespace URI value used
+ for XHTML is '%XHTML.xmlns;', defined in the Qualified Names module.
+-->
+
+<!-- title: Document Title ............................. -->
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+-->
+
+<!ENTITY % title.element "INCLUDE" >
+<![%title.element;[
+<!ENTITY % title.content "( #PCDATA )" >
+<!ENTITY % title.qname "title" >
+<!ELEMENT %title.qname; %title.content; >
+<!-- end of title.element -->]]>
+
+<!ENTITY % title.attlist "INCLUDE" >
+<![%title.attlist;[
+<!ATTLIST %title.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+>
+<!-- end of title.attlist -->]]>
+
+<!-- head: Document Head ............................... -->
+
+<!ENTITY % head.element "INCLUDE" >
+<![%head.element;[
+<!ENTITY % head.content
+ "( %HeadOpts.mix;, %title.qname;, %HeadOpts.mix; )"
+>
+<!ENTITY % head.qname "head" >
+<!ELEMENT %head.qname; %head.content; >
+<!-- end of head.element -->]]>
+
+<!ENTITY % head.attlist "INCLUDE" >
+<![%head.attlist;[
+<!-- reserved for future use with document profiles
+-->
+<!ENTITY % profile.attrib
+ "profile %URI.datatype; '%XHTML.profile;'"
+>
+
+<!ATTLIST %head.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+ %profile.attrib;
+>
+<!-- end of head.attlist -->]]>
+
+<!-- body: Document Body ............................... -->
+
+<!ENTITY % body.element "INCLUDE" >
+<![%body.element;[
+<!ENTITY % body.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % body.qname "body" >
+<!ELEMENT %body.qname; %body.content; >
+<!-- end of body.element -->]]>
+
+<!ENTITY % body.attlist "INCLUDE" >
+<![%body.attlist;[
+<!ATTLIST %body.qname;
+ %Common.attrib;
+>
+<!-- end of body.attlist -->]]>
+
+<!-- html: XHTML Document Element ...................... -->
+
+<!ENTITY % html.element "INCLUDE" >
+<![%html.element;[
+<!ENTITY % html.content "( %head.qname;, %body.qname; )" >
+<!ENTITY % html.qname "html" >
+<!ELEMENT %html.qname; %html.content; >
+<!-- end of html.element -->]]>
+
+<!ENTITY % html.attlist "INCLUDE" >
+<![%html.attlist;[
+<!-- version attribute value defined in driver
+-->
+<!ENTITY % XHTML.version.attrib
+ "version %FPI.datatype; #FIXED '%XHTML.version;'"
+>
+
+<!-- see the Qualified Names module for information
+ on how to extend XHTML using XML namespaces
+-->
+<!ATTLIST %html.qname;
+ %XHTML.xmlns.attrib;
+ %XHTML.version.attrib;
+ %I18n.attrib;
+>
+<!-- end of html.attlist -->]]>
+
+<!-- end of xhtml-struct-1.mod -->
+
+
+<!-- end of XHTML Basic 1.0 DTD ........................................... -->
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml-lat1.ent b/bundles/org.eclipse.wst.html.core/dtds/xhtml-lat1.ent
new file mode 100644
index 0000000000..fd23a1de82
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml-lat1.ent
@@ -0,0 +1,196 @@
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+ %HTMLlat1;
+-->
+
+<!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space,
+ U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+ U+00A6 ISOnum -->
+<!ENTITY sect "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;"> <!-- diaeresis = spacing diaeresis,
+ U+00A8 ISOdia -->
+<!ENTITY copy "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;"> <!-- left-pointing double angle quotation mark
+ = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;"> <!-- not sign = angled dash,
+ U+00AC ISOnum -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen = discretionary hyphen,
+ U+00AD ISOnum -->
+<!ENTITY reg "&#174;"> <!-- registered sign = registered trade mark sign,
+ U+00AE ISOnum -->
+<!ENTITY macr "&#175;"> <!-- macron = spacing macron = overline
+ = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+ U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;"> <!-- superscript two = superscript digit two
+ = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;"> <!-- superscript three = superscript digit three
+ = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;"> <!-- acute accent = spacing acute,
+ U+00B4 ISOdia -->
+<!ENTITY micro "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;"> <!-- pilcrow sign = paragraph sign,
+ U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+ = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;"> <!-- superscript one = superscript digit one,
+ U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;"> <!-- masculine ordinal indicator,
+ U+00BA ISOnum -->
+<!ENTITY raquo "&#187;"> <!-- right-pointing double angle quotation mark
+ = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+ = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+ = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+ = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+ = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+ = latin capital letter A grave,
+ U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+ U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;"> <!-- latin capital letter A with circumflex,
+ U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+ U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;"> <!-- latin capital letter A with diaeresis,
+ U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;"> <!-- latin capital letter A with ring above
+ = latin capital letter A ring,
+ U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;"> <!-- latin capital letter AE
+ = latin capital ligature AE,
+ U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+ U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+ U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+ U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;"> <!-- latin capital letter E with circumflex,
+ U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;"> <!-- latin capital letter E with diaeresis,
+ U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+ U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+ U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;"> <!-- latin capital letter I with circumflex,
+ U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;"> <!-- latin capital letter I with diaeresis,
+ U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+ U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+ U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+ U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;"> <!-- latin capital letter O with circumflex,
+ U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+ U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;"> <!-- latin capital letter O with diaeresis,
+ U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+ = latin capital letter O slash,
+ U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+ U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+ U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;"> <!-- latin capital letter U with circumflex,
+ U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;"> <!-- latin capital letter U with diaeresis,
+ U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+ U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;"> <!-- latin capital letter THORN,
+ U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;"> <!-- latin small letter sharp s = ess-zed,
+ U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+ = latin small letter a grave,
+ U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+ U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;"> <!-- latin small letter a with circumflex,
+ U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+ U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;"> <!-- latin small letter a with diaeresis,
+ U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;"> <!-- latin small letter a with ring above
+ = latin small letter a ring,
+ U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;"> <!-- latin small letter ae
+ = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+ U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+ U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+ U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;"> <!-- latin small letter e with circumflex,
+ U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;"> <!-- latin small letter e with diaeresis,
+ U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+ U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+ U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;"> <!-- latin small letter i with circumflex,
+ U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;"> <!-- latin small letter i with diaeresis,
+ U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+ U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+ U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+ U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;"> <!-- latin small letter o with circumflex,
+ U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+ U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;"> <!-- latin small letter o with diaeresis,
+ U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+ = latin small letter o slash,
+ U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+ U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+ U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;"> <!-- latin small letter u with circumflex,
+ U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;"> <!-- latin small letter u with diaeresis,
+ U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+ U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;"> <!-- latin small letter thorn with,
+ U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;"> <!-- latin small letter y with diaeresis,
+ U+00FF ISOlat1 -->
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml-mobile10-flat.dtd b/bundles/org.eclipse.wst.html.core/dtds/xhtml-mobile10-flat.dtd
new file mode 100644
index 0000000000..eb2821394d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml-mobile10-flat.dtd
@@ -0,0 +1,3216 @@
+<!-- XHTML Mobile 1.0 DTD ...................................................... -->
+<!-- file: xhtml-mobile10.dtd -->
+<!--
+ This is XHTML Mobile profile, a proper subset of XHTML.
+
+ @Wireless Application Protocol Forum, Ltd. 2001.
+
+ Terms and conditions of use are available from the Wireless Application Protocol Forum Ltd.
+ Web site (http://www.wapforum.org/what/copyright.htm).
+
+-->
+<!-- This is the driver file for version 1.0 of the XHTML Mobile DTD.
+
+ This DTD is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC: "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
+ SYSTEM: "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"
+-->
+<!ENTITY % XHTML.version "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" >
+
+<!-- Use this URI to identify the default namespace:
+
+ "http://www.w3.org/1999/xhtml"
+
+ See the Qualified Names module for information
+ on the use of namespace prefixes in the DTD.
+-->
+<!ENTITY % NS.prefixed "IGNORE" >
+<!ENTITY % XHTML.prefix "" >
+
+<!-- For example, if you are using XHTML Mobile 1.0 directly, use
+ the FPI in the DOCTYPE declaration, with the xmlns attribute
+ on the document element to identify the default namespace:
+
+ <?xml version="1.0"?>
+ <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
+ "http://www.wapforum.org/DTD/xhtml-mobile10.dtd" >
+ <html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en" >
+ ...
+ </html>
+-->
+
+<!-- reserved for future use with document profiles -->
+<!ENTITY % XHTML.profile "" >
+
+<!-- Inline Style Module ........................................ -->
+<!ENTITY % xhtml-inlstyle.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Style 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Style Module ........................................... -->
+<!-- file: xhtml-inlstyle-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlstyle-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Inline Style 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Style
+
+ This module declares the 'style' attribute, used to support inline
+ style markup. This module must be instantiated prior to the XHTML
+ Common Attributes module in order to be included in %Core.attrib;.
+-->
+
+<!ENTITY % style.attrib
+ "style CDATA #IMPLIED"
+>
+
+
+<!ENTITY % Core.extra.attrib
+ "%style.attrib;"
+>
+
+<!-- end of xhtml-inlstyle-1.mod -->
+
+
+<!-- Document Model ........................................ -->
+<!ENTITY % xhtml-model.mod
+ PUBLIC "-//WAPFORUM//ENTITIES XHTML Mobile 1.0 Document Model 1.0//EN"
+ "http://www.wapforum.org/DTD/xhtml-mobile10-model-1.mod" >
+
+<!-- XHTML Framework ........................................ -->
+<!ENTITY % XHTML.bidi "IGNORE" >
+<!ENTITY % xhtml-framework.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-framework-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Modular Framework Module ...................................... -->
+<!-- file: xhtml-framework-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-framework-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-framework-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Modular Framework
+
+ This required module instantiates the modules needed
+ to support the XHTML modularization model, including:
+
+ + notations
+ + datatypes
+ + namespace-qualified names
+ + common attributes
+ + document model
+ + character entities
+
+ The Intrinsic Events module is ignored by default but
+ occurs in this module because it must be instantiated
+ prior to Attributes but after Datatypes.
+-->
+
+<!ENTITY % xhtml-arch.module "IGNORE" >
+<![%xhtml-arch.module;[
+<!ENTITY % xhtml-arch.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Architecture 1.0//EN"
+ "xhtml-arch-1.mod" >
+%xhtml-arch.mod;]]>
+
+<!ENTITY % xhtml-notations.module "INCLUDE" >
+<![%xhtml-notations.module;[
+<!ENTITY % xhtml-notations.mod
+ PUBLIC "-//W3C//NOTATIONS XHTML Notations 1.0//EN"
+ "xhtml-notations-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Notations Module .............................................. -->
+<!-- file: xhtml-notations-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-notations-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//NOTATIONS XHTML Notations 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-notations-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Notations
+
+ defines the following notations, many of these imported from
+ other specifications and standards. When an existing FPI is
+ known, it is incorporated here.
+-->
+
+<!-- XML Notations ..................................... -->
+<!-- SGML and XML Notations ............................ -->
+
+<!-- W3C XML 1.0 Recommendation -->
+<!NOTATION w3c-xml
+ PUBLIC "ISO 8879//NOTATION Extensible Markup Language (XML) 1.0//EN" >
+
+<!-- XML 1.0 CDATA -->
+<!NOTATION cdata
+ PUBLIC "-//W3C//NOTATION XML 1.0: CDATA//EN" >
+
+<!-- SGML Formal Public Identifiers -->
+<!NOTATION fpi
+ PUBLIC "ISO 8879:1986//NOTATION Formal Public Identifier//EN" >
+
+<!-- XHTML Notations ................................... -->
+
+<!-- Length defined for cellpadding/cellspacing -->
+
+<!-- nn for pixels or nn% for percentage length -->
+<!NOTATION length
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Length//EN" >
+
+<!-- space-separated list of link types -->
+<!NOTATION linkTypes
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: LinkTypes//EN" >
+
+<!-- single or comma-separated list of media descriptors -->
+<!NOTATION mediaDesc
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: MediaDesc//EN" >
+
+<!-- pixel, percentage, or relative -->
+<!NOTATION multiLength
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: MultiLength//EN" >
+
+<!-- one or more digits (NUMBER) -->
+<!NOTATION number
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Number//EN" >
+
+<!-- integer representing length in pixels -->
+<!NOTATION pixels
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Pixels//EN" >
+
+<!-- script expression -->
+<!NOTATION script
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Script//EN" >
+
+<!-- textual content -->
+<!NOTATION text
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Text//EN" >
+
+<!-- Imported Notations ................................ -->
+
+<!-- a single character from [ISO10646] -->
+<!NOTATION character
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Character//EN" >
+
+<!-- a character encoding, as per [RFC2045] -->
+<!NOTATION charset
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Charset//EN" >
+
+<!-- a space separated list of character encodings, as per [RFC2045] -->
+<!NOTATION charsets
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Charsets//EN" >
+
+<!-- media type, as per [RFC2045] -->
+<!NOTATION contentType
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: ContentType//EN" >
+
+<!-- comma-separated list of media types, as per [RFC2045] -->
+<!NOTATION contentTypes
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: ContentTypes//EN" >
+
+<!-- date and time information. ISO date format -->
+<!NOTATION datetime
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Datetime//EN" >
+
+<!-- a language code, as per [RFC3066] -->
+<!NOTATION languageCode
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: LanguageCode//EN" >
+
+<!-- a Uniform Resource Identifier, see [URI] -->
+<!NOTATION uri
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: URI//EN" >
+
+<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
+<!NOTATION uris
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: URIs//EN" >
+
+<!-- end of xhtml-notations-1.mod -->
+]]>
+
+<!ENTITY % xhtml-datatypes.module "INCLUDE" >
+<![%xhtml-datatypes.module;[
+<!ENTITY % xhtml-datatypes.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
+ "xhtml-datatypes-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Datatypes Module .............................................. -->
+<!-- file: xhtml-datatypes-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-datatypes-1.mod,v 4.1 2001/04/06 19:23:32 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-datatypes-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Datatypes
+
+ defines containers for the following datatypes, many of
+ these imported from other specifications and standards.
+-->
+
+<!-- Length defined for cellpadding/cellspacing -->
+
+<!-- nn for pixels or nn% for percentage length -->
+<!ENTITY % Length.datatype "CDATA" >
+
+<!-- space-separated list of link types -->
+<!ENTITY % LinkTypes.datatype "NMTOKENS" >
+
+<!-- single or comma-separated list of media descriptors -->
+<!ENTITY % MediaDesc.datatype "CDATA" >
+
+<!-- pixel, percentage, or relative -->
+<!ENTITY % MultiLength.datatype "CDATA" >
+
+<!-- one or more digits (NUMBER) -->
+<!ENTITY % Number.datatype "CDATA" >
+
+<!-- integer representing length in pixels -->
+<!ENTITY % Pixels.datatype "CDATA" >
+
+<!-- script expression -->
+<!ENTITY % Script.datatype "CDATA" >
+
+<!-- textual content -->
+<!ENTITY % Text.datatype "CDATA" >
+
+<!-- Imported Datatypes ................................ -->
+
+<!-- a single character from [ISO10646] -->
+<!ENTITY % Character.datatype "CDATA" >
+
+<!-- a character encoding, as per [RFC2045] -->
+<!ENTITY % Charset.datatype "CDATA" >
+
+<!-- a space separated list of character encodings, as per [RFC2045] -->
+<!ENTITY % Charsets.datatype "CDATA" >
+
+<!-- Color specification using color name or sRGB (#RRGGBB) values -->
+<!ENTITY % Color.datatype "CDATA" >
+
+<!-- media type, as per [RFC2045] -->
+<!ENTITY % ContentType.datatype "CDATA" >
+
+<!-- comma-separated list of media types, as per [RFC2045] -->
+<!ENTITY % ContentTypes.datatype "CDATA" >
+
+<!-- date and time information. ISO date format -->
+<!ENTITY % Datetime.datatype "CDATA" >
+
+<!-- formal public identifier, as per [ISO8879] -->
+<!ENTITY % FPI.datatype "CDATA" >
+
+<!-- a language code, as per [RFC3066] -->
+<!ENTITY % LanguageCode.datatype "NMTOKEN" >
+
+<!-- a Uniform Resource Identifier, see [URI] -->
+<!ENTITY % URI.datatype "CDATA" >
+
+<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
+<!ENTITY % URIs.datatype "CDATA" >
+
+<!-- end of xhtml-datatypes-1.mod -->
+]]>
+
+<!-- placeholder for XLink support module -->
+<!ENTITY % xhtml-xlink.mod "" >
+
+
+<!ENTITY % xhtml-qname.module "INCLUDE" >
+<![%xhtml-qname.module;[
+<!ENTITY % xhtml-qname.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
+ "xhtml-qname-1.mod" >
+<!-- ....................................................................... -->
+<!-- XHTML Qname Module ................................................... -->
+<!-- file: xhtml-qname-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-qname-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-qname-1.mod"
+
+ Revisions:
+#2000-10-22: added qname declarations for ruby elements
+ ....................................................................... -->
+
+<!-- XHTML Qname (Qualified Name) Module
+
+ This module is contained in two parts, labeled Section 'A' and 'B':
+
+ Section A declares parameter entities to support namespace-
+ qualified names, namespace declarations, and name prefixing
+ for XHTML and extensions.
+
+ Section B declares parameter entities used to provide
+ namespace-qualified names for all XHTML element types:
+
+ %applet.qname; the xmlns-qualified name for <applet>
+ %base.qname; the xmlns-qualified name for <base>
+ ...
+
+ XHTML extensions would create a module similar to this one.
+ Included in the XHTML distribution is a template module
+ ('template-qname-1.mod') suitable for this purpose.
+-->
+
+<!-- Section A: XHTML XML Namespace Framework :::::::::::::::::::: -->
+
+<!-- 1. Declare a %XHTML.prefixed; conditional section keyword, used
+ to activate namespace prefixing. The default value should
+ inherit '%NS.prefixed;' from the DTD driver, so that unless
+ overridden, the default behaviour follows the overall DTD
+ prefixing scheme.
+-->
+<!ENTITY % NS.prefixed "IGNORE" >
+<!ENTITY % XHTML.prefixed "%NS.prefixed;" >
+
+<!-- 2. Declare a parameter entity (eg., %XHTML.xmlns;) containing
+ the URI reference used to identify the XHTML namespace:
+-->
+<!ENTITY % XHTML.xmlns "http://www.w3.org/1999/xhtml" >
+
+<!-- 3. Declare parameter entities (eg., %XHTML.prefix;) containing
+ the default namespace prefix string(s) to use when prefixing
+ is enabled. This may be overridden in the DTD driver or the
+ internal subset of an document instance. If no default prefix
+ is desired, this may be declared as an empty string.
+
+ NOTE: As specified in [XMLNAMES], the namespace prefix serves
+ as a proxy for the URI reference, and is not in itself significant.
+-->
+<!ENTITY % XHTML.prefix "" >
+
+<!-- 4. Declare parameter entities (eg., %XHTML.pfx;) containing the
+ colonized prefix(es) (eg., '%XHTML.prefix;:') used when
+ prefixing is active, an empty string when it is not.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % XHTML.pfx "%XHTML.prefix;:" >
+]]>
+<!ENTITY % XHTML.pfx "" >
+
+<!-- declare qualified name extensions here ............ -->
+<!ENTITY % xhtml-qname-extra.mod "" >
+
+
+<!-- 5. The parameter entity %XHTML.xmlns.extra.attrib; may be
+ redeclared to contain any non-XHTML namespace declaration
+ attributes for namespaces embedded in XHTML. The default
+ is an empty string. XLink should be included here if used
+ in the DTD.
+-->
+<!ENTITY % XHTML.xmlns.extra.attrib "" >
+
+<!-- The remainder of Section A is only followed in XHTML, not extensions. -->
+
+<!-- Declare a parameter entity %NS.decl.attrib; containing
+ all XML Namespace declarations used in the DTD, plus the
+ xmlns declaration for XHTML, its form dependent on whether
+ prefixing is active.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % NS.decl.attrib
+ "xmlns:%XHTML.prefix; %URI.datatype; #FIXED '%XHTML.xmlns;'
+ %XHTML.xmlns.extra.attrib;"
+>
+]]>
+<!ENTITY % NS.decl.attrib
+ "%XHTML.xmlns.extra.attrib;"
+>
+
+<!-- This is a placeholder for future XLink support.
+-->
+<!ENTITY % XLINK.xmlns.attrib "" >
+
+<!-- Declare a parameter entity %NS.decl.attrib; containing all
+ XML namespace declaration attributes used by XHTML, including
+ a default xmlns attribute when prefixing is inactive.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % XHTML.xmlns.attrib
+ "%NS.decl.attrib;
+ %XLINK.xmlns.attrib;"
+>
+]]>
+<!ENTITY % XHTML.xmlns.attrib
+ "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;'
+ %XLINK.xmlns.attrib;"
+>
+
+<!-- placeholder for qualified name redeclarations -->
+<!ENTITY % xhtml-qname.redecl "" >
+
+
+<!-- Section B: XHTML Qualified Names ::::::::::::::::::::::::::::: -->
+
+<!-- 6. This section declares parameter entities used to provide
+ namespace-qualified names for all XHTML element types.
+-->
+
+<!-- module: xhtml-applet-1.mod -->
+<!ENTITY % applet.qname "%XHTML.pfx;applet" >
+
+<!-- module: xhtml-base-1.mod -->
+<!ENTITY % base.qname "%XHTML.pfx;base" >
+
+<!-- module: xhtml-bdo-1.mod -->
+<!ENTITY % bdo.qname "%XHTML.pfx;bdo" >
+
+<!-- module: xhtml-blkphras-1.mod -->
+<!ENTITY % address.qname "%XHTML.pfx;address" >
+<!ENTITY % blockquote.qname "%XHTML.pfx;blockquote" >
+<!ENTITY % pre.qname "%XHTML.pfx;pre" >
+<!ENTITY % h1.qname "%XHTML.pfx;h1" >
+<!ENTITY % h2.qname "%XHTML.pfx;h2" >
+<!ENTITY % h3.qname "%XHTML.pfx;h3" >
+<!ENTITY % h4.qname "%XHTML.pfx;h4" >
+<!ENTITY % h5.qname "%XHTML.pfx;h5" >
+<!ENTITY % h6.qname "%XHTML.pfx;h6" >
+
+<!-- module: xhtml-blkpres-1.mod -->
+<!ENTITY % hr.qname "%XHTML.pfx;hr" >
+
+<!-- module: xhtml-blkstruct-1.mod -->
+<!ENTITY % div.qname "%XHTML.pfx;div" >
+<!ENTITY % p.qname "%XHTML.pfx;p" >
+
+<!-- module: xhtml-edit-1.mod -->
+<!ENTITY % ins.qname "%XHTML.pfx;ins" >
+<!ENTITY % del.qname "%XHTML.pfx;del" >
+
+<!-- module: xhtml-form-1.mod -->
+<!ENTITY % form.qname "%XHTML.pfx;form" >
+<!ENTITY % label.qname "%XHTML.pfx;label" >
+<!ENTITY % input.qname "%XHTML.pfx;input" >
+<!ENTITY % select.qname "%XHTML.pfx;select" >
+<!ENTITY % optgroup.qname "%XHTML.pfx;optgroup" >
+<!ENTITY % option.qname "%XHTML.pfx;option" >
+<!ENTITY % textarea.qname "%XHTML.pfx;textarea" >
+<!ENTITY % fieldset.qname "%XHTML.pfx;fieldset" >
+<!ENTITY % legend.qname "%XHTML.pfx;legend" >
+<!ENTITY % button.qname "%XHTML.pfx;button" >
+
+<!-- module: xhtml-hypertext-1.mod -->
+<!ENTITY % a.qname "%XHTML.pfx;a" >
+
+<!-- module: xhtml-image-1.mod -->
+<!ENTITY % img.qname "%XHTML.pfx;img" >
+
+<!-- module: xhtml-inlphras-1.mod -->
+<!ENTITY % abbr.qname "%XHTML.pfx;abbr" >
+<!ENTITY % acronym.qname "%XHTML.pfx;acronym" >
+<!ENTITY % cite.qname "%XHTML.pfx;cite" >
+<!ENTITY % code.qname "%XHTML.pfx;code" >
+<!ENTITY % dfn.qname "%XHTML.pfx;dfn" >
+<!ENTITY % em.qname "%XHTML.pfx;em" >
+<!ENTITY % kbd.qname "%XHTML.pfx;kbd" >
+<!ENTITY % q.qname "%XHTML.pfx;q" >
+<!ENTITY % samp.qname "%XHTML.pfx;samp" >
+<!ENTITY % strong.qname "%XHTML.pfx;strong" >
+<!ENTITY % var.qname "%XHTML.pfx;var" >
+
+<!-- module: xhtml-inlpres-1.mod -->
+<!ENTITY % b.qname "%XHTML.pfx;b" >
+<!ENTITY % big.qname "%XHTML.pfx;big" >
+<!ENTITY % i.qname "%XHTML.pfx;i" >
+<!ENTITY % small.qname "%XHTML.pfx;small" >
+<!ENTITY % sub.qname "%XHTML.pfx;sub" >
+<!ENTITY % sup.qname "%XHTML.pfx;sup" >
+<!ENTITY % tt.qname "%XHTML.pfx;tt" >
+
+<!-- module: xhtml-inlstruct-1.mod -->
+<!ENTITY % br.qname "%XHTML.pfx;br" >
+<!ENTITY % span.qname "%XHTML.pfx;span" >
+
+<!-- module: xhtml-ismap-1.mod (also csismap, ssismap) -->
+<!ENTITY % map.qname "%XHTML.pfx;map" >
+<!ENTITY % area.qname "%XHTML.pfx;area" >
+
+<!-- module: xhtml-link-1.mod -->
+<!ENTITY % link.qname "%XHTML.pfx;link" >
+
+<!-- module: xhtml-list-1.mod -->
+<!ENTITY % dl.qname "%XHTML.pfx;dl" >
+<!ENTITY % dt.qname "%XHTML.pfx;dt" >
+<!ENTITY % dd.qname "%XHTML.pfx;dd" >
+<!ENTITY % ol.qname "%XHTML.pfx;ol" >
+<!ENTITY % ul.qname "%XHTML.pfx;ul" >
+<!ENTITY % li.qname "%XHTML.pfx;li" >
+
+<!-- module: xhtml-meta-1.mod -->
+<!ENTITY % meta.qname "%XHTML.pfx;meta" >
+
+<!-- module: xhtml-param-1.mod -->
+<!ENTITY % param.qname "%XHTML.pfx;param" >
+
+<!-- module: xhtml-object-1.mod -->
+<!ENTITY % object.qname "%XHTML.pfx;object" >
+
+<!-- module: xhtml-script-1.mod -->
+<!ENTITY % script.qname "%XHTML.pfx;script" >
+<!ENTITY % noscript.qname "%XHTML.pfx;noscript" >
+
+<!-- module: xhtml-struct-1.mod -->
+<!ENTITY % html.qname "%XHTML.pfx;html" >
+<!ENTITY % head.qname "%XHTML.pfx;head" >
+<!ENTITY % title.qname "%XHTML.pfx;title" >
+<!ENTITY % body.qname "%XHTML.pfx;body" >
+
+<!-- module: xhtml-style-1.mod -->
+<!ENTITY % style.qname "%XHTML.pfx;style" >
+
+<!-- module: xhtml-table-1.mod -->
+<!ENTITY % table.qname "%XHTML.pfx;table" >
+<!ENTITY % caption.qname "%XHTML.pfx;caption" >
+<!ENTITY % thead.qname "%XHTML.pfx;thead" >
+<!ENTITY % tfoot.qname "%XHTML.pfx;tfoot" >
+<!ENTITY % tbody.qname "%XHTML.pfx;tbody" >
+<!ENTITY % colgroup.qname "%XHTML.pfx;colgroup" >
+<!ENTITY % col.qname "%XHTML.pfx;col" >
+<!ENTITY % tr.qname "%XHTML.pfx;tr" >
+<!ENTITY % th.qname "%XHTML.pfx;th" >
+<!ENTITY % td.qname "%XHTML.pfx;td" >
+
+<!-- module: xhtml-ruby-1.mod -->
+
+<!ENTITY % ruby.qname "%XHTML.pfx;ruby" >
+<!ENTITY % rbc.qname "%XHTML.pfx;rbc" >
+<!ENTITY % rtc.qname "%XHTML.pfx;rtc" >
+<!ENTITY % rb.qname "%XHTML.pfx;rb" >
+<!ENTITY % rt.qname "%XHTML.pfx;rt" >
+<!ENTITY % rp.qname "%XHTML.pfx;rp" >
+
+<!-- Provisional XHTML 2.0 Qualified Names ...................... -->
+
+<!-- module: xhtml-image-2.mod -->
+<!ENTITY % alt.qname "%XHTML.pfx;alt" >
+
+<!-- end of xhtml-qname-1.mod -->
+]]>
+
+<!ENTITY % xhtml-events.module "IGNORE" >
+<![%xhtml-events.module;[
+<!ENTITY % xhtml-events.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Intrinsic Events 1.0//EN"
+ "xhtml-events-1.mod" >
+%xhtml-events.mod;]]>
+
+<!ENTITY % xhtml-attribs.module "INCLUDE" >
+<![%xhtml-attribs.module;[
+<!ENTITY % xhtml-attribs.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Common Attributes 1.0//EN"
+ "xhtml-attribs-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Common Attributes Module ...................................... -->
+<!-- file: xhtml-attribs-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-attribs-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Common Attributes 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-attribs-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Common Attributes
+
+ This module declares many of the common attributes for the XHTML DTD.
+ %NS.decl.attrib; is declared in the XHTML Qname module.
+-->
+
+<!ENTITY % id.attrib
+ "id ID #IMPLIED"
+>
+
+<!ENTITY % class.attrib
+ "class NMTOKENS #IMPLIED"
+>
+
+<!ENTITY % title.attrib
+ "title %Text.datatype; #IMPLIED"
+>
+
+<!ENTITY % Core.extra.attrib "" >
+
+<!ENTITY % Core.attrib
+ "%XHTML.xmlns.attrib;
+ %id.attrib;
+ %class.attrib;
+ %title.attrib;
+ %Core.extra.attrib;"
+>
+
+<!ENTITY % lang.attrib
+ "xml:lang %LanguageCode.datatype; #IMPLIED"
+>
+
+<![%XHTML.bidi;[
+<!ENTITY % dir.attrib
+ "dir ( ltr | rtl ) #IMPLIED"
+>
+
+<!ENTITY % I18n.attrib
+ "%dir.attrib;
+ %lang.attrib;"
+>
+
+]]>
+<!ENTITY % I18n.attrib
+ "%lang.attrib;"
+>
+
+<!ENTITY % Common.extra.attrib "" >
+
+<!-- intrinsic event attributes declared previously
+-->
+<!ENTITY % Events.attrib "" >
+
+<!ENTITY % Common.attrib
+ "%Core.attrib;
+ %I18n.attrib;
+ %Events.attrib;
+ %Common.extra.attrib;"
+>
+
+<!-- end of xhtml-attribs-1.mod -->
+]]>
+
+<!-- placeholder for content model redeclarations -->
+<!ENTITY % xhtml-model.redecl "" >
+
+
+<!ENTITY % xhtml-model.module "INCLUDE" >
+<![%xhtml-model.module;[
+<!-- instantiate the Document Model module declared in the DTD driver
+-->
+<!-- ....................................................................... -->
+<!-- XHTML Mobile 1.0 Document Model Module .................................... -->
+<!-- file: xhtml-mobile10-model-1.mod
+
+ This is XHTML Mobile, a proper subset of XHTML.
+ @Wireless Application Protocol Forum, Ltd. 2001.
+
+ Terms and conditions of use are available from the Wireless Application Protocol Forum Ltd.
+ Web site (http://www.wapforum.org/what/copyright.htm).
+
+-->
+<!-- XHTML Mobile Document Model
+
+ This module describes the groupings of elements that make up
+ common content models for XHTML elements.
+-->
+
+<!-- Optional Elements in head .............. -->
+
+<!ENTITY % HeadOpts.mix
+ "( %meta.qname; | %link.qname; | %object.qname; | %style.qname; )*" >
+
+<!-- Miscellaneous Elements ................. -->
+
+<!ENTITY % Misc.class "" >
+
+<!-- Inline Elements ........................ -->
+
+<!ENTITY % InlStruct.class "%br.qname; | %span.qname;" >
+
+<!ENTITY % InlPhras.class
+ "| %em.qname; | %strong.qname; | %dfn.qname; | %code.qname;
+ | %samp.qname; | %kbd.qname; | %var.qname; | %cite.qname;
+ | %abbr.qname; | %acronym.qname; | %q.qname;" >
+
+<!ENTITY % InlPres.class
+ "| %i.qname; | %b.qname; | %big.qname; | %small.qname; " >
+
+
+<!ENTITY % I18n.class "" >
+
+<!ENTITY % Anchor.class "| %a.qname;" >
+
+<!ENTITY % InlSpecial.class "| %img.qname; | %object.qname;" >
+
+<!ENTITY % InlForm.class
+ "| %input.qname; | %select.qname; | %textarea.qname;
+ | %label.qname;"
+>
+
+<!ENTITY % Inline.extra "" >
+
+<!ENTITY % Inline.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %Anchor.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Inline.extra;"
+>
+
+<!ENTITY % InlNoAnchor.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Inline.extra;"
+>
+
+<!ENTITY % InlNoAnchor.mix
+ "%InlNoAnchor.class;
+ %Misc.class;"
+>
+
+<!ENTITY % Inline.mix
+ "%Inline.class;
+ %Misc.class;"
+>
+
+<!-- Block Elements ......................... -->
+
+<!ENTITY % Heading.class
+ "%h1.qname; | %h2.qname; | %h3.qname;
+ | %h4.qname; | %h5.qname; | %h6.qname;"
+>
+<!ENTITY % List.class "%ul.qname; | %ol.qname; | %dl.qname;" >
+
+<!ENTITY % Table.class "| %table.qname;" >
+
+<!ENTITY % Form.class "| %form.qname;" >
+
+<!ENTITY % Fieldset.class "| %fieldset.qname;" >
+
+<!ENTITY % BlkStruct.class "%p.qname; | %div.qname;" >
+
+<!ENTITY % BlkPhras.class
+ "| %pre.qname; | %blockquote.qname; | %address.qname;"
+>
+
+<!ENTITY % BlkPres.class "| %hr.qname;" >
+
+<!ENTITY % BlkSpecial.class
+ "%Table.class;
+ %Form.class;
+ %Fieldset.class;"
+>
+
+<!ENTITY % Block.extra "" >
+
+<!ENTITY % Block.class
+ "%BlkStruct.class;
+ %BlkPhras.class;
+ %BlkPres.class;
+ %BlkSpecial.class;
+ %Block.extra;"
+>
+
+<!ENTITY % BlkNoForm.mix
+ "%Heading.class;
+ | %List.class;
+ | %BlkStruct.class;
+ %BlkPhras.class;
+ %BlkPres.class;
+ %Table.class;
+ %Block.extra;
+ %Misc.class;"
+>
+
+<!ENTITY % Block.mix
+ "%Heading.class;
+ | %List.class;
+ | %Block.class;
+ %Misc.class;"
+>
+
+<!-- All Content Elements ................... -->
+
+<!-- declares all content except tables
+-->
+<!ENTITY % FlowNoTable.mix
+ "%Heading.class;
+ | %List.class;
+ | %BlkStruct.class;
+ %BlkPhras.class;
+ %Form.class;
+ %Block.extra;
+ | %Inline.class;
+ %Misc.class;"
+>
+
+
+<!ENTITY % Flow.mix
+ "%Heading.class;
+ | %List.class;
+ | %Block.class;
+ | %Inline.class;
+ %Misc.class;"
+>
+
+<!-- end of xhtml-mobile10-model-1.mod -->
+]]>
+
+<!ENTITY % xhtml-charent.module "INCLUDE" >
+<![%xhtml-charent.module;[
+<!ENTITY % xhtml-charent.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Character Entities 1.0//EN"
+ "xhtml-charent-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Character Entities Module ......................................... -->
+<!-- file: xhtml-charent-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-charent-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Character Entities 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-charent-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Character Entities for XHTML
+
+ This module declares the set of character entities for XHTML,
+ including the Latin 1, Symbol and Special character collections.
+-->
+
+<!ENTITY % xhtml-lat1
+ PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent" >
+<!-- ...................................................................... -->
+<!-- XML-compatible ISO Latin 1 Character Entity Set for XHTML ............ -->
+<!-- file: xhtml-lat1.ent
+
+ Typical invocation:
+
+ <!ENTITY % xhtml-lat1
+ PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent" >
+ %xhtml-lat1;
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-lat1.ent"
+
+ Revision: $Id: xhtml-lat1.ent,v 4.1 2001/04/10 09:34:14 altheim Exp $ SMI
+
+ Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with conforming
+ SGML systems and applications as defined in ISO 8879, provided
+ this notice is included in all copies.
+-->
+
+<!ENTITY nbsp "&#160;" ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;" ><!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;" ><!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;" ><!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;" ><!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;" ><!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;" ><!-- broken bar = broken vertical bar, U+00A6 ISOnum -->
+<!ENTITY sect "&#167;" ><!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;" ><!-- diaeresis = spacing diaeresis, U+00A8 ISOdia -->
+<!ENTITY copy "&#169;" ><!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;" ><!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;" ><!-- left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;" ><!-- not sign, U+00AC ISOnum -->
+<!ENTITY shy "&#173;" ><!-- soft hyphen = discretionary hyphen, U+00AD ISOnum -->
+<!ENTITY reg "&#174;" ><!-- registered sign = registered trade mark sign, U+00AE ISOnum -->
+<!ENTITY macr "&#175;" ><!-- macron = spacing macron = overline = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;" ><!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;" ><!-- plus-minus sign = plus-or-minus sign, U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;" ><!-- superscript two = superscript digit two = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;" ><!-- superscript three = superscript digit three = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;" ><!-- acute accent = spacing acute, U+00B4 ISOdia -->
+<!ENTITY micro "&#181;" ><!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;" ><!-- pilcrow sign = paragraph sign, U+00B6 ISOnum -->
+<!ENTITY middot "&#183;" ><!-- middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;" ><!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;" ><!-- superscript one = superscript digit one, U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;" ><!-- masculine ordinal indicator, U+00BA ISOnum -->
+<!ENTITY raquo "&#187;" ><!-- right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;" ><!-- vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;" ><!-- vulgar fraction one half = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;" ><!-- vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;" ><!-- inverted question mark = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;" ><!-- latin capital A with grave = latin capital A grave, U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;" ><!-- latin capital A with acute, U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;" ><!-- latin capital A with circumflex, U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;" ><!-- latin capital A with tilde, U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;" ><!-- latin capital A with diaeresis, U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;" ><!-- latin capital A with ring above = latin capital A ring, U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;" ><!-- latin capital AE = latin capital ligature AE, U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;" ><!-- latin capital C with cedilla, U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;" ><!-- latin capital E with grave, U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;" ><!-- latin capital E with acute, U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;" ><!-- latin capital E with circumflex, U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;" ><!-- latin capital E with diaeresis, U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;" ><!-- latin capital I with grave, U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;" ><!-- latin capital I with acute, U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;" ><!-- latin capital I with circumflex, U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;" ><!-- latin capital I with diaeresis, U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;" ><!-- latin capital ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;" ><!-- latin capital N with tilde, U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;" ><!-- latin capital O with grave, U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;" ><!-- latin capital O with acute, U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;" ><!-- latin capital O with circumflex, U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;" ><!-- latin capital O with tilde, U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;" ><!-- latin capital O with diaeresis, U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;" ><!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;" ><!-- latin capital O with stroke = latin capital O slash, U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;" ><!-- latin capital U with grave, U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;" ><!-- latin capital U with acute, U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;" ><!-- latin capital U with circumflex, U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;" ><!-- latin capital U with diaeresis, U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;" ><!-- latin capital Y with acute, U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;" ><!-- latin capital THORN, U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;" ><!-- latin small sharp s = ess-zed, U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;" ><!-- latin small a with grave = latin small a grave, U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;" ><!-- latin small a with acute, U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;" ><!-- latin small a with circumflex, U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;" ><!-- latin small a with tilde, U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;" ><!-- latin small a with diaeresis, U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;" ><!-- latin small a with ring above = latin small a ring, U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;" ><!-- latin small ae = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;" ><!-- latin small c with cedilla, U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;" ><!-- latin small e with grave, U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;" ><!-- latin small e with acute, U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;" ><!-- latin small e with circumflex, U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;" ><!-- latin small e with diaeresis, U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;" ><!-- latin small i with grave, U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;" ><!-- latin small i with acute, U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;" ><!-- latin small i with circumflex, U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;" ><!-- latin small i with diaeresis, U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;" ><!-- latin small eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;" ><!-- latin small n with tilde, U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;" ><!-- latin small o with grave, U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;" ><!-- latin small o with acute, U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;" ><!-- latin small o with circumflex, U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;" ><!-- latin small o with tilde, U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;" ><!-- latin small o with diaeresis, U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;" ><!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;" ><!-- latin small o with stroke, = latin small o slash, U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;" ><!-- latin small u with grave, U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;" ><!-- latin small u with acute, U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;" ><!-- latin small u with circumflex, U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;" ><!-- latin small u with diaeresis, U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;" ><!-- latin small y with acute, U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;" ><!-- latin small thorn with, U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;" ><!-- latin small y with diaeresis, U+00FF ISOlat1 -->
+<!-- end of xhtml-lat1.ent -->
+
+
+<!ENTITY % xhtml-symbol
+ PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent" >
+<!-- ...................................................................... -->
+<!-- ISO Math, Greek and Symbolic Character Entity Set for XHTML .......... -->
+<!-- file: xhtml-symbol.ent
+
+ Typical invocation:
+
+ <!ENTITY % xhtml-symbol
+ PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent" >
+ %xhtml-symbol;
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-symbol.ent"
+
+ Revision: $Id: xhtml-symbol.ent,v 4.1 2001/04/10 09:34:14 altheim Exp $ SMI
+
+ Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with conforming
+ SGML systems and applications as defined in ISO 8879, provided
+ this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 [SGML] list) do not clash with
+ any existing ISO 8879 entity names. ISO 10646 [ISO10646] character
+ numbers are given for each character, in hex. Entity values are
+ decimal conversions of the ISO 10646 values and refer to the
+ document character set. Names are Unicode [UNICODE] names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;" ><!-- latin small f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;" ><!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;" ><!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;" ><!-- greek capital letter gamma, U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;" ><!-- greek capital letter delta, U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;" ><!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;" ><!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;" ><!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;" ><!-- greek capital letter theta, U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;" ><!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;" ><!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;" ><!-- greek capital letter lambda, U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;" ><!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;" ><!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;" ><!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;" ><!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;" ><!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;" ><!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;" ><!-- greek capital letter sigma, U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;" ><!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;" ><!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;" ><!-- greek capital letter phi, U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;" ><!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;" ><!-- greek capital letter psi, U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;" ><!-- greek capital letter omega, U+03A9 ISOgrk3 -->
+<!ENTITY alpha "&#945;" ><!-- greek small letter alpha, U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;" ><!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;" ><!-- greek small letter gamma, U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;" ><!-- greek small letter delta, U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;" ><!-- greek small letter epsilon, U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;" ><!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;" ><!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;" ><!-- greek small letter theta, U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;" ><!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;" ><!-- greek small letter kappa, U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;" ><!-- greek small letter lambda, U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;" ><!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;" ><!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;" ><!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;" ><!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;" ><!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;" ><!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;" ><!-- greek small letter final sigma, U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;" ><!-- greek small letter sigma, U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;" ><!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;" ><!-- greek small letter upsilon, U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;" ><!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;" ><!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;" ><!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;" ><!-- greek small letter omega, U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;" ><!-- greek small letter theta symbol, U+03D1 NEW -->
+<!ENTITY upsih "&#978;" ><!-- greek upsilon with hook symbol, U+03D2 NEW -->
+<!ENTITY piv "&#982;" ><!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;" ><!-- bullet = black small circle, U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;" ><!-- horizontal ellipsis = three dot leader, U+2026 ISOpub -->
+<!ENTITY prime "&#8242;" ><!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;" ><!-- double prime = seconds = inches, U+2033 ISOtech -->
+<!ENTITY oline "&#8254;" ><!-- overline = spacing overscore, U+203E NEW -->
+<!ENTITY frasl "&#8260;" ><!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;" ><!-- script capital P = power set = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;" ><!-- blackletter capital I = imaginary part, U+2111 ISOamso -->
+<!ENTITY real "&#8476;" ><!-- blackletter capital R = real part symbol, U+211C ISOamso -->
+<!ENTITY trade "&#8482;" ><!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;" ><!-- alef symbol = first transfinite cardinal, U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef, U+05D0 although
+ the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;" ><!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;" ><!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;" ><!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;" ><!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;" ><!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;" ><!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;" ><!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So ? lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;" ><!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;" ><!-- rightwards double arrow, U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so ?
+ rArr can be used for 'implies' as ISOtech suggests -->
+<!ENTITY dArr "&#8659;" ><!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;" ><!-- left right double arrow, U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;" ><!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;" ><!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;" ><!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;" ><!-- empty set = null set = diameter, U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;" ><!-- nabla = backward difference, U+2207 ISOtech -->
+<!ENTITY isin "&#8712;" ><!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;" ><!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;" ><!-- contains as member, U+220B ISOtech -->
+<!-- should there be a more memorable name than 'ni'? -->
+<!ENTITY prod "&#8719;" ><!-- n-ary product = product sign, U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;" ><!-- n-ary sumation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;" ><!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;" ><!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;" ><!-- square root = radical sign, U+221A ISOtech -->
+<!ENTITY prop "&#8733;" ><!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;" ><!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;" ><!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;" ><!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;" ><!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;" ><!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;" ><!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;" ><!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;" ><!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;" ><!-- tilde operator = varies with = similar to, U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;" ><!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;" ><!-- almost equal to = asymptotic to, U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;" ><!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;" ><!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;" ><!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;" ><!-- greater-than or equal to, U+2265 ISOtech -->
+<!ENTITY sub "&#8834;" ><!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;" ><!-- superset of, U+2283 ISOtech -->
+<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
+ font encoding and is not included. Should it be, for symmetry?
+ It is in ISOamsn -->
+<!ENTITY nsub "&#8836;" ><!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;" ><!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;" ><!-- superset of or equal to, U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;" ><!-- circled plus = direct sum, U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;" ><!-- circled times = vector product, U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;" ><!-- up tack = orthogonal to = perpendicular, U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;" ><!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;" ><!-- left ceiling = apl upstile, U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;" ><!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;" ><!-- left floor = apl downstile, U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;" ><!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;" ><!-- left-pointing angle bracket = bra, U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;" ><!-- right-pointing angle bracket = ket, U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;" ><!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;" ><!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;" ><!-- black club suit = shamrock, U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;" ><!-- black heart suit = valentine, U+2665 ISOpub -->
+<!ENTITY diams "&#9830;" ><!-- black diamond suit, U+2666 ISOpub -->
+
+<!-- end of xhtml-symbol.ent -->
+
+
+<!ENTITY % xhtml-special
+ PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent" >
+<!-- ...................................................................... -->
+<!-- XML-compatible ISO Special Character Entity Set for XHTML ............ -->
+<!-- file: xhtml-special.ent
+
+ Typical invocation:
+
+ <!ENTITY % xhtml-special
+ PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent" >
+ %xhtml-special;
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-special.ent"
+
+ Revision: $Id: xhtml-special.ent,v 4.1 2001/04/10 09:34:14 altheim Exp $ SMI
+
+ Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with conforming
+ SGML systems and applications as defined in ISO 8879, provided
+ this notice is included in all copies.
+
+ Revisions:
+2000-10-28: added &apos; and altered XML Predefined Entities for compatibility
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 [SGML] list) do not clash with
+ any existing ISO 8879 entity names. ISO 10646 [ISO10646] character
+ numbers are given for each character, in hex. Entity values are
+ decimal conversions of the ISO 10646 values and refer to the
+ document character set. Names are Unicode [UNICODE] names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY lt "&#38;&#60;" ><!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;" ><!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY amp "&#38;&#38;" ><!-- ampersand, U+0026 ISOnum -->
+<!ENTITY apos "&#39;" ><!-- apostrophe, U+0027 ISOnum -->
+<!ENTITY quot "&#34;" ><!-- quotation mark = APL quote, U+0022 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;" ><!-- latin capital ligature OE, U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;" ><!-- latin small ligature oe, U+0153 ISOlat2 -->
+
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;" ><!-- latin capital letter S with caron, U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;" ><!-- latin small letter s with caron, U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;" ><!-- latin capital letter Y with diaeresis, U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;" ><!-- modifier letter circumflex accent, U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;" ><!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;" ><!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;" ><!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;" ><!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;" ><!-- zero width non-joiner, U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;" ><!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;" ><!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;" ><!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;" ><!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;" ><!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;" ><!-- left single quotation mark, U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;" ><!-- right single quotation mark, U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;" ><!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;" ><!-- left double quotation mark, U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;" ><!-- right double quotation mark, U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;" ><!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;" ><!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;" ><!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;" ><!-- per mille sign, U+2030 ISOtech -->
+
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY lsaquo "&#8249;" ><!-- single left-pointing angle quotation mark, U+2039 ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;" ><!-- single right-pointing angle quotation mark, U+203A ISO proposed -->
+<!ENTITY euro "&#8364;" ><!-- euro sign, U+20AC NEW -->
+
+<!-- end of xhtml-special.ent -->
+
+
+<!-- end of xhtml-charent-1.mod -->
+]]>
+
+<!-- end of xhtml-framework-1.mod -->
+
+
+<!-- XHTML Core Modules ........................................ -->
+<!ENTITY % pre.content
+ "( #PCDATA
+ | %InlStruct.class;
+ %InlPhras.class;
+ %Anchor.class;
+ %Inline.extra; )*"
+>
+
+<!ENTITY % xhtml-text.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-text-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Text Module ................................................... -->
+<!-- file: xhtml-text-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-text-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-text-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Textual Content
+
+ The Text module includes declarations for all core
+ text container elements and their attributes.
+-->
+
+<!ENTITY % xhtml-inlstruct.module "INCLUDE" >
+<![%xhtml-inlstruct.module;[
+<!ENTITY % xhtml-inlstruct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN"
+ "xhtml-inlstruct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Structural Module ...................................... -->
+<!-- file: xhtml-inlstruct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlstruct-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstruct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Structural
+
+ br, span
+
+ This module declares the elements and their attributes
+ used to support inline-level structural markup.
+-->
+
+<!-- br: forced line break ............................. -->
+
+<!ENTITY % br.element "INCLUDE" >
+<![%br.element;[
+
+<!ENTITY % br.content "EMPTY" >
+<!ENTITY % br.qname "br" >
+<!ELEMENT %br.qname; %br.content; >
+
+<!-- end of br.element -->]]>
+
+<!ENTITY % br.attlist "INCLUDE" >
+<![%br.attlist;[
+<!ATTLIST %br.qname;
+ %Core.attrib;
+>
+<!-- end of br.attlist -->]]>
+
+<!-- span: generic inline container .................... -->
+
+<!ENTITY % span.element "INCLUDE" >
+<![%span.element;[
+<!ENTITY % span.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % span.qname "span" >
+<!ELEMENT %span.qname; %span.content; >
+<!-- end of span.element -->]]>
+
+<!ENTITY % span.attlist "INCLUDE" >
+<![%span.attlist;[
+<!ATTLIST %span.qname;
+ %Common.attrib;
+>
+<!-- end of span.attlist -->]]>
+
+<!-- end of xhtml-inlstruct-1.mod -->
+]]>
+
+<!ENTITY % xhtml-inlphras.module "INCLUDE" >
+<![%xhtml-inlphras.module;[
+<!ENTITY % xhtml-inlphras.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN"
+ "xhtml-inlphras-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Phrasal Module ......................................... -->
+<!-- file: xhtml-inlphras-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlphras-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlphras-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Phrasal
+
+ abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var
+
+ This module declares the elements and their attributes used to
+ support inline-level phrasal markup.
+-->
+
+<!ENTITY % abbr.element "INCLUDE" >
+<![%abbr.element;[
+<!ENTITY % abbr.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % abbr.qname "abbr" >
+<!ELEMENT %abbr.qname; %abbr.content; >
+<!-- end of abbr.element -->]]>
+
+<!ENTITY % abbr.attlist "INCLUDE" >
+<![%abbr.attlist;[
+<!ATTLIST %abbr.qname;
+ %Common.attrib;
+>
+<!-- end of abbr.attlist -->]]>
+
+<!ENTITY % acronym.element "INCLUDE" >
+<![%acronym.element;[
+<!ENTITY % acronym.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % acronym.qname "acronym" >
+<!ELEMENT %acronym.qname; %acronym.content; >
+<!-- end of acronym.element -->]]>
+
+<!ENTITY % acronym.attlist "INCLUDE" >
+<![%acronym.attlist;[
+<!ATTLIST %acronym.qname;
+ %Common.attrib;
+>
+<!-- end of acronym.attlist -->]]>
+
+<!ENTITY % cite.element "INCLUDE" >
+<![%cite.element;[
+<!ENTITY % cite.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % cite.qname "cite" >
+<!ELEMENT %cite.qname; %cite.content; >
+<!-- end of cite.element -->]]>
+
+<!ENTITY % cite.attlist "INCLUDE" >
+<![%cite.attlist;[
+<!ATTLIST %cite.qname;
+ %Common.attrib;
+>
+<!-- end of cite.attlist -->]]>
+
+<!ENTITY % code.element "INCLUDE" >
+<![%code.element;[
+<!ENTITY % code.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % code.qname "code" >
+<!ELEMENT %code.qname; %code.content; >
+<!-- end of code.element -->]]>
+
+<!ENTITY % code.attlist "INCLUDE" >
+<![%code.attlist;[
+<!ATTLIST %code.qname;
+ %Common.attrib;
+>
+<!-- end of code.attlist -->]]>
+
+<!ENTITY % dfn.element "INCLUDE" >
+<![%dfn.element;[
+<!ENTITY % dfn.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % dfn.qname "dfn" >
+<!ELEMENT %dfn.qname; %dfn.content; >
+<!-- end of dfn.element -->]]>
+
+<!ENTITY % dfn.attlist "INCLUDE" >
+<![%dfn.attlist;[
+<!ATTLIST %dfn.qname;
+ %Common.attrib;
+>
+<!-- end of dfn.attlist -->]]>
+
+<!ENTITY % em.element "INCLUDE" >
+<![%em.element;[
+<!ENTITY % em.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % em.qname "em" >
+<!ELEMENT %em.qname; %em.content; >
+<!-- end of em.element -->]]>
+
+<!ENTITY % em.attlist "INCLUDE" >
+<![%em.attlist;[
+<!ATTLIST %em.qname;
+ %Common.attrib;
+>
+<!-- end of em.attlist -->]]>
+
+<!ENTITY % kbd.element "INCLUDE" >
+<![%kbd.element;[
+<!ENTITY % kbd.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % kbd.qname "kbd" >
+<!ELEMENT %kbd.qname; %kbd.content; >
+<!-- end of kbd.element -->]]>
+
+<!ENTITY % kbd.attlist "INCLUDE" >
+<![%kbd.attlist;[
+<!ATTLIST %kbd.qname;
+ %Common.attrib;
+>
+<!-- end of kbd.attlist -->]]>
+
+<!ENTITY % q.element "INCLUDE" >
+<![%q.element;[
+<!ENTITY % q.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % q.qname "q" >
+<!ELEMENT %q.qname; %q.content; >
+<!-- end of q.element -->]]>
+
+<!ENTITY % q.attlist "INCLUDE" >
+<![%q.attlist;[
+<!ATTLIST %q.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+>
+<!-- end of q.attlist -->]]>
+
+<!ENTITY % samp.element "INCLUDE" >
+<![%samp.element;[
+<!ENTITY % samp.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % samp.qname "samp" >
+<!ELEMENT %samp.qname; %samp.content; >
+<!-- end of samp.element -->]]>
+
+<!ENTITY % samp.attlist "INCLUDE" >
+<![%samp.attlist;[
+<!ATTLIST %samp.qname;
+ %Common.attrib;
+>
+<!-- end of samp.attlist -->]]>
+
+<!ENTITY % strong.element "INCLUDE" >
+<![%strong.element;[
+<!ENTITY % strong.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % strong.qname "strong" >
+<!ELEMENT %strong.qname; %strong.content; >
+<!-- end of strong.element -->]]>
+
+<!ENTITY % strong.attlist "INCLUDE" >
+<![%strong.attlist;[
+<!ATTLIST %strong.qname;
+ %Common.attrib;
+>
+<!-- end of strong.attlist -->]]>
+
+<!ENTITY % var.element "INCLUDE" >
+<![%var.element;[
+<!ENTITY % var.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % var.qname "var" >
+<!ELEMENT %var.qname; %var.content; >
+<!-- end of var.element -->]]>
+
+<!ENTITY % var.attlist "INCLUDE" >
+<![%var.attlist;[
+<!ATTLIST %var.qname;
+ %Common.attrib;
+>
+<!-- end of var.attlist -->]]>
+
+<!-- end of xhtml-inlphras-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkstruct.module "INCLUDE" >
+<![%xhtml-blkstruct.module;[
+<!ENTITY % xhtml-blkstruct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Structural 1.0//EN"
+ "xhtml-blkstruct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Structural Module ....................................... -->
+<!-- file: xhtml-blkstruct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkstruct-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Structural 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkstruct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Structural
+
+ div, p
+
+ This module declares the elements and their attributes used to
+ support block-level structural markup.
+-->
+
+<!ENTITY % div.element "INCLUDE" >
+<![%div.element;[
+<!ENTITY % div.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ENTITY % div.qname "div" >
+<!ELEMENT %div.qname; %div.content; >
+<!-- end of div.element -->]]>
+
+<!ENTITY % div.attlist "INCLUDE" >
+<![%div.attlist;[
+<!ATTLIST %div.qname;
+ %Common.attrib;
+>
+<!-- end of div.attlist -->]]>
+
+<!ENTITY % p.element "INCLUDE" >
+<![%p.element;[
+<!ENTITY % p.content
+ "( #PCDATA | %Inline.mix; )*" >
+<!ENTITY % p.qname "p" >
+<!ELEMENT %p.qname; %p.content; >
+<!-- end of p.element -->]]>
+
+<!ENTITY % p.attlist "INCLUDE" >
+<![%p.attlist;[
+<!ATTLIST %p.qname;
+ %Common.attrib;
+>
+<!-- end of p.attlist -->]]>
+
+<!-- end of xhtml-blkstruct-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkphras.module "INCLUDE" >
+<![%xhtml-blkphras.module;[
+<!ENTITY % xhtml-blkphras.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN"
+ "xhtml-blkphras-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Phrasal Module .......................................... -->
+<!-- file: xhtml-blkphras-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkphras-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkphras-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Phrasal
+
+ address, blockquote, pre, h1, h2, h3, h4, h5, h6
+
+ This module declares the elements and their attributes used to
+ support block-level phrasal markup.
+-->
+
+<!ENTITY % address.element "INCLUDE" >
+<![%address.element;[
+<!ENTITY % address.content
+ "( #PCDATA | %Inline.mix; )*" >
+<!ENTITY % address.qname "address" >
+<!ELEMENT %address.qname; %address.content; >
+<!-- end of address.element -->]]>
+
+<!ENTITY % address.attlist "INCLUDE" >
+<![%address.attlist;[
+<!ATTLIST %address.qname;
+ %Common.attrib;
+>
+<!-- end of address.attlist -->]]>
+
+<!ENTITY % blockquote.element "INCLUDE" >
+<![%blockquote.element;[
+<!ENTITY % blockquote.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % blockquote.qname "blockquote" >
+<!ELEMENT %blockquote.qname; %blockquote.content; >
+<!-- end of blockquote.element -->]]>
+
+<!ENTITY % blockquote.attlist "INCLUDE" >
+<![%blockquote.attlist;[
+<!ATTLIST %blockquote.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+>
+<!-- end of blockquote.attlist -->]]>
+
+<!ENTITY % pre.element "INCLUDE" >
+<![%pre.element;[
+<!ENTITY % pre.content
+ "( #PCDATA
+ | %InlStruct.class;
+ %InlPhras.class;
+ | %tt.qname; | %i.qname; | %b.qname;
+ %I18n.class;
+ %Anchor.class;
+ | %script.qname; | %map.qname;
+ %Inline.extra; )*"
+>
+<!ENTITY % pre.qname "pre" >
+<!ELEMENT %pre.qname; %pre.content; >
+<!-- end of pre.element -->]]>
+
+<!ENTITY % pre.attlist "INCLUDE" >
+<![%pre.attlist;[
+<!ATTLIST %pre.qname;
+ %Common.attrib;
+ xml:space ( preserve ) #FIXED 'preserve'
+>
+<!-- end of pre.attlist -->]]>
+
+<!-- ................... Heading Elements ................... -->
+
+<!ENTITY % Heading.content "( #PCDATA | %Inline.mix; )*" >
+
+<!ENTITY % h1.element "INCLUDE" >
+<![%h1.element;[
+<!ENTITY % h1.qname "h1" >
+<!ELEMENT %h1.qname; %Heading.content; >
+<!-- end of h1.element -->]]>
+
+<!ENTITY % h1.attlist "INCLUDE" >
+<![%h1.attlist;[
+<!ATTLIST %h1.qname;
+ %Common.attrib;
+>
+<!-- end of h1.attlist -->]]>
+
+<!ENTITY % h2.element "INCLUDE" >
+<![%h2.element;[
+<!ENTITY % h2.qname "h2" >
+<!ELEMENT %h2.qname; %Heading.content; >
+<!-- end of h2.element -->]]>
+
+<!ENTITY % h2.attlist "INCLUDE" >
+<![%h2.attlist;[
+<!ATTLIST %h2.qname;
+ %Common.attrib;
+>
+<!-- end of h2.attlist -->]]>
+
+<!ENTITY % h3.element "INCLUDE" >
+<![%h3.element;[
+<!ENTITY % h3.qname "h3" >
+<!ELEMENT %h3.qname; %Heading.content; >
+<!-- end of h3.element -->]]>
+
+<!ENTITY % h3.attlist "INCLUDE" >
+<![%h3.attlist;[
+<!ATTLIST %h3.qname;
+ %Common.attrib;
+>
+<!-- end of h3.attlist -->]]>
+
+<!ENTITY % h4.element "INCLUDE" >
+<![%h4.element;[
+<!ENTITY % h4.qname "h4" >
+<!ELEMENT %h4.qname; %Heading.content; >
+<!-- end of h4.element -->]]>
+
+<!ENTITY % h4.attlist "INCLUDE" >
+<![%h4.attlist;[
+<!ATTLIST %h4.qname;
+ %Common.attrib;
+>
+<!-- end of h4.attlist -->]]>
+
+<!ENTITY % h5.element "INCLUDE" >
+<![%h5.element;[
+<!ENTITY % h5.qname "h5" >
+<!ELEMENT %h5.qname; %Heading.content; >
+<!-- end of h5.element -->]]>
+
+<!ENTITY % h5.attlist "INCLUDE" >
+<![%h5.attlist;[
+<!ATTLIST %h5.qname;
+ %Common.attrib;
+>
+<!-- end of h5.attlist -->]]>
+
+<!ENTITY % h6.element "INCLUDE" >
+<![%h6.element;[
+<!ENTITY % h6.qname "h6" >
+<!ELEMENT %h6.qname; %Heading.content; >
+<!-- end of h6.element -->]]>
+
+<!ENTITY % h6.attlist "INCLUDE" >
+<![%h6.attlist;[
+<!ATTLIST %h6.qname;
+ %Common.attrib;
+>
+<!-- end of h6.attlist -->]]>
+
+<!-- end of xhtml-blkphras-1.mod -->
+]]>
+
+<!-- end of xhtml-text-1.mod -->
+
+
+<!ENTITY % xhtml-hypertext.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-hypertext-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Hypertext Module .............................................. -->
+<!-- file: xhtml-hypertext-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-hypertext-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-hypertext-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Hypertext
+
+ a
+
+ This module declares the anchor ('a') element type, which
+ defines the source of a hypertext link. The destination
+ (or link 'target') is identified via its 'id' attribute
+ rather than the 'name' attribute as was used in HTML.
+-->
+
+<!-- ............ Anchor Element ............ -->
+
+<!ENTITY % a.element "INCLUDE" >
+<![%a.element;[
+<!ENTITY % a.content
+ "( #PCDATA | %InlNoAnchor.mix; )*"
+>
+<!ENTITY % a.qname "a" >
+<!ELEMENT %a.qname; %a.content; >
+<!-- end of a.element -->]]>
+
+<!ENTITY % a.attlist "INCLUDE" >
+<![%a.attlist;[
+<!ATTLIST %a.qname;
+ %Common.attrib;
+ href %URI.datatype; #IMPLIED
+ charset %Charset.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ hreflang %LanguageCode.datatype; #IMPLIED
+ rel %LinkTypes.datatype; #IMPLIED
+ rev %LinkTypes.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of a.attlist -->]]>
+
+<!-- end of xhtml-hypertext-1.mod -->
+
+
+<!ENTITY % xhtml-list.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-list-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Lists Module .................................................. -->
+<!-- file: xhtml-list-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-list-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-list-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Lists
+
+ dl, dt, dd, ol, ul, li
+
+ This module declares the list-oriented element types
+ and their attributes.
+-->
+
+<!ENTITY % dl.qname "dl" >
+<!ENTITY % dt.qname "dt" >
+<!ENTITY % dd.qname "dd" >
+<!ENTITY % ol.qname "ol" >
+<!ENTITY % ul.qname "ul" >
+<!ENTITY % li.qname "li" >
+
+<!-- dl: Definition List ............................... -->
+
+<!ENTITY % dl.element "INCLUDE" >
+<![%dl.element;[
+<!ENTITY % dl.content "( %dt.qname; | %dd.qname; )+" >
+<!ELEMENT %dl.qname; %dl.content; >
+<!-- end of dl.element -->]]>
+
+<!ENTITY % dl.attlist "INCLUDE" >
+<![%dl.attlist;[
+<!ATTLIST %dl.qname;
+ %Common.attrib;
+>
+<!-- end of dl.attlist -->]]>
+
+<!-- dt: Definition Term ............................... -->
+
+<!ENTITY % dt.element "INCLUDE" >
+<![%dt.element;[
+<!ENTITY % dt.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %dt.qname; %dt.content; >
+<!-- end of dt.element -->]]>
+
+<!ENTITY % dt.attlist "INCLUDE" >
+<![%dt.attlist;[
+<!ATTLIST %dt.qname;
+ %Common.attrib;
+>
+<!-- end of dt.attlist -->]]>
+
+<!-- dd: Definition Description ........................ -->
+
+<!ENTITY % dd.element "INCLUDE" >
+<![%dd.element;[
+<!ENTITY % dd.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %dd.qname; %dd.content; >
+<!-- end of dd.element -->]]>
+
+<!ENTITY % dd.attlist "INCLUDE" >
+<![%dd.attlist;[
+<!ATTLIST %dd.qname;
+ %Common.attrib;
+>
+<!-- end of dd.attlist -->]]>
+
+<!-- ol: Ordered List (numbered styles) ................ -->
+
+<!ENTITY % ol.element "INCLUDE" >
+<![%ol.element;[
+<!ENTITY % ol.content "( %li.qname; )+" >
+<!ELEMENT %ol.qname; %ol.content; >
+<!-- end of ol.element -->]]>
+
+<!ENTITY % ol.attlist "INCLUDE" >
+<![%ol.attlist;[
+<!ATTLIST %ol.qname;
+ %Common.attrib;
+>
+<!-- end of ol.attlist -->]]>
+
+<!-- ul: Unordered List (bullet styles) ................ -->
+
+<!ENTITY % ul.element "INCLUDE" >
+<![%ul.element;[
+<!ENTITY % ul.content "( %li.qname; )+" >
+<!ELEMENT %ul.qname; %ul.content; >
+<!-- end of ul.element -->]]>
+
+<!ENTITY % ul.attlist "INCLUDE" >
+<![%ul.attlist;[
+<!ATTLIST %ul.qname;
+ %Common.attrib;
+>
+<!-- end of ul.attlist -->]]>
+
+<!-- li: List Item ..................................... -->
+
+<!ENTITY % li.element "INCLUDE" >
+<![%li.element;[
+<!ENTITY % li.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %li.qname; %li.content; >
+<!-- end of li.element -->]]>
+
+<!ENTITY % li.attlist "INCLUDE" >
+<![%li.attlist;[
+<!ATTLIST %li.qname;
+ %Common.attrib;
+>
+<!-- end of li.attlist -->]]>
+
+<!-- end of xhtml-list-1.mod -->
+
+<!-- Extend lists with value and start attributes -->
+<!ATTLIST %li.qname;
+ value %Number.datatype; #IMPLIED
+>
+<!ATTLIST %ol.qname;
+ start %Number.datatype; #IMPLIED
+>
+
+<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+
+<!-- Image Module ............................................... -->
+<!ENTITY % xhtml-image.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-image-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Images Module ................................................. -->
+<!-- file: xhtml-image-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Rovision: $Id: xhtml-image-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-image-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Images
+
+ img
+
+ This module provides markup to support basic image embedding.
+-->
+
+<!-- To avoid problems with text-only UAs as well as to make
+ image content understandable and navigable to users of
+ non-visual UAs, you need to provide a description with
+ the 'alt' attribute, and avoid server-side image maps.
+-->
+
+<!ENTITY % img.element "INCLUDE" >
+<![%img.element;[
+<!ENTITY % img.content "EMPTY" >
+<!ENTITY % img.qname "img" >
+<!ELEMENT %img.qname; %img.content; >
+<!-- end of img.element -->]]>
+
+<!ENTITY % img.attlist "INCLUDE" >
+<![%img.attlist;[
+<!ATTLIST %img.qname;
+ %Common.attrib;
+ src %URI.datatype; #REQUIRED
+ alt %Text.datatype; #REQUIRED
+ longdesc %URI.datatype; #IMPLIED
+ height %Length.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+>
+<!-- end of img.attlist -->]]>
+
+<!-- end of xhtml-image-1.mod -->
+
+
+<!-- Tables Module ............................................... -->
+<!ENTITY % xhtml-table.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Tables 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-basic-table-1.mod" >
+<!-- ....................................................................... -->
+<!-- XHTML Basic Table Module ............................................. -->
+<!-- file: xhtml-basic-table-1.mod
+
+ This is XHTML Basic, a proper subset of XHTML.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-basic-table-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Tables 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-basic-table-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Basic Tables
+
+ table, caption, tr, th, td
+
+ This table module declares elements and attributes defining
+ a table model based fundamentally on features found in the
+ widely-deployed HTML 3.2 table model. While this module
+ mimics the content model and table attributes of HTML 3.2
+ tables, the element types declared herein also includes all
+ HTML 4 common and most of the HTML 4 table attributes.
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % table.qname "table" >
+<!ENTITY % caption.qname "caption" >
+<!ENTITY % tr.qname "tr" >
+<!ENTITY % th.qname "th" >
+<!ENTITY % td.qname "td" >
+
+<!-- horizontal alignment attributes for cell contents
+-->
+<!ENTITY % CellHAlign.attrib
+ "align ( left
+ | center
+ | right ) #IMPLIED"
+>
+
+<!-- vertical alignment attributes for cell contents
+-->
+<!ENTITY % CellVAlign.attrib
+ "valign ( top
+ | middle
+ | bottom ) #IMPLIED"
+>
+
+<!-- scope is simpler than axes attribute for common tables
+-->
+<!ENTITY % scope.attrib
+ "scope ( row | col ) #IMPLIED"
+>
+
+<!-- table: Table Element .............................. -->
+
+<!ENTITY % table.element "INCLUDE" >
+<![%table.element;[
+<!ENTITY % table.content
+ "( %caption.qname;?, %tr.qname;+ )"
+>
+<!ELEMENT %table.qname; %table.content; >
+<!-- end of table.element -->]]>
+
+<!ENTITY % table.attlist "INCLUDE" >
+<![%table.attlist;[
+<!ATTLIST %table.qname;
+ %Common.attrib;
+ summary %Text.datatype; #IMPLIED
+>
+<!-- end of table.attlist -->]]>
+
+<!-- caption: Table Caption ............................ -->
+
+<!ENTITY % caption.element "INCLUDE" >
+<![%caption.element;[
+<!ENTITY % caption.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %caption.qname; %caption.content; >
+<!-- end of caption.element -->]]>
+
+<!ENTITY % caption.attlist "INCLUDE" >
+<![%caption.attlist;[
+<!ATTLIST %caption.qname;
+ %Common.attrib;
+>
+<!-- end of caption.attlist -->]]>
+
+<!-- tr: Table Row ..................................... -->
+
+<!ENTITY % tr.element "INCLUDE" >
+<![%tr.element;[
+<!ENTITY % tr.content "( %th.qname; | %td.qname; )+" >
+<!ELEMENT %tr.qname; %tr.content; >
+<!-- end of tr.element -->]]>
+
+<!ENTITY % tr.attlist "INCLUDE" >
+<![%tr.attlist;[
+<!ATTLIST %tr.qname;
+ %Common.attrib;
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of tr.attlist -->]]>
+
+<!-- th: Table Header Cell ............................. -->
+
+<!-- th is for header cells, td for data,
+ but for cells acting as both use td
+-->
+
+<!ENTITY % th.element "INCLUDE" >
+<![%th.element;[
+<!ENTITY % th.content
+ "( #PCDATA | %FlowNoTable.mix; )*"
+>
+<!ELEMENT %th.qname; %th.content; >
+<!-- end of th.element -->]]>
+
+<!ENTITY % th.attlist "INCLUDE" >
+<![%th.attlist;[
+<!ATTLIST %th.qname;
+ %Common.attrib;
+ abbr %Text.datatype; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ %scope.attrib;
+ rowspan %Number.datatype; '1'
+ colspan %Number.datatype; '1'
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of th.attlist -->]]>
+
+<!-- td: Table Data Cell ............................... -->
+
+<!ENTITY % td.element "INCLUDE" >
+<![%td.element;[
+<!ENTITY % td.content
+ "( #PCDATA | %FlowNoTable.mix; )*"
+>
+<!ELEMENT %td.qname; %td.content; >
+<!-- end of td.element -->]]>
+
+<!ENTITY % td.attlist "INCLUDE" >
+<![%td.attlist;[
+<!ATTLIST %td.qname;
+ %Common.attrib;
+ abbr %Text.datatype; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ %scope.attrib;
+ rowspan %Number.datatype; '1'
+ colspan %Number.datatype; '1'
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of td.attlist -->]]>
+
+<!-- end of xhtml-basic-table-1.mod -->
+
+
+<!-- Forms Module ...............................................
+ XHTML basic forms module extended with optgroup and fieldset
+-->
+<!ELEMENT %optgroup.qname; (%option.qname;)+>
+<!ATTLIST %optgroup.qname;
+ %Common.attrib;
+ label %Text.datatype; #REQUIRED
+>
+<!ENTITY % select.content "( %optgroup.qname; | %option.qname; )+">
+<!ELEMENT %fieldset.qname; (#PCDATA | %Flow.mix;)*>
+<!ATTLIST %fieldset.qname;
+ %Common.attrib;
+>
+<!ENTITY % form.content "( %BlkNoForm.mix; | %fieldset.qname; )+">
+<!ENTITY % xhtml-form.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Forms 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-basic-form-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Simplified Forms Module ....................................... -->
+<!-- file: xhtml-basic-form-1.mod
+
+ This is XHTML Basic, a proper subset of XHTML.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-basic-form-1.mod,v 4.1 2001/04/05 06:57:40 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Basic Forms 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-basic-form-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Basic Forms
+
+ This forms module is based on the HTML 3.2 forms model, with
+ the WAI-requested addition of the label element. While this
+ module essentially mimics the content model and attributes of
+ HTML 3.2 forms, the element types declared herein also include
+ all HTML 4 common attributes.
+
+ form, label, input, select, option, textarea
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % form.qname "form" >
+<!ENTITY % label.qname "label" >
+<!ENTITY % input.qname "input" >
+<!ENTITY % select.qname "select" >
+<!ENTITY % option.qname "option" >
+<!ENTITY % textarea.qname "textarea" >
+
+<!-- %BlkNoForm.mix; includes all non-form block elements,
+ plus %Misc.class;
+-->
+<!ENTITY % BlkNoForm.mix
+ "%Heading.class;
+ | %List.class;
+ | %BlkStruct.class;
+ %BlkPhras.class;
+ %BlkPres.class;
+ | %table.qname;
+ %Block.extra;
+ %Misc.class;"
+>
+
+<!-- form: Form Element ................................ -->
+
+<!ENTITY % form.element "INCLUDE" >
+<![%form.element;[
+<!ENTITY % form.content
+ "( %BlkNoForm.mix; )+"
+>
+<!ELEMENT %form.qname; %form.content; >
+<!-- end of form.element -->]]>
+
+<!ENTITY % form.attlist "INCLUDE" >
+<![%form.attlist;[
+<!ATTLIST %form.qname;
+ %Common.attrib;
+ action %URI.datatype; #REQUIRED
+ method ( get | post ) 'get'
+ enctype %ContentType.datatype; 'application/x-www-form-urlencoded'
+>
+<!-- end of form.attlist -->]]>
+
+<!-- label: Form Field Label Text ...................... -->
+
+<!ENTITY % label.element "INCLUDE" >
+<![%label.element;[
+<!-- Each label must not contain more than ONE field
+-->
+<!ENTITY % label.content
+ "( #PCDATA
+ | %input.qname; | %select.qname; | %textarea.qname;
+ | %InlStruct.class;
+ %InlPhras.class;
+ %I18n.class;
+ %InlPres.class;
+ %InlSpecial.class;
+ %Misc.class; )*"
+>
+<!ELEMENT %label.qname; %label.content; >
+<!-- end of label.element -->]]>
+
+<!ENTITY % label.attlist "INCLUDE" >
+<![%label.attlist;[
+<!ATTLIST %label.qname;
+ %Common.attrib;
+ for IDREF #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of label.attlist -->]]>
+
+<!-- input: Form Control ............................... -->
+
+<!ENTITY % input.element "INCLUDE" >
+<![%input.element;[
+<!ENTITY % input.content "EMPTY" >
+<!ELEMENT %input.qname; %input.content; >
+<!-- end of input.element -->]]>
+
+<!-- Basic Forms removes 'image' and 'file' input types.
+-->
+<!ENTITY % input.attlist "INCLUDE" >
+<![%input.attlist;[
+<!ENTITY % InputType.class
+ "( text | password | checkbox | radio
+ | submit | reset | hidden )"
+>
+<!-- attribute name required for all but submit & reset
+-->
+<!ATTLIST %input.qname;
+ %Common.attrib;
+ type %InputType.class; 'text'
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked ( checked ) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number.datatype; #IMPLIED
+ src %URI.datatype; #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of input.attlist -->]]>
+
+<!-- select: Option Selector ........................... -->
+
+<!ENTITY % select.element "INCLUDE" >
+<![%select.element;[
+<!ENTITY % select.content "( %option.qname; )+" >
+<!ELEMENT %select.qname; %select.content; >
+<!-- end of select.element -->]]>
+
+<!ENTITY % select.attlist "INCLUDE" >
+<![%select.attlist;[
+<!ATTLIST %select.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ size %Number.datatype; #IMPLIED
+ multiple ( multiple ) #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of select.attlist -->]]>
+
+<!-- option: Selectable Choice ......................... -->
+
+<!ENTITY % option.element "INCLUDE" >
+<![%option.element;[
+<!ENTITY % option.content "( #PCDATA )" >
+<!ELEMENT %option.qname; %option.content; >
+<!-- end of option.element -->]]>
+
+<!ENTITY % option.attlist "INCLUDE" >
+<![%option.attlist;[
+<!ATTLIST %option.qname;
+ %Common.attrib;
+ selected ( selected ) #IMPLIED
+ value CDATA #IMPLIED
+>
+<!-- end of option.attlist -->]]>
+
+<!-- textarea: Multi-Line Text Field ................... -->
+
+<!ENTITY % textarea.element "INCLUDE" >
+<![%textarea.element;[
+<!ENTITY % textarea.content "( #PCDATA )" >
+<!ELEMENT %textarea.qname; %textarea.content; >
+<!-- end of textarea.element -->]]>
+
+<!ENTITY % textarea.attlist "INCLUDE" >
+<![%textarea.attlist;[
+<!ATTLIST %textarea.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ rows %Number.datatype; #REQUIRED
+ cols %Number.datatype; #REQUIRED
+ tabindex %Number.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of textarea.attlist -->]]>
+
+<!-- end of xhtml-basic-form-1.mod -->
+
+
+<!-- Link Element Module ........................................ -->
+<!ENTITY % xhtml-link.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-link-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Link Element Module ........................................... -->
+<!-- file: xhtml-link-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-link-1.mod,v 4.1 2001/04/05 06:57:40 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-link-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Link element
+
+ link
+
+ This module declares the link element type and its attributes,
+ which could (in principle) be used to define document-level links
+ to external resources such as:
+
+ a) for document specific toolbars/menus, e.g. start, contents,
+ previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by style sheets to control how collections of html nodes are
+ rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a postscript or pdf version (rel="alternate" media="print")
+-->
+
+<!-- link: Media-Independent Link ...................... -->
+
+<!ENTITY % link.element "INCLUDE" >
+<![%link.element;[
+<!ENTITY % link.content "EMPTY" >
+<!ENTITY % link.qname "link" >
+<!ELEMENT %link.qname; %link.content; >
+<!-- end of link.element -->]]>
+
+<!ENTITY % link.attlist "INCLUDE" >
+<![%link.attlist;[
+<!ATTLIST %link.qname;
+ %Common.attrib;
+ charset %Charset.datatype; #IMPLIED
+ href %URI.datatype; #IMPLIED
+ hreflang %LanguageCode.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ rel %LinkTypes.datatype; #IMPLIED
+ rev %LinkTypes.datatype; #IMPLIED
+ media %MediaDesc.datatype; #IMPLIED
+>
+<!-- end of link.attlist -->]]>
+
+<!-- end of xhtml-link-1.mod -->
+
+
+<!-- Document Metainformation Module ............................ -->
+<!ENTITY % xhtml-meta.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-meta-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Document Metainformation Module ............................... -->
+<!-- file: xhtml-meta-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-meta-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-meta-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Meta Information
+
+ meta
+
+ This module declares the meta element type and its attributes,
+ used to provide declarative document metainformation.
+-->
+
+<!-- meta: Generic Metainformation ..................... -->
+
+<!ENTITY % meta.element "INCLUDE" >
+<![%meta.element;[
+<!ENTITY % meta.content "EMPTY" >
+<!ENTITY % meta.qname "meta" >
+<!ELEMENT %meta.qname; %meta.content; >
+<!-- end of meta.element -->]]>
+
+<!ENTITY % meta.attlist "INCLUDE" >
+<![%meta.attlist;[
+<!ATTLIST %meta.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+ http-equiv NMTOKEN #IMPLIED
+ name NMTOKEN #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+>
+<!-- end of meta.attlist -->]]>
+
+<!-- end of xhtml-meta-1.mod -->
+
+
+<!-- Base Element Module ........................................ -->
+<!ENTITY % xhtml-base.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-base-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Base Element Module ........................................... -->
+<!-- file: xhtml-base-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-base-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-base-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Base element
+
+ base
+
+ This module declares the base element type and its attributes,
+ used to define a base URI against which relative URIs in the
+ document will be resolved.
+
+ Note that this module also redeclares the content model for
+ the head element to include the base element.
+-->
+
+<!-- base: Document Base URI ........................... -->
+
+<!ENTITY % base.element "INCLUDE" >
+<![%base.element;[
+<!ENTITY % base.content "EMPTY" >
+<!ENTITY % base.qname "base" >
+<!ELEMENT %base.qname; %base.content; >
+<!-- end of base.element -->]]>
+
+<!ENTITY % base.attlist "INCLUDE" >
+<![%base.attlist;[
+<!ATTLIST %base.qname;
+ %XHTML.xmlns.attrib;
+ href %URI.datatype; #REQUIRED
+>
+<!-- end of base.attlist -->]]>
+
+<!ENTITY % head.content
+ "( %HeadOpts.mix;,
+ ( ( %title.qname;, %HeadOpts.mix;, ( %base.qname;, %HeadOpts.mix; )? )
+ | ( %base.qname;, %HeadOpts.mix;, ( %title.qname;, %HeadOpts.mix; ))))"
+>
+
+<!-- end of xhtml-base-1.mod -->
+
+
+<!-- Stylesheets Module ......................................... -->
+<!ENTITY % xhtml-style.mod PUBLIC "-//W3C//ELEMENTS XHTML Style Sheets 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-style-1.mod">
+<!-- ...................................................................... -->
+<!-- XHTML Document Style Sheet Module ................................... -->
+<!-- file: xhtml-style-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-style-1.mod,v 4.1 2001/04/05 06:57:40 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML Style Sheets 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-style-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Style Sheets
+
+ style
+
+ This module declares the style element type and its attributes,
+ used to embed style sheet information in the document head element.
+-->
+
+<!-- style: Style Sheet Information .................... -->
+
+<!ENTITY % style.element "INCLUDE" >
+<![%style.element;[
+<!ENTITY % style.content "( #PCDATA )" >
+<!ENTITY % style.qname "style" >
+<!ELEMENT %style.qname; %style.content; >
+<!-- end of style.element -->]]>
+
+<!ENTITY % style.attlist "INCLUDE" >
+<![%style.attlist;[
+<!ATTLIST %style.qname;
+ %XHTML.xmlns.attrib;
+ %title.attrib;
+ %I18n.attrib;
+ type %ContentType.datatype; #REQUIRED
+ media %MediaDesc.datatype; #IMPLIED
+ xml:space ( preserve ) #FIXED 'preserve'
+>
+<!-- end of style.attlist -->]]>
+
+<!-- end of xhtml-style-1.mod -->
+
+
+<!-- Param Element Module ....................................... -->
+<!ENTITY % xhtml-param.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-param-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Param Element Module ..................................... -->
+<!-- file: xhtml-param-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-param-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-param-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Parameters for Java Applets and Embedded Objects
+
+ param
+
+ This module provides declarations for the param element,
+ used to provide named property values for the applet
+ and object elements.
+-->
+
+<!-- param: Named Property Value ....................... -->
+
+<!ENTITY % param.element "INCLUDE" >
+<![%param.element;[
+<!ENTITY % param.content "EMPTY" >
+<!ENTITY % param.qname "param" >
+<!ELEMENT %param.qname; %param.content; >
+<!-- end of param.element -->]]>
+
+<!ENTITY % param.attlist "INCLUDE" >
+<![%param.attlist;[
+<!ATTLIST %param.qname;
+ %XHTML.xmlns.attrib;
+ %id.attrib;
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype ( data | ref | object ) 'data'
+ type %ContentType.datatype; #IMPLIED
+>
+<!-- end of param.attlist -->]]>
+
+<!-- end of xhtml-param-1.mod -->
+
+
+<!-- Embedded Object Module ..................................... -->
+<!ENTITY % xhtml-object.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-object-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Embedded Object Module ........................................ -->
+<!-- file: xhtml-object-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-object-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-object-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Embedded Objects
+
+ object
+
+ This module declares the object element type and its attributes, used
+ to embed external objects as part of XHTML pages. In the document,
+ place param elements prior to other content within the object element.
+
+ Note that use of this module requires instantiation of the Param
+ Element Module.
+-->
+
+<!-- object: Generic Embedded Object ................... -->
+
+<!ENTITY % object.element "INCLUDE" >
+<![%object.element;[
+<!ENTITY % object.content
+ "( #PCDATA | %Flow.mix; | %param.qname; )*"
+>
+<!ENTITY % object.qname "object" >
+<!ELEMENT %object.qname; %object.content; >
+<!-- end of object.element -->]]>
+
+<!ENTITY % object.attlist "INCLUDE" >
+<![%object.attlist;[
+<!ATTLIST %object.qname;
+ %Common.attrib;
+ declare ( declare ) #IMPLIED
+ classid %URI.datatype; #IMPLIED
+ codebase %URI.datatype; #IMPLIED
+ data %URI.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ codetype %ContentType.datatype; #IMPLIED
+ archive %URIs.datatype; #IMPLIED
+ standby %Text.datatype; #IMPLIED
+ height %Length.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+ name CDATA #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of object.attlist -->]]>
+
+<!-- end of xhtml-object-1.mod -->
+
+
+<!-- Document Structure Module ..................................... -->
+<!ENTITY % xhtml-struct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-struct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Structure Module .............................................. -->
+<!-- file: xhtml-struct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-struct-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-struct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Document Structure
+
+ title, head, body, html
+
+ The Structure Module defines the major structural elements and
+ their attributes.
+
+ Note that the content model of the head element type is redeclared
+ when the Base Module is included in the DTD.
+
+ The parameter entity containing the XML namespace URI value used
+ for XHTML is '%XHTML.xmlns;', defined in the Qualified Names module.
+-->
+
+<!-- title: Document Title ............................. -->
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+-->
+
+<!ENTITY % title.element "INCLUDE" >
+<![%title.element;[
+<!ENTITY % title.content "( #PCDATA )" >
+<!ENTITY % title.qname "title" >
+<!ELEMENT %title.qname; %title.content; >
+<!-- end of title.element -->]]>
+
+<!ENTITY % title.attlist "INCLUDE" >
+<![%title.attlist;[
+<!ATTLIST %title.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+>
+<!-- end of title.attlist -->]]>
+
+<!-- head: Document Head ............................... -->
+
+<!ENTITY % head.element "INCLUDE" >
+<![%head.element;[
+<!ENTITY % head.content
+ "( %HeadOpts.mix;, %title.qname;, %HeadOpts.mix; )"
+>
+<!ENTITY % head.qname "head" >
+<!ELEMENT %head.qname; %head.content; >
+<!-- end of head.element -->]]>
+
+<!ENTITY % head.attlist "INCLUDE" >
+<![%head.attlist;[
+<!-- reserved for future use with document profiles
+-->
+<!ENTITY % profile.attrib
+ "profile %URI.datatype; '%XHTML.profile;'"
+>
+
+<!ATTLIST %head.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+ %profile.attrib;
+>
+<!-- end of head.attlist -->]]>
+
+<!-- body: Document Body ............................... -->
+
+<!ENTITY % body.element "INCLUDE" >
+<![%body.element;[
+<!ENTITY % body.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % body.qname "body" >
+<!ELEMENT %body.qname; %body.content; >
+<!-- end of body.element -->]]>
+
+<!ENTITY % body.attlist "INCLUDE" >
+<![%body.attlist;[
+<!ATTLIST %body.qname;
+ %Common.attrib;
+>
+<!-- end of body.attlist -->]]>
+
+<!-- html: XHTML Document Element ...................... -->
+
+<!ENTITY % html.element "INCLUDE" >
+<![%html.element;[
+<!ENTITY % html.content "( %head.qname;, %body.qname; )" >
+<!ENTITY % html.qname "html" >
+<!ELEMENT %html.qname; %html.content; >
+<!-- end of html.element -->]]>
+
+<!ENTITY % html.attlist "INCLUDE" >
+<![%html.attlist;[
+<!-- version attribute value defined in driver
+-->
+<!ENTITY % XHTML.version.attrib
+ "version %FPI.datatype; #FIXED '%XHTML.version;'"
+>
+
+<!-- see the Qualified Names module for information
+ on how to extend XHTML using XML namespaces
+-->
+<!ATTLIST %html.qname;
+ %XHTML.xmlns.attrib;
+ %XHTML.version.attrib;
+ %I18n.attrib;
+>
+<!-- end of html.attlist -->]]>
+
+<!-- end of xhtml-struct-1.mod -->
+
+
+<!-- Block Presentation ........................................ -->
+<!ENTITY % xhtml-blkpres.mod PUBLIC "-//W3C//ELEMENTS XHTML Block Presentation 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkpres-1.mod">
+<!-- ...................................................................... -->
+<!-- XHTML Block Presentation Module ..................................... -->
+<!-- file: xhtml-blkpres-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkpres-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Presentation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkpres-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Presentational Elements
+
+ hr
+
+ This module declares the elements and their attributes used to
+ support block-level presentational markup.
+-->
+
+<!ENTITY % hr.element "INCLUDE" >
+<![%hr.element;[
+<!ENTITY % hr.content "EMPTY" >
+<!ENTITY % hr.qname "hr" >
+<!ELEMENT %hr.qname; %hr.content; >
+<!-- end of hr.element -->]]>
+
+<!ENTITY % hr.attlist "INCLUDE" >
+<![%hr.attlist;[
+<!ATTLIST %hr.qname;
+ %Common.attrib;
+>
+<!-- end of hr.attlist -->]]>
+
+<!-- end of xhtml-blkpres-1.mod -->
+
+
+<!-- ========================================== -->
+<!--
+ Inline Presentation: b, big, i, small
+-->
+<!ENTITY % sub.element "IGNORE">
+<!ENTITY % sub.attlist "IGNORE">
+<!ENTITY % sup.element "IGNORE">
+<!ENTITY % sup.attlist "IGNORE">
+<!ENTITY % tt.element "IGNORE">
+<!ENTITY % tt.attlist "IGNORE">
+<!ENTITY % xhtml-inlpres.mod PUBLIC "-//W3C//ELEMENTS XHTML Inline Presentation 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlpres-1.mod">
+<!-- ...................................................................... -->
+<!-- XHTML Inline Presentation Module .................................... -->
+<!-- file: xhtml-inlpres-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlpres-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Presentation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlpres-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Presentational Elements
+
+ b, big, i, small, sub, sup, tt
+
+ This module declares the elements and their attributes used to
+ support inline-level presentational markup.
+-->
+
+<!ENTITY % b.element "INCLUDE" >
+<![%b.element;[
+<!ENTITY % b.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % b.qname "b" >
+<!ELEMENT %b.qname; %b.content; >
+<!-- end of b.element -->]]>
+
+<!ENTITY % b.attlist "INCLUDE" >
+<![%b.attlist;[
+<!ATTLIST %b.qname;
+ %Common.attrib;
+>
+<!-- end of b.attlist -->]]>
+
+<!ENTITY % big.element "INCLUDE" >
+<![%big.element;[
+<!ENTITY % big.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % big.qname "big" >
+<!ELEMENT %big.qname; %big.content; >
+<!-- end of big.element -->]]>
+
+<!ENTITY % big.attlist "INCLUDE" >
+<![%big.attlist;[
+<!ATTLIST %big.qname;
+ %Common.attrib;
+>
+<!-- end of big.attlist -->]]>
+
+<!ENTITY % i.element "INCLUDE" >
+<![%i.element;[
+<!ENTITY % i.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % i.qname "i" >
+<!ELEMENT %i.qname; %i.content; >
+<!-- end of i.element -->]]>
+
+<!ENTITY % i.attlist "INCLUDE" >
+<![%i.attlist;[
+<!ATTLIST %i.qname;
+ %Common.attrib;
+>
+<!-- end of i.attlist -->]]>
+
+<!ENTITY % small.element "INCLUDE" >
+<![%small.element;[
+<!ENTITY % small.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % small.qname "small" >
+<!ELEMENT %small.qname; %small.content; >
+<!-- end of small.element -->]]>
+
+<!ENTITY % small.attlist "INCLUDE" >
+<![%small.attlist;[
+<!ATTLIST %small.qname;
+ %Common.attrib;
+>
+<!-- end of small.attlist -->]]>
+
+<!ENTITY % sub.element "INCLUDE" >
+<![%sub.element;[
+<!ENTITY % sub.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % sub.qname "sub" >
+<!ELEMENT %sub.qname; %sub.content; >
+<!-- end of sub.element -->]]>
+
+<!ENTITY % sub.attlist "INCLUDE" >
+<![%sub.attlist;[
+<!ATTLIST %sub.qname;
+ %Common.attrib;
+>
+<!-- end of sub.attlist -->]]>
+
+<!ENTITY % sup.element "INCLUDE" >
+<![%sup.element;[
+<!ENTITY % sup.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % sup.qname "sup" >
+<!ELEMENT %sup.qname; %sup.content; >
+<!-- end of sup.element -->]]>
+
+<!ENTITY % sup.attlist "INCLUDE" >
+<![%sup.attlist;[
+<!ATTLIST %sup.qname;
+ %Common.attrib;
+>
+<!-- end of sup.attlist -->]]>
+
+<!ENTITY % tt.element "INCLUDE" >
+<![%tt.element;[
+<!ENTITY % tt.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % tt.qname "tt" >
+<!ELEMENT %tt.qname; %tt.content; >
+<!-- end of tt.element -->]]>
+
+<!ENTITY % tt.attlist "INCLUDE" >
+<![%tt.attlist;[
+<!ATTLIST %tt.qname;
+ %Common.attrib;
+>
+<!-- end of tt.attlist -->]]>
+
+<!-- end of xhtml-inlpres-1.mod -->
+
+
+<!-- end of XHTML Mobile 1.0 DTD ........................................... --> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml-special.ent b/bundles/org.eclipse.wst.html.core/dtds/xhtml-special.ent
new file mode 100644
index 0000000000..7e087af28c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml-special.ent
@@ -0,0 +1,79 @@
+<!-- Special characters for HTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+ %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- quotation mark = APL quote,
+ U+0022 ISOnum -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand, U+0026 ISOnum -->
+<!ENTITY lt "&#38;#60;"> <!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;"> <!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY apos "&#39;"> <!-- apostrophe mark, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- latin capital ligature OE,
+ U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;"> <!-- latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- latin capital letter S with caron,
+ U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;"> <!-- latin small letter s with caron,
+ U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;"> <!-- latin capital letter Y with diaeresis,
+ U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;"> <!-- modifier letter circumflex accent,
+ U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;"> <!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;"> <!-- zero width non-joiner,
+ U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;"> <!-- left single quotation mark,
+ U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;"> <!-- right single quotation mark,
+ U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;"> <!-- left double quotation mark,
+ U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;"> <!-- right double quotation mark,
+ U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo "&#8249;"> <!-- single left-pointing angle quotation mark,
+ U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- single right-pointing angle quotation mark,
+ U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+<!ENTITY euro "&#8364;"> <!-- euro sign, U+20AC NEW -->
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml-symbol.ent b/bundles/org.eclipse.wst.html.core/dtds/xhtml-symbol.ent
new file mode 100644
index 0000000000..587089486f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml-symbol.ent
@@ -0,0 +1,242 @@
+<!-- Mathematical, Greek and Symbolic characters for HTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+ %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- latin small f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;"> <!-- greek capital letter gamma,
+ U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;"> <!-- greek capital letter delta,
+ U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;"> <!-- greek capital letter theta,
+ U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;"> <!-- greek capital letter lambda,
+ U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;"> <!-- greek capital letter sigma,
+ U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;"> <!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;"> <!-- greek capital letter phi,
+ U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;"> <!-- greek capital letter psi,
+ U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;"> <!-- greek capital letter omega,
+ U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha "&#945;"> <!-- greek small letter alpha,
+ U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;"> <!-- greek small letter gamma,
+ U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;"> <!-- greek small letter delta,
+ U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;"> <!-- greek small letter epsilon,
+ U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;"> <!-- greek small letter theta,
+ U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;"> <!-- greek small letter kappa,
+ U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;"> <!-- greek small letter lambda,
+ U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;"> <!-- greek small letter final sigma,
+ U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;"> <!-- greek small letter sigma,
+ U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;"> <!-- greek small letter upsilon,
+ U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;"> <!-- greek small letter omega,
+ U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek small letter theta symbol,
+ U+03D1 NEW -->
+<!ENTITY upsih "&#978;"> <!-- greek upsilon with hook symbol,
+ U+03D2 NEW -->
+<!ENTITY piv "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- bullet = black small circle,
+ U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+ U+2026 ISOpub -->
+<!ENTITY prime "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;"> <!-- double prime = seconds = inches,
+ U+2033 ISOtech -->
+<!ENTITY oline "&#8254;"> <!-- overline = spacing overscore,
+ U+203E NEW -->
+<!ENTITY frasl "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- script capital P = power set
+ = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;"> <!-- blackletter capital I = imaginary part,
+ U+2111 ISOamso -->
+<!ENTITY real "&#8476;"> <!-- blackletter capital R = real part symbol,
+ U+211C ISOamso -->
+<!ENTITY trade "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+ U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+ U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;"> <!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So ? lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;"> <!-- rightwards double arrow,
+ U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so ?
+ rArr can be used for 'implies' as ISOtech suggests -->
+<!ENTITY dArr "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;"> <!-- left right double arrow,
+ U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;"> <!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;"> <!-- empty set = null set = diameter,
+ U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;"> <!-- nabla = backward difference,
+ U+2207 ISOtech -->
+<!ENTITY isin "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!-- should there be a more memorable name than 'ni'? -->
+<!ENTITY prod "&#8719;"> <!-- n-ary product = product sign,
+ U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;"> <!-- n-ary sumation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;"> <!-- square root = radical sign,
+ U+221A ISOtech -->
+<!ENTITY prop "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;"> <!-- tilde operator = varies with = similar to,
+ U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;"> <!-- almost equal to = asymptotic to,
+ U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;"> <!-- greater-than or equal to,
+ U+2265 ISOtech -->
+<!ENTITY sub "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
+ font encoding and is not included. Should it be, for symmetry?
+ It is in ISOamsn -->
+<!ENTITY nsub "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;"> <!-- superset of or equal to,
+ U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;"> <!-- circled plus = direct sum,
+ U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;"> <!-- circled times = vector product,
+ U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+ U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- left ceiling = apl upstile,
+ U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;"> <!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;"> <!-- left floor = apl downstile,
+ U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;"> <!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;"> <!-- left-pointing angle bracket = bra,
+ U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;"> <!-- right-pointing angle bracket = ket,
+ U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;"> <!-- black club suit = shamrock,
+ U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;"> <!-- black heart suit = valentine,
+ U+2665 ISOpub -->
+<!ENTITY diams "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml1-frameset.dtd b/bundles/org.eclipse.wst.html.core/dtds/xhtml1-frameset.dtd
new file mode 100644
index 0000000000..53d6597c80
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml1-frameset.dtd
@@ -0,0 +1,1225 @@
+<!--
+ Extensible HTML version 1.0 Frameset DTD
+
+ This is the same as HTML 4.0 Frameset except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2000 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2000/01/26 14:08:56 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC1766] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character from [ISO10646] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % MultiLengths "CDATA">
+ <!-- comma-separated list of MultiLength -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special
+ "br | span | bdo |object | applet | img | map | iframe">
+
+<!ENTITY % fontstyle "tt | i | b | big | small | u
+ | s | strike |font | basefont">
+
+<!ENTITY % phrase "em | strong | dfn | code | q | sub | sup |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc "ins | del | script | noscript">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex | fieldset | table">
+
+<!ENTITY % Block "(%block; | form | %misc;)*">
+
+<!-- %Flow; mixes Block and Inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ sub, sup, font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | br | span | bdo | map | tt | i | b | u | s |
+ %phrase; | %inline.forms;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, frameset)>
+<!ATTLIST html
+ %i18n;
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title %i18n;>
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- only one noframes element permitted per document -->
+
+<!ELEMENT frameset (frameset|frame|noframes)*>
+<!ATTLIST frameset
+ %coreattrs;
+ rows %MultiLengths; #IMPLIED
+ cols %MultiLengths; #IMPLIED
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ >
+
+<!-- reserved frame names start with "_" otherwise starts with letter -->
+
+<!-- tiled window within frameset -->
+
+<!ELEMENT frame EMPTY>
+<!ATTLIST frame
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ noresize (noresize) #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ >
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes (body)>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address %Inline;>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ accesskey %Character; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form |%inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=":"
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml1-strict.dtd b/bundles/org.eclipse.wst.html.core/dtds/xhtml1-strict.dtd
new file mode 100644
index 0000000000..6dd0c582e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml1-strict.dtd
@@ -0,0 +1,988 @@
+<!--
+ Extensible HTML version 1.0 Strict DTD
+
+ This is the same as HTML 4.0 Strict except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2000 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2000/01/26 14:08:56 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC1766] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character from [ISO10646] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % MultiLengths "CDATA">
+ <!-- comma-separated list of MultiLength -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special
+ "br | span | bdo | object | img | map">
+
+<!ENTITY % fontstyle "tt | i | b | big | small">
+
+<!ENTITY % phrase "em | strong | dfn | code | q | sub | sup |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc "ins | del | script | noscript">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl">
+<!ENTITY % blocktext "pre | hr | blockquote | address">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | fieldset | table">
+
+<!ENTITY % Block "(%block; | form | %misc;)*">
+
+<!-- %Flow; mixes Block and Inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc;)*">
+
+<!-- pre uses %Inline excluding img, object, big, small, sup or sup -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | br | span | bdo | map | tt | i | b |
+ %phrase; | %inline.forms;)*">
+
+<!-- form uses %Block; excluding form -->
+
+<!ENTITY % form.content "(%block; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form and form controls -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | %special; | %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+ %i18n;
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title %i18n;>
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ href %URI; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Block;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Block;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ >
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ >
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address %Inline;>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding "img|object|big|small|sub|sup" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Block;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ accesskey %Character; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+ Note that in this DTD there is no name attribute. That
+ is only available in the transitional and frameset DTD.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form and form controls
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ >
+
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml1-transitional.dtd b/bundles/org.eclipse.wst.html.core/dtds/xhtml1-transitional.dtd
new file mode 100644
index 0000000000..93321c6b3d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml1-transitional.dtd
@@ -0,0 +1,1196 @@
+<!--
+ Extensible HTML version 1.0 Transitional DTD
+
+ This is the same as HTML 4.0 Transitional except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2000 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+ $Revision: 1.1 $
+ $Date: 2000/01/26 14:08:56 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent">
+%HTMLspecial;
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+ <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+ <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+ <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+ <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+ <!-- a language code, as per [RFC1766] -->
+
+<!ENTITY % Character "CDATA">
+ <!-- a single character from [ISO10646] -->
+
+<!ENTITY % Number "CDATA">
+ <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+ <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+ <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+ <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+ <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+ <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+ <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+ <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+ <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+ <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+ <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+ <!-- pixel, percentage, or relative -->
+
+<!ENTITY % MultiLengths "CDATA">
+ <!-- comma-separated list of MultiLength -->
+
+<!ENTITY % Pixels "CDATA">
+ <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+ <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+ Black = #000000 Green = #008000
+ Silver = #C0C0C0 Lime = #00FF00
+ Gray = #808080 Olive = #808000
+ White = #FFFFFF Yellow = #FFFF00
+ Maroon = #800000 Navy = #000080
+ Red = #FF0000 Blue = #0000FF
+ Purple = #800080 Teal = #008080
+ Fuchsia= #FF00FF Aqua = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id ID #IMPLIED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED"
+ >
+
+<!-- internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #IMPLIED"
+ >
+
+<!-- attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+-->
+<!ENTITY % events
+ "onclick %Script; #IMPLIED
+ ondblclick %Script; #IMPLIED
+ onmousedown %Script; #IMPLIED
+ onmouseup %Script; #IMPLIED
+ onmouseover %Script; #IMPLIED
+ onmousemove %Script; #IMPLIED
+ onmouseout %Script; #IMPLIED
+ onkeypress %Script; #IMPLIED
+ onkeydown %Script; #IMPLIED
+ onkeyup %Script; #IMPLIED"
+ >
+
+<!-- attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey %Character; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED"
+ >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+ align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special
+ "br | span | bdo | object | applet | img | map | iframe">
+
+<!ENTITY % fontstyle "tt | i | b | big | small | u
+ | s | strike |font | basefont">
+
+<!ENTITY % phrase "em | strong | dfn | code | q | sub | sup |
+ samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc "ins | del | script | noscript">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
+
+<!ENTITY % block
+ "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
+
+<!ENTITY % Block "(%block; | form | %misc;)*">
+
+<!-- %Flow; mixes Block and Inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+ "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+ sub, sup, font, or basefont -->
+
+<!ENTITY % pre.content
+ "(#PCDATA | a | br | span | bdo | map | tt | i | b | u | s |
+ %phrase; | %inline.forms;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+ "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+ table | br | span | bdo | object | applet | img | map |
+ %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+ %i18n;
+ xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
+ >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+ title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+ ((title, %head.misc;, (base, %head.misc;)?) |
+ (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+ %i18n;
+ profile %URI; #IMPLIED
+ >
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title %i18n;>
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+ href %URI; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+ %i18n;
+ http-equiv CDATA #IMPLIED
+ name CDATA #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+ >
+
+<!--
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+ %attrs;
+ charset %Charset; #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ type %ContentType; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ media %MediaDesc; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+ %i18n;
+ type %ContentType; #REQUIRED
+ media %MediaDesc; #IMPLIED
+ title %Text; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+ charset %Charset; #IMPLIED
+ type %ContentType; #REQUIRED
+ language CDATA #IMPLIED
+ src %URI; #IMPLIED
+ defer (defer) #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+ %attrs;
+ >
+
+<!--======================= Frames =======================================-->
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+ %coreattrs;
+ longdesc %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ src %URI; #IMPLIED
+ frameborder (1|0) "1"
+ marginwidth %Pixels; #IMPLIED
+ marginheight %Pixels; #IMPLIED
+ scrolling (yes|no|auto) "auto"
+ align %ImgAlign; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes %Flow;>
+<!ATTLIST noframes
+ %attrs;
+ >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+ %attrs;
+ onload %Script; #IMPLIED
+ onunload %Script; #IMPLIED
+ background %URI; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ text %Color; #IMPLIED
+ link %Color; #IMPLIED
+ vlink %Color; #IMPLIED
+ alink %Color; #IMPLIED
+ >
+
+<!ELEMENT div %Flow;> <!-- generic language/style container -->
+<!ATTLIST div
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Headings =========================================-->
+
+<!--
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+-->
+
+<!ELEMENT h1 %Inline;>
+<!ATTLIST h1
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+ %attrs;
+ %TextAlign;
+ >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+ %attrs;
+ %TextAlign;
+ >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+ %attrs;
+ type %ULStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ >
+
+<!-- Ordered list numbering style
+
+ 1 arabic numbers 1, 2, 3, ...
+ a lower alpha a, b, c, ...
+ A upper alpha A, B, C, ...
+ i lower roman i, ii, iii, ...
+ I upper roman I, II, III, ...
+
+ The style is applied to the sequence number which by default
+ is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+ %attrs;
+ type %OLStyle; #IMPLIED
+ compact (compact) #IMPLIED
+ start %Number; #IMPLIED
+ >
+
+<!-- single column list (DEPRECATED) -->
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- multiple column list (DEPRECATED) -->
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+ %attrs;
+ type %LIStyle; #IMPLIED
+ value %Number; #IMPLIED
+ >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+ %attrs;
+ compact (compact) #IMPLIED
+ >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+ %attrs;
+ >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+ %attrs;
+ >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address %Inline;>
+<!ATTLIST address
+ %attrs;
+ >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+ %attrs;
+ align (left|center|right) #IMPLIED
+ noshade (noshade) #IMPLIED
+ size %Pixels; #IMPLIED
+ width %Length; #IMPLIED
+ >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding
+ "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+ %attrs;
+ width %Number; #IMPLIED
+ xml:space (preserve) #FIXED 'preserve'
+ >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+ %attrs;
+ >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+ %attrs;
+ cite %URI; #IMPLIED
+ datetime %Datetime; #IMPLIED
+ >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+ %attrs;
+ charset %Charset; #IMPLIED
+ type %ContentType; #IMPLIED
+ name NMTOKEN #IMPLIED
+ href %URI; #IMPLIED
+ hreflang %LanguageCode; #IMPLIED
+ rel %LinkTypes; #IMPLIED
+ rev %LinkTypes; #IMPLIED
+ accesskey %Character; #IMPLIED
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+ %attrs;
+ >
+
+<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+ %coreattrs;
+ %events;
+ lang %LanguageCode; #IMPLIED
+ xml:lang %LanguageCode; #IMPLIED
+ dir (ltr|rtl) #REQUIRED
+ >
+
+<!ELEMENT br EMPTY> <!-- forced line break -->
+<!ATTLIST br
+ %coreattrs;
+ clear (left|all|right|none) "none"
+ >
+
+<!ELEMENT em %Inline;> <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;> <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;> <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;> <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;> <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;> <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;> <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;> <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;> <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;> <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;> <!-- inlined quote -->
+<!ATTLIST q
+ %attrs;
+ cite %URI; #IMPLIED
+ >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;> <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;> <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;> <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;> <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;> <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;> <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;> <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;> <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY> <!-- base font size -->
+<!ATTLIST basefont
+ id ID #IMPLIED
+ size CDATA #REQUIRED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+ %coreattrs;
+ %i18n;
+ size CDATA #IMPLIED
+ color %Color; #IMPLIED
+ face CDATA #IMPLIED
+ >
+
+<!--==================== Object ======================================-->
+<!--
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+ %attrs;
+ declare (declare) #IMPLIED
+ classid %URI; #IMPLIED
+ codebase %URI; #IMPLIED
+ data %URI; #IMPLIED
+ type %ContentType; #IMPLIED
+ codetype %ContentType; #IMPLIED
+ archive %UriList; #IMPLIED
+ standby %Text; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ name NMTOKEN #IMPLIED
+ tabindex %Number; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Pixels; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ id ID #IMPLIED
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype (data|ref|object) "data"
+ type %ContentType; #IMPLIED
+ >
+
+<!--=================== Java applet ==================================-->
+<!--
+ One of code or object attributes must be present.
+ Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+ %coreattrs;
+ codebase %URI; #IMPLIED
+ archive CDATA #IMPLIED
+ code CDATA #IMPLIED
+ object CDATA #IMPLIED
+ alt %Text; #IMPLIED
+ name NMTOKEN #IMPLIED
+ width %Length; #REQUIRED
+ height %Length; #REQUIRED
+ align %ImgAlign; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!--=================== Images ===========================================-->
+
+<!--
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+ %attrs;
+ src %URI; #REQUIRED
+ alt %Text; #REQUIRED
+ name NMTOKEN #IMPLIED
+ longdesc %URI; #IMPLIED
+ height %Length; #IMPLIED
+ width %Length; #IMPLIED
+ usemap %URI; #IMPLIED
+ ismap (ismap) #IMPLIED
+ align %ImgAlign; #IMPLIED
+ border %Length; #IMPLIED
+ hspace %Pixels; #IMPLIED
+ vspace %Pixels; #IMPLIED
+ >
+
+<!-- usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+ %i18n;
+ %events;
+ id ID #REQUIRED
+ class CDATA #IMPLIED
+ style %StyleSheet; #IMPLIED
+ title %Text; #IMPLIED
+ name CDATA #IMPLIED
+ >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+ %attrs;
+ shape %Shape; "rect"
+ coords %Coords; #IMPLIED
+ href %URI; #IMPLIED
+ nohref (nohref) #IMPLIED
+ alt %Text; #REQUIRED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+ %attrs;
+ action %URI; #REQUIRED
+ method (get|post) "get"
+ name NMTOKEN #IMPLIED
+ enctype %ContentType; "application/x-www-form-urlencoded"
+ onsubmit %Script; #IMPLIED
+ onreset %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ accept-charset %Charsets; #IMPLIED
+ target %FrameTarget; #IMPLIED
+ >
+
+<!--
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+ %attrs;
+ for IDREF #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!ENTITY % InputType
+ "(text | password | checkbox |
+ radio | submit | reset |
+ file | hidden | image | button)"
+ >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY> <!-- form control -->
+<!ATTLIST input
+ %attrs;
+ type %InputType; "text"
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked (checked) #IMPLIED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ size CDATA #IMPLIED
+ maxlength %Number; #IMPLIED
+ src %URI; #IMPLIED
+ alt CDATA #IMPLIED
+ usemap %URI; #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ accept %ContentTypes; #IMPLIED
+ align %ImgAlign; #IMPLIED
+ >
+
+<!ELEMENT select (optgroup|option)+> <!-- option selector -->
+<!ATTLIST select
+ %attrs;
+ name CDATA #IMPLIED
+ size %Number; #IMPLIED
+ multiple (multiple) #IMPLIED
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!ELEMENT optgroup (option)+> <!-- option group -->
+<!ATTLIST optgroup
+ %attrs;
+ disabled (disabled) #IMPLIED
+ label %Text; #REQUIRED
+ >
+
+<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
+<!ATTLIST option
+ %attrs;
+ selected (selected) #IMPLIED
+ disabled (disabled) #IMPLIED
+ label %Text; #IMPLIED
+ value CDATA #IMPLIED
+ >
+
+<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field -->
+<!ATTLIST textarea
+ %attrs;
+ name CDATA #IMPLIED
+ rows %Number; #REQUIRED
+ cols %Number; #REQUIRED
+ disabled (disabled) #IMPLIED
+ readonly (readonly) #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ onselect %Script; #IMPLIED
+ onchange %Script; #IMPLIED
+ >
+
+<!--
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+ %attrs;
+ >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;> <!-- fieldset label -->
+<!ATTLIST legend
+ %attrs;
+ accesskey %Character; #IMPLIED
+ align %LAlign; #IMPLIED
+ >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+-->
+<!ELEMENT button %button.content;> <!-- push button -->
+<!ATTLIST button
+ %attrs;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type (button|submit|reset) "submit"
+ disabled (disabled) #IMPLIED
+ tabindex %Number; #IMPLIED
+ accesskey %Character; #IMPLIED
+ onfocus %Script; #IMPLIED
+ onblur %Script; #IMPLIED
+ >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+ %coreattrs;
+ %i18n;
+ prompt %Text; #IMPLIED
+ >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+-->
+<!ENTITY % cellhalign
+ "align (left|center|right|justify|char) #IMPLIED
+ char %Character; #IMPLIED
+ charoff %Length; #IMPLIED"
+ >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+ "valign (top|middle|bottom|baseline) #IMPLIED"
+ >
+
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption %Inline;>
+<!ELEMENT thead (tr)+>
+<!ELEMENT tfoot (tr)+>
+<!ELEMENT tbody (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col EMPTY>
+<!ELEMENT tr (th|td)+>
+<!ELEMENT th %Flow;>
+<!ELEMENT td %Flow;>
+
+<!ATTLIST table
+ %attrs;
+ summary %Text; #IMPLIED
+ width %Length; #IMPLIED
+ border %Pixels; #IMPLIED
+ frame %TFrame; #IMPLIED
+ rules %TRules; #IMPLIED
+ cellspacing %Length; #IMPLIED
+ cellpadding %Length; #IMPLIED
+ align %TAlign; #IMPLIED
+ bgcolor %Color; #IMPLIED
+ >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+ %attrs;
+ align %CAlign; #IMPLIED
+ >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+ %attrs;
+ span %Number; "1"
+ width %MultiLength; #IMPLIED
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!--
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+<!ATTLIST thead
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tfoot
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tbody
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ >
+
+<!ATTLIST tr
+ %attrs;
+ %cellhalign;
+ %cellvalign;
+ bgcolor %Color; #IMPLIED
+ >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
+<!ATTLIST td
+ %attrs;
+ abbr %Text; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope %Scope; #IMPLIED
+ rowspan %Number; "1"
+ colspan %Number; "1"
+ %cellhalign;
+ %cellvalign;
+ nowrap (nowrap) #IMPLIED
+ bgcolor %Color; #IMPLIED
+ width %Pixels; #IMPLIED
+ height %Pixels; #IMPLIED
+ >
+
diff --git a/bundles/org.eclipse.wst.html.core/dtds/xhtml11-flat.dtd b/bundles/org.eclipse.wst.html.core/dtds/xhtml11-flat.dtd
new file mode 100644
index 0000000000..95b0710215
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/dtds/xhtml11-flat.dtd
@@ -0,0 +1,4513 @@
+<!-- ....................................................................... -->
+<!-- XHTML 1.1 DTD ........................................................ -->
+<!-- file: xhtml11.dtd
+-->
+
+<!-- XHTML 1.1 DTD
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+
+ The Extensible HyperText Markup Language (XHTML)
+ Copyright 1998-2000 World Wide Web Consortium
+ (Massachusetts Institute of Technology, Institut National de
+ Recherche en Informatique et en Automatique, Keio University).
+ All Rights Reserved.
+
+ Permission to use, copy, modify and distribute the XHTML DTD and its
+ accompanying documentation for any purpose and without fee is hereby
+ granted in perpetuity, provided that the above copyright notice and
+ this paragraph appear in all copies. The copyright holders make no
+ representation about the suitability of the DTD for any purpose.
+
+ It is provided "as is" without expressed or implied warranty.
+
+ Author: Murray M. Altheim <altheim@eng.sun.com>
+ Revision: $Id: xhtml11.dtd,v 1.20 2001/04/05 14:20:51 ahby Exp $
+
+-->
+<!-- This is the driver file for version 1.1 of the XHTML DTD.
+
+ Please use this formal public identifier to identify it:
+
+ "-//W3C//DTD XHTML 1.1//EN"
+-->
+<!ENTITY % XHTML.version "-//W3C//DTD XHTML 1.1//EN" >
+
+<!-- Use this URI to identify the default namespace:
+
+ "http://www.w3.org/1999/xhtml"
+
+ See the Qualified Names module for information
+ on the use of namespace prefixes in the DTD.
+-->
+<!ENTITY % NS.prefixed "IGNORE" >
+<!ENTITY % XHTML.prefix "" >
+
+<!-- Reserved for use with the XLink namespace:
+-->
+<!ENTITY % XLINK.xmlns "" >
+<!ENTITY % XLINK.xmlns.attrib "" >
+
+<!-- For example, if you are using XHTML 1.1 directly, use the FPI
+ in the DOCTYPE declaration, with the xmlns attribute on the
+ document element to identify the default namespace:
+
+ <?xml version="1.0"?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en">
+ ...
+ </html>
+
+ Revisions:
+ (none)
+-->
+
+<!-- reserved for future use with document profiles -->
+<!ENTITY % XHTML.profile "" >
+
+<!-- Bidirectional Text features
+ This feature-test entity is used to declare elements
+ and attributes used for bidirectional text support.
+-->
+<!ENTITY % XHTML.bidi "INCLUDE" >
+
+<?doc type="doctype" role="title" { XHTML 1.1 } ?>
+
+<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+
+<!-- Pre-Framework Redeclaration placeholder .................... -->
+<!-- this serves as a location to insert markup declarations
+ into the DTD prior to the framework declarations.
+-->
+<!ENTITY % xhtml-prefw-redecl.module "IGNORE" >
+<![%xhtml-prefw-redecl.module;[
+%xhtml-prefw-redecl.mod;
+<!-- end of xhtml-prefw-redecl.module -->]]>
+
+<!ENTITY % xhtml-events.module "INCLUDE" >
+
+<!-- Inline Style Module ........................................ -->
+<!ENTITY % xhtml-inlstyle.module "INCLUDE" >
+<![%xhtml-inlstyle.module;[
+<!ENTITY % xhtml-inlstyle.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Style 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Style Module ........................................... -->
+<!-- file: xhtml-inlstyle-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlstyle-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Inline Style 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Style
+
+ This module declares the 'style' attribute, used to support inline
+ style markup. This module must be instantiated prior to the XHTML
+ Common Attributes module in order to be included in %Core.attrib;.
+-->
+
+<!ENTITY % style.attrib
+ "style CDATA #IMPLIED"
+>
+
+
+<!ENTITY % Core.extra.attrib
+ "%style.attrib;"
+>
+
+<!-- end of xhtml-inlstyle-1.mod -->
+]]>
+
+<!-- declare Document Model module instantiated in framework
+-->
+<!ENTITY % xhtml-model.mod
+ PUBLIC "-//W3C//ENTITIES XHTML 1.1 Document Model 1.0//EN"
+ "xhtml11-model-1.mod" >
+
+<!-- Modular Framework Module (required) ......................... -->
+<!ENTITY % xhtml-framework.module "INCLUDE" >
+<![%xhtml-framework.module;[
+<!ENTITY % xhtml-framework.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-framework-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Modular Framework Module ...................................... -->
+<!-- file: xhtml-framework-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-framework-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-framework-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Modular Framework
+
+ This required module instantiates the modules needed
+ to support the XHTML modularization model, including:
+
+ + notations
+ + datatypes
+ + namespace-qualified names
+ + common attributes
+ + document model
+ + character entities
+
+ The Intrinsic Events module is ignored by default but
+ occurs in this module because it must be instantiated
+ prior to Attributes but after Datatypes.
+-->
+
+<!ENTITY % xhtml-arch.module "IGNORE" >
+<![%xhtml-arch.module;[
+<!ENTITY % xhtml-arch.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Architecture 1.0//EN"
+ "xhtml-arch-1.mod" >
+%xhtml-arch.mod;]]>
+
+<!ENTITY % xhtml-notations.module "INCLUDE" >
+<![%xhtml-notations.module;[
+<!ENTITY % xhtml-notations.mod
+ PUBLIC "-//W3C//NOTATIONS XHTML Notations 1.0//EN"
+ "xhtml-notations-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Notations Module .............................................. -->
+<!-- file: xhtml-notations-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-notations-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//NOTATIONS XHTML Notations 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-notations-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Notations
+
+ defines the following notations, many of these imported from
+ other specifications and standards. When an existing FPI is
+ known, it is incorporated here.
+-->
+
+<!-- XML Notations ..................................... -->
+<!-- SGML and XML Notations ............................ -->
+
+<!-- W3C XML 1.0 Recommendation -->
+<!NOTATION w3c-xml
+ PUBLIC "ISO 8879//NOTATION Extensible Markup Language (XML) 1.0//EN" >
+
+<!-- XML 1.0 CDATA -->
+<!NOTATION cdata
+ PUBLIC "-//W3C//NOTATION XML 1.0: CDATA//EN" >
+
+<!-- SGML Formal Public Identifiers -->
+<!NOTATION fpi
+ PUBLIC "ISO 8879:1986//NOTATION Formal Public Identifier//EN" >
+
+<!-- XHTML Notations ................................... -->
+
+<!-- Length defined for cellpadding/cellspacing -->
+
+<!-- nn for pixels or nn% for percentage length -->
+<!NOTATION length
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Length//EN" >
+
+<!-- space-separated list of link types -->
+<!NOTATION linkTypes
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: LinkTypes//EN" >
+
+<!-- single or comma-separated list of media descriptors -->
+<!NOTATION mediaDesc
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: MediaDesc//EN" >
+
+<!-- pixel, percentage, or relative -->
+<!NOTATION multiLength
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: MultiLength//EN" >
+
+<!-- one or more digits (NUMBER) -->
+<!NOTATION number
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Number//EN" >
+
+<!-- integer representing length in pixels -->
+<!NOTATION pixels
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Pixels//EN" >
+
+<!-- script expression -->
+<!NOTATION script
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Script//EN" >
+
+<!-- textual content -->
+<!NOTATION text
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Text//EN" >
+
+<!-- Imported Notations ................................ -->
+
+<!-- a single character from [ISO10646] -->
+<!NOTATION character
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Character//EN" >
+
+<!-- a character encoding, as per [RFC2045] -->
+<!NOTATION charset
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Charset//EN" >
+
+<!-- a space separated list of character encodings, as per [RFC2045] -->
+<!NOTATION charsets
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Charsets//EN" >
+
+<!-- media type, as per [RFC2045] -->
+<!NOTATION contentType
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: ContentType//EN" >
+
+<!-- comma-separated list of media types, as per [RFC2045] -->
+<!NOTATION contentTypes
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: ContentTypes//EN" >
+
+<!-- date and time information. ISO date format -->
+<!NOTATION datetime
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: Datetime//EN" >
+
+<!-- a language code, as per [RFC3066] -->
+<!NOTATION languageCode
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: LanguageCode//EN" >
+
+<!-- a Uniform Resource Identifier, see [URI] -->
+<!NOTATION uri
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: URI//EN" >
+
+<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
+<!NOTATION uris
+ PUBLIC "-//W3C//NOTATION XHTML Datatype: URIs//EN" >
+
+<!-- end of xhtml-notations-1.mod -->
+]]>
+
+<!ENTITY % xhtml-datatypes.module "INCLUDE" >
+<![%xhtml-datatypes.module;[
+<!ENTITY % xhtml-datatypes.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
+ "xhtml-datatypes-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Datatypes Module .............................................. -->
+<!-- file: xhtml-datatypes-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-datatypes-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-datatypes-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Datatypes
+
+ defines containers for the following datatypes, many of
+ these imported from other specifications and standards.
+-->
+
+<!-- Length defined for cellpadding/cellspacing -->
+
+<!-- nn for pixels or nn% for percentage length -->
+<!ENTITY % Length.datatype "CDATA" >
+
+<!-- space-separated list of link types -->
+<!ENTITY % LinkTypes.datatype "NMTOKENS" >
+
+<!-- single or comma-separated list of media descriptors -->
+<!ENTITY % MediaDesc.datatype "CDATA" >
+
+<!-- pixel, percentage, or relative -->
+<!ENTITY % MultiLength.datatype "CDATA" >
+
+<!-- one or more digits (NUMBER) -->
+<!ENTITY % Number.datatype "CDATA" >
+
+<!-- integer representing length in pixels -->
+<!ENTITY % Pixels.datatype "CDATA" >
+
+<!-- script expression -->
+<!ENTITY % Script.datatype "CDATA" >
+
+<!-- textual content -->
+<!ENTITY % Text.datatype "CDATA" >
+
+<!-- Imported Datatypes ................................ -->
+
+<!-- a single character from [ISO10646] -->
+<!ENTITY % Character.datatype "CDATA" >
+
+<!-- a character encoding, as per [RFC2045] -->
+<!ENTITY % Charset.datatype "CDATA" >
+
+<!-- a space separated list of character encodings, as per [RFC2045] -->
+<!ENTITY % Charsets.datatype "CDATA" >
+
+<!-- media type, as per [RFC2045] -->
+<!ENTITY % ContentType.datatype "CDATA" >
+
+<!-- comma-separated list of media types, as per [RFC2045] -->
+<!ENTITY % ContentTypes.datatype "CDATA" >
+
+<!-- date and time information. ISO date format -->
+<!ENTITY % Datetime.datatype "CDATA" >
+
+<!-- formal public identifier, as per [ISO8879] -->
+<!ENTITY % FPI.datatype "CDATA" >
+
+<!-- a language code, as per [RFC3066] -->
+<!ENTITY % LanguageCode.datatype "NMTOKEN" >
+
+<!-- a Uniform Resource Identifier, see [URI] -->
+<!ENTITY % URI.datatype "CDATA" >
+
+<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
+<!ENTITY % URIs.datatype "CDATA" >
+
+<!-- end of xhtml-datatypes-1.mod -->
+]]>
+
+<!-- placeholder for XLink support module -->
+<!ENTITY % xhtml-xlink.mod "" >
+
+
+<!ENTITY % xhtml-qname.module "INCLUDE" >
+<![%xhtml-qname.module;[
+<!ENTITY % xhtml-qname.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
+ "xhtml-qname-1.mod" >
+<!-- ....................................................................... -->
+<!-- XHTML Qname Module ................................................... -->
+<!-- file: xhtml-qname-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-qname-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Qualified Names 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-qname-1.mod"
+
+ Revisions:
+#2000-10-22: added qname declarations for ruby elements
+ ....................................................................... -->
+
+<!-- XHTML Qname (Qualified Name) Module
+
+ This module is contained in two parts, labeled Section 'A' and 'B':
+
+ Section A declares parameter entities to support namespace-
+ qualified names, namespace declarations, and name prefixing
+ for XHTML and extensions.
+
+ Section B declares parameter entities used to provide
+ namespace-qualified names for all XHTML element types:
+
+ %applet.qname; the xmlns-qualified name for <applet>
+ %base.qname; the xmlns-qualified name for <base>
+ ...
+
+ XHTML extensions would create a module similar to this one.
+ Included in the XHTML distribution is a template module
+ ('template-qname-1.mod') suitable for this purpose.
+-->
+
+<!-- Section A: XHTML XML Namespace Framework :::::::::::::::::::: -->
+
+<!-- 1. Declare a %XHTML.prefixed; conditional section keyword, used
+ to activate namespace prefixing. The default value should
+ inherit '%NS.prefixed;' from the DTD driver, so that unless
+ overridden, the default behaviour follows the overall DTD
+ prefixing scheme.
+-->
+<!ENTITY % NS.prefixed "IGNORE" >
+<!ENTITY % XHTML.prefixed "%NS.prefixed;" >
+
+<!-- 2. Declare a parameter entity (eg., %XHTML.xmlns;) containing
+ the URI reference used to identify the XHTML namespace:
+-->
+<!ENTITY % XHTML.xmlns "http://www.w3.org/1999/xhtml" >
+
+<!-- 3. Declare parameter entities (eg., %XHTML.prefix;) containing
+ the default namespace prefix string(s) to use when prefixing
+ is enabled. This may be overridden in the DTD driver or the
+ internal subset of an document instance. If no default prefix
+ is desired, this may be declared as an empty string.
+
+ NOTE: As specified in [XMLNAMES], the namespace prefix serves
+ as a proxy for the URI reference, and is not in itself significant.
+-->
+<!ENTITY % XHTML.prefix "" >
+
+<!-- 4. Declare parameter entities (eg., %XHTML.pfx;) containing the
+ colonized prefix(es) (eg., '%XHTML.prefix;:') used when
+ prefixing is active, an empty string when it is not.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % XHTML.pfx "%XHTML.prefix;:" >
+]]>
+<!ENTITY % XHTML.pfx "" >
+
+<!-- declare qualified name extensions here ............ -->
+<!ENTITY % xhtml-qname-extra.mod "" >
+
+
+<!-- 5. The parameter entity %XHTML.xmlns.extra.attrib; may be
+ redeclared to contain any non-XHTML namespace declaration
+ attributes for namespaces embedded in XHTML. The default
+ is an empty string. XLink should be included here if used
+ in the DTD.
+-->
+<!ENTITY % XHTML.xmlns.extra.attrib "" >
+
+<!-- The remainder of Section A is only followed in XHTML, not extensions. -->
+
+<!-- Declare a parameter entity %NS.decl.attrib; containing
+ all XML Namespace declarations used in the DTD, plus the
+ xmlns declaration for XHTML, its form dependent on whether
+ prefixing is active.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % NS.decl.attrib
+ "xmlns:%XHTML.prefix; %URI.datatype; #FIXED '%XHTML.xmlns;'
+ %XHTML.xmlns.extra.attrib;"
+>
+]]>
+<!ENTITY % NS.decl.attrib
+ "%XHTML.xmlns.extra.attrib;"
+>
+
+<!-- This is a placeholder for future XLink support.
+-->
+<!ENTITY % XLINK.xmlns.attrib "" >
+
+<!-- Declare a parameter entity %NS.decl.attrib; containing all
+ XML namespace declaration attributes used by XHTML, including
+ a default xmlns attribute when prefixing is inactive.
+-->
+<![%XHTML.prefixed;[
+<!ENTITY % XHTML.xmlns.attrib
+ "%NS.decl.attrib;
+ %XLINK.xmlns.attrib;"
+>
+]]>
+<!ENTITY % XHTML.xmlns.attrib
+ "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;'
+ %XLINK.xmlns.attrib;"
+>
+
+<!-- placeholder for qualified name redeclarations -->
+<!ENTITY % xhtml-qname.redecl "" >
+
+
+<!-- Section B: XHTML Qualified Names ::::::::::::::::::::::::::::: -->
+
+<!-- 6. This section declares parameter entities used to provide
+ namespace-qualified names for all XHTML element types.
+-->
+
+<!-- module: xhtml-applet-1.mod -->
+<!ENTITY % applet.qname "%XHTML.pfx;applet" >
+
+<!-- module: xhtml-base-1.mod -->
+<!ENTITY % base.qname "%XHTML.pfx;base" >
+
+<!-- module: xhtml-bdo-1.mod -->
+<!ENTITY % bdo.qname "%XHTML.pfx;bdo" >
+
+<!-- module: xhtml-blkphras-1.mod -->
+<!ENTITY % address.qname "%XHTML.pfx;address" >
+<!ENTITY % blockquote.qname "%XHTML.pfx;blockquote" >
+<!ENTITY % pre.qname "%XHTML.pfx;pre" >
+<!ENTITY % h1.qname "%XHTML.pfx;h1" >
+<!ENTITY % h2.qname "%XHTML.pfx;h2" >
+<!ENTITY % h3.qname "%XHTML.pfx;h3" >
+<!ENTITY % h4.qname "%XHTML.pfx;h4" >
+<!ENTITY % h5.qname "%XHTML.pfx;h5" >
+<!ENTITY % h6.qname "%XHTML.pfx;h6" >
+
+<!-- module: xhtml-blkpres-1.mod -->
+<!ENTITY % hr.qname "%XHTML.pfx;hr" >
+
+<!-- module: xhtml-blkstruct-1.mod -->
+<!ENTITY % div.qname "%XHTML.pfx;div" >
+<!ENTITY % p.qname "%XHTML.pfx;p" >
+
+<!-- module: xhtml-edit-1.mod -->
+<!ENTITY % ins.qname "%XHTML.pfx;ins" >
+<!ENTITY % del.qname "%XHTML.pfx;del" >
+
+<!-- module: xhtml-form-1.mod -->
+<!ENTITY % form.qname "%XHTML.pfx;form" >
+<!ENTITY % label.qname "%XHTML.pfx;label" >
+<!ENTITY % input.qname "%XHTML.pfx;input" >
+<!ENTITY % select.qname "%XHTML.pfx;select" >
+<!ENTITY % optgroup.qname "%XHTML.pfx;optgroup" >
+<!ENTITY % option.qname "%XHTML.pfx;option" >
+<!ENTITY % textarea.qname "%XHTML.pfx;textarea" >
+<!ENTITY % fieldset.qname "%XHTML.pfx;fieldset" >
+<!ENTITY % legend.qname "%XHTML.pfx;legend" >
+<!ENTITY % button.qname "%XHTML.pfx;button" >
+
+<!-- module: xhtml-hypertext-1.mod -->
+<!ENTITY % a.qname "%XHTML.pfx;a" >
+
+<!-- module: xhtml-image-1.mod -->
+<!ENTITY % img.qname "%XHTML.pfx;img" >
+
+<!-- module: xhtml-inlphras-1.mod -->
+<!ENTITY % abbr.qname "%XHTML.pfx;abbr" >
+<!ENTITY % acronym.qname "%XHTML.pfx;acronym" >
+<!ENTITY % cite.qname "%XHTML.pfx;cite" >
+<!ENTITY % code.qname "%XHTML.pfx;code" >
+<!ENTITY % dfn.qname "%XHTML.pfx;dfn" >
+<!ENTITY % em.qname "%XHTML.pfx;em" >
+<!ENTITY % kbd.qname "%XHTML.pfx;kbd" >
+<!ENTITY % q.qname "%XHTML.pfx;q" >
+<!ENTITY % samp.qname "%XHTML.pfx;samp" >
+<!ENTITY % strong.qname "%XHTML.pfx;strong" >
+<!ENTITY % var.qname "%XHTML.pfx;var" >
+
+<!-- module: xhtml-inlpres-1.mod -->
+<!ENTITY % b.qname "%XHTML.pfx;b" >
+<!ENTITY % big.qname "%XHTML.pfx;big" >
+<!ENTITY % i.qname "%XHTML.pfx;i" >
+<!ENTITY % small.qname "%XHTML.pfx;small" >
+<!ENTITY % sub.qname "%XHTML.pfx;sub" >
+<!ENTITY % sup.qname "%XHTML.pfx;sup" >
+<!ENTITY % tt.qname "%XHTML.pfx;tt" >
+
+<!-- module: xhtml-inlstruct-1.mod -->
+<!ENTITY % br.qname "%XHTML.pfx;br" >
+<!ENTITY % span.qname "%XHTML.pfx;span" >
+
+<!-- module: xhtml-ismap-1.mod (also csismap, ssismap) -->
+<!ENTITY % map.qname "%XHTML.pfx;map" >
+<!ENTITY % area.qname "%XHTML.pfx;area" >
+
+<!-- module: xhtml-link-1.mod -->
+<!ENTITY % link.qname "%XHTML.pfx;link" >
+
+<!-- module: xhtml-list-1.mod -->
+<!ENTITY % dl.qname "%XHTML.pfx;dl" >
+<!ENTITY % dt.qname "%XHTML.pfx;dt" >
+<!ENTITY % dd.qname "%XHTML.pfx;dd" >
+<!ENTITY % ol.qname "%XHTML.pfx;ol" >
+<!ENTITY % ul.qname "%XHTML.pfx;ul" >
+<!ENTITY % li.qname "%XHTML.pfx;li" >
+
+<!-- module: xhtml-meta-1.mod -->
+<!ENTITY % meta.qname "%XHTML.pfx;meta" >
+
+<!-- module: xhtml-param-1.mod -->
+<!ENTITY % param.qname "%XHTML.pfx;param" >
+
+<!-- module: xhtml-object-1.mod -->
+<!ENTITY % object.qname "%XHTML.pfx;object" >
+
+<!-- module: xhtml-script-1.mod -->
+<!ENTITY % script.qname "%XHTML.pfx;script" >
+<!ENTITY % noscript.qname "%XHTML.pfx;noscript" >
+
+<!-- module: xhtml-struct-1.mod -->
+<!ENTITY % html.qname "%XHTML.pfx;html" >
+<!ENTITY % head.qname "%XHTML.pfx;head" >
+<!ENTITY % title.qname "%XHTML.pfx;title" >
+<!ENTITY % body.qname "%XHTML.pfx;body" >
+
+<!-- module: xhtml-style-1.mod -->
+<!ENTITY % style.qname "%XHTML.pfx;style" >
+
+<!-- module: xhtml-table-1.mod -->
+<!ENTITY % table.qname "%XHTML.pfx;table" >
+<!ENTITY % caption.qname "%XHTML.pfx;caption" >
+<!ENTITY % thead.qname "%XHTML.pfx;thead" >
+<!ENTITY % tfoot.qname "%XHTML.pfx;tfoot" >
+<!ENTITY % tbody.qname "%XHTML.pfx;tbody" >
+<!ENTITY % colgroup.qname "%XHTML.pfx;colgroup" >
+<!ENTITY % col.qname "%XHTML.pfx;col" >
+<!ENTITY % tr.qname "%XHTML.pfx;tr" >
+<!ENTITY % th.qname "%XHTML.pfx;th" >
+<!ENTITY % td.qname "%XHTML.pfx;td" >
+
+<!-- module: xhtml-ruby-1.mod -->
+
+<!ENTITY % ruby.qname "%XHTML.pfx;ruby" >
+<!ENTITY % rbc.qname "%XHTML.pfx;rbc" >
+<!ENTITY % rtc.qname "%XHTML.pfx;rtc" >
+<!ENTITY % rb.qname "%XHTML.pfx;rb" >
+<!ENTITY % rt.qname "%XHTML.pfx;rt" >
+<!ENTITY % rp.qname "%XHTML.pfx;rp" >
+
+<!-- Provisional XHTML 2.0 Qualified Names ...................... -->
+
+<!-- module: xhtml-image-2.mod -->
+<!ENTITY % alt.qname "%XHTML.pfx;alt" >
+
+<!-- end of xhtml-qname-1.mod -->
+]]>
+
+<!ENTITY % xhtml-events.module "IGNORE" >
+<![%xhtml-events.module;[
+<!ENTITY % xhtml-events.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Intrinsic Events 1.0//EN"
+ "xhtml-events-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Intrinsic Events Module ....................................... -->
+<!-- file: xhtml-events-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-events-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Intrinsic Events 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-events-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Intrinsic Event Attributes
+
+ These are the event attributes defined in HTML 4.0,
+ Section 18.2.3 "Intrinsic Events". This module must be
+ instantiated prior to the Attributes Module but after
+ the Datatype Module in the Modular Framework module.
+
+ "Note: Authors of HTML documents are advised that changes
+ are likely to occur in the realm of intrinsic events
+ (e.g., how scripts are bound to events). Research in
+ this realm is carried on by members of the W3C Document
+ Object Model Working Group (see the W3C Web site at
+ http://www.w3.org/ for more information)."
+-->
+<!-- NOTE: Because the ATTLIST declarations in this module occur
+ before their respective ELEMENT declarations in other
+ modules, there may be a dependency on this module that
+ should be considered if any of the parameter entities used
+ for element type names (eg., %a.qname;) are redeclared.
+-->
+
+<!ENTITY % Events.attrib
+ "onclick %Script.datatype; #IMPLIED
+ ondblclick %Script.datatype; #IMPLIED
+ onmousedown %Script.datatype; #IMPLIED
+ onmouseup %Script.datatype; #IMPLIED
+ onmouseover %Script.datatype; #IMPLIED
+ onmousemove %Script.datatype; #IMPLIED
+ onmouseout %Script.datatype; #IMPLIED
+ onkeypress %Script.datatype; #IMPLIED
+ onkeydown %Script.datatype; #IMPLIED
+ onkeyup %Script.datatype; #IMPLIED"
+>
+
+<!-- additional attributes on anchor element
+-->
+<!ATTLIST %a.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on form element
+-->
+<!ATTLIST %form.qname;
+ onsubmit %Script.datatype; #IMPLIED
+ onreset %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on label element
+-->
+<!ATTLIST %label.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on input element
+-->
+<!ATTLIST %input.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+ onselect %Script.datatype; #IMPLIED
+ onchange %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on select element
+-->
+<!ATTLIST %select.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+ onchange %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on textarea element
+-->
+<!ATTLIST %textarea.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+ onselect %Script.datatype; #IMPLIED
+ onchange %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on button element
+-->
+<!ATTLIST %button.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on body element
+-->
+<!ATTLIST %body.qname;
+ onload %Script.datatype; #IMPLIED
+ onunload %Script.datatype; #IMPLIED
+>
+
+<!-- additional attributes on area element
+-->
+<!ATTLIST %area.qname;
+ onfocus %Script.datatype; #IMPLIED
+ onblur %Script.datatype; #IMPLIED
+>
+
+<!-- end of xhtml-events-1.mod -->
+]]>
+
+<!ENTITY % xhtml-attribs.module "INCLUDE" >
+<![%xhtml-attribs.module;[
+<!ENTITY % xhtml-attribs.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Common Attributes 1.0//EN"
+ "xhtml-attribs-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Common Attributes Module ...................................... -->
+<!-- file: xhtml-attribs-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-attribs-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Common Attributes 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-attribs-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Common Attributes
+
+ This module declares many of the common attributes for the XHTML DTD.
+ %NS.decl.attrib; is declared in the XHTML Qname module.
+-->
+
+<!ENTITY % id.attrib
+ "id ID #IMPLIED"
+>
+
+<!ENTITY % class.attrib
+ "class NMTOKENS #IMPLIED"
+>
+
+<!ENTITY % title.attrib
+ "title %Text.datatype; #IMPLIED"
+>
+
+<!ENTITY % Core.extra.attrib "" >
+
+<!ENTITY % Core.attrib
+ "%XHTML.xmlns.attrib;
+ %id.attrib;
+ %class.attrib;
+ %title.attrib;
+ %Core.extra.attrib;"
+>
+
+<!ENTITY % lang.attrib
+ "xml:lang %LanguageCode.datatype; #IMPLIED"
+>
+
+<![%XHTML.bidi;[
+<!ENTITY % dir.attrib
+ "dir ( ltr | rtl ) #IMPLIED"
+>
+
+<!ENTITY % I18n.attrib
+ "%dir.attrib;
+ %lang.attrib;"
+>
+
+]]>
+<!ENTITY % I18n.attrib
+ "%lang.attrib;"
+>
+
+<!ENTITY % Common.extra.attrib "" >
+
+<!-- intrinsic event attributes declared previously
+-->
+<!ENTITY % Events.attrib "" >
+
+<!ENTITY % Common.attrib
+ "%Core.attrib;
+ %I18n.attrib;
+ %Events.attrib;
+ %Common.extra.attrib;"
+>
+
+<!-- end of xhtml-attribs-1.mod -->
+]]>
+
+<!-- placeholder for content model redeclarations -->
+<!ENTITY % xhtml-model.redecl "" >
+
+
+<!ENTITY % xhtml-model.module "INCLUDE" >
+<![%xhtml-model.module;[
+<!-- instantiate the Document Model module declared in the DTD driver
+-->
+<!-- ....................................................................... -->
+<!-- XHTML 1.1 Document Model Module ...................................... -->
+<!-- file: xhtml11-model-1.mod
+
+ This is XHTML 1.1, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2000 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml11-model-1.mod,v 1.12 2000/11/18 18:20:25 ahby Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML 1.1 Document Model 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml11/DTD/xhtml11-model-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- XHTML 1.1 Document Model
+
+ This module describes the groupings of elements that make up
+ common content models for XHTML elements.
+
+ XHTML has three basic content models:
+
+ %Inline.mix; character-level elements
+ %Block.mix; block-like elements, eg., paragraphs and lists
+ %Flow.mix; any block or inline elements
+
+ Any parameter entities declared in this module may be used
+ to create element content models, but the above three are
+ considered 'global' (insofar as that term applies here).
+
+ The reserved word '#PCDATA' (indicating a text string) is now
+ included explicitly with each element declaration that is
+ declared as mixed content, as XML requires that this token
+ occur first in a content model specification.
+-->
+<!-- Extending the Model
+
+ While in some cases this module may need to be rewritten to
+ accommodate changes to the document model, minor extensions
+ may be accomplished by redeclaring any of the three *.extra;
+ parameter entities to contain extension element types as follows:
+
+ %Misc.extra; whose parent may be any block or
+ inline element.
+
+ %Inline.extra; whose parent may be any inline element.
+
+ %Block.extra; whose parent may be any block element.
+
+ If used, these parameter entities must be an OR-separated
+ list beginning with an OR separator ("|"), eg., "| a | b | c"
+
+ All block and inline *.class parameter entities not part
+ of the *struct.class classes begin with "| " to allow for
+ exclusion from mixes.
+-->
+
+<!-- .............. Optional Elements in head .................. -->
+
+<!ENTITY % HeadOpts.mix
+ "( %script.qname; | %style.qname; | %meta.qname;
+ | %link.qname; | %object.qname; )*"
+>
+
+<!-- ................. Miscellaneous Elements .................. -->
+
+<!-- ins and del are used to denote editing changes
+-->
+<!ENTITY % Edit.class "| %ins.qname; | %del.qname;" >
+
+<!-- script and noscript are used to contain scripts
+ and alternative content
+-->
+<!ENTITY % Script.class "| %script.qname; | %noscript.qname;" >
+
+<!ENTITY % Misc.extra "" >
+
+<!-- These elements are neither block nor inline, and can
+ essentially be used anywhere in the document body.
+-->
+<!ENTITY % Misc.class
+ "%Edit.class;
+ %Script.class;
+ %Misc.extra;"
+>
+
+<!-- .................... Inline Elements ...................... -->
+
+<!ENTITY % InlStruct.class "%br.qname; | %span.qname;" >
+
+<!ENTITY % InlPhras.class
+ "| %em.qname; | %strong.qname; | %dfn.qname; | %code.qname;
+ | %samp.qname; | %kbd.qname; | %var.qname; | %cite.qname;
+ | %abbr.qname; | %acronym.qname; | %q.qname;" >
+
+<!ENTITY % InlPres.class
+ "| %tt.qname; | %i.qname; | %b.qname; | %big.qname;
+ | %small.qname; | %sub.qname; | %sup.qname;" >
+
+<!ENTITY % I18n.class "| %bdo.qname;" >
+
+<!ENTITY % Anchor.class "| %a.qname;" >
+
+<!ENTITY % InlSpecial.class
+ "| %img.qname; | %map.qname;
+ | %object.qname;" >
+
+<!ENTITY % InlForm.class
+ "| %input.qname; | %select.qname; | %textarea.qname;
+ | %label.qname; | %button.qname;" >
+
+<!ENTITY % Inline.extra "" >
+
+<!ENTITY % Ruby.class "| %ruby.qname;" >
+
+<!-- %Inline.class; includes all inline elements,
+ used as a component in mixes
+-->
+<!ENTITY % Inline.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %InlPres.class;
+ %I18n.class;
+ %Anchor.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Ruby.class;
+ %Inline.extra;"
+>
+
+<!-- %InlNoRuby.class; includes all inline elements
+ except ruby, used as a component in mixes
+-->
+<!ENTITY % InlNoRuby.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %InlPres.class;
+ %I18n.class;
+ %Anchor.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Inline.extra;"
+>
+
+<!-- %NoRuby.content; includes all inlines except ruby
+-->
+<!ENTITY % NoRuby.content
+ "( #PCDATA
+ | %InlNoRuby.class;
+ %Misc.class; )*"
+>
+
+<!-- %InlNoAnchor.class; includes all non-anchor inlines,
+ used as a component in mixes
+-->
+<!ENTITY % InlNoAnchor.class
+ "%InlStruct.class;
+ %InlPhras.class;
+ %InlPres.class;
+ %I18n.class;
+ %InlSpecial.class;
+ %InlForm.class;
+ %Ruby.class;
+ %Inline.extra;"
+>
+
+<!-- %InlNoAnchor.mix; includes all non-anchor inlines
+-->
+<!ENTITY % InlNoAnchor.mix
+ "%InlNoAnchor.class;
+ %Misc.class;"
+>
+
+<!-- %Inline.mix; includes all inline elements, including %Misc.class;
+-->
+<!ENTITY % Inline.mix
+ "%Inline.class;
+ %Misc.class;"
+>
+
+<!-- ..................... Block Elements ...................... -->
+
+<!-- In the HTML 4.0 DTD, heading and list elements were included
+ in the %block; parameter entity. The %Heading.class; and
+ %List.class; parameter entities must now be included explicitly
+ on element declarations where desired.
+-->
+
+<!ENTITY % Heading.class
+ "%h1.qname; | %h2.qname; | %h3.qname;
+ | %h4.qname; | %h5.qname; | %h6.qname;" >
+
+<!ENTITY % List.class "%ul.qname; | %ol.qname; | %dl.qname;" >
+
+<!ENTITY % Table.class "| %table.qname;" >
+
+<!ENTITY % Form.class "| %form.qname;" >
+
+<!ENTITY % Fieldset.class "| %fieldset.qname;" >
+
+<!ENTITY % BlkStruct.class "%p.qname; | %div.qname;" >
+
+<!ENTITY % BlkPhras.class
+ "| %pre.qname; | %blockquote.qname; | %address.qname;" >
+
+<!ENTITY % BlkPres.class "| %hr.qname;" >
+
+<!ENTITY % BlkSpecial.class
+ "%Table.class;
+ %Form.class;
+ %Fieldset.class;"
+>
+
+<!ENTITY % Block.extra "" >
+
+<!-- %Block.class; includes all block elements,
+ used as an component in mixes
+-->
+<!ENTITY % Block.class
+ "%BlkStruct.class;
+ %BlkPhras.class;
+ %BlkPres.class;
+ %BlkSpecial.class;
+ %Block.extra;"
+>
+
+<!-- %Block.mix; includes all block elements plus %Misc.class;
+-->
+<!ENTITY % Block.mix
+ "%Heading.class;
+ | %List.class;
+ | %Block.class;
+ %Misc.class;"
+>
+
+<!-- ................ All Content Elements .................. -->
+
+<!-- %Flow.mix; includes all text content, block and inline
+-->
+<!ENTITY % Flow.mix
+ "%Heading.class;
+ | %List.class;
+ | %Block.class;
+ | %Inline.class;
+ %Misc.class;"
+>
+
+<!-- end of xhtml11-model-1.mod -->
+]]>
+
+<!ENTITY % xhtml-charent.module "INCLUDE" >
+<![%xhtml-charent.module;[
+<!ENTITY % xhtml-charent.mod
+ PUBLIC "-//W3C//ENTITIES XHTML Character Entities 1.0//EN"
+ "xhtml-charent-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Character Entities Module ......................................... -->
+<!-- file: xhtml-charent-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-charent-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES XHTML Character Entities 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-charent-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Character Entities for XHTML
+
+ This module declares the set of character entities for XHTML,
+ including the Latin 1, Symbol and Special character collections.
+-->
+
+<!ENTITY % xhtml-lat1
+ PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "xhtml-lat1.ent" >
+<!-- Portions (C) International Organization for Standardization 1986
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLlat1 PUBLIC
+ "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+ %HTMLlat1;
+-->
+
+<!ENTITY nbsp "&#160;"> <!-- no-break space = non-breaking space,
+ U+00A0 ISOnum -->
+<!ENTITY iexcl "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+ U+00A6 ISOnum -->
+<!ENTITY sect "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml "&#168;"> <!-- diaeresis = spacing diaeresis,
+ U+00A8 ISOdia -->
+<!ENTITY copy "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo "&#171;"> <!-- left-pointing double angle quotation mark
+ = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not "&#172;"> <!-- not sign = discretionary hyphen,
+ U+00AC ISOnum -->
+<!ENTITY shy "&#173;"> <!-- soft hyphen = discretionary hyphen,
+ U+00AD ISOnum -->
+<!ENTITY reg "&#174;"> <!-- registered sign = registered trade mark sign,
+ U+00AE ISOnum -->
+<!ENTITY macr "&#175;"> <!-- macron = spacing macron = overline
+ = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+ U+00B1 ISOnum -->
+<!ENTITY sup2 "&#178;"> <!-- superscript two = superscript digit two
+ = squared, U+00B2 ISOnum -->
+<!ENTITY sup3 "&#179;"> <!-- superscript three = superscript digit three
+ = cubed, U+00B3 ISOnum -->
+<!ENTITY acute "&#180;"> <!-- acute accent = spacing acute,
+ U+00B4 ISOdia -->
+<!ENTITY micro "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para "&#182;"> <!-- pilcrow sign = paragraph sign,
+ U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+ = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1 "&#185;"> <!-- superscript one = superscript digit one,
+ U+00B9 ISOnum -->
+<!ENTITY ordm "&#186;"> <!-- masculine ordinal indicator,
+ U+00BA ISOnum -->
+<!ENTITY raquo "&#187;"> <!-- right-pointing double angle quotation mark
+ = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+ = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+ = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+ = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+ = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+ = latin capital letter A grave,
+ U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+ U+00C1 ISOlat1 -->
+<!ENTITY Acirc "&#194;"> <!-- latin capital letter A with circumflex,
+ U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+ U+00C3 ISOlat1 -->
+<!ENTITY Auml "&#196;"> <!-- latin capital letter A with diaeresis,
+ U+00C4 ISOlat1 -->
+<!ENTITY Aring "&#197;"> <!-- latin capital letter A with ring above
+ = latin capital letter A ring,
+ U+00C5 ISOlat1 -->
+<!ENTITY AElig "&#198;"> <!-- latin capital letter AE
+ = latin capital ligature AE,
+ U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+ U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+ U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+ U+00C9 ISOlat1 -->
+<!ENTITY Ecirc "&#202;"> <!-- latin capital letter E with circumflex,
+ U+00CA ISOlat1 -->
+<!ENTITY Euml "&#203;"> <!-- latin capital letter E with diaeresis,
+ U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+ U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+ U+00CD ISOlat1 -->
+<!ENTITY Icirc "&#206;"> <!-- latin capital letter I with circumflex,
+ U+00CE ISOlat1 -->
+<!ENTITY Iuml "&#207;"> <!-- latin capital letter I with diaeresis,
+ U+00CF ISOlat1 -->
+<!ENTITY ETH "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+ U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+ U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+ U+00D3 ISOlat1 -->
+<!ENTITY Ocirc "&#212;"> <!-- latin capital letter O with circumflex,
+ U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+ U+00D5 ISOlat1 -->
+<!ENTITY Ouml "&#214;"> <!-- latin capital letter O with diaeresis,
+ U+00D6 ISOlat1 -->
+<!ENTITY times "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+ = latin capital letter O slash,
+ U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+ U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+ U+00DA ISOlat1 -->
+<!ENTITY Ucirc "&#219;"> <!-- latin capital letter U with circumflex,
+ U+00DB ISOlat1 -->
+<!ENTITY Uuml "&#220;"> <!-- latin capital letter U with diaeresis,
+ U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+ U+00DD ISOlat1 -->
+<!ENTITY THORN "&#222;"> <!-- latin capital letter THORN,
+ U+00DE ISOlat1 -->
+<!ENTITY szlig "&#223;"> <!-- latin small letter sharp s = ess-zed,
+ U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+ = latin small letter a grave,
+ U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+ U+00E1 ISOlat1 -->
+<!ENTITY acirc "&#226;"> <!-- latin small letter a with circumflex,
+ U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+ U+00E3 ISOlat1 -->
+<!ENTITY auml "&#228;"> <!-- latin small letter a with diaeresis,
+ U+00E4 ISOlat1 -->
+<!ENTITY aring "&#229;"> <!-- latin small letter a with ring above
+ = latin small letter a ring,
+ U+00E5 ISOlat1 -->
+<!ENTITY aelig "&#230;"> <!-- latin small letter ae
+ = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+ U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+ U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+ U+00E9 ISOlat1 -->
+<!ENTITY ecirc "&#234;"> <!-- latin small letter e with circumflex,
+ U+00EA ISOlat1 -->
+<!ENTITY euml "&#235;"> <!-- latin small letter e with diaeresis,
+ U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+ U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+ U+00ED ISOlat1 -->
+<!ENTITY icirc "&#238;"> <!-- latin small letter i with circumflex,
+ U+00EE ISOlat1 -->
+<!ENTITY iuml "&#239;"> <!-- latin small letter i with diaeresis,
+ U+00EF ISOlat1 -->
+<!ENTITY eth "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+ U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+ U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+ U+00F3 ISOlat1 -->
+<!ENTITY ocirc "&#244;"> <!-- latin small letter o with circumflex,
+ U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+ U+00F5 ISOlat1 -->
+<!ENTITY ouml "&#246;"> <!-- latin small letter o with diaeresis,
+ U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+ = latin small letter o slash,
+ U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+ U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+ U+00FA ISOlat1 -->
+<!ENTITY ucirc "&#251;"> <!-- latin small letter u with circumflex,
+ U+00FB ISOlat1 -->
+<!ENTITY uuml "&#252;"> <!-- latin small letter u with diaeresis,
+ U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+ U+00FD ISOlat1 -->
+<!ENTITY thorn "&#254;"> <!-- latin small letter thorn with,
+ U+00FE ISOlat1 -->
+<!ENTITY yuml "&#255;"> <!-- latin small letter y with diaeresis,
+ U+00FF ISOlat1 -->
+
+
+<!ENTITY % xhtml-symbol
+ PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "xhtml-symbol.ent" >
+<!-- Mathematical, Greek and Symbolic characters for HTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLsymbol PUBLIC
+ "-//W3C//ENTITIES Symbols for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+ %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof "&#402;"> <!-- latin small f with hook = function
+ = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma "&#915;"> <!-- greek capital letter gamma,
+ U+0393 ISOgrk3 -->
+<!ENTITY Delta "&#916;"> <!-- greek capital letter delta,
+ U+0394 ISOgrk3 -->
+<!ENTITY Epsilon "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta "&#920;"> <!-- greek capital letter theta,
+ U+0398 ISOgrk3 -->
+<!ENTITY Iota "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda "&#923;"> <!-- greek capital letter lambda,
+ U+039B ISOgrk3 -->
+<!ENTITY Mu "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma "&#931;"> <!-- greek capital letter sigma,
+ U+03A3 ISOgrk3 -->
+<!ENTITY Tau "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon "&#933;"> <!-- greek capital letter upsilon,
+ U+03A5 ISOgrk3 -->
+<!ENTITY Phi "&#934;"> <!-- greek capital letter phi,
+ U+03A6 ISOgrk3 -->
+<!ENTITY Chi "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi "&#936;"> <!-- greek capital letter psi,
+ U+03A8 ISOgrk3 -->
+<!ENTITY Omega "&#937;"> <!-- greek capital letter omega,
+ U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha "&#945;"> <!-- greek small letter alpha,
+ U+03B1 ISOgrk3 -->
+<!ENTITY beta "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma "&#947;"> <!-- greek small letter gamma,
+ U+03B3 ISOgrk3 -->
+<!ENTITY delta "&#948;"> <!-- greek small letter delta,
+ U+03B4 ISOgrk3 -->
+<!ENTITY epsilon "&#949;"> <!-- greek small letter epsilon,
+ U+03B5 ISOgrk3 -->
+<!ENTITY zeta "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta "&#952;"> <!-- greek small letter theta,
+ U+03B8 ISOgrk3 -->
+<!ENTITY iota "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa "&#954;"> <!-- greek small letter kappa,
+ U+03BA ISOgrk3 -->
+<!ENTITY lambda "&#955;"> <!-- greek small letter lambda,
+ U+03BB ISOgrk3 -->
+<!ENTITY mu "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf "&#962;"> <!-- greek small letter final sigma,
+ U+03C2 ISOgrk3 -->
+<!ENTITY sigma "&#963;"> <!-- greek small letter sigma,
+ U+03C3 ISOgrk3 -->
+<!ENTITY tau "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon "&#965;"> <!-- greek small letter upsilon,
+ U+03C5 ISOgrk3 -->
+<!ENTITY phi "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega "&#969;"> <!-- greek small letter omega,
+ U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek small letter theta symbol,
+ U+03D1 NEW -->
+<!ENTITY upsih "&#978;"> <!-- greek upsilon with hook symbol,
+ U+03D2 NEW -->
+<!ENTITY piv "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull "&#8226;"> <!-- bullet = black small circle,
+ U+2022 ISOpub -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+ U+2026 ISOpub -->
+<!ENTITY prime "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime "&#8243;"> <!-- double prime = seconds = inches,
+ U+2033 ISOtech -->
+<!ENTITY oline "&#8254;"> <!-- overline = spacing overscore,
+ U+203E NEW -->
+<!ENTITY frasl "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp "&#8472;"> <!-- script capital P = power set
+ = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image "&#8465;"> <!-- blackletter capital I = imaginary part,
+ U+2111 ISOamso -->
+<!ENTITY real "&#8476;"> <!-- blackletter capital R = real part symbol,
+ U+211C ISOamso -->
+<!ENTITY trade "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+ U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+ U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr "&#8629;"> <!-- downwards arrow with corner leftwards
+ = carriage return, U+21B5 NEW -->
+<!ENTITY lArr "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+ but also does not have any other character for that function. So ? lArr can
+ be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr "&#8658;"> <!-- rightwards double arrow,
+ U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have
+ another character with this function so ?
+ rArr can be used for 'implies' as ISOtech suggests -->
+<!ENTITY dArr "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr "&#8660;"> <!-- left right double arrow,
+ U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part "&#8706;"> <!-- partial differential, U+2202 ISOtech -->
+<!ENTITY exist "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty "&#8709;"> <!-- empty set = null set = diameter,
+ U+2205 ISOamso -->
+<!ENTITY nabla "&#8711;"> <!-- nabla = backward difference,
+ U+2207 ISOtech -->
+<!ENTITY isin "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!-- should there be a more memorable name than 'ni'? -->
+<!ENTITY prod "&#8719;"> <!-- n-ary product = product sign,
+ U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+ the same glyph might be used for both -->
+<!ENTITY sum "&#8721;"> <!-- n-ary sumation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+ though the same glyph might be used for both -->
+<!ENTITY minus "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic "&#8730;"> <!-- square root = radical sign,
+ U+221A ISOtech -->
+<!ENTITY prop "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4 "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim "&#8764;"> <!-- tilde operator = varies with = similar to,
+ U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+ although the same glyph might be used to represent both -->
+<!ENTITY cong "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp "&#8776;"> <!-- almost equal to = asymptotic to,
+ U+2248 ISOamsr -->
+<!ENTITY ne "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge "&#8805;"> <!-- greater-than or equal to,
+ U+2265 ISOtech -->
+<!ENTITY sub "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
+ font encoding and is not included. Should it be, for symmetry?
+ It is in ISOamsn -->
+<!ENTITY nsub "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe "&#8839;"> <!-- superset of or equal to,
+ U+2287 ISOtech -->
+<!ENTITY oplus "&#8853;"> <!-- circled plus = direct sum,
+ U+2295 ISOamsb -->
+<!ENTITY otimes "&#8855;"> <!-- circled times = vector product,
+ U+2297 ISOamsb -->
+<!ENTITY perp "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+ U+22A5 ISOtech -->
+<!ENTITY sdot "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil "&#8968;"> <!-- left ceiling = apl upstile,
+ U+2308 ISOamsc -->
+<!ENTITY rceil "&#8969;"> <!-- right ceiling, U+2309 ISOamsc -->
+<!ENTITY lfloor "&#8970;"> <!-- left floor = apl downstile,
+ U+230A ISOamsc -->
+<!ENTITY rfloor "&#8971;"> <!-- right floor, U+230B ISOamsc -->
+<!ENTITY lang "&#9001;"> <!-- left-pointing angle bracket = bra,
+ U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than'
+ or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang "&#9002;"> <!-- right-pointing angle bracket = ket,
+ U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than'
+ or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs "&#9827;"> <!-- black club suit = shamrock,
+ U+2663 ISOpub -->
+<!ENTITY hearts "&#9829;"> <!-- black heart suit = valentine,
+ U+2665 ISOpub -->
+<!ENTITY diams "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
+
+
+<!ENTITY % xhtml-special
+ PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
+ "xhtml-special.ent" >
+<!-- Special characters for HTML -->
+
+<!-- Character entity set. Typical invocation:
+ <!ENTITY % HTMLspecial PUBLIC
+ "-//W3C//ENTITIES Special for XHTML//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+ %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+ Permission to copy in any form is granted for use with
+ conforming SGML systems and applications as defined in
+ ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+ New names (i.e., not in ISO 8879 list) do not clash with any
+ existing ISO 8879 entity names. ISO 10646 character numbers
+ are given for each character, in hex. values are decimal
+ conversions of the ISO 10646 values and refer to the document
+ character set. Names are Unicode names.
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot "&#34;"> <!-- quotation mark = APL quote,
+ U+0022 ISOnum -->
+<!ENTITY amp "&#38;#38;"> <!-- ampersand, U+0026 ISOnum -->
+<!ENTITY lt "&#38;#60;"> <!-- less-than sign, U+003C ISOnum -->
+<!ENTITY gt "&#62;"> <!-- greater-than sign, U+003E ISOnum -->
+<!ENTITY apos "&#39;"> <!-- apostrophe mark, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig "&#338;"> <!-- latin capital ligature OE,
+ U+0152 ISOlat2 -->
+<!ENTITY oelig "&#339;"> <!-- latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron "&#352;"> <!-- latin capital letter S with caron,
+ U+0160 ISOlat2 -->
+<!ENTITY scaron "&#353;"> <!-- latin small letter s with caron,
+ U+0161 ISOlat2 -->
+<!ENTITY Yuml "&#376;"> <!-- latin capital letter Y with diaeresis,
+ U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ "&#710;"> <!-- modifier letter circumflex accent,
+ U+02C6 ISOpub -->
+<!ENTITY tilde "&#732;"> <!-- small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj "&#8204;"> <!-- zero width non-joiner,
+ U+200C NEW RFC 2070 -->
+<!ENTITY zwj "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo "&#8216;"> <!-- left single quotation mark,
+ U+2018 ISOnum -->
+<!ENTITY rsquo "&#8217;"> <!-- right single quotation mark,
+ U+2019 ISOnum -->
+<!ENTITY sbquo "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo "&#8220;"> <!-- left double quotation mark,
+ U+201C ISOnum -->
+<!ENTITY rdquo "&#8221;"> <!-- right double quotation mark,
+ U+201D ISOnum -->
+<!ENTITY bdquo "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo "&#8249;"> <!-- single left-pointing angle quotation mark,
+ U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo "&#8250;"> <!-- single right-pointing angle quotation mark,
+ U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+<!ENTITY euro "&#8364;"> <!-- euro sign, U+20AC NEW -->
+
+
+<!-- end of xhtml-charent-1.mod -->
+]]>
+
+<!-- end of xhtml-framework-1.mod -->
+]]>
+
+<!-- Post-Framework Redeclaration placeholder ................... -->
+<!-- this serves as a location to insert markup declarations
+ into the DTD following the framework declarations.
+-->
+<!ENTITY % xhtml-postfw-redecl.module "IGNORE" >
+<![%xhtml-postfw-redecl.module;[
+%xhtml-postfw-redecl.mod;
+<!-- end of xhtml-postfw-redecl.module -->]]>
+
+<!-- Text Module (Required) ..................................... -->
+<!ENTITY % xhtml-text.module "INCLUDE" >
+<![%xhtml-text.module;[
+<!ENTITY % xhtml-text.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-text-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Text Module ................................................... -->
+<!-- file: xhtml-text-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-text-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-text-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Textual Content
+
+ The Text module includes declarations for all core
+ text container elements and their attributes.
+-->
+
+<!ENTITY % xhtml-inlstruct.module "INCLUDE" >
+<![%xhtml-inlstruct.module;[
+<!ENTITY % xhtml-inlstruct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN"
+ "xhtml-inlstruct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Structural Module ...................................... -->
+<!-- file: xhtml-inlstruct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlstruct-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Structural 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstruct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Structural
+
+ br, span
+
+ This module declares the elements and their attributes
+ used to support inline-level structural markup.
+-->
+
+<!-- br: forced line break ............................. -->
+
+<!ENTITY % br.element "INCLUDE" >
+<![%br.element;[
+
+<!ENTITY % br.content "EMPTY" >
+<!ENTITY % br.qname "br" >
+<!ELEMENT %br.qname; %br.content; >
+
+<!-- end of br.element -->]]>
+
+<!ENTITY % br.attlist "INCLUDE" >
+<![%br.attlist;[
+<!ATTLIST %br.qname;
+ %Core.attrib;
+>
+<!-- end of br.attlist -->]]>
+
+<!-- span: generic inline container .................... -->
+
+<!ENTITY % span.element "INCLUDE" >
+<![%span.element;[
+<!ENTITY % span.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % span.qname "span" >
+<!ELEMENT %span.qname; %span.content; >
+<!-- end of span.element -->]]>
+
+<!ENTITY % span.attlist "INCLUDE" >
+<![%span.attlist;[
+<!ATTLIST %span.qname;
+ %Common.attrib;
+>
+<!-- end of span.attlist -->]]>
+
+<!-- end of xhtml-inlstruct-1.mod -->
+]]>
+
+<!ENTITY % xhtml-inlphras.module "INCLUDE" >
+<![%xhtml-inlphras.module;[
+<!ENTITY % xhtml-inlphras.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN"
+ "xhtml-inlphras-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Phrasal Module ......................................... -->
+<!-- file: xhtml-inlphras-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlphras-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Phrasal 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlphras-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Phrasal
+
+ abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var
+
+ This module declares the elements and their attributes used to
+ support inline-level phrasal markup.
+-->
+
+<!ENTITY % abbr.element "INCLUDE" >
+<![%abbr.element;[
+<!ENTITY % abbr.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % abbr.qname "abbr" >
+<!ELEMENT %abbr.qname; %abbr.content; >
+<!-- end of abbr.element -->]]>
+
+<!ENTITY % abbr.attlist "INCLUDE" >
+<![%abbr.attlist;[
+<!ATTLIST %abbr.qname;
+ %Common.attrib;
+>
+<!-- end of abbr.attlist -->]]>
+
+<!ENTITY % acronym.element "INCLUDE" >
+<![%acronym.element;[
+<!ENTITY % acronym.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % acronym.qname "acronym" >
+<!ELEMENT %acronym.qname; %acronym.content; >
+<!-- end of acronym.element -->]]>
+
+<!ENTITY % acronym.attlist "INCLUDE" >
+<![%acronym.attlist;[
+<!ATTLIST %acronym.qname;
+ %Common.attrib;
+>
+<!-- end of acronym.attlist -->]]>
+
+<!ENTITY % cite.element "INCLUDE" >
+<![%cite.element;[
+<!ENTITY % cite.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % cite.qname "cite" >
+<!ELEMENT %cite.qname; %cite.content; >
+<!-- end of cite.element -->]]>
+
+<!ENTITY % cite.attlist "INCLUDE" >
+<![%cite.attlist;[
+<!ATTLIST %cite.qname;
+ %Common.attrib;
+>
+<!-- end of cite.attlist -->]]>
+
+<!ENTITY % code.element "INCLUDE" >
+<![%code.element;[
+<!ENTITY % code.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % code.qname "code" >
+<!ELEMENT %code.qname; %code.content; >
+<!-- end of code.element -->]]>
+
+<!ENTITY % code.attlist "INCLUDE" >
+<![%code.attlist;[
+<!ATTLIST %code.qname;
+ %Common.attrib;
+>
+<!-- end of code.attlist -->]]>
+
+<!ENTITY % dfn.element "INCLUDE" >
+<![%dfn.element;[
+<!ENTITY % dfn.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % dfn.qname "dfn" >
+<!ELEMENT %dfn.qname; %dfn.content; >
+<!-- end of dfn.element -->]]>
+
+<!ENTITY % dfn.attlist "INCLUDE" >
+<![%dfn.attlist;[
+<!ATTLIST %dfn.qname;
+ %Common.attrib;
+>
+<!-- end of dfn.attlist -->]]>
+
+<!ENTITY % em.element "INCLUDE" >
+<![%em.element;[
+<!ENTITY % em.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % em.qname "em" >
+<!ELEMENT %em.qname; %em.content; >
+<!-- end of em.element -->]]>
+
+<!ENTITY % em.attlist "INCLUDE" >
+<![%em.attlist;[
+<!ATTLIST %em.qname;
+ %Common.attrib;
+>
+<!-- end of em.attlist -->]]>
+
+<!ENTITY % kbd.element "INCLUDE" >
+<![%kbd.element;[
+<!ENTITY % kbd.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % kbd.qname "kbd" >
+<!ELEMENT %kbd.qname; %kbd.content; >
+<!-- end of kbd.element -->]]>
+
+<!ENTITY % kbd.attlist "INCLUDE" >
+<![%kbd.attlist;[
+<!ATTLIST %kbd.qname;
+ %Common.attrib;
+>
+<!-- end of kbd.attlist -->]]>
+
+<!ENTITY % q.element "INCLUDE" >
+<![%q.element;[
+<!ENTITY % q.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % q.qname "q" >
+<!ELEMENT %q.qname; %q.content; >
+<!-- end of q.element -->]]>
+
+<!ENTITY % q.attlist "INCLUDE" >
+<![%q.attlist;[
+<!ATTLIST %q.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+>
+<!-- end of q.attlist -->]]>
+
+<!ENTITY % samp.element "INCLUDE" >
+<![%samp.element;[
+<!ENTITY % samp.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % samp.qname "samp" >
+<!ELEMENT %samp.qname; %samp.content; >
+<!-- end of samp.element -->]]>
+
+<!ENTITY % samp.attlist "INCLUDE" >
+<![%samp.attlist;[
+<!ATTLIST %samp.qname;
+ %Common.attrib;
+>
+<!-- end of samp.attlist -->]]>
+
+<!ENTITY % strong.element "INCLUDE" >
+<![%strong.element;[
+<!ENTITY % strong.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % strong.qname "strong" >
+<!ELEMENT %strong.qname; %strong.content; >
+<!-- end of strong.element -->]]>
+
+<!ENTITY % strong.attlist "INCLUDE" >
+<![%strong.attlist;[
+<!ATTLIST %strong.qname;
+ %Common.attrib;
+>
+<!-- end of strong.attlist -->]]>
+
+<!ENTITY % var.element "INCLUDE" >
+<![%var.element;[
+<!ENTITY % var.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % var.qname "var" >
+<!ELEMENT %var.qname; %var.content; >
+<!-- end of var.element -->]]>
+
+<!ENTITY % var.attlist "INCLUDE" >
+<![%var.attlist;[
+<!ATTLIST %var.qname;
+ %Common.attrib;
+>
+<!-- end of var.attlist -->]]>
+
+<!-- end of xhtml-inlphras-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkstruct.module "INCLUDE" >
+<![%xhtml-blkstruct.module;[
+<!ENTITY % xhtml-blkstruct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Structural 1.0//EN"
+ "xhtml-blkstruct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Structural Module ....................................... -->
+<!-- file: xhtml-blkstruct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkstruct-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Structural 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkstruct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Structural
+
+ div, p
+
+ This module declares the elements and their attributes used to
+ support block-level structural markup.
+-->
+
+<!ENTITY % div.element "INCLUDE" >
+<![%div.element;[
+<!ENTITY % div.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ENTITY % div.qname "div" >
+<!ELEMENT %div.qname; %div.content; >
+<!-- end of div.element -->]]>
+
+<!ENTITY % div.attlist "INCLUDE" >
+<![%div.attlist;[
+<!ATTLIST %div.qname;
+ %Common.attrib;
+>
+<!-- end of div.attlist -->]]>
+
+<!ENTITY % p.element "INCLUDE" >
+<![%p.element;[
+<!ENTITY % p.content
+ "( #PCDATA | %Inline.mix; )*" >
+<!ENTITY % p.qname "p" >
+<!ELEMENT %p.qname; %p.content; >
+<!-- end of p.element -->]]>
+
+<!ENTITY % p.attlist "INCLUDE" >
+<![%p.attlist;[
+<!ATTLIST %p.qname;
+ %Common.attrib;
+>
+<!-- end of p.attlist -->]]>
+
+<!-- end of xhtml-blkstruct-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkphras.module "INCLUDE" >
+<![%xhtml-blkphras.module;[
+<!ENTITY % xhtml-blkphras.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN"
+ "xhtml-blkphras-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Phrasal Module .......................................... -->
+<!-- file: xhtml-blkphras-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkphras-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Phrasal 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkphras-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Phrasal
+
+ address, blockquote, pre, h1, h2, h3, h4, h5, h6
+
+ This module declares the elements and their attributes used to
+ support block-level phrasal markup.
+-->
+
+<!ENTITY % address.element "INCLUDE" >
+<![%address.element;[
+<!ENTITY % address.content
+ "( #PCDATA | %Inline.mix; )*" >
+<!ENTITY % address.qname "address" >
+<!ELEMENT %address.qname; %address.content; >
+<!-- end of address.element -->]]>
+
+<!ENTITY % address.attlist "INCLUDE" >
+<![%address.attlist;[
+<!ATTLIST %address.qname;
+ %Common.attrib;
+>
+<!-- end of address.attlist -->]]>
+
+<!ENTITY % blockquote.element "INCLUDE" >
+<![%blockquote.element;[
+<!ENTITY % blockquote.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % blockquote.qname "blockquote" >
+<!ELEMENT %blockquote.qname; %blockquote.content; >
+<!-- end of blockquote.element -->]]>
+
+<!ENTITY % blockquote.attlist "INCLUDE" >
+<![%blockquote.attlist;[
+<!ATTLIST %blockquote.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+>
+<!-- end of blockquote.attlist -->]]>
+
+<!ENTITY % pre.element "INCLUDE" >
+<![%pre.element;[
+<!ENTITY % pre.content
+ "( #PCDATA
+ | %InlStruct.class;
+ %InlPhras.class;
+ | %tt.qname; | %i.qname; | %b.qname;
+ %I18n.class;
+ %Anchor.class;
+ | %script.qname; | %map.qname;
+ %Inline.extra; )*"
+>
+<!ENTITY % pre.qname "pre" >
+<!ELEMENT %pre.qname; %pre.content; >
+<!-- end of pre.element -->]]>
+
+<!ENTITY % pre.attlist "INCLUDE" >
+<![%pre.attlist;[
+<!ATTLIST %pre.qname;
+ %Common.attrib;
+ xml:space ( preserve ) #FIXED 'preserve'
+>
+<!-- end of pre.attlist -->]]>
+
+<!-- ................... Heading Elements ................... -->
+
+<!ENTITY % Heading.content "( #PCDATA | %Inline.mix; )*" >
+
+<!ENTITY % h1.element "INCLUDE" >
+<![%h1.element;[
+<!ENTITY % h1.qname "h1" >
+<!ELEMENT %h1.qname; %Heading.content; >
+<!-- end of h1.element -->]]>
+
+<!ENTITY % h1.attlist "INCLUDE" >
+<![%h1.attlist;[
+<!ATTLIST %h1.qname;
+ %Common.attrib;
+>
+<!-- end of h1.attlist -->]]>
+
+<!ENTITY % h2.element "INCLUDE" >
+<![%h2.element;[
+<!ENTITY % h2.qname "h2" >
+<!ELEMENT %h2.qname; %Heading.content; >
+<!-- end of h2.element -->]]>
+
+<!ENTITY % h2.attlist "INCLUDE" >
+<![%h2.attlist;[
+<!ATTLIST %h2.qname;
+ %Common.attrib;
+>
+<!-- end of h2.attlist -->]]>
+
+<!ENTITY % h3.element "INCLUDE" >
+<![%h3.element;[
+<!ENTITY % h3.qname "h3" >
+<!ELEMENT %h3.qname; %Heading.content; >
+<!-- end of h3.element -->]]>
+
+<!ENTITY % h3.attlist "INCLUDE" >
+<![%h3.attlist;[
+<!ATTLIST %h3.qname;
+ %Common.attrib;
+>
+<!-- end of h3.attlist -->]]>
+
+<!ENTITY % h4.element "INCLUDE" >
+<![%h4.element;[
+<!ENTITY % h4.qname "h4" >
+<!ELEMENT %h4.qname; %Heading.content; >
+<!-- end of h4.element -->]]>
+
+<!ENTITY % h4.attlist "INCLUDE" >
+<![%h4.attlist;[
+<!ATTLIST %h4.qname;
+ %Common.attrib;
+>
+<!-- end of h4.attlist -->]]>
+
+<!ENTITY % h5.element "INCLUDE" >
+<![%h5.element;[
+<!ENTITY % h5.qname "h5" >
+<!ELEMENT %h5.qname; %Heading.content; >
+<!-- end of h5.element -->]]>
+
+<!ENTITY % h5.attlist "INCLUDE" >
+<![%h5.attlist;[
+<!ATTLIST %h5.qname;
+ %Common.attrib;
+>
+<!-- end of h5.attlist -->]]>
+
+<!ENTITY % h6.element "INCLUDE" >
+<![%h6.element;[
+<!ENTITY % h6.qname "h6" >
+<!ELEMENT %h6.qname; %Heading.content; >
+<!-- end of h6.element -->]]>
+
+<!ENTITY % h6.attlist "INCLUDE" >
+<![%h6.attlist;[
+<!ATTLIST %h6.qname;
+ %Common.attrib;
+>
+<!-- end of h6.attlist -->]]>
+
+<!-- end of xhtml-blkphras-1.mod -->
+]]>
+
+<!-- end of xhtml-text-1.mod -->
+]]>
+
+<!-- Hypertext Module (required) ................................. -->
+<!ENTITY % xhtml-hypertext.module "INCLUDE" >
+<![%xhtml-hypertext.module;[
+<!ENTITY % xhtml-hypertext.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-hypertext-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Hypertext Module .............................................. -->
+<!-- file: xhtml-hypertext-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-hypertext-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-hypertext-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Hypertext
+
+ a
+
+ This module declares the anchor ('a') element type, which
+ defines the source of a hypertext link. The destination
+ (or link 'target') is identified via its 'id' attribute
+ rather than the 'name' attribute as was used in HTML.
+-->
+
+<!-- ............ Anchor Element ............ -->
+
+<!ENTITY % a.element "INCLUDE" >
+<![%a.element;[
+<!ENTITY % a.content
+ "( #PCDATA | %InlNoAnchor.mix; )*"
+>
+<!ENTITY % a.qname "a" >
+<!ELEMENT %a.qname; %a.content; >
+<!-- end of a.element -->]]>
+
+<!ENTITY % a.attlist "INCLUDE" >
+<![%a.attlist;[
+<!ATTLIST %a.qname;
+ %Common.attrib;
+ href %URI.datatype; #IMPLIED
+ charset %Charset.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ hreflang %LanguageCode.datatype; #IMPLIED
+ rel %LinkTypes.datatype; #IMPLIED
+ rev %LinkTypes.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of a.attlist -->]]>
+
+<!-- end of xhtml-hypertext-1.mod -->
+]]>
+
+<!-- Lists Module (required) .................................... -->
+<!ENTITY % xhtml-list.module "INCLUDE" >
+<![%xhtml-list.module;[
+<!ENTITY % xhtml-list.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-list-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Lists Module .................................................. -->
+<!-- file: xhtml-list-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-list-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-list-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Lists
+
+ dl, dt, dd, ol, ul, li
+
+ This module declares the list-oriented element types
+ and their attributes.
+-->
+
+<!ENTITY % dl.qname "dl" >
+<!ENTITY % dt.qname "dt" >
+<!ENTITY % dd.qname "dd" >
+<!ENTITY % ol.qname "ol" >
+<!ENTITY % ul.qname "ul" >
+<!ENTITY % li.qname "li" >
+
+<!-- dl: Definition List ............................... -->
+
+<!ENTITY % dl.element "INCLUDE" >
+<![%dl.element;[
+<!ENTITY % dl.content "( %dt.qname; | %dd.qname; )+" >
+<!ELEMENT %dl.qname; %dl.content; >
+<!-- end of dl.element -->]]>
+
+<!ENTITY % dl.attlist "INCLUDE" >
+<![%dl.attlist;[
+<!ATTLIST %dl.qname;
+ %Common.attrib;
+>
+<!-- end of dl.attlist -->]]>
+
+<!-- dt: Definition Term ............................... -->
+
+<!ENTITY % dt.element "INCLUDE" >
+<![%dt.element;[
+<!ENTITY % dt.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %dt.qname; %dt.content; >
+<!-- end of dt.element -->]]>
+
+<!ENTITY % dt.attlist "INCLUDE" >
+<![%dt.attlist;[
+<!ATTLIST %dt.qname;
+ %Common.attrib;
+>
+<!-- end of dt.attlist -->]]>
+
+<!-- dd: Definition Description ........................ -->
+
+<!ENTITY % dd.element "INCLUDE" >
+<![%dd.element;[
+<!ENTITY % dd.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %dd.qname; %dd.content; >
+<!-- end of dd.element -->]]>
+
+<!ENTITY % dd.attlist "INCLUDE" >
+<![%dd.attlist;[
+<!ATTLIST %dd.qname;
+ %Common.attrib;
+>
+<!-- end of dd.attlist -->]]>
+
+<!-- ol: Ordered List (numbered styles) ................ -->
+
+<!ENTITY % ol.element "INCLUDE" >
+<![%ol.element;[
+<!ENTITY % ol.content "( %li.qname; )+" >
+<!ELEMENT %ol.qname; %ol.content; >
+<!-- end of ol.element -->]]>
+
+<!ENTITY % ol.attlist "INCLUDE" >
+<![%ol.attlist;[
+<!ATTLIST %ol.qname;
+ %Common.attrib;
+>
+<!-- end of ol.attlist -->]]>
+
+<!-- ul: Unordered List (bullet styles) ................ -->
+
+<!ENTITY % ul.element "INCLUDE" >
+<![%ul.element;[
+<!ENTITY % ul.content "( %li.qname; )+" >
+<!ELEMENT %ul.qname; %ul.content; >
+<!-- end of ul.element -->]]>
+
+<!ENTITY % ul.attlist "INCLUDE" >
+<![%ul.attlist;[
+<!ATTLIST %ul.qname;
+ %Common.attrib;
+>
+<!-- end of ul.attlist -->]]>
+
+<!-- li: List Item ..................................... -->
+
+<!ENTITY % li.element "INCLUDE" >
+<![%li.element;[
+<!ENTITY % li.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %li.qname; %li.content; >
+<!-- end of li.element -->]]>
+
+<!ENTITY % li.attlist "INCLUDE" >
+<![%li.attlist;[
+<!ATTLIST %li.qname;
+ %Common.attrib;
+>
+<!-- end of li.attlist -->]]>
+
+<!-- end of xhtml-list-1.mod -->
+]]>
+
+<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+
+<!-- Edit Module ................................................ -->
+<!ENTITY % xhtml-edit.module "INCLUDE" >
+<![%xhtml-edit.module;[
+<!ENTITY % xhtml-edit.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Editing Elements 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-edit-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Editing Elements Module ....................................... -->
+<!-- file: xhtml-edit-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-edit-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Editing Markup 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-edit-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Editing Elements
+
+ ins, del
+
+ This module declares element types and attributes used to indicate
+ inserted and deleted content while editing a document.
+-->
+
+<!-- ins: Inserted Text ............................... -->
+
+<!ENTITY % ins.element "INCLUDE" >
+<![%ins.element;[
+<!ENTITY % ins.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ENTITY % ins.qname "ins" >
+<!ELEMENT %ins.qname; %ins.content; >
+<!-- end of ins.element -->]]>
+
+<!ENTITY % ins.attlist "INCLUDE" >
+<![%ins.attlist;[
+<!ATTLIST %ins.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+ datetime %Datetime.datatype; #IMPLIED
+>
+<!-- end of ins.attlist -->]]>
+
+<!-- del: Deleted Text ................................ -->
+
+<!ENTITY % del.element "INCLUDE" >
+<![%del.element;[
+<!ENTITY % del.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ENTITY % del.qname "del" >
+<!ELEMENT %del.qname; %del.content; >
+<!-- end of del.element -->]]>
+
+<!ENTITY % del.attlist "INCLUDE" >
+<![%del.attlist;[
+<!ATTLIST %del.qname;
+ %Common.attrib;
+ cite %URI.datatype; #IMPLIED
+ datetime %Datetime.datatype; #IMPLIED
+>
+<!-- end of del.attlist -->]]>
+
+<!-- end of xhtml-edit-1.mod -->
+]]>
+
+<!-- BIDI Override Module ....................................... -->
+<!ENTITY % xhtml-bdo.module "%XHTML.bidi;" >
+<![%xhtml-bdo.module;[
+<!ENTITY % xhtml-bdo.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML BIDI Override Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-bdo-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML BDO Element Module ............................................. -->
+<!-- file: xhtml-bdo-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-bdo-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML BDO Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-bdo-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Bidirectional Override (bdo) Element
+
+ This modules declares the element 'bdo', used to override the
+ Unicode bidirectional algorithm for selected fragments of text.
+
+ DEPENDENCIES:
+ Relies on the conditional section keyword %XHTML.bidi; declared
+ as "INCLUDE". Bidirectional text support includes both the bdo
+ element and the 'dir' attribute.
+-->
+
+<!ENTITY % bdo.element "INCLUDE" >
+<![%bdo.element;[
+<!ENTITY % bdo.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % bdo.qname "bdo" >
+<!ELEMENT %bdo.qname; %bdo.content; >
+<!-- end of bdo.element -->]]>
+
+<!ENTITY % bdo.attlist "INCLUDE" >
+<![%bdo.attlist;[
+<!ATTLIST %bdo.qname;
+ %Core.attrib;
+ xml:lang %LanguageCode.datatype; #IMPLIED
+ dir ( ltr | rtl ) #REQUIRED
+>
+]]>
+
+<!-- end of xhtml-bdo-1.mod -->
+]]>
+
+<!-- Ruby Module ................................................ -->
+<!ENTITY % Ruby.common.attlists "INCLUDE" >
+<!ENTITY % Ruby.common.attrib "%Common.attrib;" >
+<!ENTITY % xhtml-ruby.module "INCLUDE" >
+<![%xhtml-ruby.module;[
+<!ENTITY % xhtml-ruby.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Ruby 1.0//EN"
+ "http://www.w3.org/TR/ruby/xhtml-ruby-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Ruby Module .................................................... -->
+<!-- file: xhtml-ruby-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1999-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-ruby-1.mod,v 4.0 2001/04/03 23:14:33 altheim Exp $
+
+ This module is based on the W3C Ruby Annotation Specification:
+
+ http://www.w3.org/TR/ruby
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Ruby 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/ruby/xhtml-ruby-1.mod"
+
+ ...................................................................... -->
+
+<!-- Ruby Elements
+
+ ruby, rbc, rtc, rb, rt, rp
+
+ This module declares the elements and their attributes used to
+ support ruby annotation markup.
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % ruby.qname "ruby" >
+<!ENTITY % rbc.qname "rbc" >
+<!ENTITY % rtc.qname "rtc" >
+<!ENTITY % rb.qname "rb" >
+<!ENTITY % rt.qname "rt" >
+<!ENTITY % rp.qname "rp" >
+
+<!-- rp fallback is included by default.
+-->
+<!ENTITY % Ruby.fallback "INCLUDE" >
+<!ENTITY % Ruby.fallback.mandatory "IGNORE" >
+
+<!-- Complex ruby is included by default; it may be
+ overridden by other modules to ignore it.
+-->
+<!ENTITY % Ruby.complex "INCLUDE" >
+
+<!-- Fragments for the content model of the ruby element -->
+<![%Ruby.fallback;[
+<![%Ruby.fallback.mandatory;[
+<!ENTITY % Ruby.content.simple
+ "( %rb.qname;, %rp.qname;, %rt.qname;, %rp.qname; )"
+>
+]]>
+<!ENTITY % Ruby.content.simple
+ "( %rb.qname;, ( %rt.qname; | ( %rp.qname;, %rt.qname;, %rp.qname; ) ) )"
+>
+]]>
+<!ENTITY % Ruby.content.simple "( %rb.qname;, %rt.qname; )" >
+
+<![%Ruby.complex;[
+<!ENTITY % Ruby.content.complex
+ "| ( %rbc.qname;, %rtc.qname;, %rtc.qname;? )"
+>
+]]>
+<!ENTITY % Ruby.content.complex "" >
+
+<!-- Content models of the rb and the rt elements are intended to
+ allow other inline-level elements of its parent markup language,
+ but it should not include ruby descendent elements. The following
+ parameter entity %NoRuby.content; can be used to redefine
+ those content models with minimum effort. It's defined as
+ '( #PCDATA )' by default.
+-->
+<!ENTITY % NoRuby.content "( #PCDATA )" >
+
+<!-- one or more digits (NUMBER) -->
+<!ENTITY % Number.datatype "CDATA" >
+
+<!-- ruby element ...................................... -->
+
+<!ENTITY % ruby.element "INCLUDE" >
+<![%ruby.element;[
+<!ENTITY % ruby.content
+ "( %Ruby.content.simple; %Ruby.content.complex; )"
+>
+<!ELEMENT %ruby.qname; %ruby.content; >
+<!-- end of ruby.element -->]]>
+
+<![%Ruby.complex;[
+<!-- rbc (ruby base component) element ................. -->
+
+<!ENTITY % rbc.element "INCLUDE" >
+<![%rbc.element;[
+<!ENTITY % rbc.content
+ "(%rb.qname;)+"
+>
+<!ELEMENT %rbc.qname; %rbc.content; >
+<!-- end of rbc.element -->]]>
+
+<!-- rtc (ruby text component) element ................. -->
+
+<!ENTITY % rtc.element "INCLUDE" >
+<![%rtc.element;[
+<!ENTITY % rtc.content
+ "(%rt.qname;)+"
+>
+<!ELEMENT %rtc.qname; %rtc.content; >
+<!-- end of rtc.element -->]]>
+]]>
+
+<!-- rb (ruby base) element ............................ -->
+
+<!ENTITY % rb.element "INCLUDE" >
+<![%rb.element;[
+<!-- %rb.content; uses %NoRuby.content; as its content model,
+ which is '( #PCDATA )' by default. It may be overridden
+ by other modules to allow other inline-level elements
+ of its parent markup language, but it should not include
+ ruby descendent elements.
+-->
+<!ENTITY % rb.content "%NoRuby.content;" >
+<!ELEMENT %rb.qname; %rb.content; >
+<!-- end of rb.element -->]]>
+
+<!-- rt (ruby text) element ............................ -->
+
+<!ENTITY % rt.element "INCLUDE" >
+<![%rt.element;[
+<!-- %rt.content; uses %NoRuby.content; as its content model,
+ which is '( #PCDATA )' by default. It may be overridden
+ by other modules to allow other inline-level elements
+ of its parent markup language, but it should not include
+ ruby descendent elements.
+-->
+<!ENTITY % rt.content "%NoRuby.content;" >
+
+<!ELEMENT %rt.qname; %rt.content; >
+<!-- end of rt.element -->]]>
+
+<!-- rbspan attribute is used for complex ruby only ...... -->
+<![%Ruby.complex;[
+<!ENTITY % rt.attlist "INCLUDE" >
+<![%rt.attlist;[
+<!ATTLIST %rt.qname;
+ rbspan %Number.datatype; "1"
+>
+<!-- end of rt.attlist -->]]>
+]]>
+
+<!-- rp (ruby parenthesis) element ..................... -->
+
+<![%Ruby.fallback;[
+<!ENTITY % rp.element "INCLUDE" >
+<![%rp.element;[
+<!ENTITY % rp.content
+ "( #PCDATA )"
+>
+<!ELEMENT %rp.qname; %rp.content; >
+<!-- end of rp.element -->]]>
+]]>
+
+<!-- Ruby Common Attributes
+
+ The following optional ATTLIST declarations provide an easy way
+ to define common attributes for ruby elements. These declarations
+ are ignored by default.
+
+ Ruby elements are intended to have common attributes of its
+ parent markup language. For example, if a markup language defines
+ common attributes as a parameter entity %attrs;, you may add
+ those attributes by just declaring the following parameter entities
+
+ <!ENTITY % Ruby.common.attlists "INCLUDE" >
+ <!ENTITY % Ruby.common.attrib "%attrs;" >
+
+ before including the Ruby module.
+-->
+
+<!ENTITY % Ruby.common.attlists "IGNORE" >
+<![%Ruby.common.attlists;[
+<!ENTITY % Ruby.common.attrib "" >
+
+<!-- common attributes for ruby ........................ -->
+
+<!ENTITY % Ruby.common.attlist "INCLUDE" >
+<![%Ruby.common.attlist;[
+<!ATTLIST %ruby.qname;
+ %Ruby.common.attrib;
+>
+<!-- end of Ruby.common.attlist -->]]>
+
+<![%Ruby.complex;[
+<!-- common attributes for rbc ......................... -->
+
+<!ENTITY % Rbc.common.attlist "INCLUDE" >
+<![%Rbc.common.attlist;[
+<!ATTLIST %rbc.qname;
+ %Ruby.common.attrib;
+>
+<!-- end of Rbc.common.attlist -->]]>
+
+<!-- common attributes for rtc ......................... -->
+
+<!ENTITY % Rtc.common.attlist "INCLUDE" >
+<![%Rtc.common.attlist;[
+<!ATTLIST %rtc.qname;
+ %Ruby.common.attrib;
+>
+<!-- end of Rtc.common.attlist -->]]>
+]]>
+
+<!-- common attributes for rb .......................... -->
+
+<!ENTITY % Rb.common.attlist "INCLUDE" >
+<![%Rb.common.attlist;[
+<!ATTLIST %rb.qname;
+ %Ruby.common.attrib;
+>
+<!-- end of Rb.common.attlist -->]]>
+
+<!-- common attributes for rt .......................... -->
+
+<!ENTITY % Rt.common.attlist "INCLUDE" >
+<![%Rt.common.attlist;[
+<!ATTLIST %rt.qname;
+ %Ruby.common.attrib;
+>
+<!-- end of Rt.common.attlist -->]]>
+
+<![%Ruby.fallback;[
+<!-- common attributes for rp .......................... -->
+
+<!ENTITY % Rp.common.attlist "INCLUDE" >
+<![%Rp.common.attlist;[
+<!ATTLIST %rp.qname;
+ %Ruby.common.attrib;
+>
+<!-- end of Rp.common.attlist -->]]>
+]]>
+]]>
+
+<!-- end of xhtml-ruby-1.mod -->
+]]>
+
+<!-- Presentation Module ........................................ -->
+<!ENTITY % xhtml-pres.module "INCLUDE" >
+<![%xhtml-pres.module;[
+<!ENTITY % xhtml-pres.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Presentation 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-pres-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Presentation Module ............................................ -->
+<!-- file: xhtml-pres-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-pres-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Presentation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-pres-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Presentational Elements
+
+ This module defines elements and their attributes for
+ simple presentation-related markup.
+-->
+
+<!ENTITY % xhtml-inlpres.module "INCLUDE" >
+<![%xhtml-inlpres.module;[
+<!ENTITY % xhtml-inlpres.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Presentation 1.0//EN"
+ "xhtml-inlpres-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Inline Presentation Module .................................... -->
+<!-- file: xhtml-inlpres-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-inlpres-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Inline Presentation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlpres-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Inline Presentational Elements
+
+ b, big, i, small, sub, sup, tt
+
+ This module declares the elements and their attributes used to
+ support inline-level presentational markup.
+-->
+
+<!ENTITY % b.element "INCLUDE" >
+<![%b.element;[
+<!ENTITY % b.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % b.qname "b" >
+<!ELEMENT %b.qname; %b.content; >
+<!-- end of b.element -->]]>
+
+<!ENTITY % b.attlist "INCLUDE" >
+<![%b.attlist;[
+<!ATTLIST %b.qname;
+ %Common.attrib;
+>
+<!-- end of b.attlist -->]]>
+
+<!ENTITY % big.element "INCLUDE" >
+<![%big.element;[
+<!ENTITY % big.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % big.qname "big" >
+<!ELEMENT %big.qname; %big.content; >
+<!-- end of big.element -->]]>
+
+<!ENTITY % big.attlist "INCLUDE" >
+<![%big.attlist;[
+<!ATTLIST %big.qname;
+ %Common.attrib;
+>
+<!-- end of big.attlist -->]]>
+
+<!ENTITY % i.element "INCLUDE" >
+<![%i.element;[
+<!ENTITY % i.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % i.qname "i" >
+<!ELEMENT %i.qname; %i.content; >
+<!-- end of i.element -->]]>
+
+<!ENTITY % i.attlist "INCLUDE" >
+<![%i.attlist;[
+<!ATTLIST %i.qname;
+ %Common.attrib;
+>
+<!-- end of i.attlist -->]]>
+
+<!ENTITY % small.element "INCLUDE" >
+<![%small.element;[
+<!ENTITY % small.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % small.qname "small" >
+<!ELEMENT %small.qname; %small.content; >
+<!-- end of small.element -->]]>
+
+<!ENTITY % small.attlist "INCLUDE" >
+<![%small.attlist;[
+<!ATTLIST %small.qname;
+ %Common.attrib;
+>
+<!-- end of small.attlist -->]]>
+
+<!ENTITY % sub.element "INCLUDE" >
+<![%sub.element;[
+<!ENTITY % sub.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % sub.qname "sub" >
+<!ELEMENT %sub.qname; %sub.content; >
+<!-- end of sub.element -->]]>
+
+<!ENTITY % sub.attlist "INCLUDE" >
+<![%sub.attlist;[
+<!ATTLIST %sub.qname;
+ %Common.attrib;
+>
+<!-- end of sub.attlist -->]]>
+
+<!ENTITY % sup.element "INCLUDE" >
+<![%sup.element;[
+<!ENTITY % sup.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % sup.qname "sup" >
+<!ELEMENT %sup.qname; %sup.content; >
+<!-- end of sup.element -->]]>
+
+<!ENTITY % sup.attlist "INCLUDE" >
+<![%sup.attlist;[
+<!ATTLIST %sup.qname;
+ %Common.attrib;
+>
+<!-- end of sup.attlist -->]]>
+
+<!ENTITY % tt.element "INCLUDE" >
+<![%tt.element;[
+<!ENTITY % tt.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ENTITY % tt.qname "tt" >
+<!ELEMENT %tt.qname; %tt.content; >
+<!-- end of tt.element -->]]>
+
+<!ENTITY % tt.attlist "INCLUDE" >
+<![%tt.attlist;[
+<!ATTLIST %tt.qname;
+ %Common.attrib;
+>
+<!-- end of tt.attlist -->]]>
+
+<!-- end of xhtml-inlpres-1.mod -->
+]]>
+
+<!ENTITY % xhtml-blkpres.module "INCLUDE" >
+<![%xhtml-blkpres.module;[
+<!ENTITY % xhtml-blkpres.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Presentation 1.0//EN"
+ "xhtml-blkpres-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Block Presentation Module ..................................... -->
+<!-- file: xhtml-blkpres-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-blkpres-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Block Presentation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-blkpres-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Block Presentational Elements
+
+ hr
+
+ This module declares the elements and their attributes used to
+ support block-level presentational markup.
+-->
+
+<!ENTITY % hr.element "INCLUDE" >
+<![%hr.element;[
+<!ENTITY % hr.content "EMPTY" >
+<!ENTITY % hr.qname "hr" >
+<!ELEMENT %hr.qname; %hr.content; >
+<!-- end of hr.element -->]]>
+
+<!ENTITY % hr.attlist "INCLUDE" >
+<![%hr.attlist;[
+<!ATTLIST %hr.qname;
+ %Common.attrib;
+>
+<!-- end of hr.attlist -->]]>
+
+<!-- end of xhtml-blkpres-1.mod -->
+]]>
+
+<!-- end of xhtml-pres-1.mod -->
+]]>
+
+<!-- Link Element Module ........................................ -->
+<!ENTITY % xhtml-link.module "INCLUDE" >
+<![%xhtml-link.module;[
+<!ENTITY % xhtml-link.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-link-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Link Element Module ........................................... -->
+<!-- file: xhtml-link-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-link-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-link-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Link element
+
+ link
+
+ This module declares the link element type and its attributes,
+ which could (in principle) be used to define document-level links
+ to external resources such as:
+
+ a) for document specific toolbars/menus, e.g. start, contents,
+ previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of html nodes are
+ rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a postscript or pdf version (rel="alternate" media="print")
+-->
+
+<!-- link: Media-Independent Link ...................... -->
+
+<!ENTITY % link.element "INCLUDE" >
+<![%link.element;[
+<!ENTITY % link.content "EMPTY" >
+<!ENTITY % link.qname "link" >
+<!ELEMENT %link.qname; %link.content; >
+<!-- end of link.element -->]]>
+
+<!ENTITY % link.attlist "INCLUDE" >
+<![%link.attlist;[
+<!ATTLIST %link.qname;
+ %Common.attrib;
+ charset %Charset.datatype; #IMPLIED
+ href %URI.datatype; #IMPLIED
+ hreflang %LanguageCode.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ rel %LinkTypes.datatype; #IMPLIED
+ rev %LinkTypes.datatype; #IMPLIED
+ media %MediaDesc.datatype; #IMPLIED
+>
+<!-- end of link.attlist -->]]>
+
+<!-- end of xhtml-link-1.mod -->
+]]>
+
+<!-- Document Metainformation Module ............................ -->
+<!ENTITY % xhtml-meta.module "INCLUDE" >
+<![%xhtml-meta.module;[
+<!ENTITY % xhtml-meta.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-meta-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Document Metainformation Module ............................... -->
+<!-- file: xhtml-meta-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-meta-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-meta-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Meta Information
+
+ meta
+
+ This module declares the meta element type and its attributes,
+ used to provide declarative document metainformation.
+-->
+
+<!-- meta: Generic Metainformation ..................... -->
+
+<!ENTITY % meta.element "INCLUDE" >
+<![%meta.element;[
+<!ENTITY % meta.content "EMPTY" >
+<!ENTITY % meta.qname "meta" >
+<!ELEMENT %meta.qname; %meta.content; >
+<!-- end of meta.element -->]]>
+
+<!ENTITY % meta.attlist "INCLUDE" >
+<![%meta.attlist;[
+<!ATTLIST %meta.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+ http-equiv NMTOKEN #IMPLIED
+ name NMTOKEN #IMPLIED
+ content CDATA #REQUIRED
+ scheme CDATA #IMPLIED
+>
+<!-- end of meta.attlist -->]]>
+
+<!-- end of xhtml-meta-1.mod -->
+]]>
+
+<!-- Base Element Module ........................................ -->
+<!ENTITY % xhtml-base.module "INCLUDE" >
+<![%xhtml-base.module;[
+<!ENTITY % xhtml-base.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-base-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Base Element Module ........................................... -->
+<!-- file: xhtml-base-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-base-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-base-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Base element
+
+ base
+
+ This module declares the base element type and its attributes,
+ used to define a base URI against which relative URIs in the
+ document will be resolved.
+
+ Note that this module also redeclares the content model for
+ the head element to include the base element.
+-->
+
+<!-- base: Document Base URI ........................... -->
+
+<!ENTITY % base.element "INCLUDE" >
+<![%base.element;[
+<!ENTITY % base.content "EMPTY" >
+<!ENTITY % base.qname "base" >
+<!ELEMENT %base.qname; %base.content; >
+<!-- end of base.element -->]]>
+
+<!ENTITY % base.attlist "INCLUDE" >
+<![%base.attlist;[
+<!ATTLIST %base.qname;
+ %XHTML.xmlns.attrib;
+ href %URI.datatype; #REQUIRED
+>
+<!-- end of base.attlist -->]]>
+
+<!ENTITY % head.content
+ "( %HeadOpts.mix;,
+ ( ( %title.qname;, %HeadOpts.mix;, ( %base.qname;, %HeadOpts.mix; )? )
+ | ( %base.qname;, %HeadOpts.mix;, ( %title.qname;, %HeadOpts.mix; ))))"
+>
+
+<!-- end of xhtml-base-1.mod -->
+]]>
+
+<!-- Scripting Module ........................................... -->
+<!ENTITY % xhtml-script.module "INCLUDE" >
+<![%xhtml-script.module;[
+<!ENTITY % xhtml-script.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Scripting 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-script-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Document Scripting Module ..................................... -->
+<!-- file: xhtml-script-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-script-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Scripting 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-script-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Scripting
+
+ script, noscript
+
+ This module declares element types and attributes used to provide
+ support for executable scripts as well as an alternate content
+ container where scripts are not supported.
+-->
+
+<!-- script: Scripting Statement ....................... -->
+
+<!ENTITY % script.element "INCLUDE" >
+<![%script.element;[
+<!ENTITY % script.content "( #PCDATA )" >
+<!ENTITY % script.qname "script" >
+<!ELEMENT %script.qname; %script.content; >
+<!-- end of script.element -->]]>
+
+<!ENTITY % script.attlist "INCLUDE" >
+<![%script.attlist;[
+<!ATTLIST %script.qname;
+ %XHTML.xmlns.attrib;
+ charset %Charset.datatype; #IMPLIED
+ type %ContentType.datatype; #REQUIRED
+ src %URI.datatype; #IMPLIED
+ defer ( defer ) #IMPLIED
+ xml:space ( preserve ) #FIXED 'preserve'
+>
+<!-- end of script.attlist -->]]>
+
+<!-- noscript: No-Script Alternate Content ............. -->
+
+<!ENTITY % noscript.element "INCLUDE" >
+<![%noscript.element;[
+<!ENTITY % noscript.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % noscript.qname "noscript" >
+<!ELEMENT %noscript.qname; %noscript.content; >
+<!-- end of noscript.element -->]]>
+
+<!ENTITY % noscript.attlist "INCLUDE" >
+<![%noscript.attlist;[
+<!ATTLIST %noscript.qname;
+ %Common.attrib;
+>
+<!-- end of noscript.attlist -->]]>
+
+<!-- end of xhtml-script-1.mod -->
+]]>
+
+<!-- Style Sheets Module ......................................... -->
+<!ENTITY % xhtml-style.module "INCLUDE" >
+<![%xhtml-style.module;[
+<!ENTITY % xhtml-style.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Style Sheets 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-style-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Document Style Sheet Module .................................... -->
+<!-- file: xhtml-style-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-style-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML Style Sheets 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-style-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Style Sheets
+
+ style
+
+ This module declares the style element type and its attributes,
+ used to embed stylesheet information in the document head element.
+-->
+
+<!-- style: Style Sheet Information ..................... -->
+
+<!ENTITY % style.element "INCLUDE" >
+<![%style.element;[
+<!ENTITY % style.content "( #PCDATA )" >
+<!ENTITY % style.qname "style" >
+<!ELEMENT %style.qname; %style.content; >
+<!-- end of style.element -->]]>
+
+<!ENTITY % style.attlist "INCLUDE" >
+<![%style.attlist;[
+<!ATTLIST %style.qname;
+ %XHTML.xmlns.attrib;
+ %title.attrib;
+ %I18n.attrib;
+ type %ContentType.datatype; #REQUIRED
+ media %MediaDesc.datatype; #IMPLIED
+ xml:space ( preserve ) #FIXED 'preserve'
+>
+<!-- end of style.attlist -->]]>
+
+<!-- end of xhtml-style-1.mod -->
+]]>
+
+<!-- Image Module ............................................... -->
+<!ENTITY % xhtml-image.module "INCLUDE" >
+<![%xhtml-image.module;[
+<!ENTITY % xhtml-image.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-image-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Images Module ................................................. -->
+<!-- file: xhtml-image-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Rovision: $Id: xhtml-image-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-image-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Images
+
+ img
+
+ This module provides markup to support basic image embedding.
+-->
+
+<!-- To avoid problems with text-only UAs as well as to make
+ image content understandable and navigable to users of
+ non-visual UAs, you need to provide a description with
+ the 'alt' attribute, and avoid server-side image maps.
+-->
+
+<!ENTITY % img.element "INCLUDE" >
+<![%img.element;[
+<!ENTITY % img.content "EMPTY" >
+<!ENTITY % img.qname "img" >
+<!ELEMENT %img.qname; %img.content; >
+<!-- end of img.element -->]]>
+
+<!ENTITY % img.attlist "INCLUDE" >
+<![%img.attlist;[
+<!ATTLIST %img.qname;
+ %Common.attrib;
+ src %URI.datatype; #REQUIRED
+ alt %Text.datatype; #REQUIRED
+ longdesc %URI.datatype; #IMPLIED
+ height %Length.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+>
+<!-- end of img.attlist -->]]>
+
+<!-- end of xhtml-image-1.mod -->
+]]>
+
+<!-- Client-side Image Map Module ............................... -->
+<!ENTITY % xhtml-csismap.module "INCLUDE" >
+<![%xhtml-csismap.module;[
+<!ENTITY % xhtml-csismap.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Client-side Image Maps 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-csismap-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Client-side Image Map Module .................................. -->
+<!-- file: xhtml-csismap-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-csismap-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Client-side Image Maps 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-csismap-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Client-side Image Maps
+
+ area, map
+
+ This module declares elements and attributes to support client-side
+ image maps. This requires that the Image Module (or a module
+ declaring the img element type) be included in the DTD.
+
+ These can be placed in the same document or grouped in a
+ separate document, although the latter isn't widely supported
+-->
+
+<!ENTITY % area.element "INCLUDE" >
+<![%area.element;[
+<!ENTITY % area.content "EMPTY" >
+<!ENTITY % area.qname "area" >
+<!ELEMENT %area.qname; %area.content; >
+<!-- end of area.element -->]]>
+
+<!ENTITY % Shape.datatype "( rect | circle | poly | default )">
+<!ENTITY % Coords.datatype "CDATA" >
+
+<!ENTITY % area.attlist "INCLUDE" >
+<![%area.attlist;[
+<!ATTLIST %area.qname;
+ %Common.attrib;
+ href %URI.datatype; #IMPLIED
+ shape %Shape.datatype; 'rect'
+ coords %Coords.datatype; #IMPLIED
+ nohref ( nohref ) #IMPLIED
+ alt %Text.datatype; #REQUIRED
+ tabindex %Number.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of area.attlist -->]]>
+
+<!-- modify anchor attribute definition list
+ to allow for client-side image maps
+-->
+<!ATTLIST %a.qname;
+ shape %Shape.datatype; 'rect'
+ coords %Coords.datatype; #IMPLIED
+>
+
+<!-- modify img attribute definition list
+ to allow for client-side image maps
+-->
+<!ATTLIST %img.qname;
+ usemap IDREF #IMPLIED
+>
+
+<!-- modify form input attribute definition list
+ to allow for client-side image maps
+-->
+<!ATTLIST %input.qname;
+ usemap IDREF #IMPLIED
+>
+
+<!-- modify object attribute definition list
+ to allow for client-side image maps
+-->
+<!ATTLIST %object.qname;
+ usemap IDREF #IMPLIED
+>
+
+<!-- 'usemap' points to the 'id' attribute of a <map> element,
+ which must be in the same document; support for external
+ document maps was not widely supported in HTML and is
+ eliminated in XHTML.
+
+ It is considered an error for the element pointed to by
+ a usemap IDREF to occur in anything but a <map> element.
+-->
+
+<!ENTITY % map.element "INCLUDE" >
+<![%map.element;[
+<!ENTITY % map.content
+ "(( %Block.mix; ) | %area.qname; )+"
+>
+<!ENTITY % map.qname "map" >
+<!ELEMENT %map.qname; %map.content; >
+<!-- end of map.element -->]]>
+
+<!ENTITY % map.attlist "INCLUDE" >
+<![%map.attlist;[
+<!ATTLIST %map.qname;
+ %XHTML.xmlns.attrib;
+ id ID #REQUIRED
+ %class.attrib;
+ %title.attrib;
+ %Core.extra.attrib;
+ %I18n.attrib;
+ %Events.attrib;
+>
+<!-- end of map.attlist -->]]>
+
+<!-- end of xhtml-csismap-1.mod -->
+]]>
+
+<!-- Server-side Image Map Module ............................... -->
+<!ENTITY % xhtml-ssismap.module "INCLUDE" >
+<![%xhtml-ssismap.module;[
+<!ENTITY % xhtml-ssismap.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Server-side Image Maps 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-ssismap-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Server-side Image Map Module .................................. -->
+<!-- file: xhtml-ssismap-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-ssismap-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Server-side Image Maps 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-ssismap-1.mod"
+
+ Revisions:
+#2000-10-22: added declaration for 'ismap' on <input>
+ ....................................................................... -->
+
+<!-- Server-side Image Maps
+
+ This adds the 'ismap' attribute to the img and input elements
+ to support server-side processing of a user selection.
+-->
+
+<!ATTLIST %img.qname;
+ ismap ( ismap ) #IMPLIED
+>
+
+<!ATTLIST %input.qname;
+ ismap ( ismap ) #IMPLIED
+>
+
+<!-- end of xhtml-ssismap-1.mod -->
+]]>
+
+<!-- Param Element Module ....................................... -->
+<!ENTITY % xhtml-param.module "INCLUDE" >
+<![%xhtml-param.module;[
+<!ENTITY % xhtml-param.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-param-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Param Element Module ..................................... -->
+<!-- file: xhtml-param-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-param-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-param-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Parameters for Java Applets and Embedded Objects
+
+ param
+
+ This module provides declarations for the param element,
+ used to provide named property values for the applet
+ and object elements.
+-->
+
+<!-- param: Named Property Value ....................... -->
+
+<!ENTITY % param.element "INCLUDE" >
+<![%param.element;[
+<!ENTITY % param.content "EMPTY" >
+<!ENTITY % param.qname "param" >
+<!ELEMENT %param.qname; %param.content; >
+<!-- end of param.element -->]]>
+
+<!ENTITY % param.attlist "INCLUDE" >
+<![%param.attlist;[
+<!ATTLIST %param.qname;
+ %XHTML.xmlns.attrib;
+ %id.attrib;
+ name CDATA #REQUIRED
+ value CDATA #IMPLIED
+ valuetype ( data | ref | object ) 'data'
+ type %ContentType.datatype; #IMPLIED
+>
+<!-- end of param.attlist -->]]>
+
+<!-- end of xhtml-param-1.mod -->
+]]>
+
+<!-- Embedded Object Module ..................................... -->
+<!ENTITY % xhtml-object.module "INCLUDE" >
+<![%xhtml-object.module;[
+<!ENTITY % xhtml-object.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-object-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Embedded Object Module ........................................ -->
+<!-- file: xhtml-object-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-object-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-object-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Embedded Objects
+
+ object
+
+ This module declares the object element type and its attributes, used
+ to embed external objects as part of XHTML pages. In the document,
+ place param elements prior to other content within the object element.
+
+ Note that use of this module requires instantiation of the Param
+ Element Module.
+-->
+
+<!-- object: Generic Embedded Object ................... -->
+
+<!ENTITY % object.element "INCLUDE" >
+<![%object.element;[
+<!ENTITY % object.content
+ "( #PCDATA | %Flow.mix; | %param.qname; )*"
+>
+<!ENTITY % object.qname "object" >
+<!ELEMENT %object.qname; %object.content; >
+<!-- end of object.element -->]]>
+
+<!ENTITY % object.attlist "INCLUDE" >
+<![%object.attlist;[
+<!ATTLIST %object.qname;
+ %Common.attrib;
+ declare ( declare ) #IMPLIED
+ classid %URI.datatype; #IMPLIED
+ codebase %URI.datatype; #IMPLIED
+ data %URI.datatype; #IMPLIED
+ type %ContentType.datatype; #IMPLIED
+ codetype %ContentType.datatype; #IMPLIED
+ archive %URIs.datatype; #IMPLIED
+ standby %Text.datatype; #IMPLIED
+ height %Length.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+ name CDATA #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of object.attlist -->]]>
+
+<!-- end of xhtml-object-1.mod -->
+]]>
+
+<!-- Tables Module ............................................... -->
+<!ENTITY % xhtml-table.module "INCLUDE" >
+<![%xhtml-table.module;[
+<!ENTITY % xhtml-table.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Tables 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-table-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Table Module .................................................. -->
+<!-- file: xhtml-table-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-table-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Tables 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-table-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Tables
+
+ table, caption, thead, tfoot, tbody, colgroup, col, tr, th, td
+
+ This module declares element types and attributes used to provide
+ table markup similar to HTML 4.0, including features that enable
+ better accessibility for non-visual user agents.
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % table.qname "table" >
+<!ENTITY % caption.qname "caption" >
+<!ENTITY % thead.qname "thead" >
+<!ENTITY % tfoot.qname "tfoot" >
+<!ENTITY % tbody.qname "tbody" >
+<!ENTITY % colgroup.qname "colgroup" >
+<!ENTITY % col.qname "col" >
+<!ENTITY % tr.qname "tr" >
+<!ENTITY % th.qname "th" >
+<!ENTITY % td.qname "td" >
+
+<!-- The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % frame.attrib
+ "frame ( void
+ | above
+ | below
+ | hsides
+ | lhs
+ | rhs
+ | vsides
+ | box
+ | border ) #IMPLIED"
+>
+
+<!-- The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+
+ "none" if border is absent or border="0" otherwise "all"
+-->
+<!ENTITY % rules.attrib
+ "rules ( none
+ | groups
+ | rows
+ | cols
+ | all ) #IMPLIED"
+>
+
+<!-- horizontal alignment attributes for cell contents
+-->
+<!ENTITY % CellHAlign.attrib
+ "align ( left
+ | center
+ | right
+ | justify
+ | char ) #IMPLIED
+ char %Character.datatype; #IMPLIED
+ charoff %Length.datatype; #IMPLIED"
+>
+
+<!-- vertical alignment attribute for cell contents
+-->
+<!ENTITY % CellVAlign.attrib
+ "valign ( top
+ | middle
+ | bottom
+ | baseline ) #IMPLIED"
+>
+
+<!-- scope is simpler than axes attribute for common tables
+-->
+<!ENTITY % scope.attrib
+ "scope ( row
+ | col
+ | rowgroup
+ | colgroup ) #IMPLIED"
+>
+
+<!-- table: Table Element .............................. -->
+
+<!ENTITY % table.element "INCLUDE" >
+<![%table.element;[
+<!ENTITY % table.content
+ "( %caption.qname;?, ( %col.qname;* | %colgroup.qname;* ),
+ (( %thead.qname;?, %tfoot.qname;?, %tbody.qname;+ ) | ( %tr.qname;+ )))"
+>
+<!ELEMENT %table.qname; %table.content; >
+<!-- end of table.element -->]]>
+
+<!ENTITY % table.attlist "INCLUDE" >
+<![%table.attlist;[
+<!ATTLIST %table.qname;
+ %Common.attrib;
+ summary %Text.datatype; #IMPLIED
+ width %Length.datatype; #IMPLIED
+ border %Pixels.datatype; #IMPLIED
+ %frame.attrib;
+ %rules.attrib;
+ cellspacing %Length.datatype; #IMPLIED
+ cellpadding %Length.datatype; #IMPLIED
+>
+<!-- end of table.attlist -->]]>
+
+<!-- caption: Table Caption ............................ -->
+
+<!ENTITY % caption.element "INCLUDE" >
+<![%caption.element;[
+<!ENTITY % caption.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %caption.qname; %caption.content; >
+<!-- end of caption.element -->]]>
+
+<!ENTITY % caption.attlist "INCLUDE" >
+<![%caption.attlist;[
+<!ATTLIST %caption.qname;
+ %Common.attrib;
+>
+<!-- end of caption.attlist -->]]>
+
+<!-- thead: Table Header ............................... -->
+
+<!-- Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+-->
+
+<!ENTITY % thead.element "INCLUDE" >
+<![%thead.element;[
+<!ENTITY % thead.content "( %tr.qname; )+" >
+<!ELEMENT %thead.qname; %thead.content; >
+<!-- end of thead.element -->]]>
+
+<!ENTITY % thead.attlist "INCLUDE" >
+<![%thead.attlist;[
+<!ATTLIST %thead.qname;
+ %Common.attrib;
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of thead.attlist -->]]>
+
+<!-- tfoot: Table Footer ............................... -->
+
+<!-- Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+-->
+
+<!ENTITY % tfoot.element "INCLUDE" >
+<![%tfoot.element;[
+<!ENTITY % tfoot.content "( %tr.qname; )+" >
+<!ELEMENT %tfoot.qname; %tfoot.content; >
+<!-- end of tfoot.element -->]]>
+
+<!ENTITY % tfoot.attlist "INCLUDE" >
+<![%tfoot.attlist;[
+<!ATTLIST %tfoot.qname;
+ %Common.attrib;
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of tfoot.attlist -->]]>
+
+<!-- tbody: Table Body ................................. -->
+
+<!-- Use multiple tbody sections when rules are needed
+ between groups of table rows.
+-->
+
+<!ENTITY % tbody.element "INCLUDE" >
+<![%tbody.element;[
+<!ENTITY % tbody.content "( %tr.qname; )+" >
+<!ELEMENT %tbody.qname; %tbody.content; >
+<!-- end of tbody.element -->]]>
+
+<!ENTITY % tbody.attlist "INCLUDE" >
+<![%tbody.attlist;[
+<!ATTLIST %tbody.qname;
+ %Common.attrib;
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of tbody.attlist -->]]>
+
+<!-- colgroup: Table Column Group ...................... -->
+
+<!-- colgroup groups a set of col elements. It allows you
+ to group several semantically-related columns together.
+-->
+
+<!ENTITY % colgroup.element "INCLUDE" >
+<![%colgroup.element;[
+<!ENTITY % colgroup.content "( %col.qname; )*" >
+<!ELEMENT %colgroup.qname; %colgroup.content; >
+<!-- end of colgroup.element -->]]>
+
+<!ENTITY % colgroup.attlist "INCLUDE" >
+<![%colgroup.attlist;[
+<!ATTLIST %colgroup.qname;
+ %Common.attrib;
+ span %Number.datatype; '1'
+ width %MultiLength.datatype; #IMPLIED
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of colgroup.attlist -->]]>
+
+<!-- col: Table Column ................................. -->
+
+<!-- col elements define the alignment properties for
+ cells in one or more columns.
+
+ The width attribute specifies the width of the
+ columns, e.g.
+
+ width="64" width in screen pixels
+ width="0.5*" relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+
+<!ENTITY % col.element "INCLUDE" >
+<![%col.element;[
+<!ENTITY % col.content "EMPTY" >
+<!ELEMENT %col.qname; %col.content; >
+<!-- end of col.element -->]]>
+
+<!ENTITY % col.attlist "INCLUDE" >
+<![%col.attlist;[
+<!ATTLIST %col.qname;
+ %Common.attrib;
+ span %Number.datatype; '1'
+ width %MultiLength.datatype; #IMPLIED
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of col.attlist -->]]>
+
+<!-- tr: Table Row ..................................... -->
+
+<!ENTITY % tr.element "INCLUDE" >
+<![%tr.element;[
+<!ENTITY % tr.content "( %th.qname; | %td.qname; )+" >
+<!ELEMENT %tr.qname; %tr.content; >
+<!-- end of tr.element -->]]>
+
+<!ENTITY % tr.attlist "INCLUDE" >
+<![%tr.attlist;[
+<!ATTLIST %tr.qname;
+ %Common.attrib;
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of tr.attlist -->]]>
+
+<!-- th: Table Header Cell ............................. -->
+
+<!-- th is for header cells, td for data,
+ but for cells acting as both use td
+-->
+
+<!ENTITY % th.element "INCLUDE" >
+<![%th.element;[
+<!ENTITY % th.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %th.qname; %th.content; >
+<!-- end of th.element -->]]>
+
+<!ENTITY % th.attlist "INCLUDE" >
+<![%th.attlist;[
+<!ATTLIST %th.qname;
+ %Common.attrib;
+ abbr %Text.datatype; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ %scope.attrib;
+ rowspan %Number.datatype; '1'
+ colspan %Number.datatype; '1'
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of th.attlist -->]]>
+
+<!-- td: Table Data Cell ............................... -->
+
+<!ENTITY % td.element "INCLUDE" >
+<![%td.element;[
+<!ENTITY % td.content
+ "( #PCDATA | %Flow.mix; )*"
+>
+<!ELEMENT %td.qname; %td.content; >
+<!-- end of td.element -->]]>
+
+<!ENTITY % td.attlist "INCLUDE" >
+<![%td.attlist;[
+<!ATTLIST %td.qname;
+ %Common.attrib;
+ abbr %Text.datatype; #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ %scope.attrib;
+ rowspan %Number.datatype; '1'
+ colspan %Number.datatype; '1'
+ %CellHAlign.attrib;
+ %CellVAlign.attrib;
+>
+<!-- end of td.attlist -->]]>
+
+<!-- end of xhtml-table-1.mod -->
+]]>
+
+<!-- Forms Module ............................................... -->
+<!ENTITY % xhtml-form.module "INCLUDE" >
+<![%xhtml-form.module;[
+<!ENTITY % xhtml-form.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Forms 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-form-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Forms Module .................................................. -->
+<!-- file: xhtml-form-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-form-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Forms 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-form-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Forms
+
+ form, label, input, select, optgroup, option,
+ textarea, fieldset, legend, button
+
+ This module declares markup to provide support for online
+ forms, based on the features found in HTML 4.0 forms.
+-->
+
+<!-- declare qualified element type names:
+-->
+<!ENTITY % form.qname "form" >
+<!ENTITY % label.qname "label" >
+<!ENTITY % input.qname "input" >
+<!ENTITY % select.qname "select" >
+<!ENTITY % optgroup.qname "optgroup" >
+<!ENTITY % option.qname "option" >
+<!ENTITY % textarea.qname "textarea" >
+<!ENTITY % fieldset.qname "fieldset" >
+<!ENTITY % legend.qname "legend" >
+<!ENTITY % button.qname "button" >
+
+<!-- %BlkNoForm.mix; includes all non-form block elements,
+ plus %Misc.class;
+-->
+<!ENTITY % BlkNoForm.mix
+ "%Heading.class;
+ | %List.class;
+ | %BlkStruct.class;
+ %BlkPhras.class;
+ %BlkPres.class;
+ %Table.class;
+ %Block.extra;
+ %Misc.class;"
+>
+
+<!-- form: Form Element ................................ -->
+
+<!ENTITY % form.element "INCLUDE" >
+<![%form.element;[
+<!ENTITY % form.content
+ "( %BlkNoForm.mix;
+ | %fieldset.qname; )+"
+>
+<!ELEMENT %form.qname; %form.content; >
+<!-- end of form.element -->]]>
+
+<!ENTITY % form.attlist "INCLUDE" >
+<![%form.attlist;[
+<!ATTLIST %form.qname;
+ %Common.attrib;
+ action %URI.datatype; #REQUIRED
+ method ( get | post ) 'get'
+ enctype %ContentType.datatype; 'application/x-www-form-urlencoded'
+ accept-charset %Charsets.datatype; #IMPLIED
+ accept %ContentTypes.datatype; #IMPLIED
+>
+<!-- end of form.attlist -->]]>
+
+<!-- label: Form Field Label Text ...................... -->
+
+<!-- Each label must not contain more than ONE field
+-->
+
+<!ENTITY % label.element "INCLUDE" >
+<![%label.element;[
+<!ENTITY % label.content
+ "( #PCDATA
+ | %input.qname; | %select.qname; | %textarea.qname; | %button.qname;
+ | %InlStruct.class;
+ %InlPhras.class;
+ %I18n.class;
+ %InlPres.class;
+ %Anchor.class;
+ %InlSpecial.class;
+ %Inline.extra;
+ %Misc.class; )*"
+>
+<!ELEMENT %label.qname; %label.content; >
+<!-- end of label.element -->]]>
+
+<!ENTITY % label.attlist "INCLUDE" >
+<![%label.attlist;[
+<!ATTLIST %label.qname;
+ %Common.attrib;
+ for IDREF #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of label.attlist -->]]>
+
+<!-- input: Form Control ............................... -->
+
+<!ENTITY % input.element "INCLUDE" >
+<![%input.element;[
+<!ENTITY % input.content "EMPTY" >
+<!ELEMENT %input.qname; %input.content; >
+<!-- end of input.element -->]]>
+
+<!ENTITY % input.attlist "INCLUDE" >
+<![%input.attlist;[
+<!ENTITY % InputType.class
+ "( text | password | checkbox | radio | submit
+ | reset | file | hidden | image | button )"
+>
+<!-- attribute 'name' required for all but submit & reset
+-->
+<!ATTLIST %input.qname;
+ %Common.attrib;
+ type %InputType.class; 'text'
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ checked ( checked ) #IMPLIED
+ disabled ( disabled ) #IMPLIED
+ readonly ( readonly ) #IMPLIED
+ size %Number.datatype; #IMPLIED
+ maxlength %Number.datatype; #IMPLIED
+ src %URI.datatype; #IMPLIED
+ alt %Text.datatype; #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+ accept %ContentTypes.datatype; #IMPLIED
+>
+<!-- end of input.attlist -->]]>
+
+<!-- select: Option Selector ........................... -->
+
+<!ENTITY % select.element "INCLUDE" >
+<![%select.element;[
+<!ENTITY % select.content
+ "( %optgroup.qname; | %option.qname; )+"
+>
+<!ELEMENT %select.qname; %select.content; >
+<!-- end of select.element -->]]>
+
+<!ENTITY % select.attlist "INCLUDE" >
+<![%select.attlist;[
+<!ATTLIST %select.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ size %Number.datatype; #IMPLIED
+ multiple ( multiple ) #IMPLIED
+ disabled ( disabled ) #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+>
+<!-- end of select.attlist -->]]>
+
+<!-- optgroup: Option Group ............................ -->
+
+<!ENTITY % optgroup.element "INCLUDE" >
+<![%optgroup.element;[
+<!ENTITY % optgroup.content "( %option.qname; )+" >
+<!ELEMENT %optgroup.qname; %optgroup.content; >
+<!-- end of optgroup.element -->]]>
+
+<!ENTITY % optgroup.attlist "INCLUDE" >
+<![%optgroup.attlist;[
+<!ATTLIST %optgroup.qname;
+ %Common.attrib;
+ disabled ( disabled ) #IMPLIED
+ label %Text.datatype; #REQUIRED
+>
+<!-- end of optgroup.attlist -->]]>
+
+<!-- option: Selectable Choice ......................... -->
+
+<!ENTITY % option.element "INCLUDE" >
+<![%option.element;[
+<!ENTITY % option.content "( #PCDATA )" >
+<!ELEMENT %option.qname; %option.content; >
+<!-- end of option.element -->]]>
+
+<!ENTITY % option.attlist "INCLUDE" >
+<![%option.attlist;[
+<!ATTLIST %option.qname;
+ %Common.attrib;
+ selected ( selected ) #IMPLIED
+ disabled ( disabled ) #IMPLIED
+ label %Text.datatype; #IMPLIED
+ value CDATA #IMPLIED
+>
+<!-- end of option.attlist -->]]>
+
+<!-- textarea: Multi-Line Text Field ................... -->
+
+<!ENTITY % textarea.element "INCLUDE" >
+<![%textarea.element;[
+<!ENTITY % textarea.content "( #PCDATA )" >
+<!ELEMENT %textarea.qname; %textarea.content; >
+<!-- end of textarea.element -->]]>
+
+<!ENTITY % textarea.attlist "INCLUDE" >
+<![%textarea.attlist;[
+<!ATTLIST %textarea.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ rows %Number.datatype; #REQUIRED
+ cols %Number.datatype; #REQUIRED
+ disabled ( disabled ) #IMPLIED
+ readonly ( readonly ) #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of textarea.attlist -->]]>
+
+<!-- fieldset: Form Control Group ...................... -->
+
+<!-- #PCDATA is to solve the mixed content problem,
+ per specification only whitespace is allowed
+-->
+
+<!ENTITY % fieldset.element "INCLUDE" >
+<![%fieldset.element;[
+<!ENTITY % fieldset.content
+ "( #PCDATA | %legend.qname; | %Flow.mix; )*"
+>
+<!ELEMENT %fieldset.qname; %fieldset.content; >
+<!-- end of fieldset.element -->]]>
+
+<!ENTITY % fieldset.attlist "INCLUDE" >
+<![%fieldset.attlist;[
+<!ATTLIST %fieldset.qname;
+ %Common.attrib;
+>
+<!-- end of fieldset.attlist -->]]>
+
+<!-- legend: Fieldset Legend ........................... -->
+
+<!ENTITY % legend.element "INCLUDE" >
+<![%legend.element;[
+<!ENTITY % legend.content
+ "( #PCDATA | %Inline.mix; )*"
+>
+<!ELEMENT %legend.qname; %legend.content; >
+<!-- end of legend.element -->]]>
+
+<!ENTITY % legend.attlist "INCLUDE" >
+<![%legend.attlist;[
+<!ATTLIST %legend.qname;
+ %Common.attrib;
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of legend.attlist -->]]>
+
+<!-- button: Push Button ............................... -->
+
+<!ENTITY % button.element "INCLUDE" >
+<![%button.element;[
+<!ENTITY % button.content
+ "( #PCDATA
+ | %BlkNoForm.mix;
+ | %InlStruct.class;
+ %InlPhras.class;
+ %InlPres.class;
+ %I18n.class;
+ %InlSpecial.class;
+ %Inline.extra; )*"
+>
+<!ELEMENT %button.qname; %button.content; >
+<!-- end of button.element -->]]>
+
+<!ENTITY % button.attlist "INCLUDE" >
+<![%button.attlist;[
+<!ATTLIST %button.qname;
+ %Common.attrib;
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED
+ type ( button | submit | reset ) 'submit'
+ disabled ( disabled ) #IMPLIED
+ tabindex %Number.datatype; #IMPLIED
+ accesskey %Character.datatype; #IMPLIED
+>
+<!-- end of button.attlist -->]]>
+
+<!-- end of xhtml-form-1.mod -->
+]]>
+
+<!-- Legacy Markup ............................................... -->
+<!ENTITY % xhtml-legacy.module "IGNORE" >
+<![%xhtml-legacy.module;[
+<!ENTITY % xhtml-legacy.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Legacy Markup 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-legacy-1.mod" >
+%xhtml-legacy.mod;]]>
+
+<!-- Document Structure Module (required) ....................... -->
+<!ENTITY % xhtml-struct.module "INCLUDE" >
+<![%xhtml-struct.module;[
+<!ENTITY % xhtml-struct.mod
+ PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
+ "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-struct-1.mod" >
+<!-- ...................................................................... -->
+<!-- XHTML Structure Module .............................................. -->
+<!-- file: xhtml-struct-1.mod
+
+ This is XHTML, a reformulation of HTML as a modular XML application.
+ Copyright 1998-2001 W3C (MIT, INRIA, Keio), All Rights Reserved.
+ Revision: $Id: xhtml-struct-1.mod,v 4.0 2001/04/02 22:42:49 altheim Exp $ SMI
+
+ This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-struct-1.mod"
+
+ Revisions:
+ (none)
+ ....................................................................... -->
+
+<!-- Document Structure
+
+ title, head, body, html
+
+ The Structure Module defines the major structural elements and
+ their attributes.
+
+ Note that the content model of the head element type is redeclared
+ when the Base Module is included in the DTD.
+
+ The parameter entity containing the XML namespace URI value used
+ for XHTML is '%XHTML.xmlns;', defined in the Qualified Names module.
+-->
+
+<!-- title: Document Title ............................. -->
+
+<!-- The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+-->
+
+<!ENTITY % title.element "INCLUDE" >
+<![%title.element;[
+<!ENTITY % title.content "( #PCDATA )" >
+<!ENTITY % title.qname "title" >
+<!ELEMENT %title.qname; %title.content; >
+<!-- end of title.element -->]]>
+
+<!ENTITY % title.attlist "INCLUDE" >
+<![%title.attlist;[
+<!ATTLIST %title.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+>
+<!-- end of title.attlist -->]]>
+
+<!-- head: Document Head ............................... -->
+
+<!ENTITY % head.element "INCLUDE" >
+<![%head.element;[
+<!ENTITY % head.content
+ "( %HeadOpts.mix;, %title.qname;, %HeadOpts.mix; )"
+>
+<!ENTITY % head.qname "head" >
+<!ELEMENT %head.qname; %head.content; >
+<!-- end of head.element -->]]>
+
+<!ENTITY % head.attlist "INCLUDE" >
+<![%head.attlist;[
+<!-- reserved for future use with document profiles
+-->
+<!ENTITY % profile.attrib
+ "profile %URI.datatype; '%XHTML.profile;'"
+>
+
+<!ATTLIST %head.qname;
+ %XHTML.xmlns.attrib;
+ %I18n.attrib;
+ %profile.attrib;
+>
+<!-- end of head.attlist -->]]>
+
+<!-- body: Document Body ............................... -->
+
+<!ENTITY % body.element "INCLUDE" >
+<![%body.element;[
+<!ENTITY % body.content
+ "( %Block.mix; )+"
+>
+<!ENTITY % body.qname "body" >
+<!ELEMENT %body.qname; %body.content; >
+<!-- end of body.element -->]]>
+
+<!ENTITY % body.attlist "INCLUDE" >
+<![%body.attlist;[
+<!ATTLIST %body.qname;
+ %Common.attrib;
+>
+<!-- end of body.attlist -->]]>
+
+<!-- html: XHTML Document Element ...................... -->
+
+<!ENTITY % html.element "INCLUDE" >
+<![%html.element;[
+<!ENTITY % html.content "( %head.qname;, %body.qname; )" >
+<!ENTITY % html.qname "html" >
+<!ELEMENT %html.qname; %html.content; >
+<!-- end of html.element -->]]>
+
+<!ENTITY % html.attlist "INCLUDE" >
+<![%html.attlist;[
+<!-- version attribute value defined in driver
+-->
+<!ENTITY % XHTML.version.attrib
+ "version %FPI.datatype; #FIXED '%XHTML.version;'"
+>
+
+<!-- see the Qualified Names module for information
+ on how to extend XHTML using XML namespaces
+-->
+<!ATTLIST %html.qname;
+ %XHTML.xmlns.attrib;
+ %XHTML.version.attrib;
+ %I18n.attrib;
+>
+<!-- end of html.attlist -->]]>
+
+<!-- end of xhtml-struct-1.mod -->
+]]>
+
+<!-- end of XHTML 1.1 DTD ................................................. -->
+<!-- ....................................................................... -->
diff --git a/bundles/org.eclipse.wst.html.core/plugin.properties b/bundles/org.eclipse.wst.html.core/plugin.properties
new file mode 100644
index 0000000000..a7b7ef7f16
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Structured_Source_HTML_Model.name=Structured Source HTML Model
+Structured_Source_HTML_Model_NL_Support.name=Structured Source HTML Model NL Support
diff --git a/bundles/org.eclipse.wst.html.core/plugin.xml b/bundles/org.eclipse.wst.html.core/plugin.xml
new file mode 100644
index 0000000000..967fbc43f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/plugin.xml
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.wst.html.core"
+ name="%Structured_Source_HTML_Model.name"
+ version="1.0.0"
+ provider-name="IBM"
+ class="org.eclipse.wst.html.core.HTMLCorePlugin">
+
+ <runtime>
+ <library name="htmlmodel.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.core.runtime.compatibility"/>
+ <import plugin="org.eclipse.wst.css.core"/>
+ <import plugin="org.eclipse.wst.sse.ui"/>
+ <import plugin="org.eclipse.wst.sse.core"/>
+ <import plugin="org.eclipse.wst.common.contentmodel"/>
+ <import plugin="org.eclipse.wst.xml.core"/>
+ <import plugin="org.eclipse.wst.xml.uriresolver"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.wst.common.encoding"/>
+ </requires>
+
+
+ <extension
+ point="org.eclipse.wst.sse.core.modelHandler">
+ <modelHandler
+ default="no"
+ class="org.eclipse.wst.html.core.modelhandler.ModelHandlerForHTML"
+ associatedContentTypeId="org.eclipse.wst.html.core.htmlsource"
+ id="org.eclipse.wst.html.core.modelhandler">
+ </modelHandler>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.core.embeddedTypeHandler">
+ <embeddedTypeHandler
+ class="org.eclipse.wst.html.core.modelhandler.EmbeddedHTML">
+ </embeddedTypeHandler>
+ </extension>
+ <extension
+ id="org.eclipse.wst.sse.html.core.builderdelegate.todo"
+ point="org.eclipse.wst.sse.core.builderdelegate">
+ <participant
+ class="org.eclipse.wst.sse.core.xml.builder.delegates.XMLTaskTagSeeker"
+ contentType="org.eclipse.wst.html.core.htmlsource">
+ </participant>
+ </extension>
+ <extension point="org.eclipse.core.filebuffers.documentCreation"
+ id="org.eclipse.wst.html.core.documentfactories"
+ name="Structured HTML Document Factory">
+ <factory
+ contentTypeId="org.eclipse.wst.html.core.htmlsource"
+ class="org.eclipse.wst.sse.core.filebuffers.BasicStructuredDocumentFactory:org.eclipse.wst.html.core.htmlsource"/>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.core.commentElementHandler">
+ <handler-custom
+ commenttype="xml"
+ class="org.eclipse.wst.html.core.commentelement.handlers.CommentElementHandlerForSSI">
+ <startwith
+ prefix="#">
+ </startwith>
+ </handler-custom>
+ </extension>
+ <extension
+ point="org.eclipse.team.core.fileTypes">
+ <fileTypes
+ type="text"
+ extension="html">
+ </fileTypes>
+ <fileTypes
+ type="text"
+ extension="htm">
+ </fileTypes>
+ <fileTypes
+ type="text"
+ extension="xhtml">
+ </fileTypes>
+ <fileTypes
+ type="text"
+ extension="htpl">
+ </fileTypes>
+ <fileTypes
+ type="text"
+ extension="wml">
+ </fileTypes>
+ <fileTypes
+ type="text"
+ extension="shtml">
+ </fileTypes>
+ <fileTypes
+ type="text"
+ extension="shtm">
+ </fileTypes>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.core.formatProcessors">
+ <processor
+ class="org.eclipse.wst.html.core.format.HTMLFormatProcessorImpl"
+ contentTypeId="org.eclipse.wst.html.core.htmlsource">
+ </processor>
+ </extension>
+<!-- Extension point for taghelp documentation -->
+ <extension
+ point="org.eclipse.wst.common.contentmodel.annotationFiles">
+ <annotationFile
+ location="data/htmref.xml"
+ publicId="-//W3C//DTD XHTML 1.0 Strict//EN">
+ </annotationFile>
+ <annotationFile
+ location="data/htmref.xml"
+ publicId="-//W3C//DTD XHTML 1.0 Transitional//EN">
+ </annotationFile>
+ <annotationFile
+ location="data/htmref.xml"
+ publicId="-//W3C//DTD XHTML 1.0 Frameset//EN">
+ </annotationFile>
+ <annotationFile
+ location="data/htmref.xml"
+ publicId="-//W3C//DTD XHTML Basic 1.0//EN">
+ </annotationFile>
+ <annotationFile
+ location="data/htmref.xml"
+ publicId="-//W3C//DTD XHTML 1.1//EN">
+ </annotationFile>
+ <annotationFile
+ location="data/htmref.xml"
+ publicId="-//WAPFORUM//DTD XHTML Mobile 1.0//EN">
+ </annotationFile>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.contentTypes">
+ <content-type
+ file-extensions="html,htm,xhtml,htpl,wml,shtml,shtm"
+ priority="high"
+ name="HTML Content Type"
+ id="htmlsource"
+ base-type="org.eclipse.core.runtime.text">
+ <!-- note: no default-charset for HTML, should use 'platform' -->
+ <describer class="org.eclipse.wst.html.core.internal.contenttype.ContentDescriberForHTML"/>
+ </content-type>
+ </extension>
+
+
+<!--==========================================-->
+<!-- DTD Contributions -->
+<!-- Register known J2EE DTDs for XML editor -->
+<!--==========================================-->
+ <extension
+ point="org.eclipse.wst.xml.uriresolver.catalogContributor">
+ <catalogContributor
+ catalogId="default">
+ <!--
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
+ uri="dtds/web-app_2_2.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ uri="dtds/web-app_2_3.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN"
+ uri="dtds/application-client_1_2.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN"
+ uri="dtds/application-client_1_3.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN"
+ uri="dtds/application_1_2.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+ uri="dtds/application_1_3.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
+ uri="dtds/ejb-jar_1_1.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ uri="dtds/ejb-jar_2_0.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD Connector 1.0//EN"
+ uri="dtds/connector_1_0.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
+ uri="dtds/web-jsptaglibrary_1_1.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ uri="dtds/web-jsptaglibrary_1_2.dtd">
+ </mappingInfo>
+ -->
+
+ <mappingInfo
+ key="-//WAPFORUM//DTD WML 1.1//EN"
+ uri="dtds/wml11.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//W3C//DTD XHTML 1.0 Strict//EN"
+ type="PUBLIC"
+ uri="dtds/xhtml1-strict.dtd"
+ webURL="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ type="PUBLIC"
+ uri="dtds/xhtml1-transitional.dtd"
+ webURL="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//W3C//DTD XHTML 1.0 Frameset//EN"
+ type="PUBLIC"
+ uri="dtds/xhtml1-frameset.dtd"
+ webURL="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//W3C//DTD XHTML Basic 1.0//EN"
+ type="PUBLIC"
+ uri="dtds/xhtml-basic10-f.dtd"
+ webURL="http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
+ </mappingInfo>
+ <mappingInfo
+ key="-//W3C//DTD XHTML 1.1//EN"
+ type="PUBLIC"
+ uri="dtds/xhtml11-flat.dtd"
+ webURL="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+ </mappingInfo>
+
+ <mappingInfo
+ key="-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
+ type="PUBLIC"
+ uri="dtds/xhtml-mobile10-flat.dtd"
+ webURL="http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
+ </mappingInfo>
+
+ <mappingInfo
+ key="-//WAPFORUM//DTD WML 1.3//EN"
+ type="PUBLIC"
+ uri="dtds/wml13.dtd"
+ webURL="http://www.wapforum.org/DTD/wml13.dtd">
+ </mappingInfo>
+ </catalogContributor>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.core.documentTypes">
+ <documentType
+ elementName="html"
+ displayName="XHTML 1.0 Strict"
+ namespaceURI="http://www.w3.org/1999/xhtml"
+ isXHTML="true"
+ hasFrameset="false"
+ publicID="-//W3C//DTD XHTML 1.0 Strict//EN"
+ systemID="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ </documentType>
+ <documentType
+ elementName="html"
+ displayName="XHTML 1.0 Transitional"
+ namespaceURI="http://www.w3.org/1999/xhtml"
+ isXHTML="true"
+ hasFrameset="false"
+ publicID="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ defaultXHTML="true"
+ systemID="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ </documentType>
+ <documentType
+ elementName="html"
+ displayName="XHTML 1.0 Frameset"
+ namespaceURI="http://www.w3.org/1999/xhtml"
+ isXHTML="true"
+ hasFrameset="true"
+ publicID="-//W3C//DTD XHTML 1.0 Frameset//EN"
+ systemID="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+ </documentType>
+ <documentType
+ elementName="html"
+ displayName="XHTML Basic 1.0"
+ namespaceURI="http://www.w3.org/1999/xhtml"
+ isXHTML="true"
+ hasFrameset="false"
+ publicID="-//W3C//DTD XHTML Basic 1.0//EN"
+ systemID="http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
+ </documentType>
+ <documentType
+ elementName="html"
+ displayName="XHTML 1.1"
+ namespaceURI="http://www.w3.org/1999/xhtml"
+ isXHTML="true"
+ hasFrameset="false"
+ publicID="-//W3C//DTD XHTML 1.1//EN"
+ systemID="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+ </documentType>
+ <documentType
+ elementName="html"
+ displayName="XHTML MP 1.0"
+ namespaceURI="http://www.w3.org/1999/xhtml"
+ isXHTML="true"
+ hasFrameset="false"
+ publicID="-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
+ systemID="http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
+ </documentType>
+ <documentType
+ elementName="wml"
+ displayName="WML 1.3"
+ namespaceURI=""
+ isWML="true"
+ hasFrameset="false"
+ publicID="-//WAPFORUM//DTD WML 1.3//EN"
+ defaultWML="true"
+ systemID="http://www.wapforum.org/DTD/wml13.dtd">
+ </documentType>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.wst.html.core/src/ModelsHTML.properties b/bundles/org.eclipse.wst.html.core/src/ModelsHTML.properties
new file mode 100644
index 0000000000..05eff27e6d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/ModelsHTML.properties
@@ -0,0 +1,40 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+No_error._UI_=No error.
+Undefined_attribute_name_(_ERROR_=IWAK0043E Undefined attribute name ({0}).
+Undefined_attribute_value__ERROR_=IWAK0044E Undefined attribute value ({0}).
+Multiple_values_specified__ERROR_=IWAK0045E Multiple values specified for an attribute ({0}).
+Attribute_name_({0})_uses__ERROR_=IWAK0046E Attribute name ({0}) uses wrong case character.
+Invalid_attribute_name_({0_ERROR_=IWAK0047E Invalid attribute name ({0}).
+Invalid_attribute_({0})._ERROR_=IWAK0048E Invalid attribute ({0}).
+Invalid_location_of_tag_({_ERROR_=IWAK0049E Invalid location of tag ({0}).
+Duplicate_tag_({0})._ERROR_=IWAK0050E Duplicate tag ({0}).
+No_start_tag_(<{0}>)._ERROR_=IWAK0051E No start tag (<{0}>).
+No_end_tag_(</{0}>)._ERROR_=IWAK0052E No end tag (</{0}>).
+End_tag_(</{0}>)_not_neede_ERROR_=IWAK0053E End tag (</{0}>) not needed.
+Unknown_tag_({0})._ERROR_=IWAK0054E Unknown tag ({0}).
+Tag_name_({0})_uses_wrong__ERROR_=IWAK0055E Tag name ({0}) uses wrong case character.
+Invalid_tag_name_({0})._ERROR_=IWAK0056E Invalid tag name ({0}).
+Invalid_JSP_directive_({0}_ERROR_=IWAK0057E Invalid JSP directive ({0}).
+Invalid_text_string_({0})._ERROR_=IWAK0058E Invalid text string ({0}).
+Invalid_character_used_in__ERROR_=IWAK0059E Invalid character used in text string ({0}).
+Unknown_error._ERROR_=IWAK0060E Unknown error.
+Start_tag_(<{0}>)_not_clos_ERROR_=IWAK0061E Start tag (<{0}>) not closed.
+End_tag_(</{0}>)_not_close_ERROR_=IWAK0062E End tag (</{0}>) not closed.
+Tag_({0})_not_closed._ERROR_=IWAK0063E Tag ({0}) not closed.
+Attribute_value_({0})_uses_ERROR_=IWAK0064E Attribute value ({0}) uses wrong case character.
+Comment_not_closed._ERROR_=IWAK0065E Comment not closed.
+DOCTYPE_declaration_not_cl_ERROR_=IWAK0066E DOCTYPE declaration not closed.
+Processing_instruction_not_ERROR_=IWAK0067E Processing instruction not closed.
+CDATA_section_not_closed._ERROR_=IWAK0068E CDATA section not closed.
+# From here, the new messages are added for V5
+_ERROR_Tag_({0})_should_be_an_empty-element_tag_1=IWAK0069E Tag ({0}) should be an empty-element tag.
+_ERROR_Attribute_value_({0})_not_closed._1=IWAK0070E Attribute value ({0}) not closed.
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTML40Namespace.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTML40Namespace.java
new file mode 100644
index 0000000000..9f5485be22
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTML40Namespace.java
@@ -0,0 +1,675 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core;
+
+/**
+ * Provide all names defined in the HTML 4.0? specification.
+ */
+public interface HTML40Namespace {
+
+ // Element names
+ public static interface ElementName {
+ public static final String A = "A"; //$NON-NLS-1$
+ public static final String ABBR = "ABBR"; //$NON-NLS-1$
+ public static final String ACRONYM = "ACRONYM"; //$NON-NLS-1$
+ public static final String ADDRESS = "ADDRESS"; //$NON-NLS-1$
+ public static final String APPLET = "APPLET"; //$NON-NLS-1$
+ public static final String AREA = "AREA"; //$NON-NLS-1$
+ public static final String B = "B"; //$NON-NLS-1$
+ public static final String BASE = "BASE"; //$NON-NLS-1$
+ public static final String BASEFONT = "BASEFONT"; //$NON-NLS-1$
+ public static final String BDO = "BDO"; //$NON-NLS-1$
+ public static final String BGSOUND = "BGSOUND"; // D205513 //$NON-NLS-1$
+ public static final String BIG = "BIG"; //$NON-NLS-1$
+ public static final String BLINK = "BLINK"; //$NON-NLS-1$
+ public static final String BLOCKQUOTE = "BLOCKQUOTE"; //$NON-NLS-1$
+ public static final String BODY = "BODY"; //$NON-NLS-1$
+ public static final String BR = "BR"; //$NON-NLS-1$
+ public static final String BUTTON = "BUTTON"; //$NON-NLS-1$
+ public static final String CAPTION = "CAPTION"; //$NON-NLS-1$
+ public static final String CENTER = "CENTER"; //$NON-NLS-1$
+ public static final String CITE = "CITE"; //$NON-NLS-1$
+ public static final String CODE = "CODE"; //$NON-NLS-1$
+ public static final String COL = "COL"; //$NON-NLS-1$
+ public static final String COLGROUP = "COLGROUP"; //$NON-NLS-1$
+ public static final String DD = "DD"; //$NON-NLS-1$
+ public static final String DEL = "DEL"; //$NON-NLS-1$
+ public static final String DFN = "DFN"; //$NON-NLS-1$
+ public static final String DIR = "DIR"; //$NON-NLS-1$
+ public static final String DIV = "DIV"; //$NON-NLS-1$
+ public static final String DL = "DL"; //$NON-NLS-1$
+ public static final String DT = "DT"; //$NON-NLS-1$
+ public static final String EM = "EM"; //$NON-NLS-1$
+ public static final String EMBED = "EMBED"; //$NON-NLS-1$
+ public static final String FIELDSET = "FIELDSET"; //$NON-NLS-1$
+ public static final String FONT = "FONT"; //$NON-NLS-1$
+ public static final String FORM = "FORM"; //$NON-NLS-1$
+ public static final String FRAME = "FRAME"; //$NON-NLS-1$
+ public static final String FRAMESET = "FRAMESET"; //$NON-NLS-1$
+ public static final String H1 = "H1"; //$NON-NLS-1$
+ public static final String H2 = "H2"; //$NON-NLS-1$
+ public static final String H3 = "H3"; //$NON-NLS-1$
+ public static final String H4 = "H4"; //$NON-NLS-1$
+ public static final String H5 = "H5"; //$NON-NLS-1$
+ public static final String H6 = "H6"; //$NON-NLS-1$
+ public static final String HEAD = "HEAD"; //$NON-NLS-1$
+ public static final String HR = "HR"; //$NON-NLS-1$
+ public static final String HTML = "HTML"; //$NON-NLS-1$
+ public static final String I = "I"; //$NON-NLS-1$
+ public static final String IFRAME = "IFRAME"; //$NON-NLS-1$
+ public static final String IMG = "IMG"; //$NON-NLS-1$
+ public static final String INPUT = "INPUT"; //$NON-NLS-1$
+ public static final String INS = "INS"; //$NON-NLS-1$
+ public static final String ISINDEX = "ISINDEX"; //$NON-NLS-1$
+ public static final String KBD = "KBD"; //$NON-NLS-1$
+ public static final String LABEL = "LABEL"; //$NON-NLS-1$
+ public static final String LEGEND = "LEGEND"; //$NON-NLS-1$
+ public static final String LI = "LI"; //$NON-NLS-1$
+ public static final String LINK = "LINK"; //$NON-NLS-1$
+ public static final String MAP = "MAP"; //$NON-NLS-1$
+ public static final String MENU = "MENU"; //$NON-NLS-1$
+ public static final String META = "META"; //$NON-NLS-1$
+ public static final String NOBR = "NOBR"; // D205513 //$NON-NLS-1$
+ public static final String NOEMBED = "NOEMBED"; //$NON-NLS-1$
+ public static final String NOFRAMES = "NOFRAMES"; //$NON-NLS-1$
+ public static final String NOSCRIPT = "NOSCRIPT"; //$NON-NLS-1$
+ public static final String OBJECT = "OBJECT"; //$NON-NLS-1$
+ public static final String OL = "OL"; //$NON-NLS-1$
+ public static final String OPTGROUP = "OPTGROUP"; //$NON-NLS-1$
+ public static final String OPTION = "OPTION"; //$NON-NLS-1$
+ public static final String P = "P"; //$NON-NLS-1$
+ public static final String PARAM = "PARAM"; //$NON-NLS-1$
+ public static final String PRE = "PRE"; //$NON-NLS-1$
+ public static final String Q = "Q"; //$NON-NLS-1$
+ public static final String S = "S"; //$NON-NLS-1$
+ public static final String SAMP = "SAMP"; //$NON-NLS-1$
+ public static final String SCRIPT = "SCRIPT"; //$NON-NLS-1$
+ public static final String SELECT = "SELECT"; //$NON-NLS-1$
+ public static final String SMALL = "SMALL"; //$NON-NLS-1$
+ public static final String SPAN = "SPAN"; //$NON-NLS-1$
+ public static final String STRIKE = "STRIKE"; //$NON-NLS-1$
+ public static final String STRONG = "STRONG"; //$NON-NLS-1$
+ public static final String STYLE = "STYLE"; //$NON-NLS-1$
+ public static final String SUB = "SUB"; //$NON-NLS-1$
+ public static final String SUP = "SUP"; //$NON-NLS-1$
+ public static final String TABLE = "TABLE"; //$NON-NLS-1$
+ public static final String TBODY = "TBODY"; //$NON-NLS-1$
+ public static final String TD = "TD"; //$NON-NLS-1$
+ public static final String TEXTAREA = "TEXTAREA"; //$NON-NLS-1$
+ public static final String TFOOT = "TFOOT"; //$NON-NLS-1$
+ public static final String TH = "TH"; //$NON-NLS-1$
+ public static final String THEAD = "THEAD"; //$NON-NLS-1$
+ public static final String TITLE = "TITLE"; //$NON-NLS-1$
+ public static final String TR = "TR"; //$NON-NLS-1$
+ public static final String TT = "TT"; //$NON-NLS-1$
+ public static final String U = "U"; //$NON-NLS-1$
+ public static final String UL = "UL"; //$NON-NLS-1$
+ public static final String VAR = "VAR"; //$NON-NLS-1$
+ public static final String WBR = "WBR"; // D205513 //$NON-NLS-1$
+ public static final String MARQUEE = "MARQUEE"; //$NON-NLS-1$
+ public static final String SSI_CONFIG = "SSI:CONFIG"; // D210393 //$NON-NLS-1$
+ public static final String SSI_ECHO = "SSI:ECHO"; //$NON-NLS-1$
+ public static final String SSI_EXEC = "SSI:EXEC"; //$NON-NLS-1$
+ public static final String SSI_FSIZE = "SSI:FSIZE"; //$NON-NLS-1$
+ public static final String SSI_FLASTMOD = "SSI:FLASTMOD"; //$NON-NLS-1$
+ public static final String SSI_INCLUDE = "SSI:INCLUDE"; //$NON-NLS-1$
+ public static final String SSI_PRINTENV = "SSI:PRINTENV"; //$NON-NLS-1$
+ public static final String SSI_SET = "SSI:SET"; //$NON-NLS-1$
+ public static final String WML_WML = "wml"; //$NON-NLS-1$
+ public static final String WML_CARD = "card"; //$NON-NLS-1$
+ public static final String WML_TEMPLATE = "template"; //$NON-NLS-1$
+ public static final String WML_ACCESS = "access"; //$NON-NLS-1$
+ public static final String WML_DO = "do"; //$NON-NLS-1$
+ public static final String WML_ONEVENT = "onevent"; //$NON-NLS-1$
+ public static final String WML_TIMER = "timer"; //$NON-NLS-1$
+ public static final String WML_ANCHOR = "anchor"; //$NON-NLS-1$
+ public static final String WML_PREV = "prev"; //$NON-NLS-1$
+ public static final String WML_REFRESH = "refresh"; //$NON-NLS-1$
+ public static final String WML_GO = "go"; //$NON-NLS-1$
+ public static final String WML_NOOP = "noop"; //$NON-NLS-1$
+ public static final String WML_SETVAR = "setvar"; //$NON-NLS-1$
+ public static final String WML_POSTFIELD = "postfield"; //$NON-NLS-1$
+ }
+
+ // Character Entities
+ public static interface EntityName {
+ public static final String AACUTE_U = "Aacute"; //$NON-NLS-1$
+ public static final String AACUTE_L = "aacute"; //$NON-NLS-1$
+ public static final String ACIRC_U = "Acirc"; //$NON-NLS-1$
+ public static final String ACIRC_L = "acirc"; //$NON-NLS-1$
+ public static final String ACUTE = "acute"; //$NON-NLS-1$
+ public static final String AELIG_U = "AElig"; //$NON-NLS-1$
+ public static final String AELIG_L = "aelig"; //$NON-NLS-1$
+ public static final String AGRAVE_U = "Agrave"; //$NON-NLS-1$
+ public static final String AGRAVE_L = "agrave"; //$NON-NLS-1$
+ public static final String ALEFSYM = "alefsym"; //$NON-NLS-1$
+ public static final String ALPHA_U = "Alpha"; //$NON-NLS-1$
+ public static final String ALPHA_L = "alpha"; //$NON-NLS-1$
+ public static final String AMP = "amp"; //$NON-NLS-1$
+ public static final String AND = "and"; //$NON-NLS-1$
+ public static final String ANG = "ang"; //$NON-NLS-1$
+ public static final String ARING_U = "Aring"; //$NON-NLS-1$
+ public static final String ARING_L = "aring"; //$NON-NLS-1$
+ public static final String ASYMP = "asymp"; //$NON-NLS-1$
+ public static final String ATILDE_U = "Atilde"; //$NON-NLS-1$
+ public static final String ATILDE_L = "atilde"; //$NON-NLS-1$
+ public static final String AUML_U = "Auml"; //$NON-NLS-1$
+ public static final String AUML_L = "auml"; //$NON-NLS-1$
+ public static final String BDQUO = "bdquo"; //$NON-NLS-1$
+ public static final String BETA_U = "Beta"; //$NON-NLS-1$
+ public static final String BETA_L = "beta"; //$NON-NLS-1$
+ public static final String BRVBAR = "brvbar"; //$NON-NLS-1$
+ public static final String BULL = "bull"; //$NON-NLS-1$
+ public static final String CAP = "cap"; //$NON-NLS-1$
+ public static final String CCEDIL_U = "Ccedil"; //$NON-NLS-1$
+ public static final String CCEDIL_L = "ccedil"; //$NON-NLS-1$
+ public static final String CEDIL = "cedil"; //$NON-NLS-1$
+ public static final String CENT = "cent"; //$NON-NLS-1$
+ public static final String CHI_U = "Chi"; //$NON-NLS-1$
+ public static final String CHI_L = "chi"; //$NON-NLS-1$
+ public static final String CIRC = "circ"; //$NON-NLS-1$
+ public static final String CLUBS = "clubs"; //$NON-NLS-1$
+ public static final String CONG = "cong"; //$NON-NLS-1$
+ public static final String COPY = "copy"; //$NON-NLS-1$
+ public static final String CRARR = "crarr"; //$NON-NLS-1$
+ public static final String CUP = "cup"; //$NON-NLS-1$
+ public static final String CURREN = "curren"; //$NON-NLS-1$
+ public static final String DAGGER_U = "Dagger"; //$NON-NLS-1$
+ public static final String DAGGER_L = "dagger"; //$NON-NLS-1$
+ public static final String DARR_U = "dArr"; //$NON-NLS-1$
+ public static final String DARR_L = "darr"; //$NON-NLS-1$
+ public static final String DEG = "deg"; //$NON-NLS-1$
+ public static final String DELTA_U = "Delta"; //$NON-NLS-1$
+ public static final String DELTA_L = "delta"; //$NON-NLS-1$
+ public static final String DIAMS = "diams"; //$NON-NLS-1$
+ public static final String DIVIDE = "divide"; //$NON-NLS-1$
+ public static final String EACUTE_U = "Eacute"; //$NON-NLS-1$
+ public static final String EACUTE_L = "eacute"; //$NON-NLS-1$
+ public static final String ECIRC_U = "Ecirc"; //$NON-NLS-1$
+ public static final String ECIRC_L = "ecirc"; //$NON-NLS-1$
+ public static final String EGRAVE_U = "Egrave"; //$NON-NLS-1$
+ public static final String EGRAVE_L = "egrave"; //$NON-NLS-1$
+ public static final String EMPTY = "empty"; //$NON-NLS-1$
+ public static final String EMSP = "emsp"; //$NON-NLS-1$
+ public static final String ENSP = "ensp"; //$NON-NLS-1$
+ public static final String EPSILON_U = "Epsilon"; //$NON-NLS-1$
+ public static final String EPSILON_L = "epsilon"; //$NON-NLS-1$
+ public static final String EQUIV = "equiv"; //$NON-NLS-1$
+ public static final String ETA_U = "Eta"; //$NON-NLS-1$
+ public static final String ETA_L = "eta"; //$NON-NLS-1$
+ public static final String ETH_U = "ETH"; //$NON-NLS-1$
+ public static final String ETH_L = "eth"; //$NON-NLS-1$
+ public static final String EUML_U = "Euml"; //$NON-NLS-1$
+ public static final String EUML_L = "euml"; //$NON-NLS-1$
+ public static final String EURO = "euro"; //$NON-NLS-1$
+ public static final String EXIST = "exist"; //$NON-NLS-1$
+ public static final String FNOF = "fnof"; //$NON-NLS-1$
+ public static final String FORALL = "forall"; //$NON-NLS-1$
+ public static final String FRAC12 = "frac12"; //$NON-NLS-1$
+ public static final String FRAC14 = "frac14"; //$NON-NLS-1$
+ public static final String FRAC34 = "frac34"; //$NON-NLS-1$
+ public static final String FRASL = "frasl"; //$NON-NLS-1$
+ public static final String GAMMA_U = "Gamma"; //$NON-NLS-1$
+ public static final String GAMMA_L = "gamma"; //$NON-NLS-1$
+ public static final String GE = "ge"; //$NON-NLS-1$
+ public static final String GT = "gt"; //$NON-NLS-1$
+ public static final String HARR_U = "hArr"; //$NON-NLS-1$
+ public static final String HARR_L = "harr"; //$NON-NLS-1$
+ public static final String HEARTS = "hearts"; //$NON-NLS-1$
+ public static final String HELLIP = "hellip"; //$NON-NLS-1$
+ public static final String IACUTE_U = "Iacute"; //$NON-NLS-1$
+ public static final String IACUTE_L = "iacute"; //$NON-NLS-1$
+ public static final String ICIRC_U = "Icirc"; //$NON-NLS-1$
+ public static final String ICIRC_L = "icirc"; //$NON-NLS-1$
+ public static final String IEXCL = "iexcl"; //$NON-NLS-1$
+ public static final String IGRAVE_U = "Igrave"; //$NON-NLS-1$
+ public static final String IGRAVE_L = "igrave"; //$NON-NLS-1$
+ public static final String IMAGE = "image"; //$NON-NLS-1$
+ public static final String INFIN = "infin"; //$NON-NLS-1$
+ public static final String INT = "int"; //$NON-NLS-1$
+ public static final String IOTA_U = "Iota"; //$NON-NLS-1$
+ public static final String IOTA_L = "iota"; //$NON-NLS-1$
+ public static final String IQUEST = "iquest"; //$NON-NLS-1$
+ public static final String ISIN = "isin"; //$NON-NLS-1$
+ public static final String IUML_U = "Iuml"; //$NON-NLS-1$
+ public static final String IUML_L = "iuml"; //$NON-NLS-1$
+ public static final String KAPPA_U = "Kappa"; //$NON-NLS-1$
+ public static final String KAPPA_L = "kappa"; //$NON-NLS-1$
+ public static final String LAMBDA_U = "Lambda"; //$NON-NLS-1$
+ public static final String LAMBDA_L = "lambda"; //$NON-NLS-1$
+ public static final String LANG = "lang"; //$NON-NLS-1$
+ public static final String LAQUO = "laquo"; //$NON-NLS-1$
+ public static final String LARR_U = "lArr"; //$NON-NLS-1$
+ public static final String LARR_L = "larr"; //$NON-NLS-1$
+ public static final String LCEIL = "lceil"; //$NON-NLS-1$
+ public static final String LDQUO = "ldquo"; //$NON-NLS-1$
+ public static final String LE = "le"; //$NON-NLS-1$
+ public static final String LFLOOR = "lfloor"; //$NON-NLS-1$
+ public static final String LOWAST = "lowast"; //$NON-NLS-1$
+ public static final String LOZ = "loz"; //$NON-NLS-1$
+ public static final String LRM = "lrm"; //$NON-NLS-1$
+ public static final String LSAQUO = "lsaquo"; //$NON-NLS-1$
+ public static final String LSQUO = "lsquo"; //$NON-NLS-1$
+ public static final String LT = "lt"; //$NON-NLS-1$
+ public static final String MACR = "macr"; //$NON-NLS-1$
+ public static final String MDASH = "mdash"; //$NON-NLS-1$
+ public static final String MICRO = "micro"; //$NON-NLS-1$
+ public static final String MIDDOT = "middot"; //$NON-NLS-1$
+ public static final String MINUS = "minus"; //$NON-NLS-1$
+ public static final String MU_U = "Mu"; //$NON-NLS-1$
+ public static final String MU_L = "mu"; //$NON-NLS-1$
+ public static final String NABLA = "nabla"; //$NON-NLS-1$
+ public static final String NBSP = "nbsp"; //$NON-NLS-1$
+ public static final String NDASH = "ndash"; //$NON-NLS-1$
+ public static final String NE = "ne"; //$NON-NLS-1$
+ public static final String NI = "ni"; //$NON-NLS-1$
+ public static final String NOT = "not"; //$NON-NLS-1$
+ public static final String NOTIN = "notin"; //$NON-NLS-1$
+ public static final String NSUB = "nsub"; //$NON-NLS-1$
+ public static final String NTILDE_U = "Ntilde"; //$NON-NLS-1$
+ public static final String NTILDE_L = "ntilde"; //$NON-NLS-1$
+ public static final String NU_U = "Nu"; //$NON-NLS-1$
+ public static final String NU_L = "nu"; //$NON-NLS-1$
+ public static final String OACUTE_U = "Oacute"; //$NON-NLS-1$
+ public static final String OACUTE_L = "oacute"; //$NON-NLS-1$
+ public static final String OCIRC_U = "Ocirc"; //$NON-NLS-1$
+ public static final String OCIRC_L = "ocirc"; //$NON-NLS-1$
+ public static final String OELIG_U = "OElig"; //$NON-NLS-1$
+ public static final String OELIG_L = "oelig"; //$NON-NLS-1$
+ public static final String OGRAVE_U = "Ograve"; //$NON-NLS-1$
+ public static final String OGRAVE_L = "ograve"; //$NON-NLS-1$
+ public static final String OLINE = "oline"; //$NON-NLS-1$
+ public static final String OMEGA_U = "Omega"; //$NON-NLS-1$
+ public static final String OMEGA_L = "omega"; //$NON-NLS-1$
+ public static final String OMICRON_U = "Omicron"; //$NON-NLS-1$
+ public static final String OMICRON_L = "omicron"; //$NON-NLS-1$
+ public static final String OPLUS = "oplus"; //$NON-NLS-1$
+ public static final String OR = "or"; //$NON-NLS-1$
+ public static final String ORDF = "ordf"; //$NON-NLS-1$
+ public static final String ORDM = "ordm"; //$NON-NLS-1$
+ public static final String OSLASH_U = "Oslash"; //$NON-NLS-1$
+ public static final String OSLASH_L = "oslash"; //$NON-NLS-1$
+ public static final String OTILDE_U = "Otilde"; //$NON-NLS-1$
+ public static final String OTILDE_L = "otilde"; //$NON-NLS-1$
+ public static final String OTIMES = "otimes"; //$NON-NLS-1$
+ public static final String OUML_U = "Ouml"; //$NON-NLS-1$
+ public static final String OUML_L = "ouml"; //$NON-NLS-1$
+ public static final String PARA = "para"; //$NON-NLS-1$
+ public static final String PART = "part"; //$NON-NLS-1$
+ public static final String PERMIL = "permil"; //$NON-NLS-1$
+ public static final String PERP = "perp"; //$NON-NLS-1$
+ public static final String PHI_U = "Phi"; //$NON-NLS-1$
+ public static final String PHI_L = "phi"; //$NON-NLS-1$
+ public static final String PI_U = "Pi"; //$NON-NLS-1$
+ public static final String PI_L = "pi"; //$NON-NLS-1$
+ public static final String PIV = "piv"; //$NON-NLS-1$
+ public static final String PLUSMN = "plusmn"; //$NON-NLS-1$
+ public static final String POUND = "pound"; //$NON-NLS-1$
+ public static final String PRIME_U = "Prime"; //$NON-NLS-1$
+ public static final String PRIME_L = "prime"; //$NON-NLS-1$
+ public static final String PROD = "prod"; //$NON-NLS-1$
+ public static final String PROP = "prop"; //$NON-NLS-1$
+ public static final String PSI_U = "Psi"; //$NON-NLS-1$
+ public static final String PSI_L = "psi"; //$NON-NLS-1$
+ public static final String QUOT = "quot"; //$NON-NLS-1$
+ public static final String RADIC = "radic"; //$NON-NLS-1$
+ public static final String RANG = "rang"; //$NON-NLS-1$
+ public static final String RAQUO = "raquo"; //$NON-NLS-1$
+ public static final String RARR_U = "rArr"; //$NON-NLS-1$
+ public static final String RARR_L = "rarr"; //$NON-NLS-1$
+ public static final String RCEIL = "rceil"; //$NON-NLS-1$
+ public static final String RDQUO = "rdquo"; //$NON-NLS-1$
+ public static final String REAL = "real"; //$NON-NLS-1$
+ public static final String REG = "reg"; //$NON-NLS-1$
+ public static final String RFLOOR = "rfloor"; //$NON-NLS-1$
+ public static final String RHO_U = "Rho"; //$NON-NLS-1$
+ public static final String RHO_L = "rho"; //$NON-NLS-1$
+ public static final String RLM = "rlm"; //$NON-NLS-1$
+ public static final String RSAQUO = "rsaquo"; //$NON-NLS-1$
+ public static final String RSQUO = "rsquo"; //$NON-NLS-1$
+ public static final String SBQUO = "sbquo"; //$NON-NLS-1$
+ public static final String SCARON_U = "Scaron"; //$NON-NLS-1$
+ public static final String SCARON_L = "scaron"; //$NON-NLS-1$
+ public static final String SDOT = "sdot"; //$NON-NLS-1$
+ public static final String SECT = "sect"; //$NON-NLS-1$
+ public static final String SHY = "shy"; //$NON-NLS-1$
+ public static final String SIGMA_U = "Sigma"; //$NON-NLS-1$
+ public static final String SIGMA_L = "sigma"; //$NON-NLS-1$
+ public static final String SIGMAF = "sigmaf"; //$NON-NLS-1$
+ public static final String SIM = "sim"; //$NON-NLS-1$
+ public static final String SPADES = "spades"; //$NON-NLS-1$
+ public static final String SUB = "sub"; //$NON-NLS-1$
+ public static final String SUBE = "sube"; //$NON-NLS-1$
+ public static final String SUM = "sum"; //$NON-NLS-1$
+ public static final String SUP = "sup"; //$NON-NLS-1$
+ public static final String SUP1 = "sup1"; //$NON-NLS-1$
+ public static final String SUP2 = "sup2"; //$NON-NLS-1$
+ public static final String SUP3 = "sup3"; //$NON-NLS-1$
+ public static final String SUPE = "supe"; //$NON-NLS-1$
+ public static final String SZLIG = "szlig"; //$NON-NLS-1$
+ public static final String TAU_U = "Tau"; //$NON-NLS-1$
+ public static final String TAU_L = "tau"; //$NON-NLS-1$
+ public static final String THERE4 = "there4"; //$NON-NLS-1$
+ public static final String THETA_U = "Theta"; //$NON-NLS-1$
+ public static final String THETA_L = "theta"; //$NON-NLS-1$
+ public static final String THETASYM = "thetasym"; //$NON-NLS-1$
+ public static final String THINSP = "thinsp"; //$NON-NLS-1$
+ public static final String THORN_U = "THORN"; //$NON-NLS-1$
+ public static final String THORN_L = "thorn"; //$NON-NLS-1$
+ public static final String TILDE = "tilde"; //$NON-NLS-1$
+ public static final String TIMES = "times"; //$NON-NLS-1$
+ public static final String TRADE = "trade"; //$NON-NLS-1$
+ public static final String UACUTE_U = "Uacute"; //$NON-NLS-1$
+ public static final String UACUTE_L = "uacute"; //$NON-NLS-1$
+ public static final String UARR_U = "uArr"; //$NON-NLS-1$
+ public static final String UARR_L = "uarr"; //$NON-NLS-1$
+ public static final String UCIRC_U = "Ucirc"; //$NON-NLS-1$
+ public static final String UCIRC_L = "ucirc"; //$NON-NLS-1$
+ public static final String UGRAVE_U = "Ugrave"; //$NON-NLS-1$
+ public static final String UGRAVE_L = "ugrave"; //$NON-NLS-1$
+ public static final String UML = "uml"; //$NON-NLS-1$
+ public static final String UPSIH = "upsih"; //$NON-NLS-1$
+ public static final String UPSILON_U = "Upsilon"; //$NON-NLS-1$
+ public static final String UPSILON_L = "upsilon"; //$NON-NLS-1$
+ public static final String UUML_U = "Uuml"; //$NON-NLS-1$
+ public static final String UUML_L = "uuml"; //$NON-NLS-1$
+ public static final String WEIERP = "weierp"; //$NON-NLS-1$
+ public static final String XI_U = "Xi"; //$NON-NLS-1$
+ public static final String XI_L = "xi"; //$NON-NLS-1$
+ public static final String YACUTE_U = "Yacute"; //$NON-NLS-1$
+ public static final String YACUTE_L = "yacute"; //$NON-NLS-1$
+ public static final String YEN = "yen"; //$NON-NLS-1$
+ public static final String YUML_U = "Yuml"; //$NON-NLS-1$
+ public static final String YUML_L = "yuml"; //$NON-NLS-1$
+ public static final String ZETA_U = "Zeta"; //$NON-NLS-1$
+ public static final String ZETA_L = "zeta"; //$NON-NLS-1$
+ public static final String ZWJ = "zwj"; //$NON-NLS-1$
+ public static final String ZWNJ = "zwnj"; //$NON-NLS-1$
+ }
+
+ public static final String HTML40_URI = "http://www.w3.org/TR/REC-html40/frameset.dtd"; //$NON-NLS-1$
+ public static final String HTML40_TAG_PREFIX = ""; //$NON-NLS-1$
+ // global attribute names
+ public static final String ATTR_NAME_ID = "id"; // %coreattrs; //$NON-NLS-1$
+ public static final String ATTR_NAME_CLASS = "class"; // %coreattrs; //$NON-NLS-1$
+ public static final String ATTR_NAME_STYLE = "style"; // %coreattrs; //$NON-NLS-1$
+ public static final String ATTR_NAME_TITLE = "title"; // %coreattrs; //$NON-NLS-1$
+ public static final String ATTR_NAME_LANG = "lang"; // %i18n; //$NON-NLS-1$
+ public static final String ATTR_NAME_DIR = "dir"; // %i18n; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONCLICK = "onclick"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONDBLCLICK = "ondblclick"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEDOWN = "onmousedown"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEUP = "onmouseup"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEOVER = "onmouseover"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEMOVE = "onmousemove"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONMOUSEOUT = "onmouseout"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONKEYPRESS = "onkeypress"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONKEYDOWN = "onkeydown"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONKEYUP = "onkeyup"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_ONHELP = "onhelp"; // %events; //$NON-NLS-1$
+ public static final String ATTR_NAME_BGCOLOR = "bgcolor"; // %bodycolor;, TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_TEXT = "text"; // %bodycolor; //$NON-NLS-1$
+ public static final String ATTR_NAME_LINK = "link"; // %bodycolor; //$NON-NLS-1$
+ public static final String ATTR_NAME_VLINK = "vlink"; // %bodycolor; //$NON-NLS-1$
+ public static final String ATTR_NAME_ALINK = "alink"; // %bodycolor; //$NON-NLS-1$
+ public static final String ATTR_NAME_VERSION = "version"; // HTML //$NON-NLS-1$
+ public static final String ATTR_NAME_PROFILE = "profile"; // HEAD //$NON-NLS-1$
+ public static final String ATTR_NAME_ONLOAD = "onload"; // BODY //$NON-NLS-1$
+ public static final String ATTR_NAME_ONUNLOAD = "onunload"; // BODY //$NON-NLS-1$
+ public static final String ATTR_NAME_BACKGROUND = "background"; // BODY, TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_SRC = "src"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_ALT = "alt"; // IMG,AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_LONGDESC = "longdesc"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_NAME = "name"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_HEIGHT = "height"; // IMG, TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_WIDTH = "width"; // IMG, TABLE,HR //$NON-NLS-1$
+ public static final String ATTR_NAME_USEMAP = "usemap"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_ISMAP = "ismap"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_ALIGN = "align"; // IMG, TABLE,HR //$NON-NLS-1$
+ public static final String ATTR_NAME_BORDER = "border"; // IMG, TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_HSPACE = "hspace"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_VSPACE = "vspace"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_MAPFILE = "mapfile"; // IMG //$NON-NLS-1$
+ public static final String ATTR_NAME_SUMMARY = "summary"; // TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_FRAME = "frame"; // TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_RULES = "rules"; // TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_CELLSPACING = "cellspacing"; // TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_CELLPADDING = "cellpadding"; // TABLE //$NON-NLS-1$
+ public static final String ATTR_NAME_DATAPAGESIZE = "datapagesize"; // TABLE,HR //$NON-NLS-1$
+ public static final String ATTR_NAME_COLOR = "color"; // BASEFONT,FONT //$NON-NLS-1$
+ public static final String ATTR_NAME_FACE = "face"; // BASEFONT,FONT //$NON-NLS-1$
+ public static final String ATTR_NAME_SIZE = "size"; // BASEFONT,FONT //$NON-NLS-1$
+ public static final String ATTR_NAME_CLEAR = "clear"; // BR //$NON-NLS-1$
+ public static final String ATTR_NAME_SHAPE = "shape"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_COORDS = "coords"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_HREF = "href"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_TARGET = "target"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_NOHREF = "nohref"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_TABINDEX = "tabindex"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_ACCESSKEY = "accesskey"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_ONFOCUS = "onfocus"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_ONBLUR = "onblur"; // AREA //$NON-NLS-1$
+ public static final String ATTR_NAME_CHARSET = "charset"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_HREFLANG = "hreflang"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_TYPE = "type"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_REL = "rel"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_REV = "rev"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_MEDIA = "media"; // LINK //$NON-NLS-1$
+ public static final String ATTR_NAME_VALUE = "value"; // PARAM //$NON-NLS-1$
+ public static final String ATTR_NAME_VALUETYPE = "valuetype"; // PARAM //$NON-NLS-1$
+ public static final String ATTR_NAME_NOSHADE = "noshade"; // HR //$NON-NLS-1$
+ public static final String ATTR_NAME_CHECKED = "checked"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_DISABLED = "disabled"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_READONLY = "readonly"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_MAXLENGTH = "maxlength"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_ONSELECT = "onselect"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_ONCHANGE = "onchange"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_ACCEPT = "accept"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_ISTYLE = "istyle"; // INPUT //$NON-NLS-1$
+ public static final String ATTR_NAME_CHAR = "char"; // COL //$NON-NLS-1$
+ public static final String ATTR_NAME_CHAROFF = "charoff"; // COL //$NON-NLS-1$
+ public static final String ATTR_NAME_VALIGN = "valign"; // COL //$NON-NLS-1$
+ public static final String ATTR_NAME_SPAN = "span"; // COL //$NON-NLS-1$
+ public static final String ATTR_NAME_FRAMEBORDER = "frameborder"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_NAME_MARGINWIDTH = "marginwidth"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_NAME_MARGINHEIGHT = "marginheight"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_NAME_NORESIZE = "noresize"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_NAME_SCROLLING = "scrolling"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_NAME_PROMPT = "prompt"; // ISINDEX //$NON-NLS-1$
+ public static final String ATTR_NAME_HTTP_EQUIV = "http-equiv"; // META //$NON-NLS-1$
+ public static final String ATTR_NAME_CONTENT = "content"; // META //$NON-NLS-1$
+ public static final String ATTR_NAME_SCHEME = "scheme"; // META //$NON-NLS-1$
+ public static final String ATTR_NAME_ERRMSG = "errmsg"; // ssi:config //$NON-NLS-1$
+ public static final String ATTR_NAME_SIZEFMT = "sizefmt"; // ssi:config //$NON-NLS-1$
+ public static final String ATTR_NAME_TIMEFMT = "timefmt"; // ssi:config //$NON-NLS-1$
+ public static final String ATTR_NAME_VAR = "var"; // ssi:echo //$NON-NLS-1$
+ public static final String ATTR_NAME_CGI = "cgi"; // ssi:exec //$NON-NLS-1$
+ public static final String ATTR_NAME_CMD = "cmd"; // ssi:exec //$NON-NLS-1$
+ public static final String ATTR_NAME_FILE = "file"; // ssi:fsize //$NON-NLS-1$
+ public static final String ATTR_NAME_VIRTUAL = "virtual"; // ssi:fsize //$NON-NLS-1$
+ public static final String ATTR_NAME_SELECTED = "selected"; // OPTION //$NON-NLS-1$
+ public static final String ATTR_NAME_LABEL = "label"; // OPTION //$NON-NLS-1$
+ public static final String ATTR_NAME_ROWS = "rows"; // TEXTAREA //$NON-NLS-1$
+ public static final String ATTR_NAME_COLS = "cols"; // TEXTAREA //$NON-NLS-1$
+ public static final String ATTR_NAME_LANGUAGE = "language"; // SCRIPT //$NON-NLS-1$
+ public static final String ATTR_NAME_DEFER = "defer"; // SCRIPT //$NON-NLS-1$
+ public static final String ATTR_NAME_EVENT = "event"; // SCRIPT //$NON-NLS-1$
+ public static final String ATTR_NAME_FOR = "for"; // SCRIPT //$NON-NLS-1$
+ public static final String ATTR_NAME_COMPACT = "compact"; // OL/UL //$NON-NLS-1$
+ public static final String ATTR_NAME_START = "start"; // OL/UL //$NON-NLS-1$
+ public static final String ATTR_NAME_DIRECTKEY = "directkey"; // A //$NON-NLS-1$
+ public static final String ATTR_NAME_CODEBASE = "codebase"; // APPLET //$NON-NLS-1$
+ public static final String ATTR_NAME_ARCHIVE = "archive"; // APPLET //$NON-NLS-1$
+ public static final String ATTR_NAME_CODE = "code"; // APPLET //$NON-NLS-1$
+ public static final String ATTR_NAME_OBJECT = "object"; // APPLET //$NON-NLS-1$
+ public static final String ATTR_NAME_MAYSCRIPT = "mayscript"; // APPLET //$NON-NLS-1$
+ public static final String ATTR_NAME_CITE = "cite"; // BLOCKQUOTE //$NON-NLS-1$
+ public static final String ATTR_NAME_MACRO = "macro"; // D2W //$NON-NLS-1$
+ public static final String ATTR_NAME_DATETIME = "datetime"; // INS/DEL //$NON-NLS-1$
+ public static final String ATTR_NAME_LOOP = "loop"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_HIDDEN = "hidden"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_VOLUME = "volume"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOSTART = "autostart"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOPLAY = "autoplay"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOSIZE = "autosize"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_CONTROLLER = "controller";// EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_SCALE = "scale"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_SHOWCONTROLS = "showcontrols";// EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_PLAYCOUNT = "playcount"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_REPEAT = "repeat"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_PANEL = "panel"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_PALETTE = "palette"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_TEXTFOCUS = "textfocus"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_NAME_ACTION = "action"; // FORM //$NON-NLS-1$
+ public static final String ATTR_NAME_METHOD = "method"; // FORM //$NON-NLS-1$
+ public static final String ATTR_NAME_ENCTYPE = "enctype"; // FORM //$NON-NLS-1$
+ public static final String ATTR_NAME_ONSUBMIT = "onsubmit"; // FORM //$NON-NLS-1$
+ public static final String ATTR_NAME_ONRESET = "onreset"; // FORM //$NON-NLS-1$
+ public static final String ATTR_NAME_ACCEPT_CHARSET = "accept-charset";// FORM //$NON-NLS-1$
+ public static final String ATTR_NAME_BEHAVIOR = "behavior"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_NAME_DIRECTION = "direction"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_NAME_SCROLLAMOUNT = "scrollamount";// MARQUEE //$NON-NLS-1$
+ public static final String ATTR_NAME_SCROLLDELAY = "scrolldelay";// MARQUEE //$NON-NLS-1$
+ public static final String ATTR_NAME_TRUESPEED = "truespeed"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_NAME_DECLARE = "declare"; // OBJECT //$NON-NLS-1$
+ public static final String ATTR_NAME_CLASSID = "classid"; // OBJECT //$NON-NLS-1$
+ public static final String ATTR_NAME_DATA = "data"; // OBJECT //$NON-NLS-1$
+ public static final String ATTR_NAME_CODETYPE = "codetype"; // OBJECT //$NON-NLS-1$
+ public static final String ATTR_NAME_STANDBY = "standby"; // OBJECT //$NON-NLS-1$
+ public static final String ATTR_NAME_MULTIPLE = "multiple"; // SELECT //$NON-NLS-1$
+ public static final String ATTR_NAME_ABBR = "abbr"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_AXIS = "axis"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_HEADERS = "headers"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_SCOPE = "scope"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_ROWSPAN = "rowspan"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_COLSPAN = "colspan"; // TH/TD //$NON-NLS-1$
+ public static final String ATTR_NAME_NOWRAP = "nowrap"; // TH/TD //$NON-NLS-1$
+ // <<D205514
+ public static final String ATTR_NAME_TOPMARGIN = "topmargin"; // BODY //$NON-NLS-1$
+ public static final String ATTR_NAME_BOTTOMMARGIN = "bottommargin"; // BODY //$NON-NLS-1$
+ public static final String ATTR_NAME_LEFTMARGIN = "leftmargin"; // BODY //$NON-NLS-1$
+ public static final String ATTR_NAME_RIGHTMARGIN = "rightmargin"; // BODY //$NON-NLS-1$
+ public static final String ATTR_NAME_BORDERCOLOR = "bordercolor"; // TABLE/TR/TH/TD/FRAMESET/FRAME //$NON-NLS-1$
+ // for WML
+ public static final String WML_ATTR_NAME_TITLE = "title"; // card //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_DOMAIN = "domain"; // access //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_PATH = "path"; // access //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONENTERFORWARD = "onenterforward"; // template,card //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONENTERBACKWARD = "onenterbackward"; // template,card //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONPICK = "onpick"; // option //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ONTIMER = "ontimer"; // template,card //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_NEWCONTEXT = "newcontext"; // card //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ORDERED = "ordered"; // card //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_OPTIONAL = "optional"; // do //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_CACHE_CONTROL = "cache-control"; // go //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_SENDREFERER = "sendreferer"; // go //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_METHOD = "method"; // go //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ENCTYPE = "enctype"; // go //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_ACCEPT_CHARSET = "accept-charset"; // go //$NON-NLS-1$
+ public static final String WML_ATTR_NAME_COLUMNS = "columns"; // table //$NON-NLS-1$
+ // D205514
+ //<<D215684
+ public static final String ATTR_NAME_FRAMESPACING = "framespacing"; // FRAMESET //$NON-NLS-1$
+ //D215684
+ // global attribute values; mainly used in enumeration.
+ public static final String ATTR_VALUE_VERSION_TRANSITIONAL = "-//W3C//DTD HTML 4.01 Transitional//EN"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_VERSION_FRAMESET = "-//W3C//DTD HTML 4.01 Frameset//EN"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_LTR = "ltr"; // dir //$NON-NLS-1$
+ public static final String ATTR_VALUE_RTL = "rtl"; // dir //$NON-NLS-1$
+ // for align (top|middle|bottom|left|right)
+ public static final String ATTR_VALUE_TOP = "top"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_MIDDLE = "middle"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_BOTTOM = "bottom"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_LEFT = "left"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_CENTER = "center"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_RIGHT = "right"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_JUSTIFY = "justify"; // align //$NON-NLS-1$
+ public static final String ATTR_VALUE_CHAR = "char"; // align //$NON-NLS-1$
+ // for valign (baseline)
+ public static final String ATTR_VALUE_BASELINE = "baseline"; // valign //$NON-NLS-1$
+ // for clear (left|all|right|none): left and right are already defined above.
+ public static final String ATTR_VALUE_ALL = "all"; // clear //$NON-NLS-1$
+ public static final String ATTR_VALUE_NONE = "none"; // clear //$NON-NLS-1$
+ // for shape (rect|circle|poly|default)
+ public static final String ATTR_VALUE_RECT = "rect"; // shape //$NON-NLS-1$
+ public static final String ATTR_VALUE_CIRCLE = "circle"; // shape //$NON-NLS-1$
+ public static final String ATTR_VALUE_POLY = "poly"; // shape //$NON-NLS-1$
+ public static final String ATTR_VALUE_DEFAULT = "default"; // shape //$NON-NLS-1$
+ // for valuetype (data|ref|object)
+ public static final String ATTR_VALUE_DATA = "data"; // valuetype //$NON-NLS-1$
+ public static final String ATTR_VALUE_REF = "ref"; // valuetype //$NON-NLS-1$
+ public static final String ATTR_VALUE_OBJECT = "object"; // valuetype //$NON-NLS-1$
+ // for type of INPUT
+ // (text | password | checkbox | radio | submit | reset |
+ // file | hidden | image | button)
+ public static final String ATTR_VALUE_TEXT = "text"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_PASSWORD = "password"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_CHECKBOX = "checkbox"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_RADIO = "radio"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_SUBMIT = "submit"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_RESET = "reset"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_FILE = "file"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_HIDDEN = "hidden"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_IMAGE = "image"; // INPUT:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_BUTTON = "button"; // INPUT:type //$NON-NLS-1$
+ // for span, colspan, rowspan
+ public static final String ATTR_VALUE_1 = "1"; // span //$NON-NLS-1$
+ // for frameborder
+ public static final String ATTR_VALUE_0 = "0"; // FRAME //$NON-NLS-1$
+ // for scrolling
+ public static final String ATTR_VALUE_YES = "yes"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_VALUE_NO = "no"; // FRAME //$NON-NLS-1$
+ public static final String ATTR_VALUE_AUTO = "auto"; // FRAME //$NON-NLS-1$
+ // for UL
+ public static final String ATTR_VALUE_DISC = "disc"; // UL:type //$NON-NLS-1$
+ public static final String ATTR_VALUE_SQUARE = "square"; // UL:type //$NON-NLS-1$
+ // for frame of TABLE
+ public static final String ATTR_VALUE_VOID = "void"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_ABOVE = "above"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_BELOW = "below"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_HSIDES = "hsides"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_LHS = "lhs"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_RHS = "rhs"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_VSIDES = "vsides"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_BOX = "box"; // TABLE:frame //$NON-NLS-1$
+ public static final String ATTR_VALUE_BORDER = "border"; // TABLE:frame //$NON-NLS-1$
+ // for rules of TABLE
+ public static final String ATTR_VALUE_GROUPS = "groups"; // TABLE:rules //$NON-NLS-1$
+ public static final String ATTR_VALUE_ROWS = "rows"; // TEXTAREA //$NON-NLS-1$
+ public static final String ATTR_VALUE_COLS = "cols"; // TEXTAREA //$NON-NLS-1$
+ // for method of FORM
+ public static final String ATTR_VALUE_GET = "get"; // FORM //$NON-NLS-1$
+ public static final String ATTR_VALUE_POST = "post"; // FORM //$NON-NLS-1$
+ public static final String ATTR_VALUE_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
+ // for scope of (TH | TD)
+ public static final String ATTR_VALUE_ROW = "row"; // (TH|TD):scope //$NON-NLS-1$
+ public static final String ATTR_VALUE_COL = "col"; // (TH|TD):scope //$NON-NLS-1$
+ public static final String ATTR_VALUE_ROWGROUP = "rowgroup";// (TH|TD):scope //$NON-NLS-1$
+ public static final String ATTR_VALUE_COLGROUP = "colgroup";// (TH|TD):scope //$NON-NLS-1$
+ // for auto?? of EMBED
+ public static final String ATTR_VALUE_TRUE = "true"; // EMBED //$NON-NLS-1$
+ public static final String ATTR_VALUE_FALSE = "false"; // EMBED //$NON-NLS-1$
+ // for behaviro of MARQUEE
+ public static final String ATTR_VALUE_SCROLL = "scroll"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_VALUE_SLIDE = "slide"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_VALUE_ALTERNATE = "alternate"; // MARQUEE //$NON-NLS-1$
+ // for direction of MARQUEE
+ public static final String ATTR_VALUE_UP = "up"; // MARQUEE //$NON-NLS-1$
+ public static final String ATTR_VALUE_DOWN = "down"; // MARQUEE //$NON-NLS-1$
+ // for type of LI (D19924)
+ public static final String ATTR_VALUE_NUMBER = "1"; // LI //$NON-NLS-1$
+ public static final String ATTR_VALUE_LOWER_ALPHA = "a"; // LI //$NON-NLS-1$
+ public static final String ATTR_VALUE_UPPER_ALPHA = "A"; // LI //$NON-NLS-1$
+ public static final String ATTR_VALUE_LOWER_ROMAN = "i"; // LI //$NON-NLS-1$
+ public static final String ATTR_VALUE_UPPER_ROMAN = "I"; // LI //$NON-NLS-1$
+ // for loop of BGSOUND (D205513)
+ public static final String ATTR_VALUE_INFINITE = "infinite"; // BGSOUND //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCMProperties.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCMProperties.java
new file mode 100644
index 0000000000..16d4719cce
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCMProperties.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core;
+
+
+/**
+ * HTMLCMProperties defines all property names and pre-defined values in HTML CM.
+ * All of those properties can be retreived from element declarations of HTML CM
+ * via CMNode#getProperty(String propName).
+ */
+public interface HTMLCMProperties {
+
+ /**
+ * "shouldIgnoreCase" returns java.lang.Boolean object.
+ */
+ public static final String SHOULD_IGNORE_CASE = "shouldIgnoreCase";//$NON-NLS-1$
+ /**
+ * "shouldKeepSpace" returns java.lang.Boolean object.
+ */
+ public static final String SHOULD_KEEP_SPACE = "shouldKeepSpace";//$NON-NLS-1$
+ /**
+ * "indentChildSource" returns java.lang.Boolean object.
+ */
+ public static final String SHOULD_INDENT_CHILD_SOURCE = "shouldIndentChildSource";//$NON-NLS-1$
+ /**
+ * "terminators" returns java.util.Iterator (an array of String objects).
+ */
+ public static final String TERMINATORS = "terminators";//$NON-NLS-1$
+ /**
+ * "contentHint" returns CMElementDeclaration instnace.
+ */
+ public static final String CONTENT_HINT = "contentHint";//$NON-NLS-1$
+ /**
+ * "prohibitedAncestors" returns org.eclipse.wst.common.contentmodel.CMNamedNodeMap.
+ */
+ public static final String PROHIBITED_ANCESTORS = "prohibitedAncestors";//$NON-NLS-1$
+ /**
+ * "isJSP" returns java.lang.Boolean object.
+ */
+ public static final String IS_JSP = "isJSP";//$NON-NLS-1$
+ /**
+ * "isXHTML" returns java.lang.Boolean object.
+ */
+ public static final String IS_XHTML = "isXHTML";//$NON-NLS-1$
+ /**
+ * "isSSI" returns java.lang.Boolean object.
+ */
+ public static final String IS_SSI = "isSSI";//$NON-NLS-1$
+ /**
+ * "lineBreakHint" returns String (one of pre-defined values in Values).
+ */
+ public static final String LINE_BREAK_HINT = "lineBreakHint";//$NON-NLS-1$
+ /**
+ * "layoutType" returns String (one of pre-defined values in Values).
+ */
+ public static final String LAYOUT_TYPE = "layoutType";//$NON-NLS-1$
+ /**
+ * "tagInfo" returns String (documentation for this element).
+ */
+ public static final String TAGINFO = "tagInfo";//$NON-NLS-1$
+ /**
+ * "omitType" returns String (one of pre-defined values in Values).
+ */
+ public static final String OMIT_TYPE = "omitType";//$NON-NLS-1$
+ /**
+ * "inclusion" returns org.eclipse.wst.common.contentmodel.CMContent.
+ */
+ public static final String INCLUSION = "inclusion";//$NON-NLS-1$
+ /**
+ * "isScriptable" returns java.lang.Boolean object.
+ */
+ public static final String IS_SCRIPTABLE = "isScriptable"; //$NON-NLS-1$
+
+ public static interface Values {
+ /*
+ * for LINE_BREAK_HINT = "lineBreakHint".
+ */
+ public static final String BREAK_NONE = "breakNone";//$NON-NLS-1$
+ public static final String BREAK_AFTER_START = "breakAfterStart";//$NON-NLS-1$
+ public static final String BREAK_BEFORE_START_AND_AFTER_END = "breakBeforeStartAndAfterEnd";//$NON-NLS-1$
+ /*
+ * for LAYOUT_TYPE = "layoutType"
+ */
+ public static final String LAYOUT_BLOCK = "layoutBlock";//$NON-NLS-1$
+ /** BR */
+ public static final String LAYOUT_BREAK = "layoutBreak";//$NON-NLS-1$
+ /** Hidden object; like HTML or HEAD */
+ public static final String LAYOUT_HIDDEN = "layoutHidden";//$NON-NLS-1$
+ public static final String LAYOUT_NONE = "layoutNone";//$NON-NLS-1$
+ /** No wrap object; like IMG, APPLET,... */
+ public static final String LAYOUT_OBJECT = "layoutObject";//$NON-NLS-1$
+ public static final String LAYOUT_WRAP = "layoutWrap";//$NON-NLS-1$
+ /*
+ * for OMIT_TYPE = "omitType"
+ */
+ /** Not ommisible. */
+ public static final String OMIT_NONE = "omitNone";//$NON-NLS-1$
+ /** Both tags are ommisible. */
+ public static final String OMIT_BOTH = "omitBoth";//$NON-NLS-1$
+ /** The end tag is ommisible. */
+ public static final String OMIT_END = "omitEnd";//$NON-NLS-1$
+ /** The end tag is ommitted when created. */
+ public static final String OMIT_END_DEFAULT = "omitEndDefault";//$NON-NLS-1$
+ /** The end tag must be omitted. */
+ public static final String OMIT_END_MUST = "omitEndMust";//$NON-NLS-1$
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCorePlugin.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCorePlugin.java
new file mode 100644
index 0000000000..a3c7d1eda5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLCorePlugin.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.common.encoding.CommonCharsetNames;
+import org.eclipse.wst.common.encoding.CommonEncodingPreferenceNames;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class HTMLCorePlugin extends Plugin {
+ //The shared instance.
+ private static HTMLCorePlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public HTMLCorePlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.html.core.HtmlPluginResources"); //$NON-NLS-1$
+ }
+ catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static HTMLCorePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = HTMLCorePlugin.getDefault().getResourceBundle();
+ try {
+ return bundle.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPreferences()
+ */
+ protected void initializeDefaultPluginPreferences() {
+ super.initializeDefaultPluginPreferences();
+ Preferences prefs = getDefault().getPluginPreferences();
+ // set model preference defaults
+ prefs.setDefault(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE, CommonModelPreferenceNames.ASIS);
+ prefs.setDefault(CommonModelPreferenceNames.INSERT_REQUIRED_ATTRS, true);
+ prefs.setDefault(CommonModelPreferenceNames.INSERT_MISSING_TAGS, true);
+ prefs.setDefault(CommonModelPreferenceNames.QUOTE_ATTR_VALUES, true);
+ prefs.setDefault(CommonModelPreferenceNames.FORMAT_SOURCE, true);
+ prefs.setDefault(CommonModelPreferenceNames.CONVERT_EOL_CODES, false);
+
+ prefs.setDefault(CommonEncodingPreferenceNames.INPUT_CODESET, ""); //$NON-NLS-1$
+
+ String defaultEnc = CommonModelPreferenceNames.UTF_8;
+ String systemEnc = System.getProperty("file.encoding"); //$NON-NLS-1$
+ if (systemEnc != null) {
+ defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, CommonModelPreferenceNames.UTF_8);
+ }
+ prefs.setDefault(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc);
+
+ prefs.setDefault(CommonEncodingPreferenceNames.END_OF_LINE_CODE, ""); //$NON-NLS-1$
+ prefs.setDefault(CommonModelPreferenceNames.TAB_WIDTH, CommonModelPreferenceNames.DEFAULT_TAB_WIDTH);
+
+ prefs.setDefault(CommonModelPreferenceNames.FORMATTING_SUPPORTED, true);
+ prefs.setDefault(CommonModelPreferenceNames.LINE_WIDTH, 72);
+ prefs.setDefault(CommonModelPreferenceNames.SPLIT_MULTI_ATTRS, false);
+ prefs.setDefault(CommonModelPreferenceNames.INDENT_USING_TABS, true);
+ prefs.setDefault(CommonModelPreferenceNames.CLEAR_ALL_BLANK_LINES, false);
+
+ prefs.setDefault(CommonModelPreferenceNames.PREFERRED_MARKUP_CASE_SUPPORTED, true);
+ prefs.setDefault(CommonModelPreferenceNames.TAG_NAME_CASE, CommonModelPreferenceNames.UPPER);
+ prefs.setDefault(CommonModelPreferenceNames.ATTR_NAME_CASE, CommonModelPreferenceNames.LOWER);
+
+ prefs.setDefault(HTMLFilesPreferenceNames.DEFAULT_SUFFIX, HTMLFilesPreferenceNames.HTML_SUFFIX);
+ prefs.setDefault(HTMLFilesPreferenceNames.GENERATE_DOCUMENT_TYPE, true);
+ prefs.setDefault(HTMLFilesPreferenceNames.GENERATE_GENERATOR, true);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFilesPreferenceNames.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFilesPreferenceNames.java
new file mode 100644
index 0000000000..6072e0f8f7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFilesPreferenceNames.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core;
+
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+
+/**
+ * Additional preferences for new HTML Files generation
+ */
+public interface HTMLFilesPreferenceNames extends CommonModelPreferenceNames {
+
+ static final String DEFAULT_SUFFIX = "defaultSuffix";//$NON-NLS-1$
+ static final String HTML_SUFFIX = "html";//$NON-NLS-1$
+ static final String GENERATE_DOCUMENT_TYPE = "generateDocumentType";//$NON-NLS-1$
+ static final String GENERATE_GENERATOR = "generateGenerator";//$NON-NLS-1$
+ // added this as a potential why to handle changing
+ // product names "up" the stack. Note, not declared final
+ // to avoid getting 'inlined' by compiler.
+ static IProduct product = Platform.getProduct();
+ static String GENERATOR = product.getName();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFormatContraints.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFormatContraints.java
new file mode 100644
index 0000000000..5346737757
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/HTMLFormatContraints.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core;
+
+import org.eclipse.wst.sse.core.format.IStructuredFormatContraints;
+
+/**
+ * @deprecated
+ * Please un-deprecate this if Page Designer thinks they are needed.
+ */
+public interface HTMLFormatContraints extends IStructuredFormatContraints {
+ /**
+ * @deprecated
+ * It's very hard to keep the available line width accurate.
+ * Sometimes a node wants to start on a new line, sometimes it doesn't.
+ * It's best for the node to figure out the available line width on the fly.
+ */
+ int getAvailableLineWidth();
+
+ /**
+ * @deprecated
+ * It's very hard to keep the available line width accurate.
+ * Sometimes a node wants to start on a new line, sometimes it doesn't.
+ * It's best for the node to figure out the available line width on the fly.
+ */
+ void setAvailableLineWidth(int availableLineWidth);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/PreferenceNames.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/PreferenceNames.java
new file mode 100644
index 0000000000..66466e4b24
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/PreferenceNames.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core;
+
+
+public interface PreferenceNames {
+
+ String TRUE = "true"; //$NON-NLS-1$
+ String FALSE = "false"; //$NON-NLS-1$
+ String YES = "yes"; //$NON-NLS-1$
+ String NO = "no"; //$NON-NLS-1$
+
+
+ String SETTINGS = "settings"; //$NON-NLS-1$
+
+ String TREEVIEW = "treeview"; //$NON-NLS-1$
+ String DEFAULT_DEPTH = "defaultdepth"; //$NON-NLS-1$
+
+ String ASIS = "as-is"; //$NON-NLS-1$
+ String LOWER = "lower"; //$NON-NLS-1$
+ String UPPER = "upper"; //$NON-NLS-1$
+
+ String PREFERRED_CASE = "preferred-case"; //$NON-NLS-1$
+ String TAGNAME = "tagname"; //$NON-NLS-1$
+ String ATTRIBUTENAME = "attributename"; //$NON-NLS-1$
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/AbstractNodeCleanupHandler.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/AbstractNodeCleanupHandler.java
new file mode 100644
index 0000000000..b16b86795a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/AbstractNodeCleanupHandler.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupHandler;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupPreferences;
+import org.eclipse.wst.sse.core.cleanup.StructuredCleanupPreferences;
+import org.eclipse.wst.sse.core.events.StructuredDocumentEvent;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+
+abstract class AbstractNodeCleanupHandler implements IStructuredCleanupHandler {
+
+ protected IStructuredCleanupPreferences fCleanupPreferences = null;
+ protected IProgressMonitor fProgressMonitor = null;
+
+ public void setCleanupPreferences(IStructuredCleanupPreferences cleanupPreferences) {
+
+ fCleanupPreferences = cleanupPreferences;
+ }
+
+ /**
+ * @see com.ibm.sed.partitionCleanup.CleanupHandler#getCleanupPreferences()
+ */
+ public IStructuredCleanupPreferences getCleanupPreferences() {
+ if (fCleanupPreferences == null) {
+ fCleanupPreferences = new StructuredCleanupPreferences();
+
+ Preferences preferences = getModelPreferences();
+ if (preferences != null) {
+ fCleanupPreferences.setTagNameCase(preferences.getInt(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE));
+ fCleanupPreferences.setAttrNameCase(preferences.getInt(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE));
+ fCleanupPreferences.setCompressEmptyElementTags(preferences.getBoolean(CommonModelPreferenceNames.COMPRESS_EMPTY_ELEMENT_TAGS));
+ fCleanupPreferences.setInsertRequiredAttrs(preferences.getBoolean(CommonModelPreferenceNames.INSERT_REQUIRED_ATTRS));
+ fCleanupPreferences.setInsertMissingTags(preferences.getBoolean(CommonModelPreferenceNames.INSERT_MISSING_TAGS));
+ fCleanupPreferences.setQuoteAttrValues(preferences.getBoolean(CommonModelPreferenceNames.QUOTE_ATTR_VALUES));
+ fCleanupPreferences.setFormatSource(preferences.getBoolean(CommonModelPreferenceNames.FORMAT_SOURCE));
+ fCleanupPreferences.setConvertEOLCodes(preferences.getBoolean(CommonModelPreferenceNames.CONVERT_EOL_CODES));
+ fCleanupPreferences.setEOLCode(preferences.getString(CommonModelPreferenceNames.CLEANUP_EOL_CODE));
+ }
+ }
+
+ return fCleanupPreferences;
+ }
+
+ /**
+ * @see com.ibm.sed.partitionCleanup.CleanupHandler#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void setProgressMonitor(IProgressMonitor progressMonitor) {
+
+ fProgressMonitor = progressMonitor;
+ }
+
+ static protected StructuredDocumentEvent replaceSource(XMLModel model, Object requester, int offset, int length, String source) {
+
+ StructuredDocumentEvent result = null;
+ if (model == null)
+ return result;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return result;
+ if (source == null)
+ source = new String();
+ if (structuredDocument.containsReadOnly(offset, length))
+ return result;
+ if (requester == null) {
+ requester = structuredDocument;
+ }
+ return structuredDocument.replaceText(requester, offset, length, source);
+ }
+
+ protected Preferences getModelPreferences() {
+ return HTMLCorePlugin.getDefault().getPluginPreferences();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/CSSTextNodeCleanupHandler.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/CSSTextNodeCleanupHandler.java
new file mode 100644
index 0000000000..491a8bd262
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/CSSTextNodeCleanupHandler.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+
+
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.format.CSSSourceFormatter;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Node;
+
+// nakamori_TODO: check and remove
+
+public class CSSTextNodeCleanupHandler extends AbstractNodeCleanupHandler {
+
+ public Node cleanup(Node node) {
+ if (node == null)
+ return node;
+ XMLModel model = ((XMLNode) node).getModel();
+ if (model == null)
+ return node;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return node;
+
+ String content = getCSSContent(node);
+ if (content == null)
+ return node;
+
+ int offset = ((XMLNode) node).getStartOffset();
+ int length = ((XMLNode) node).getEndOffset() - offset;
+ replaceSource(model, this, offset, length, content);
+ return (XMLNode) model.getIndexedRegion(offset);
+ }
+
+ /**
+ */
+ private String getCSSContent(Node text) {
+ ICSSModel model = getCSSModel(text);
+ if (model == null)
+ return null;
+ ICSSNode document = model.getDocument();
+ if (document == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) document;
+ INodeAdapter adapter = notifier.getAdapterFor(CSSSourceFormatter.class);
+ if (adapter == null)
+ return null;
+ CSSSourceFormatter formatter = (CSSSourceFormatter) adapter;
+ StringBuffer buffer = formatter.cleanup(document);
+ if (buffer == null)
+ return null;
+ return buffer.toString();
+ }
+
+ /**
+ */
+ private ICSSModel getCSSModel(Node text) {
+ if (text == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) text.getParentNode();
+ if (notifier == null)
+ return null;
+ INodeAdapter adapter = notifier.getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter == null)
+ return null;
+ if (!(adapter instanceof IStyleSheetAdapter))
+ return null;
+ IStyleSheetAdapter styleAdapter = (IStyleSheetAdapter) adapter;
+ return styleAdapter.getModel();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/ElementNodeCleanupHandler.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/ElementNodeCleanupHandler.java
new file mode 100644
index 0000000000..f006784b63
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/ElementNodeCleanupHandler.java
@@ -0,0 +1,635 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.css.core.adapters.IStyleDeclarationAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.format.CSSSourceFormatter;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupHandler;
+import org.eclipse.wst.sse.core.exceptions.SourceEditingRuntimeException;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.util.StringUtils;
+import org.eclipse.wst.xml.core.document.XMLAttr;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLGenerator;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+// nakamori_TODO: check and remove CSS formatting
+
+public class ElementNodeCleanupHandler extends AbstractNodeCleanupHandler {
+
+ /** Non-NLS strings */
+ protected static final String START_TAG_OPEN = "<"; //$NON-NLS-1$
+ protected static final String END_TAG_OPEN = "</"; //$NON-NLS-1$
+ protected static final String TAG_CLOSE = ">"; //$NON-NLS-1$
+ protected static final String EMPTY_TAG_CLOSE = "/>"; //$NON-NLS-1$
+ protected static final String SINGLE_QUOTES = "''"; //$NON-NLS-1$
+ protected static final String DOUBLE_QUOTES = "\"\""; //$NON-NLS-1$
+ protected static final char SINGLE_QUOTE = '\''; //$NON-NLS-1$
+ protected static final char DOUBLE_QUOTE = '\"'; //$NON-NLS-1$
+
+ public Node cleanup(Node node) {
+ XMLNode renamedNode = (XMLNode) cleanupChildren(node);
+
+ // call quoteAttrValue() first so it will close any unclosed attr
+ // quoteAttrValue() will return the new start tag if there is a structure change
+ renamedNode = quoteAttrValue(renamedNode);
+
+ // insert tag close if missing
+ // if node is not comment tag
+ // and not implicit tag
+ if (!((XMLElement) renamedNode).isCommentTag() && (renamedNode.getStartStructuredDocumentRegion() != null)) {
+ XMLModel structuredModel = renamedNode.getModel();
+
+ // save start offset before insertTagClose()
+ // or else renamedNode.getStartOffset() will be zero if renamedNode replaced by insertTagClose()
+ int startTagStartOffset = renamedNode.getStartOffset();
+
+ // for start tag
+ IStructuredDocumentRegion startTagStructuredDocumentRegion = renamedNode.getStartStructuredDocumentRegion();
+ insertTagClose(structuredModel, startTagStructuredDocumentRegion);
+
+ // update renamedNode and startTagStructuredDocumentRegion after insertTagClose()
+ renamedNode = (XMLNode) structuredModel.getIndexedRegion(startTagStartOffset);
+ startTagStructuredDocumentRegion = renamedNode.getStartStructuredDocumentRegion();
+
+ // for end tag
+ IStructuredDocumentRegion endTagStructuredDocumentRegion = renamedNode.getEndStructuredDocumentRegion();
+ if (endTagStructuredDocumentRegion != startTagStructuredDocumentRegion)
+ insertTagClose(structuredModel, endTagStructuredDocumentRegion);
+ }
+
+ // call insertMissingTags() next, it will generate implicit tags if there are any
+ // insertMissingTags() will return the new missing start tag if one is missing
+ // applyTagNameCase() will return the renamed node.
+ // The renamed/new node will be saved and returned to caller when all cleanup is done.
+ renamedNode = insertMissingTags(renamedNode);
+ renamedNode = insertRequiredAttrs(renamedNode);
+ renamedNode = applyTagNameCase(renamedNode);
+ applyAttrNameCase(renamedNode);
+ cleanupCSSAttrValue(renamedNode);
+
+ return renamedNode;
+ }
+
+ private boolean shouldIgnoreCase(XMLElement element) {
+ // case option can be applied to no namespace tags
+ return element.isGlobalTag();
+ /*
+ ModelQueryAdapter mqadapter = (ModelQueryAdapter) element.getAdapterFor(ModelQueryAdapter.class);
+ ModelQuery mq = null;
+ CMNode nodedecl = null;
+ if (mqadapter != null)
+ mq = mqadapter.getModelQuery();
+ if (mq != null)
+ nodedecl = mq.getCMNode(node);
+ // if a Node isn't recognized as HTML or is and cares about case, do not alter it
+ // if (nodedecl == null || (nodedecl instanceof HTMLCMNode && ((HTMLCMNode) nodedecl).shouldIgnoreCase()))
+ if (! nodedecl.supports(HTMLCMProperties.SHOULD_IGNORE_CASE)) return false;
+ return ((Boolean)cmnode.getProperty(HTMLCMProperties.SHOULD_IGNORE_CASE)).booleanValue();
+ */
+ }
+
+ protected void applyAttrNameCase(XMLNode node) {
+ XMLElement element = (XMLElement) node;
+ if (element.isCommentTag())
+ return; // do nothing
+
+ int attrNameCase = CommonModelPreferenceNames.ASIS;
+
+ if (shouldIgnoreCase(element))
+ attrNameCase = getCleanupPreferences().getAttrNameCase();
+
+ NamedNodeMap attributes = node.getAttributes();
+ int attributesLength = attributes.getLength();
+
+ for (int i = 0; i < attributesLength; i++) {
+ XMLNode eachAttr = (XMLNode) attributes.item(i);
+ String oldAttrName = eachAttr.getNodeName();
+ String newAttrName = oldAttrName;
+ // 254961 - all HTML tag names and attribute names should be in English
+ // even for HTML files in other languages like Japanese or Turkish.
+ // English locale should be used to convert between uppercase and lowercase
+ // (otherwise "link" would be converted to "LÝNK" in Turkish, where '?' in "LÝNK"
+ // is the "I Overdot Capital" in Turkish).
+ if (attrNameCase == CommonModelPreferenceNames.LOWER)
+ newAttrName = oldAttrName.toLowerCase(Locale.US);
+ else if (attrNameCase == CommonModelPreferenceNames.UPPER)
+ newAttrName = oldAttrName.toUpperCase(Locale.US);
+
+ if (newAttrName.compareTo(oldAttrName) != 0) {
+ int attrNameStartOffset = eachAttr.getStartOffset();
+ int attrNameLength = oldAttrName.length();
+
+ XMLModel structuredModel = node.getModel();
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+ replaceSource(structuredModel, structuredDocument, attrNameStartOffset, attrNameLength, newAttrName);
+ }
+ }
+ }
+
+ protected XMLNode applyTagNameCase(XMLNode node) {
+ XMLElement element = (XMLElement) node;
+ if (element.isCommentTag())
+ return node; // do nothing
+
+ int tagNameCase = CommonModelPreferenceNames.ASIS;
+
+ if (shouldIgnoreCase(element))
+ tagNameCase = getCleanupPreferences().getTagNameCase();
+
+ String oldTagName = node.getNodeName();
+ String newTagName = oldTagName;
+ XMLNode newNode = node;
+
+ // 254961 - all HTML tag names and attribute names should be in English
+ // even for HTML files in other languages like Japanese or Turkish.
+ // English locale should be used to convert between uppercase and lowercase
+ // (otherwise "link" would be converted to "LÝNK" in Turkish, where '?' in "LÝNK"
+ // is the "I Overdot Capital" in Turkish).
+ if (tagNameCase == CommonModelPreferenceNames.LOWER)
+ newTagName = oldTagName.toLowerCase(Locale.US);
+ else if (tagNameCase == CommonModelPreferenceNames.UPPER)
+ newTagName = oldTagName.toUpperCase(Locale.US);
+
+ XMLModel structuredModel = node.getModel();
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+
+ IStructuredDocumentRegion startTagStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
+ if (startTagStructuredDocumentRegion != null) {
+ ITextRegionList regions = startTagStructuredDocumentRegion.getRegions();
+ if (regions != null && regions.size() > 0) {
+ ITextRegion startTagNameRegion = regions.get(1);
+ int startTagNameStartOffset = startTagStructuredDocumentRegion.getStartOffset(startTagNameRegion);
+ int startTagNameLength = startTagStructuredDocumentRegion.getTextEndOffset(startTagNameRegion) - startTagNameStartOffset;
+
+ replaceSource(structuredModel, structuredDocument, startTagNameStartOffset, startTagNameLength, newTagName);
+ newNode = (XMLNode) structuredModel.getIndexedRegion(startTagNameStartOffset); // save new node
+ }
+ }
+
+ IStructuredDocumentRegion endTagStructuredDocumentRegion = node.getEndStructuredDocumentRegion();
+ if (endTagStructuredDocumentRegion != null) {
+ ITextRegionList regions = endTagStructuredDocumentRegion.getRegions();
+ if (regions != null && regions.size() > 0) {
+ ITextRegion endTagNameRegion = regions.get(1);
+ int endTagNameStartOffset = endTagStructuredDocumentRegion.getStartOffset(endTagNameRegion);
+ int endTagNameLength = endTagStructuredDocumentRegion.getTextEndOffset(endTagNameRegion) - endTagNameStartOffset;
+
+ if (startTagStructuredDocumentRegion != endTagStructuredDocumentRegion)
+ replaceSource(structuredModel, structuredDocument, endTagNameStartOffset, endTagNameLength, newTagName);
+ }
+ }
+
+ return newNode;
+ }
+
+ protected Node cleanupChildren(Node node) {
+ Node parentNode = node;
+
+ if (node != null) {
+ Node childNode = node.getFirstChild();
+ HTMLCleanupHandlerFactory factory = HTMLCleanupHandlerFactory.getInstance();
+ while (childNode != null) {
+ // cleanup this child node
+ IStructuredCleanupHandler cleanupHandler = factory.createHandler(childNode, getCleanupPreferences());
+ childNode = cleanupHandler.cleanup(childNode);
+
+ // get new parent node
+ parentNode = (XMLNode) childNode.getParentNode();
+
+ // get next child node
+ childNode = (XMLNode) childNode.getNextSibling();
+ }
+ }
+
+ return parentNode;
+ }
+
+ /**
+ */
+ protected void cleanupCSSAttrValue(XMLNode node) {
+ if (node == null || node.getNodeType() != Node.ELEMENT_NODE)
+ return;
+ XMLElement element = (XMLElement) node;
+ if (!element.isGlobalTag())
+ return;
+
+ Attr attr = element.getAttributeNode("style"); //$NON-NLS-1$
+ if (attr == null)
+ return;
+ String value = getCSSValue(attr);
+ if (value == null)
+ return;
+ String oldValue = ((XMLNode) attr).getValueSource();
+ if (oldValue != null && value.equals(oldValue))
+ return;
+ attr.setValue(value);
+ }
+
+ /**
+ */
+ private ICSSModel getCSSModel(Attr attr) {
+ if (attr == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) attr.getOwnerElement();
+ if (notifier == null)
+ return null;
+ INodeAdapter adapter = notifier.getAdapterFor(IStyleDeclarationAdapter.class);
+ if (adapter == null)
+ return null;
+ if (!(adapter instanceof IStyleDeclarationAdapter))
+ return null;
+ IStyleDeclarationAdapter styleAdapter = (IStyleDeclarationAdapter) adapter;
+ return styleAdapter.getModel();
+ }
+
+ /**
+ */
+ private String getCSSValue(Attr attr) {
+ ICSSModel model = getCSSModel(attr);
+ if (model == null)
+ return null;
+ ICSSNode document = model.getDocument();
+ if (document == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) document;
+ INodeAdapter adapter = notifier.getAdapterFor(CSSSourceFormatter.class);
+ if (adapter == null)
+ return null;
+ CSSSourceFormatter formatter = (CSSSourceFormatter) adapter;
+ StringBuffer buffer = formatter.cleanup(document);
+ if (buffer == null)
+ return null;
+ return buffer.toString();
+ }
+
+ private boolean isEmptyElement(XMLElement element) {
+ Document document = element.getOwnerDocument();
+ if (document == null)
+ // undefined tag, return default
+ return false;
+
+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
+ if (modelQuery == null)
+ // undefined tag, return default
+ return false;
+
+ CMElementDeclaration decl = modelQuery.getCMElementDeclaration(element);
+ if (decl == null)
+ // undefined tag, return default
+ return false;
+
+ return (decl.getContentType() == CMElementDeclaration.EMPTY);
+ }
+
+ protected XMLNode insertEndTag(XMLNode node) {
+ XMLElement element = (XMLElement) node;
+
+ int startTagStartOffset = node.getStartOffset();
+ XMLModel structuredModel = node.getModel();
+ XMLNode newNode = null;
+
+ if (element.isCommentTag()) {
+ // do nothing
+ }
+ else if (isEmptyElement(element)) {
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+ IStructuredDocumentRegion startStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
+ ITextRegionList regions = startStructuredDocumentRegion.getRegions();
+ ITextRegion lastRegion = regions.get(regions.size() - 1);
+ replaceSource(structuredModel, structuredDocument, startStructuredDocumentRegion.getStartOffset(lastRegion), lastRegion.getLength(), EMPTY_TAG_CLOSE);
+
+ if (regions.size() > 1) {
+ ITextRegion regionBeforeTagClose = regions.get(regions.size() - 1 - 1);
+
+ // insert a space separator before tag close if the previous region does not have extra spaces
+ if (regionBeforeTagClose.getTextLength() == regionBeforeTagClose.getLength())
+ replaceSource(structuredModel, structuredDocument, startStructuredDocumentRegion.getStartOffset(lastRegion), 0, " "); //$NON-NLS-1$
+ }
+ }
+ else {
+ String tagName = node.getNodeName();
+ String endTag = END_TAG_OPEN.concat(tagName).concat(TAG_CLOSE);
+
+ XMLNode lastChild = (XMLNode) node.getLastChild();
+ int endTagStartOffset = 0;
+ if (lastChild != null)
+ // if this node has children, insert the end tag after the last child
+ endTagStartOffset = lastChild.getEndOffset();
+ else
+ // if this node does not has children, insert the end tag after the start tag
+ endTagStartOffset = node.getEndOffset();
+
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+ replaceSource(structuredModel, structuredDocument, endTagStartOffset, 0, endTag);
+ }
+
+ newNode = (XMLNode) structuredModel.getIndexedRegion(startTagStartOffset); // save new node
+
+ return newNode;
+ }
+
+ protected XMLNode insertMissingTags(XMLNode node) {
+ boolean insertMissingTags = getCleanupPreferences().getInsertMissingTags();
+ XMLNode newNode = node;
+
+ if (insertMissingTags) {
+ IStructuredDocumentRegion startTagStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
+ if (startTagStructuredDocumentRegion == null) {
+ // implicit start tag; generate tag for it
+ newNode = insertStartTag(node);
+ startTagStructuredDocumentRegion = newNode.getStartStructuredDocumentRegion();
+ }
+
+ IStructuredDocumentRegion endTagStructuredDocumentRegion = newNode.getEndStructuredDocumentRegion();
+
+ ITextRegionList regionList = startTagStructuredDocumentRegion.getRegions();
+ if (startTagStructuredDocumentRegion != null && regionList != null && regionList.get(regionList.size() - 1).getType() == XMLRegionContext.XML_EMPTY_TAG_CLOSE) {
+
+ }
+ else {
+ if (startTagStructuredDocumentRegion == null) {
+ // start tag missing
+ if (isStartTagRequired(newNode))
+ newNode = insertStartTag(newNode);
+ }
+ else if (endTagStructuredDocumentRegion == null) {
+ // end tag missing
+ if (isEndTagRequired(newNode))
+ newNode = insertEndTag(newNode);
+ }
+ }
+ }
+
+ return newNode;
+ }
+
+ protected XMLNode insertStartTag(XMLNode node) {
+ XMLElement element = (XMLElement) node;
+ if (element.isCommentTag())
+ return node; // do nothing
+
+ XMLNode newNode = null;
+
+ String tagName = node.getNodeName();
+ String startTag = START_TAG_OPEN.concat(tagName).concat(TAG_CLOSE);
+ int startTagStartOffset = node.getStartOffset();
+
+ XMLModel structuredModel = node.getModel();
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+ replaceSource(structuredModel, structuredDocument, startTagStartOffset, 0, startTag);
+ newNode = (XMLNode) structuredModel.getIndexedRegion(startTagStartOffset); // save new node
+
+ return newNode;
+ }
+
+ protected void insertTagClose(XMLModel structuredModel, IStructuredDocumentRegion flatNode) {
+ if ((flatNode != null) && (flatNode.getRegions() != null)) {
+ ITextRegionList regionList = flatNode.getRegions();
+ ITextRegion lastRegion = regionList.get(regionList.size() - 1);
+ if (lastRegion != null) {
+ String regionType = lastRegion.getType();
+ if ((regionType != XMLRegionContext.XML_EMPTY_TAG_CLOSE) && (regionType != XMLRegionContext.XML_TAG_CLOSE)) {
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+
+ // insert ">" after lastRegion of flatNode
+ // as in "<a</a>" if flatNode is for start tag, or in "<a></a" if flatNode is for end tag
+ replaceSource(structuredModel, structuredDocument, flatNode.getTextEndOffset(lastRegion), 0, ">"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ protected boolean isEndTagRequired(XMLNode node) {
+ if (node == null)
+ return false;
+ return node.isContainer();
+ }
+
+ /**
+ * The end tags of HTML EMPTY content type, such as IMG,
+ * and HTML undefined tags are parsed separately from the start tags.
+ * So inserting the missing start tag is useless and even harmful.
+ */
+ protected boolean isStartTagRequired(XMLNode node) {
+ if (node == null)
+ return false;
+ return node.isContainer();
+ }
+
+ protected boolean isXMLType(XMLModel structuredModel) {
+ boolean result = false;
+
+ if (structuredModel != null && structuredModel != null) {
+ XMLDocument document = structuredModel.getDocument();
+
+ if (document != null)
+ result = document.isXMLType();
+ }
+
+ return result;
+ }
+
+ protected XMLNode quoteAttrValue(XMLNode node) {
+ XMLElement element = (XMLElement) node;
+ if (element.isCommentTag())
+ return node; // do nothing
+
+ boolean quoteAttrValues = getCleanupPreferences().getQuoteAttrValues();
+ XMLNode newNode = node;
+
+ if (quoteAttrValues) {
+ NamedNodeMap attributes = newNode.getAttributes();
+ int attributesLength = attributes.getLength();
+ XMLGenerator generator = node.getModel().getGenerator();
+
+ for (int i = 0; i < attributesLength; i++) {
+ attributes = newNode.getAttributes();
+ attributesLength = attributes.getLength();
+ XMLAttr eachAttr = (XMLAttr) attributes.item(i);
+ //ITextRegion oldAttrValueRegion = eachAttr.getValueRegion();
+ String oldAttrValue = eachAttr.getValueRegionText();
+ if (oldAttrValue == null) {
+ XMLModel structuredModel = node.getModel();
+ if (isXMLType(structuredModel)) {
+ // TODO: Kit, please check. Is there any way to not rely on getting regions from attributes?
+ String newAttrValue = "=\"" + eachAttr.getNameRegionText() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+ replaceSource(structuredModel, structuredDocument, eachAttr.getNameRegionEndOffset(), 0, newAttrValue);
+ newNode = (XMLNode) structuredModel.getIndexedRegion(node.getStartOffset()); // save new node
+ }
+ }
+ else {
+
+ char quote = StringUtils.isQuoted(oldAttrValue) ? oldAttrValue.charAt(0) : DOUBLE_QUOTE;
+ String newAttrValue = generator.generateAttrValue(eachAttr, quote);
+
+ // There is a problem in StructuredDocumentRegionUtil.getAttrValue(ITextRegion) when the region is instanceof ContextRegion.
+ // Workaround for now...
+ if (oldAttrValue.length() == 1) {
+ char firstChar = oldAttrValue.charAt(0);
+ if (firstChar == SINGLE_QUOTE)
+ newAttrValue = SINGLE_QUOTES;
+ else if (firstChar == DOUBLE_QUOTE)
+ newAttrValue = DOUBLE_QUOTES;
+ }
+
+ if (newAttrValue != null) {
+ if (newAttrValue.compareTo(oldAttrValue) != 0) {
+ int attrValueStartOffset = eachAttr.getValueRegionStartOffset();
+ int attrValueLength = oldAttrValue.length();
+ int startTagStartOffset = node.getStartOffset();
+
+ XMLModel structuredModel = node.getModel();
+ IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
+ replaceSource(structuredModel, structuredDocument, attrValueStartOffset, attrValueLength, newAttrValue);
+ newNode = (XMLNode) structuredModel.getIndexedRegion(startTagStartOffset); // save new node
+ }
+ }
+ }
+ }
+ }
+
+ return newNode;
+ }
+
+ private XMLNode insertRequiredAttrs(XMLNode node) {
+ boolean insertRequiredAttrs = getCleanupPreferences().getInsertRequiredAttrs();
+ XMLNode newNode = node;
+
+ if (insertRequiredAttrs) {
+ List requiredAttrs = getRequiredAttrs(newNode);
+ if (requiredAttrs.size() > 0) {
+ NamedNodeMap currentAttrs = node.getAttributes();
+ List insertAttrs = new ArrayList();
+ if (currentAttrs.getLength() == 0)
+ insertAttrs.addAll(requiredAttrs);
+ else {
+ for (int i = 0; i < requiredAttrs.size(); i++) {
+ String requiredAttrName = ((CMAttributeDeclaration) requiredAttrs.get(i)).getAttrName();
+ boolean found = false;
+ for (int j = 0; j < currentAttrs.getLength(); j++) {
+ String currentAttrName = currentAttrs.item(j).getNodeName();
+ if (requiredAttrName.compareToIgnoreCase(currentAttrName) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ insertAttrs.add(requiredAttrs.get(i));
+ }
+ }
+ if (insertAttrs.size() > 0) {
+ IStructuredDocumentRegion startStructuredDocumentRegion = newNode.getStartStructuredDocumentRegion();
+ int index = startStructuredDocumentRegion.getEndOffset();
+ ITextRegion lastRegion = startStructuredDocumentRegion.getLastRegion();
+ if (lastRegion.getType() == XMLRegionContext.XML_TAG_CLOSE) {
+ index--;
+ lastRegion = startStructuredDocumentRegion.getRegionAtCharacterOffset(index - 1);
+ }
+ else if (lastRegion.getType() == XMLRegionContext.XML_EMPTY_TAG_CLOSE) {
+ index = index - 2;
+ lastRegion = startStructuredDocumentRegion.getRegionAtCharacterOffset(index - 1);
+ }
+ MultiTextEdit multiTextEdit = new MultiTextEdit();
+ try {
+ for (int i = insertAttrs.size() - 1; i >= 0; i--) {
+ CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) insertAttrs.get(i);
+ String requiredAttributeName = attrDecl.getAttrName();
+ String defaultValue = attrDecl.getDefaultValue();
+ if (defaultValue == null)
+ defaultValue = ""; //$NON-NLS-1$
+ String nameAndDefaultValue = " "; //$NON-NLS-1$
+ if (i == 0 && lastRegion.getLength() > lastRegion.getTextLength())
+ nameAndDefaultValue = ""; //$NON-NLS-1$
+ nameAndDefaultValue += requiredAttributeName + "=\"" + defaultValue + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ multiTextEdit.addChild(new InsertEdit(index, nameAndDefaultValue));
+ // BUG3381: MultiTextEdit applies all child TextEdit's basing on offsets
+ // in the document before the first TextEdit, not after each
+ // child TextEdit. Therefore, do not need to advance the index.
+ //index += nameAndDefaultValue.length();
+ }
+ multiTextEdit.apply(newNode.getStructuredDocument());
+ }
+ catch (BadLocationException e) {
+ throw new SourceEditingRuntimeException(e);
+ }
+ }
+ }
+ }
+
+ return newNode;
+ }
+
+
+ protected ModelQuery getModelQuery(Node node) {
+ if (node.getNodeType() == Node.DOCUMENT_NODE) {
+ return ModelQueryUtil.getModelQuery((Document) node);
+ }
+ else {
+ return ModelQueryUtil.getModelQuery(node.getOwnerDocument());
+ }
+ }
+
+ protected List getRequiredAttrs(Node node) {
+ List result = new ArrayList();
+
+ ModelQuery modelQuery = getModelQuery(node);
+ if (modelQuery != null) {
+ CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node);
+ if (elementDecl != null) {
+ CMNamedNodeMap attrMap = elementDecl.getAttributes();
+ Iterator it = attrMap.iterator();
+ CMAttributeDeclaration attr = null;
+ while (it.hasNext()) {
+ attr = (CMAttributeDeclaration) it.next();
+ if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) {
+ result.add(attr);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupHandlerFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupHandlerFactory.java
new file mode 100644
index 0000000000..0935e7dd96
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupHandlerFactory.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+
+
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupHandler;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupPreferences;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.jsp.model.parser.temp.XMLJSPRegionContexts;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.w3c.dom.Node;
+
+// nakamori_TODO: check and remove CSS formatting
+
+class HTMLCleanupHandlerFactory {
+
+ private static HTMLCleanupHandlerFactory fInstance = null;
+
+ static synchronized HTMLCleanupHandlerFactory getInstance() {
+ if (fInstance == null) {
+ fInstance = new HTMLCleanupHandlerFactory();
+ }
+ return fInstance;
+ }
+
+ private HTMLCleanupHandlerFactory() {
+ super();
+ }
+
+ IStructuredCleanupHandler createHandler(Node node, IStructuredCleanupPreferences cleanupPreferences) {
+ short nodeType = node.getNodeType();
+ IStructuredCleanupHandler handler = null;
+ switch (nodeType) {
+ case Node.ELEMENT_NODE :
+ {
+ if (isJSPTag(node))
+ handler = new JSPElementNodeCleanupHandler();
+ else
+ handler = new ElementNodeCleanupHandler();
+ break;
+ }
+ case Node.TEXT_NODE :
+ {
+ if (isParentStyleTag(node))
+ handler = new CSSTextNodeCleanupHandler();
+ else
+ handler = new NodeCleanupHandler();
+ break;
+ }
+ default :
+ {
+ handler = new NodeCleanupHandler();
+ }
+ }
+
+ handler.setCleanupPreferences(cleanupPreferences);
+
+ return handler;
+ }
+
+ private boolean isJSPTag(Node node) {
+ boolean result = false;
+
+ if (node instanceof XMLNode) {
+ IStructuredDocumentRegion flatNode = ((XMLNode) node).getFirstStructuredDocumentRegion();
+ // in some cases, the nodes exists, but hasn't been associated with
+ // a flatnode yet (the screen updates can be initiated on a different thread,
+ // so the request for a flatnode can come in before the node is fully formed.
+ // if the flatnode is null, we'll just allow the defaults to apply.
+ // (html adapter in this case).
+ if (flatNode != null) {
+ String flatNodeType = flatNode.getType();
+ if ((flatNodeType == XMLJSPRegionContexts.JSP_CONTENT) || (flatNodeType == XMLJSPRegionContexts.JSP_EXPRESSION_OPEN) || (flatNodeType == XMLJSPRegionContexts.JSP_SCRIPTLET_OPEN) || (flatNodeType == XMLJSPRegionContexts.JSP_DECLARATION_OPEN) || (flatNodeType == XMLJSPRegionContexts.JSP_DIRECTIVE_CLOSE) || (flatNodeType == XMLJSPRegionContexts.JSP_DIRECTIVE_NAME) || (flatNodeType == XMLJSPRegionContexts.JSP_DIRECTIVE_OPEN) || (flatNodeType == XMLJSPRegionContexts.JSP_CLOSE)) {
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private boolean isParentStyleTag(Node node) {
+ if (node == null)
+ return false;
+ if (node.getNodeType() != Node.TEXT_NODE)
+ return false;
+ if (!(node instanceof XMLNode))
+ return false;
+ IStructuredDocumentRegion flatNode = ((XMLNode) node).getFirstStructuredDocumentRegion();
+ if (flatNode == null)
+ return false;
+ if (flatNode.getType() != XMLRegionContext.BLOCK_TEXT)
+ return false;
+
+ // check if the parent is STYLE element
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return false;
+ if (parent.getNodeType() != Node.ELEMENT_NODE)
+ return false;
+ String name = parent.getNodeName();
+ if (name == null)
+ return false;
+ if (!name.equalsIgnoreCase("STYLE"))//$NON-NLS-1$
+ return false;
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupProcessorImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupProcessorImpl.java
new file mode 100644
index 0000000000..3c7d6f700d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/HTMLCleanupProcessorImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.html.core.format.HTMLFormatProcessorImpl;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupHandler;
+import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
+import org.eclipse.wst.xml.core.cleanup.CleanupProcessorXML;
+import org.w3c.dom.Node;
+
+public class HTMLCleanupProcessorImpl extends CleanupProcessorXML {
+
+ /**
+ * @see com.ibm.sed.partitionCleanup.AbstractCleanupProcessorImpl#getContentType()
+ */
+ protected String getContentType() {
+ return IContentTypeIdentifier.ContentTypeID_HTML;
+ }
+
+ /**
+ * @see com.ibm.sed.partitionCleanup.AbstractCleanupProcessorImpl#getCleanupHandler(com.ibm.sed.model.xml.XMLNode)
+ */
+ protected IStructuredCleanupHandler getCleanupHandler(Node node) {
+ return HTMLCleanupHandlerFactory.getInstance().createHandler(node, getCleanupPreferences());
+ }
+
+ protected IStructuredFormatProcessor getFormatProcessor() {
+ return new HTMLFormatProcessorImpl();
+ }
+
+ protected Preferences getModelPreferences() {
+ return HTMLCorePlugin.getDefault().getPluginPreferences();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/JSPElementNodeCleanupHandler.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/JSPElementNodeCleanupHandler.java
new file mode 100644
index 0000000000..c4143ad35f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/JSPElementNodeCleanupHandler.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+
+
+import org.w3c.dom.Node;
+
+public class JSPElementNodeCleanupHandler extends AbstractNodeCleanupHandler {
+
+ public Node cleanup(Node node) {
+ return node;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/NodeCleanupHandler.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/NodeCleanupHandler.java
new file mode 100644
index 0000000000..1e9c7d265e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/cleanup/NodeCleanupHandler.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.cleanup;
+
+
+
+import org.w3c.dom.Node;
+
+public class NodeCleanupHandler extends AbstractNodeCleanupHandler {
+
+ public Node cleanup(Node node) {
+ return node;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/commentelement/handlers/CommentElementHandlerForSSI.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/commentelement/handlers/CommentElementHandlerForSSI.java
new file mode 100644
index 0000000000..f24b10800f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/commentelement/handlers/CommentElementHandlerForSSI.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.commentelement.handlers;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.xml.core.commentelement.CommentElementHandler;
+import org.eclipse.wst.xml.core.commentelement.util.CommentElementFactory;
+import org.eclipse.wst.xml.core.commentelement.util.TagScanner;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLGenerator;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ */
+public class CommentElementHandlerForSSI implements CommentElementHandler {
+
+ /**
+ * @see com.ibm.sed.model.commentelement.CommentElementHandler#createElement(Document, String, boolean)
+ */
+ public Element createElement(Document document, String data, boolean isJSPTag) {
+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
+ if (modelQuery == null) {
+ return null;
+ }
+ CMDocument cm = modelQuery.getCorrespondingCMDocument(document);
+ if (cm == null) {
+ return null;
+ }
+ CMNamedNodeMap map = cm.getElements();
+ if (map == null) {
+ return null;
+ }
+
+ TagScanner scanner = new TagScanner(data, 1);
+ String name = scanner.nextName();
+ if (name == null) {
+ return null;
+ }
+ StringBuffer buffer = new StringBuffer(name.length() + 4);
+ buffer.append(SSI_PREFIX);
+ buffer.append(':');
+ buffer.append(name);
+ String tagName = buffer.toString();
+ // check if valid (defined) SSI tag or not
+ if (map.getNamedItem(tagName) == null) {
+ return null;
+ }
+
+ CommentElementFactory factory = new CommentElementFactory(document, isJSPTag, this);
+ Element element = factory.create(tagName, CommentElementFactory.IS_START);
+
+ // set attributes
+ String attrName = scanner.nextName();
+ while (attrName != null) {
+ String attrValue = scanner.nextValue();
+ Attr attr = document.createAttribute(attrName);
+ if (attr != null) {
+ if (attrValue != null)
+ attr.setValue(attrValue);
+ element.setAttributeNode(attr);
+ }
+ attrName = scanner.nextName();
+ }
+ return element;
+ }
+
+ /**
+ * @see com.ibm.sed.model.commentelement.CommentElementHandler#generateStartTagContent(XMLElement)
+ */
+ public String generateStartTagContent(XMLElement element) {
+ XMLGenerator generator = element.getModel().getGenerator();
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append('#');
+ buffer.append(element.getLocalName());
+
+ NamedNodeMap attributes = element.getAttributes();
+ int length = attributes.getLength();
+ for (int i = 0; i < length; i++) {
+ Attr attr = (Attr) attributes.item(i);
+ if (attr == null) {
+ continue;
+ }
+ buffer.append(' ');
+ String attrName = generator.generateAttrName(attr);
+ if (attrName != null) {
+ buffer.append(attrName);
+ }
+ String attrValue = generator.generateAttrValue(attr);
+ if (attrValue != null) {
+ // attr name only for HTML boolean and JSP
+ buffer.append('=');
+ buffer.append(attrValue);
+ }
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ * @see com.ibm.sed.model.commentelement.CommentElementHandler#generateEndTagContent(XMLElement)
+ */
+ public String generateEndTagContent(XMLElement element) {
+ return null; // always empty
+ }
+
+ public boolean isEmpty() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sed.model.commentelement.CommentElementHandler#isCommentElement(com.ibm.sed.model.xml.XMLElement)
+ */
+ public boolean isCommentElement(XMLElement element) {
+ if (element == null) {
+ return false;
+ }
+ Document document = element.getOwnerDocument();
+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
+ if (modelQuery == null) {
+ return false;
+ }
+ CMDocument cm = modelQuery.getCorrespondingCMDocument(document);
+ if (cm == null) {
+ return false;
+ }
+ CMNamedNodeMap map = cm.getElements();
+ if (map == null) {
+ return false;
+ }
+ String prefix = element.getPrefix();
+ if (prefix == null || !prefix.equals(SSI_PREFIX)) {
+ return false;
+ }
+ String tagName = element.getTagName();
+ if (tagName.length() <= 4) {
+ return false;
+ }
+ if (map.getNamedItem(tagName) == null) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ private static final String SSI_PREFIX = "ssi";//$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/AttributeCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/AttributeCollection.java
new file mode 100644
index 0000000000..435e8ccc82
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/AttributeCollection.java
@@ -0,0 +1,1295 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * Factory for attribute declarations.
+ */
+final class AttributeCollection extends CMNamedNodeMapImpl implements HTML40Namespace {
+
+ /** bodycolors. */
+ private static final String[] BODYCOLORS = {ATTR_NAME_BGCOLOR, ATTR_NAME_TEXT, ATTR_NAME_LINK, ATTR_NAME_VLINK, HTML40Namespace.ATTR_NAME_ALINK};
+ /** coreattrs. */
+ private static final String[] CORE = {ATTR_NAME_ID, ATTR_NAME_CLASS, ATTR_NAME_STYLE, ATTR_NAME_TITLE};
+ /** events. */
+ private static final String[] EVENTS = {ATTR_NAME_ONCLICK, ATTR_NAME_ONDBLCLICK, ATTR_NAME_ONMOUSEDOWN, ATTR_NAME_ONMOUSEUP, ATTR_NAME_ONMOUSEOVER, ATTR_NAME_ONMOUSEMOVE, ATTR_NAME_ONMOUSEOUT, ATTR_NAME_ONKEYPRESS, ATTR_NAME_ONKEYDOWN, ATTR_NAME_ONKEYUP, ATTR_NAME_ONHELP};
+ /** i18n. lang, dir */
+ private static final String[] I18N = {ATTR_NAME_LANG, ATTR_NAME_DIR};
+ /** cellhaligh. */
+ private static final String[] CELLHALIGN = {ATTR_NAME_CHAR, ATTR_NAME_CHAROFF};
+
+ /**
+ * constructor.
+ */
+ public AttributeCollection() {
+ super();
+ }
+
+ /**
+ * Create an attribute declaration.
+ * @return com.ibm.sed.contentmodel.html.HTMLAttrDeclImpl
+ * @param attrName java.lang.String
+ */
+ private HTMLAttrDeclImpl create(String attrName) {
+ HTMLAttrDeclImpl attr = null;
+ HTMLCMDataTypeImpl atype = null;
+
+ if (attrName.equalsIgnoreCase(ATTR_NAME_ABBR)) {
+ // (abbr %Text; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ABBR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ACCEPT)) {
+ // (accept %ContentTypes; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ACCEPT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ACCEPT_CHARSET)) {
+ // (accept-charset %Charsets;; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CHARSETS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ACCEPT_CHARSET, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ACTION)) {
+ // (action %URI #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ACTION, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ARCHIVE)) {
+ // (archive CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ARCHIVE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ACCESSKEY)) {
+ // (accesskey %Character; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CHARACTER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ACCESSKEY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ALINK)) {
+ // (alink %Color; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COLOR);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ALINK, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ALT)) {
+ // (alt %Text; #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ALT, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_AUTOSTART)) {
+ // (autostart (true|false) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOSTART, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_AUTOPLAY)) {
+ // (autoplay (true|false) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOPLAY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_AUTOSIZE)) {
+ // (autosize (true|false) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOSIZE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_AXIS)) {
+ // (axis CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_AXIS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BACKGROUND)) {
+ // (background %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BACKGROUND, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BEHAVIOR)) {
+ // (behavior (scroll|slide|alternate) scroll)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_SCROLL, ATTR_VALUE_SLIDE, ATTR_VALUE_ALTERNATE};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_SCROLL);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BEHAVIOR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BGCOLOR)) {
+ // (bgcolor %Color; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COLOR);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BGCOLOR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BORDER)) {
+ // (border %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BORDER, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CELLSPACING)) {
+ // (cellspacing %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CELLSPACING, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CELLPADDING)) {
+ // (cellpadding %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CELLPADDING, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CGI)) {
+ // (cgi %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CGI, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CHAR)) {
+ // (char %Character; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CHARACTER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CHAR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CHAROFF)) {
+ // (charoff %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CHAROFF, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CHARSET)) {
+ // (charset %Charset; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CHARSET);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CHARSET, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CITE)) {
+ // (cite %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CITE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CLASS)) {
+ // (class CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CLASS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CLASSID)) {
+ // (classid %URI #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CLASSID, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CMD)) {
+ // (cmd CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CMD, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CHECKED)) {
+ // (checked (checked) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_CHECKED};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CHECKED, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CLEAR)) {
+ // (clear (left | all | right | none) none)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_LEFT, ATTR_VALUE_ALL, ATTR_VALUE_RIGHT, ATTR_VALUE_NONE};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_NONE);
+
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CLEAR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CODE)) {
+ // (code CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CODE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CODEBASE)) {
+ // (codebase %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CODEBASE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CODETYPE)) {
+ // (codetype %CotentType; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CODETYPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_COLOR)) {
+ // (color %Color; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COLOR);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_COLOR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_COMPACT)) {
+ // (compact (compact) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_COMPACT};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_COMPACT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_COLS)) {
+ // (cols NUMBER #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_COLS, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_COLSPAN)) {
+ // (colspan NUMBER 1)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_1);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_COLSPAN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CONTENT)) {
+ // (content CDATA #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CONTENT, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CONTROLLER)) {
+ // (controller (true|false) true)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_TRUE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CONTROLLER, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_COORDS)) {
+ // (coords %Coords; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COORDS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_COORDS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DATA)) {
+ // (data %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DATA, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DATETIME)) {
+ // (datetime %Datetime; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.DATETIME);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DATETIME, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DATAPAGESIZE)) {
+ // (datapagesize CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DATAPAGESIZE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DECLARE)) {
+ // (declare (declare) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_DECLARE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DECLARE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DEFER)) {
+ // (defer (defer) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_DEFER};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DEFER, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DIR)) {
+ // (dir (ltr|rtl) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_LTR, ATTR_VALUE_RTL};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DIR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DIRECTION)) {
+ // (direction (left|right|up|down) left)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_LEFT, ATTR_VALUE_RIGHT, ATTR_VALUE_UP, ATTR_VALUE_DOWN};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DIRECTION, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DIRECTKEY)) {
+ // (directkey %Character; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CHARACTER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DIRECTKEY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_DISABLED)) {
+ // (disabled (disabled) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // boolean attribute must have the same value as its name.
+ String[] values = {ATTR_NAME_DISABLED};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_DISABLED, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ENCTYPE)) {
+ // (enctype %ContentType; "application/x-www-form-urlencoded")
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_WWW_FORM_URLENCODED);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ENCTYPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ERRMSG)) {
+ // (errmsg CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ERRMSG, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_EVENT)) {
+ // (event CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_EVENT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_FACE)) {
+ // (face CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_FACE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_FILE)) {
+ // (file %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_FILE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_FOR)) {
+ // (for %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_FOR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_FRAME)) {
+ // (frame %TFrame; #IMPLIED)
+ // %TFrame; is (void|above|below|hsides|lhs|rhs|vsides|box|border).
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_VOID, ATTR_VALUE_ABOVE, ATTR_VALUE_BELOW, ATTR_VALUE_HSIDES, ATTR_VALUE_LHS, ATTR_VALUE_RHS, ATTR_VALUE_VSIDES, ATTR_VALUE_BOX, ATTR_VALUE_BORDER};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_FRAME, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_FRAMEBORDER)) {
+ // (frameborder (1|0) 1)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_1, ATTR_VALUE_0};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_1);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_FRAMEBORDER, atype, CMAttributeDeclaration.OPTIONAL);
+
+ //<<D215684
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_FRAMESPACING)) {
+ // (framespacing CDATA; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_FRAMESPACING, atype, CMAttributeDeclaration.OPTIONAL);
+ //D215684
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HEADERS)) {
+ // (HEADERS IDREFS; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.IDREFS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HEADERS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HEIGHT)) {
+ // (height %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HEIGHT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HIDDEN)) {
+ // (hidden CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HIDDEN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HREF)) {
+ // (href %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HREF, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HREFLANG)) {
+ // (hreflang %LanguageCode; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LANGUAGE_CODE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HREFLANG, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HSPACE)) {
+ // (hspace %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HSPACE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HTTP_EQUIV)) {
+ // (http-equiv NAME #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.NAME);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HTTP_EQUIV, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ID)) {
+ // (id ID #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ID);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ID, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ISMAP)) {
+ // (ismap (ismap) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_ISMAP};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ISMAP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ISTYLE)) {
+ // (istyle CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ISTYLE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LABEL)) {
+ // (label %Text; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LABEL, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LANG)) {
+ // (lang %LanguageCode; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LANGUAGE_CODE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LANG, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LANGUAGE)) {
+ // (language %CDATA; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LANGUAGE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LINK)) {
+ // (link %Color; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COLOR);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LINK, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LONGDESC)) {
+ // (longdesc %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LONGDESC, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LOOP)) {
+ // (loop CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LOOP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MACRO)) {
+ // (macro CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MACRO, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MAPFILE)) {
+ // (mapfile %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MAPFILE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MARGINWIDTH)) {
+ // (marginwidth %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MARGINWIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MARGINHEIGHT)) {
+ // (marginheight %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MARGINHEIGHT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MAXLENGTH)) {
+ // (maxlength NUMBER #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MAXLENGTH, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MAYSCRIPT)) {
+ // (mayscript (mayscript) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_MAYSCRIPT};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MAYSCRIPT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MEDIA)) {
+ // (media %MediaDesc; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.MEDIA_DESC);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MEDIA, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_METHOD)) {
+ // (method (GET|POST) GET)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_GET, ATTR_VALUE_POST};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_GET);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_METHOD, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MULTIPLE)) {
+ // (multiple (multiple) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_MULTIPLE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MULTIPLE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NAME)) {
+ // (name CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NAME, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NOHREF)) {
+ // (nohref (nohref) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_NOHREF};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NOHREF, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NORESIZE)) {
+ // (noresize (noresize) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_NORESIZE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NORESIZE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NOSHADE)) {
+ // (noshade (noshade) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_NOSHADE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NOSHADE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NOWRAP)) {
+ // (nowrap (nowrap) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_NOWRAP};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NOWRAP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_OBJECT)) {
+ // (object CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_OBJECT};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_OBJECT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONBLUR)) {
+ // (onblur %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONBLUR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONCLICK)) {
+ // (onclick %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONCLICK, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONCHANGE)) {
+ // (onchange %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONCHANGE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONDBLCLICK)) {
+ // (ondblclick %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONDBLCLICK, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONFOCUS)) {
+ // (onfocus %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONFOCUS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONHELP)) {
+ // (onhelp %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONHELP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONKEYPRESS)) {
+ // (onkeypress %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONKEYPRESS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONKEYDOWN)) {
+ // (onkeydown %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONKEYDOWN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONKEYUP)) {
+ // (onkyeup %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONKEYUP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONLOAD)) {
+ // (onload %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONLOAD, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONMOUSEDOWN)) {
+ // (onmousedown %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONMOUSEDOWN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONMOUSEUP)) {
+ // (onmouseup %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONMOUSEUP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONMOUSEOVER)) {
+ // (onmouseover %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONMOUSEOVER, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONMOUSEMOVE)) {
+ // (onmousemove %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONMOUSEMOVE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONMOUSEOUT)) {
+ // (onmouseout %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONMOUSEOUT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONRESET)) {
+ // (onreset %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONRESET, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONSELECT)) {
+ // (onselect %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONSELECT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONSUBMIT)) {
+ // (onsubmit %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONSUBMIT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ONUNLOAD)) {
+ // (onunload %Script; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.SCRIPT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ONUNLOAD, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_PALETTE)) {
+ // (palette CDATA; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_PALETTE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_PANEL)) {
+ // (panel CDATA; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_PANEL, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_PLAYCOUNT)) {
+ // (playcount NUMBER; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_PLAYCOUNT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_PROFILE)) {
+ // (profile %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_PROFILE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_PROMPT)) {
+ // (prompt %Text; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_PROMPT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_READONLY)) {
+ // (readonly (readonly) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_READONLY};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_READONLY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_REPEAT)) {
+ // (repeat CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_REPEAT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_REL)) {
+ // (rel %LinkTypes; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LINK_TYPES);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_REL, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_REV)) {
+ // (rev %LinkTypes; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LINK_TYPES);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_REV, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ROWS)) {
+ // (rows NUMBER #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ROWS, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ROWSPAN)) {
+ // (rowspan NUMBER 1)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_1);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ROWSPAN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_RULES)) {
+ // (rules %TRules; #IMPLIED)
+ // %TRules; is (none | groups | rows | cols | all).
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_NONE, ATTR_VALUE_GROUPS, ATTR_VALUE_ROWS, ATTR_VALUE_COLS, ATTR_VALUE_ALL};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_RULES, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SCALE)) {
+ // (scale CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SCALE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SCHEME)) {
+ // (scheme CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SCHEME, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SELECTED)) {
+ // (selected (selected) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_SELECTED};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SELECTED, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SCOPE)) {
+ // (SCOPE %Scope; #IMPLIED)
+ // %Scope; is (row|col|rowgroup|colgroup)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_ROW, ATTR_VALUE_COL, ATTR_VALUE_ROWGROUP, ATTR_VALUE_COLGROUP};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SCOPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SCROLLAMOUNT)) {
+ // (scrollamount NUMBER #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SCROLLAMOUNT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SCROLLDELAY)) {
+ // (scrolldelay NUMBER #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SCROLLDELAY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SCROLLING)) {
+ // (scrolling (yes|no|auto) auto)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_YES, ATTR_VALUE_NO, ATTR_VALUE_AUTO};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_AUTO);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SCROLLING, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SHAPE)) {
+ // (shape %Shape; rect): %Shape; is (rect|circle|poly|default).
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_RECT, ATTR_VALUE_CIRCLE, ATTR_VALUE_POLY, ATTR_VALUE_DEFAULT};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_RECT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SHAPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SHOWCONTROLS)) {
+ // (showcontrols (true|false) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SHOWCONTROLS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SIZE)) {
+ // (size %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SIZEFMT)) {
+ // (sizefmt CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SIZEFMT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SPAN)) {
+ // (span NUMBER 1)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_1);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SPAN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SRC)) {
+ // (src %URI; #IMPLIED)
+ // NOTE: "src" attributes are defined in several elements.
+ // The definition of IMG is different from others.
+ // So, it should be locally defined.
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SRC, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_START)) {
+ // (start NUMBER #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_START, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_STANDBY)) {
+ // (standby %Text; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_STANDBY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_STYLE)) {
+ // (style %StyleSheet; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.STYLE_SHEET);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_STYLE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SUMMARY)) {
+ // (summary %Text; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SUMMARY, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TABINDEX)) {
+ // (tabindex NUMBER #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TABINDEX, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TARGET)) {
+ // (target %FrameTarget; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.FRAME_TARGET);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TARGET, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TEXT)) {
+ // (text CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TEXT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TEXTFOCUS)) {
+ // (textfocus CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TEXTFOCUS, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TITLE)) {
+ // (title %Text; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TITLE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TIMEFMT)) {
+ // (timefmt CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TIMEFMT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TRUESPEED)) {
+ // (truespeed (truespeed) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_TRUESPEED};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TRUESPEED, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TYPE)) {
+ // (type %CotentType; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_USEMAP)) {
+ // (usemap %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_USEMAP, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VALIGN)) {
+ // (valign (top|middle|bottom|baseline) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TOP, ATTR_VALUE_MIDDLE, ATTR_VALUE_BOTTOM, ATTR_VALUE_BASELINE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VALUE)) {
+ // (value CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VALUE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VALUETYPE)) {
+ // (valuetype (DATA|REF|OBJECT) DATA)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_DATA, ATTR_VALUE_REF, ATTR_VALUE_OBJECT};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_DATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VALUETYPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VAR)) {
+ // (var CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VAR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VERSION)) {
+ // (version CDATA #FIXED '%HTML.Version;)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_FIXED, ATTR_VALUE_VERSION_TRANSITIONAL);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VERSION, atype, CMAttributeDeclaration.FIXED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VIRTUAL)) {
+ // (virtual %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VIRTUAL, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VLINK)) {
+ // (vlink %Color; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COLOR);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VLINK, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VOLUME)) {
+ // (volume CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VOLUME, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_WIDTH)) {
+ // (width %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VSPACE)) {
+ // (vspace %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VSPACE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ // <<D205514
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TOPMARGIN)) {
+ // (topmargin, CDATA, #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TOPMARGIN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BOTTOMMARGIN)) {
+ // (bottommargin, CDATA, #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BOTTOMMARGIN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_LEFTMARGIN)) {
+ // (leftmargin, CDATA, #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_LEFTMARGIN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_RIGHTMARGIN)) {
+ // (rightmargin, CDATA, #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_RIGHTMARGIN, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BORDERCOLOR)) {
+ // (bordercolor, %Color; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.COLOR);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BORDERCOLOR, atype, CMAttributeDeclaration.OPTIONAL);
+ // D205514
+
+ }
+ else {
+ // unknown attribute; maybe error.
+ // should warn.
+ attr = null;
+ }
+
+ return attr;
+ }
+
+ /**
+ * Get align attribute which has %CAlign; as values..
+ * At this time (4/19/2001), it is identical to %LAlign;.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public static final HTMLAttrDeclImpl createAlignForCaption() {
+ // align (local)
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values
+ String[] values = {ATTR_VALUE_TOP, ATTR_VALUE_BOTTOM, ATTR_VALUE_LEFT, ATTR_VALUE_RIGHT};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ return attr;
+ }
+
+ /**
+ * Get align attribute which has %IAlign; as values..
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public static final HTMLAttrDeclImpl createAlignForImage() {
+ // align (local)
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values
+ String[] values = {ATTR_VALUE_TOP, ATTR_VALUE_MIDDLE, ATTR_VALUE_BOTTOM, ATTR_VALUE_LEFT, ATTR_VALUE_RIGHT};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ return attr;
+ }
+
+ /**
+ * Get align attribute which has %LAlign; as values..
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public static final HTMLAttrDeclImpl createAlignForLegend() {
+ // align (local)
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values
+ String[] values = {ATTR_VALUE_TOP, ATTR_VALUE_BOTTOM, ATTR_VALUE_LEFT, ATTR_VALUE_RIGHT};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ return attr;
+ }
+
+ /**
+ * Create an attribute declaration for <code>align</code>
+ * in several elements, like <code>P</code>, <code>DIV</code>.
+ * The values are different from attributes those have the same name
+ * in other elements (<code>IMG</code> and <code>TABLE</code>).
+ * So, it can't treat as global attributes.
+ * <strong>NOTE: These attribute declaration has
+ * no owner CMDocument instance.</strong>
+ * @return com.ibm.sed.contentmodel.html.HTMLAttrDeclImpl
+ */
+ public static final HTMLAttrDeclImpl createAlignForParagraph() {
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values: left|center|right|justify
+ String[] values = {ATTR_VALUE_LEFT, ATTR_VALUE_CENTER, ATTR_VALUE_RIGHT, ATTR_VALUE_JUSTIFY};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ return attr;
+ }
+
+ /**
+ * Get %attrs; declarations.
+ * %attrs; consists of %coreattrs;, %i18n, and %events;.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getAttrs(CMNamedNodeMapImpl declarations) {
+ // %coreattrs;
+ Iterator names = Arrays.asList(CORE).iterator();
+ getDeclarations(declarations, names);
+ // %i18n;
+ names = Arrays.asList(I18N).iterator();
+ getDeclarations(declarations, names);
+ // %events;
+ names = Arrays.asList(EVENTS).iterator();
+ getDeclarations(declarations, names);
+ }
+
+ /**
+ * Get %bodycolors; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getBodycolors(CMNamedNodeMapImpl declarations) {
+ Iterator names = Arrays.asList(BODYCOLORS).iterator();
+ getDeclarations(declarations, names);
+ }
+
+ /**
+ * Get %cellhalign; declarations.
+ * %cellhaligh; consists of:
+ * - (align (left|center|right|justify|char) #IMPLIED)
+ * - (char %Character; #IMPLIED)
+ * - (charoff %Length; #IMPLIED)
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getCellhalign(CMNamedNodeMapImpl declarations) {
+ // (align (left|center|right|justify|char) #IMPLIED) should be defined
+ // locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values
+ String[] values = {ATTR_VALUE_LEFT, ATTR_VALUE_CENTER, ATTR_VALUE_RIGHT, ATTR_VALUE_JUSTIFY, ATTR_VALUE_CHAR};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ declarations.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+
+ // the rest.
+ Iterator names = Arrays.asList(CELLHALIGN).iterator();
+ getDeclarations(declarations, names);
+ }
+
+ /**
+ * Get %cellvalign; declarations.
+ * %cellhaligh; is:
+ * - (valign (top|middle|bottom|baseline) #IMPLIED)
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getCellvalign(CMNamedNodeMapImpl declarations) {
+ HTMLAttributeDeclaration dec = getDeclaration(HTML40Namespace.ATTR_NAME_VALIGN);
+ if (dec != null)
+ declarations.putNamedItem(HTML40Namespace.ATTR_NAME_VALIGN, dec);
+ }
+
+ /**
+ * Get %coreattrs; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getCore(CMNamedNodeMapImpl declarations) {
+ Iterator names = Arrays.asList(CORE).iterator();
+ getDeclarations(declarations, names);
+ }
+
+ /**
+ * Get a global attribute declaration.
+ * @return com.ibm.sed.contentmodel.html.HTMLAttrributeDeclaration
+ * @param attrName java.lang.String
+ */
+ public HTMLAttributeDeclaration getDeclaration(String attrName) {
+ CMNode cmnode = getNamedItem(attrName);
+ if (cmnode != null)
+ return (HTMLAttributeDeclaration) cmnode; // already exists.
+
+ HTMLAttrDeclImpl dec = create(attrName);
+ if (dec != null)
+ putNamedItem(attrName, dec);
+
+ return dec;
+ }
+
+ /**
+ * Get declarations which are specified by names.
+ * @param declarations com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ * @param names java.util.Iterator
+ */
+ public void getDeclarations(CMNamedNodeMapImpl declarations, Iterator names) {
+ while (names.hasNext()) {
+ String attrName = (String) names.next();
+ HTMLAttributeDeclaration dec = getDeclaration(attrName);
+ if (dec != null)
+ declarations.putNamedItem(attrName, dec);
+ }
+ }
+
+ /**
+ * Get %events; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getEvents(CMNamedNodeMapImpl declarations) {
+ Iterator names = Arrays.asList(EVENTS).iterator();
+ getDeclarations(declarations, names);
+ }
+
+ /**
+ * Get %i18n; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getI18n(CMNamedNodeMapImpl declarations) {
+ Iterator names = Arrays.asList(I18N).iterator();
+ getDeclarations(declarations, names);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMContentImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMContentImpl.java
new file mode 100644
index 0000000000..20341fb6aa
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMContentImpl.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+
+
+
+/**
+ * Implementation of CMContent for HTML CM.
+ */
+abstract class CMContentImpl extends CMNodeImpl implements CMContent {
+
+ public static final int UNBOUNDED = -1;
+ /** -1: it's UNBOUNDED. */
+ private int maxOccur = UNBOUNDED;
+ /** 0: it's OPTIONAL, 1, it's REQUIRED. */
+ private int minOccur = 0;
+
+ /**
+ * The primary consturctor.
+ * Use this one for usual cases.<br>
+ */
+ public CMContentImpl(String name, int min, int max) {
+ super(name);
+ minOccur = min;
+ maxOccur = max;
+ }
+
+ /**
+ * getMaxOccur method
+ * @return int
+ *
+ * If -1, it's UNBOUNDED.
+ */
+ public int getMaxOccur() {
+ return maxOccur;
+ }
+
+ /**
+ * getMinOccur method
+ * @return int
+ *
+ * If 0, it's OPTIONAL.
+ * If 1, it's REQUIRED.
+ */
+ public int getMinOccur() {
+ return minOccur;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMGroupImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMGroupImpl.java
new file mode 100644
index 0000000000..cbbe37f4df
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMGroupImpl.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.CMNodeList;
+
+/**
+ */
+class CMGroupImpl extends CMContentImpl implements CMGroup {
+
+ private int operator = CMGroup.SEQUENCE;
+ private CMNodeListImpl children = null;
+
+ /**
+ * CMGroupImpl constructor comment.
+ */
+ public CMGroupImpl(int op, int minOccur, int maxOccur) {
+ super(null, minOccur, maxOccur);
+ switch (op) {
+ case CMGroup.ALL :
+ case CMGroup.CHOICE :
+ case CMGroup.SEQUENCE :
+ operator = op;
+ break;
+ default :
+ // should warn.
+ break;
+ }
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param org.eclipse.wst.common.contentmodel.CMNode
+ */
+ protected CMNode appendChild(CMNode child) {
+ if (child == null)
+ return null;
+ if (children == null)
+ children = new CMNodeListImpl();
+ return children.appendNode(child);
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNodeList
+ */
+ public CMNodeList getChildNodes() {
+ return children;
+ }
+
+ /**
+ * getNodeType method
+ * @return int
+ *
+ * Returns one of :
+ * ELEMENT_DECLARATION, ATTRIBUTE_DECLARATION, GROUP, ENTITY_DECLARATION.
+ */
+ public int getNodeType() {
+ return CMNode.GROUP;
+ }
+
+ /**
+ * getOperation method
+ * @return int
+ *
+ * Returns one of :
+ * ALONE (a), SEQUENCE (a,b), CHOICE (a|b), ALL (a&b).
+ */
+ public int getOperator() {
+ return operator;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamedNodeMapImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamedNodeMapImpl.java
new file mode 100644
index 0000000000..ac775f61df
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamedNodeMapImpl.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * An implementation of the CMNamedNodeMap interface.
+ * This class is intented to be used as a container of attribute declarations.
+ * If someone wants to use this class for other purpose, he must pay attention
+ * to the fact that this class is tolerant of the key name case. That is, this
+ * class does not distinguish "name", "NAME", and "Name" as a key name.
+ */
+class CMNamedNodeMapImpl implements CMNamedNodeMap {
+
+ private Hashtable items = null;
+
+ /**
+ */
+ public CMNamedNodeMapImpl() {
+ super();
+ items = new Hashtable();
+ }
+
+ /**
+ * getLength method
+ * @return int
+ */
+ public int getLength() {
+ return items.size();
+ }
+
+ /**
+ * getNamedItem method
+ * @return CMNode <code>null</code> for unknown keys.
+ * @param name java.lang.String
+ */
+ public CMNode getNamedItem(String name) {
+ String cookedName = makeCanonicalForm(name);
+ if (!items.containsKey(cookedName))
+ return null;
+ return (CMNode) items.get(cookedName);
+ }
+
+ /**
+ * item method
+ * @return CMNode
+ * @param index int
+ */
+ public CMNode item(int index) {
+ Iterator iter = iterator();
+ while (iter.hasNext()) {
+ CMNode node = (CMNode) iter.next();
+ if (--index < 0)
+ return node;
+ }
+ return null;
+ }
+
+ /**
+ * @return java.util.Iterator
+ */
+ public Iterator iterator() {
+ return items.values().iterator();
+ }
+
+ /**
+ * @return java.lang.String
+ * @param rawForm java.lang.String
+ */
+ private String makeCanonicalForm(String rawForm) {
+ return rawForm.toUpperCase();
+ }
+
+ /**
+ * @param key java.lang.String
+ * @param item java.lang.String
+ */
+ void putNamedItem(String name, CMNode item) {
+ String cookedName = makeCanonicalForm(name);
+ if (items.containsKey(cookedName))
+ return; // already registered.
+ items.put(cookedName, item);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamespaceImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamespaceImpl.java
new file mode 100644
index 0000000000..f24a601225
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNamespaceImpl.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamespace;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * CMNamespace implementation.
+ */
+class CMNamespaceImpl extends CMNodeImpl implements CMNamespace {
+
+ private java.lang.String prefix = null;
+
+ /**
+ * CMNamespaceImpl constructor comment.
+ */
+ public CMNamespaceImpl(String uri, String pfx) {
+ super(uri);
+ prefix = pfx;
+ }
+
+ /**
+ * getNodeType method
+ * @return int
+ *
+ * Returns one of :
+ *
+ */
+ public int getNodeType() {
+ return CMNode.NAME_SPACE;
+ }
+
+ /**
+ * getPrefix method
+ * @return java.lang.String
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * getURI method
+ * @return java.lang.String
+ */
+ public String getURI() {
+ return getNodeName();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeImpl.java
new file mode 100644
index 0000000000..9c45f16e0e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeImpl.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+
+
+/**
+ */
+abstract class CMNodeImpl implements CMNode {
+
+ private java.lang.String name = null;
+
+ /**
+ * CMNodeImpl constructor comment.
+ */
+ public CMNodeImpl(String nm) {
+ super();
+ name = nm;
+ }
+
+ /**
+ * getNodeName method
+ * @return java.lang.String
+ */
+ public String getNodeName() {
+ return name;
+ }
+
+ /**
+ * getProperty method
+ * @return java.lang.Object
+ *
+ * Returns the object property desciped by the propertyName
+ *
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.IS_XHTML))
+ return new Boolean(false);
+ return null;
+ }
+
+ /**
+ * supports method
+ * @return boolean
+ *
+ * Returns true if the CMNode supports a specified property
+ *
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.IS_XHTML))
+ return true;
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeListImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeListImpl.java
new file mode 100644
index 0000000000..a821fc51b9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CMNodeListImpl.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.CMNodeList;
+
+/**
+ * Analog of dom.NodeList for CM.
+ * So, the implementation is very similar to
+ * {@link com.ibm.sed.model.xml.NodeListImpl}.<br>
+ */
+class CMNodeListImpl implements CMNodeList {
+
+ private java.util.Vector nodes = null;
+
+ /**
+ * CMNodeListImpl constructor comment.
+ */
+ public CMNodeListImpl() {
+ super();
+ nodes = new java.util.Vector();
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param node org.eclipse.wst.common.contentmodel.CMNode
+ */
+ protected CMNode appendNode(CMNode node) {
+ nodes.addElement(node);
+ return node;
+ }
+
+ /**
+ * getLength method
+ * @return int
+ */
+ public int getLength() {
+ return nodes.size();
+ }
+
+ /**
+ * item method
+ * @return CMNode
+ * @param index int
+ */
+ public CMNode item(int index) {
+ if (index < 0 || index >= nodes.size())
+ return null;
+ return (CMNode) nodes.elementAt(index);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinition.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinition.java
new file mode 100644
index 0000000000..8ddb7732e2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinition.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMGroup;
+
+/**
+ * This class is intended to represent a complex type definition
+ * in XML Schema.<br>
+ */
+abstract class ComplexTypeDefinition {
+
+ protected CMGroupImpl content = null;
+ protected ElementCollection collection = null;
+ protected String primaryCandidateName = null;
+
+ /**
+ * ComplexTypeDefinition constructor comment.
+ */
+ public ComplexTypeDefinition(ElementCollection elementCollection) {
+ super();
+ collection = elementCollection;
+ createContent();
+ }
+
+ /**
+ * Create an actual content model.
+ * This method should be called once and only once in the constructor.<br>
+ */
+ protected abstract void createContent();
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMGroup
+ */
+ public CMGroup getContent() {
+ return content;
+ }
+
+ /**
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ /* NOTE: Do we need LOGICAL type?
+ * -- 3/7/2001
+ */
+ public abstract int getContentType();
+
+ /**
+ * Get content hint.
+ * @return com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public HTMLElementDeclaration getPrimaryCandidate() {
+ if (primaryCandidateName == null)
+ return null;
+ return (HTMLElementDeclaration) collection.getNamedItem(primaryCandidateName);
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public abstract String getTypeName();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinitionFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinitionFactory.java
new file mode 100644
index 0000000000..ecf6f04002
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ComplexTypeDefinitionFactory.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * Factory of ComplexTypeDefinition.
+ */
+final class ComplexTypeDefinitionFactory {
+
+ private static ComplexTypeDefinitionFactory instance = null;
+ private java.util.Hashtable definitions = null;
+ // constants for complex type name
+ /** for ADDRESS. */
+ public final static String CTYPE_ADDRESS = "CTYPE_ADDRESS";//$NON-NLS-1$
+ /** CDATA content. No ComplexTypeDefinition instance shuld be created. */
+ public final static String CTYPE_CDATA = "CTYPE_CDATA";//$NON-NLS-1$
+ /** col group content. COL* */
+ public final static String CTYPE_COLUMN_GROUP = "CTYPE_COLUMN_GROUP";//$NON-NLS-1$
+ /** for DL. */
+ public final static String CTYPE_DEFINITION_LIST = "CTYPE_DEFINITION_LIST";//$NON-NLS-1$
+ /** for EMBED. */
+ public final static String CTYPE_EMBED = "CTYPE_EMBED";//$NON-NLS-1$
+ /** empty content. No ComplexTypeDefinition instance should be created. */
+ public final static String CTYPE_EMPTY = "CTYPE_EMPTY";//$NON-NLS-1$
+ /** for FIELDSET. */
+ public final static String CTYPE_FIELDSET = "CTYPE_FIELDSET";//$NON-NLS-1$
+ /** for FRAMESET. */
+ public final static String CTYPE_FRAMESET = "CTYPE_FRAMESET";//$NON-NLS-1$
+ /** flow content. (%flow;)* */
+ public final static String CTYPE_FLOW_CONTAINER = "CTYPE_FLOW_CONTAINER";//$NON-NLS-1$
+ /** html content. HEAD, (FRAMESET|BODY) */
+ public final static String CTYPE_HTML = "CTYPE_HTML";//$NON-NLS-1$
+ /** head content. TITLE & ISINDEX? & BASE? */
+ public final static String CTYPE_HEAD = "CTYPE_HEAD";//$NON-NLS-1$
+ /** inline content. (%inline;)* */
+ public final static String CTYPE_INLINE_CONTAINER = "CTYPE_INLINE_CONTAINER";//$NON-NLS-1$
+ /** list item container. (LI)+ */
+ public final static String CTYPE_LI_CONTAINER = "CTYPE_LI_CONTAINER";//$NON-NLS-1$
+ /** for MAP. */
+ public final static String CTYPE_MAP = "CTYPE_MAP";//$NON-NLS-1$
+ /** noframes content. */
+ public final static String CTYPE_NOFRAMES_CONTENT = "CTYPE_NOFRAMES_CONTENT";//$NON-NLS-1$
+ /** for OPTGROUP. */
+ public final static String CTYPE_OPTION_CONTAINER = "CTYPE_OPTION_CONTAINER";//$NON-NLS-1$
+ /** param container. For OBJECT/APPLET. */
+ public final static String CTYPE_PARAM_CONTAINER = "CTYPE_PARAM_CONTAINER";//$NON-NLS-1$
+ /** PCDATA content. No ComplexTypeDefinition instance shuld be created. */
+ public final static String CTYPE_PCDATA = "CTYPE_PCDATA";//$NON-NLS-1$
+ /** for SELECT. */
+ public final static String CTYPE_SELECT = "CTYPE_SELECT";//$NON-NLS-1$
+ /** table content. CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+ */
+ public final static String CTYPE_TABLE = "CTYPE_TABLE";//$NON-NLS-1$
+ /** table cell contaier. (TH|TD)+ */
+ public final static String CTYPE_TCELL_CONTAINER = "CTYPE_TCELL_CONTAINER";//$NON-NLS-1$
+ /** table record container. (TR)+ */
+ public final static String CTYPE_TR_CONTAINER = "CTYPE_TR_CONTAINER";//$NON-NLS-1$
+
+ /**
+ * ComplexTypeDefinitionFactory constructor comment.
+ */
+ private ComplexTypeDefinitionFactory() {
+ super();
+ definitions = new java.util.Hashtable();
+ }
+
+ /**
+ * Factory method for ComplexTypeDefinition.
+ * Each instance created in this method must be registered into
+ * the map with its name.
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ * @param definitionName java.lang.String
+ * @param elementCollection ElementCollection
+ */
+ public ComplexTypeDefinition createTypeDefinition(String definitionName, ElementCollection elementCollection) {
+ if (definitions.containsKey(definitionName)) {
+ return (ComplexTypeDefinition) definitions.get(definitionName);
+ }
+
+ ComplexTypeDefinition def = null;
+ if (definitionName == CTYPE_ADDRESS) {
+ def = new CtdAddress(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_COLUMN_GROUP) {
+ def = new CtdColumnGroup(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_DEFINITION_LIST) {
+ def = new CtdDl(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_EMBED) {
+ def = new CtdEmbed(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_FIELDSET) {
+ def = new CtdFieldset(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_FLOW_CONTAINER) {
+ def = new CtdFlowContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_FRAMESET) {
+ def = new CtdFrameset(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_HEAD) {
+ def = new CtdHead(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_HTML) {
+ def = new CtdHtml(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_INLINE_CONTAINER) {
+ def = new CtdInlineContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_LI_CONTAINER) {
+ def = new CtdLiContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_MAP) {
+ def = new CtdMap(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_NOFRAMES_CONTENT) {
+ def = new CtdNoframesContent(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_OPTION_CONTAINER) {
+ def = new CtdOptionContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_PARAM_CONTAINER) {
+ def = new CtdParamContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_SELECT) {
+ def = new CtdSelect(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_TABLE) {
+ def = new CtdTable(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_TCELL_CONTAINER) {
+ def = new CtdTableCellContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_TR_CONTAINER) {
+ def = new CtdTrContainer(elementCollection);
+
+ }
+ else {
+ def = null;
+ }
+ if (def == null)
+ return null; // fail to create.
+ definitions.put(definitionName, def);
+ return def;
+ }
+
+ /**
+ * For singleton.<br>
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinitionFactory
+ */
+ public synchronized static ComplexTypeDefinitionFactory getInstance() {
+ if (instance != null)
+ return instance;
+ instance = new ComplexTypeDefinitionFactory();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdAddress.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdAddress.java
new file mode 100644
index 0000000000..a524a1cd73
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdAddress.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for ADDRESS.
+ */
+final class CtdAddress extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdAddress(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * ((%inline) | P)*.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )*
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ // (%inline)
+ CMGroupImpl inlines = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (inlines == null)
+ return;
+ collection.getInline(inlines);
+ content.appendChild(inlines);
+ // P
+ CMNode p = collection.getNamedItem(HTML40Namespace.ElementName.P);
+ if (p != null)
+ content.appendChild(p);
+ }
+
+ /**
+ * ((%inline) | P)*.
+ * Because %inline; contains #PCDATA, the type is MIXED.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_ADDRESS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdColumnGroup.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdColumnGroup.java
new file mode 100644
index 0000000000..f3b8e5585a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdColumnGroup.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * COL group.
+ * (COL)*
+ */
+final class CtdColumnGroup extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdColumnGroup(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * (COL)*
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )*
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
+ // COL
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.COL);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (COL)*
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_COLUMN_GROUP;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdDl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdDl.java
new file mode 100644
index 0000000000..abd3dd42ab
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdDl.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for DL.
+ */
+final class CtdDl extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdDl(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.DT;
+ }
+
+ /**
+ * (DT | DD)+
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )+
+ content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ // DT
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.DT);
+ if (dec != null)
+ content.appendChild(dec);
+ // DD
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.DD);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (DT | DD)+.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_DEFINITION_LIST;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdEmbed.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdEmbed.java
new file mode 100644
index 0000000000..f5abdd5bcb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdEmbed.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for EMBED.
+ */
+final class CtdEmbed extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdEmbed(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.NOEMBED;
+ }
+
+ /**
+ * (NOEMBED).
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ // NOEMBED
+ CMNode noembed = collection.getNamedItem(HTML40Namespace.ElementName.NOEMBED);
+ if (noembed != null)
+ content.appendChild(noembed);
+ }
+
+ /**
+ * (NOEMBED).
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_EMBED;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFieldset.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFieldset.java
new file mode 100644
index 0000000000..e54e8f5e65
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFieldset.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for FIELDSET.
+ */
+final class CtdFieldset extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdFieldset(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.LEGEND;
+ }
+
+ /**
+ * (#PCDATA, LEGEND, (%flow;)*)
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( , , )
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ // #PCDATA
+ // ...??
+
+ // LEGEND
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.LEGEND);
+ if (dec != null)
+ content.appendChild(dec);
+ // (%flow;)*
+ CMGroupImpl flows = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ if (flows == null)
+ return;
+ collection.getFlow(flows);
+ content.appendChild(flows);
+ }
+
+ /**
+ * (#PCDATA, LEGEND, (%flow;)*)
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_FIELDSET;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFlowContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFlowContainer.java
new file mode 100644
index 0000000000..7b202bea5c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFlowContainer.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+
+/**
+ * Complex type definition for containers of <code>%flow;</code>.
+ */
+final class CtdFlowContainer extends ComplexTypeDefinition {
+
+ /**
+ */
+ public CtdFlowContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * (%flow;)*
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ collection.getFlow(content);
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_FLOW_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFrameset.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFrameset.java
new file mode 100644
index 0000000000..759d983ad4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdFrameset.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for FRAMESET.
+ * ((FRAMESET | FRAME)+ & NOFRAMES?)
+ */
+final class CtdFrameset extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdFrameset(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.FRAME;
+ }
+
+ /**
+ * ((FRAMESET | FRAME)+ & NOFRAMES?).
+ * --> ((FRAMESET | FRAME)+ & (NOFRAMES)?)
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( & )
+ content = new CMGroupImpl(CMGroup.ALL, 1, 1);
+
+ // ( | )+
+ CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ if (group == null)
+ return;
+ content.appendChild(group);
+
+ // FRAMESET
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.FRAMESET);
+ if (dec != null)
+ group.appendChild(dec);
+ // FRAME
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.FRAME);
+ if (dec != null)
+ group.appendChild(dec);
+
+ // ( )?
+ group = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
+ if (group == null)
+ return;
+ content.appendChild(group);
+
+ // NOFRAMES
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.NOFRAMES);
+ if (dec != null)
+ group.appendChild(dec);
+ }
+
+ /**
+ * ((FRAMESET | FRAME)+ & NOFRAMES?)
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_FRAMESET;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHead.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHead.java
new file mode 100644
index 0000000000..684241edd8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHead.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * Complex type definition for the head content.
+ * Content Model: (TITLE & ISINDEX? & BASE?)
+ */
+final class CtdHead extends ComplexTypeDefinition {
+
+ /**
+ */
+ public CtdHead(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.TITLE;
+ }
+
+ /**
+ * for HEAD.
+ * To avoid using inclusion, the content model comes from the XHTML 1.0.
+ *
+ * (%head.misc;, ((title, %head.misc;, (base, %head.misc;)?) | (base, %head.misc;, (title, %head.misc;))))
+ * And %head.misc; is:
+ * (script|style|meta|link|object|isindex)*
+ *
+ * 0: (%head.misc, A)
+ * A: (B | C)
+ * B: (title, %head.misc;, D)
+ * C: (base, %head.misc;, E)
+ * D: (base, %head.misc;)?
+ * E: (title, %head.misc;)
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // At 1st, create %head.misc; content.
+ // %head.misc;
+ // ( | )*
+ CMGroupImpl misc = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ if (misc == null)
+ return;
+ String[] names = {HTML40Namespace.ElementName.SCRIPT, HTML40Namespace.ElementName.STYLE, HTML40Namespace.ElementName.META, HTML40Namespace.ElementName.LINK, HTML40Namespace.ElementName.OBJECT, HTML40Namespace.ElementName.ISINDEX};
+ collection.getDeclarations(misc, Arrays.asList(names).iterator());
+ // 2nd, get a title
+ CMNode title = collection.getNamedItem(HTML40Namespace.ElementName.TITLE);
+ // 3rd, get a base
+ CMNode base = collection.getNamedItem(HTML40Namespace.ElementName.BASE);
+ if (title == null || base == null)
+ return;
+
+ // Top level content is a sequence of %head.misc; and A.
+ // 0: (%head.misc;, A)
+ // create a sequence
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (content == null)
+ return;
+ // append %head.misc;
+ content.appendChild(misc);
+ // create A and append it to the top level.
+ {
+ // A is a choice of B and C.
+ // A: (B | C)
+ // create a choice
+ CMGroupImpl gA = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (gA == null)
+ return;
+ // append A to the top level.
+ content.appendChild(gA);
+
+ // create B and append it to A
+ {
+ // B is a sequence of title, %head.misc;, and D.
+ // B: (title, %head.misc;, D)
+ // create a sequence
+ CMGroupImpl gB = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (gB == null)
+ return;
+ // append B to A.
+ gA.appendChild(gB);
+
+ // append title to B
+ gB.appendChild(title);
+ // append %head.misc; to B
+ gB.appendChild(misc);
+ // create D and append it to B.
+ {
+ // D is a sequence of base, %head.misc;.
+ // D: (base, %head.misc;)?
+ // create a sequence
+ CMGroupImpl gD = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
+ if (gD == null)
+ return;
+ // append D to B.
+ gB.appendChild(gD);
+
+ // append base to D
+ gD.appendChild(base);
+ // append %head.misc; to D.
+ gD.appendChild(misc);
+ }
+ }
+ // create C and append it to A
+ {
+ // C is a sequence of base, %head.misc;, and E
+ // C: (base, %head.misc;, E)
+ // create a sequence
+ CMGroupImpl gC = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (gC == null)
+ return;
+ // append C to A.
+ gA.appendChild(gC);
+
+ // append base to C
+ gC.appendChild(base);
+ // append %head.misc; to C
+ gC.appendChild(misc);
+
+ // create E and append it to C.
+ {
+ // E is a sequence of title and %head.misc;.
+ // E: (title, %head.misc;)
+ // create a sequence
+ CMGroupImpl gE = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (gE == null)
+ return;
+ // append E to C.
+ gC.appendChild(gE);
+
+ // append title to E
+ gE.appendChild(title);
+ // append %head.misc; to E.
+ gE.appendChild(misc);
+ }
+ }
+ }
+ }
+
+ /**
+ * Element content.<br>
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_HEAD;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHtml.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHtml.java
new file mode 100644
index 0000000000..b13ba6bd42
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdHtml.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * Complex type definition for <code>HTML</code>.<br>
+ * Content Model:
+ * HEAD, (FRAMESET|BODY)<br>
+ */
+final class CtdHtml extends ComplexTypeDefinition {
+
+ /**
+ */
+ public CtdHtml(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.HEAD;
+ }
+
+ /**
+ * (%html.content;).
+ * %html.content; is HEAD, (FRAMESET | BODY).
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (content == null)
+ return;
+
+ // HEAD
+ CMNode edec = collection.getNamedItem(HTML40Namespace.ElementName.HEAD);
+ if (edec != null)
+ content.appendChild(edec);
+
+ // ( | )
+ CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ content.appendChild(group);
+
+ // FRAMESET, BODY
+ String[] names = {HTML40Namespace.ElementName.FRAMESET, HTML40Namespace.ElementName.BODY};
+ collection.getDeclarations(group, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Element content.
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_HTML;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdInlineContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdInlineContainer.java
new file mode 100644
index 0000000000..09ee6b80fa
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdInlineContainer.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+
+/**
+ * Complex type definition for (%inline;)*.
+ */
+final class CtdInlineContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdInlineContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * (%inline)*.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ collection.getInline(content);
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_INLINE_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdLiContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdLiContainer.java
new file mode 100644
index 0000000000..4f56f0d569
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdLiContainer.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * List item container.
+ * (LI)+
+ */
+final class CtdLiContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elemenCollection ElementCollection
+ */
+ public CtdLiContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.LI;
+ }
+
+ /**
+ * (LI)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // (LI)+
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ CMNode li = collection.getNamedItem(HTML40Namespace.ElementName.LI);
+ if (li != null)
+ content.appendChild(li);
+ }
+
+ /**
+ * ELEMENT content.<br>
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_LI_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdMap.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdMap.java
new file mode 100644
index 0000000000..ac295ec012
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdMap.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for MAP.
+ */
+final class CtdMap extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdMap(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.AREA;
+ }
+
+ /**
+ * ((%block;) | AREA)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )+
+ content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ // (%block;)
+ CMGroupImpl blocks = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (blocks == null)
+ return;
+ collection.getBlock(blocks);
+ content.appendChild(blocks);
+ // AREA
+ CMNode area = collection.getNamedItem(HTML40Namespace.ElementName.AREA);
+ if (area != null)
+ content.appendChild(area);
+ }
+
+ /**
+ * ((%block;) | AREA)+.
+ * Because %block; consists of elements only, the type is ELEMENT.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_MAP;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdNoframesContent.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdNoframesContent.java
new file mode 100644
index 0000000000..4f220a33ab
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdNoframesContent.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for NOFRAMES.
+ */
+final class CtdNoframesContent extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdNoframesContent(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.BODY;
+ }
+
+ /**
+ * (BODY).
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ // BODY
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.BODY);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (BODY)
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_NOFRAMES_CONTENT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdOptionContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdOptionContainer.java
new file mode 100644
index 0000000000..05237b3694
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdOptionContainer.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * OPTION container.
+ * (OPTION)+
+ */
+final class CtdOptionContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdOptionContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.OPTION;
+ }
+
+ /**
+ * (OPTION)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )+
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ // OPTION
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.OPTION);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (OPTION)+
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_OPTION_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdParamContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdParamContainer.java
new file mode 100644
index 0000000000..587ec35c0d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdParamContainer.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * PARAM container. For OBJECT and APPLET.
+ */
+final class CtdParamContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdParamContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * (PARAM | %flow;)*.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )*
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ // PARAM
+ CMNode param = collection.getNamedItem(HTML40Namespace.ElementName.PARAM);
+ if (param != null)
+ content.appendChild(param);
+ // %flow;
+ CMGroupImpl flows = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (flows == null)
+ return;
+ collection.getInline(flows);
+ content.appendChild(flows);
+ }
+
+ /**
+ * (PARAM | %flow;)*.
+ * Because %flow; contains #PCDATA, the type is MIXED.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_PARAM_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdSelect.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdSelect.java
new file mode 100644
index 0000000000..7f03f22a4f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdSelect.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for SELECT.
+ */
+final class CtdSelect extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdSelect(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.OPTION;
+ }
+
+ /**
+ * (OPTGROUP | OPTION)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )+
+ content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ // OPTGROUP
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.OPTGROUP);
+ if (dec != null)
+ content.appendChild(dec);
+ // OPTION
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.OPTION);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (OPTGROUP | OPTION)+.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_SELECT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTable.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTable.java
new file mode 100644
index 0000000000..1e5f4b0c11
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTable.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * for TABLE.
+ * (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)
+ */
+final class CtdTable extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdTable(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.TBODY;
+ }
+
+ /**
+ * (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)
+ * --> ((CAPTION)?, ((COL)* | (COLGROUP)*), (THEAD)?, (TFOOT)?, (TBODY)+)
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( , , , ,)
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+
+ // (CAPTION)?
+ // ( )?
+ CMGroupImpl wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
+ if (wrap == null)
+ return;
+ content.appendChild(wrap);
+ // CAPTION
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.CAPTION);
+ if (dec != null)
+ wrap.appendChild(dec);
+
+ // ((COL)* | (COLGROUP)*)
+ // ( | )
+ CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (group == null)
+ return;
+ content.appendChild(group);
+ // (COL)*
+ wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
+ if (wrap == null)
+ return;
+ group.appendChild(wrap);
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.COL);
+ if (dec != null)
+ wrap.appendChild(dec);
+ // (COLGROUP)*
+ wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
+ if (wrap == null)
+ return;
+ group.appendChild(wrap);
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.COLGROUP);
+ if (dec != null)
+ wrap.appendChild(dec);
+
+ // (THEAD)?
+ wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
+ if (wrap == null)
+ return;
+ content.appendChild(wrap);
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.THEAD);
+ if (dec != null)
+ wrap.appendChild(dec);
+
+ // (TFOOT)?
+ wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
+ if (wrap == null)
+ return;
+ content.appendChild(wrap);
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.TFOOT);
+ if (dec != null)
+ wrap.appendChild(dec);
+
+ // (TBODY)+
+ wrap = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ if (wrap == null)
+ return;
+ content.appendChild(wrap);
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.TBODY);
+ if (dec != null)
+ wrap.appendChild(dec);
+ }
+
+ /**
+ * ((FRAMESET | FRAME)+ & NOFRAMES?)
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_TABLE;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTableCellContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTableCellContainer.java
new file mode 100644
index 0000000000..39221ff0bd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTableCellContainer.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * Table cell container.
+ * (TH | TD)+
+ */
+final class CtdTableCellContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdTableCellContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.TD;
+ }
+
+ /**
+ * (TH | TD)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )+
+ content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ // TH
+ CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.TH);
+ if (dec != null)
+ content.appendChild(dec);
+ // TD
+ dec = collection.getNamedItem(HTML40Namespace.ElementName.TD);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (TH | TD)+
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_TCELL_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTrContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTrContainer.java
new file mode 100644
index 0000000000..4a494bd8d2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/CtdTrContainer.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * Table record container.
+ * (TR)+
+ */
+final class CtdTrContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdTrContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = HTML40Namespace.ElementName.TR;
+ }
+
+ /**
+ * (TR)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // (TR)+
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ CMNode tr = collection.getNamedItem(HTML40Namespace.ElementName.TR);
+ if (tr != null)
+ content.appendChild(tr);
+ }
+
+ /**
+ * ELEMENT content.<br>
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_TR_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/DeclCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/DeclCollection.java
new file mode 100644
index 0000000000..c9449fd6bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/DeclCollection.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ */
+abstract class DeclCollection implements CMNamedNodeMap {
+
+
+ protected class DualMap {
+ public DualMap() {
+ super();
+ }
+
+ public DualMap(Object[] objects) {
+ super();
+ initialize(objects);
+ }
+
+ public int size() {
+ return table.length;
+ }
+
+ public Object getValue(int key) {
+ if (!isValidIndex(key))
+ return null;
+ return table[key];
+ }
+
+ public int getKey(Object value) {
+ Integer keyObj = (Integer) map.get(value);
+ if (keyObj == null)
+ return ID_UNKNOWN;
+ return keyObj.intValue();
+ }
+
+ protected void initialize(Object[] objects) {
+ if (objects == null)
+ return;
+ table = objects;
+ map = new HashMap();
+ for (int key = 0; key < objects.length; key++) {
+ Object value = table[key];
+ map.put(value, new Integer(key));
+ }
+ }
+
+ private Object[] table = null;
+ private HashMap map = null;
+
+ private boolean isValidIndex(int index) {
+ return index >= 0 && index < table.length;
+ }
+ }
+
+ protected class TolerantStringDualMap extends DualMap {
+ public TolerantStringDualMap(String[] names) {
+ super();
+ Object[] objects = new Object[names.length];
+ for (int i = 0; i < names.length; i++) {
+ objects[i] = makeCanonicalForm(names[i]);
+ }
+ initialize(objects);
+ }
+
+ public int getKey(Object value) {
+ try {
+ String name = (String) value;
+ return super.getKey(makeCanonicalForm(name));
+ }
+ catch (ClassCastException e) {
+ return ID_UNKNOWN;
+ }
+ }
+
+ private String makeCanonicalForm(String raw) {
+ return raw.toUpperCase();
+ }
+ }
+
+ private class DeclIterator implements Iterator {
+ public DeclIterator() {
+ maxid = fDecls.length - 1;
+ }
+
+ public boolean hasNext() {
+ return id < maxid;
+ }
+
+ public Object next() {
+ if (!hasNext())
+ return null;
+ return item(++id);
+ }
+
+ public void remove() { /* nothing should be done. */
+ }
+
+ private int id = -1;
+ private int maxid = -1;
+ }
+
+ CMNode[] fDecls = null;
+ protected final static boolean STRICT_CASE = false;
+ protected final static boolean TOLERANT_CASE = true;
+ protected final static int ID_UNKNOWN = -1;
+ private DualMap fMap = null;
+
+ /**
+ */
+ public DeclCollection(String[] names, boolean tolerant) {
+ super();
+ fDecls = new CMNode[names.length];
+ if (tolerant) {
+ fMap = new TolerantStringDualMap(names);
+ }
+ else {
+ fMap = new DualMap(names);
+ }
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param id int
+ */
+ protected abstract CMNode create(String name);
+
+ /**
+ */
+ public CMNamedNodeMap getDeclarations(String[] names) {
+ CMNamedNodeMapImpl map = new CMNamedNodeMapImpl();
+ for (int i = 0; i < names.length; i++) {
+ String name = names[i];
+ CMNode node = getNamedItem(name);
+ if (node == null)
+ continue;
+ map.putNamedItem(name, node);
+ }
+ return map;
+ }
+
+ /**
+ * @param declarations com.ibm.sed.contentmodel.html.CMGroupImpl
+ * @param names java.util.Iterator
+ */
+ public void getDeclarations(CMGroupImpl group, Iterator names) {
+ while (names.hasNext()) {
+ String entityName = (String) names.next();
+ CMNode dec = getNamedItem(entityName);
+ if (dec != null)
+ group.appendChild(dec);
+ }
+ }
+
+ /**
+ * Map name to id.
+ * @return int
+ * @param name java.lang.String
+ */
+ protected int getID(String name) {
+ return fMap.getKey(name);
+ }
+
+ /**
+ * getLength method
+ * @return int
+ */
+ public int getLength() {
+ return fDecls.length;
+ }
+
+ /**
+ * @return java.lang.String
+ * @param id int
+ */
+ protected String getName(int id) {
+ return (String) fMap.getValue(id);
+ }
+
+ /**
+ * getNamedItem method
+ * @return CMNode
+ * @param name java.lang.String
+ */
+ public CMNode getNamedItem(String name) {
+ int id = getID(name);
+ if (!isValidID(id))
+ return null;
+ return item(id);
+ }
+
+ /**
+ * @return boolean
+ * @param id int
+ */
+ private boolean isValidID(int id) {
+ return id >= 0 && id < fDecls.length;
+ }
+
+ /**
+ * item method
+ * @return CMNode
+ * @param index int
+ */
+ public CMNode item(int index) {
+ if (!isValidID(index))
+ return null;
+ CMNode decl = fDecls[index];
+ if (decl != null)
+ return decl; // already exist.
+
+ decl = create(getName(index));
+ fDecls[index] = decl;
+ return decl;
+ }
+
+ /**
+ */
+ public Iterator iterator() {
+ return new DeclIterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ElementCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ElementCollection.java
new file mode 100644
index 0000000000..26da0269b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ElementCollection.java
@@ -0,0 +1,886 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Factory for element declarations.
+ */
+final class ElementCollection extends DeclCollection implements org.eclipse.wst.html.core.HTML40Namespace.ElementName {
+
+
+ // Element IDs
+ private static class Ids {
+ public static final int ID_A = 0;
+ public static final int ID_ABBR = 1;
+ public static final int ID_ACRONYM = 2;
+ public static final int ID_ADDRESS = 3;
+ public static final int ID_APPLET = 4;
+ public static final int ID_AREA = 5;
+ public static final int ID_B = 6;
+ public static final int ID_BASE = 7;
+ public static final int ID_BASEFONT = 8;
+ public static final int ID_BDO = 9;
+ public static final int ID_BIG = 10;
+ public static final int ID_BLINK = 11;
+ public static final int ID_BLOCKQUOTE = 12;
+ public static final int ID_BODY = 13;
+ public static final int ID_BR = 14;
+ public static final int ID_BUTTON = 15;
+ public static final int ID_CAPTION = 16;
+ public static final int ID_CENTER = 17;
+ public static final int ID_CITE = 18;
+ public static final int ID_CODE = 19;
+ public static final int ID_COL = 20;
+ public static final int ID_COLGROUP = 21;
+ public static final int ID_DD = 22;
+ public static final int ID_DEL = 23;
+ public static final int ID_DFN = 24;
+ public static final int ID_DIR = 25;
+ public static final int ID_DIV = 26;
+ public static final int ID_DL = 27;
+ public static final int ID_DT = 28;
+ public static final int ID_EM = 29;
+ public static final int ID_EMBED = 30;
+ public static final int ID_FIELDSET = 31;
+ public static final int ID_FONT = 32;
+ public static final int ID_FORM = 33;
+ public static final int ID_FRAME = 34;
+ public static final int ID_FRAMESET = 35;
+ public static final int ID_H1 = 36;
+ public static final int ID_H2 = 37;
+ public static final int ID_H3 = 38;
+ public static final int ID_H4 = 39;
+ public static final int ID_H5 = 40;
+ public static final int ID_H6 = 41;
+ public static final int ID_HEAD = 42;
+ public static final int ID_HR = 43;
+ public static final int ID_HTML = 44;
+ public static final int ID_I = 45;
+ public static final int ID_IFRAME = 46;
+ public static final int ID_IMG = 47;
+ public static final int ID_INPUT = 48;
+ public static final int ID_INS = 49;
+ public static final int ID_ISINDEX = 50;
+ public static final int ID_KBD = 51;
+ public static final int ID_LABEL = 52;
+ public static final int ID_LEGEND = 53;
+ public static final int ID_LI = 54;
+ public static final int ID_LINK = 55;
+ public static final int ID_MAP = 56;
+ public static final int ID_MENU = 57;
+ public static final int ID_META = 58;
+ public static final int ID_NOEMBED = 59;
+ public static final int ID_NOFRAMES = 60;
+ public static final int ID_NOSCRIPT = 61;
+ public static final int ID_OBJECT = 62;
+ public static final int ID_OL = 63;
+ public static final int ID_OPTGROUP = 64;
+ public static final int ID_OPTION = 65;
+ public static final int ID_P = 66;
+ public static final int ID_PARAM = 67;
+ public static final int ID_PRE = 68;
+ public static final int ID_Q = 69;
+ public static final int ID_S = 70;
+ public static final int ID_SAMP = 71;
+ public static final int ID_SCRIPT = 72;
+ public static final int ID_SELECT = 73;
+ public static final int ID_SMALL = 74;
+ public static final int ID_SPAN = 75;
+ public static final int ID_STRIKE = 76;
+ public static final int ID_STRONG = 77;
+ public static final int ID_STYLE = 78;
+ public static final int ID_SUB = 79;
+ public static final int ID_SUP = 80;
+ public static final int ID_TABLE = 81;
+ public static final int ID_TBODY = 82;
+ public static final int ID_TD = 83;
+ public static final int ID_TEXTAREA = 84;
+ public static final int ID_TFOOT = 85;
+ public static final int ID_TH = 86;
+ public static final int ID_THEAD = 87;
+ public static final int ID_TITLE = 88;
+ public static final int ID_TR = 89;
+ public static final int ID_TT = 90;
+ public static final int ID_U = 91;
+ public static final int ID_UL = 92;
+ public static final int ID_VAR = 93;
+ public static final int ID_MARQUEE = 94;
+ public static final int ID_SSI_CONFIG = 95;
+ public static final int ID_SSI_ECHO = 96;
+ public static final int ID_SSI_EXEC = 97;
+ public static final int ID_SSI_FSIZE = 98;
+ public static final int ID_SSI_FLASTMOD = 99;
+ public static final int ID_SSI_INCLUDE = 100;
+ public static final int ID_SSI_PRINTENV = 101;
+ public static final int ID_SSI_SET = 102;
+ // <<D205513
+ public static final int ID_BGSOUND = 103;
+ public static final int ID_NOBR = 104;
+ public static final int ID_WBR = 105;
+
+ // D205513
+
+ public static int getNumOfIds() {
+ if (numofids != -1)
+ return numofids;
+
+ // NOTE: If the reflection is too slow, this method should
+ // just return the literal value, like 105.
+ // -- 5/25/2001
+ Class clazz = Ids.class;
+ Field[] fields = clazz.getFields();
+ numofids = 0;
+ for (int i = 0; i < fields.length; i++) {
+ String name = fields[i].getName();
+ if (name.startsWith("ID_"))//$NON-NLS-1$
+ numofids++;
+ }
+ return numofids;
+ }
+
+ // chache the result of the reflection.
+ private static int numofids = -1;
+ }
+
+ /** %fontstyle;. TT | I | B | U | S | STRIKE | BIG | SMALL | BLINK */
+ private static final String[] FONTSTYLE = {TT, I, B, U, S, STRIKE, BIG, SMALL, BLINK};
+ /** %formctl;. INPUT | SELECT | TEXTAREA | LABEL | BUTTON */
+ private static final String[] FORMCTL = {INPUT, SELECT, TEXTAREA, LABEL, BUTTON};
+ /** %phrase;.
+ * EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM
+ */
+ private static final String[] PHRASE = {EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, ACRONYM};
+ /** %special;.
+ * A | IMG | APPLET | OBJECT | FONT | BASEFONT | BR | SCRIPT |
+ * MAP | Q | SUB | SUP | SPAN | BDO | IFRAME | EMBED | MARQUEE |
+ * D2W | SUBMIT
+ * WBR | NOBR | BGSOUND
+ */
+ private static final String[] SPECIAL = {A, IMG, APPLET, OBJECT, FONT, BASEFONT, BR, WBR, // D205513
+ SCRIPT, MAP, Q, SUB, SUP, SPAN, BDO, IFRAME, EMBED, BGSOUND, // D205513
+ MARQUEE, NOBR // D205513
+ };
+ /** %heading;. H[1-6] */
+ private static final String[] HEADING = {H1, H2, H3, H4, H5, H6};
+ /** %list;. UL | OL | DIR | MENU */
+ private static final String[] LIST = {UL, OL, DIR, MENU};
+ /** %preformatted;. PRE */
+ private static final String[] PREFORMATTED = {PRE};
+ private AttributeCollection attributeCollection = null;
+ private static String[] fNames = null;
+
+ static {
+ fNames = new String[Ids.getNumOfIds()];
+ fNames[Ids.ID_A] = A;
+ fNames[Ids.ID_ABBR] = ABBR;
+ fNames[Ids.ID_ACRONYM] = ACRONYM;
+ fNames[Ids.ID_ADDRESS] = ADDRESS;
+ fNames[Ids.ID_APPLET] = APPLET;
+ fNames[Ids.ID_AREA] = AREA;
+ fNames[Ids.ID_B] = B;
+ fNames[Ids.ID_BASE] = BASE;
+ fNames[Ids.ID_BASEFONT] = BASEFONT;
+ fNames[Ids.ID_BDO] = BDO;
+ fNames[Ids.ID_BIG] = BIG;
+ fNames[Ids.ID_BLINK] = BLINK;
+ fNames[Ids.ID_BLOCKQUOTE] = BLOCKQUOTE;
+ fNames[Ids.ID_BODY] = BODY;
+ fNames[Ids.ID_BR] = BR;
+ fNames[Ids.ID_BUTTON] = BUTTON;
+ fNames[Ids.ID_CAPTION] = CAPTION;
+ fNames[Ids.ID_CENTER] = CENTER;
+ fNames[Ids.ID_CITE] = CITE;
+ fNames[Ids.ID_CODE] = CODE;
+ fNames[Ids.ID_COL] = COL;
+ fNames[Ids.ID_COLGROUP] = COLGROUP;
+ fNames[Ids.ID_DD] = DD;
+ fNames[Ids.ID_DEL] = DEL;
+ fNames[Ids.ID_DFN] = DFN;
+ fNames[Ids.ID_DIR] = DIR;
+ fNames[Ids.ID_DIV] = DIV;
+ fNames[Ids.ID_DL] = DL;
+ fNames[Ids.ID_DT] = DT;
+ fNames[Ids.ID_EM] = EM;
+ fNames[Ids.ID_EMBED] = EMBED;
+ fNames[Ids.ID_FIELDSET] = FIELDSET;
+ fNames[Ids.ID_FONT] = FONT;
+ fNames[Ids.ID_FORM] = FORM;
+ fNames[Ids.ID_FRAME] = FRAME;
+ fNames[Ids.ID_FRAMESET] = FRAMESET;
+ fNames[Ids.ID_H1] = H1;
+ fNames[Ids.ID_H2] = H2;
+ fNames[Ids.ID_H3] = H3;
+ fNames[Ids.ID_H4] = H4;
+ fNames[Ids.ID_H5] = H5;
+ fNames[Ids.ID_H6] = H6;
+ fNames[Ids.ID_HEAD] = HEAD;
+ fNames[Ids.ID_HR] = HR;
+ fNames[Ids.ID_HTML] = HTML;
+ fNames[Ids.ID_I] = I;
+ fNames[Ids.ID_IFRAME] = IFRAME;
+ fNames[Ids.ID_IMG] = IMG;
+ fNames[Ids.ID_INPUT] = INPUT;
+ fNames[Ids.ID_INS] = INS;
+ fNames[Ids.ID_ISINDEX] = ISINDEX;
+ fNames[Ids.ID_KBD] = KBD;
+ fNames[Ids.ID_LABEL] = LABEL;
+ fNames[Ids.ID_LEGEND] = LEGEND;
+ fNames[Ids.ID_LI] = LI;
+ fNames[Ids.ID_LINK] = LINK;
+ fNames[Ids.ID_MAP] = MAP;
+ fNames[Ids.ID_MENU] = MENU;
+ fNames[Ids.ID_META] = META;
+ fNames[Ids.ID_NOEMBED] = NOEMBED;
+ fNames[Ids.ID_NOFRAMES] = NOFRAMES;
+ fNames[Ids.ID_NOSCRIPT] = NOSCRIPT;
+ fNames[Ids.ID_OBJECT] = OBJECT;
+ fNames[Ids.ID_OL] = OL;
+ fNames[Ids.ID_OPTGROUP] = OPTGROUP;
+ fNames[Ids.ID_OPTION] = OPTION;
+ fNames[Ids.ID_P] = P;
+ fNames[Ids.ID_PARAM] = PARAM;
+ fNames[Ids.ID_PRE] = PRE;
+ fNames[Ids.ID_Q] = Q;
+ fNames[Ids.ID_S] = S;
+ fNames[Ids.ID_SAMP] = SAMP;
+ fNames[Ids.ID_SCRIPT] = SCRIPT;
+ fNames[Ids.ID_SELECT] = SELECT;
+ fNames[Ids.ID_SMALL] = SMALL;
+ fNames[Ids.ID_SPAN] = SPAN;
+ fNames[Ids.ID_STRIKE] = STRIKE;
+ fNames[Ids.ID_STRONG] = STRONG;
+ fNames[Ids.ID_STYLE] = STYLE;
+ fNames[Ids.ID_SUB] = SUB;
+ fNames[Ids.ID_SUP] = SUP;
+ fNames[Ids.ID_TABLE] = TABLE;
+ fNames[Ids.ID_TBODY] = TBODY;
+ fNames[Ids.ID_TD] = TD;
+ fNames[Ids.ID_TEXTAREA] = TEXTAREA;
+ fNames[Ids.ID_TFOOT] = TFOOT;
+ fNames[Ids.ID_TH] = TH;
+ fNames[Ids.ID_THEAD] = THEAD;
+ fNames[Ids.ID_TITLE] = TITLE;
+ fNames[Ids.ID_TR] = TR;
+ fNames[Ids.ID_TT] = TT;
+ fNames[Ids.ID_U] = U;
+ fNames[Ids.ID_UL] = UL;
+ fNames[Ids.ID_VAR] = VAR;
+ fNames[Ids.ID_MARQUEE] = MARQUEE;
+ fNames[Ids.ID_SSI_CONFIG] = SSI_CONFIG;
+ fNames[Ids.ID_SSI_ECHO] = SSI_ECHO;
+ fNames[Ids.ID_SSI_EXEC] = SSI_EXEC;
+ fNames[Ids.ID_SSI_FSIZE] = SSI_FSIZE;
+ fNames[Ids.ID_SSI_FLASTMOD] = SSI_FLASTMOD;
+ fNames[Ids.ID_SSI_INCLUDE] = SSI_INCLUDE;
+ fNames[Ids.ID_SSI_PRINTENV] = SSI_PRINTENV;
+ fNames[Ids.ID_SSI_SET] = SSI_SET;
+ fNames[Ids.ID_BGSOUND] = BGSOUND;
+ fNames[Ids.ID_NOBR] = NOBR;
+ fNames[Ids.ID_WBR] = WBR;
+ }
+
+ /**
+ */
+ public ElementCollection(AttributeCollection collection) {
+ super(fNames, TOLERANT_CASE);
+ attributeCollection = collection;
+ }
+
+ /**
+ * Actually creates HTMLElementDeclaration instance.
+ * @return HTMLElementDeclaration
+ */
+ protected CMNode create(String elementName) {
+ HTMLElemDeclImpl edec = null;
+
+ if (elementName.equalsIgnoreCase(A)) {
+ edec = new HedA(this);
+ }
+ else if (elementName.equalsIgnoreCase(ABBR)) {
+ edec = new HedPhrase(ABBR, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(ACRONYM)) {
+ edec = new HedPhrase(ACRONYM, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(ADDRESS)) {
+ edec = new HedADDRESS(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(APPLET)) {
+ edec = new HedAPPLET(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(AREA)) {
+ edec = new HedAREA(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(B)) {
+ edec = new HedFontStyle(B, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BASE)) {
+ edec = new HedBASE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BASEFONT)) {
+ edec = new HedBASEFONT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BDO)) {
+ edec = new HedBDO(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BIG)) {
+ edec = new HedFontStyle(BIG, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BLINK)) {
+ edec = new HedFontStyle(BLINK, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BLOCKQUOTE)) {
+ edec = new HedBLOCKQUOTE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BODY)) {
+ edec = new HedBODY(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BR)) {
+ edec = new HedBR(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BUTTON)) {
+ edec = new HedBUTTON(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(CAPTION)) {
+ edec = new HedCAPTION(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(CENTER)) {
+ edec = new HedCENTER(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(CITE)) {
+ edec = new HedPhrase(CITE, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(CODE)) {
+ edec = new HedPhrase(CODE, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(COL)) {
+ edec = new HedCOL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(COLGROUP)) {
+ edec = new HedCOLGROUP(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DD)) {
+ edec = new HedDD(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DEL)) {
+ edec = new HedMarkChanges(DEL, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DFN)) {
+ edec = new HedPhrase(DFN, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DIR)) {
+ edec = new HedMENU(DIR, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DIV)) {
+ edec = new HedDIV(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DL)) {
+ edec = new HedDL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DT)) {
+ edec = new HedDT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(EM)) {
+ edec = new HedPhrase(EM, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(EMBED)) {
+ edec = new HedEMBED(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(FIELDSET)) {
+ edec = new HedFIELDSET(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(FONT)) {
+ edec = new HedFONT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(FORM)) {
+ edec = new HedFORM(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(FRAME)) {
+ edec = new HedFRAME(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(FRAMESET)) {
+ edec = new HedFRAMESET(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H1)) {
+ edec = new HedHeading(H1, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H2)) {
+ edec = new HedHeading(H2, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H3)) {
+ edec = new HedHeading(H3, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H4)) {
+ edec = new HedHeading(H4, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H5)) {
+ edec = new HedHeading(H5, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H6)) {
+ edec = new HedHeading(H6, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(HEAD)) {
+ edec = new HedHEAD(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(HR)) {
+ edec = new HedHR(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(HTML)) {
+ edec = new HedHTML(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(I)) {
+ edec = new HedFontStyle(I, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(IFRAME)) {
+ edec = new HedIFRAME(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(IMG)) {
+ edec = new HedIMG(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(INPUT)) {
+ edec = new HedINPUT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(INS)) {
+ edec = new HedMarkChanges(INS, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(ISINDEX)) {
+ edec = new HedISINDEX(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(KBD)) {
+ edec = new HedPhrase(KBD, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(LABEL)) {
+ edec = new HedLABEL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(LEGEND)) {
+ edec = new HedLEGEND(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(LI)) {
+ edec = new HedLI(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(LINK)) {
+ edec = new HedLINK(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(MAP)) {
+ edec = new HedMAP(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(MARQUEE)) {
+ edec = new HedMARQUEE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(MENU)) {
+ edec = new HedMENU(MENU, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(META)) {
+ edec = new HedMETA(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(NOEMBED)) {
+ edec = new HedNOEMBED(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(NOFRAMES)) {
+ edec = new HedNOFRAMES(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(NOSCRIPT)) {
+ edec = new HedNOSCRIPT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(OBJECT)) {
+ edec = new HedOBJECT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(OL)) {
+ edec = new HedOL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(OPTGROUP)) {
+ edec = new HedOPTGROUP(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(OPTION)) {
+ edec = new HedOPTION(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(P)) {
+ edec = new HedP(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(PARAM)) {
+ edec = new HedPARAM(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(PRE)) {
+ edec = new HedPRE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(Q)) {
+ edec = new HedQ(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(S)) {
+ edec = new HedFontStyle(S, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SAMP)) {
+ edec = new HedPhrase(SAMP, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SCRIPT)) {
+ edec = new HedSCRIPT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SELECT)) {
+ edec = new HedSELECT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SMALL)) {
+ edec = new HedFontStyle(SMALL, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SPAN)) {
+ edec = new HedSPAN(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(STRIKE)) {
+ edec = new HedFontStyle(STRIKE, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(STRONG)) {
+ edec = new HedPhrase(STRONG, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(STYLE)) {
+ edec = new HedSTYLE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SUB)) {
+ edec = new HedScripts(SUB, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SUP)) {
+ edec = new HedScripts(SUP, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TABLE)) {
+ edec = new HedTABLE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TBODY)) {
+ edec = new HedTableBody(TBODY, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TD)) {
+ edec = new HedTableCell(TD, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TEXTAREA)) {
+ edec = new HedTEXTAREA(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TFOOT)) {
+ edec = new HedTableBody(TFOOT, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TH)) {
+ edec = new HedTableCell(TH, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(THEAD)) {
+ edec = new HedTableBody(THEAD, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TITLE)) {
+ edec = new HedTITLE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TR)) {
+ edec = new HedTR(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TT)) {
+ edec = new HedFontStyle(TT, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(U)) {
+ edec = new HedFontStyle(U, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(UL)) {
+ edec = new HedUL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(VAR)) {
+ edec = new HedPhrase(VAR, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_CONFIG)) {
+ edec = new HedSSIConfig(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_ECHO)) {
+ edec = new HedSSIEcho(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_EXEC)) {
+ edec = new HedSSIExec(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_FSIZE)) {
+ edec = new HedSSIFsize(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_FLASTMOD)) {
+ edec = new HedSSIFlastmod(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_INCLUDE)) {
+ edec = new HedSSIInclude(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_PRINTENV)) {
+ edec = new HedSSIPrintenv(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_SET)) {
+ edec = new HedSSISet(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BGSOUND)) {
+ edec = new HedBGSOUND(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(NOBR)) {
+ edec = new HedNOBR(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(WBR)) {
+ edec = new HedWBR(this);
+
+ } // unknown
+ else {
+ // NOTE: We don't define the UNKNOWN element declaration.
+ // <code>null</code> for a declaration is a sign of
+ // the target element is unknown.
+ // -- 3/9/2001
+ edec = null;
+ }
+ return edec;
+ }
+
+ /**
+ * @return com.ibm.sed.contentmodel.html.AttributeCollection
+ */
+ public AttributeCollection getAttributeCollection() {
+ return attributeCollection;
+ }
+
+ /**
+ */
+ public final Collection getNamesOfBlock() {
+ // P, DL, DIV, CENTER, NOSCRIPT, NOFRAMES, BLOCKQUOTE, FORM, ISINDEX, HR,
+ // TABLE, FIELDSET, ADDRESS
+ String[] blockMisc = {P, DL, DIV, CENTER, NOSCRIPT, NOFRAMES, BLOCKQUOTE, FORM, ISINDEX, HR, TABLE, FIELDSET, ADDRESS};
+ Vector names = new Vector(Arrays.asList(blockMisc));
+ // %heading;
+ names.addAll(Arrays.asList(HEADING));
+ // %list;
+ names.addAll(Arrays.asList(LIST));
+ // %preformatted;
+ names.addAll(Arrays.asList(PREFORMATTED));
+
+ return names;
+ }
+
+ /**
+ * %block;.
+ * %block; is:
+ * P | %heading; | %list; | %preformatted; | DL | DIV | CENTER |
+ * NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR |
+ * TABLE | FIELDSET | ADDRESS.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getBlock(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, getNamesOfBlock().iterator());
+ }
+
+ /**
+ * Create element declarations and store them
+ * into a <code>CMGroupImpl</code> instance.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getFlow(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getBlock(group);
+ getInline(group);
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getFontstyle(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(FONTSTYLE).iterator());
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getFormctrl(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(FORMCTL).iterator());
+ }
+
+ /**
+ * %heading;.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getHeading(CMGroupImpl group) {
+ if (group == null)
+ return;
+
+ getDeclarations(group, Arrays.asList(HEADING).iterator());
+ }
+
+ /**
+ * Create element declarations and store them
+ * into a <code>CMGroupImpl</code> instance.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getInline(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getFontstyle(group);
+ getPhrase(group);
+ getSpecial(group);
+ getFormctrl(group);
+ }
+
+ /**
+ * %list;.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getList(CMGroupImpl group) {
+ if (group == null)
+ return;
+
+ getDeclarations(group, Arrays.asList(LIST).iterator());
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getPhrase(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(PHRASE).iterator());
+ }
+
+ /**
+ * %preformatted;
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getPreformatted(CMGroupImpl group) {
+ if (group == null)
+ return;
+
+ getDeclarations(group, Arrays.asList(PREFORMATTED).iterator());
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getSpecial(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(SPECIAL).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/EntityCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/EntityCollection.java
new file mode 100644
index 0000000000..dfecba9e08
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/EntityCollection.java
@@ -0,0 +1,837 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.lang.reflect.Field;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Factory for entity declarations.
+ */
+final class EntityCollection extends DeclCollection implements org.eclipse.wst.html.core.HTML40Namespace.EntityName {
+
+
+ private static class Ids {
+ public static final int ID_AACUTE_L = 0;
+ public static final int ID_AACUTE_U = 1;
+ public static final int ID_ACIRC_L = 2;
+ public static final int ID_ACIRC_U = 3;
+ public static final int ID_ACUTE = 4;
+ public static final int ID_AELIG_L = 5;
+ public static final int ID_AELIG_U = 6;
+ public static final int ID_AGRAVE_L = 7;
+ public static final int ID_AGRAVE_U = 8;
+ public static final int ID_ALEFSYM = 9;
+ public static final int ID_ALPHA_L = 10;
+ public static final int ID_ALPHA_U = 11;
+ public static final int ID_AMP = 12;
+ public static final int ID_AND = 13;
+ public static final int ID_ANG = 14;
+ public static final int ID_ARING_L = 15;
+ public static final int ID_ARING_U = 16;
+ public static final int ID_ASYMP = 17;
+ public static final int ID_ATILDE_L = 18;
+ public static final int ID_ATILDE_U = 19;
+ public static final int ID_AUML_L = 20;
+ public static final int ID_AUML_U = 21;
+ public static final int ID_BDQUO = 22;
+ public static final int ID_BETA_L = 23;
+ public static final int ID_BETA_U = 24;
+ public static final int ID_BRVBAR = 25;
+ public static final int ID_BULL = 26;
+ public static final int ID_CAP = 27;
+ public static final int ID_CCEDIL_L = 28;
+ public static final int ID_CCEDIL_U = 29;
+ public static final int ID_CEDIL = 30;
+ public static final int ID_CENT = 31;
+ public static final int ID_CHI_L = 32;
+ public static final int ID_CHI_U = 33;
+ public static final int ID_CIRC = 34;
+ public static final int ID_CLUBS = 35;
+ public static final int ID_CONG = 36;
+ public static final int ID_COPY = 37;
+ public static final int ID_CRARR = 38;
+ public static final int ID_CUP = 39;
+ public static final int ID_CURREN = 40;
+ public static final int ID_DAGGER_L = 41;
+ public static final int ID_DAGGER_U = 42;
+ public static final int ID_DARR_L = 43;
+ public static final int ID_DARR_U = 44;
+ public static final int ID_DEG = 45;
+ public static final int ID_DELTA_L = 46;
+ public static final int ID_DELTA_U = 47;
+ public static final int ID_DIAMS = 48;
+ public static final int ID_DIVIDE = 49;
+ public static final int ID_EACUTE_L = 50;
+ public static final int ID_EACUTE_U = 51;
+ public static final int ID_ECIRC_L = 52;
+ public static final int ID_ECIRC_U = 53;
+ public static final int ID_EGRAVE_L = 54;
+ public static final int ID_EGRAVE_U = 55;
+ public static final int ID_EMPTY = 56;
+ public static final int ID_EMSP = 57;
+ public static final int ID_ENSP = 58;
+ public static final int ID_EPSILON_L = 59;
+ public static final int ID_EPSILON_U = 60;
+ public static final int ID_EQUIV = 61;
+ public static final int ID_ETA_L = 62;
+ public static final int ID_ETA_U = 63;
+ public static final int ID_ETH_L = 64;
+ public static final int ID_ETH_U = 65;
+ public static final int ID_EUML_L = 66;
+ public static final int ID_EUML_U = 67;
+ public static final int ID_EURO = 68;
+ public static final int ID_EXIST = 69;
+ public static final int ID_FNOF = 70;
+ public static final int ID_FORALL = 71;
+ public static final int ID_FRAC12 = 72;
+ public static final int ID_FRAC14 = 73;
+ public static final int ID_FRAC34 = 74;
+ public static final int ID_FRASL = 75;
+ public static final int ID_GAMMA_L = 76;
+ public static final int ID_GAMMA_U = 77;
+ public static final int ID_GE = 78;
+ public static final int ID_GT = 79;
+ public static final int ID_HARR_L = 80;
+ public static final int ID_HARR_U = 81;
+ public static final int ID_HEARTS = 82;
+ public static final int ID_HELLIP = 83;
+ public static final int ID_IACUTE_L = 84;
+ public static final int ID_IACUTE_U = 85;
+ public static final int ID_ICIRC_L = 86;
+ public static final int ID_ICIRC_U = 87;
+ public static final int ID_IEXCL = 88;
+ public static final int ID_IGRAVE_L = 89;
+ public static final int ID_IGRAVE_U = 90;
+ public static final int ID_IMAGE = 91;
+ public static final int ID_INFIN = 92;
+ public static final int ID_INT = 93;
+ public static final int ID_IOTA_L = 94;
+ public static final int ID_IOTA_U = 95;
+ public static final int ID_IQUEST = 96;
+ public static final int ID_ISIN = 97;
+ public static final int ID_IUML_L = 98;
+ public static final int ID_IUML_U = 99;
+ public static final int ID_KAPPA_L = 100;
+ public static final int ID_KAPPA_U = 101;
+ public static final int ID_LAMBDA_L = 102;
+ public static final int ID_LAMBDA_U = 103;
+ public static final int ID_LANG = 104;
+ public static final int ID_LAQUO = 105;
+ public static final int ID_LARR_L = 106;
+ public static final int ID_LARR_U = 107;
+ public static final int ID_LCEIL = 108;
+ public static final int ID_LDQUO = 109;
+ public static final int ID_LE = 110;
+ public static final int ID_LFLOOR = 111;
+ public static final int ID_LOWAST = 112;
+ public static final int ID_LOZ = 113;
+ public static final int ID_LRM = 114;
+ public static final int ID_LSAQUO = 115;
+ public static final int ID_LSQUO = 116;
+ public static final int ID_LT = 117;
+ public static final int ID_MACR = 118;
+ public static final int ID_MDASH = 119;
+ public static final int ID_MICRO = 120;
+ public static final int ID_MIDDOT = 121;
+ public static final int ID_MINUS = 122;
+ public static final int ID_MU_L = 123;
+ public static final int ID_MU_U = 124;
+ public static final int ID_NABLA = 125;
+ public static final int ID_NBSP = 126;
+ public static final int ID_NDASH = 127;
+ public static final int ID_NE = 128;
+ public static final int ID_NI = 129;
+ public static final int ID_NOT = 130;
+ public static final int ID_NOTIN = 131;
+ public static final int ID_NSUB = 132;
+ public static final int ID_NTILDE_L = 133;
+ public static final int ID_NTILDE_U = 134;
+ public static final int ID_NU_L = 135;
+ public static final int ID_NU_U = 136;
+ public static final int ID_OACUTE_L = 137;
+ public static final int ID_OACUTE_U = 138;
+ public static final int ID_OCIRC_L = 139;
+ public static final int ID_OCIRC_U = 140;
+ public static final int ID_OELIG_L = 141;
+ public static final int ID_OELIG_U = 142;
+ public static final int ID_OGRAVE_L = 143;
+ public static final int ID_OGRAVE_U = 144;
+ public static final int ID_OLINE = 145;
+ public static final int ID_OMEGA_L = 146;
+ public static final int ID_OMEGA_U = 147;
+ public static final int ID_OMICRON_L = 148;
+ public static final int ID_OMICRON_U = 149;
+ public static final int ID_OPLUS = 150;
+ public static final int ID_OR = 151;
+ public static final int ID_ORDF = 152;
+ public static final int ID_ORDM = 153;
+ public static final int ID_OSLASH_L = 154;
+ public static final int ID_OSLASH_U = 155;
+ public static final int ID_OTILDE_L = 156;
+ public static final int ID_OTILDE_U = 157;
+ public static final int ID_OTIMES = 158;
+ public static final int ID_OUML_L = 159;
+ public static final int ID_OUML_U = 160;
+ public static final int ID_PARA = 161;
+ public static final int ID_PART = 162;
+ public static final int ID_PERMIL = 163;
+ public static final int ID_PERP = 164;
+ public static final int ID_PHI_L = 165;
+ public static final int ID_PHI_U = 166;
+ public static final int ID_PIV = 167;
+ public static final int ID_PI_L = 168;
+ public static final int ID_PI_U = 169;
+ public static final int ID_PLUSMN = 170;
+ public static final int ID_POUND = 171;
+ public static final int ID_PRIME_L = 172;
+ public static final int ID_PRIME_U = 173;
+ public static final int ID_PROD = 174;
+ public static final int ID_PROP = 175;
+ public static final int ID_PSI_L = 176;
+ public static final int ID_PSI_U = 177;
+ public static final int ID_QUOT = 178;
+ public static final int ID_RADIC = 179;
+ public static final int ID_RANG = 180;
+ public static final int ID_RAQUO = 181;
+ public static final int ID_RARR_L = 182;
+ public static final int ID_RARR_U = 183;
+ public static final int ID_RCEIL = 184;
+ public static final int ID_RDQUO = 185;
+ public static final int ID_REAL = 186;
+ public static final int ID_REG = 187;
+ public static final int ID_RFLOOR = 188;
+ public static final int ID_RHO_L = 189;
+ public static final int ID_RHO_U = 190;
+ public static final int ID_RLM = 191;
+ public static final int ID_RSAQUO = 192;
+ public static final int ID_RSQUO = 193;
+ public static final int ID_SBQUO = 194;
+ public static final int ID_SCARON_L = 195;
+ public static final int ID_SCARON_U = 196;
+ public static final int ID_SDOT = 197;
+ public static final int ID_SECT = 198;
+ public static final int ID_SHY = 199;
+ public static final int ID_SIGMAF = 200;
+ public static final int ID_SIGMA_L = 201;
+ public static final int ID_SIGMA_U = 202;
+ public static final int ID_SIM = 203;
+ public static final int ID_SPADES = 204;
+ public static final int ID_SUB = 205;
+ public static final int ID_SUBE = 206;
+ public static final int ID_SUM = 207;
+ public static final int ID_SUP = 208;
+ public static final int ID_SUP1 = 209;
+ public static final int ID_SUP2 = 210;
+ public static final int ID_SUP3 = 211;
+ public static final int ID_SUPE = 212;
+ public static final int ID_SZLIG = 213;
+ public static final int ID_TAU_L = 214;
+ public static final int ID_TAU_U = 215;
+ public static final int ID_THERE4 = 216;
+ public static final int ID_THETASYM = 217;
+ public static final int ID_THETA_L = 218;
+ public static final int ID_THETA_U = 219;
+ public static final int ID_THINSP = 220;
+ public static final int ID_THORN_L = 221;
+ public static final int ID_THORN_U = 222;
+ public static final int ID_TILDE = 223;
+ public static final int ID_TIMES = 224;
+ public static final int ID_TRADE = 225;
+ public static final int ID_UACUTE_L = 226;
+ public static final int ID_UACUTE_U = 227;
+ public static final int ID_UARR_L = 228;
+ public static final int ID_UARR_U = 229;
+ public static final int ID_UCIRC_L = 230;
+ public static final int ID_UCIRC_U = 231;
+ public static final int ID_UGRAVE_L = 232;
+ public static final int ID_UGRAVE_U = 233;
+ public static final int ID_UML = 234;
+ public static final int ID_UPSIH = 235;
+ public static final int ID_UPSILON_L = 236;
+ public static final int ID_UPSILON_U = 237;
+ public static final int ID_UUML_L = 238;
+ public static final int ID_UUML_U = 239;
+ public static final int ID_WEIERP = 240;
+ public static final int ID_XI_L = 241;
+ public static final int ID_XI_U = 242;
+ public static final int ID_YACUTE_L = 243;
+ public static final int ID_YACUTE_U = 244;
+ public static final int ID_YEN = 245;
+ public static final int ID_YUML_L = 246;
+ public static final int ID_YUML_U = 247;
+ public static final int ID_ZETA_L = 248;
+ public static final int ID_ZETA_U = 249;
+ public static final int ID_ZWJ = 250;
+ public static final int ID_ZWNJ = 251;
+
+ public static int getNumOfIds() {
+ if (numofids != -1)
+ return numofids;
+
+ // NOTE: If the reflection is too slow, this method should
+ // just return the literal value, like 252.
+ // -- 5/24/2001
+ Class clazz = Ids.class;
+ Field[] fields = clazz.getFields();
+ numofids = 0;
+ for (int i = 0; i < fields.length; i++) {
+ String name = fields[i].getName();
+ if (name.startsWith("ID_"))//$NON-NLS-1$
+ numofids++;
+ }
+ return numofids;
+ }
+
+ // chache the result of the reflection.
+ private static int numofids = -1;
+ }
+
+ private static String[] names = null;
+
+ static {
+ names = new String[Ids.getNumOfIds()];
+ names[Ids.ID_AACUTE_L] = AACUTE_L;
+ names[Ids.ID_AACUTE_U] = AACUTE_U;
+ names[Ids.ID_ACIRC_L] = ACIRC_L;
+ names[Ids.ID_ACIRC_U] = ACIRC_U;
+ names[Ids.ID_ACUTE] = ACUTE;
+ names[Ids.ID_AELIG_L] = AELIG_L;
+ names[Ids.ID_AELIG_U] = AELIG_U;
+ names[Ids.ID_AGRAVE_L] = AGRAVE_L;
+ names[Ids.ID_AGRAVE_U] = AGRAVE_U;
+ names[Ids.ID_ALEFSYM] = ALEFSYM;
+ names[Ids.ID_ALPHA_L] = ALPHA_L;
+ names[Ids.ID_ALPHA_U] = ALPHA_U;
+ names[Ids.ID_AMP] = AMP;
+ names[Ids.ID_AND] = AND;
+ names[Ids.ID_ANG] = ANG;
+ names[Ids.ID_ARING_L] = ARING_L;
+ names[Ids.ID_ARING_U] = ARING_U;
+ names[Ids.ID_ASYMP] = ASYMP;
+ names[Ids.ID_ATILDE_L] = ATILDE_L;
+ names[Ids.ID_ATILDE_U] = ATILDE_U;
+ names[Ids.ID_AUML_L] = AUML_L;
+ names[Ids.ID_AUML_U] = AUML_U;
+ names[Ids.ID_BDQUO] = BDQUO;
+ names[Ids.ID_BETA_L] = BETA_L;
+ names[Ids.ID_BETA_U] = BETA_U;
+ names[Ids.ID_BRVBAR] = BRVBAR;
+ names[Ids.ID_BULL] = BULL;
+ names[Ids.ID_CAP] = CAP;
+ names[Ids.ID_CCEDIL_L] = CCEDIL_L;
+ names[Ids.ID_CCEDIL_U] = CCEDIL_U;
+ names[Ids.ID_CEDIL] = CEDIL;
+ names[Ids.ID_CENT] = CENT;
+ names[Ids.ID_CHI_L] = CHI_L;
+ names[Ids.ID_CHI_U] = CHI_U;
+ names[Ids.ID_CIRC] = CIRC;
+ names[Ids.ID_CLUBS] = CLUBS;
+ names[Ids.ID_CONG] = CONG;
+ names[Ids.ID_COPY] = COPY;
+ names[Ids.ID_CRARR] = CRARR;
+ names[Ids.ID_CUP] = CUP;
+ names[Ids.ID_CURREN] = CURREN;
+ names[Ids.ID_DAGGER_L] = DAGGER_L;
+ names[Ids.ID_DAGGER_U] = DAGGER_U;
+ names[Ids.ID_DARR_L] = DARR_L;
+ names[Ids.ID_DARR_U] = DARR_U;
+ names[Ids.ID_DEG] = DEG;
+ names[Ids.ID_DELTA_L] = DELTA_L;
+ names[Ids.ID_DELTA_U] = DELTA_U;
+ names[Ids.ID_DIAMS] = DIAMS;
+ names[Ids.ID_DIVIDE] = DIVIDE;
+ names[Ids.ID_EACUTE_L] = EACUTE_L;
+ names[Ids.ID_EACUTE_U] = EACUTE_U;
+ names[Ids.ID_ECIRC_L] = ECIRC_L;
+ names[Ids.ID_ECIRC_U] = ECIRC_U;
+ names[Ids.ID_EGRAVE_L] = EGRAVE_L;
+ names[Ids.ID_EGRAVE_U] = EGRAVE_U;
+ names[Ids.ID_EMPTY] = EMPTY;
+ names[Ids.ID_EMSP] = EMSP;
+ names[Ids.ID_ENSP] = ENSP;
+ names[Ids.ID_EPSILON_L] = EPSILON_L;
+ names[Ids.ID_EPSILON_U] = EPSILON_U;
+ names[Ids.ID_EQUIV] = EQUIV;
+ names[Ids.ID_ETA_L] = ETA_L;
+ names[Ids.ID_ETA_U] = ETA_U;
+ names[Ids.ID_ETH_L] = ETH_L;
+ names[Ids.ID_ETH_U] = ETH_U;
+ names[Ids.ID_EUML_L] = EUML_L;
+ names[Ids.ID_EUML_U] = EUML_U;
+ names[Ids.ID_EURO] = EURO;
+ names[Ids.ID_EXIST] = EXIST;
+ names[Ids.ID_FNOF] = FNOF;
+ names[Ids.ID_FORALL] = FORALL;
+ names[Ids.ID_FRAC12] = FRAC12;
+ names[Ids.ID_FRAC14] = FRAC14;
+ names[Ids.ID_FRAC34] = FRAC34;
+ names[Ids.ID_FRASL] = FRASL;
+ names[Ids.ID_GAMMA_L] = GAMMA_L;
+ names[Ids.ID_GAMMA_U] = GAMMA_U;
+ names[Ids.ID_GE] = GE;
+ names[Ids.ID_GT] = GT;
+ names[Ids.ID_HARR_L] = HARR_L;
+ names[Ids.ID_HARR_U] = HARR_U;
+ names[Ids.ID_HEARTS] = HEARTS;
+ names[Ids.ID_HELLIP] = HELLIP;
+ names[Ids.ID_IACUTE_L] = IACUTE_L;
+ names[Ids.ID_IACUTE_U] = IACUTE_U;
+ names[Ids.ID_ICIRC_L] = ICIRC_L;
+ names[Ids.ID_ICIRC_U] = ICIRC_U;
+ names[Ids.ID_IEXCL] = IEXCL;
+ names[Ids.ID_IGRAVE_L] = IGRAVE_L;
+ names[Ids.ID_IGRAVE_U] = IGRAVE_U;
+ names[Ids.ID_IMAGE] = IMAGE;
+ names[Ids.ID_INFIN] = INFIN;
+ names[Ids.ID_INT] = INT;
+ names[Ids.ID_IOTA_L] = IOTA_L;
+ names[Ids.ID_IOTA_U] = IOTA_U;
+ names[Ids.ID_IQUEST] = IQUEST;
+ names[Ids.ID_ISIN] = ISIN;
+ names[Ids.ID_IUML_L] = IUML_L;
+ names[Ids.ID_IUML_U] = IUML_U;
+ names[Ids.ID_KAPPA_L] = KAPPA_L;
+ names[Ids.ID_KAPPA_U] = KAPPA_U;
+ names[Ids.ID_LAMBDA_L] = LAMBDA_L;
+ names[Ids.ID_LAMBDA_U] = LAMBDA_U;
+ names[Ids.ID_LANG] = LANG;
+ names[Ids.ID_LAQUO] = LAQUO;
+ names[Ids.ID_LARR_L] = LARR_L;
+ names[Ids.ID_LARR_U] = LARR_U;
+ names[Ids.ID_LCEIL] = LCEIL;
+ names[Ids.ID_LDQUO] = LDQUO;
+ names[Ids.ID_LE] = LE;
+ names[Ids.ID_LFLOOR] = LFLOOR;
+ names[Ids.ID_LOWAST] = LOWAST;
+ names[Ids.ID_LOZ] = LOZ;
+ names[Ids.ID_LRM] = LRM;
+ names[Ids.ID_LSAQUO] = LSAQUO;
+ names[Ids.ID_LSQUO] = LSQUO;
+ names[Ids.ID_LT] = LT;
+ names[Ids.ID_MACR] = MACR;
+ names[Ids.ID_MDASH] = MDASH;
+ names[Ids.ID_MICRO] = MICRO;
+ names[Ids.ID_MIDDOT] = MIDDOT;
+ names[Ids.ID_MINUS] = MINUS;
+ names[Ids.ID_MU_L] = MU_L;
+ names[Ids.ID_MU_U] = MU_U;
+ names[Ids.ID_NABLA] = NABLA;
+ names[Ids.ID_NBSP] = NBSP;
+ names[Ids.ID_NDASH] = NDASH;
+ names[Ids.ID_NE] = NE;
+ names[Ids.ID_NI] = NI;
+ names[Ids.ID_NOT] = NOT;
+ names[Ids.ID_NOTIN] = NOTIN;
+ names[Ids.ID_NSUB] = NSUB;
+ names[Ids.ID_NTILDE_L] = NTILDE_L;
+ names[Ids.ID_NTILDE_U] = NTILDE_U;
+ names[Ids.ID_NU_L] = NU_L;
+ names[Ids.ID_NU_U] = NU_U;
+ names[Ids.ID_OACUTE_L] = OACUTE_L;
+ names[Ids.ID_OACUTE_U] = OACUTE_U;
+ names[Ids.ID_OCIRC_L] = OCIRC_L;
+ names[Ids.ID_OCIRC_U] = OCIRC_U;
+ names[Ids.ID_OELIG_L] = OELIG_L;
+ names[Ids.ID_OELIG_U] = OELIG_U;
+ names[Ids.ID_OGRAVE_L] = OGRAVE_L;
+ names[Ids.ID_OGRAVE_U] = OGRAVE_U;
+ names[Ids.ID_OLINE] = OLINE;
+ names[Ids.ID_OMEGA_L] = OMEGA_L;
+ names[Ids.ID_OMEGA_U] = OMEGA_U;
+ names[Ids.ID_OMICRON_L] = OMICRON_L;
+ names[Ids.ID_OMICRON_U] = OMICRON_U;
+ names[Ids.ID_OPLUS] = OPLUS;
+ names[Ids.ID_OR] = OR;
+ names[Ids.ID_ORDF] = ORDF;
+ names[Ids.ID_ORDM] = ORDM;
+ names[Ids.ID_OSLASH_L] = OSLASH_L;
+ names[Ids.ID_OSLASH_U] = OSLASH_U;
+ names[Ids.ID_OTILDE_L] = OTILDE_L;
+ names[Ids.ID_OTILDE_U] = OTILDE_U;
+ names[Ids.ID_OTIMES] = OTIMES;
+ names[Ids.ID_OUML_L] = OUML_L;
+ names[Ids.ID_OUML_U] = OUML_U;
+ names[Ids.ID_PARA] = PARA;
+ names[Ids.ID_PART] = PART;
+ names[Ids.ID_PERMIL] = PERMIL;
+ names[Ids.ID_PERP] = PERP;
+ names[Ids.ID_PHI_L] = PHI_L;
+ names[Ids.ID_PHI_U] = PHI_U;
+ names[Ids.ID_PIV] = PIV;
+ names[Ids.ID_PI_L] = PI_L;
+ names[Ids.ID_PI_U] = PI_U;
+ names[Ids.ID_PLUSMN] = PLUSMN;
+ names[Ids.ID_POUND] = POUND;
+ names[Ids.ID_PRIME_L] = PRIME_L;
+ names[Ids.ID_PRIME_U] = PRIME_U;
+ names[Ids.ID_PROD] = PROD;
+ names[Ids.ID_PROP] = PROP;
+ names[Ids.ID_PSI_L] = PSI_L;
+ names[Ids.ID_PSI_U] = PSI_U;
+ names[Ids.ID_QUOT] = QUOT;
+ names[Ids.ID_RADIC] = RADIC;
+ names[Ids.ID_RANG] = RANG;
+ names[Ids.ID_RAQUO] = RAQUO;
+ names[Ids.ID_RARR_L] = RARR_L;
+ names[Ids.ID_RARR_U] = RARR_U;
+ names[Ids.ID_RCEIL] = RCEIL;
+ names[Ids.ID_RDQUO] = RDQUO;
+ names[Ids.ID_REAL] = REAL;
+ names[Ids.ID_REG] = REG;
+ names[Ids.ID_RFLOOR] = RFLOOR;
+ names[Ids.ID_RHO_L] = RHO_L;
+ names[Ids.ID_RHO_U] = RHO_U;
+ names[Ids.ID_RLM] = RLM;
+ names[Ids.ID_RSAQUO] = RSAQUO;
+ names[Ids.ID_RSQUO] = RSQUO;
+ names[Ids.ID_SBQUO] = SBQUO;
+ names[Ids.ID_SCARON_L] = SCARON_L;
+ names[Ids.ID_SCARON_U] = SCARON_U;
+ names[Ids.ID_SDOT] = SDOT;
+ names[Ids.ID_SECT] = SECT;
+ names[Ids.ID_SHY] = SHY;
+ names[Ids.ID_SIGMAF] = SIGMAF;
+ names[Ids.ID_SIGMA_L] = SIGMA_L;
+ names[Ids.ID_SIGMA_U] = SIGMA_U;
+ names[Ids.ID_SIM] = SIM;
+ names[Ids.ID_SPADES] = SPADES;
+ names[Ids.ID_SUB] = SUB;
+ names[Ids.ID_SUBE] = SUBE;
+ names[Ids.ID_SUM] = SUM;
+ names[Ids.ID_SUP] = SUP;
+ names[Ids.ID_SUP1] = SUP1;
+ names[Ids.ID_SUP2] = SUP2;
+ names[Ids.ID_SUP3] = SUP3;
+ names[Ids.ID_SUPE] = SUPE;
+ names[Ids.ID_SZLIG] = SZLIG;
+ names[Ids.ID_TAU_L] = TAU_L;
+ names[Ids.ID_TAU_U] = TAU_U;
+ names[Ids.ID_THERE4] = THERE4;
+ names[Ids.ID_THETASYM] = THETASYM;
+ names[Ids.ID_THETA_L] = THETA_L;
+ names[Ids.ID_THETA_U] = THETA_U;
+ names[Ids.ID_THINSP] = THINSP;
+ names[Ids.ID_THORN_L] = THORN_L;
+ names[Ids.ID_THORN_U] = THORN_U;
+ names[Ids.ID_TILDE] = TILDE;
+ names[Ids.ID_TIMES] = TIMES;
+ names[Ids.ID_TRADE] = TRADE;
+ names[Ids.ID_UACUTE_L] = UACUTE_L;
+ names[Ids.ID_UACUTE_U] = UACUTE_U;
+ names[Ids.ID_UARR_L] = UARR_L;
+ names[Ids.ID_UARR_U] = UARR_U;
+ names[Ids.ID_UCIRC_L] = UCIRC_L;
+ names[Ids.ID_UCIRC_U] = UCIRC_U;
+ names[Ids.ID_UGRAVE_L] = UGRAVE_L;
+ names[Ids.ID_UGRAVE_U] = UGRAVE_U;
+ names[Ids.ID_UML] = UML;
+ names[Ids.ID_UPSIH] = UPSIH;
+ names[Ids.ID_UPSILON_L] = UPSILON_L;
+ names[Ids.ID_UPSILON_U] = UPSILON_U;
+ names[Ids.ID_UUML_L] = UUML_L;
+ names[Ids.ID_UUML_U] = UUML_U;
+ names[Ids.ID_WEIERP] = WEIERP;
+ names[Ids.ID_XI_L] = XI_L;
+ names[Ids.ID_XI_U] = XI_U;
+ names[Ids.ID_YACUTE_L] = YACUTE_L;
+ names[Ids.ID_YACUTE_U] = YACUTE_U;
+ names[Ids.ID_YEN] = YEN;
+ names[Ids.ID_YUML_L] = YUML_L;
+ names[Ids.ID_YUML_U] = YUML_U;
+ names[Ids.ID_ZETA_L] = ZETA_L;
+ names[Ids.ID_ZETA_U] = ZETA_U;
+ names[Ids.ID_ZWJ] = ZWJ;
+ names[Ids.ID_ZWNJ] = ZWNJ;
+ }
+ private static char[] values = null;
+
+ static {
+ values = new char[Ids.getNumOfIds()];
+ values[Ids.ID_AACUTE_L] = 225;
+ values[Ids.ID_AACUTE_U] = 193;
+ values[Ids.ID_ACIRC_L] = 226;
+ values[Ids.ID_ACIRC_U] = 194;
+ values[Ids.ID_ACUTE] = 180;
+ values[Ids.ID_AELIG_L] = 230;
+ values[Ids.ID_AELIG_U] = 198;
+ values[Ids.ID_AGRAVE_L] = 224;
+ values[Ids.ID_AGRAVE_U] = 192;
+ values[Ids.ID_ALEFSYM] = 8501;
+ values[Ids.ID_ALPHA_L] = 945;
+ values[Ids.ID_ALPHA_U] = 913;
+ values[Ids.ID_AMP] = 38;
+ values[Ids.ID_AND] = 8743;
+ values[Ids.ID_ANG] = 8736;
+ values[Ids.ID_ARING_L] = 229;
+ values[Ids.ID_ARING_U] = 197;
+ values[Ids.ID_ASYMP] = 8776;
+ values[Ids.ID_ATILDE_L] = 227;
+ values[Ids.ID_ATILDE_U] = 195;
+ values[Ids.ID_AUML_L] = 228;
+ values[Ids.ID_AUML_U] = 196;
+ values[Ids.ID_BDQUO] = 8222;
+ values[Ids.ID_BETA_L] = 946;
+ values[Ids.ID_BETA_U] = 914;
+ values[Ids.ID_BRVBAR] = 166;
+ values[Ids.ID_BULL] = 8226;
+ values[Ids.ID_CAP] = 8745;
+ values[Ids.ID_CCEDIL_L] = 231;
+ values[Ids.ID_CCEDIL_U] = 199;
+ values[Ids.ID_CEDIL] = 184;
+ values[Ids.ID_CENT] = 162;
+ values[Ids.ID_CHI_L] = 967;
+ values[Ids.ID_CHI_U] = 935;
+ values[Ids.ID_CIRC] = 710;
+ values[Ids.ID_CLUBS] = 9827;
+ values[Ids.ID_CONG] = 8773;
+ values[Ids.ID_COPY] = 169;
+ values[Ids.ID_CRARR] = 8629;
+ values[Ids.ID_CUP] = 8746;
+ values[Ids.ID_CURREN] = 164;
+ values[Ids.ID_DAGGER_L] = 8224;
+ values[Ids.ID_DAGGER_U] = 8225;
+ values[Ids.ID_DARR_L] = 8595;
+ values[Ids.ID_DARR_U] = 8659;
+ values[Ids.ID_DEG] = 176;
+ values[Ids.ID_DELTA_L] = 948;
+ values[Ids.ID_DELTA_U] = 916;
+ values[Ids.ID_DIAMS] = 9830;
+ values[Ids.ID_DIVIDE] = 247;
+ values[Ids.ID_EACUTE_L] = 233;
+ values[Ids.ID_EACUTE_U] = 201;
+ values[Ids.ID_ECIRC_L] = 234;
+ values[Ids.ID_ECIRC_U] = 202;
+ values[Ids.ID_EGRAVE_L] = 232;
+ values[Ids.ID_EGRAVE_U] = 200;
+ values[Ids.ID_EMPTY] = 8709;
+ values[Ids.ID_EMSP] = 8195;
+ values[Ids.ID_ENSP] = 8194;
+ values[Ids.ID_EPSILON_L] = 949;
+ values[Ids.ID_EPSILON_U] = 917;
+ values[Ids.ID_EQUIV] = 8801;
+ values[Ids.ID_ETA_L] = 951;
+ values[Ids.ID_ETA_U] = 919;
+ values[Ids.ID_ETH_L] = 240;
+ values[Ids.ID_ETH_U] = 208;
+ values[Ids.ID_EUML_L] = 235;
+ values[Ids.ID_EUML_U] = 203;
+ values[Ids.ID_EURO] = 8364;
+ values[Ids.ID_EXIST] = 8707;
+ values[Ids.ID_FNOF] = 402;
+ values[Ids.ID_FORALL] = 8704;
+ values[Ids.ID_FRAC12] = 189;
+ values[Ids.ID_FRAC14] = 188;
+ values[Ids.ID_FRAC34] = 190;
+ values[Ids.ID_FRASL] = 8260;
+ values[Ids.ID_GAMMA_L] = 947;
+ values[Ids.ID_GAMMA_U] = 915;
+ values[Ids.ID_GE] = 8805;
+ values[Ids.ID_GT] = 62;
+ values[Ids.ID_HARR_L] = 8596;
+ values[Ids.ID_HARR_U] = 8660;
+ values[Ids.ID_HEARTS] = 9829;
+ values[Ids.ID_HELLIP] = 8230;
+ values[Ids.ID_IACUTE_L] = 237;
+ values[Ids.ID_IACUTE_U] = 205;
+ values[Ids.ID_ICIRC_L] = 238;
+ values[Ids.ID_ICIRC_U] = 206;
+ values[Ids.ID_IEXCL] = 161;
+ values[Ids.ID_IGRAVE_L] = 236;
+ values[Ids.ID_IGRAVE_U] = 204;
+ values[Ids.ID_IMAGE] = 8465;
+ values[Ids.ID_INFIN] = 8734;
+ values[Ids.ID_INT] = 8747;
+ values[Ids.ID_IOTA_L] = 953;
+ values[Ids.ID_IOTA_U] = 921;
+ values[Ids.ID_IQUEST] = 191;
+ values[Ids.ID_ISIN] = 8712;
+ values[Ids.ID_IUML_L] = 239;
+ values[Ids.ID_IUML_U] = 207;
+ values[Ids.ID_KAPPA_L] = 954;
+ values[Ids.ID_KAPPA_U] = 922;
+ values[Ids.ID_LAMBDA_L] = 955;
+ values[Ids.ID_LAMBDA_U] = 923;
+ values[Ids.ID_LANG] = 9001;
+ values[Ids.ID_LAQUO] = 171;
+ values[Ids.ID_LARR_L] = 8592;
+ values[Ids.ID_LARR_U] = 8656;
+ values[Ids.ID_LCEIL] = 8968;
+ values[Ids.ID_LDQUO] = 8220;
+ values[Ids.ID_LE] = 8804;
+ values[Ids.ID_LFLOOR] = 8970;
+ values[Ids.ID_LOWAST] = 8727;
+ values[Ids.ID_LOZ] = 9674;
+ values[Ids.ID_LRM] = 8206;
+ values[Ids.ID_LSAQUO] = 8249;
+ values[Ids.ID_LSQUO] = 8216;
+ values[Ids.ID_LT] = 60;
+ values[Ids.ID_MACR] = 175;
+ values[Ids.ID_MDASH] = 8212;
+ values[Ids.ID_MICRO] = 181;
+ values[Ids.ID_MIDDOT] = 183;
+ values[Ids.ID_MINUS] = 8722;
+ values[Ids.ID_MU_L] = 956;
+ values[Ids.ID_MU_U] = 924;
+ values[Ids.ID_NABLA] = 8711;
+ values[Ids.ID_NBSP] = 160;
+ values[Ids.ID_NDASH] = 8211;
+ values[Ids.ID_NE] = 8800;
+ values[Ids.ID_NI] = 8715;
+ values[Ids.ID_NOT] = 172;
+ values[Ids.ID_NOTIN] = 8713;
+ values[Ids.ID_NSUB] = 8836;
+ values[Ids.ID_NTILDE_L] = 241;
+ values[Ids.ID_NTILDE_U] = 209;
+ values[Ids.ID_NU_L] = 957;
+ values[Ids.ID_NU_U] = 925;
+ values[Ids.ID_OACUTE_L] = 243;
+ values[Ids.ID_OACUTE_U] = 211;
+ values[Ids.ID_OCIRC_L] = 244;
+ values[Ids.ID_OCIRC_U] = 212;
+ values[Ids.ID_OELIG_L] = 339;
+ values[Ids.ID_OELIG_U] = 338;
+ values[Ids.ID_OGRAVE_L] = 242;
+ values[Ids.ID_OGRAVE_U] = 210;
+ values[Ids.ID_OLINE] = 8254;
+ values[Ids.ID_OMEGA_L] = 969;
+ values[Ids.ID_OMEGA_U] = 937;
+ values[Ids.ID_OMICRON_L] = 959;
+ values[Ids.ID_OMICRON_U] = 927;
+ values[Ids.ID_OPLUS] = 8853;
+ values[Ids.ID_OR] = 8744;
+ values[Ids.ID_ORDF] = 170;
+ values[Ids.ID_ORDM] = 186;
+ values[Ids.ID_OSLASH_L] = 248;
+ values[Ids.ID_OSLASH_U] = 216;
+ values[Ids.ID_OTILDE_L] = 245;
+ values[Ids.ID_OTILDE_U] = 213;
+ values[Ids.ID_OTIMES] = 8855;
+ values[Ids.ID_OUML_L] = 246;
+ values[Ids.ID_OUML_U] = 214;
+ values[Ids.ID_PARA] = 182;
+ values[Ids.ID_PART] = 8706;
+ values[Ids.ID_PERMIL] = 8240;
+ values[Ids.ID_PERP] = 8869;
+ values[Ids.ID_PHI_L] = 966;
+ values[Ids.ID_PHI_U] = 934;
+ values[Ids.ID_PIV] = 982;
+ values[Ids.ID_PI_L] = 960;
+ values[Ids.ID_PI_U] = 928;
+ values[Ids.ID_PLUSMN] = 177;
+ values[Ids.ID_POUND] = 163;
+ values[Ids.ID_PRIME_L] = 8242;
+ values[Ids.ID_PRIME_U] = 8243;
+ values[Ids.ID_PROD] = 8719;
+ values[Ids.ID_PROP] = 8733;
+ values[Ids.ID_PSI_L] = 968;
+ values[Ids.ID_PSI_U] = 936;
+ values[Ids.ID_QUOT] = 34;
+ values[Ids.ID_RADIC] = 8730;
+ values[Ids.ID_RANG] = 9002;
+ values[Ids.ID_RAQUO] = 187;
+ values[Ids.ID_RARR_L] = 8594;
+ values[Ids.ID_RARR_U] = 8658;
+ values[Ids.ID_RCEIL] = 8969;
+ values[Ids.ID_RDQUO] = 8221;
+ values[Ids.ID_REAL] = 8476;
+ values[Ids.ID_REG] = 174;
+ values[Ids.ID_RFLOOR] = 8971;
+ values[Ids.ID_RHO_L] = 961;
+ values[Ids.ID_RHO_U] = 929;
+ values[Ids.ID_RLM] = 8207;
+ values[Ids.ID_RSAQUO] = 8250;
+ values[Ids.ID_RSQUO] = 8217;
+ values[Ids.ID_SBQUO] = 8218;
+ values[Ids.ID_SCARON_L] = 353;
+ values[Ids.ID_SCARON_U] = 352;
+ values[Ids.ID_SDOT] = 8901;
+ values[Ids.ID_SECT] = 167;
+ values[Ids.ID_SHY] = 173;
+ values[Ids.ID_SIGMAF] = 962;
+ values[Ids.ID_SIGMA_L] = 963;
+ values[Ids.ID_SIGMA_U] = 931;
+ values[Ids.ID_SIM] = 8764;
+ values[Ids.ID_SPADES] = 9824;
+ values[Ids.ID_SUB] = 8834;
+ values[Ids.ID_SUBE] = 8838;
+ values[Ids.ID_SUM] = 8721;
+ values[Ids.ID_SUP] = 8835;
+ values[Ids.ID_SUP1] = 185;
+ values[Ids.ID_SUP2] = 178;
+ values[Ids.ID_SUP3] = 179;
+ values[Ids.ID_SUPE] = 8839;
+ values[Ids.ID_SZLIG] = 223;
+ values[Ids.ID_TAU_L] = 964;
+ values[Ids.ID_TAU_U] = 932;
+ values[Ids.ID_THERE4] = 8756;
+ values[Ids.ID_THETASYM] = 977;
+ values[Ids.ID_THETA_L] = 952;
+ values[Ids.ID_THETA_U] = 920;
+ values[Ids.ID_THINSP] = 8201;
+ values[Ids.ID_THORN_L] = 254;
+ values[Ids.ID_THORN_U] = 222;
+ values[Ids.ID_TILDE] = 732;
+ values[Ids.ID_TIMES] = 215;
+ values[Ids.ID_TRADE] = 8482;
+ values[Ids.ID_UACUTE_L] = 250;
+ values[Ids.ID_UACUTE_U] = 218;
+ values[Ids.ID_UARR_L] = 8593;
+ values[Ids.ID_UARR_U] = 8657;
+ values[Ids.ID_UCIRC_L] = 251;
+ values[Ids.ID_UCIRC_U] = 219;
+ values[Ids.ID_UGRAVE_L] = 249;
+ values[Ids.ID_UGRAVE_U] = 217;
+ values[Ids.ID_UML] = 168;
+ values[Ids.ID_UPSIH] = 978;
+ values[Ids.ID_UPSILON_L] = 965;
+ values[Ids.ID_UPSILON_U] = 933;
+ values[Ids.ID_UUML_L] = 252;
+ values[Ids.ID_UUML_U] = 220;
+ values[Ids.ID_WEIERP] = 8472;
+ values[Ids.ID_XI_L] = 958;
+ values[Ids.ID_XI_U] = 926;
+ values[Ids.ID_YACUTE_L] = 253;
+ values[Ids.ID_YACUTE_U] = 221;
+ values[Ids.ID_YEN] = 165;
+ values[Ids.ID_YUML_L] = 255;
+ values[Ids.ID_YUML_U] = 376;
+ values[Ids.ID_ZETA_L] = 950;
+ values[Ids.ID_ZETA_U] = 918;
+ values[Ids.ID_ZWJ] = 8205;
+ values[Ids.ID_ZWNJ] = 8204;
+ }
+
+ /**
+ */
+ public EntityCollection() {
+ super(names, STRICT_CASE);
+ }
+
+ /**
+ * Create an entity declaration.
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param attrName java.lang.String
+ */
+ protected CMNode create(String entityName) {
+ int id = getID(entityName);
+ if (id == ID_UNKNOWN)
+ return null;
+
+ String value = String.valueOf(values[id]);
+ HTMLEntityDeclImpl dec = new HTMLEntityDeclImpl(entityName, value);
+
+ return dec;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HCMDocImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HCMDocImpl.java
new file mode 100644
index 0000000000..7357b90fec
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HCMDocImpl.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNamespace;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * CMDocument implementation for the HTML.
+ */
+class HCMDocImpl extends CMNodeImpl implements HTMLCMDocument {
+
+ /** Namespace for all names of elements, entities and attributes. */
+ private CMNamespaceImpl namespace = null;
+ private ElementCollection elements = null;
+ private EntityCollection entities = null;
+ private AttributeCollection attributes = null;
+
+ /**
+ */
+ public HCMDocImpl(String docTypeName, CMNamespaceImpl targetNamespace) {
+ super(docTypeName);
+ namespace = targetNamespace;
+ attributes = new AttributeCollection();
+ elements = new ElementCollection(attributes);
+ entities = new EntityCollection();
+ }
+
+ /**
+ * @return com.ibm.sed.contentmodel.html.AttributeCollection
+ */
+ AttributeCollection getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.HTMLCMDocument
+ */
+ public HTMLElementDeclaration getElementDeclaration(String elementName) {
+ if (elements == null)
+ return null;
+ return (HTMLElementDeclaration) elements.getNamedItem(elementName);
+ }
+
+ /**
+ * @see CMDocument
+ */
+ public CMNamedNodeMap getElements() {
+ return elements;
+ }
+
+ /**
+ * @see CMDocument
+ */
+ public CMNamedNodeMap getEntities() {
+ return entities;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.HTMLCMDocument
+ */
+ public HTMLEntityDeclaration getEntityDeclaration(String entityName) {
+ if (entities == null)
+ return null;
+ return (HTMLEntityDeclaration) entities.getNamedItem(entityName);
+ }
+
+ /**
+ * @see CMDocument
+ */
+ public CMNamespace getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * @see CMNode
+ */
+ public int getNodeType() {
+ return CMNode.DOCUMENT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttrDeclImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttrDeclImpl.java
new file mode 100644
index 0000000000..f9311ac852
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttrDeclImpl.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+/**
+ * Implementation class of {@link <code>HTMLAttributeDeclaration</code>} interface.<br>
+ */
+class HTMLAttrDeclImpl extends CMNodeImpl implements HTMLAttributeDeclaration {
+
+ private HTMLCMDataTypeImpl type = null;
+ private int usage = 0;
+
+ /**
+ */
+ public HTMLAttrDeclImpl(String attrName, HTMLCMDataTypeImpl valueType, int valueUsage) {
+ super(attrName);
+ this.type = valueType;
+
+ switch (valueUsage) {
+ case OPTIONAL :
+ case REQUIRED :
+ case FIXED :
+ case PROHIBITED :
+ this.usage = valueUsage;
+ break;
+ default :
+ // should warn...
+ this.usage = OPTIONAL; // fall back
+ break;
+ }
+ }
+
+ /**
+ * getAttrName method
+ * @return java.lang.String
+ */
+ public String getAttrName() {
+ return getNodeName();
+ }
+
+ /**
+ * getAttrType method
+ * @return CMDataType
+ */
+ public CMDataType getAttrType() {
+ return type;
+ }
+
+ /**
+ * @deprecated by superinterface
+ */
+ public String getDefaultValue() {
+ if (type.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_DEFAULT)
+ return null;
+ return type.getImpliedValue();
+ }
+
+ /**
+ * @deprecated by superinterface
+ */
+ public Enumeration getEnumAttr() {
+ Vector v = new Vector(Arrays.asList(type.getEnumeratedValues()));
+ return v.elements();
+ }
+
+ /**
+ * getNodeType method
+ * @return int
+ *
+ * Returns one of :
+ * ELEMENT_DECLARATION, ATTRIBUTE_DECLARATION, GROUP, ENTITY_DECLARATION.
+ */
+ public int getNodeType() {
+ return CMNode.ATTRIBUTE_DECLARATION;
+ }
+
+ /**
+ * @return int
+ */
+ public int getUsage() {
+ return usage;
+ }
+
+ /**
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return true;
+ else if (propertyName.equals(HTMLCMProperties.IS_SCRIPTABLE))
+ return true;
+ return super.supports(propertyName);
+ }
+
+ /**
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return new Boolean(true);
+ else if (propertyName.equals(HTMLCMProperties.IS_SCRIPTABLE)) {
+ return getAttrType().getDataTypeName() == HTMLCMDataType.SCRIPT ? new Boolean(true) : new Boolean(false);
+ }
+ return super.getProperty(propertyName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttributeDeclaration.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttributeDeclaration.java
new file mode 100644
index 0000000000..5ea976a264
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLAttributeDeclaration.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+
+
+
+/**
+ * This interface is intended to be a public interface which has
+ * interfaces defined in both of {@link <code>CMAttributeDeclaration</code>}
+ * and {@link <code>HTMLCMNode</code>}.<br>
+ */
+public interface HTMLAttributeDeclaration extends CMAttributeDeclaration {
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataType.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataType.java
new file mode 100644
index 0000000000..fe0e16eee8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataType.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMDataType;
+
+/**
+ * HTML extension for data types.
+ */
+public interface HTMLCMDataType extends CMDataType {
+
+ /** Boolean; it should be defined in CMDataType. */
+ public static final String BOOLEAN = "BOOLEAN"; //$NON-NLS-1$
+ public static final String COLOR = "COLOR"; //$NON-NLS-1$
+ public static final String EVENT = "EVENT"; //$NON-NLS-1$
+ public static final String IDREFS = "IDREFS"; //$NON-NLS-1$
+ /** Name; it should be defined in CMDataType. */
+ public static final String NAME = "NAME"; //$NON-NLS-1$
+ // Following types are just aliases.
+ /** %Character; == CDATA */
+ public static final String CHARACTER = CMDataType.CDATA;
+ /** %Charset; == CDATA */
+ public static final String CHARSET = CMDataType.CDATA;
+ /** %Charsets; == CDATA */
+ public static final String CHARSETS = CMDataType.CDATA;
+ /** %ContentType; == CDATA */
+ public static final String CONTENT_TYPE = CMDataType.CDATA;
+ /** %Coords; == CDATA */
+ public static final String COORDS = CMDataType.CDATA;
+ /** %Datetime; == CDATA */
+ public static final String DATETIME = CMDataType.CDATA;
+ /** %FrameTarget; == CDATA */
+ public static final String FRAME_TARGET = CMDataType.CDATA;
+ /** %LanguageCode; == NAME */
+ public static final String LANGUAGE_CODE = NAME;
+ /** %Length; == CDATA */
+ public static final String LENGTH = CMDataType.CDATA;
+ /** %LinkTypes; == CDATA */
+ public static final String LINK_TYPES = CMDataType.CDATA;
+ /** %LIStyle; == CDATA */
+ public static final String LI_STYLE = CMDataType.CDATA;
+ /** %MediaDesc; == CDATA */
+ public static final String MEDIA_DESC = CMDataType.CDATA;
+ /** %MultiLength; == CDATA */
+ public static final String MULTI_LENGTH = CMDataType.CDATA;
+ /** %OLStyle; == CDATA */
+ public static final String OL_STYLE = CMDataType.CDATA;
+ /** %Pixles; == CDATA */
+ public static final String PIXELS = CMDataType.CDATA;
+ /** %Script; == EVENT */
+ public static final String SCRIPT = EVENT;
+ /** %StyleSheet; == EVENT */
+ public static final String STYLE_SHEET = CMDataType.CDATA;
+ /** %Text; == CDATA */
+ public static final String TEXT = CMDataType.CDATA;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataTypeImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataTypeImpl.java
new file mode 100644
index 0000000000..d0674787de
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDataTypeImpl.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+
+
+/**
+ */
+class HTMLCMDataTypeImpl extends CMNodeImpl implements HTMLCMDataType {
+
+ private int impliedValueKind = IMPLIED_VALUE_NONE;
+ private String impliedValue = null;
+ private final static String[] emptyArray = new String[0];
+ private String[] enumValues = emptyArray;
+ private String instanceValue = null;
+
+ /**
+ * HTMLCMDataTypeImpl constructor comment.
+ * @param nm java.lang.String
+ */
+ public HTMLCMDataTypeImpl(String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * HTMLCMDataTypeImpl constructor comment.
+ * @param nm java.lang.String
+ */
+ public HTMLCMDataTypeImpl(String typeName, String instanceValue) {
+ super(typeName);
+ this.instanceValue = instanceValue;
+ }
+
+ /**
+ * getTypeName method
+ * @return java.lang.String
+ *
+ * This method returns a suitable default value that can be used when an instance of the data type is created.
+ * This returns null of a suitable default is not available.
+ */
+ public String generateInstanceValue() {
+ return instanceValue;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDataType
+ */
+ public String getDataTypeName() {
+ return getNodeName();
+ }
+
+ /**
+ * getTypeName method
+ * @return java.lang.String[]
+ *
+ */
+ public String[] getEnumeratedValues() {
+ return enumValues;
+ }
+
+ /**
+ * getTypeName method
+ * @return java.lang.String
+ *
+ * Returns the implied value or null if none exists.
+ */
+ public String getImpliedValue() {
+ return impliedValue;
+ }
+
+ /**
+ * getImpliedValueKind method
+ * @return int
+ *
+ * Returns one of :
+ * IMPLIED_VALUE_NONE, IMPLIED_VALUE_FIXED, IMPLIED_VALUE_DEFAULT.
+ */
+ public int getImpliedValueKind() {
+ return impliedValueKind;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMNode
+ */
+ public int getNodeType() {
+ return CMNode.DATA_TYPE;
+ }
+
+ /**
+ */
+ void setEnumValues(String[] values) {
+ enumValues = new String[values.length];
+ for (int i = 0; i < values.length; i++) {
+ enumValues[i] = values[i];
+ }
+ }
+
+ /**
+ * package scope.
+ */
+ void setImpliedValue(int kind, String value) {
+ switch (kind) {
+ case IMPLIED_VALUE_FIXED :
+ case IMPLIED_VALUE_DEFAULT :
+ impliedValueKind = kind;
+ impliedValue = value;
+ break;
+ case IMPLIED_VALUE_NONE :
+ default :
+ impliedValueKind = IMPLIED_VALUE_NONE;
+ impliedValue = null; // maybe a null string?
+ break;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocument.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocument.java
new file mode 100644
index 0000000000..46177cc52b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocument.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+
+
+
+/**
+ * HTML extension for CMDocument.
+ * This interface provides some short hand methods to get declarations
+ * by a name.
+ */
+public interface HTMLCMDocument extends CMDocument {
+
+ /**
+ * A short hand method to get a element declaration for a HTML element.<br>
+ * @return com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ * @param elementName java.lang.String
+ */
+ HTMLElementDeclaration getElementDeclaration(String elementName);
+
+ /**
+ * A short hand method to get a entity declaration of HTML documents.<br>
+ * @return com.ibm.sed.contentmodel.html.HTMLEntityDeclaration
+ * @param entityName java.lang.String
+ */
+ HTMLEntityDeclaration getEntityDeclaration(String entityName);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocumentFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocumentFactory.java
new file mode 100644
index 0000000000..4e7ea65f39
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMDocumentFactory.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Hashtable;
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.html.core.contentmodel.chtml.CHCMDocImpl;
+import org.eclipse.wst.sse.core.contentmodel.CMDocType;
+
+/**
+ * INodeAdapter factory for HTML and JSP documents.
+ */
+public final class HTMLCMDocumentFactory {
+
+ private static Hashtable cmdocs = new Hashtable();
+
+ static {
+ CMNamespaceImpl h40ns = new CMNamespaceImpl(HTML40Namespace.HTML40_URI, HTML40Namespace.HTML40_TAG_PREFIX);
+ CMNamespaceImpl j11ns = new CMNamespaceImpl(JSP11Namespace.JSP11_URI, JSP11Namespace.JSP_TAG_PREFIX);
+
+ HCMDocImpl html40doc = new HCMDocImpl(CMDocType.HTML_DOC_TYPE, h40ns);
+ CHCMDocImpl chtmldoc = new CHCMDocImpl(CMDocType.CHTML_DOC_TYPE, h40ns);
+ JCMDocImpl jsp11doc = new JCMDocImpl(CMDocType.JSP11_DOC_TYPE, j11ns);
+
+ cmdocs.put(CMDocType.HTML_DOC_TYPE, html40doc);
+ cmdocs.put(CMDocType.CHTML_DOC_TYPE, chtmldoc);
+ cmdocs.put(CMDocType.JSP11_DOC_TYPE, jsp11doc);
+ }
+
+ /**
+ * HTMLCMAdapterFactory constructor.
+ */
+ private HTMLCMDocumentFactory() {
+ super();
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMDocument
+ * @param cmtype java.lang.String
+ */
+ public static CMDocument getCMDocument(String cmtype) {
+ Object obj = cmdocs.get(cmtype);
+ if (obj == null)
+ return null;
+
+ return (CMDocument) obj;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMNode.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMNode.java
new file mode 100644
index 0000000000..f7a783d145
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLCMNode.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+/**
+ * In HTML Documents, name and value of an attribute/element/entity
+ * should be treated ignoring theirs case. However, in XML documents,
+ * they should be distinguished with sensitiveness of their case.
+ * CMNode is basically designed to represent DTDs or Schemas for XML
+ * documents. So, it doesn't have interfaces to retrieve such information.
+ * However, declarations in the HTML CM should provide such information.
+ * This intermediate interface is intended to provide whether ignore cases
+ * or not.<br>
+ */
+interface HTMLCMNode extends org.eclipse.wst.common.contentmodel.CMNode {
+
+ /**
+ * Returns <code>true</code>, if declaration is for HTML attribute/element/entity.
+ * Otherwise, returns <code>false</code>.
+ * @return boolean
+ */
+ boolean shouldIgnoreCase();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElemDeclImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElemDeclImpl.java
new file mode 100644
index 0000000000..6814cbe164
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElemDeclImpl.java
@@ -0,0 +1,377 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+/**
+ * Base class for all Hed???? classes.
+ */
+abstract class HTMLElemDeclImpl extends CMContentImpl implements HTMLElementDeclaration, HTMLPropertyDeclaration {
+
+ // DTD
+ protected CMNamedNodeMapImpl attributes = null;
+ protected String typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_EMPTY;
+ /** Never access this field directly. Instead, use getComplexTypeDefinition method. */
+ private ComplexTypeDefinition typeDefinition = null;
+ protected CMGroupImpl inclusion = null;
+ protected CMGroupImpl exclusion = null;
+ // advanced information
+ protected CMNamedNodeMap prohibitedAncestors = null;
+ protected int correctionType = CORRECT_NONE;
+ protected int formatType = FORMAT_HTML;
+ protected int layoutType = LAYOUT_NONE;
+ protected int omitType = OMIT_NONE;
+ protected boolean keepSpaces = false;
+ protected boolean indentChild = false;
+ protected ElementCollection elementCollection = null;
+ protected AttributeCollection attributeCollection = null;
+ protected final static CMNamedNodeMap EMPTY_MAP = new CMNamedNodeMap() {
+ public int getLength() {
+ return 0;
+ }
+
+ public CMNode getNamedItem(String name) {
+ return null;
+ }
+
+ public CMNode item(int index) {
+ return null;
+ }
+
+ public Iterator iterator() {
+ return new Iterator() {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ };
+ }
+ };
+
+ /**
+ * HTMLElemDeclImpl constructor.
+ * In the HTML DTD, an element declaration has no specification
+ * for its occurrence. Occurrence is specifed in content model, like
+ * <code>(LI)+</code>. To avoid confusion (and complexity),
+ * occurrence of an element declaration is always 1 (it means, min = 1 and
+ * max = 1). Instead, occurrence of CMGroup represents actual occurrence
+ * of the content.
+ * <br>
+ * @param name java.lang.String
+ */
+ public HTMLElemDeclImpl(String elementName, ElementCollection collection) {
+ super(elementName, 1, 1);
+ elementCollection = collection;
+ attributeCollection = collection.getAttributeCollection();
+ }
+
+ /**
+ */
+ protected abstract void createAttributeDeclarations();
+
+ /**
+ *
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ private ComplexTypeDefinition createComplexTypeDefinition() {
+ if (typeDefinitionName.equals(ComplexTypeDefinitionFactory.CTYPE_CDATA) || typeDefinitionName.equals(ComplexTypeDefinitionFactory.CTYPE_EMPTY) || typeDefinitionName.equals(ComplexTypeDefinitionFactory.CTYPE_PCDATA))
+ return null;
+
+ ComplexTypeDefinitionFactory factory = ComplexTypeDefinitionFactory.getInstance();
+ if (factory == null)
+ return null; // fatal error.
+
+ ComplexTypeDefinition def = factory.createTypeDefinition(typeDefinitionName, elementCollection);
+ return def;
+ }
+
+ /**
+ * Get an attribute declaration.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public HTMLAttributeDeclaration getAttributeDeclaration(String attrName) {
+ if (attributes == null) {
+ createAttributeDeclarations();
+ if (attributes == null)
+ return null; // fail to create
+ }
+
+ CMNode cmnode = attributes.getNamedItem(attrName);
+ if (cmnode == null) {
+ return null;
+ }
+ else {
+ return (HTMLAttributeDeclaration) cmnode; // already exists.
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMNamedNodeMap getAttributes() {
+ if (attributes == null)
+ createAttributeDeclarations(); // lazy eval.
+ return attributes;
+ }
+
+ /**
+ * Get an instance of complex type definition.
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ private ComplexTypeDefinition getComplexTypeDefinition() {
+ if (typeDefinition == null)
+ typeDefinition = createComplexTypeDefinition();
+ return typeDefinition;
+ }
+
+ /**
+ * Content.<br>
+ * Element declarations which type is EMPTY or CDATA (maybe PCDATA)
+ * <strong>MUST</strong> override this method and always return null.
+ * This default implementation always tries to create a complex type definition
+ * instance and access to it.
+ * <br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMContent getContent() {
+ ComplexTypeDefinition def = getComplexTypeDefinition(); // lazy eval.
+ return (def != null) ? def.getContent() : null;
+ }
+
+ /**
+ * Content type.<br>
+ * Element declarations which type is EMPTY or CDATA (maybe PCDATA)
+ * <strong>MUST</strong> override this method and return an appropriate type.
+ * This default implementation always tries to create a complex type definition
+ * instance and access to it.
+ * <br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public int getContentType() {
+ ComplexTypeDefinition def = getComplexTypeDefinition(); // lazy eval.
+ return (def != null) ? def.getContentType() : CMElementDeclaration.CDATA;
+ }
+
+ /**
+ * @see HTMLElementDeclaration#getCorrectionType
+ */
+ public int getCorrectionType() {
+ return correctionType;
+ }
+
+ /**
+ * HTML element doesn't have any data type. So, this method always
+ * returns <code>null</code>.<br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMDataType getDataType() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public String getElementName() {
+ return getNodeName();
+ }
+
+ /**
+ * Exclusion.
+ * Almost elements don't have a exclusion.
+ * Only classes those have exclusion should override this method.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ return null;
+ }
+
+ /**
+ * Default format type is <code>FORMAT_HTML</code>.<br>
+ */
+ public int getFormatType() {
+ return formatType;
+ }
+
+ /**
+ * Inclusion.
+ * Almost elements don't have a inclusion.
+ * Only classes those have inclusion should override this method.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getInclusion() {
+ return null;
+ }
+
+ /**
+ */
+ public int getLayoutType() {
+ return layoutType;
+ }
+
+ /**
+ * Line break hint is strongly related to layout type.
+ * Indeed, in the C++DOM, it is determined from layout type only.
+ * So, this implementation, as the default implementation for all declarations,
+ * also determines from layout type only.<br>
+ * @return int
+ */
+ public int getLineBreakHint() {
+ switch (getLayoutType()) {
+ case HTMLElementDeclaration.LAYOUT_BLOCK :
+ return HTMLElementDeclaration.BREAK_BEFORE_START_AND_AFTER_END;
+ case HTMLElementDeclaration.LAYOUT_BREAK :
+ return HTMLElementDeclaration.BREAK_AFTER_START;
+ case HTMLElementDeclaration.LAYOUT_HIDDEN :
+ return HTMLElementDeclaration.BREAK_BEFORE_START_AND_AFTER_END;
+ default :
+ return HTMLElementDeclaration.BREAK_NONE;
+ }
+ }
+
+ /**
+ * No HTML element has local elements. So, this method always
+ * returns an empty map.
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMNamedNodeMap getLocalElements() {
+ return EMPTY_MAP;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMNode
+ */
+ public int getNodeType() {
+ return CMNode.ELEMENT_DECLARATION;
+ }
+
+ /**
+ */
+ public int getOmitType() {
+ return omitType;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ return EMPTY_MAP;
+ }
+
+ /**
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return true;
+ }
+ else if (propertyName.equals(HTMLCMProperties.CONTENT_HINT)) {
+ ComplexTypeDefinition def = getComplexTypeDefinition();
+ return (def != null);
+ }
+ else {
+ PropertyProvider pp = PropertyProviderFactory.getProvider(propertyName);
+ if (pp == null)
+ return false;
+ return pp.supports(this);
+ }
+
+ }
+
+ /**
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return new Boolean(true);
+ }
+ else if (propertyName.equals(HTMLCMProperties.CONTENT_HINT)) {
+ ComplexTypeDefinition def = getComplexTypeDefinition();
+ return (def != null) ? def.getPrimaryCandidate() : null;
+ }
+ else {
+ PropertyProvider pp = PropertyProviderFactory.getProvider(propertyName);
+ if (pp == null)
+ return null;
+ return pp.get(this);
+ }
+ }
+
+ /**
+ * Return element names which terminates this element.<br>
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return null;
+ }
+
+ /**
+ * return true when the element is a JSP element.
+ */
+ public boolean isJSP() {
+ return false;
+ }
+
+ /**
+ * In some elements, such as APPLET, a source generator should indent child
+ * elements that their parents. That is, a source generator should generate
+ * source of APPLET and PARAMS like this:
+ * <PRE>
+ * &lt;APPLET ...&gt;
+ * &lt;PARAM ... &gt;
+ * &lt;PARAM ... &gt;
+ * &lt;/APPLET&gt;
+ * <PRE>
+ * @return boolean
+ */
+ public boolean shouldIndentChildSource() {
+ return indentChild;
+ }
+
+ /**
+ * Most of elements can compact spaces in their child text nodes.
+ * Some special elements should keep them in their source.
+ * @return boolean
+ */
+ public boolean shouldKeepSpaces() {
+ return keepSpaces;
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean shouldTerminateAt(HTMLElementDeclaration nextElement) {
+ Iterator i = getTerminators();
+ if (i == null)
+ return false;
+ String nextName = nextElement.getElementName();
+ while (i.hasNext()) {
+ if (nextName.equals(i.next()))
+ return true;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElementDeclaration.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElementDeclaration.java
new file mode 100644
index 0000000000..99e673578b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLElementDeclaration.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+
+/**
+ * This interface is intended to be a public interface which has
+ * interfaces defined in both of {@link <code>CMElementDeclaration</code>}
+ * and {@link <code>HTMLCMNode</code>}.<br>
+ * In addition to this, some interfaces are added to this interface,
+ * those are specially to HTML elements.<br>
+ */
+public interface HTMLElementDeclaration extends CMElementDeclaration {
+
+ /** Tag ommission; Not ommisible. */
+ int OMIT_NONE = 0;
+ /** Tag ommission; Both tags are ommisible. */
+ int OMIT_BOTH = 1;
+ /** Tag ommission; The end tag is ommisible. */
+ int OMIT_END = 2;
+ /** Tag ommission; The end tag is ommitted when created. */
+ int OMIT_END_DEFAULT = 3;
+ /** Tag ommission; The end tag must be omitted. */
+ int OMIT_END_MUST = 4;
+ /** Line Break; No break. */
+ int BREAK_NONE = 10;
+ /** Line Break; Break after the start tag. */
+ int BREAK_AFTER_START = 11;
+ /** Line Break; Break both before the start tagn and after the end tag. */
+ int BREAK_BEFORE_START_AND_AFTER_END = 12;
+ /* Layout */
+ /** initial value; the value should never returns to client programs. */
+ int LAYOUT_NONE = 100;
+ int LAYOUT_BLOCK = 101;
+ int LAYOUT_WRAP = 102;
+ /** No wrap object; like IMG, APPLET,... */
+ int LAYOUT_OBJECT = 103;
+ /** BR */
+ int LAYOUT_BREAK = 104;
+ /** Hidden object; like HTML or HEAD */
+ int LAYOUT_HIDDEN = 105;
+ /* Correction */
+ /** Correct; No correct. */
+ int CORRECT_NONE = 1000;
+ /** Correct; Meaningless when the content is empty. */
+ int CORRECT_EMPTY = 1001;
+ /** Correct; Meaningless when no attribut is set. */
+ int CORRECT_NEUTRAL = 1002;
+ /** Correct; Meaningless when same element is nested. */
+ int CORRECT_DUPLICATED = 1003;
+ /** Format; HTML */
+ int FORMAT_HTML = 10000;
+ /** Format; SSI */
+ int FORMAT_SSI = 10001;
+ /** Format; JSP script */
+ int FORMAT_JSP_SCRIPT = 10002;
+ /** Format; JSP directive */
+ int FORMAT_JSP_DIRECTIVE = 10003;
+ /** Format; XML */
+ int FORMAT_XML = 10004;
+ /** Format; MW */
+ int FORMAT_MW = 10005;
+
+ /**
+ * A short hand method to get an attribute declaration of a HTML element.
+ * @return com.ibm.sed.contentmodel.html.HTMLAttributeDeclaration
+ * @param attrName java.lang.String
+ */
+ HTMLAttributeDeclaration getAttributeDeclaration(String attrName);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclImpl.java
new file mode 100644
index 0000000000..3ec7fdb7dc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclImpl.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+
+
+/**
+ */
+class HTMLEntityDeclImpl extends CMNodeImpl implements HTMLEntityDeclaration {
+
+ private java.lang.String value = null;
+
+ /**
+ * CMEntityDeclImpl constructor comment.
+ * @param entityName java.lang.String; Entity name.
+ * @param entityValue java.lang.String; Value string.
+ */
+ public HTMLEntityDeclImpl(String entityName, String entityValue) {
+ super(entityName);
+ value = entityValue;
+ }
+
+ /**
+ * getName method
+ * @return java.lang.String
+ */
+ public String getName() {
+ return getNodeName();
+ }
+
+ /**
+ * Get CMNode type.<br>
+ * @return int; Always return ENTITY_DECLARATION.
+ */
+ public int getNodeType() {
+ return CMNode.ENTITY_DECLARATION;
+ }
+
+ /**
+ * getValue method
+ * @return java.lang.String
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return true;
+ return super.supports(propertyName);
+ }
+
+ /**
+ * Entities in HTML documents are always treated with ignoring cases.
+ * Because no special entities are defined in JSP 1.0, this method
+ * can always return <code>true</code>.<br>
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return new Boolean(true);
+ return super.getProperty(propertyName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclaration.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclaration.java
new file mode 100644
index 0000000000..b1b10148f6
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLEntityDeclaration.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * This interface is intended to be a public interface which has
+ * interfaces defined in both of {@link <code>CMEntityDeclaration</code>}
+ * and {@link <code>HTMLCMNode</code>}.<br>
+ */
+public interface HTMLEntityDeclaration extends org.eclipse.wst.common.contentmodel.CMEntityDeclaration {
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLPropertyDeclaration.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLPropertyDeclaration.java
new file mode 100644
index 0000000000..9ff07f645f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HTMLPropertyDeclaration.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * This interface is commonly used in declaration implementation, and internal use.
+ * Use getProperty() method for public use.
+ */
+public interface HTMLPropertyDeclaration {
+ /**
+ * To determin the type, look up the following keywords in C++DOM/DTDParser.cpp:
+ * <ul>
+ * <li>CORRECT_DUPLICATED - <code>GROUP_NODUP</code></li>
+ * <li>CORRECT_EMPTY - <code>GROUP_COMPACT</code></li>
+ * <li>CORRECT_NEUTRAL - <code>GROUP_NEUTRAL</code></li>
+ * <li>CORRECT_NONE - <code>(N/A)</code></li>
+ * </ul>
+ * @return int
+ */
+ int getCorrectionType();
+ /**
+ * Get the list of declarations those should be excluded from the content.<br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ CMContent getExclusion();
+ /**
+ * To determin the type, see the following files in the C++DOM:
+ * ElementType.cpp - ElementType#setGroup().
+ * Element.cpp - Element#getStartTag().
+ * @return int
+ */
+ int getFormatType();
+ /**
+ * Get the list of declarations those should be included into the content.<br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ CMContent getInclusion();
+ /**
+ * To determin the type, look up the following keywords in C++DOM/DTDParser.cpp:
+ * <ul>
+ * <li>LAYOUT_BLOCK - <code>GROUP_BLOCK</code></li>
+ * <li>LAYOUT_BREAK - <code>GROUP_BREAK</code></li>
+ * <li>LAYOUT_HIDDEN - <code>GROUP_HIDDEN</code></li>
+ * <li>LAYOUT_NONE - <code>(N/A)</code></li>
+ * <li>LAYOUT_OBJECT - <code>GROUP_NOWRAP</code></li>
+ * <li>LAYOUT_WRAP - <code>(N/A)</code></li>
+ * </ul>
+ * @return int
+ */
+ int getLayoutType();
+ /**
+ * To determine the type, see <code>Element::isBreakingBeforeElement()</code>
+ * and <code>Element::isBreakingAfterElement()</code> defined in C++DOM/Element.cpp.<br>
+ * @return int
+ */
+ int getLineBreakHint();
+ /**
+ * To determine the type, Check the HTML DTD.
+ * And look up <code>GROUP_NOEND</code> in C++DOM/DTDParser.cpp.<br>
+ * @return int
+ */
+ int getOmitType();
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNamedNodeMap
+ */
+ CMNamedNodeMap getProhibitedAncestors();
+ /**
+ * return true when the element is a JSP element.
+ */
+ boolean isJSP();
+ /**
+ * @return boolean
+ */
+ boolean shouldIndentChildSource();
+ /**
+ * Some elements should keep spaces in its child text nodes.
+ * For example, PRE and TEXTAREA. This method returns true,
+ * if a target element is one of such elements.
+ * @return boolean
+ */
+ boolean shouldKeepSpaces();
+ /**
+ * Returns <code>true</code>, if <code>nextElement</code> terminates
+ * the current element.
+ * Some elements like <code>P</code> terminates other <code>P</code>.
+ * That is, when <code>&lt;P&gt;</code> appears at the next to <code>P</code>,
+ * which end tags is omitted, it represents not only the beginning of the
+ * new <code>P</code> element but also the end of the previous <code>P</code>.
+ * <br>
+ * See the C++DOM/HTMLParser#_terminate(Element*) method.
+ * @param nextElement com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ boolean shouldTerminateAt(HTMLElementDeclaration nextElement);
+}
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedA.java
new file mode 100644
index 0000000000..84cb78bffe
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedA.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * A.
+ */
+final class HedA extends HedInlineContainer {
+
+ /**
+ */
+ public HedA(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.A, collection);
+ // CORRECT_EMPTY - GROUP_COMPACT
+ correctionType = CORRECT_EMPTY;
+ }
+
+ /**
+ * %attrs;
+ * (charset %Charset; #IMPLIED)
+ * (type %ContentType; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (href %URI; #IMPLIED)
+ * (hreflang %LanguageCode; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ * (rel %LinkTypes; #IMPLIED)
+ * (rev %LinkTypes; #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (directkey %Character; #IMPLIED)
+ * (shape %Shape; rect)
+ * (coords %Coords; #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CHARSET, HTML40Namespace.ATTR_NAME_TYPE, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_HREF, HTML40Namespace.ATTR_NAME_HREFLANG, HTML40Namespace.ATTR_NAME_TARGET, HTML40Namespace.ATTR_NAME_REL, HTML40Namespace.ATTR_NAME_REV, HTML40Namespace.ATTR_NAME_ACCESSKEY, HTML40Namespace.ATTR_NAME_DIRECTKEY, HTML40Namespace.ATTR_NAME_SHAPE, HTML40Namespace.ATTR_NAME_COORDS, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Exclusion.
+ * <code>A</code> has the exclusion.
+ * It is <code>A</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ CMNode a = elementCollection.getNamedItem(HTML40Namespace.ElementName.A);
+ if (a != null)
+ exclusion.appendChild(a);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.A, HTML40Namespace.ElementName.BUTTON};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedADDRESS.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedADDRESS.java
new file mode 100644
index 0000000000..3fb721c0e7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedADDRESS.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * ADDRESS.
+ */
+final class HedADDRESS extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedADDRESS(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.ADDRESS, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_ADDRESS;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAPPLET.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAPPLET.java
new file mode 100644
index 0000000000..48c420ef1f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAPPLET.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * APPLET.
+ */
+final class HedAPPLET extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedAPPLET(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.APPLET, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_PARAM_CONTAINER;
+ layoutType = LAYOUT_OBJECT;
+ indentChild = true;
+ }
+
+ /**
+ * %coreattrs;
+ * (codebase %URI; #IMPLIED)
+ * (archive CDATA #IMPLIED)
+ * (code CDATA #IMPLIED)
+ * (object CDATA #IMPLIED)
+ * (alt %Text; #IMPLIED) ... should be defined locally.
+ * (name CDATA #IMPLIED)
+ * (width %Length; #REQUIRED)
+ * (height %Length; #REQUIRED)
+ * (align %IAlign; #IMPLIED)
+ * (hspace %Pixels; #IMPLIED)
+ * (vspace %Pixels; #IMPLIED)
+ * (mayscript (mayscript) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CODEBASE, HTML40Namespace.ATTR_NAME_ARCHIVE, HTML40Namespace.ATTR_NAME_CODE, HTML40Namespace.ATTR_NAME_OBJECT, HTML40Namespace.ATTR_NAME_ALT, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_HSPACE, HTML40Namespace.ATTR_NAME_VSPACE, HTML40Namespace.ATTR_NAME_MAYSCRIPT};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // %align; ... should be defined locally.
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForImage();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAREA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAREA.java
new file mode 100644
index 0000000000..7014b587ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedAREA.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * AREA.
+ */
+final class HedAREA extends HedEmpty {
+
+ /**
+ */
+ public HedAREA(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.AREA, collection);
+ // LAYOUT_HIDDEN.
+ // Because, AREA is GROUP_HIDDEN in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * AREA.
+ * %attrs;
+ * (shape %Shape; rect)
+ * (coords %Coords; #IMPLIED)
+ * (href %URI; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ * (nohref (nohref) #IMPLIED)
+ * (alt %Text; #REQUIRED)
+ * (tabindex NUMBER #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_SHAPE, HTML40Namespace.ATTR_NAME_COORDS, HTML40Namespace.ATTR_NAME_HREF, HTML40Namespace.ATTR_NAME_TARGET, HTML40Namespace.ATTR_NAME_NOHREF, HTML40Namespace.ATTR_NAME_ALT, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_ACCESSKEY, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASE.java
new file mode 100644
index 0000000000..4b388cc7d8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASE.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * BASE.
+ */
+final class HedBASE extends HedEmpty {
+
+ /**
+ */
+ public HedBASE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BASE, collection);
+ // LAYOUT_HIDDEN.
+ // Because, BASE is GROUP_HIDDEN in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * BASE.
+ * (href %URI; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_HREF, HTML40Namespace.ATTR_NAME_TARGET};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASEFONT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASEFONT.java
new file mode 100644
index 0000000000..da1536fc63
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBASEFONT.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * BASEFONT.
+ */
+final class HedBASEFONT extends HedEmpty {
+
+ /**
+ */
+ public HedBASEFONT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BASEFONT, collection);
+ // LAYOUT_OBJECT - GROUP_NOWRAP.
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * BASEFONT.
+ * (id ID #IMPLIED)
+ * (size CDATA #REQUIRED) ... should be localy defined.
+ * (color %Color; #IMPLIED)
+ * (face CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ID, HTML40Namespace.ATTR_NAME_COLOR, HTML40Namespace.ATTR_NAME_FACE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (size CDATA #REQUIRED) ... should be localy defined.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_SIZE, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SIZE, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBDO.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBDO.java
new file mode 100644
index 0000000000..3cde33173e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBDO.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * BDO.
+ */
+final class HedBDO extends HedInlineContainer {
+
+ /**
+ */
+ public HedBDO(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BDO, collection);
+ // CORRECT_EMPTY - GROUP_COMPACT
+ correctionType = CORRECT_EMPTY;
+ }
+
+ /**
+ * %coreattrs;
+ * (lang %LanguageCode; #IMPLIED)
+ * (dir (ltr|rtl) #REQUIRED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_LANG};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (dir (ltr|rtl) #REQUIRED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {HTML40Namespace.ATTR_VALUE_LTR, HTML40Namespace.ATTR_VALUE_RTL};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_DIR, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_DIR, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBGSOUND.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBGSOUND.java
new file mode 100644
index 0000000000..baa939ff26
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBGSOUND.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+final class HedBGSOUND extends HedEmpty {
+
+ public HedBGSOUND(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BGSOUND, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * (src, CDATA, #IMPLIED)
+ * (loop, CDATA, #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return;
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+ // src
+ HTMLAttributeDeclaration attr = attributeCollection.getDeclaration(HTML40Namespace.ATTR_NAME_SRC);
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SRC, attr);
+ // loop
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, HTML40Namespace.ATTR_VALUE_INFINITE);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_LOOP, atype, CMAttributeDeclaration.OPTIONAL);
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_LOOP, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBLOCKQUOTE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBLOCKQUOTE.java
new file mode 100644
index 0000000000..dc0fed2697
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBLOCKQUOTE.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * BLOCKQUOTE.
+ */
+final class HedBLOCKQUOTE extends HedFlowContainer {
+
+ /**
+ */
+ public HedBLOCKQUOTE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BLOCKQUOTE, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * (cite %URI; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CITE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBODY.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBODY.java
new file mode 100644
index 0000000000..fdd5b98e20
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBODY.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * BODY.
+ */
+final class HedBODY extends HedFlowContainer {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.HEAD, HTML40Namespace.ElementName.BODY, HTML40Namespace.ElementName.FRAMESET, HTML40Namespace.ElementName.HTML};
+
+ /**
+ */
+ public HedBODY(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BODY, collection);
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_BOTH;
+ }
+
+ /**
+ * %attrs;
+ * %bodycolors;
+ * (onload %Script; #IMPLIED)
+ * (onunload %Script; #IMPLIED)
+ * (background %URI; #IMPLIED)
+ * (marginwidth %Pixels; #IMPLIED) ... D205514
+ * (marginheight %Pixels; #IMPLIED) .. D205514
+ * (topmargin, CDATA, #IMPLIED) ...... D205514
+ * (bottommargin, CDATA, #IMPLIED) ... D205514
+ * (leftmargin, CDATA, #IMPLIED) ..... D205514
+ * (rightmargin, CDATA, #IMPLIED) .... D205514
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %bodycolors;
+ attributeCollection.getBodycolors(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ONLOAD, HTML40Namespace.ATTR_NAME_ONUNLOAD, HTML40Namespace.ATTR_NAME_BACKGROUND,
+ // <<D205514
+ HTML40Namespace.ATTR_NAME_MARGINWIDTH, HTML40Namespace.ATTR_NAME_MARGINHEIGHT, HTML40Namespace.ATTR_NAME_TOPMARGIN, HTML40Namespace.ATTR_NAME_BOTTOMMARGIN, HTML40Namespace.ATTR_NAME_LEFTMARGIN, HTML40Namespace.ATTR_NAME_RIGHTMARGIN
+ // D205514
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Inclusion.
+ * "Lazy eval."<br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getInclusion() {
+ if (inclusion != null)
+ return inclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ // (INS|DEL)
+ inclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ String[] names = {HTML40Namespace.ElementName.INS, HTML40Namespace.ElementName.DEL};
+ elementCollection.getDeclarations(inclusion, Arrays.asList(names).iterator());
+ return inclusion;
+ }
+
+ /**
+ * BODY has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBR.java
new file mode 100644
index 0000000000..d6adcb067a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBR.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+/**
+ * BR.
+ */
+final class HedBR extends HedEmpty {
+
+ /**
+ */
+ public HedBR(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BR, collection);
+ // LAYOUT_BREAK.
+ // Because, BR is GROUP_BREAK in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_BREAK;
+ }
+
+ /**
+ * BR.
+ * %coreattrs;
+ * (clear (left | all | right | none) none)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+ // clear
+ HTMLAttributeDeclaration attr = attributeCollection.getDeclaration(HTML40Namespace.ATTR_NAME_CLEAR);
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_CLEAR, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBUTTON.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBUTTON.java
new file mode 100644
index 0000000000..7360060415
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedBUTTON.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * BUTTON.
+ */
+final class HedBUTTON extends HedFlowContainer {
+
+ /**
+ */
+ public HedBUTTON(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.BUTTON, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * %reserved; ... empty.
+ * (name CDATA #IMPLIED)
+ * (value CDATA #IMPLIED)
+ * (type (button|submit|reset) submit) ... should be defined locally.
+ * (disabled (disabled) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_VALUE, HTML40Namespace.ATTR_NAME_DISABLED, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_ACCESSKEY, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (type (button|submit|reset) submit) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {HTML40Namespace.ATTR_VALUE_BUTTON, HTML40Namespace.ATTR_VALUE_SUBMIT, HTML40Namespace.ATTR_VALUE_RESET};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+ }
+
+ /**
+ * Exclusion.
+ * <code>FORM</code> has the exclusion.
+ * It is <code>FORM</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null; // fatal
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ String[] names = {HTML40Namespace.ElementName.A, HTML40Namespace.ElementName.FORM, HTML40Namespace.ElementName.ISINDEX, HTML40Namespace.ElementName.FIELDSET, HTML40Namespace.ElementName.IFRAME};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+ elementCollection.getFormctrl(exclusion);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCAPTION.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCAPTION.java
new file mode 100644
index 0000000000..dbab319f4c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCAPTION.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+/**
+ * CAPTION.
+ */
+final class HedCAPTION extends HedInlineContainer {
+
+ /**
+ */
+ public HedCAPTION(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.CAPTION, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * (align %CAlign; #IMPLIED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForCaption();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCENTER.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCENTER.java
new file mode 100644
index 0000000000..55e0fbf021
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCENTER.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * CENTER.
+ */
+final class HedCENTER extends HedFlowContainer {
+
+ /**
+ */
+ public HedCENTER(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.CENTER, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOL.java
new file mode 100644
index 0000000000..ba3f1b7362
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOL.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * COL.
+ */
+final class HedCOL extends HedEmpty {
+
+ /**
+ */
+ public HedCOL(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.COL, collection);
+ // LAYOUT_BLOCK.
+ // Because, COL is GROUP_BLOCK in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * COL.
+ * %attrs;
+ * (span NUMBER 1)
+ * (width %MultiLength; #IMPLIED) ... should be defined locally.
+ * %cellhalign;
+ * %cellvalign;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (span NUMBER 1)
+ String[] names = {HTML40Namespace.ATTR_NAME_SPAN};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (width %MultiLength; #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.MULTI_LENGTH);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_WIDTH, attr);
+
+ // %cellhalign;
+ attributeCollection.getCellhalign(attributes);
+ // %cellvalign;
+ attributeCollection.getCellvalign(attributes);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOLGROUP.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOLGROUP.java
new file mode 100644
index 0000000000..37528e5a1e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedCOLGROUP.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * COLGROUP.
+ */
+final class HedCOLGROUP extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.COLGROUP, HTML40Namespace.ElementName.CAPTION, HTML40Namespace.ElementName.THEAD, HTML40Namespace.ElementName.TBODY, HTML40Namespace.ElementName.TFOOT, HTML40Namespace.ElementName.TR};
+
+ /**
+ * @param ownerDocument com.ibm.sed.contentmodel.html.HCMDocImpl
+ */
+ public HedCOLGROUP(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.COLGROUP, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_COLUMN_GROUP;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * (span NUMBER 1)
+ * (width %MultiLength; #IMPLIED) ... should be defined locally.
+ * %cellhalign;
+ * %cellvalign;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %cellhalign;
+ attributeCollection.getCellhalign(attributes);
+ // %cellvalign;
+ attributeCollection.getCellvalign(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_SPAN};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (width %MultiLength; #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.MULTI_LENGTH);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_WIDTH, attr);
+ }
+
+ /**
+ * LI has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDD.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDD.java
new file mode 100644
index 0000000000..cdb4f6f603
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDD.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * DD.
+ */
+final class HedDD extends HedFlowContainer {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.DT, HTML40Namespace.ElementName.DD};
+
+ /**
+ */
+ public HedDD(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.DD, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ * DD has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDIV.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDIV.java
new file mode 100644
index 0000000000..5faaf3c093
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDIV.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * DIV.
+ */
+final class HedDIV extends HedFlowContainer {
+
+ /**
+ */
+ public HedDIV(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.DIV, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * %align;
+ * %reserved;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %align;
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForParagraph();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ // %reserved; ... empty
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDL.java
new file mode 100644
index 0000000000..ff2aba550b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDL.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * DL.
+ */
+final class HedDL extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedDL(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.DL, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_DEFINITION_LIST;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ indentChild = true;
+ }
+
+ /**
+ * %arrays;
+ * (compact (compact) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_COMPACT};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDT.java
new file mode 100644
index 0000000000..6c7bd4856a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedDT.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * DT.
+ */
+final class HedDT extends HedInlineContainer {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.DT, HTML40Namespace.ElementName.DD};
+
+ /**
+ */
+ public HedDT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.DT, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ * DT has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEMBED.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEMBED.java
new file mode 100644
index 0000000000..1b94431f97
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEMBED.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * EMBED.
+ */
+final class HedEMBED extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedEMBED(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.EMBED, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_EMBED;
+ layoutType = LAYOUT_OBJECT;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %coreattrs;
+ * %events;
+ * (src %URI; #REQUIRED) ... should be defined locally.
+ * (height %Length; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (align %IAlign; #IMPLIED) ... should be defined locally.
+ * (hspace %Pixels; #IMPLIED)
+ * (vspace %Pixels; #IMPLIED)
+ * (loop CDATA #IMPLIED)
+ * (hidden CDATA #IMPLIED)
+ * (volume CDATA #IMPLIED)
+ * (autostart (true|false) #IMPLIED)
+ * (autoplay (true|false) #IMPLIED)
+ * (autosize (true|false) #IMPLIED)
+ * (controller (true|false) true)
+ * (scale CDATA #IMPLIED)
+ * (showcontrols (true|false) #IMPLIED)
+ * (playcount NUMBER #IMPLIED)
+ * (repeat CDATA #IMPLIED)
+ * (panel CDATA #IMPLIED)
+ * (text CDATA #IMPLIED)
+ * (palette CDATA #IMPLIED)
+ * (textfocus CDATA #IMPLIED)
+ * (type CDATA #IMPLIED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+ // %events;
+ attributeCollection.getEvents(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_HSPACE, HTML40Namespace.ATTR_NAME_VSPACE, HTML40Namespace.ATTR_NAME_LOOP, HTML40Namespace.ATTR_NAME_HIDDEN, HTML40Namespace.ATTR_NAME_VOLUME, HTML40Namespace.ATTR_NAME_AUTOSTART, HTML40Namespace.ATTR_NAME_AUTOPLAY, HTML40Namespace.ATTR_NAME_AUTOSIZE, HTML40Namespace.ATTR_NAME_CONTROLLER, HTML40Namespace.ATTR_NAME_SCALE, HTML40Namespace.ATTR_NAME_SHOWCONTROLS, HTML40Namespace.ATTR_NAME_PLAYCOUNT, HTML40Namespace.ATTR_NAME_REPEAT, HTML40Namespace.ATTR_NAME_PANEL, HTML40Namespace.ATTR_NAME_TEXT, HTML40Namespace.ATTR_NAME_PALETTE, HTML40Namespace.ATTR_NAME_TEXTFOCUS};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ // (src %URI; #REQUIRED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_SRC, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SRC, attr);
+
+ // (align %IAlign; #IMPLIED) ... should be defined locally.
+ attr = AttributeCollection.createAlignForImage();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+
+ // (type CDATA #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEmpty.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEmpty.java
new file mode 100644
index 0000000000..bcf3dcee79
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedEmpty.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+
+/**
+ * Base class for EMPTY type element declarations.
+ */
+abstract class HedEmpty extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedEmpty(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_EMPTY;
+ // EMPTY type has no end tag.
+ omitType = OMIT_END_MUST;
+ }
+
+ /**
+ * Content.<br>
+ * EMPTY type always returns <code>null</code>.
+ * <br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getContent() {
+ return null;
+ }
+
+ /**
+ * Content type.<br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public int getContentType() {
+ return CMElementDeclaration.EMPTY;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFIELDSET.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFIELDSET.java
new file mode 100644
index 0000000000..16d28c0333
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFIELDSET.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * FIELDSET.
+ */
+final class HedFIELDSET extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedFIELDSET(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.FIELDSET, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_FIELDSET;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON, HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFONT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFONT.java
new file mode 100644
index 0000000000..20ec1a5860
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFONT.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * FONT.
+ */
+final class HedFONT extends HedInlineContainer {
+
+ /**
+ */
+ public HedFONT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.FONT, collection);
+ // CORRECT_EMPTY - GROUP_COMPACT
+ correctionType = CORRECT_EMPTY;
+ }
+
+ /**
+ * %coreattrs;
+ * %i18n;
+ * (size CDATA #IMPLIED) ... should be defined locally.
+ * (color %Color; #IMPLIED)
+ * (face CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_COLOR, HTML40Namespace.ATTR_NAME_FACE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (size CDATA #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SIZE, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFORM.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFORM.java
new file mode 100644
index 0000000000..e823b0f134
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFORM.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * FORM.
+ */
+final class HedFORM extends HedFlowContainer {
+
+ /**
+ */
+ public HedFORM(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.FORM, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * (action %URI; #REQUIRED)
+ * (method (GET|POST) GET)
+ * (enctype %ContentType; "application/x-www-form-urlencoded")
+ * (accept %ContentTypes; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (onsubmit %Script; #IMPLIED)
+ * (onreset %Script; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ * (accept-charset %Charsets; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ACTION, HTML40Namespace.ATTR_NAME_METHOD, HTML40Namespace.ATTR_NAME_ENCTYPE, HTML40Namespace.ATTR_NAME_ACCEPT, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_ONSUBMIT, HTML40Namespace.ATTR_NAME_ONRESET, HTML40Namespace.ATTR_NAME_TARGET, HTML40Namespace.ATTR_NAME_ACCEPT_CHARSET};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Exclusion.
+ * <code>FORM</code> has the exclusion.
+ * It is <code>FORM</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null; // fatal
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ CMNode form = elementCollection.getNamedItem(HTML40Namespace.ElementName.FORM);
+ if (form != null)
+ exclusion.appendChild(form);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON, HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.FORM, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAME.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAME.java
new file mode 100644
index 0000000000..bb7d37305b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAME.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * FRAME.
+ */
+final class HedFRAME extends HedEmpty {
+
+ /**
+ */
+ public HedFRAME(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.FRAME, collection);
+ // LAYOUT_HIDDEN.
+ // Because, FRAME is GROUP_HIDDEN in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * FRAME.
+ * %coreattrs;
+ * (longdesc %URI; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (src %URI; #IMPLIED)
+ * (frameborder (1|0) 1)
+ * (marginwidth %Pixels; #IMPLIED)
+ * (marginheight %Pixels; #IMPLIED)
+ * (noresize (noresize) #IMPLIED)
+ * (scrolling (yes|no|auto) auto)
+ * (bordercolor %Color #IMPLIED) ... D205514
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_LONGDESC, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_SRC, HTML40Namespace.ATTR_NAME_FRAMEBORDER, HTML40Namespace.ATTR_NAME_MARGINWIDTH, HTML40Namespace.ATTR_NAME_MARGINHEIGHT, HTML40Namespace.ATTR_NAME_NORESIZE, HTML40Namespace.ATTR_NAME_SCROLLING, HTML40Namespace.ATTR_NAME_BORDERCOLOR // D20554
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAMESET.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAMESET.java
new file mode 100644
index 0000000000..a2ab71ffbd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFRAMESET.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * FRAMESET.
+ */
+final class HedFRAMESET extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedFRAMESET(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.FRAMESET, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_FRAMESET;
+ layoutType = LAYOUT_HIDDEN;
+ indentChild = true;
+ }
+
+ /**
+ * %coreattrs;
+ * (rows %MultiLengths; #IMPLIED) ... should be defined locally.
+ * (cols %MultiLengths; #IMPLIED) ... should be defined locally.
+ * (onload %Script; #IMPLIED)
+ * (onunload %Script; #IMPLIED)
+ * (frameborder (yes|no) #IMPLIED) ... should be defined locally.
+ * (border %Pixels; #IMPLIED)
+ * (bordercolor %Color #IMPLIED) ... D205514
+ * (framespacing CDATA #IMPLIED) ... D215684
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getCore(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ONLOAD, HTML40Namespace.ATTR_NAME_ONUNLOAD, HTML40Namespace.ATTR_NAME_BORDER, HTML40Namespace.ATTR_NAME_BORDERCOLOR, // D205514
+ HTML40Namespace.ATTR_NAME_FRAMESPACING // D215684
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ // (rows %MultiLengths; #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.MULTI_LENGTH);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_ROWS, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ROWS, attr);
+
+ // (cols %MultiLengths; #IMPLIED) ... should be defined locally.
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_COLS, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_COLS, attr);
+
+ // (frameborder (yes|no) #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {HTML40Namespace.ATTR_VALUE_YES, HTML40Namespace.ATTR_VALUE_NO};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_FRAMEBORDER, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_FRAMEBORDER, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFlowContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFlowContainer.java
new file mode 100644
index 0000000000..6324dee7ca
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFlowContainer.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * Base class for (%flow;)* containers.
+ */
+abstract class HedFlowContainer extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedFlowContainer(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_FLOW_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFontStyle.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFontStyle.java
new file mode 100644
index 0000000000..ff06724101
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedFontStyle.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * %fontstyle;
+ */
+final class HedFontStyle extends HedInlineContainer {
+
+ /**
+ */
+ public HedFontStyle(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ if (elementName.equalsIgnoreCase(HTML40Namespace.ElementName.BIG) || elementName.equalsIgnoreCase(HTML40Namespace.ElementName.SMALL)) {
+ correctionType = CORRECT_EMPTY;
+ }
+ else { // B, I, U, ...
+ correctionType = CORRECT_DUPLICATED;
+ }
+ }
+
+ /**
+ * %attrs;
+ * @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ String myName = getElementName();
+ if (!myName.equalsIgnoreCase(HTML40Namespace.ElementName.BIG) && !myName.equalsIgnoreCase(HTML40Namespace.ElementName.SMALL))
+ return EMPTY_MAP;
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.PRE};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHEAD.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHEAD.java
new file mode 100644
index 0000000000..df4a36565f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHEAD.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * HTML.
+ */
+final class HedHEAD extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.HEAD, HTML40Namespace.ElementName.BODY, HTML40Namespace.ElementName.FRAMESET, HTML40Namespace.ElementName.HTML};
+
+ /**
+ */
+ public HedHEAD(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.HEAD, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_HEAD;
+ layoutType = LAYOUT_HIDDEN;
+ omitType = OMIT_BOTH;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>HEAD</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td>%i18n;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * <tr>
+ * <td>profile</td><td>URI</td><td>#IMPLIED</td><td>N/A</td><td>-</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+ // profile
+ HTMLAttributeDeclaration adec = attributeCollection.getDeclaration(HTML40Namespace.ATTR_NAME_PROFILE);
+ if (adec != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_PROFILE, adec);
+ }
+
+ /**
+ * HEAD has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHR.java
new file mode 100644
index 0000000000..958a1fd556
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHR.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * HR.
+ */
+final class HedHR extends HedEmpty {
+
+ /**
+ */
+ public HedHR(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.HR, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs
+ * (align (left|center|right) #IMPLIED) ... should be defined locally.
+ * (noshade (noshade) #IMPLIED)
+ * (size %Pixels; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (color %Color; #IMPLIED) ... D205514
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (align (left|center|right) #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {HTML40Namespace.ATTR_VALUE_LEFT, HTML40Namespace.ATTR_VALUE_CENTER, HTML40Namespace.ATTR_VALUE_RIGHT};
+ atype.setEnumValues(values);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+
+ // the rest.
+ String[] names = {HTML40Namespace.ATTR_NAME_NOSHADE, HTML40Namespace.ATTR_NAME_SIZE, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_COLOR // D205514
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHTML.java
new file mode 100644
index 0000000000..bb0dfb2d5c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHTML.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * HTML.
+ */
+final class HedHTML extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.HTML};
+
+ /**
+ */
+ public HedHTML(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.HTML, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_HTML;
+ layoutType = LAYOUT_HIDDEN;
+ omitType = OMIT_BOTH;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>HTML</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td><code>%i18n;</code></td><td>-</td><td>-</td><td>-</td>
+ * <td>{@link PDCMDocImpl#getAttrDeclarationsI18n}</td>
+ * </tr>
+ * <tr>
+ * <td>version</td><td>CDATA</td><td>#FIXED</td>
+ * <td>{@link HTML_VERSION_TRANSITIONAL}</td><td>deplecated in HTML4.01</td>
+ * </tr>
+ * </tbody>
+ * </table><br>
+ * @see com.ibm.sed.contentmodel.html.AbstractHTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+ // version
+ HTMLAttributeDeclaration adec = attributeCollection.getDeclaration(HTML40Namespace.ATTR_NAME_VERSION);
+ if (adec != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_VERSION, adec);
+ }
+
+ /**
+ * HTML has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHeading.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHeading.java
new file mode 100644
index 0000000000..1e572ebd5c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedHeading.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * H[1-6].
+ */
+final class HedHeading extends HedInlineContainer {
+
+ /**
+ */
+ public HedHeading(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>H1</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td>%attrs;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * <tr>
+ * <td>%align;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * <p><b>%align;</b> means <code>align (left|center|right|justify) #IMPLIED</code>.
+ * Unfortunately, this <code>align</code> is different from one in
+ * <code>IMG</code> or <code>TABLE</code>. So, the attribute declaration
+ * of <code>align</code> should be localy created and it shouldn't be registered
+ * in a <code>HCMDocImpl</code> instance.</p>
+ * <p>However, %align is used in sevaral times. I wouldn't write same code
+ * in many times. So, I add a new utility method into <code>CMUtil</code>
+ * to create the attribute declaration.</p>
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // align
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForParagraph();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIFRAME.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIFRAME.java
new file mode 100644
index 0000000000..a2c592f596
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIFRAME.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * IFRAME.
+ */
+final class HedIFRAME extends HedFlowContainer {
+
+ /**
+ */
+ public HedIFRAME(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.IFRAME, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * %coreattrs;
+ * (longdesc %URI; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (src %URI; #IMPLIED)
+ * (frameborder (1|0) 1)
+ * (marginwidth %Pixels; #IMPLIED)
+ * (marginheight %Pixels; #IMPLIED)
+ * (scrolling (yes|no|auto) auto)
+ * (align %IAlign; #IMPLIED) ... should be defined locally.
+ * (height %Length; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_LONGDESC, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_SRC, HTML40Namespace.ATTR_NAME_FRAMEBORDER, HTML40Namespace.ATTR_NAME_MARGINWIDTH, HTML40Namespace.ATTR_NAME_MARGINHEIGHT, HTML40Namespace.ATTR_NAME_SCROLLING, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_WIDTH};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // align
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForImage();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIMG.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIMG.java
new file mode 100644
index 0000000000..b2244bde26
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedIMG.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * IMG.
+ */
+final class HedIMG extends HedEmpty {
+
+ /**
+ */
+ public HedIMG(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.IMG, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * IMG.
+ * %attrs;
+ * (src %URI; #REQUIRED): should be defined locally.
+ * (alt %Text; #REQUIRED)
+ * (longdesc %URI; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (height %Length; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (usemap %URI; #IMPLIED)
+ * (ismap (ismap) #IMPLIED)
+ * (align %IAlign; #IMPLIED): should be defined locally.
+ * (border %Pixels; #IMPLIED)
+ * (hspace %Pixels; #IMPLIED)
+ * (vspace %Pixels; #IMPLIED)
+ * (mapfile %URI; #IMPLIED)
+ * @see com.ibm.sed.contentmodel.html.AbstractHTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (src %URI; #REQUIRED): should be defined locally.
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_SRC, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SRC, attr);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ALT, HTML40Namespace.ATTR_NAME_LONGDESC, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_USEMAP, HTML40Namespace.ATTR_NAME_ISMAP, HTML40Namespace.ATTR_NAME_BORDER, HTML40Namespace.ATTR_NAME_HSPACE, HTML40Namespace.ATTR_NAME_VSPACE, HTML40Namespace.ATTR_NAME_MAPFILE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // align (local); should be defined locally.
+ attr = AttributeCollection.createAlignForImage();
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.PRE};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedINPUT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedINPUT.java
new file mode 100644
index 0000000000..c1dc3d15b1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedINPUT.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * INPUT.
+ */
+final class HedINPUT extends HedEmpty {
+
+ /**
+ */
+ public HedINPUT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.INPUT, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * INPUT.
+ * %attrs;
+ * (type %InputType; TEXT) ... should be defined locally.
+ * (name CDATA #IMPLIED)
+ * (value CDATA #IMPLIED)
+ * (checked (checked) #IMPLIED)
+ * (disabled (disabled) #IMPLIED)
+ * (readonly (readonly) #IMPLIED)
+ * (size CDATA #IMPLIED) ... should be defined locally.
+ * (maxlength NUMBER #IMPLIED)
+ * (src %URI; #IMPLIED)
+ * (alt CDATA #IMPLIED) ... should be defined locally.
+ * (usemap %URI; #IMPLIED)
+ * (ismap (ismap) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ * (onselect %Script; #IMPLIED)
+ * (onchange %Script; #IMPLIED)
+ * (accept %ContentTypes; #IMPLIED)
+ * (align %IAlign; #IMPLIED) ... should be defined locally.
+ * (istyle CDATA #IMPLIED)
+ * <<D215684
+ * (width CDATA; #IMPLIED)
+ * (height CDATA; #IMPLIED)
+ * (border CDATA; #IMPLIED)
+ * D215684
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ // (type %InputType; TEXT) ... should be defined locally.
+ // NOTE: %InputType is ENUM;
+ // (text | password | checkbox | radio | submit | reset |
+ // file | hidden | image | button)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {HTML40Namespace.ATTR_VALUE_TEXT, HTML40Namespace.ATTR_VALUE_PASSWORD, HTML40Namespace.ATTR_VALUE_CHECKBOX, HTML40Namespace.ATTR_VALUE_RADIO, HTML40Namespace.ATTR_VALUE_SUBMIT, HTML40Namespace.ATTR_VALUE_RESET, HTML40Namespace.ATTR_VALUE_FILE, HTML40Namespace.ATTR_VALUE_HIDDEN, HTML40Namespace.ATTR_VALUE_IMAGE, HTML40Namespace.ATTR_VALUE_BUTTON};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, HTML40Namespace.ATTR_VALUE_TEXT);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+
+ // (size CDATA #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SIZE, attr);
+
+ // (alt CDATA #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_ALT, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALT, attr);
+
+ // (align %IAlign; #IMPLIED) ... should be defined locally.
+ attr = AttributeCollection.createAlignForImage();
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+
+ // the rest.
+ String[] names = {HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_VALUE, HTML40Namespace.ATTR_NAME_CHECKED, HTML40Namespace.ATTR_NAME_DISABLED, HTML40Namespace.ATTR_NAME_READONLY, HTML40Namespace.ATTR_NAME_SIZE, HTML40Namespace.ATTR_NAME_MAXLENGTH, HTML40Namespace.ATTR_NAME_SRC, HTML40Namespace.ATTR_NAME_ALT, HTML40Namespace.ATTR_NAME_USEMAP, HTML40Namespace.ATTR_NAME_ISMAP, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_ACCESSKEY, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR, HTML40Namespace.ATTR_NAME_ONSELECT, HTML40Namespace.ATTR_NAME_ONCHANGE, HTML40Namespace.ATTR_NAME_ACCEPT, HTML40Namespace.ATTR_NAME_ALIGN, HTML40Namespace.ATTR_NAME_ISTYLE,
+ //<<D215684
+ HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_BORDER
+ //<D215684
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedISINDEX.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedISINDEX.java
new file mode 100644
index 0000000000..7f84d63662
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedISINDEX.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * ISINDEX.
+ */
+final class HedISINDEX extends HedEmpty {
+
+ /**
+ */
+ public HedISINDEX(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.ISINDEX, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * ISINDEX.
+ * %coreattrs;
+ * %i18n;
+ * (prompt %Text; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+
+ HTMLAttributeDeclaration attr = attributeCollection.getDeclaration(HTML40Namespace.ATTR_NAME_PROMPT);
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_PROMPT, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON, HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedInlineContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedInlineContainer.java
new file mode 100644
index 0000000000..eb97a66570
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedInlineContainer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * Base class for (%inline;)* containers.
+ */
+abstract class HedInlineContainer extends HTMLElemDeclImpl {
+
+ /**
+ * HedInlineContainer.
+ * @param elementName java.lang.String
+ * @param collection ElementCollection
+ */
+ public HedInlineContainer(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_INLINE_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLABEL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLABEL.java
new file mode 100644
index 0000000000..5251560714
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLABEL.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * LABEL.
+ */
+final class HedLABEL extends HedInlineContainer {
+
+ /**
+ */
+ public HedLABEL(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.LABEL, collection);
+ }
+
+ /**
+ * %attrs;
+ * (for IDREF #IMPLIED) ... should be defined locally.
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (for IDREF #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.IDREF);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_FOR, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_FOR, attr);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ACCESSKEY, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Exclusion.
+ * <code>LABEL</code> has the exclusion.
+ * It is <code>LABEL</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ CMNode label = elementCollection.getNamedItem(HTML40Namespace.ElementName.LABEL);
+ if (label != null)
+ exclusion.appendChild(label);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON, HTML40Namespace.ElementName.LABEL};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLEGEND.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLEGEND.java
new file mode 100644
index 0000000000..138f7303a9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLEGEND.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * LEGEND.
+ */
+final class HedLEGEND extends HedInlineContainer {
+
+ /**
+ */
+ public HedLEGEND(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.LEGEND, collection);
+ }
+
+ /**
+ * (accesskey %Character; #IMPLIED)
+ * (align %LAlign; #IMPLIED) ... shuld be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ACCESSKEY};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // align
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForLegend();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLI.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLI.java
new file mode 100644
index 0000000000..892af63cde
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLI.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * LI.
+ */
+final class HedLI extends HedFlowContainer {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.LI};
+
+ /**
+ */
+ public HedLI(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.LI, collection);
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %attrs;
+ * (type %LIStyle; #IMPLIED) ... should be defined locally.
+ * (value NUMBER #IMPLIED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (type %LIStyle; #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LI_STYLE);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+
+ // (value NUMBER #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_VALUE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_VALUE, attr);
+ }
+
+ /**
+ * LI has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLINK.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLINK.java
new file mode 100644
index 0000000000..7489b750f4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedLINK.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * LINK.
+ */
+final class HedLINK extends HedEmpty {
+
+ /**
+ */
+ public HedLINK(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.LINK, collection);
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * LINK.
+ * %attrs;
+ * (charset %Charset; #IMPLIED)
+ * (href %URI; #IMPLIED)
+ * (hreflang %LanguageCode; #IMPLIED)
+ * (type %ContentType; #IMPLIED): should be defined locally.
+ * (rel %LinkTypes; #IMPLIED)
+ * (rev %LinkTypes; #IMPLIED)
+ * (media %MediaDesc; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CHARSET, HTML40Namespace.ATTR_NAME_HREF, HTML40Namespace.ATTR_NAME_HREFLANG, HTML40Namespace.ATTR_NAME_REL, HTML40Namespace.ATTR_NAME_REV, HTML40Namespace.ATTR_NAME_MEDIA, HTML40Namespace.ATTR_NAME_TARGET};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (type %ContentType; #IMPLIED)
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedListItemContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedListItemContainer.java
new file mode 100644
index 0000000000..875bb606c5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedListItemContainer.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * Base class for list item container declarations.
+ * - OL, UL, MENU, DIR.
+ */
+abstract class HedListItemContainer extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedListItemContainer(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_LI_CONTAINER;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ indentChild = true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMAP.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMAP.java
new file mode 100644
index 0000000000..d167f6976d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMAP.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+/**
+ * MAP.
+ */
+final class HedMAP extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedMAP(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.MAP, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_MAP;
+ layoutType = LAYOUT_OBJECT;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * (name CDATA #REQUIRED) ... should be defined locally
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (name CDATA #REQUIRED) ... should be defined locally
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_NAME, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_NAME, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMARQUEE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMARQUEE.java
new file mode 100644
index 0000000000..d9ab01cae4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMARQUEE.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * MARQUEE.
+ */
+final class HedMARQUEE extends HedFlowContainer {
+
+ /**
+ */
+ public HedMARQUEE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.MARQUEE, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * %attrs;
+ * (behavior (scroll|slide|alternate) scroll)
+ * (bgcolor %Color; #IMPLIED)
+ * (direction (left|right|up|down) left)
+ * (height CDATA #IMPLIED) ... should be defined locally.
+ * (hspace NUMBER #IMPLIED) ... should be defined locally.
+ * (loop CDATA #IMPLIED)
+ * (scrollamount NUMBER #IMPLIED)
+ * (scrolldelay NUMBER #IMPLIED)
+ * (vspace NUMBER #IMPLIED) ... should be defined locally.
+ * (width CDATA #IMPLIED) ... should be defined locally.
+ * (truespeed (truespeed) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_BEHAVIOR, HTML40Namespace.ATTR_NAME_BGCOLOR, HTML40Namespace.ATTR_NAME_DIRECTION, HTML40Namespace.ATTR_NAME_LOOP, HTML40Namespace.ATTR_NAME_SCROLLAMOUNT, HTML40Namespace.ATTR_NAME_SCROLLDELAY, HTML40Namespace.ATTR_NAME_TRUESPEED};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ // (height CDATA #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_HEIGHT, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_HEIGHT, attr);
+
+ // (width CDATA #IMPLIED) ... should be defined locally.
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_WIDTH, attr);
+
+ // (hspace NUMBER #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_HSPACE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_HSPACE, attr);
+
+ // (vspace NUMBER #IMPLIED) ... should be defined locally.
+ attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_VSPACE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_VSPACE, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMENU.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMENU.java
new file mode 100644
index 0000000000..29f0456288
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMENU.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * MENU/DIR.
+ */
+final class HedMENU extends HedListItemContainer {
+
+ /**
+ */
+ public HedMENU(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ }
+
+ /**
+ * MENU/DIR.
+ * (compact (compact) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_COMPACT};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Exclusion.
+ * <code>MENU/DIR</code> has the exclusion.
+ * It is <code>%block;</code>.
+ * %block; is:
+ * P | %heading; | %list; | %preformatted; | DL | DIV | CENTER |
+ * NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR |
+ * TABLE | FIELDSET | ADDRESS.
+ * %heading; is: H1 | H2 | H3 | H4 | H5 | H6.
+ * %list; is : UL | OL | DIR | MENU.
+ * %preformatted; is PRE.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ // %block;
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ String[] names = {HTML40Namespace.ElementName.P, HTML40Namespace.ElementName.H1, HTML40Namespace.ElementName.H2, HTML40Namespace.ElementName.H3, HTML40Namespace.ElementName.H4, HTML40Namespace.ElementName.H5, HTML40Namespace.ElementName.H6, HTML40Namespace.ElementName.UL, HTML40Namespace.ElementName.OL, HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU, HTML40Namespace.ElementName.PRE, HTML40Namespace.ElementName.DL, HTML40Namespace.ElementName.DIV, HTML40Namespace.ElementName.CENTER, HTML40Namespace.ElementName.NOSCRIPT, HTML40Namespace.ElementName.NOFRAMES, HTML40Namespace.ElementName.BLOCKQUOTE, HTML40Namespace.ElementName.FORM, HTML40Namespace.ElementName.ISINDEX, HTML40Namespace.ElementName.HR, HTML40Namespace.ElementName.TABLE, HTML40Namespace.ElementName.FIELDSET, HTML40Namespace.ElementName.ADDRESS};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMETA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMETA.java
new file mode 100644
index 0000000000..17f09b4f2c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMETA.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * META.
+ */
+final class HedMETA extends HedEmpty {
+
+ /**
+ */
+ public HedMETA(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.META, collection);
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * META.
+ * %i18n;
+ * (http-equiv NAME #IMPLIED)
+ * (name NAME #IMPLIED) ... should be defined locally.
+ * (content CDATA #REQUIRED)
+ * (scheme CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+
+ // (name NAME #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.NAME);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_NAME, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_NAME, attr);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_HTTP_EQUIV, HTML40Namespace.ATTR_NAME_CONTENT, HTML40Namespace.ATTR_NAME_SCHEME};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMarkChanges.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMarkChanges.java
new file mode 100644
index 0000000000..e8bcc195ae
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedMarkChanges.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * (INS|DEL)
+ */
+final class HedMarkChanges extends HedFlowContainer {
+
+ /**
+ */
+ public HedMarkChanges(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ }
+
+ /**
+ * %attrs;
+ * (cite %URI; #IMPLIED)
+ * (datetime %Datetime; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CITE, HTML40Namespace.ATTR_NAME_DATETIME};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOBR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOBR.java
new file mode 100644
index 0000000000..2b18887e9f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOBR.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * NOBR -- not standard tag but it is commonly used.
+ */
+final class HedNOBR extends HedInlineContainer {
+
+
+ public HedNOBR(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.NOBR, collection);
+ correctionType = HTMLElementDeclaration.CORRECT_DUPLICATED;
+ }
+
+ protected void createAttributeDeclarations() {
+ // No attributes is defined.
+ if (attributes != null)
+ return;
+ attributes = new CMNamedNodeMapImpl();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOEMBED.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOEMBED.java
new file mode 100644
index 0000000000..821a3e542c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOEMBED.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+/**
+ * NOEMBED.
+ */
+final class HedNOEMBED extends HedFlowContainer {
+
+ /**
+ */
+ public HedNOEMBED(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.NOEMBED, collection);
+ }
+
+ /**
+ * %coreattrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOFRAMES.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOFRAMES.java
new file mode 100644
index 0000000000..c780b6d353
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOFRAMES.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * NOFRAMES.
+ */
+final class HedNOFRAMES extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedNOFRAMES(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.NOFRAMES, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_NOFRAMES_CONTENT;
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ * Exclusion.
+ * <code>NOFRAMES</code> has the exclusion.
+ * It is <code>NOFRAMES</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ CMNode label = elementCollection.getNamedItem(HTML40Namespace.ElementName.NOFRAMES);
+ if (label != null)
+ exclusion.appendChild(label);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU, HTML40Namespace.ElementName.NOFRAMES};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOSCRIPT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOSCRIPT.java
new file mode 100644
index 0000000000..a3d154c996
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedNOSCRIPT.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * NOSCRIPT.
+ */
+final class HedNOSCRIPT extends HedFlowContainer {
+
+ /**
+ */
+ public HedNOSCRIPT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.NOSCRIPT, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOBJECT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOBJECT.java
new file mode 100644
index 0000000000..a0b3c861f5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOBJECT.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * OBJECT.
+ */
+final class HedOBJECT extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedOBJECT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.OBJECT, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_PARAM_CONTAINER;
+ layoutType = LAYOUT_OBJECT;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * %reserved; ... empty.
+ * (declare (declare) #IMPLIED)
+ * (classid %URI; #IMPLIED)
+ * (codebase %URI; #IMPLIED)
+ * (data %URI; #IMPLIED)
+ * (type %ContentType; #IMPLIED)
+ * (codetype %ContentType; #IMPLIED)
+ * (archive CDATA #IMPLIED)
+ * (standby %Text; #IMPLIED)
+ * (height %Length; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (usemap %URI; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (align %IAlign; #IMPLIED) ... should be defined locally.
+ * (border %Pixels; #IMPLIED)
+ * (hspace %Pixels; #IMPLIED)
+ * (vspace %Pixels; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %reserved; ... empty.
+
+ String[] names = {HTML40Namespace.ATTR_NAME_DECLARE, HTML40Namespace.ATTR_NAME_CLASSID, HTML40Namespace.ATTR_NAME_CODEBASE, HTML40Namespace.ATTR_NAME_DATA, HTML40Namespace.ATTR_NAME_TYPE, HTML40Namespace.ATTR_NAME_CODETYPE, HTML40Namespace.ATTR_NAME_ARCHIVE, HTML40Namespace.ATTR_NAME_STANDBY, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_USEMAP, HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_BORDER, HTML40Namespace.ATTR_NAME_HSPACE, HTML40Namespace.ATTR_NAME_VSPACE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ // %align; ... should be defined locally.
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForImage();
+ if (attr != null)
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.PRE};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOL.java
new file mode 100644
index 0000000000..8e4aa25ddc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOL.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * OL.
+ */
+final class HedOL extends HedListItemContainer {
+
+ /**
+ */
+ public HedOL(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.OL, collection);
+ }
+
+ /**
+ * OL.
+ * (type %OLStyle; #IMPLIED) ... should be defined locally.
+ * (compact (compact) #IMPLIED)
+ * (start NUMBER #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (type %OLStyle; #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.OL_STYLE);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+
+ // the rest.
+ String[] names = {HTML40Namespace.ATTR_NAME_COMPACT, HTML40Namespace.ATTR_NAME_START};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTGROUP.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTGROUP.java
new file mode 100644
index 0000000000..5ba00196b1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTGROUP.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * OPTGROUP.
+ */
+final class HedOPTGROUP extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedOPTGROUP(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.OPTGROUP, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_OPTION_CONTAINER;
+ layoutType = LAYOUT_HIDDEN;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * (disabled (disabled) #IMPLIED)
+ * (label %Text; #REQUIRED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // (disabled (disabled) #IMPLIED)
+ String[] names = {HTML40Namespace.ATTR_NAME_DISABLED};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (label %Text; #REQUIRED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_LABEL, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_LABEL, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTION.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTION.java
new file mode 100644
index 0000000000..9657f5ab9e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedOPTION.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * OPTION.
+ */
+final class HedOPTION extends HedPcdata {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.OPTION};
+
+ /**
+ */
+ public HedOPTION(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.OPTION, collection);
+ layoutType = LAYOUT_HIDDEN;
+ omitType = OMIT_END;
+ }
+
+ /**
+ * OPTION.
+ * %attrs;
+ * (selected (selected) #IMPLIED)
+ * (disabled (disabled) #IMPLIED)
+ * (label %Text; #IMPLIED)
+ * (value CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_SELECTED, HTML40Namespace.ATTR_NAME_DISABLED, HTML40Namespace.ATTR_NAME_LABEL, HTML40Namespace.ATTR_NAME_VALUE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * OPTION has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedP.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedP.java
new file mode 100644
index 0000000000..492be84fca
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedP.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * P.
+ */
+final class HedP extends HedInlineContainer {
+
+ private static Collection terminators = null;
+
+ /**
+ */
+ public HedP(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.P, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>P</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td>%attrs;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * <tr>
+ * <td>%align;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * <p><b>%align;</b> means <code>align (left|center|right|justify) #IMPLIED</code>.
+ * Unfortunately, this <code>align</code> is different from one in
+ * <code>IMG</code> or <code>TABLE</code>. So, the attribute declaration
+ * of <code>align</code> should be localy created and it shouldn't be registered
+ * in a <code>HCMDocImpl</code> instance.</p>
+ * <p>However, %align is used in sevaral times. I wouldn't write same code
+ * in many times. So, I add a new utility method into <code>CMUtil</code>
+ * to create the attribute declaration.</p>
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // align
+ HTMLAttrDeclImpl adec = AttributeCollection.createAlignForParagraph();
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, adec);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+ return prohibitedAncestors;
+ }
+
+ /**
+ * Return names of terminators.
+ * <code>P</code> has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ if (terminators != null)
+ return terminators.iterator();
+ //<<D217982
+ terminators = new Vector();
+ terminators.addAll(elementCollection.getNamesOfBlock());
+ terminators.add(HTML40Namespace.ElementName.LI);
+ terminators.add(HTML40Namespace.ElementName.DT);
+ terminators.add(HTML40Namespace.ElementName.DD);
+ //D217982
+ return terminators.iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPARAM.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPARAM.java
new file mode 100644
index 0000000000..3b6c56bc98
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPARAM.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * PARAM.
+ */
+final class HedPARAM extends HedEmpty {
+
+ /**
+ */
+ public HedPARAM(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.PARAM, collection);
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * PARAM.
+ * (id ID #IMPLIED)
+ * (name CDATA #REQUIRED) ... should be defined locally.
+ * (value CDATA #IMPLIED)
+ * (valuetype (DATA|REF|OBJECT) DATA)
+ * (type %ContentType; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ID, HTML40Namespace.ATTR_NAME_VALUE, HTML40Namespace.ATTR_NAME_VALUETYPE, HTML40Namespace.ATTR_NAME_TYPE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (name CDATA #REQUIRED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_NAME, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_NAME, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPRE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPRE.java
new file mode 100644
index 0000000000..19c9019163
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPRE.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * PRE.
+ */
+final class HedPRE extends HedInlineContainer {
+
+ /**
+ * PRE element should keep spaces in its source.
+ */
+ public HedPRE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.PRE, collection);
+ // CORRECT_EMPTY - GROUP_COMPACT
+ correctionType = CORRECT_EMPTY;
+
+ keepSpaces = true;
+ }
+
+ /**
+ * %attrs;
+ * (width NUMBER #IMPLIED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // (width NUMBER #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_WIDTH, attr);
+ }
+
+ /**
+ * Exclusion.
+ * <code>PRE</code> has the exclusion.
+ * It is <code>%pre.exclusion;</code>.
+ * %pre.exclusion is:
+ * IMG | OBJECT | APPLET | BIG | SMALL | SUB | SUP | FONT | BASEFONT
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ String[] names = {HTML40Namespace.ElementName.IMG, HTML40Namespace.ElementName.OBJECT, HTML40Namespace.ElementName.APPLET, HTML40Namespace.ElementName.BIG, HTML40Namespace.ElementName.SMALL, HTML40Namespace.ElementName.SUB, HTML40Namespace.ElementName.SUP, HTML40Namespace.ElementName.FONT, HTML40Namespace.ElementName.BASEFONT};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPcdata.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPcdata.java
new file mode 100644
index 0000000000..b9d053d0d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPcdata.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+
+/**
+ * Base class for PCDATA type element declarations.<br>
+ */
+abstract class HedPcdata extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedPcdata(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_PCDATA;
+ }
+
+ /**
+ * Content.<br>
+ * PCDATA type always returns <code>null</code>.
+ * <br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getContent() {
+ return null;
+ }
+
+ /**
+ * Content type.<br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public int getContentType() {
+ return CMElementDeclaration.PCDATA;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPhrase.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPhrase.java
new file mode 100644
index 0000000000..e8e6cc1eb7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedPhrase.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * %phrase;
+ */
+final class HedPhrase extends HedInlineContainer {
+
+ /**
+ */
+ public HedPhrase(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ correctionType = HTMLElementDeclaration.CORRECT_DUPLICATED;
+ }
+
+ /**
+ * %attrs;
+ * @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedQ.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedQ.java
new file mode 100644
index 0000000000..11bd04d484
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedQ.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * Q.
+ */
+final class HedQ extends HedInlineContainer {
+
+ /**
+ */
+ public HedQ(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.Q, collection);
+ correctionType = CORRECT_DUPLICATED;
+ }
+
+ /**
+ * %attrs;
+ * (cite %URI; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CITE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSCRIPT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSCRIPT.java
new file mode 100644
index 0000000000..6a0153db86
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSCRIPT.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * SCRIPT.
+ */
+final class HedSCRIPT extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedSCRIPT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SCRIPT, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_CDATA;
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * SCRIPT.
+ * (charset %Charset; #IMPLIED)
+ * (type %ContentType; #REQUIRED) ... should be defined locally.
+ * (language CDATA #IMPLIED)
+ * (src %URI; #IMPLIED)
+ * (defer (defer) #IMPLIED)
+ * (event CDATA #IMPLIED)
+ * (for %URI; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CHARSET, HTML40Namespace.ATTR_NAME_LANGUAGE, HTML40Namespace.ATTR_NAME_SRC, HTML40Namespace.ATTR_NAME_DEFER, HTML40Namespace.ATTR_NAME_EVENT, HTML40Namespace.ATTR_NAME_FOR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // (type %ContentType; #REQUIRED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, "text/javascript"); //$NON-NLS-1$
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+ }
+
+ /**
+ * <code>SCRIPT</code> is CDATA type.
+ * So, the method always returns <code>null</code>.
+ * <br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getContent() {
+ return null;
+ }
+
+ /**
+ * CDATA content.<br>
+ * @return int
+ */
+ public int getContentType() {
+ return CMElementDeclaration.CDATA;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSELECT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSELECT.java
new file mode 100644
index 0000000000..3e7438e6d4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSELECT.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * SELECT.
+ */
+final class HedSELECT extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedSELECT(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SELECT, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_SELECT;
+ layoutType = LAYOUT_OBJECT;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * %reserved;
+ * (name CDATA #IMPLIED)
+ * (size NUMBER #IMPLIED) ... should be defined locally.
+ * (multiple (multiple) #IMPLIED)
+ * (disabled (disabled) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ * (onchange %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (size NUMBER #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_SIZE, attr);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_MULTIPLE, HTML40Namespace.ATTR_NAME_DISABLED, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR, HTML40Namespace.ATTR_NAME_ONCHANGE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSPAN.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSPAN.java
new file mode 100644
index 0000000000..b1fc4f5818
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSPAN.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+/**
+ * SPAN.
+ */
+final class HedSPAN extends HedInlineContainer {
+
+ /**
+ * SPAN.
+ */
+ public HedSPAN(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SPAN, collection);
+ }
+
+ /**
+ * %attrs;
+ * %reserved; ... empty.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIBase.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIBase.java
new file mode 100644
index 0000000000..7a0bee45b5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIBase.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+
+
+/**
+ * Base class for SSI declarations.
+ */
+abstract class HedSSIBase extends HedEmpty {
+
+ /**
+ */
+ public HedSSIBase(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ */
+ public int getFormatType() {
+ return HTMLElementDeclaration.FORMAT_SSI;
+ }
+
+ /**
+ */
+ public boolean supports(String propName) {
+ if (propName.equals(HTMLCMProperties.IS_SSI))
+ return true;
+ return super.supports(propName);
+ }
+
+ /*
+ */
+ public Object getProperty(String propName) {
+ if (propName.equals(HTMLCMProperties.IS_SSI))
+ return new Boolean(true);
+ return super.getProperty(propName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIConfig.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIConfig.java
new file mode 100644
index 0000000000..af32153a04
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIConfig.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:CONFIG.
+ */
+final class HedSSIConfig extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIConfig(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_CONFIG, collection);
+ }
+
+ /**
+ * SSI:CONFIG.
+ * (errmsg CDATA #IMPLIED)
+ * (sizefmt CDATA #IMPLIED)
+ * (timefmt CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ERRMSG, HTML40Namespace.ATTR_NAME_SIZEFMT, HTML40Namespace.ATTR_NAME_TIMEFMT};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIEcho.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIEcho.java
new file mode 100644
index 0000000000..3e958d1d97
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIEcho.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:ECHO.
+ */
+final class HedSSIEcho extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIEcho(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_ECHO, collection);
+ }
+
+ /**
+ * SSI:ECHO
+ * (var CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_VAR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIExec.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIExec.java
new file mode 100644
index 0000000000..6d18d97464
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIExec.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:EXEC.
+ */
+final class HedSSIExec extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIExec(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_EXEC, collection);
+ }
+
+ /**
+ * SSI:EXEC
+ * (cgi %URI; #IMPLIED)
+ * (cmd CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_CGI, HTML40Namespace.ATTR_NAME_CMD};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFlastmod.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFlastmod.java
new file mode 100644
index 0000000000..e2092e088f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFlastmod.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:FLASTMOD.
+ */
+final class HedSSIFlastmod extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIFlastmod(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_FLASTMOD, collection);
+ }
+
+ /**
+ * SSI:FLASTMOD
+ * (file %URI; #IMPLIED)
+ * (virtual %URI #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_FILE, HTML40Namespace.ATTR_NAME_VIRTUAL};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFsize.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFsize.java
new file mode 100644
index 0000000000..bcb7cb4b02
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIFsize.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:FSIZE.
+ */
+final class HedSSIFsize extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIFsize(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_FSIZE, collection);
+ }
+
+ /**
+ * SSI:FSIZE
+ * (file %URI; #IMPLIED)
+ * (virtual %URI #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_FILE, HTML40Namespace.ATTR_NAME_VIRTUAL};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIInclude.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIInclude.java
new file mode 100644
index 0000000000..a14459f702
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIInclude.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:INCLUDE.
+ */
+final class HedSSIInclude extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIInclude(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_INCLUDE, collection);
+ }
+
+ /**
+ * SSI:INCLUDE
+ * (file %URI; #IMPLIED)
+ * (virtual %URI #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_FILE, HTML40Namespace.ATTR_NAME_VIRTUAL};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIPrintenv.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIPrintenv.java
new file mode 100644
index 0000000000..29b4ed9e10
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSIPrintenv.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * SSI:PRINTENV.
+ */
+final class HedSSIPrintenv extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIPrintenv(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_PRINTENV, collection);
+ }
+
+ /**
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+ }
+
+ /**
+ * SSI:PRINTENV has no attributes. So, this method should
+ * always return <code>null</code>.
+ * Note: Since somebody doesn't expect null is returned, return the empty attribute
+ * like a custom tag which doesn't have attributes
+ */
+ public CMNamedNodeMap getAttributes() {
+ return super.getAttributes();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSISet.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSISet.java
new file mode 100644
index 0000000000..2ac31d4f64
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSSISet.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * SSI:SET.
+ */
+final class HedSSISet extends HedSSIBase {
+
+ /**
+ */
+ public HedSSISet(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.SSI_SET, collection);
+ }
+
+ /**
+ * SSI:SET
+ * (var CDATA #IMPLIED)
+ * (value CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {HTML40Namespace.ATTR_NAME_VAR, HTML40Namespace.ATTR_NAME_VALUE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSTYLE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSTYLE.java
new file mode 100644
index 0000000000..4288cf7bc7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedSTYLE.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * STYLE.
+ */
+final class HedSTYLE extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedSTYLE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.STYLE, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_CDATA;
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * STYLE
+ * %i18n;
+ * (type %ContentType; #REQUIRED) ... should be defined locally.
+ * (media %MediaDesc; #IMPLIED)
+ * (title %Text; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_MEDIA, HTML40Namespace.ATTR_NAME_TITLE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ // (type %ContentType; #REQUIRED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+ }
+
+ /**
+ * Content.<br>
+ * <code>STYLE</code> is CDATA content type. So, it always returns <code>null</code>.
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getContent() {
+ return null;
+ }
+
+ /**
+ * CDATA content.<br>
+ * @return int
+ */
+ public int getContentType() {
+ return CMElementDeclaration.CDATA;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedScripts.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedScripts.java
new file mode 100644
index 0000000000..f25a804fd9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedScripts.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * SUB and SUP.
+ */
+final class HedScripts extends HedInlineContainer {
+
+ /**
+ */
+ public HedScripts(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ correctionType = CORRECT_EMPTY;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.PRE};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTABLE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTABLE.java
new file mode 100644
index 0000000000..7a77ff639c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTABLE.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * TABLE.
+ */
+final class HedTABLE extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedTABLE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.TABLE, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_TABLE;
+ layoutType = LAYOUT_BLOCK;
+ indentChild = true;
+ }
+
+ /**
+ * TABLE.
+ * %attrs;
+ * %reserved;
+ * (summary %Text; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (border %Pixels; #IMPLIED)
+ * (frame %TFrame; #IMPLIED)
+ * (rules %TRules; #IMPLIED)
+ * (cellspacing %Length; #IMPLIED)
+ * (cellpadding %Length; #IMPLIED)
+ * (align %TAlign; #IMPLIED)
+ * (bgcolor %Color; #IMPLIED)
+ * (datapagesize CDATA #IMPLIED)
+ * (height %Pixels; #IMPLIED)
+ * (background %URI; #IMPLIED)
+ * (bordercolor %Color #IMPLIED) ... D205514
+ * @see com.ibm.sed.contentmodel.html.AbstractHTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %reserved;
+ // ... %reserved; is empty in the current DTD.
+
+ String[] names = {HTML40Namespace.ATTR_NAME_SUMMARY, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_BORDER, HTML40Namespace.ATTR_NAME_FRAME, HTML40Namespace.ATTR_NAME_RULES, HTML40Namespace.ATTR_NAME_CELLSPACING, HTML40Namespace.ATTR_NAME_CELLPADDING, HTML40Namespace.ATTR_NAME_BGCOLOR, HTML40Namespace.ATTR_NAME_DATAPAGESIZE, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_BACKGROUND, HTML40Namespace.ATTR_NAME_BORDERCOLOR // D205514
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // align (local)
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] alignValues = {HTML40Namespace.ATTR_VALUE_LEFT, HTML40Namespace.ATTR_VALUE_CENTER, HTML40Namespace.ATTR_VALUE_RIGHT};
+ atype.setEnumValues(alignValues);
+ HTMLAttrDeclImpl adec = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, adec);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTEXTAREA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTEXTAREA.java
new file mode 100644
index 0000000000..ad5f71acdc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTEXTAREA.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * TEXTAREA.
+ */
+final class HedTEXTAREA extends HedPcdata {
+
+ /**
+ * TEXTAREA should keep spaces in its source.
+ */
+ public HedTEXTAREA(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.TEXTAREA, collection);
+ layoutType = LAYOUT_OBJECT;
+
+ keepSpaces = true;
+ }
+
+ /**
+ * TEXTAREA.
+ * %attrs;
+ * %reserved; ... empty
+ * (name CDATA #IMPLIED)
+ * (rows NUMBER #REQUIRED)
+ * (cols NUMBER #REQUIRED)
+ * (disabled (disabled) #IMPLIED)
+ * (readonly (readonly) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ * (onselect %Script; #IMPLIED)
+ * (onchange %Script; #IMPLIED)
+ * (istyle CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_NAME, HTML40Namespace.ATTR_NAME_ROWS, HTML40Namespace.ATTR_NAME_COLS, HTML40Namespace.ATTR_NAME_DISABLED, HTML40Namespace.ATTR_NAME_READONLY, HTML40Namespace.ATTR_NAME_TABINDEX, HTML40Namespace.ATTR_NAME_ACCESSKEY, HTML40Namespace.ATTR_NAME_ONFOCUS, HTML40Namespace.ATTR_NAME_ONBLUR, HTML40Namespace.ATTR_NAME_ONSELECT, HTML40Namespace.ATTR_NAME_ONCHANGE, HTML40Namespace.ATTR_NAME_ISTYLE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.BUTTON};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTITLE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTITLE.java
new file mode 100644
index 0000000000..23e77ce572
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTITLE.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * TITLE.
+ */
+final class HedTITLE extends HedPcdata {
+
+ /**
+ */
+ public HedTITLE(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.TITLE, collection);
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * TITLE.
+ * %i18n;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+ }
+
+ /**
+ * Exclusion.
+ * <code>TITLE</code> has the exclusion.
+ * It is <code>%head.misc;</code>.
+ * %head.misc; is <code>SCRIPT|STYLE|META|LINK|OBJECT</code>.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ // (SCRIPT|STYLE|META|LINK|OBJECT)
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+
+ String[] names = {HTML40Namespace.ElementName.SCRIPT, HTML40Namespace.ElementName.STYLE, HTML40Namespace.ElementName.META, HTML40Namespace.ElementName.LINK, HTML40Namespace.ElementName.OBJECT};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+ return exclusion;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTR.java
new file mode 100644
index 0000000000..c66423633f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTR.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * TR.
+ */
+final class HedTR extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.TR};
+
+ /**
+ */
+ public HedTR(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.TR, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_TCELL_CONTAINER;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * %cellhalign;
+ * %cellvalign;
+ * (bgcolor %Color; #IMPLIED)
+ * (background %URI; #IMPLIED)
+ * (bordercolor %Color #IMPLIED) ... D205514
+ * (height %Length #IMPLIED) bug2246
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %cellhalign;
+ attributeCollection.getCellhalign(attributes);
+ // %cellvalign;
+ attributeCollection.getCellvalign(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_BGCOLOR, HTML40Namespace.ATTR_NAME_BACKGROUND, HTML40Namespace.ATTR_NAME_BORDERCOLOR, HTML40Namespace.ATTR_NAME_HEIGHT // D205514
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * TR has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableBody.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableBody.java
new file mode 100644
index 0000000000..3360016f7f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableBody.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * THEAD/TFOOT/TBODY
+ */
+final class HedTableBody extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.CAPTION, HTML40Namespace.ElementName.COL, HTML40Namespace.ElementName.COLGROUP, HTML40Namespace.ElementName.THEAD, HTML40Namespace.ElementName.TBODY, HTML40Namespace.ElementName.TFOOT};
+
+ /**
+ */
+ public HedTableBody(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_TR_CONTAINER;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ if (elementName == HTML40Namespace.ElementName.TBODY) {
+ omitType = OMIT_BOTH;
+ }
+ else {
+ omitType = OMIT_END;
+ }
+ indentChild = true;
+ }
+
+ /**
+ * TBODY/TFOOT/THEAD
+ * %attrs;
+ * %cellhalign;
+ * %cellvalign;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %cellhalign;
+ attributeCollection.getCellhalign(attributes);
+ // %cellvalign;
+ attributeCollection.getCellvalign(attributes);
+ }
+
+ /**
+ * THEAD, TFOOT and TBODY have terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableCell.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableCell.java
new file mode 100644
index 0000000000..1e641938e6
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedTableCell.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+/**
+ * (TH | TD).
+ */
+final class HedTableCell extends HedFlowContainer {
+
+ private static String[] terminators = {HTML40Namespace.ElementName.TR, HTML40Namespace.ElementName.TH, HTML40Namespace.ElementName.TD};
+
+ /**
+ */
+ public HedTableCell(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END;
+ }
+
+ /**
+ * %attrs;
+ * (abbr %Text; #IMPLIED)
+ * (axis CDATA #IMPLIED)
+ * (headers IDREFS #IMPLIED)
+ * (scope %Scope; #IMPLIED)
+ * (rowspan NUMBER 1)
+ * (colspan NUMBER 1)
+ * %cellhalign;
+ * %cellvalign;
+ * (nowrap (nowrap) #IMPLIED)
+ * (bgcolor %Color; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (height %Length; #IMPLIED)
+ * (background %URI; #IMPLIED)
+ * (bordercolor %Color #IMPLIED) ... D205514
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %cellhalign;
+ attributeCollection.getCellhalign(attributes);
+ // %cellvalign;
+ attributeCollection.getCellvalign(attributes);
+
+ String[] names = {HTML40Namespace.ATTR_NAME_ABBR, HTML40Namespace.ATTR_NAME_AXIS, HTML40Namespace.ATTR_NAME_HEADERS, HTML40Namespace.ATTR_NAME_SCOPE, HTML40Namespace.ATTR_NAME_ROWSPAN, HTML40Namespace.ATTR_NAME_COLSPAN, HTML40Namespace.ATTR_NAME_NOWRAP, HTML40Namespace.ATTR_NAME_BGCOLOR, HTML40Namespace.ATTR_NAME_WIDTH, HTML40Namespace.ATTR_NAME_HEIGHT, HTML40Namespace.ATTR_NAME_BACKGROUND, HTML40Namespace.ATTR_NAME_BORDERCOLOR // D205514
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * TH and TD have terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedUL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedUL.java
new file mode 100644
index 0000000000..1bf48d381e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedUL.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+/**
+ * UL.
+ */
+final class HedUL extends HedListItemContainer {
+
+ /**
+ */
+ public HedUL(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.UL, collection);
+ }
+
+ /**
+ * UL.
+ * (type %ULStyle; #IMPLIED) ... should be defined locally.
+ * (compact (compact) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (type %ULStyle; #IMPLIED) ... should be defined locally.
+ // %ULStyle; is (disc|square|circle).
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {HTML40Namespace.ATTR_VALUE_DISC, HTML40Namespace.ATTR_VALUE_SQUARE, HTML40Namespace.ATTR_VALUE_CIRCLE};
+ atype.setEnumValues(values);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(HTML40Namespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(HTML40Namespace.ATTR_NAME_TYPE, attr);
+
+ // the rest.
+ String[] names = {HTML40Namespace.ATTR_NAME_COMPACT};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedWBR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedWBR.java
new file mode 100644
index 0000000000..51bedf0a47
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/HedWBR.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+final class HedWBR extends HedEmpty {
+
+ public HedWBR(ElementCollection collection) {
+ super(HTML40Namespace.ElementName.WBR, collection);
+ // LAYOUT_BREAK.
+ // same as BR.
+ layoutType = LAYOUT_BREAK;
+ }
+
+ protected void createAttributeDeclarations() {
+ // No attributes is defined.
+ if (attributes != null)
+ return;
+ attributes = new CMNamedNodeMapImpl();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JCMDocImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JCMDocImpl.java
new file mode 100644
index 0000000000..7401ac5bc8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JCMDocImpl.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Implementation of CMDocument for the JSP 1.1.
+ */
+class JCMDocImpl extends CMNodeImpl implements JSPCMDocument {
+
+ /** Namespace for all names of elements, entities and attributes. */
+ private CMNamespaceImpl namespace = null;
+ private JSPElementCollection elements = null;
+
+ /**
+ * HCMDocImpl constructor comment.
+ */
+ public JCMDocImpl(String docTypeName, CMNamespaceImpl targetNamespace) {
+ super(docTypeName);
+ namespace = targetNamespace;
+ elements = new JSPElementCollection();
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.HTMLCMDocument
+ */
+ public HTMLElementDeclaration getElementDeclaration(String elementName) {
+ if (elements == null)
+ return null;
+ return (HTMLElementDeclaration) elements.getNamedItem(elementName);
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDocument
+ */
+ public CMNamedNodeMap getElements() {
+ return elements;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDocument
+ */
+ public CMNamedNodeMap getEntities() {
+ return null;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.HTMLCMDocument
+ */
+ public HTMLEntityDeclaration getEntityDeclaration(String entityName) {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDocument
+ */
+ public org.eclipse.wst.common.contentmodel.CMNamespace getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMNode
+ */
+ public int getNodeType() {
+ return CMNode.DOCUMENT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSP11Namespace.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSP11Namespace.java
new file mode 100644
index 0000000000..893c034e77
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSP11Namespace.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+/**
+ * JSP 1.1 Namespace. Note, this interface was
+ * copied form JSP core packages. One implication
+ * is that extra care is needed in using '==' instead
+ * of '.equals'.
+ */
+public interface JSP11Namespace {
+
+ public static interface ElementName {
+ // Element names
+ public static final String SCRIPTLET = "jsp:scriptlet"; //$NON-NLS-1$
+ public static final String EXPRESSION = "jsp:expression"; //$NON-NLS-1$
+ public static final String DECLARATION = "jsp:declaration"; //$NON-NLS-1$
+ public static final String DIRECTIVE_PAGE = "jsp:directive.page"; //$NON-NLS-1$
+ public static final String DIRECTIVE_INCLUDE = "jsp:directive.include"; //$NON-NLS-1$
+ public static final String DIRECTIVE_TAGLIB = "jsp:directive.taglib"; //$NON-NLS-1$
+ public static final String USEBEAN = "jsp:useBean"; //$NON-NLS-1$
+ public static final String SETPROPERTY = "jsp:setProperty"; //$NON-NLS-1$
+ public static final String GETPROPERTY = "jsp:getProperty"; //$NON-NLS-1$
+ public static final String INCLUDE = "jsp:include"; //$NON-NLS-1$
+ public static final String FORWARD = "jsp:forward"; //$NON-NLS-1$
+ public static final String PLUGIN = "jsp:plugin"; //$NON-NLS-1$
+ public static final String PARAMS = "jsp:params"; //$NON-NLS-1$
+ public static final String FALLBACK = "jsp:fallback"; //$NON-NLS-1$
+ public static final String PARAM = "jsp:param"; //$NON-NLS-1$
+ public static final String ROOT = "jsp:root"; //$NON-NLS-1$
+ public static final String TEXT = "jsp:text"; //$NON-NLS-1$
+ }
+
+ public static final String JSP11_URI = ""; //$NON-NLS-1$
+ public static final String JSP_TAG_PREFIX = "jsp"; //$NON-NLS-1$
+ // attribute names
+ // directive.page
+ public static final String ATTR_NAME_LANGUAGE = "language"; //$NON-NLS-1$
+ public static final String ATTR_NAME_EXTENDS = "extends"; //$NON-NLS-1$
+ public static final String ATTR_NAME_CONTENT_TYPE = "contentType"; //$NON-NLS-1$
+ public static final String ATTR_NAME_IMPORT = "import"; //$NON-NLS-1$
+ public static final String ATTR_NAME_SESSION = "session"; //$NON-NLS-1$
+ public static final String ATTR_NAME_BUFFER = "buffer"; //$NON-NLS-1$
+ public static final String ATTR_NAME_AUTOFLUSH = "autoFlush"; //$NON-NLS-1$
+ public static final String ATTR_NAME_IS_THREAD_SAFE = "isThreadSafe"; //$NON-NLS-1$
+ public static final String ATTR_NAME_INFO = "info"; //$NON-NLS-1$
+ public static final String ATTR_NAME_ERROR_PAGE = "errorPage"; //$NON-NLS-1$
+ public static final String ATTR_NAME_IS_ERROR_PAGE = "isErrorPage"; //$NON-NLS-1$
+ public static final String ATTR_NAME_PAGE_ENCODING = "pageEncoding"; //$NON-NLS-1$
+ // directive.include
+ public static final String ATTR_NAME_FILE = "file"; //$NON-NLS-1$
+ // directive.taglib
+ public static final String ATTR_NAME_URI = "uri"; //$NON-NLS-1$
+ public static final String ATTR_NAME_PREFIX = "prefix"; //$NON-NLS-1$
+ // useBean
+ public static final String ATTR_NAME_ID = "id"; //$NON-NLS-1$
+ public static final String ATTR_NAME_SCOPE = "scope"; //$NON-NLS-1$
+ public static final String ATTR_NAME_CLASS = "class"; //$NON-NLS-1$
+ public static final String ATTR_NAME_BEAN_NAME = "beanName"; //$NON-NLS-1$
+ public static final String ATTR_NAME_TYPE = "type"; //$NON-NLS-1$
+ // setProperty
+ public static final String ATTR_NAME_NAME = "name"; //$NON-NLS-1$
+ public static final String ATTR_NAME_PROPERTY = "property"; //$NON-NLS-1$
+ public static final String ATTR_NAME_VALUE = "value"; //$NON-NLS-1$
+ public static final String ATTR_NAME_PARAM = "param"; //$NON-NLS-1$
+ // include
+ public static final String ATTR_NAME_PAGE = "page"; //$NON-NLS-1$
+ public static final String ATTR_NAME_FLUSH = "flush"; //$NON-NLS-1$
+ // plugin
+ public static final String ATTR_NAME_CODE = "code"; //$NON-NLS-1$
+ public static final String ATTR_NAME_CODEBASE = "codebase"; //$NON-NLS-1$
+ public static final String ATTR_NAME_ALIGN = "align"; //$NON-NLS-1$
+ public static final String ATTR_NAME_ARCHIVE = "archive"; //$NON-NLS-1$
+ public static final String ATTR_NAME_HEIGHT = "height"; //$NON-NLS-1$
+ public static final String ATTR_NAME_HSPACE = "hspace"; //$NON-NLS-1$
+ public static final String ATTR_NAME_JREVERSION = "jreversion"; //$NON-NLS-1$
+ public static final String ATTR_NAME_VSPACE = "vspace"; //$NON-NLS-1$
+ public static final String ATTR_NAME_WIDTH = "width"; //$NON-NLS-1$
+ public static final String ATTR_NAME_NSPLUGINURL = "nspluginurl"; //$NON-NLS-1$
+ public static final String ATTR_NAME_IEPLUGINURL = "iepluginurl"; //$NON-NLS-1$
+ // root
+ public static final String ATTR_NAME_XMLNS_JSP = "xmlns:jsp"; //$NON-NLS-1$
+ public static final String ATTR_NAME_VERSION = "version"; //$NON-NLS-1$
+ // attribute values
+ public static final String ATTR_VALUE_TRUE = "true"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_FALSE = "false"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_JAVA = "java"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_CT_DEFAULT = "text/html; charset=ISO-8859-1";//D195366 //$NON-NLS-1$
+ public static final String ATTR_VALUE_BUFSIZ_DEFAULT = "8kb"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_PAGE = "page"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_SESSION = "session"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_REQUEST = "request"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_APPLICATION = "application"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_BEAN = "bean"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_APPLET = "applet"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_TOP = "top"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_MIDDLE = "middle"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_BOTTOM = "bottom"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_LEFT = "left"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_RIGHT = "right"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_JVER11 = "1.1"; //$NON-NLS-1$
+ public static final String ATTR_VALUE_XMLNS_JSP = "http://java.sun.com/JSP/Page"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPCMDocument.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPCMDocument.java
new file mode 100644
index 0000000000..e547c93ed1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPCMDocument.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+/**
+ * JSP extension for CMDocument.
+ * This interface provides some short hand methods to get declarations
+ * by a name.
+ */
+public interface JSPCMDocument extends org.eclipse.wst.common.contentmodel.CMDocument {
+
+ /**
+ * A short hand method to get a element declaration for a JSP element.
+ * JSP declaration class implements HTMLElementDeclaration interface.
+ * @return com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ * @param elementName java.lang.String
+ */
+ HTMLElementDeclaration getElementDeclaration(String elementName);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPElementCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPElementCollection.java
new file mode 100644
index 0000000000..3cd6748ab4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/JSPElementCollection.java
@@ -0,0 +1,897 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+/**
+ * Factory for element declarations of the JSP 1.1.
+ */
+final class JSPElementCollection extends DeclCollection implements JSP11Namespace.ElementName {
+
+
+ private class TypePacket {
+ public String name = null;
+ public int content = CMElementDeclaration.EMPTY;
+ public int omit = HTMLElementDeclaration.OMIT_NONE;
+ public int lineBreak = HTMLElementDeclaration.BREAK_NONE;
+ public int layout = HTMLElementDeclaration.LAYOUT_NONE;
+ public int correct = HTMLElementDeclaration.CORRECT_NONE;
+ public int format = HTMLElementDeclaration.FORMAT_XML;
+ public boolean indentChild = false;
+
+ public TypePacket() {
+ }
+ }
+
+ /** JSP element declaration. */
+ private class ElemDecl extends CMContentImpl implements HTMLElementDeclaration, HTMLPropertyDeclaration {
+ private TypePacket type = null;
+ private CMGroupImpl content = null;
+ private CMNamedNodeMapImpl attributes = null;
+
+ public ElemDecl(TypePacket t) {
+ super(t.name, 1, 1);
+ type = t;
+ }
+
+ public void setContent(CMGroupImpl group) {
+ content = group;
+ }
+
+ public void setAttributes(CMNamedNodeMapImpl attrs) {
+ attributes = attrs;
+ }
+
+ // implementes CMNode
+ public int getNodeType() {
+ return CMNode.ELEMENT_DECLARATION;
+ }
+
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return true;
+ }
+ else if (propertyName.equals(HTMLCMProperties.CONTENT_HINT)) {
+ return true;
+ }
+ else {
+ PropertyProvider pp = PropertyProviderFactory.getProvider(propertyName);
+ if (pp == null)
+ return false;
+ return pp.supports(this);
+ }
+ }
+
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return new Boolean(false); //D208839
+ }
+ else if (propertyName.equals(HTMLCMProperties.CONTENT_HINT)) {
+ String myName = getElementName();
+ if (myName == JSP11Namespace.ElementName.PLUGIN) {
+ return getNamedItem(JSP11Namespace.ElementName.PARAMS); // outer class method.
+ }
+ else if (myName == JSP11Namespace.ElementName.PARAMS) {
+ return getNamedItem(JSP11Namespace.ElementName.PARAM); // outer class method.
+ }
+ else {
+ return null;
+ }
+ }
+ else {
+ PropertyProvider pp = PropertyProviderFactory.getProvider(propertyName);
+ if (pp == null)
+ return null;
+ return pp.get(this);
+ }
+ }
+
+ // implementes CMElementDeclaration
+ public CMNamedNodeMap getAttributes() {
+ return attributes;
+ }
+
+ public CMContent getContent() {
+ return content;
+ }
+
+ public int getContentType() {
+ return type.content;
+ }
+
+ public CMDataType getDataType() {
+ return null;
+ }
+
+ public String getElementName() {
+ return getNodeName();
+ }
+
+ public CMNamedNodeMap getLocalElements() {
+ return null;
+ }
+
+ // implementes HTMLElementDeclaration
+ public HTMLAttributeDeclaration getAttributeDeclaration(String attrName) {
+ if (attributes == null)
+ return null;
+ return (HTMLAttributeDeclaration) attributes.getNamedItem(attrName);
+ }
+
+ public int getCorrectionType() {
+ return type.correct;
+ }
+
+ public CMContent getExclusion() {
+ return null;
+ }
+
+ public CMContent getInclusion() {
+ return null;
+ }
+
+ public CMNamedNodeMap getProhibitedAncestors() {
+ return EMPTY_MAP;
+ }
+
+ public int getFormatType() {
+ return type.format;
+ }
+
+ public int getLayoutType() {
+ return type.layout;
+ }
+
+ public int getLineBreakHint() {
+ return type.lineBreak;
+ }
+
+ public int getOmitType() {
+ return type.omit;
+ }
+
+ public boolean shouldTerminateAt(HTMLElementDeclaration dec) {
+ return false;
+ }
+
+ public boolean shouldKeepSpaces() {
+ return false;
+ }
+
+ public boolean shouldIndentChildSource() {
+ return type.indentChild;
+ }
+
+ public boolean isJSP() {
+ return true;
+ }
+ }
+
+ // element IDs
+ private static class Ids {
+ public static final int ID_SCRIPTLET = 0;
+ public static final int ID_EXPRESSION = 1;
+ public static final int ID_DECLARATION = 2;
+ public static final int ID_DIRECTIVE_PAGE = 3;
+ public static final int ID_DIRECTIVE_INCLUDE = 4;
+ public static final int ID_DIRECTIVE_TAGLIB = 5;
+ public static final int ID_USEBEAN = 6;
+ public static final int ID_SETPROPERTY = 7;
+ public static final int ID_GETPROPERTY = 8;
+ public static final int ID_INCLUDE = 9;
+ public static final int ID_FORWARD = 10;
+ public static final int ID_PLUGIN = 11;
+ public static final int ID_PARAMS = 12;
+ public static final int ID_FALLBACK = 13;
+ public static final int ID_PARAM = 14;
+ public static final int ID_ROOT = 15;
+ public static final int ID_TEXT = 16;
+
+ public static int getNumOfIds() {
+ if (numofids != -1)
+ return numofids;
+
+ // NOTE: If the reflection is too slow, this method should
+ // just return the literal value, like 105.
+ // -- 5/25/2001
+ Class clazz = Ids.class;
+ Field[] fields = clazz.getFields();
+ numofids = 0;
+ for (int i = 0; i < fields.length; i++) {
+ String name = fields[i].getName();
+ if (name.startsWith("ID_"))//$NON-NLS-1$
+ numofids++;
+ }
+ return numofids;
+ }
+
+ // chache the result of the reflection.
+ private static int numofids = -1;
+ }
+
+ // attribute creater
+ private class JACreater implements JSP11Namespace {
+ // attribute declaration
+ private class AttrDecl extends CMNodeImpl implements HTMLAttributeDeclaration {
+ HTMLCMDataTypeImpl type = null;
+ int usage = CMAttributeDeclaration.OPTIONAL;
+
+ // methods
+ public AttrDecl(String attrName) {
+ super(attrName);
+ }
+
+ public String getAttrName() {
+ return getNodeName();
+ }
+
+ public CMDataType getAttrType() {
+ return type;
+ }
+
+ /** @deprecated by superclass */
+ public String getDefaultValue() {
+ if (type.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_DEFAULT)
+ return null;
+ return type.getImpliedValue();
+ }
+
+ /** @deprecated by superclass */
+ public Enumeration getEnumAttr() {
+ Vector v = new Vector(Arrays.asList(type.getEnumeratedValues()));
+ return v.elements();
+ }
+
+ public int getNodeType() {
+ return CMNode.ATTRIBUTE_DECLARATION;
+ }
+
+ public int getUsage() {
+ return usage;
+ }
+
+ public boolean shouldIgnoreCase() {
+ return false;
+ }
+ }
+
+ private CMNamedNodeMapImpl declarations = null;
+
+ public JACreater() {
+ declarations = new CMNamedNodeMapImpl();
+ }
+
+ public CMNamedNodeMapImpl getDeclarations(int eid) {
+ switch (eid) {
+ case Ids.ID_DIRECTIVE_PAGE :
+ createForDirPage();
+ break;
+ case Ids.ID_DIRECTIVE_INCLUDE :
+ createForDirInclude();
+ break;
+ case Ids.ID_DIRECTIVE_TAGLIB :
+ createForDirTaglib();
+ break;
+ case Ids.ID_USEBEAN :
+ createForUseBean();
+ break;
+ case Ids.ID_SETPROPERTY :
+ createForSetProperty();
+ break;
+ case Ids.ID_GETPROPERTY :
+ createForGetProperty();
+ break;
+ case Ids.ID_INCLUDE :
+ createForInclude();
+ break;
+ case Ids.ID_FORWARD :
+ createForForward();
+ break;
+ case Ids.ID_PLUGIN :
+ createForPlugin();
+ break;
+ case Ids.ID_PARAM :
+ createForParam();
+ break;
+ case Ids.ID_ROOT :
+ createForRoot();
+ break;
+ default :
+ // should warn.
+ break;
+ }
+ return declarations;
+ }
+
+ private AttrDecl createBoolType(String name, String defValue) {
+ AttrDecl adec = new AttrDecl(name);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ adec.type.setEnumValues(values);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, defValue);
+ return adec;
+ }
+
+ private void createForDirPage() {
+ AttrDecl adec = null;
+ // ("language" CDATA DECLARED "java")
+ adec = new AttrDecl(ATTR_NAME_LANGUAGE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_JAVA);
+ declarations.putNamedItem(ATTR_NAME_LANGUAGE, adec);
+
+ // ("extends" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_EXTENDS);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_EXTENDS, adec);
+
+ // ("contentType" CDATA DECLARED "text/html; ISO-8859-1")
+ adec = new AttrDecl(ATTR_NAME_CONTENT_TYPE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_CT_DEFAULT);
+ declarations.putNamedItem(ATTR_NAME_CONTENT_TYPE, adec);
+
+ // ("import" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_IMPORT);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_IMPORT, adec);
+
+ // ("session" ENUM DECLARED (true|false) "true")
+ adec = createBoolType(ATTR_NAME_SESSION, ATTR_VALUE_TRUE);
+ if (adec != null)
+ declarations.putNamedItem(ATTR_NAME_SESSION, adec);
+
+ // ("buffer" CDATA DECLARED "8kb")
+ adec = new AttrDecl(ATTR_NAME_BUFFER);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_BUFSIZ_DEFAULT);
+ declarations.putNamedItem(ATTR_NAME_BUFFER, adec);
+
+ // ("autoFlush" ENUM DECLARED (true|false) "true")
+ adec = createBoolType(ATTR_NAME_AUTOFLUSH, ATTR_VALUE_TRUE);
+ if (adec != null)
+ declarations.putNamedItem(ATTR_NAME_AUTOFLUSH, adec);
+
+ // ("isThreadSafe" ENUM DECLARED (true|false) "true")
+ adec = createBoolType(ATTR_NAME_IS_THREAD_SAFE, ATTR_VALUE_TRUE);
+ if (adec != null)
+ declarations.putNamedItem(ATTR_NAME_IS_THREAD_SAFE, adec);
+
+ // ("info" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_INFO);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_INFO, adec);
+
+ // ("errorPage" URI IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_ERROR_PAGE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ declarations.putNamedItem(ATTR_NAME_ERROR_PAGE, adec);
+
+ // ("isErrorPage" ENUM DECLARED (true|false) "false")
+ adec = createBoolType(ATTR_NAME_IS_ERROR_PAGE, ATTR_VALUE_FALSE);
+ if (adec != null)
+ declarations.putNamedItem(ATTR_NAME_IS_ERROR_PAGE, adec);
+
+ // ("pageEncoding" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_PAGE_ENCODING);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_PAGE_ENCODING, adec);
+
+ }
+
+ private void createForDirInclude() {
+ // ("file" URI REQUIRED); Defect TORO:185241
+ AttrDecl adec = new AttrDecl(ATTR_NAME_FILE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_FILE, adec);
+ }
+
+ private void createForDirTaglib() {
+ // ("uri" URI REQUIRED)
+ AttrDecl adec = new AttrDecl(ATTR_NAME_URI);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_URI, adec);
+
+ // ("prefix" CDATA REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_PREFIX);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_PREFIX, adec);
+ }
+
+ private void createForUseBean() {
+ // ("id" ID REQUIRED)
+ AttrDecl adec = new AttrDecl(ATTR_NAME_ID);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ID);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_ID, adec);
+
+ // ("scope" ENUM DECLARED (page|session|request|application) "page")
+ adec = new AttrDecl(ATTR_NAME_SCOPE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_PAGE, ATTR_VALUE_SESSION, ATTR_VALUE_REQUEST, ATTR_VALUE_APPLICATION};
+ adec.type.setEnumValues(values);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_PAGE);
+ declarations.putNamedItem(ATTR_NAME_SCOPE, adec);
+
+ // ("class" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_CLASS);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_CLASS, adec);
+
+ // ("beanName" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_BEAN_NAME);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_BEAN_NAME, adec);
+
+ // ("type" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_TYPE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_TYPE, adec);
+ }
+
+ private void createForSetProperty() {
+ // ("name" IDREF REQUIRED)
+ AttrDecl adec = new AttrDecl(ATTR_NAME_NAME);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.IDREF);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_NAME, adec);
+
+ // ("property" CDATA REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_PROPERTY);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_PROPERTY, adec);
+
+ // ("value" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_VALUE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_VALUE, adec);
+
+ // ("param" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_PARAM);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_PARAM, adec);
+
+ }
+
+ private void createForGetProperty() {
+ // ("name" IDREF REQUIRED)
+ AttrDecl adec = new AttrDecl(ATTR_NAME_NAME);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.IDREF);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_NAME, adec);
+
+ // ("property" CDATA REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_PROPERTY);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_PROPERTY, adec);
+
+ }
+
+ private void createForInclude() {
+ AttrDecl adec = null;
+ // ("page" URI REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_PAGE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_PAGE, adec);
+
+ // ("flush" ENUM REQUIRED (true|false)); Defect TORO:185241
+ adec = new AttrDecl(ATTR_NAME_FLUSH);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ adec.type.setEnumValues(values);
+ declarations.putNamedItem(ATTR_NAME_FLUSH, adec);
+ }
+
+ private void createForForward() {
+ // ("page" URI REQUIRED)
+ AttrDecl adec = new AttrDecl(ATTR_NAME_PAGE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_PAGE, adec);
+ }
+
+ private void createForPlugin() {
+ // ("type" ENUM REQUIRED (bean|applet))
+ AttrDecl adec = new AttrDecl(ATTR_NAME_TYPE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ String[] values = {ATTR_VALUE_BEAN, ATTR_VALUE_APPLET};
+ adec.type.setEnumValues(values);
+ declarations.putNamedItem(ATTR_NAME_TYPE, adec);
+
+ // ("code" CDATA REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_CODE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_CODE, adec);
+
+ // ("codebase" URI REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_CODEBASE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_CODEBASE, adec);
+
+ // ("align" ENUM IMPLIED (top|middle|bottom|left|right))
+ adec = new AttrDecl(ATTR_NAME_ALIGN);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] aligns = {ATTR_VALUE_TOP, ATTR_VALUE_MIDDLE, ATTR_VALUE_BOTTOM, ATTR_VALUE_LEFT, ATTR_VALUE_RIGHT};
+ adec.type.setEnumValues(aligns);
+ declarations.putNamedItem(ATTR_NAME_ALIGN, adec);
+
+ // ("archive" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_ARCHIVE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_ARCHIVE, adec);
+
+ // ("height" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_HEIGHT);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_HEIGHT, adec);
+
+ // ("hspace" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_HSPACE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_HSPACE, adec);
+
+ // ("jreversion" CDATA DECLARED "1.1")
+ adec = new AttrDecl(ATTR_NAME_JREVERSION);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_JVER11);
+ declarations.putNamedItem(ATTR_NAME_JREVERSION, adec);
+
+ // ("name" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_NAME);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_NAME, adec);
+
+ // ("vspace" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_VSPACE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_VSPACE, adec);
+
+ // ("width" CDATA IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_WIDTH);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ declarations.putNamedItem(ATTR_NAME_WIDTH, adec);
+
+ // ("nspluginurl" URI IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_NSPLUGINURL);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ declarations.putNamedItem(ATTR_NAME_NSPLUGINURL, adec);
+
+ // ("iepluginurl" URI IMPLIED)
+ adec = new AttrDecl(ATTR_NAME_IEPLUGINURL);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.URI);
+ declarations.putNamedItem(ATTR_NAME_IEPLUGINURL, adec);
+ }
+
+ private void createForParam() {
+ // ("name" CDATA REQUIRED)
+ AttrDecl adec = new AttrDecl(ATTR_NAME_NAME);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_NAME, adec);
+
+ // ("value" CDATA REQUIRED); Defect TORO:185241
+ adec = new AttrDecl(ATTR_NAME_VALUE);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_VALUE, adec);
+
+ }
+
+ private void createForRoot() {
+ // ("xmlns:jsp" CDATA "http://jva.sun.com/JSP/Page")
+ AttrDecl adec = new AttrDecl(ATTR_NAME_XMLNS_JSP);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_XMLNS_JSP);
+ declarations.putNamedItem(ATTR_NAME_XMLNS_JSP, adec);
+ // ("version" CDATA REQUIRED)
+ adec = new AttrDecl(ATTR_NAME_VERSION);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_VERSION, adec);
+ }
+ }
+
+ private final static CMNamedNodeMap EMPTY_MAP = new CMNamedNodeMap() {
+ public int getLength() {
+ return 0;
+ }
+
+ public CMNode getNamedItem(String name) {
+ return null;
+ }
+
+ public CMNode item(int index) {
+ return null;
+ }
+
+ public Iterator iterator() {
+ return new Iterator() {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ };
+ }
+ };
+ private static String[] names = null;
+
+ static {
+ names = new String[Ids.getNumOfIds()];
+ names[Ids.ID_SCRIPTLET] = SCRIPTLET;
+ names[Ids.ID_EXPRESSION] = EXPRESSION;
+ names[Ids.ID_DECLARATION] = DECLARATION;
+ names[Ids.ID_DIRECTIVE_PAGE] = DIRECTIVE_PAGE;
+ names[Ids.ID_DIRECTIVE_INCLUDE] = DIRECTIVE_INCLUDE;
+ names[Ids.ID_DIRECTIVE_TAGLIB] = DIRECTIVE_TAGLIB;
+ names[Ids.ID_USEBEAN] = USEBEAN;
+ names[Ids.ID_SETPROPERTY] = SETPROPERTY;
+ names[Ids.ID_GETPROPERTY] = GETPROPERTY;
+ names[Ids.ID_INCLUDE] = INCLUDE;
+ names[Ids.ID_FORWARD] = FORWARD;
+ names[Ids.ID_PLUGIN] = PLUGIN;
+ names[Ids.ID_PARAMS] = PARAMS;
+ names[Ids.ID_FALLBACK] = FALLBACK;
+ names[Ids.ID_PARAM] = PARAM;
+ names[Ids.ID_ROOT] = ROOT;
+ names[Ids.ID_TEXT] = TEXT;
+ }
+
+ /**
+ */
+ public JSPElementCollection() {
+ super(names, TOLERANT_CASE);
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param elementName java.lang.String
+ */
+ protected CMNode create(String elementName) {
+ return createElemDecl(getID(elementName));
+ }
+
+ /**
+ * @return com.ibm.sed.contentmodel.html.CMGroupImpl
+ * @param eid int
+ */
+ private CMGroupImpl createContent(int eid) {
+ if (eid == ID_UNKNOWN)
+ return null;
+
+ CMGroupImpl content = null;
+ CMNode child = null;
+
+ switch (eid) {
+ case Ids.ID_INCLUDE :
+ case Ids.ID_FORWARD :
+ // (jsp:param)*
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
+ child = item(Ids.ID_PARAM);
+ if (child != null)
+ content.appendChild(child);
+ break;
+ case Ids.ID_PLUGIN :
+ // (jsp:params | jsp:fallback)?
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, 1);
+ // jsp:params
+ child = item(Ids.ID_PARAMS);
+ if (child != null)
+ content.appendChild(child);
+ // jsp:fallback
+ child = item(Ids.ID_FALLBACK);
+ if (child != null)
+ content.appendChild(child);
+ break;
+ case Ids.ID_PARAMS :
+ // (jsp:param)+
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ child = item(Ids.ID_PARAM);
+ if (child != null)
+ content.appendChild(child);
+ break;
+ case Ids.ID_ROOT :
+ // %Body;
+ // --> (jsp:text|%Directives;|%Scripts;|%Actions;)*
+ // %Directives --> jsp:directive.page|jsp:directive.include
+ // %Scripts; --> jsp:scriptlet|jsp:declaration|jsp:expression
+ // %Actions --> jsp:useBean|jsp.setProperty|jsp:getProperty
+ // |jsp:include|jsp:forward|jsp:plugin
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ int validChildren[] = {Ids.ID_TEXT,
+ // %Directves;
+ Ids.ID_DIRECTIVE_PAGE, Ids.ID_DIRECTIVE_INCLUDE,
+ // %Scripts;
+ Ids.ID_SCRIPTLET, Ids.ID_DECLARATION, Ids.ID_EXPRESSION,
+ // %Actions;
+ Ids.ID_USEBEAN, Ids.ID_SETPROPERTY, Ids.ID_GETPROPERTY, Ids.ID_INCLUDE, Ids.ID_FORWARD, Ids.ID_PLUGIN};
+ for (int i = 0; i < validChildren.length; i++) {
+ child = item(validChildren[i]);
+ if (child != null)
+ content.appendChild(child);
+ }
+ break;
+ }
+
+ return content;
+ }
+
+ /**
+ * @return com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ * @param eid int
+ */
+ private HTMLElementDeclaration createElemDecl(int eid) {
+ if (eid == ID_UNKNOWN)
+ return null;
+
+ TypePacket packet = new TypePacket();
+ switch (eid) {
+ case Ids.ID_SCRIPTLET :
+ // content, omit, lineBreak, layout, correct, format
+ // scriptlet
+ packet.name = SCRIPTLET;
+ packet.content = CMElementDeclaration.CDATA;
+ packet.layout = HTMLElementDeclaration.LAYOUT_OBJECT;
+ packet.format = HTMLElementDeclaration.FORMAT_JSP_SCRIPT;
+ break;
+ case Ids.ID_EXPRESSION :
+ // expression
+ packet.name = EXPRESSION;
+ packet.content = CMElementDeclaration.CDATA;
+ packet.layout = HTMLElementDeclaration.LAYOUT_OBJECT;
+ packet.format = HTMLElementDeclaration.FORMAT_JSP_SCRIPT;
+ break;
+ case Ids.ID_DECLARATION :
+ // declaration
+ packet.name = DECLARATION;
+ packet.content = CMElementDeclaration.CDATA;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ packet.format = HTMLElementDeclaration.FORMAT_JSP_SCRIPT;
+ break;
+ case Ids.ID_DIRECTIVE_PAGE :
+ // directive.page
+ packet.name = DIRECTIVE_PAGE;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ packet.format = HTMLElementDeclaration.FORMAT_JSP_DIRECTIVE;
+ break;
+ case Ids.ID_DIRECTIVE_INCLUDE :
+ // directive.inlcude
+ packet.name = DIRECTIVE_INCLUDE;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ packet.format = HTMLElementDeclaration.FORMAT_JSP_DIRECTIVE;
+ break;
+ case Ids.ID_DIRECTIVE_TAGLIB :
+ // directive.taglib
+ packet.name = DIRECTIVE_TAGLIB;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ packet.format = HTMLElementDeclaration.FORMAT_JSP_DIRECTIVE;
+ break;
+ case Ids.ID_USEBEAN :
+ // useBean
+ packet.name = USEBEAN;
+ packet.content = CMElementDeclaration.ANY;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ packet.indentChild = true;
+ break;
+ case Ids.ID_SETPROPERTY :
+ // setProperty
+ packet.name = SETPROPERTY;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ break;
+ case Ids.ID_GETPROPERTY :
+ // getProperty
+ packet.name = GETPROPERTY;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_OBJECT;
+ break;
+ case Ids.ID_INCLUDE :
+ // include
+ packet.name = INCLUDE;
+ packet.content = CMElementDeclaration.ELEMENT;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_OBJECT;
+ packet.indentChild = true;
+ break;
+ case Ids.ID_FORWARD :
+ // forward
+ packet.name = FORWARD;
+ packet.content = CMElementDeclaration.ELEMENT;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_OBJECT;
+ packet.indentChild = true;
+ break;
+ case Ids.ID_PLUGIN :
+ // plugin
+ packet.name = PLUGIN;
+ packet.content = CMElementDeclaration.ELEMENT;
+ packet.layout = HTMLElementDeclaration.LAYOUT_OBJECT;
+ packet.indentChild = true;
+ break;
+ case Ids.ID_PARAMS :
+ // params
+ packet.name = PARAMS;
+ packet.content = CMElementDeclaration.ELEMENT;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ packet.indentChild = true;
+ break;
+ case Ids.ID_FALLBACK :
+ // fallback
+ packet.name = FALLBACK;
+ packet.content = CMElementDeclaration.CDATA;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ break;
+ case Ids.ID_PARAM :
+ // param
+ packet.name = PARAM;
+ packet.omit = HTMLElementDeclaration.OMIT_END;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN;
+ break;
+ case Ids.ID_ROOT :
+ packet.name = ROOT;
+ packet.content = CMElementDeclaration.ELEMENT;
+ packet.layout = HTMLElementDeclaration.LAYOUT_HIDDEN; // same as HTML
+ break;
+ case Ids.ID_TEXT :
+ packet.name = TEXT;
+ packet.content = CMElementDeclaration.PCDATA;
+ break;
+ default :
+ // unknown ID
+ return null;
+ }
+
+ ElemDecl dec = new ElemDecl(packet);
+
+ CMGroupImpl content = createContent(eid);
+ if (content != null)
+ dec.setContent(content);
+
+ JACreater creater = new JACreater();
+ dec.setAttributes(creater.getDeclarations(eid));
+
+ return dec;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProvider.java
new file mode 100644
index 0000000000..ebe5e0c7cb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProvider.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+
+/**
+ * PropertyProvider class.
+ * This class is intended to be used in HTMLElementDeclaration instances.
+ */
+interface PropertyProvider {
+
+ boolean supports(HTMLElementDeclaration edecl);
+
+ Object get(HTMLElementDeclaration edecl);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProviderFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProviderFactory.java
new file mode 100644
index 0000000000..3347343d40
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/PropertyProviderFactory.java
@@ -0,0 +1,359 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel;
+
+import java.util.Hashtable;
+
+import org.eclipse.wst.common.contentmodel.annotation.AnnotationMap;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+/**
+ * The factory object of PropertyProvider.
+ */
+final class PropertyProviderFactory {
+
+
+ /**
+ * DefaultProvider is intended to be used for unknown properties.
+ * It always returns null value for any properties.
+ */
+ class DefaultProvider implements PropertyProvider {
+ public DefaultProvider() {
+ super();
+ }
+
+ public boolean supports(HTMLElementDeclaration edecl) {
+ return false;
+ }
+
+ public Object get(HTMLElementDeclaration edecl) {
+ return null;
+ }
+ }
+
+ abstract class AbstractElementPropertyProvider implements PropertyProvider {
+ protected AbstractElementPropertyProvider() {
+ super();
+ }
+
+ public boolean supports(HTMLElementDeclaration edecl) {
+ return (edecl != null);
+ }
+
+ public Object get(HTMLElementDeclaration edecl) {
+ if (!(edecl instanceof HTMLPropertyDeclaration))
+ return null;
+ return getElementProperty((HTMLPropertyDeclaration)edecl);
+ }
+
+ abstract protected Object getElementProperty(HTMLPropertyDeclaration decl);
+ }
+
+ /*
+ * "tagInfo"
+ * gets documentation for the element
+ */
+ class PPTagInfo extends AbstractElementPropertyProvider {
+ private final static String htmlAnnotationLoc = "platform:/plugin/org.eclipse.wst.html.core/data/htmref.xml"; //$NON-NLS-1$
+ protected AnnotationMap fAnnotationMap = null;
+
+ public PPTagInfo() {
+ super();
+ }
+
+ /**
+ * Gets the annotationMap.
+ * @return Returns a AnnotationMap
+ */
+ protected AnnotationMap getAnnotationMap() {
+ if (fAnnotationMap == null) {
+ fAnnotationMap = new AnnotationMap();
+ try {
+ fAnnotationMap.load(htmlAnnotationLoc);
+ }
+ catch (Exception e) {
+ // no annotation available
+ }
+ }
+ return fAnnotationMap;
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ if (decl instanceof HTMLElementDeclaration) {
+ return getAnnotationMap().getProperty(((HTMLElementDeclaration)decl).getElementName(), "tagInfo"); //$NON-NLS-1$
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /*
+ * "shouldKeepSpace"
+ */
+ class PPShouldKeepSpace extends AbstractElementPropertyProvider {
+ public PPShouldKeepSpace() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(decl.shouldKeepSpaces());
+ }
+ }
+
+ /*
+ * "shouldIndentChildSource"
+ */
+ class PPShouldIndentChildSource extends AbstractElementPropertyProvider {
+ public PPShouldIndentChildSource() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(decl.shouldIndentChildSource());
+ }
+ }
+
+ /*
+ * "terminators"
+ */
+ class PPTerminators extends AbstractElementPropertyProvider {
+ public PPTerminators() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ if (! (decl instanceof HTMLElemDeclImpl)) return null;
+ return ((HTMLElemDeclImpl)decl).getTerminators();
+ }
+ }
+
+ /*
+ * "prohibitedAncestors"
+ */
+ class PPProhibitedAncestors extends AbstractElementPropertyProvider {
+ public PPProhibitedAncestors() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return decl.getProhibitedAncestors();
+ }
+ }
+
+ /*
+ * "isJSP"
+ */
+ class PPIsJSP extends AbstractElementPropertyProvider {
+ public PPIsJSP() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(decl.isJSP());
+ }
+ }
+
+ /*
+ * "isXHTML"
+ * HTMLElementDeclaration itself never represent any XHTML element declaration.
+ * So, this property must be always false.
+ */
+ class PPIsXHTML extends AbstractElementPropertyProvider {
+ public PPIsXHTML() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(false);
+ }
+ }
+
+ /*
+ * "isSSI"
+ * Each declaration class for SSI elements must provide this property itself,
+ * and then return true. Other declaration must always return false.
+ */
+ class PPIsSSI extends AbstractElementPropertyProvider {
+ public PPIsSSI() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(false);
+ }
+ }
+
+ /*
+ * "lineBreakHint"
+ */
+ class PPLineBreakHint extends AbstractElementPropertyProvider {
+ public PPLineBreakHint() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ String hint = HTMLCMProperties.Values.BREAK_NONE;
+ switch (decl.getLineBreakHint()) {
+ case HTMLElementDeclaration.BREAK_AFTER_START :
+ hint = HTMLCMProperties.Values.BREAK_AFTER_START;
+ break;
+ case HTMLElementDeclaration.BREAK_BEFORE_START_AND_AFTER_END :
+ hint = HTMLCMProperties.Values.BREAK_BEFORE_START_AND_AFTER_END;
+ break;
+ case HTMLElementDeclaration.BREAK_NONE :
+ // nothing to do
+ default :
+ break;
+ }
+ return hint;
+ }
+ }
+
+ /*
+ * "layoutType"
+ */
+ class PPLayoutType extends AbstractElementPropertyProvider {
+ public PPLayoutType() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ String type = HTMLCMProperties.Values.LAYOUT_NONE;
+ switch (decl.getLayoutType()) {
+ case HTMLElementDeclaration.LAYOUT_BLOCK :
+ type = HTMLCMProperties.Values.LAYOUT_BLOCK;
+ break;
+ case HTMLElementDeclaration.LAYOUT_BREAK :
+ type = HTMLCMProperties.Values.LAYOUT_BREAK;
+ break;
+ case HTMLElementDeclaration.LAYOUT_HIDDEN :
+ type = HTMLCMProperties.Values.LAYOUT_HIDDEN;
+ break;
+ case HTMLElementDeclaration.LAYOUT_OBJECT :
+ type = HTMLCMProperties.Values.LAYOUT_OBJECT;
+ break;
+ case HTMLElementDeclaration.LAYOUT_WRAP :
+ type = HTMLCMProperties.Values.LAYOUT_WRAP;
+ break;
+ case HTMLElementDeclaration.LAYOUT_NONE :
+ // nothing to do.
+ default :
+ break;
+ }
+ return type;
+ }
+ }
+
+ /*
+ * "omitType"
+ */
+ class PPOmitType extends AbstractElementPropertyProvider {
+ public PPOmitType() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ String type = HTMLCMProperties.Values.OMIT_NONE;
+ switch (decl.getOmitType()) {
+ case HTMLElementDeclaration.OMIT_BOTH :
+ type = HTMLCMProperties.Values.OMIT_BOTH;
+ break;
+ case HTMLElementDeclaration.OMIT_END :
+ type = HTMLCMProperties.Values.OMIT_END;
+ break;
+ case HTMLElementDeclaration.OMIT_END_DEFAULT :
+ type = HTMLCMProperties.Values.OMIT_END_DEFAULT;
+ break;
+ case HTMLElementDeclaration.OMIT_END_MUST :
+ type = HTMLCMProperties.Values.OMIT_END_MUST;
+ break;
+ case HTMLElementDeclaration.OMIT_NONE :
+ // nothing to do.
+ default :
+ break;
+ }
+ return type;
+ }
+ }
+
+ /*
+ * "inclusion"
+ */
+ class PPInclusion extends AbstractElementPropertyProvider {
+ public PPInclusion() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return decl.getInclusion();
+ }
+ }
+
+ public static PropertyProvider getProvider(String propName) {
+ PropertyProviderFactory factory = getInstance();
+ PropertyProvider pp = (PropertyProvider) factory.registry.get(propName);
+ if (pp != null)
+ return pp;
+
+ pp = factory.create(propName);
+ if (pp == null)
+ return factory.defaultProvider;
+
+ factory.registry.put(propName, pp);
+ return pp;
+ }
+
+ private static PropertyProviderFactory instance = null;
+
+ private synchronized static PropertyProviderFactory getInstance() {
+ if (instance != null)
+ return instance;
+ instance = new PropertyProviderFactory();
+ return instance;
+ }
+
+ private Hashtable registry = new Hashtable();
+ private PropertyProvider defaultProvider = new DefaultProvider();
+
+ private PropertyProviderFactory() {
+ super();
+ }
+
+ private PropertyProvider create(String propName) {
+ PropertyProvider pp = null;
+ if (propName.equals(HTMLCMProperties.IS_JSP))
+ pp = new PPIsJSP();
+ else if (propName.equals(HTMLCMProperties.IS_XHTML))
+ pp = new PPIsXHTML();
+ else if (propName.equals(HTMLCMProperties.IS_SSI))
+ pp = new PPIsSSI();
+ else if (propName.equals(HTMLCMProperties.LAYOUT_TYPE))
+ pp = new PPLayoutType();
+ else if (propName.equals(HTMLCMProperties.LINE_BREAK_HINT))
+ pp = new PPLineBreakHint();
+ else if (propName.equals(HTMLCMProperties.PROHIBITED_ANCESTORS))
+ pp = new PPProhibitedAncestors();
+ else if (propName.equals(HTMLCMProperties.SHOULD_KEEP_SPACE))
+ pp = new PPShouldKeepSpace();
+ else if (propName.equals(HTMLCMProperties.SHOULD_INDENT_CHILD_SOURCE))
+ pp = new PPShouldIndentChildSource();
+ else if (propName.equals(HTMLCMProperties.TERMINATORS))
+ pp = new PPTerminators();
+ else if (propName.equals(HTMLCMProperties.TAGINFO))
+ pp = new PPTagInfo();
+ else if (propName.equals(HTMLCMProperties.OMIT_TYPE))
+ pp = new PPOmitType();
+ else if (propName.equals(HTMLCMProperties.INCLUSION))
+ pp = new PPInclusion();
+
+ return pp;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/AttributeCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/AttributeCollection.java
new file mode 100644
index 0000000000..8b388bd48c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/AttributeCollection.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.contentmodel.HTMLAttributeDeclaration;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDataType;
+
+/**
+ * Factory for attribute declarations.
+ */
+final class AttributeCollection extends CMNamedNodeMapImpl implements CHTMLNamespace {
+ /**
+ * constructor.
+ */
+ public AttributeCollection() {
+ super();
+ }
+
+ /**
+ * Create an attribute declaration.
+ * @return com.ibm.sed.contentmodel.html.HTMLAttrDeclImpl
+ * @param attrName java.lang.String
+ */
+ private HTMLAttrDeclImpl create(String attrName) {
+ HTMLAttrDeclImpl attr = null;
+ HTMLCMDataTypeImpl atype = null;
+
+ if (attrName.equalsIgnoreCase(ATTR_NAME_ACTION)) {
+ // (action %URI #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ACTION, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ALT)) {
+ // (alt %Text; #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ALT, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_BORDER)) {
+ // (border %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_BORDER, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CHECKED)) {
+ // (checked (checked) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_CHECKED};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CHECKED, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_CLEAR)) {
+ // (clear (left | all | right | none) none)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_LEFT, ATTR_VALUE_ALL, ATTR_VALUE_RIGHT, ATTR_VALUE_NONE};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_NONE);
+
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_CLEAR, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_COLS)) {
+ // (cols NUMBER #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_COLS, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ENCTYPE)) {
+ // (enctype %ContentType; "application/x-www-form-urlencoded")
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_WWW_FORM_URLENCODED);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ENCTYPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HEIGHT)) {
+ // (height %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HEIGHT, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HREF)) {
+ // (href %URI; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HREF, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HSPACE)) {
+ // (hspace %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HSPACE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_HTTP_EQUIV)) {
+ // (http-equiv NAME #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.NAME);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_HTTP_EQUIV, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MAXLENGTH)) {
+ // (maxlength NUMBER #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MAXLENGTH, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_METHOD)) {
+ // (method (GET|POST) GET)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_GET, ATTR_VALUE_POST};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_GET);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_METHOD, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_MULTIPLE)) {
+ // (multiple (multiple) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_MULTIPLE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_MULTIPLE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NAME)) {
+ // (name CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NAME, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_NOSHADE)) {
+ // (noshade (noshade) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_NOSHADE};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_NOSHADE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_ROWS)) {
+ // (rows NUMBER #REQUIRED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_ROWS, atype, CMAttributeDeclaration.REQUIRED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SELECTED)) {
+ // (selected (selected) #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_NAME_SELECTED};
+ atype.setEnumValues(values);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SELECTED, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SIZE)) {
+ // (size %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SRC)) {
+ // (src %URI; #IMPLIED)
+ // NOTE: "src" attributes are defined in several elements.
+ // The definition of IMG is different from others.
+ // So, it should be locally defined.
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SRC, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_TYPE)) {
+ // (type %CotentType; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.CONTENT_TYPE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VALUE)) {
+ // (value CDATA #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VALUE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VERSION)) {
+ // (version CDATA #FIXED '%HTML.Version;)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_FIXED, ATTR_VALUE_VERSION_TRANSITIONAL);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VERSION, atype, CMAttributeDeclaration.FIXED);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_WIDTH)) {
+ // (width %Length; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.LENGTH);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_VSPACE)) {
+ // (vspace %Pixels; #IMPLIED)
+ atype = new HTMLCMDataTypeImpl(HTMLCMDataType.PIXELS);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_VSPACE, atype, CMAttributeDeclaration.OPTIONAL);
+
+ // <<D205514
+ }
+ else {
+ // unknown attribute; maybe error.
+ // should warn.
+ attr = null;
+ }
+
+ return attr;
+ }
+
+ /**
+ * Get %bodycolors; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getBodycolors(CMNamedNodeMapImpl declarations) {
+ }
+
+ /**
+ * Get align attribute which has %IAlign; as values..
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public static final HTMLAttrDeclImpl createAlignForImage() {
+ // align (local)
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values
+ String[] values = {ATTR_VALUE_TOP, ATTR_VALUE_MIDDLE, ATTR_VALUE_BOTTOM, ATTR_VALUE_LEFT, ATTR_VALUE_RIGHT};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ return attr;
+ }
+
+ /**
+ * Create an attribute declaration for <code>align</code>
+ * in several elements, like <code>P</code>, <code>DIV</code>.
+ * The values are different from attributes those have the same name
+ * in other elements (<code>IMG</code> and <code>TABLE</code>).
+ * So, it can't treat as global attributes.
+ * <strong>NOTE: These attribute declaration has
+ * no owner CMDocument instance.</strong>
+ * @return com.ibm.sed.contentmodel.html.HTMLAttrDeclImpl
+ */
+ public static final HTMLAttrDeclImpl createAlignForParagraph() {
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ // set enum values: left|center|right|justify
+ String[] values = {ATTR_VALUE_LEFT, ATTR_VALUE_CENTER, ATTR_VALUE_RIGHT,};
+ atype.setEnumValues(values);
+
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ return attr;
+ }
+
+ /**
+ * Get %attrs; declarations.
+ * %attrs; consists of %coreattrs;, %i18n, and %events;.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getAttrs(CMNamedNodeMapImpl declarations) {
+ }
+
+ /**
+ * Get %coreattrs; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getCore(CMNamedNodeMapImpl declarations) {
+ }
+
+ /**
+ * Get a global attribute declaration.
+ * @return com.ibm.sed.contentmodel.html.HTMLAttrributeDeclaration
+ * @param attrName java.lang.String
+ */
+ public HTMLAttributeDeclaration getDeclaration(String attrName) {
+ CMNode cmnode = getNamedItem(attrName);
+ if (cmnode != null)
+ return (HTMLAttributeDeclaration) cmnode; // already exists.
+
+ HTMLAttrDeclImpl dec = create(attrName);
+ if (dec != null)
+ putNamedItem(attrName, dec);
+
+ return dec;
+ }
+
+ /**
+ * Get declarations which are specified by names.
+ * @param declarations com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ * @param names java.util.Iterator
+ */
+ public void getDeclarations(CMNamedNodeMapImpl declarations, Iterator names) {
+ while (names.hasNext()) {
+ String attrName = (String) names.next();
+ HTMLAttributeDeclaration dec = getDeclaration(attrName);
+ if (dec != null)
+ declarations.putNamedItem(attrName, dec);
+ }
+ }
+
+ /**
+ * Get %events; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getEvents(CMNamedNodeMapImpl declarations) {
+ }
+
+ /**
+ * Get %i18n; declarations.
+ * @param attributes com.ibm.sed.contentmodel.html.CMNamedNodeMapImpl
+ */
+ public void getI18n(CMNamedNodeMapImpl declarations) {
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHCMDocImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHCMDocImpl.java
new file mode 100644
index 0000000000..d191f98b40
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHCMDocImpl.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNamespace;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocument;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+import org.eclipse.wst.html.core.contentmodel.HTMLEntityDeclaration;
+
+/**
+ * CMDocument implementation for the HTML.
+ */
+public class CHCMDocImpl extends CMNodeImpl implements HTMLCMDocument {
+
+ /** Namespace for all names of elements, entities and attributes. */
+ private CMNamespace namespace = null;
+ private ElementCollection elements = null;
+ private EntityCollection entities = null;
+ private AttributeCollection attributes = null;
+
+ /**
+ */
+ public CHCMDocImpl(String docTypeName, CMNamespace targetNamespace) {
+ super(docTypeName);
+ namespace = targetNamespace;
+ attributes = new AttributeCollection();
+ elements = new ElementCollection(attributes);
+ entities = new EntityCollection();
+ }
+
+ /**
+ * @return com.ibm.sed.contentmodel.html.AttributeCollection
+ */
+ AttributeCollection getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.HTMLCMDocument
+ */
+ public HTMLElementDeclaration getElementDeclaration(String elementName) {
+ if (elements == null)
+ return null;
+ return (HTMLElementDeclaration) elements.getNamedItem(elementName);
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDocument
+ */
+ public CMNamedNodeMap getElements() {
+ return elements;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDocument
+ */
+ public CMNamedNodeMap getEntities() {
+ return entities;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.HTMLCMDocument
+ */
+ public HTMLEntityDeclaration getEntityDeclaration(String entityName) {
+ if (entities == null)
+ return null;
+ return (HTMLEntityDeclaration) entities.getNamedItem(entityName);
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDocument
+ */
+ public org.eclipse.wst.common.contentmodel.CMNamespace getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMNode
+ */
+ public int getNodeType() {
+ return CMNode.DOCUMENT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHTMLNamespace.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHTMLNamespace.java
new file mode 100644
index 0000000000..d2d2d8e2fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CHTMLNamespace.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.html.core.HTML40Namespace;
+
+
+
+/**
+ * Provide all names defined in the HTML 4.0? specification.
+ */
+public interface CHTMLNamespace {
+
+ // Element names
+ public static interface ElementName {
+ public static final String A = HTML40Namespace.ElementName.A;
+ public static final String ADDRESS = HTML40Namespace.ElementName.ADDRESS;
+ public static final String BASE = HTML40Namespace.ElementName.BASE;
+ public static final String BLOCKQUOTE = HTML40Namespace.ElementName.BLOCKQUOTE;
+ public static final String BODY = HTML40Namespace.ElementName.BODY;
+ public static final String BR = HTML40Namespace.ElementName.BR;
+ public static final String CENTER = HTML40Namespace.ElementName.CENTER;
+ public static final String DD = HTML40Namespace.ElementName.DD;
+ public static final String DIR = HTML40Namespace.ElementName.DIR;
+ public static final String DIV = HTML40Namespace.ElementName.DIV;
+ public static final String DL = HTML40Namespace.ElementName.DL;
+ public static final String DT = HTML40Namespace.ElementName.DT;
+ public static final String FORM = HTML40Namespace.ElementName.FORM;
+ public static final String H1 = HTML40Namespace.ElementName.H1;
+ public static final String H2 = HTML40Namespace.ElementName.H2;
+ public static final String H3 = HTML40Namespace.ElementName.H3;
+ public static final String H4 = HTML40Namespace.ElementName.H4;
+ public static final String H5 = HTML40Namespace.ElementName.H5;
+ public static final String H6 = HTML40Namespace.ElementName.H6;
+ public static final String HEAD = HTML40Namespace.ElementName.HEAD;
+ public static final String HR = HTML40Namespace.ElementName.HR;
+ public static final String HTML = HTML40Namespace.ElementName.HTML;
+ public static final String IMG = HTML40Namespace.ElementName.IMG;
+ public static final String INPUT = HTML40Namespace.ElementName.INPUT;
+ public static final String LI = HTML40Namespace.ElementName.LI;
+ public static final String MENU = HTML40Namespace.ElementName.MENU;
+ public static final String META = HTML40Namespace.ElementName.META;
+ public static final String OL = HTML40Namespace.ElementName.OL;
+ public static final String OPTION = HTML40Namespace.ElementName.OPTION;
+ public static final String P = HTML40Namespace.ElementName.P;
+ public static final String PRE = HTML40Namespace.ElementName.PRE;
+ public static final String SELECT = HTML40Namespace.ElementName.SELECT;
+ public static final String TEXTAREA = HTML40Namespace.ElementName.TEXTAREA;
+ public static final String TITLE = HTML40Namespace.ElementName.TITLE;
+ public static final String UL = HTML40Namespace.ElementName.UL;
+ public static final String SSI_CONFIG = HTML40Namespace.ElementName.SSI_CONFIG;
+ public static final String SSI_ECHO = HTML40Namespace.ElementName.SSI_ECHO;
+ public static final String SSI_EXEC = HTML40Namespace.ElementName.SSI_EXEC;
+ public static final String SSI_FSIZE = HTML40Namespace.ElementName.SSI_FSIZE;
+ public static final String SSI_FLASTMOD = HTML40Namespace.ElementName.SSI_FLASTMOD;
+ public static final String SSI_INCLUDE = HTML40Namespace.ElementName.SSI_INCLUDE;
+ public static final String SSI_PRINTENV = HTML40Namespace.ElementName.SSI_PRINTENV;
+ public static final String SSI_SET = HTML40Namespace.ElementName.SSI_SET;
+ }
+
+ // Character Entities
+ public static interface EntityName {
+ }
+
+ // global attribute names
+ public static final String ATTR_NAME_VERSION = HTML40Namespace.ATTR_NAME_VERSION;
+ public static final String ATTR_NAME_SRC = HTML40Namespace.ATTR_NAME_SRC;
+ public static final String ATTR_NAME_ALT = HTML40Namespace.ATTR_NAME_ALT;
+ public static final String ATTR_NAME_HEIGHT = HTML40Namespace.ATTR_NAME_HEIGHT;
+ public static final String ATTR_NAME_WIDTH = HTML40Namespace.ATTR_NAME_WIDTH;
+ public static final String ATTR_NAME_ALIGN = HTML40Namespace.ATTR_NAME_ALIGN;
+ public static final String ATTR_NAME_BORDER = HTML40Namespace.ATTR_NAME_BORDER;
+ public static final String ATTR_NAME_HSPACE = HTML40Namespace.ATTR_NAME_HSPACE;
+ public static final String ATTR_NAME_VSPACE = HTML40Namespace.ATTR_NAME_VSPACE;
+ public static final String ATTR_NAME_NAME = HTML40Namespace.ATTR_NAME_NAME;
+ public static final String ATTR_NAME_CLEAR = HTML40Namespace.ATTR_NAME_CLEAR;
+ public static final String ATTR_NAME_NOSHADE = HTML40Namespace.ATTR_NAME_NOSHADE;
+ public static final String ATTR_NAME_CHECKED = HTML40Namespace.ATTR_NAME_CHECKED;
+ public static final String ATTR_NAME_MAXLENGTH = HTML40Namespace.ATTR_NAME_MAXLENGTH;
+ public static final String ATTR_NAME_ISTYLE = HTML40Namespace.ATTR_NAME_ISTYLE;
+ public static final String ATTR_NAME_HTTP_EQUIV = HTML40Namespace.ATTR_NAME_HTTP_EQUIV;
+ public static final String ATTR_NAME_CONTENT = HTML40Namespace.ATTR_NAME_CONTENT;
+
+ public static final String ATTR_NAME_HREF = HTML40Namespace.ATTR_NAME_HREF;
+ public static final String ATTR_NAME_MULTIPLE = HTML40Namespace.ATTR_NAME_MULTIPLE;
+ public static final String ATTR_NAME_SELECTED = HTML40Namespace.ATTR_NAME_SELECTED;
+ public static final String ATTR_NAME_ROWS = HTML40Namespace.ATTR_NAME_ROWS;
+ public static final String ATTR_NAME_COLS = HTML40Namespace.ATTR_NAME_COLS;
+ public static final String ATTR_NAME_ACTION = HTML40Namespace.ATTR_NAME_ACTION;
+ public static final String ATTR_NAME_METHOD = HTML40Namespace.ATTR_NAME_METHOD;
+ public static final String ATTR_NAME_ENCTYPE = HTML40Namespace.ATTR_NAME_ENCTYPE;
+ public static final String ATTR_NAME_SIZE = HTML40Namespace.ATTR_NAME_SIZE;
+ public static final String ATTR_NAME_TYPE = HTML40Namespace.ATTR_NAME_TYPE;
+ public static final String ATTR_NAME_VALUE = HTML40Namespace.ATTR_NAME_VALUE;
+
+
+
+ public static final String ATTR_NAME_ERRMSG = HTML40Namespace.ATTR_NAME_ERRMSG;
+ public static final String ATTR_NAME_SIZEFMT = HTML40Namespace.ATTR_NAME_SIZEFMT;
+ public static final String ATTR_NAME_TIMEFMT = HTML40Namespace.ATTR_NAME_TIMEFMT;
+ public static final String ATTR_NAME_VAR = HTML40Namespace.ATTR_NAME_VAR;
+ public static final String ATTR_NAME_CGI = HTML40Namespace.ATTR_NAME_CGI;
+ public static final String ATTR_NAME_CMD = HTML40Namespace.ATTR_NAME_CMD;
+ public static final String ATTR_NAME_FILE = HTML40Namespace.ATTR_NAME_FILE;
+ public static final String ATTR_NAME_VIRTUAL = HTML40Namespace.ATTR_NAME_VIRTUAL;
+
+ // global attribute values; mainly used in enumeration.
+ public static final String ATTR_VALUE_VERSION_TRANSITIONAL = "-//W3C//DTD Compact HTML 1.0 Draft//EN"; //$NON-NLS-1$
+ // for align (top|middle|bottom|left|right)
+ public static final String ATTR_VALUE_TOP = HTML40Namespace.ATTR_VALUE_TOP;
+ public static final String ATTR_VALUE_MIDDLE = HTML40Namespace.ATTR_VALUE_MIDDLE;
+ public static final String ATTR_VALUE_BOTTOM = HTML40Namespace.ATTR_VALUE_BOTTOM;
+ public static final String ATTR_VALUE_LEFT = HTML40Namespace.ATTR_VALUE_LEFT;
+ public static final String ATTR_VALUE_CENTER = HTML40Namespace.ATTR_VALUE_CENTER;
+ public static final String ATTR_VALUE_RIGHT = HTML40Namespace.ATTR_VALUE_RIGHT;
+ // for clear (left|all|right|none): left and right are already defined above.
+ public static final String ATTR_VALUE_ALL = HTML40Namespace.ATTR_VALUE_ALL;
+ public static final String ATTR_VALUE_NONE = HTML40Namespace.ATTR_VALUE_NONE;
+ // for type of INPUT
+ // (text | password | checkbox | radio | submit | reset |
+ // file | hidden | image | button)
+ public static final String ATTR_VALUE_TEXT = HTML40Namespace.ATTR_VALUE_TEXT;
+ public static final String ATTR_VALUE_PASSWORD = HTML40Namespace.ATTR_VALUE_PASSWORD;
+ public static final String ATTR_VALUE_CHECKBOX = HTML40Namespace.ATTR_VALUE_CHECKBOX;
+ public static final String ATTR_VALUE_RADIO = HTML40Namespace.ATTR_VALUE_RADIO;
+ public static final String ATTR_VALUE_SUBMIT = HTML40Namespace.ATTR_VALUE_SUBMIT;
+ public static final String ATTR_VALUE_RESET = HTML40Namespace.ATTR_VALUE_RESET;
+ public static final String ATTR_VALUE_HIDDEN = HTML40Namespace.ATTR_VALUE_HIDDEN;
+ // for span, colspan, rowspan
+ public static final String ATTR_VALUE_1 = HTML40Namespace.ATTR_VALUE_1;
+ // for frameborder
+ public static final String ATTR_VALUE_0 = HTML40Namespace.ATTR_VALUE_0;
+ // for method of FORM
+ public static final String ATTR_VALUE_GET = HTML40Namespace.ATTR_VALUE_GET;
+ public static final String ATTR_VALUE_POST = HTML40Namespace.ATTR_VALUE_POST;
+ public static final String ATTR_VALUE_WWW_FORM_URLENCODED = HTML40Namespace.ATTR_VALUE_WWW_FORM_URLENCODED;
+ // for behaviro of MARQUEE
+ public static final String ATTR_VALUE_SCROLL = HTML40Namespace.ATTR_VALUE_SCROLL;
+ public static final String ATTR_VALUE_SLIDE = HTML40Namespace.ATTR_VALUE_SLIDE;
+ public static final String ATTR_VALUE_ALTERNATE = HTML40Namespace.ATTR_VALUE_ALTERNATE;
+ // for direction of MARQUEE
+ public static final String ATTR_VALUE_UP = HTML40Namespace.ATTR_VALUE_UP;
+ public static final String ATTR_VALUE_DOWN = HTML40Namespace.ATTR_VALUE_DOWN;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMContentImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMContentImpl.java
new file mode 100644
index 0000000000..c9f5219d8f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMContentImpl.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+/**
+ * Implementation of CMContent for HTML CM.
+ */
+abstract class CMContentImpl extends CMNodeImpl implements org.eclipse.wst.common.contentmodel.CMContent {
+
+ public static final int UNBOUNDED = -1;
+ /** -1: it's UNBOUNDED. */
+ private int maxOccur = UNBOUNDED;
+ /** 0: it's OPTIONAL, 1, it's REQUIRED. */
+ private int minOccur = 0;
+
+ /**
+ * The primary consturctor.
+ * Use this one for usual cases.<br>
+ */
+ public CMContentImpl(String name, int min, int max) {
+ super(name);
+ minOccur = min;
+ maxOccur = max;
+ }
+
+ /**
+ * getMaxOccur method
+ * @return int
+ *
+ * If -1, it's UNBOUNDED.
+ */
+ public int getMaxOccur() {
+ return maxOccur;
+ }
+
+ /**
+ * getMinOccur method
+ * @return int
+ *
+ * If 0, it's OPTIONAL.
+ * If 1, it's REQUIRED.
+ */
+ public int getMinOccur() {
+ return minOccur;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMGroupImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMGroupImpl.java
new file mode 100644
index 0000000000..509bf9e173
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMGroupImpl.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.CMNodeList;
+
+/**
+ */
+class CMGroupImpl extends CMContentImpl implements CMGroup {
+
+ private int operator = CMGroup.SEQUENCE;
+ private CMNodeListImpl children = null;
+
+ /**
+ * CMGroupImpl constructor comment.
+ */
+ public CMGroupImpl(int op, int minOccur, int maxOccur) {
+ super(null, minOccur, maxOccur);
+ switch (op) {
+ case CMGroup.ALL :
+ case CMGroup.CHOICE :
+ case CMGroup.SEQUENCE :
+ operator = op;
+ break;
+ default :
+ // should warn.
+ break;
+ }
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param org.eclipse.wst.common.contentmodel.CMNode
+ */
+ protected CMNode appendChild(CMNode child) {
+ if (child == null)
+ return null;
+ if (children == null)
+ children = new CMNodeListImpl();
+ return children.appendNode(child);
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNodeList
+ */
+ public CMNodeList getChildNodes() {
+ return children;
+ }
+
+ /**
+ * getNodeType method
+ * @return int
+ *
+ * Returns one of :
+ * ELEMENT_DECLARATION, ATTRIBUTE_DECLARATION, GROUP, ENTITY_DECLARATION.
+ */
+ public int getNodeType() {
+ return CMNode.GROUP;
+ }
+
+ /**
+ * getOperation method
+ * @return int
+ *
+ * Returns one of :
+ * ALONE (a), SEQUENCE (a,b), CHOICE (a|b), ALL (a&b).
+ */
+ public int getOperator() {
+ return operator;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNamedNodeMapImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNamedNodeMapImpl.java
new file mode 100644
index 0000000000..39a7ba9a81
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNamedNodeMapImpl.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * An implementation of the CMNamedNodeMap interface.
+ * This class is intented to be used as a container of attribute declarations.
+ * If someone wants to use this class for other purpose, he must pay attention
+ * to the fact that this class is tolerant of the key name case. That is, this
+ * class does not distinguish "name", "NAME", and "Name" as a key name.
+ */
+class CMNamedNodeMapImpl implements org.eclipse.wst.common.contentmodel.CMNamedNodeMap {
+
+ private java.util.Hashtable items = null;
+
+ /**
+ */
+ public CMNamedNodeMapImpl() {
+ super();
+ items = new java.util.Hashtable();
+ }
+
+ /**
+ * getLength method
+ * @return int
+ */
+ public int getLength() {
+ return items.size();
+ }
+
+ /**
+ * getNamedItem method
+ * @return CMNode <code>null</code> for unknown keys.
+ * @param name java.lang.String
+ */
+ public CMNode getNamedItem(String name) {
+ String cookedName = makeCanonicalForm(name);
+ if (!items.containsKey(cookedName))
+ return null;
+ return (CMNode) items.get(cookedName);
+ }
+
+ /**
+ * item method
+ * @return CMNode
+ * @param index int
+ */
+ public CMNode item(int index) {
+ Iterator iter = iterator();
+ while (iter.hasNext()) {
+ CMNode node = (CMNode) iter.next();
+ if (--index < 0)
+ return node;
+ }
+ return null;
+ }
+
+ /**
+ * @return java.util.Iterator
+ */
+ public Iterator iterator() {
+ return items.values().iterator();
+ }
+
+ /**
+ * @return java.lang.String
+ * @param rawForm java.lang.String
+ */
+ private String makeCanonicalForm(String rawForm) {
+ return rawForm.toUpperCase();
+ }
+
+ /**
+ * @param key java.lang.String
+ * @param item java.lang.String
+ */
+ void putNamedItem(String name, CMNode item) {
+ String cookedName = makeCanonicalForm(name);
+ if (items.containsKey(cookedName))
+ return; // already registered.
+ items.put(cookedName, item);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeImpl.java
new file mode 100644
index 0000000000..69707962d5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeImpl.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+
+
+/**
+ */
+abstract class CMNodeImpl implements org.eclipse.wst.common.contentmodel.CMNode {
+
+ private java.lang.String name = null;
+
+ /**
+ * CMNodeImpl constructor comment.
+ */
+ public CMNodeImpl(String nm) {
+ super();
+ name = nm;
+ }
+
+ /**
+ * getNodeName method
+ * @return java.lang.String
+ */
+ public String getNodeName() {
+ return name;
+ }
+
+ /**
+ * getProperty method
+ * @return java.lang.Object
+ *
+ * Returns the object property desciped by the propertyName
+ *
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.IS_XHTML))
+ return new Boolean(false);
+ return null;
+ }
+
+ /**
+ * supports method
+ * @return boolean
+ *
+ * Returns true if the CMNode supports a specified property
+ *
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.IS_XHTML))
+ return true;
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeListImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeListImpl.java
new file mode 100644
index 0000000000..1aba885873
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CMNodeListImpl.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Analog of dom.NodeList for CM.
+ * So, the implementation is very similar to
+ * {@link com.ibm.sed.model.xml.NodeListImpl}.<br>
+ */
+class CMNodeListImpl implements org.eclipse.wst.common.contentmodel.CMNodeList {
+
+ private java.util.Vector nodes = null;
+
+ /**
+ * CMNodeListImpl constructor comment.
+ */
+ public CMNodeListImpl() {
+ super();
+ nodes = new java.util.Vector();
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param node org.eclipse.wst.common.contentmodel.CMNode
+ */
+ protected CMNode appendNode(CMNode node) {
+ nodes.addElement(node);
+ return node;
+ }
+
+ /**
+ * getLength method
+ * @return int
+ */
+ public int getLength() {
+ return nodes.size();
+ }
+
+ /**
+ * item method
+ * @return CMNode
+ * @param index int
+ */
+ public CMNode item(int index) {
+ if (index < 0 || index >= nodes.size())
+ return null;
+ return (CMNode) nodes.elementAt(index);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinition.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinition.java
new file mode 100644
index 0000000000..c3d730496b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinition.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+
+/**
+ * This class is intended to represent a complex type definition
+ * in XML Schema.<br>
+ */
+abstract class ComplexTypeDefinition {
+
+ protected CMGroupImpl content = null;
+ protected ElementCollection collection = null;
+ protected String primaryCandidateName = null;
+
+ /**
+ * ComplexTypeDefinition constructor comment.
+ */
+ public ComplexTypeDefinition(ElementCollection elementCollection) {
+ super();
+ collection = elementCollection;
+ createContent();
+ }
+
+ /**
+ * Create an actual content model.
+ * This method should be called once and only once in the constructor.<br>
+ */
+ protected abstract void createContent();
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMGroup
+ */
+ public CMGroup getContent() {
+ return content;
+ }
+
+ /**
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ /* NOTE: Do we need LOGICAL type?
+ * -- 3/7/2001
+ */
+ public abstract int getContentType();
+
+ /**
+ * Get content hint.
+ * @return com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public HTMLElementDeclaration getPrimaryCandidate() {
+ if (primaryCandidateName == null)
+ return null;
+ return (HTMLElementDeclaration) collection.getNamedItem(primaryCandidateName);
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public abstract String getTypeName();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinitionFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinitionFactory.java
new file mode 100644
index 0000000000..4d66fb5f30
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ComplexTypeDefinitionFactory.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+/**
+ * Factory of ComplexTypeDefinition.
+ */
+final class ComplexTypeDefinitionFactory {
+
+ private static ComplexTypeDefinitionFactory instance = null;
+ private java.util.Hashtable definitions = null;
+ // constants for complex type name
+ /** for ADDRESS. */
+ public final static String CTYPE_ADDRESS = "CTYPE_ADDRESS";//$NON-NLS-1$
+ /** CDATA content. No ComplexTypeDefinition instance shuld be created. */
+ public final static String CTYPE_CDATA = "CTYPE_CDATA";//$NON-NLS-1$
+ /** col group content. COL* */
+ public final static String CTYPE_COLUMN_GROUP = "CTYPE_COLUMN_GROUP";//$NON-NLS-1$
+ /** for DL. */
+ public final static String CTYPE_DEFINITION_LIST = "CTYPE_DEFINITION_LIST";//$NON-NLS-1$
+ /** for EMBED. */
+ public final static String CTYPE_EMBED = "CTYPE_EMBED";//$NON-NLS-1$
+ /** empty content. No ComplexTypeDefinition instance should be created. */
+ public final static String CTYPE_EMPTY = "CTYPE_EMPTY";//$NON-NLS-1$
+ /** for FIELDSET. */
+ public final static String CTYPE_FIELDSET = "CTYPE_FIELDSET";//$NON-NLS-1$
+ /** for FRAMESET. */
+ public final static String CTYPE_FRAMESET = "CTYPE_FRAMESET";//$NON-NLS-1$
+ /** flow content. (%flow;)* */
+ public final static String CTYPE_FLOW_CONTAINER = "CTYPE_FLOW_CONTAINER";//$NON-NLS-1$
+ /** html content. HEAD, (FRAMESET|BODY) */
+ public final static String CTYPE_HTML = "CTYPE_HTML";//$NON-NLS-1$
+ /** head content. TITLE & ISINDEX? & BASE? */
+ public final static String CTYPE_HEAD = "CTYPE_HEAD";//$NON-NLS-1$
+ /** inline content. (%inline;)* */
+ public final static String CTYPE_INLINE_CONTAINER = "CTYPE_INLINE_CONTAINER";//$NON-NLS-1$
+ /** list item container. (LI)+ */
+ public final static String CTYPE_LI_CONTAINER = "CTYPE_LI_CONTAINER";//$NON-NLS-1$
+ /** for MAP. */
+ public final static String CTYPE_MAP = "CTYPE_MAP";//$NON-NLS-1$
+ /** noframes content. */
+ public final static String CTYPE_NOFRAMES_CONTENT = "CTYPE_NOFRAMES_CONTENT";//$NON-NLS-1$
+ /** for OPTGROUP. */
+ public final static String CTYPE_OPTION_CONTAINER = "CTYPE_OPTION_CONTAINER";//$NON-NLS-1$
+ /** param container. For OBJECT/APPLET. */
+ public final static String CTYPE_PARAM_CONTAINER = "CTYPE_PARAM_CONTAINER";//$NON-NLS-1$
+ /** PCDATA content. No ComplexTypeDefinition instance shuld be created. */
+ public final static String CTYPE_PCDATA = "CTYPE_PCDATA";//$NON-NLS-1$
+ /** for SELECT. */
+ public final static String CTYPE_SELECT = "CTYPE_SELECT";//$NON-NLS-1$
+ /** table content. CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+ */
+ public final static String CTYPE_TABLE = "CTYPE_TABLE";//$NON-NLS-1$
+ /** table cell contaier. (TH|TD)+ */
+ public final static String CTYPE_TCELL_CONTAINER = "CTYPE_TCELL_CONTAINER";//$NON-NLS-1$
+ /** table record container. (TR)+ */
+ public final static String CTYPE_TR_CONTAINER = "CTYPE_TR_CONTAINER";//$NON-NLS-1$
+
+ /**
+ * ComplexTypeDefinitionFactory constructor comment.
+ */
+ private ComplexTypeDefinitionFactory() {
+ super();
+ definitions = new java.util.Hashtable();
+ }
+
+ /**
+ * Factory method for ComplexTypeDefinition.
+ * Each instance created in this method must be registered into
+ * the map with its name.
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ * @param definitionName java.lang.String
+ * @param elementCollection ElementCollection
+ */
+ public ComplexTypeDefinition createTypeDefinition(String definitionName, ElementCollection elementCollection) {
+ if (definitions.containsKey(definitionName)) {
+ return (ComplexTypeDefinition) definitions.get(definitionName);
+ }
+
+ ComplexTypeDefinition def = null;
+ if (definitionName == CTYPE_ADDRESS) {
+ def = new CtdAddress(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_DEFINITION_LIST) {
+ def = new CtdDl(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_FLOW_CONTAINER) {
+ def = new CtdFlowContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_HEAD) {
+ def = new CtdHead(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_HTML) {
+ def = new CtdHtml(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_INLINE_CONTAINER) {
+ def = new CtdInlineContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_LI_CONTAINER) {
+ def = new CtdLiContainer(elementCollection);
+
+
+ }
+ else if (definitionName == CTYPE_OPTION_CONTAINER) {
+ def = new CtdOptionContainer(elementCollection);
+
+ }
+ else if (definitionName == CTYPE_SELECT) {
+ def = new CtdSelect(elementCollection);
+
+ }
+ else {
+ def = null;
+ }
+ if (def == null)
+ return null; // fail to create.
+ definitions.put(definitionName, def);
+ return def;
+ }
+
+ /**
+ * For singleton.<br>
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinitionFactory
+ */
+ public synchronized static ComplexTypeDefinitionFactory getInstance() {
+ if (instance != null)
+ return instance;
+ instance = new ComplexTypeDefinitionFactory();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdAddress.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdAddress.java
new file mode 100644
index 0000000000..8b2392e7ff
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdAddress.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * for ADDRESS.
+ */
+final class CtdAddress extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdAddress(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * ((%inline) | P)*.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )*
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ // (%inline)
+ CMGroupImpl inlines = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (inlines == null)
+ return;
+ collection.getInline(inlines);
+ content.appendChild(inlines);
+ // P
+ CMNode p = collection.getNamedItem(CHTMLNamespace.ElementName.P);
+ if (p != null)
+ content.appendChild(p);
+ }
+
+ /**
+ * ((%inline) | P)*.
+ * Because %inline; contains #PCDATA, the type is MIXED.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_ADDRESS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdDl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdDl.java
new file mode 100644
index 0000000000..51cd5ad75d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdDl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * for DL.
+ */
+final class CtdDl extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdDl(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = CHTMLNamespace.ElementName.DT;
+ }
+
+ /**
+ * (DT | DD)+
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )+
+ content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ // DT
+ CMNode dec = collection.getNamedItem(CHTMLNamespace.ElementName.DT);
+ if (dec != null)
+ content.appendChild(dec);
+ // DD
+ dec = collection.getNamedItem(CHTMLNamespace.ElementName.DD);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (DT | DD)+.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_DEFINITION_LIST;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdFlowContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdFlowContainer.java
new file mode 100644
index 0000000000..cbf733a867
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdFlowContainer.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+
+/**
+ * Complex type definition for containers of <code>%flow;</code>.
+ */
+final class CtdFlowContainer extends ComplexTypeDefinition {
+
+ /**
+ */
+ public CtdFlowContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * (%flow;)*
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ collection.getFlow(content);
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_FLOW_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHead.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHead.java
new file mode 100644
index 0000000000..a3172351ef
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHead.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Complex type definition for the head content.
+ * Content Model: (TITLE & ISINDEX? & BASE?)
+ */
+final class CtdHead extends ComplexTypeDefinition {
+
+ /**
+ */
+ public CtdHead(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = CHTMLNamespace.ElementName.TITLE;
+ }
+
+ /**
+ * for HEAD.
+ * To avoid using inclusion, the content model comes from the XHTML 1.0.
+ *
+ * (%head.misc;, ((title, %head.misc;, (base, %head.misc;)?) | (base, %head.misc;, (title, %head.misc;))))
+ * And %head.misc; is:
+ * (script|style|meta|link|object|isindex)*
+ *
+ * 0: (%head.misc, A)
+ * A: (B | C)
+ * B: (title, %head.misc;, D)
+ * C: (base, %head.misc;, E)
+ * D: (base, %head.misc;)?
+ * E: (title, %head.misc;)
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // At 1st, create %head.misc; content.
+ // %head.misc;
+ // ( | )*
+ CMGroupImpl misc = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ if (misc == null)
+ return;
+ String[] names = {CHTMLNamespace.ElementName.META,};
+ collection.getDeclarations(misc, Arrays.asList(names).iterator());
+ // 2nd, get a title
+ CMNode title = collection.getNamedItem(CHTMLNamespace.ElementName.TITLE);
+ // 3rd, get a base
+ CMNode base = collection.getNamedItem(CHTMLNamespace.ElementName.BASE);
+ if (title == null || base == null)
+ return;
+
+ // Top level content is a sequence of %head.misc; and A.
+ // 0: (%head.misc;, A)
+ // create a sequence
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (content == null)
+ return;
+ // append %head.misc;
+ content.appendChild(misc);
+ // create A and append it to the top level.
+ {
+ // A is a choice of B and C.
+ // A: (B | C)
+ // create a choice
+ CMGroupImpl gA = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ if (gA == null)
+ return;
+ // append A to the top level.
+ content.appendChild(gA);
+
+ // create B and append it to A
+ {
+ // B is a sequence of title, %head.misc;, and D.
+ // B: (title, %head.misc;, D)
+ // create a sequence
+ CMGroupImpl gB = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (gB == null)
+ return;
+ // append B to A.
+ gA.appendChild(gB);
+
+ // append title to B
+ gB.appendChild(title);
+ // append %head.misc; to B
+ gB.appendChild(misc);
+ // create D and append it to B.
+ {
+ // D is a sequence of base, %head.misc;.
+ // D: (base, %head.misc;)?
+ // create a sequence
+ CMGroupImpl gD = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
+ if (gD == null)
+ return;
+ // append D to B.
+ gB.appendChild(gD);
+
+ // append base to D
+ gD.appendChild(base);
+ // append %head.misc; to D.
+ gD.appendChild(misc);
+ }
+ }
+ // create C and append it to A
+ {
+ // C is a sequence of base, %head.misc;, and E
+ // C: (base, %head.misc;, E)
+ // create a sequence
+ CMGroupImpl gC = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (gC == null)
+ return;
+ // append C to A.
+ gA.appendChild(gC);
+
+ // append base to C
+ gC.appendChild(base);
+ // append %head.misc; to C
+ gC.appendChild(misc);
+
+ // create E and append it to C.
+ {
+ // E is a sequence of title and %head.misc;.
+ // E: (title, %head.misc;)
+ // create a sequence
+ CMGroupImpl gE = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (gE == null)
+ return;
+ // append E to C.
+ gC.appendChild(gE);
+
+ // append title to E
+ gE.appendChild(title);
+ // append %head.misc; to E.
+ gE.appendChild(misc);
+ }
+ }
+ }
+ }
+
+ /**
+ * Element content.<br>
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_HEAD;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHtml.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHtml.java
new file mode 100644
index 0000000000..34db54866f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdHtml.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Complex type definition for <code>HTML</code>.<br>
+ * Content Model:
+ * HEAD, (FRAMESET|BODY)<br>
+ */
+final class CtdHtml extends ComplexTypeDefinition {
+
+ /**
+ */
+ public CtdHtml(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = CHTMLNamespace.ElementName.HEAD;
+ }
+
+ /**
+ * (%html.content;).
+ * %html.content; is HEAD, (FRAMESET | BODY).
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
+ if (content == null)
+ return;
+
+ // HEAD
+ CMNode edec = collection.getNamedItem(CHTMLNamespace.ElementName.HEAD);
+ if (edec != null)
+ content.appendChild(edec);
+
+ // ( | )
+ CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ content.appendChild(group);
+
+ // FRAMESET, BODY
+ String[] names = {CHTMLNamespace.ElementName.BODY};
+ collection.getDeclarations(group, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Element content.
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_HTML;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdInlineContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdInlineContainer.java
new file mode 100644
index 0000000000..b00c3acf6b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdInlineContainer.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+
+/**
+ * Complex type definition for (%inline;)*.
+ */
+final class CtdInlineContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdInlineContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ }
+
+ /**
+ * (%inline)*.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
+ collection.getInline(content);
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public int getContentType() {
+ return CMElementDeclaration.MIXED;
+ }
+
+ /**
+ * @see com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_INLINE_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdLiContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdLiContainer.java
new file mode 100644
index 0000000000..7b8cb714ed
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdLiContainer.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * List item container.
+ * (LI)+
+ */
+final class CtdLiContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elemenCollection ElementCollection
+ */
+ public CtdLiContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = CHTMLNamespace.ElementName.LI;
+ }
+
+ /**
+ * (LI)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // (LI)+
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ CMNode li = collection.getNamedItem(CHTMLNamespace.ElementName.LI);
+ if (li != null)
+ content.appendChild(li);
+ }
+
+ /**
+ * ELEMENT content.<br>
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_LI_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdOptionContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdOptionContainer.java
new file mode 100644
index 0000000000..45f8430586
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdOptionContainer.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * OPTION container.
+ * (OPTION)+
+ */
+final class CtdOptionContainer extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdOptionContainer(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = CHTMLNamespace.ElementName.OPTION;
+ }
+
+ /**
+ * (OPTION)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( )+
+ content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
+ // OPTION
+ CMNode dec = collection.getNamedItem(CHTMLNamespace.ElementName.OPTION);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (OPTION)+
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * Name of complex type definition.
+ * Each singleton must know its own name.
+ * All names should be defined in
+ * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_OPTION_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdSelect.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdSelect.java
new file mode 100644
index 0000000000..ea83c5991c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/CtdSelect.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * for SELECT.
+ */
+final class CtdSelect extends ComplexTypeDefinition {
+
+ /**
+ * @param elementCollection ElementCollection
+ */
+ public CtdSelect(ElementCollection elementCollection) {
+ super(elementCollection);
+ primaryCandidateName = CHTMLNamespace.ElementName.OPTION;
+ }
+
+ /**
+ * (OPTGROUP | OPTION)+.
+ */
+ protected void createContent() {
+ if (content != null)
+ return; // already created.
+ if (collection == null)
+ return;
+
+ // ( | )+
+ content = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
+ // OPTION
+ CMNode dec = collection.getNamedItem(CHTMLNamespace.ElementName.OPTION);
+ if (dec != null)
+ content.appendChild(dec);
+ }
+
+ /**
+ * (OPTGROUP | OPTION)+.
+ * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
+ * those are defined in CMElementDeclaration.
+ */
+ public int getContentType() {
+ return CMElementDeclaration.ELEMENT;
+ }
+
+ /**
+ * @return java.lang.String
+ */
+ public String getTypeName() {
+ return ComplexTypeDefinitionFactory.CTYPE_SELECT;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/DeclCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/DeclCollection.java
new file mode 100644
index 0000000000..62809a8cdd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/DeclCollection.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ */
+abstract class DeclCollection implements CMNamedNodeMap {
+
+
+ protected class DualMap {
+ public DualMap() {
+ super();
+ }
+
+ public DualMap(Object[] objects) {
+ super();
+ initialize(objects);
+ }
+
+ public int size() {
+ return table.length;
+ }
+
+ public Object getValue(int key) {
+ if (!isValidIndex(key))
+ return null;
+ return table[key];
+ }
+
+ public int getKey(Object value) {
+ Integer keyObj = (Integer) map.get(value);
+ if (keyObj == null)
+ return ID_UNKNOWN;
+ return keyObj.intValue();
+ }
+
+ protected void initialize(Object[] objects) {
+ if (objects == null)
+ return;
+ table = objects;
+ map = new HashMap();
+ for (int key = 0; key < objects.length; key++) {
+ Object value = table[key];
+ map.put(value, new Integer(key));
+ }
+ }
+
+ private Object[] table = null;
+ private HashMap map = null;
+
+ private boolean isValidIndex(int index) {
+ return index >= 0 && index < table.length;
+ }
+ }
+
+ protected class TolerantStringDualMap extends DualMap {
+ public TolerantStringDualMap(String[] names) {
+ super();
+ Object[] objects = new Object[names.length];
+ for (int i = 0; i < names.length; i++) {
+ objects[i] = makeCanonicalForm(names[i]);
+ }
+ initialize(objects);
+ }
+
+ public int getKey(Object value) {
+ try {
+ String name = (String) value;
+ return super.getKey(makeCanonicalForm(name));
+ }
+ catch (ClassCastException e) {
+ return ID_UNKNOWN;
+ }
+ }
+
+ private String makeCanonicalForm(String raw) {
+ return raw.toUpperCase();
+ }
+ }
+
+ private class DeclIterator implements Iterator {
+ public DeclIterator() {
+ maxid = fDecls.length - 1;
+ }
+
+ public boolean hasNext() {
+ return id < maxid;
+ }
+
+ public Object next() {
+ if (!hasNext())
+ return null;
+ return item(++id);
+ }
+
+ public void remove() { /* nothing should be done. */
+ }
+
+ private int id = -1;
+ private int maxid = -1;
+ }
+
+ CMNode[] fDecls = null;
+ protected final static boolean STRICT_CASE = false;
+ protected final static boolean TOLERANT_CASE = true;
+ protected final static int ID_UNKNOWN = -1;
+ private DualMap fMap = null;
+
+ /**
+ */
+ public DeclCollection(String[] names, boolean tolerant) {
+ super();
+ fDecls = new CMNode[names.length];
+ if (tolerant) {
+ fMap = new TolerantStringDualMap(names);
+ }
+ else {
+ fMap = new DualMap(names);
+ }
+ }
+
+ /**
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param id int
+ */
+ protected abstract CMNode create(String name);
+
+ /**
+ */
+ public CMNamedNodeMap getDeclarations(String[] names) {
+ CMNamedNodeMapImpl map = new CMNamedNodeMapImpl();
+ for (int i = 0; i < names.length; i++) {
+ String name = names[i];
+ CMNode node = getNamedItem(name);
+ if (node == null)
+ continue;
+ map.putNamedItem(name, node);
+ }
+ return map;
+ }
+
+ /**
+ * @param declarations com.ibm.sed.contentmodel.html.CMGroupImpl
+ * @param names java.util.Iterator
+ */
+ public void getDeclarations(CMGroupImpl group, Iterator names) {
+ while (names.hasNext()) {
+ String entityName = (String) names.next();
+ CMNode dec = getNamedItem(entityName);
+ if (dec != null)
+ group.appendChild(dec);
+ }
+ }
+
+ /**
+ * Map name to id.
+ * @return int
+ * @param name java.lang.String
+ */
+ protected int getID(String name) {
+ return fMap.getKey(name);
+ }
+
+ /**
+ * getLength method
+ * @return int
+ */
+ public int getLength() {
+ return fDecls.length;
+ }
+
+ /**
+ * @return java.lang.String
+ * @param id int
+ */
+ protected String getName(int id) {
+ return (String) fMap.getValue(id);
+ }
+
+ /**
+ * getNamedItem method
+ * @return CMNode
+ * @param name java.lang.String
+ */
+ public CMNode getNamedItem(String name) {
+ int id = getID(name);
+ if (!isValidID(id))
+ return null;
+ return item(id);
+ }
+
+ /**
+ * @return boolean
+ * @param id int
+ */
+ private boolean isValidID(int id) {
+ return id >= 0 && id < fDecls.length;
+ }
+
+ /**
+ * item method
+ * @return CMNode
+ * @param index int
+ */
+ public CMNode item(int index) {
+ if (!isValidID(index))
+ return null;
+ CMNode decl = fDecls[index];
+ if (decl != null)
+ return decl; // already exist.
+
+ decl = create(getName(index));
+ fDecls[index] = decl;
+ return decl;
+ }
+
+ /**
+ */
+ public Iterator iterator() {
+ return new DeclIterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ElementCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ElementCollection.java
new file mode 100644
index 0000000000..854806427d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/ElementCollection.java
@@ -0,0 +1,495 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Factory for element declarations.
+ */
+final class ElementCollection extends DeclCollection implements org.eclipse.wst.html.core.HTML40Namespace.ElementName {
+
+
+ // Element IDs
+ private static class Ids {
+ public static final int ID_A = 0;
+ public static final int ID_ADDRESS = 1;
+ public static final int ID_BASE = 2;
+ public static final int ID_BLOCKQUOTE = 3;
+ public static final int ID_BODY = 4;
+ public static final int ID_BR = 5;
+ public static final int ID_CENTER = 6;
+ public static final int ID_DD = 7;
+ public static final int ID_DIR = 8;
+ public static final int ID_DIV = 9;
+ public static final int ID_DL = 10;
+ public static final int ID_DT = 11;
+ public static final int ID_FORM = 12;
+ public static final int ID_H1 = 13;
+ public static final int ID_H2 = 14;
+ public static final int ID_H3 = 15;
+ public static final int ID_H4 = 16;
+ public static final int ID_H5 = 17;
+ public static final int ID_H6 = 18;
+ public static final int ID_HEAD = 19;
+ public static final int ID_HR = 20;
+ public static final int ID_HTML = 21;
+ public static final int ID_IMG = 22;
+ public static final int ID_INPUT = 23;
+ public static final int ID_LI = 24;
+ public static final int ID_MENU = 25;
+ public static final int ID_META = 26;
+ public static final int ID_OL = 27;
+ public static final int ID_OPTION = 28;
+ public static final int ID_P = 29;
+ public static final int ID_PRE = 30;
+ public static final int ID_SELECT = 31;
+ public static final int ID_TEXTAREA = 32;
+ public static final int ID_TITLE = 33;
+ public static final int ID_UL = 34;
+ public static final int ID_SSI_CONFIG = 35;
+ public static final int ID_SSI_ECHO = 36;
+ public static final int ID_SSI_EXEC = 37;
+ public static final int ID_SSI_FSIZE = 38;
+ public static final int ID_SSI_FLASTMOD = 39;
+ public static final int ID_SSI_INCLUDE = 40;
+ public static final int ID_SSI_PRINTENV = 41;
+ public static final int ID_SSI_SET = 42;
+
+ public static int getNumOfIds() {
+ if (numofids != -1)
+ return numofids;
+
+ // NOTE: If the reflection is too slow, this method should
+ // just return the literal value, like 105.
+ // -- 5/25/2001
+ Class clazz = Ids.class;
+ Field[] fields = clazz.getFields();
+ numofids = 0;
+ for (int i = 0; i < fields.length; i++) {
+ String name = fields[i].getName();
+ if (name.startsWith("ID_"))//$NON-NLS-1$
+ numofids++;
+ }
+ return numofids;
+ }
+
+ // chache the result of the reflection.
+ private static int numofids = -1;
+ }
+
+ /** %formctl;. INPUT | SELECT | TEXTAREA */
+ private static final String[] FORMCTL = {INPUT, SELECT, TEXTAREA};
+ /** %phrase;.
+ * DFN
+ */
+ private static final String[] PHRASE = {DFN};
+ /** %special;.
+ * A | IMG | BR
+ */
+ private static final String[] SPECIAL = {A, IMG, BR};
+ /** %heading;. H[1-6] */
+ private static final String[] HEADING = {H1, H2, H3, H4, H5, H6};
+ /** %list;. UL | OL | DIR | MENU */
+ private static final String[] LIST = {UL, OL, DIR, MENU};
+ /** %preformatted;. PRE */
+ private static final String[] PREFORMATTED = {PRE};
+ private AttributeCollection attributeCollection = null;
+ private static String[] names = null;
+
+ static {
+ names = new String[Ids.getNumOfIds()];
+ names[Ids.ID_A] = A;
+ names[Ids.ID_ADDRESS] = ADDRESS;
+ names[Ids.ID_BASE] = BASE;
+ names[Ids.ID_BLOCKQUOTE] = BLOCKQUOTE;
+ names[Ids.ID_BODY] = BODY;
+ names[Ids.ID_BR] = BR;
+ names[Ids.ID_CENTER] = CENTER;
+ names[Ids.ID_DD] = DD;
+ names[Ids.ID_DIR] = DIR;
+ names[Ids.ID_DIV] = DIV;
+ names[Ids.ID_DL] = DL;
+ names[Ids.ID_DT] = DT;
+ names[Ids.ID_FORM] = FORM;
+ names[Ids.ID_H1] = H1;
+ names[Ids.ID_H2] = H2;
+ names[Ids.ID_H3] = H3;
+ names[Ids.ID_H4] = H4;
+ names[Ids.ID_H5] = H5;
+ names[Ids.ID_H6] = H6;
+ names[Ids.ID_HEAD] = HEAD;
+ names[Ids.ID_HR] = HR;
+ names[Ids.ID_HTML] = HTML;
+ names[Ids.ID_IMG] = IMG;
+ names[Ids.ID_INPUT] = INPUT;
+ names[Ids.ID_LI] = LI;
+ names[Ids.ID_MENU] = MENU;
+ names[Ids.ID_META] = META;
+ names[Ids.ID_OL] = OL;
+ names[Ids.ID_OPTION] = OPTION;
+ names[Ids.ID_P] = P;
+ names[Ids.ID_PRE] = PRE;
+ names[Ids.ID_SELECT] = SELECT;
+ names[Ids.ID_TEXTAREA] = TEXTAREA;
+ names[Ids.ID_TITLE] = TITLE;
+ names[Ids.ID_UL] = UL;
+ names[Ids.ID_SSI_CONFIG] = SSI_CONFIG;
+ names[Ids.ID_SSI_ECHO] = SSI_ECHO;
+ names[Ids.ID_SSI_EXEC] = SSI_EXEC;
+ names[Ids.ID_SSI_FSIZE] = SSI_FSIZE;
+ names[Ids.ID_SSI_FLASTMOD] = SSI_FLASTMOD;
+ names[Ids.ID_SSI_INCLUDE] = SSI_INCLUDE;
+ names[Ids.ID_SSI_PRINTENV] = SSI_PRINTENV;
+ names[Ids.ID_SSI_SET] = SSI_SET;
+ }
+
+ /**
+ */
+ public ElementCollection(AttributeCollection collection) {
+ super(names, TOLERANT_CASE);
+ attributeCollection = collection;
+ }
+
+ /**
+ * Actually creates HTMLElementDeclaration instance.
+ * @return HTMLElementDeclaration
+ */
+ protected CMNode create(String elementName) {
+ HTMLElemDeclImpl edec = null;
+
+ if (elementName.equalsIgnoreCase(A)) {
+ edec = new HedA(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(ADDRESS)) {
+ edec = new HedADDRESS(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BASE)) {
+ edec = new HedBASE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BLOCKQUOTE)) {
+ edec = new HedBLOCKQUOTE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BODY)) {
+ edec = new HedBODY(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(BR)) {
+ edec = new HedBR(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(CENTER)) {
+ edec = new HedCENTER(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DD)) {
+ edec = new HedDD(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DIR)) {
+ edec = new HedMENU(DIR, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DIV)) {
+ edec = new HedDIV(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DL)) {
+ edec = new HedDL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(DT)) {
+ edec = new HedDT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(FORM)) {
+ edec = new HedFORM(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H1)) {
+ edec = new HedHeading(H1, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H2)) {
+ edec = new HedHeading(H2, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H3)) {
+ edec = new HedHeading(H3, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H4)) {
+ edec = new HedHeading(H4, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H5)) {
+ edec = new HedHeading(H5, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(H6)) {
+ edec = new HedHeading(H6, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(HEAD)) {
+ edec = new HedHEAD(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(HR)) {
+ edec = new HedHR(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(HTML)) {
+ edec = new HedHTML(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(IMG)) {
+ edec = new HedIMG(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(INPUT)) {
+ edec = new HedINPUT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(LI)) {
+ edec = new HedLI(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(MENU)) {
+ edec = new HedMENU(MENU, this);
+
+ }
+ else if (elementName.equalsIgnoreCase(META)) {
+ edec = new HedMETA(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(OL)) {
+ edec = new HedOL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(OPTION)) {
+ edec = new HedOPTION(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(P)) {
+ edec = new HedP(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(PRE)) {
+ edec = new HedPRE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SELECT)) {
+ edec = new HedSELECT(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TEXTAREA)) {
+ edec = new HedTEXTAREA(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(TITLE)) {
+ edec = new HedTITLE(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(UL)) {
+ edec = new HedUL(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_CONFIG)) {
+ edec = new HedSSIConfig(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_ECHO)) {
+ edec = new HedSSIEcho(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_EXEC)) {
+ edec = new HedSSIExec(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_FSIZE)) {
+ edec = new HedSSIFsize(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_FLASTMOD)) {
+ edec = new HedSSIFlastmod(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_INCLUDE)) {
+ edec = new HedSSIInclude(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_PRINTENV)) {
+ edec = new HedSSIPrintenv(this);
+
+ }
+ else if (elementName.equalsIgnoreCase(SSI_SET)) {
+ edec = new HedSSISet(this);
+
+ } // unknown
+ else {
+ // NOTE: We don't define the UNKNOWN element declaration.
+ // <code>null</code> for a declaration is a sign of
+ // the target element is unknown.
+ // -- 3/9/2001
+ edec = null;
+ }
+ return edec;
+ }
+
+ /**
+ * @return com.ibm.sed.contentmodel.html.AttributeCollection
+ */
+ public AttributeCollection getAttributeCollection() {
+ return attributeCollection;
+ }
+
+ /**
+ */
+ public final Collection getNamesOfBlock() {
+ // P | %list | %preformatted | DL | DIV | CENTER | BLOCKQUOTE | FORM | HR
+ String[] blockMisc = {P, DL, DIV, CENTER, BLOCKQUOTE, FORM, HR,};
+ Vector blockNames = new Vector(Arrays.asList(blockMisc));
+ // %heading;
+ blockNames.addAll(Arrays.asList(HEADING));
+ // %list;
+ blockNames.addAll(Arrays.asList(LIST));
+ // %preformatted;
+ blockNames.addAll(Arrays.asList(PREFORMATTED));
+
+ return blockNames;
+ }
+
+ /**
+ * %block;.
+ * %block; is:
+ * P | %heading; | %list; | %preformatted; | DL | DIV | CENTER |
+ * NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR |
+ * TABLE | FIELDSET | ADDRESS.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getBlock(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, getNamesOfBlock().iterator());
+ }
+
+ /**
+ * Create element declarations and store them
+ * into a <code>CMGroupImpl</code> instance.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getFlow(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getBlock(group);
+ getInline(group);
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getFontstyle(CMGroupImpl group) {
+ return;
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getFormctrl(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(FORMCTL).iterator());
+ }
+
+ /**
+ * %heading;.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getHeading(CMGroupImpl group) {
+ if (group == null)
+ return;
+
+ getDeclarations(group, Arrays.asList(HEADING).iterator());
+ }
+
+ /**
+ * Create element declarations and store them
+ * into a <code>CMGroupImpl</code> instance.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getInline(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getFontstyle(group);
+ getPhrase(group);
+ getSpecial(group);
+ getFormctrl(group);
+ }
+
+ /**
+ * %list;.
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getList(CMGroupImpl group) {
+ if (group == null)
+ return;
+
+ getDeclarations(group, Arrays.asList(LIST).iterator());
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getPhrase(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(PHRASE).iterator());
+ }
+
+ /**
+ * %preformatted;
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getPreformatted(CMGroupImpl group) {
+ if (group == null)
+ return;
+
+ getDeclarations(group, Arrays.asList(PREFORMATTED).iterator());
+ }
+
+ /**
+ * Create element declarations and store them into a <code>CMGroupImpl</code>
+ * instance.<br>
+ * @param group CMGroupImpl Return values.
+ */
+ public final void getSpecial(CMGroupImpl group) {
+ if (group == null)
+ return;
+ getDeclarations(group, Arrays.asList(SPECIAL).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/EntityCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/EntityCollection.java
new file mode 100644
index 0000000000..1ae092584c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/EntityCollection.java
@@ -0,0 +1,837 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.lang.reflect.Field;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * Factory for entity declarations.
+ */
+final class EntityCollection extends DeclCollection implements org.eclipse.wst.html.core.HTML40Namespace.EntityName {
+
+
+ private static class Ids {
+ public static final int ID_AACUTE_L = 0;
+ public static final int ID_AACUTE_U = 1;
+ public static final int ID_ACIRC_L = 2;
+ public static final int ID_ACIRC_U = 3;
+ public static final int ID_ACUTE = 4;
+ public static final int ID_AELIG_L = 5;
+ public static final int ID_AELIG_U = 6;
+ public static final int ID_AGRAVE_L = 7;
+ public static final int ID_AGRAVE_U = 8;
+ public static final int ID_ALEFSYM = 9;
+ public static final int ID_ALPHA_L = 10;
+ public static final int ID_ALPHA_U = 11;
+ public static final int ID_AMP = 12;
+ public static final int ID_AND = 13;
+ public static final int ID_ANG = 14;
+ public static final int ID_ARING_L = 15;
+ public static final int ID_ARING_U = 16;
+ public static final int ID_ASYMP = 17;
+ public static final int ID_ATILDE_L = 18;
+ public static final int ID_ATILDE_U = 19;
+ public static final int ID_AUML_L = 20;
+ public static final int ID_AUML_U = 21;
+ public static final int ID_BDQUO = 22;
+ public static final int ID_BETA_L = 23;
+ public static final int ID_BETA_U = 24;
+ public static final int ID_BRVBAR = 25;
+ public static final int ID_BULL = 26;
+ public static final int ID_CAP = 27;
+ public static final int ID_CCEDIL_L = 28;
+ public static final int ID_CCEDIL_U = 29;
+ public static final int ID_CEDIL = 30;
+ public static final int ID_CENT = 31;
+ public static final int ID_CHI_L = 32;
+ public static final int ID_CHI_U = 33;
+ public static final int ID_CIRC = 34;
+ public static final int ID_CLUBS = 35;
+ public static final int ID_CONG = 36;
+ public static final int ID_COPY = 37;
+ public static final int ID_CRARR = 38;
+ public static final int ID_CUP = 39;
+ public static final int ID_CURREN = 40;
+ public static final int ID_DAGGER_L = 41;
+ public static final int ID_DAGGER_U = 42;
+ public static final int ID_DARR_L = 43;
+ public static final int ID_DARR_U = 44;
+ public static final int ID_DEG = 45;
+ public static final int ID_DELTA_L = 46;
+ public static final int ID_DELTA_U = 47;
+ public static final int ID_DIAMS = 48;
+ public static final int ID_DIVIDE = 49;
+ public static final int ID_EACUTE_L = 50;
+ public static final int ID_EACUTE_U = 51;
+ public static final int ID_ECIRC_L = 52;
+ public static final int ID_ECIRC_U = 53;
+ public static final int ID_EGRAVE_L = 54;
+ public static final int ID_EGRAVE_U = 55;
+ public static final int ID_EMPTY = 56;
+ public static final int ID_EMSP = 57;
+ public static final int ID_ENSP = 58;
+ public static final int ID_EPSILON_L = 59;
+ public static final int ID_EPSILON_U = 60;
+ public static final int ID_EQUIV = 61;
+ public static final int ID_ETA_L = 62;
+ public static final int ID_ETA_U = 63;
+ public static final int ID_ETH_L = 64;
+ public static final int ID_ETH_U = 65;
+ public static final int ID_EUML_L = 66;
+ public static final int ID_EUML_U = 67;
+ public static final int ID_EURO = 68;
+ public static final int ID_EXIST = 69;
+ public static final int ID_FNOF = 70;
+ public static final int ID_FORALL = 71;
+ public static final int ID_FRAC12 = 72;
+ public static final int ID_FRAC14 = 73;
+ public static final int ID_FRAC34 = 74;
+ public static final int ID_FRASL = 75;
+ public static final int ID_GAMMA_L = 76;
+ public static final int ID_GAMMA_U = 77;
+ public static final int ID_GE = 78;
+ public static final int ID_GT = 79;
+ public static final int ID_HARR_L = 80;
+ public static final int ID_HARR_U = 81;
+ public static final int ID_HEARTS = 82;
+ public static final int ID_HELLIP = 83;
+ public static final int ID_IACUTE_L = 84;
+ public static final int ID_IACUTE_U = 85;
+ public static final int ID_ICIRC_L = 86;
+ public static final int ID_ICIRC_U = 87;
+ public static final int ID_IEXCL = 88;
+ public static final int ID_IGRAVE_L = 89;
+ public static final int ID_IGRAVE_U = 90;
+ public static final int ID_IMAGE = 91;
+ public static final int ID_INFIN = 92;
+ public static final int ID_INT = 93;
+ public static final int ID_IOTA_L = 94;
+ public static final int ID_IOTA_U = 95;
+ public static final int ID_IQUEST = 96;
+ public static final int ID_ISIN = 97;
+ public static final int ID_IUML_L = 98;
+ public static final int ID_IUML_U = 99;
+ public static final int ID_KAPPA_L = 100;
+ public static final int ID_KAPPA_U = 101;
+ public static final int ID_LAMBDA_L = 102;
+ public static final int ID_LAMBDA_U = 103;
+ public static final int ID_LANG = 104;
+ public static final int ID_LAQUO = 105;
+ public static final int ID_LARR_L = 106;
+ public static final int ID_LARR_U = 107;
+ public static final int ID_LCEIL = 108;
+ public static final int ID_LDQUO = 109;
+ public static final int ID_LE = 110;
+ public static final int ID_LFLOOR = 111;
+ public static final int ID_LOWAST = 112;
+ public static final int ID_LOZ = 113;
+ public static final int ID_LRM = 114;
+ public static final int ID_LSAQUO = 115;
+ public static final int ID_LSQUO = 116;
+ public static final int ID_LT = 117;
+ public static final int ID_MACR = 118;
+ public static final int ID_MDASH = 119;
+ public static final int ID_MICRO = 120;
+ public static final int ID_MIDDOT = 121;
+ public static final int ID_MINUS = 122;
+ public static final int ID_MU_L = 123;
+ public static final int ID_MU_U = 124;
+ public static final int ID_NABLA = 125;
+ public static final int ID_NBSP = 126;
+ public static final int ID_NDASH = 127;
+ public static final int ID_NE = 128;
+ public static final int ID_NI = 129;
+ public static final int ID_NOT = 130;
+ public static final int ID_NOTIN = 131;
+ public static final int ID_NSUB = 132;
+ public static final int ID_NTILDE_L = 133;
+ public static final int ID_NTILDE_U = 134;
+ public static final int ID_NU_L = 135;
+ public static final int ID_NU_U = 136;
+ public static final int ID_OACUTE_L = 137;
+ public static final int ID_OACUTE_U = 138;
+ public static final int ID_OCIRC_L = 139;
+ public static final int ID_OCIRC_U = 140;
+ public static final int ID_OELIG_L = 141;
+ public static final int ID_OELIG_U = 142;
+ public static final int ID_OGRAVE_L = 143;
+ public static final int ID_OGRAVE_U = 144;
+ public static final int ID_OLINE = 145;
+ public static final int ID_OMEGA_L = 146;
+ public static final int ID_OMEGA_U = 147;
+ public static final int ID_OMICRON_L = 148;
+ public static final int ID_OMICRON_U = 149;
+ public static final int ID_OPLUS = 150;
+ public static final int ID_OR = 151;
+ public static final int ID_ORDF = 152;
+ public static final int ID_ORDM = 153;
+ public static final int ID_OSLASH_L = 154;
+ public static final int ID_OSLASH_U = 155;
+ public static final int ID_OTILDE_L = 156;
+ public static final int ID_OTILDE_U = 157;
+ public static final int ID_OTIMES = 158;
+ public static final int ID_OUML_L = 159;
+ public static final int ID_OUML_U = 160;
+ public static final int ID_PARA = 161;
+ public static final int ID_PART = 162;
+ public static final int ID_PERMIL = 163;
+ public static final int ID_PERP = 164;
+ public static final int ID_PHI_L = 165;
+ public static final int ID_PHI_U = 166;
+ public static final int ID_PIV = 167;
+ public static final int ID_PI_L = 168;
+ public static final int ID_PI_U = 169;
+ public static final int ID_PLUSMN = 170;
+ public static final int ID_POUND = 171;
+ public static final int ID_PRIME_L = 172;
+ public static final int ID_PRIME_U = 173;
+ public static final int ID_PROD = 174;
+ public static final int ID_PROP = 175;
+ public static final int ID_PSI_L = 176;
+ public static final int ID_PSI_U = 177;
+ public static final int ID_QUOT = 178;
+ public static final int ID_RADIC = 179;
+ public static final int ID_RANG = 180;
+ public static final int ID_RAQUO = 181;
+ public static final int ID_RARR_L = 182;
+ public static final int ID_RARR_U = 183;
+ public static final int ID_RCEIL = 184;
+ public static final int ID_RDQUO = 185;
+ public static final int ID_REAL = 186;
+ public static final int ID_REG = 187;
+ public static final int ID_RFLOOR = 188;
+ public static final int ID_RHO_L = 189;
+ public static final int ID_RHO_U = 190;
+ public static final int ID_RLM = 191;
+ public static final int ID_RSAQUO = 192;
+ public static final int ID_RSQUO = 193;
+ public static final int ID_SBQUO = 194;
+ public static final int ID_SCARON_L = 195;
+ public static final int ID_SCARON_U = 196;
+ public static final int ID_SDOT = 197;
+ public static final int ID_SECT = 198;
+ public static final int ID_SHY = 199;
+ public static final int ID_SIGMAF = 200;
+ public static final int ID_SIGMA_L = 201;
+ public static final int ID_SIGMA_U = 202;
+ public static final int ID_SIM = 203;
+ public static final int ID_SPADES = 204;
+ public static final int ID_SUB = 205;
+ public static final int ID_SUBE = 206;
+ public static final int ID_SUM = 207;
+ public static final int ID_SUP = 208;
+ public static final int ID_SUP1 = 209;
+ public static final int ID_SUP2 = 210;
+ public static final int ID_SUP3 = 211;
+ public static final int ID_SUPE = 212;
+ public static final int ID_SZLIG = 213;
+ public static final int ID_TAU_L = 214;
+ public static final int ID_TAU_U = 215;
+ public static final int ID_THERE4 = 216;
+ public static final int ID_THETASYM = 217;
+ public static final int ID_THETA_L = 218;
+ public static final int ID_THETA_U = 219;
+ public static final int ID_THINSP = 220;
+ public static final int ID_THORN_L = 221;
+ public static final int ID_THORN_U = 222;
+ public static final int ID_TILDE = 223;
+ public static final int ID_TIMES = 224;
+ public static final int ID_TRADE = 225;
+ public static final int ID_UACUTE_L = 226;
+ public static final int ID_UACUTE_U = 227;
+ public static final int ID_UARR_L = 228;
+ public static final int ID_UARR_U = 229;
+ public static final int ID_UCIRC_L = 230;
+ public static final int ID_UCIRC_U = 231;
+ public static final int ID_UGRAVE_L = 232;
+ public static final int ID_UGRAVE_U = 233;
+ public static final int ID_UML = 234;
+ public static final int ID_UPSIH = 235;
+ public static final int ID_UPSILON_L = 236;
+ public static final int ID_UPSILON_U = 237;
+ public static final int ID_UUML_L = 238;
+ public static final int ID_UUML_U = 239;
+ public static final int ID_WEIERP = 240;
+ public static final int ID_XI_L = 241;
+ public static final int ID_XI_U = 242;
+ public static final int ID_YACUTE_L = 243;
+ public static final int ID_YACUTE_U = 244;
+ public static final int ID_YEN = 245;
+ public static final int ID_YUML_L = 246;
+ public static final int ID_YUML_U = 247;
+ public static final int ID_ZETA_L = 248;
+ public static final int ID_ZETA_U = 249;
+ public static final int ID_ZWJ = 250;
+ public static final int ID_ZWNJ = 251;
+
+ public static int getNumOfIds() {
+ if (numofids != -1)
+ return numofids;
+
+ // NOTE: If the reflection is too slow, this method should
+ // just return the literal value, like 252.
+ // -- 5/24/2001
+ Class clazz = Ids.class;
+ Field[] fields = clazz.getFields();
+ numofids = 0;
+ for (int i = 0; i < fields.length; i++) {
+ String name = fields[i].getName();
+ if (name.startsWith("ID_"))//$NON-NLS-1$
+ numofids++;
+ }
+ return numofids;
+ }
+
+ // chache the result of the reflection.
+ private static int numofids = -1;
+ }
+
+ private static String[] names = null;
+
+ static {
+ names = new String[Ids.getNumOfIds()];
+ names[Ids.ID_AACUTE_L] = AACUTE_L;
+ names[Ids.ID_AACUTE_U] = AACUTE_U;
+ names[Ids.ID_ACIRC_L] = ACIRC_L;
+ names[Ids.ID_ACIRC_U] = ACIRC_U;
+ names[Ids.ID_ACUTE] = ACUTE;
+ names[Ids.ID_AELIG_L] = AELIG_L;
+ names[Ids.ID_AELIG_U] = AELIG_U;
+ names[Ids.ID_AGRAVE_L] = AGRAVE_L;
+ names[Ids.ID_AGRAVE_U] = AGRAVE_U;
+ names[Ids.ID_ALEFSYM] = ALEFSYM;
+ names[Ids.ID_ALPHA_L] = ALPHA_L;
+ names[Ids.ID_ALPHA_U] = ALPHA_U;
+ names[Ids.ID_AMP] = AMP;
+ names[Ids.ID_AND] = AND;
+ names[Ids.ID_ANG] = ANG;
+ names[Ids.ID_ARING_L] = ARING_L;
+ names[Ids.ID_ARING_U] = ARING_U;
+ names[Ids.ID_ASYMP] = ASYMP;
+ names[Ids.ID_ATILDE_L] = ATILDE_L;
+ names[Ids.ID_ATILDE_U] = ATILDE_U;
+ names[Ids.ID_AUML_L] = AUML_L;
+ names[Ids.ID_AUML_U] = AUML_U;
+ names[Ids.ID_BDQUO] = BDQUO;
+ names[Ids.ID_BETA_L] = BETA_L;
+ names[Ids.ID_BETA_U] = BETA_U;
+ names[Ids.ID_BRVBAR] = BRVBAR;
+ names[Ids.ID_BULL] = BULL;
+ names[Ids.ID_CAP] = CAP;
+ names[Ids.ID_CCEDIL_L] = CCEDIL_L;
+ names[Ids.ID_CCEDIL_U] = CCEDIL_U;
+ names[Ids.ID_CEDIL] = CEDIL;
+ names[Ids.ID_CENT] = CENT;
+ names[Ids.ID_CHI_L] = CHI_L;
+ names[Ids.ID_CHI_U] = CHI_U;
+ names[Ids.ID_CIRC] = CIRC;
+ names[Ids.ID_CLUBS] = CLUBS;
+ names[Ids.ID_CONG] = CONG;
+ names[Ids.ID_COPY] = COPY;
+ names[Ids.ID_CRARR] = CRARR;
+ names[Ids.ID_CUP] = CUP;
+ names[Ids.ID_CURREN] = CURREN;
+ names[Ids.ID_DAGGER_L] = DAGGER_L;
+ names[Ids.ID_DAGGER_U] = DAGGER_U;
+ names[Ids.ID_DARR_L] = DARR_L;
+ names[Ids.ID_DARR_U] = DARR_U;
+ names[Ids.ID_DEG] = DEG;
+ names[Ids.ID_DELTA_L] = DELTA_L;
+ names[Ids.ID_DELTA_U] = DELTA_U;
+ names[Ids.ID_DIAMS] = DIAMS;
+ names[Ids.ID_DIVIDE] = DIVIDE;
+ names[Ids.ID_EACUTE_L] = EACUTE_L;
+ names[Ids.ID_EACUTE_U] = EACUTE_U;
+ names[Ids.ID_ECIRC_L] = ECIRC_L;
+ names[Ids.ID_ECIRC_U] = ECIRC_U;
+ names[Ids.ID_EGRAVE_L] = EGRAVE_L;
+ names[Ids.ID_EGRAVE_U] = EGRAVE_U;
+ names[Ids.ID_EMPTY] = EMPTY;
+ names[Ids.ID_EMSP] = EMSP;
+ names[Ids.ID_ENSP] = ENSP;
+ names[Ids.ID_EPSILON_L] = EPSILON_L;
+ names[Ids.ID_EPSILON_U] = EPSILON_U;
+ names[Ids.ID_EQUIV] = EQUIV;
+ names[Ids.ID_ETA_L] = ETA_L;
+ names[Ids.ID_ETA_U] = ETA_U;
+ names[Ids.ID_ETH_L] = ETH_L;
+ names[Ids.ID_ETH_U] = ETH_U;
+ names[Ids.ID_EUML_L] = EUML_L;
+ names[Ids.ID_EUML_U] = EUML_U;
+ names[Ids.ID_EURO] = EURO;
+ names[Ids.ID_EXIST] = EXIST;
+ names[Ids.ID_FNOF] = FNOF;
+ names[Ids.ID_FORALL] = FORALL;
+ names[Ids.ID_FRAC12] = FRAC12;
+ names[Ids.ID_FRAC14] = FRAC14;
+ names[Ids.ID_FRAC34] = FRAC34;
+ names[Ids.ID_FRASL] = FRASL;
+ names[Ids.ID_GAMMA_L] = GAMMA_L;
+ names[Ids.ID_GAMMA_U] = GAMMA_U;
+ names[Ids.ID_GE] = GE;
+ names[Ids.ID_GT] = GT;
+ names[Ids.ID_HARR_L] = HARR_L;
+ names[Ids.ID_HARR_U] = HARR_U;
+ names[Ids.ID_HEARTS] = HEARTS;
+ names[Ids.ID_HELLIP] = HELLIP;
+ names[Ids.ID_IACUTE_L] = IACUTE_L;
+ names[Ids.ID_IACUTE_U] = IACUTE_U;
+ names[Ids.ID_ICIRC_L] = ICIRC_L;
+ names[Ids.ID_ICIRC_U] = ICIRC_U;
+ names[Ids.ID_IEXCL] = IEXCL;
+ names[Ids.ID_IGRAVE_L] = IGRAVE_L;
+ names[Ids.ID_IGRAVE_U] = IGRAVE_U;
+ names[Ids.ID_IMAGE] = IMAGE;
+ names[Ids.ID_INFIN] = INFIN;
+ names[Ids.ID_INT] = INT;
+ names[Ids.ID_IOTA_L] = IOTA_L;
+ names[Ids.ID_IOTA_U] = IOTA_U;
+ names[Ids.ID_IQUEST] = IQUEST;
+ names[Ids.ID_ISIN] = ISIN;
+ names[Ids.ID_IUML_L] = IUML_L;
+ names[Ids.ID_IUML_U] = IUML_U;
+ names[Ids.ID_KAPPA_L] = KAPPA_L;
+ names[Ids.ID_KAPPA_U] = KAPPA_U;
+ names[Ids.ID_LAMBDA_L] = LAMBDA_L;
+ names[Ids.ID_LAMBDA_U] = LAMBDA_U;
+ names[Ids.ID_LANG] = LANG;
+ names[Ids.ID_LAQUO] = LAQUO;
+ names[Ids.ID_LARR_L] = LARR_L;
+ names[Ids.ID_LARR_U] = LARR_U;
+ names[Ids.ID_LCEIL] = LCEIL;
+ names[Ids.ID_LDQUO] = LDQUO;
+ names[Ids.ID_LE] = LE;
+ names[Ids.ID_LFLOOR] = LFLOOR;
+ names[Ids.ID_LOWAST] = LOWAST;
+ names[Ids.ID_LOZ] = LOZ;
+ names[Ids.ID_LRM] = LRM;
+ names[Ids.ID_LSAQUO] = LSAQUO;
+ names[Ids.ID_LSQUO] = LSQUO;
+ names[Ids.ID_LT] = LT;
+ names[Ids.ID_MACR] = MACR;
+ names[Ids.ID_MDASH] = MDASH;
+ names[Ids.ID_MICRO] = MICRO;
+ names[Ids.ID_MIDDOT] = MIDDOT;
+ names[Ids.ID_MINUS] = MINUS;
+ names[Ids.ID_MU_L] = MU_L;
+ names[Ids.ID_MU_U] = MU_U;
+ names[Ids.ID_NABLA] = NABLA;
+ names[Ids.ID_NBSP] = NBSP;
+ names[Ids.ID_NDASH] = NDASH;
+ names[Ids.ID_NE] = NE;
+ names[Ids.ID_NI] = NI;
+ names[Ids.ID_NOT] = NOT;
+ names[Ids.ID_NOTIN] = NOTIN;
+ names[Ids.ID_NSUB] = NSUB;
+ names[Ids.ID_NTILDE_L] = NTILDE_L;
+ names[Ids.ID_NTILDE_U] = NTILDE_U;
+ names[Ids.ID_NU_L] = NU_L;
+ names[Ids.ID_NU_U] = NU_U;
+ names[Ids.ID_OACUTE_L] = OACUTE_L;
+ names[Ids.ID_OACUTE_U] = OACUTE_U;
+ names[Ids.ID_OCIRC_L] = OCIRC_L;
+ names[Ids.ID_OCIRC_U] = OCIRC_U;
+ names[Ids.ID_OELIG_L] = OELIG_L;
+ names[Ids.ID_OELIG_U] = OELIG_U;
+ names[Ids.ID_OGRAVE_L] = OGRAVE_L;
+ names[Ids.ID_OGRAVE_U] = OGRAVE_U;
+ names[Ids.ID_OLINE] = OLINE;
+ names[Ids.ID_OMEGA_L] = OMEGA_L;
+ names[Ids.ID_OMEGA_U] = OMEGA_U;
+ names[Ids.ID_OMICRON_L] = OMICRON_L;
+ names[Ids.ID_OMICRON_U] = OMICRON_U;
+ names[Ids.ID_OPLUS] = OPLUS;
+ names[Ids.ID_OR] = OR;
+ names[Ids.ID_ORDF] = ORDF;
+ names[Ids.ID_ORDM] = ORDM;
+ names[Ids.ID_OSLASH_L] = OSLASH_L;
+ names[Ids.ID_OSLASH_U] = OSLASH_U;
+ names[Ids.ID_OTILDE_L] = OTILDE_L;
+ names[Ids.ID_OTILDE_U] = OTILDE_U;
+ names[Ids.ID_OTIMES] = OTIMES;
+ names[Ids.ID_OUML_L] = OUML_L;
+ names[Ids.ID_OUML_U] = OUML_U;
+ names[Ids.ID_PARA] = PARA;
+ names[Ids.ID_PART] = PART;
+ names[Ids.ID_PERMIL] = PERMIL;
+ names[Ids.ID_PERP] = PERP;
+ names[Ids.ID_PHI_L] = PHI_L;
+ names[Ids.ID_PHI_U] = PHI_U;
+ names[Ids.ID_PIV] = PIV;
+ names[Ids.ID_PI_L] = PI_L;
+ names[Ids.ID_PI_U] = PI_U;
+ names[Ids.ID_PLUSMN] = PLUSMN;
+ names[Ids.ID_POUND] = POUND;
+ names[Ids.ID_PRIME_L] = PRIME_L;
+ names[Ids.ID_PRIME_U] = PRIME_U;
+ names[Ids.ID_PROD] = PROD;
+ names[Ids.ID_PROP] = PROP;
+ names[Ids.ID_PSI_L] = PSI_L;
+ names[Ids.ID_PSI_U] = PSI_U;
+ names[Ids.ID_QUOT] = QUOT;
+ names[Ids.ID_RADIC] = RADIC;
+ names[Ids.ID_RANG] = RANG;
+ names[Ids.ID_RAQUO] = RAQUO;
+ names[Ids.ID_RARR_L] = RARR_L;
+ names[Ids.ID_RARR_U] = RARR_U;
+ names[Ids.ID_RCEIL] = RCEIL;
+ names[Ids.ID_RDQUO] = RDQUO;
+ names[Ids.ID_REAL] = REAL;
+ names[Ids.ID_REG] = REG;
+ names[Ids.ID_RFLOOR] = RFLOOR;
+ names[Ids.ID_RHO_L] = RHO_L;
+ names[Ids.ID_RHO_U] = RHO_U;
+ names[Ids.ID_RLM] = RLM;
+ names[Ids.ID_RSAQUO] = RSAQUO;
+ names[Ids.ID_RSQUO] = RSQUO;
+ names[Ids.ID_SBQUO] = SBQUO;
+ names[Ids.ID_SCARON_L] = SCARON_L;
+ names[Ids.ID_SCARON_U] = SCARON_U;
+ names[Ids.ID_SDOT] = SDOT;
+ names[Ids.ID_SECT] = SECT;
+ names[Ids.ID_SHY] = SHY;
+ names[Ids.ID_SIGMAF] = SIGMAF;
+ names[Ids.ID_SIGMA_L] = SIGMA_L;
+ names[Ids.ID_SIGMA_U] = SIGMA_U;
+ names[Ids.ID_SIM] = SIM;
+ names[Ids.ID_SPADES] = SPADES;
+ names[Ids.ID_SUB] = SUB;
+ names[Ids.ID_SUBE] = SUBE;
+ names[Ids.ID_SUM] = SUM;
+ names[Ids.ID_SUP] = SUP;
+ names[Ids.ID_SUP1] = SUP1;
+ names[Ids.ID_SUP2] = SUP2;
+ names[Ids.ID_SUP3] = SUP3;
+ names[Ids.ID_SUPE] = SUPE;
+ names[Ids.ID_SZLIG] = SZLIG;
+ names[Ids.ID_TAU_L] = TAU_L;
+ names[Ids.ID_TAU_U] = TAU_U;
+ names[Ids.ID_THERE4] = THERE4;
+ names[Ids.ID_THETASYM] = THETASYM;
+ names[Ids.ID_THETA_L] = THETA_L;
+ names[Ids.ID_THETA_U] = THETA_U;
+ names[Ids.ID_THINSP] = THINSP;
+ names[Ids.ID_THORN_L] = THORN_L;
+ names[Ids.ID_THORN_U] = THORN_U;
+ names[Ids.ID_TILDE] = TILDE;
+ names[Ids.ID_TIMES] = TIMES;
+ names[Ids.ID_TRADE] = TRADE;
+ names[Ids.ID_UACUTE_L] = UACUTE_L;
+ names[Ids.ID_UACUTE_U] = UACUTE_U;
+ names[Ids.ID_UARR_L] = UARR_L;
+ names[Ids.ID_UARR_U] = UARR_U;
+ names[Ids.ID_UCIRC_L] = UCIRC_L;
+ names[Ids.ID_UCIRC_U] = UCIRC_U;
+ names[Ids.ID_UGRAVE_L] = UGRAVE_L;
+ names[Ids.ID_UGRAVE_U] = UGRAVE_U;
+ names[Ids.ID_UML] = UML;
+ names[Ids.ID_UPSIH] = UPSIH;
+ names[Ids.ID_UPSILON_L] = UPSILON_L;
+ names[Ids.ID_UPSILON_U] = UPSILON_U;
+ names[Ids.ID_UUML_L] = UUML_L;
+ names[Ids.ID_UUML_U] = UUML_U;
+ names[Ids.ID_WEIERP] = WEIERP;
+ names[Ids.ID_XI_L] = XI_L;
+ names[Ids.ID_XI_U] = XI_U;
+ names[Ids.ID_YACUTE_L] = YACUTE_L;
+ names[Ids.ID_YACUTE_U] = YACUTE_U;
+ names[Ids.ID_YEN] = YEN;
+ names[Ids.ID_YUML_L] = YUML_L;
+ names[Ids.ID_YUML_U] = YUML_U;
+ names[Ids.ID_ZETA_L] = ZETA_L;
+ names[Ids.ID_ZETA_U] = ZETA_U;
+ names[Ids.ID_ZWJ] = ZWJ;
+ names[Ids.ID_ZWNJ] = ZWNJ;
+ }
+ private static char[] values = null;
+
+ static {
+ values = new char[Ids.getNumOfIds()];
+ values[Ids.ID_AACUTE_L] = 225;
+ values[Ids.ID_AACUTE_U] = 193;
+ values[Ids.ID_ACIRC_L] = 226;
+ values[Ids.ID_ACIRC_U] = 194;
+ values[Ids.ID_ACUTE] = 180;
+ values[Ids.ID_AELIG_L] = 230;
+ values[Ids.ID_AELIG_U] = 198;
+ values[Ids.ID_AGRAVE_L] = 224;
+ values[Ids.ID_AGRAVE_U] = 192;
+ values[Ids.ID_ALEFSYM] = 8501;
+ values[Ids.ID_ALPHA_L] = 945;
+ values[Ids.ID_ALPHA_U] = 913;
+ values[Ids.ID_AMP] = 38;
+ values[Ids.ID_AND] = 8743;
+ values[Ids.ID_ANG] = 8736;
+ values[Ids.ID_ARING_L] = 229;
+ values[Ids.ID_ARING_U] = 197;
+ values[Ids.ID_ASYMP] = 8776;
+ values[Ids.ID_ATILDE_L] = 227;
+ values[Ids.ID_ATILDE_U] = 195;
+ values[Ids.ID_AUML_L] = 228;
+ values[Ids.ID_AUML_U] = 196;
+ values[Ids.ID_BDQUO] = 8222;
+ values[Ids.ID_BETA_L] = 946;
+ values[Ids.ID_BETA_U] = 914;
+ values[Ids.ID_BRVBAR] = 166;
+ values[Ids.ID_BULL] = 8226;
+ values[Ids.ID_CAP] = 8745;
+ values[Ids.ID_CCEDIL_L] = 231;
+ values[Ids.ID_CCEDIL_U] = 199;
+ values[Ids.ID_CEDIL] = 184;
+ values[Ids.ID_CENT] = 162;
+ values[Ids.ID_CHI_L] = 967;
+ values[Ids.ID_CHI_U] = 935;
+ values[Ids.ID_CIRC] = 710;
+ values[Ids.ID_CLUBS] = 9827;
+ values[Ids.ID_CONG] = 8773;
+ values[Ids.ID_COPY] = 169;
+ values[Ids.ID_CRARR] = 8629;
+ values[Ids.ID_CUP] = 8746;
+ values[Ids.ID_CURREN] = 164;
+ values[Ids.ID_DAGGER_L] = 8224;
+ values[Ids.ID_DAGGER_U] = 8225;
+ values[Ids.ID_DARR_L] = 8595;
+ values[Ids.ID_DARR_U] = 8659;
+ values[Ids.ID_DEG] = 176;
+ values[Ids.ID_DELTA_L] = 948;
+ values[Ids.ID_DELTA_U] = 916;
+ values[Ids.ID_DIAMS] = 9830;
+ values[Ids.ID_DIVIDE] = 247;
+ values[Ids.ID_EACUTE_L] = 233;
+ values[Ids.ID_EACUTE_U] = 201;
+ values[Ids.ID_ECIRC_L] = 234;
+ values[Ids.ID_ECIRC_U] = 202;
+ values[Ids.ID_EGRAVE_L] = 232;
+ values[Ids.ID_EGRAVE_U] = 200;
+ values[Ids.ID_EMPTY] = 8709;
+ values[Ids.ID_EMSP] = 8195;
+ values[Ids.ID_ENSP] = 8194;
+ values[Ids.ID_EPSILON_L] = 949;
+ values[Ids.ID_EPSILON_U] = 917;
+ values[Ids.ID_EQUIV] = 8801;
+ values[Ids.ID_ETA_L] = 951;
+ values[Ids.ID_ETA_U] = 919;
+ values[Ids.ID_ETH_L] = 240;
+ values[Ids.ID_ETH_U] = 208;
+ values[Ids.ID_EUML_L] = 235;
+ values[Ids.ID_EUML_U] = 203;
+ values[Ids.ID_EURO] = 8364;
+ values[Ids.ID_EXIST] = 8707;
+ values[Ids.ID_FNOF] = 402;
+ values[Ids.ID_FORALL] = 8704;
+ values[Ids.ID_FRAC12] = 189;
+ values[Ids.ID_FRAC14] = 188;
+ values[Ids.ID_FRAC34] = 190;
+ values[Ids.ID_FRASL] = 8260;
+ values[Ids.ID_GAMMA_L] = 947;
+ values[Ids.ID_GAMMA_U] = 915;
+ values[Ids.ID_GE] = 8805;
+ values[Ids.ID_GT] = 62;
+ values[Ids.ID_HARR_L] = 8596;
+ values[Ids.ID_HARR_U] = 8660;
+ values[Ids.ID_HEARTS] = 9829;
+ values[Ids.ID_HELLIP] = 8230;
+ values[Ids.ID_IACUTE_L] = 237;
+ values[Ids.ID_IACUTE_U] = 205;
+ values[Ids.ID_ICIRC_L] = 238;
+ values[Ids.ID_ICIRC_U] = 206;
+ values[Ids.ID_IEXCL] = 161;
+ values[Ids.ID_IGRAVE_L] = 236;
+ values[Ids.ID_IGRAVE_U] = 204;
+ values[Ids.ID_IMAGE] = 8465;
+ values[Ids.ID_INFIN] = 8734;
+ values[Ids.ID_INT] = 8747;
+ values[Ids.ID_IOTA_L] = 953;
+ values[Ids.ID_IOTA_U] = 921;
+ values[Ids.ID_IQUEST] = 191;
+ values[Ids.ID_ISIN] = 8712;
+ values[Ids.ID_IUML_L] = 239;
+ values[Ids.ID_IUML_U] = 207;
+ values[Ids.ID_KAPPA_L] = 954;
+ values[Ids.ID_KAPPA_U] = 922;
+ values[Ids.ID_LAMBDA_L] = 955;
+ values[Ids.ID_LAMBDA_U] = 923;
+ values[Ids.ID_LANG] = 9001;
+ values[Ids.ID_LAQUO] = 171;
+ values[Ids.ID_LARR_L] = 8592;
+ values[Ids.ID_LARR_U] = 8656;
+ values[Ids.ID_LCEIL] = 8968;
+ values[Ids.ID_LDQUO] = 8220;
+ values[Ids.ID_LE] = 8804;
+ values[Ids.ID_LFLOOR] = 8970;
+ values[Ids.ID_LOWAST] = 8727;
+ values[Ids.ID_LOZ] = 9674;
+ values[Ids.ID_LRM] = 8206;
+ values[Ids.ID_LSAQUO] = 8249;
+ values[Ids.ID_LSQUO] = 8216;
+ values[Ids.ID_LT] = 60;
+ values[Ids.ID_MACR] = 175;
+ values[Ids.ID_MDASH] = 8212;
+ values[Ids.ID_MICRO] = 181;
+ values[Ids.ID_MIDDOT] = 183;
+ values[Ids.ID_MINUS] = 8722;
+ values[Ids.ID_MU_L] = 956;
+ values[Ids.ID_MU_U] = 924;
+ values[Ids.ID_NABLA] = 8711;
+ values[Ids.ID_NBSP] = 160;
+ values[Ids.ID_NDASH] = 8211;
+ values[Ids.ID_NE] = 8800;
+ values[Ids.ID_NI] = 8715;
+ values[Ids.ID_NOT] = 172;
+ values[Ids.ID_NOTIN] = 8713;
+ values[Ids.ID_NSUB] = 8836;
+ values[Ids.ID_NTILDE_L] = 241;
+ values[Ids.ID_NTILDE_U] = 209;
+ values[Ids.ID_NU_L] = 957;
+ values[Ids.ID_NU_U] = 925;
+ values[Ids.ID_OACUTE_L] = 243;
+ values[Ids.ID_OACUTE_U] = 211;
+ values[Ids.ID_OCIRC_L] = 244;
+ values[Ids.ID_OCIRC_U] = 212;
+ values[Ids.ID_OELIG_L] = 339;
+ values[Ids.ID_OELIG_U] = 338;
+ values[Ids.ID_OGRAVE_L] = 242;
+ values[Ids.ID_OGRAVE_U] = 210;
+ values[Ids.ID_OLINE] = 8254;
+ values[Ids.ID_OMEGA_L] = 969;
+ values[Ids.ID_OMEGA_U] = 937;
+ values[Ids.ID_OMICRON_L] = 959;
+ values[Ids.ID_OMICRON_U] = 927;
+ values[Ids.ID_OPLUS] = 8853;
+ values[Ids.ID_OR] = 8744;
+ values[Ids.ID_ORDF] = 170;
+ values[Ids.ID_ORDM] = 186;
+ values[Ids.ID_OSLASH_L] = 248;
+ values[Ids.ID_OSLASH_U] = 216;
+ values[Ids.ID_OTILDE_L] = 245;
+ values[Ids.ID_OTILDE_U] = 213;
+ values[Ids.ID_OTIMES] = 8855;
+ values[Ids.ID_OUML_L] = 246;
+ values[Ids.ID_OUML_U] = 214;
+ values[Ids.ID_PARA] = 182;
+ values[Ids.ID_PART] = 8706;
+ values[Ids.ID_PERMIL] = 8240;
+ values[Ids.ID_PERP] = 8869;
+ values[Ids.ID_PHI_L] = 966;
+ values[Ids.ID_PHI_U] = 934;
+ values[Ids.ID_PIV] = 982;
+ values[Ids.ID_PI_L] = 960;
+ values[Ids.ID_PI_U] = 928;
+ values[Ids.ID_PLUSMN] = 177;
+ values[Ids.ID_POUND] = 163;
+ values[Ids.ID_PRIME_L] = 8242;
+ values[Ids.ID_PRIME_U] = 8243;
+ values[Ids.ID_PROD] = 8719;
+ values[Ids.ID_PROP] = 8733;
+ values[Ids.ID_PSI_L] = 968;
+ values[Ids.ID_PSI_U] = 936;
+ values[Ids.ID_QUOT] = 34;
+ values[Ids.ID_RADIC] = 8730;
+ values[Ids.ID_RANG] = 9002;
+ values[Ids.ID_RAQUO] = 187;
+ values[Ids.ID_RARR_L] = 8594;
+ values[Ids.ID_RARR_U] = 8658;
+ values[Ids.ID_RCEIL] = 8969;
+ values[Ids.ID_RDQUO] = 8221;
+ values[Ids.ID_REAL] = 8476;
+ values[Ids.ID_REG] = 174;
+ values[Ids.ID_RFLOOR] = 8971;
+ values[Ids.ID_RHO_L] = 961;
+ values[Ids.ID_RHO_U] = 929;
+ values[Ids.ID_RLM] = 8207;
+ values[Ids.ID_RSAQUO] = 8250;
+ values[Ids.ID_RSQUO] = 8217;
+ values[Ids.ID_SBQUO] = 8218;
+ values[Ids.ID_SCARON_L] = 353;
+ values[Ids.ID_SCARON_U] = 352;
+ values[Ids.ID_SDOT] = 8901;
+ values[Ids.ID_SECT] = 167;
+ values[Ids.ID_SHY] = 173;
+ values[Ids.ID_SIGMAF] = 962;
+ values[Ids.ID_SIGMA_L] = 963;
+ values[Ids.ID_SIGMA_U] = 931;
+ values[Ids.ID_SIM] = 8764;
+ values[Ids.ID_SPADES] = 9824;
+ values[Ids.ID_SUB] = 8834;
+ values[Ids.ID_SUBE] = 8838;
+ values[Ids.ID_SUM] = 8721;
+ values[Ids.ID_SUP] = 8835;
+ values[Ids.ID_SUP1] = 185;
+ values[Ids.ID_SUP2] = 178;
+ values[Ids.ID_SUP3] = 179;
+ values[Ids.ID_SUPE] = 8839;
+ values[Ids.ID_SZLIG] = 223;
+ values[Ids.ID_TAU_L] = 964;
+ values[Ids.ID_TAU_U] = 932;
+ values[Ids.ID_THERE4] = 8756;
+ values[Ids.ID_THETASYM] = 977;
+ values[Ids.ID_THETA_L] = 952;
+ values[Ids.ID_THETA_U] = 920;
+ values[Ids.ID_THINSP] = 8201;
+ values[Ids.ID_THORN_L] = 254;
+ values[Ids.ID_THORN_U] = 222;
+ values[Ids.ID_TILDE] = 732;
+ values[Ids.ID_TIMES] = 215;
+ values[Ids.ID_TRADE] = 8482;
+ values[Ids.ID_UACUTE_L] = 250;
+ values[Ids.ID_UACUTE_U] = 218;
+ values[Ids.ID_UARR_L] = 8593;
+ values[Ids.ID_UARR_U] = 8657;
+ values[Ids.ID_UCIRC_L] = 251;
+ values[Ids.ID_UCIRC_U] = 219;
+ values[Ids.ID_UGRAVE_L] = 249;
+ values[Ids.ID_UGRAVE_U] = 217;
+ values[Ids.ID_UML] = 168;
+ values[Ids.ID_UPSIH] = 978;
+ values[Ids.ID_UPSILON_L] = 965;
+ values[Ids.ID_UPSILON_U] = 933;
+ values[Ids.ID_UUML_L] = 252;
+ values[Ids.ID_UUML_U] = 220;
+ values[Ids.ID_WEIERP] = 8472;
+ values[Ids.ID_XI_L] = 958;
+ values[Ids.ID_XI_U] = 926;
+ values[Ids.ID_YACUTE_L] = 253;
+ values[Ids.ID_YACUTE_U] = 221;
+ values[Ids.ID_YEN] = 165;
+ values[Ids.ID_YUML_L] = 255;
+ values[Ids.ID_YUML_U] = 376;
+ values[Ids.ID_ZETA_L] = 950;
+ values[Ids.ID_ZETA_U] = 918;
+ values[Ids.ID_ZWJ] = 8205;
+ values[Ids.ID_ZWNJ] = 8204;
+ }
+
+ /**
+ */
+ public EntityCollection() {
+ super(names, STRICT_CASE);
+ }
+
+ /**
+ * Create an entity declaration.
+ * @return org.eclipse.wst.common.contentmodel.CMNode
+ * @param attrName java.lang.String
+ */
+ protected CMNode create(String entityName) {
+ int id = getID(entityName);
+ if (id == ID_UNKNOWN)
+ return null;
+
+ String value = String.valueOf(values[id]);
+ HTMLEntityDeclImpl dec = new HTMLEntityDeclImpl(entityName, value);
+
+ return dec;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLAttrDeclImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLAttrDeclImpl.java
new file mode 100644
index 0000000000..e0fbc52466
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLAttrDeclImpl.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLAttributeDeclaration;
+
+/**
+ * Implementation class of {@link <code>HTMLAttributeDeclaration</code>} interface.<br>
+ */
+class HTMLAttrDeclImpl extends CMNodeImpl implements HTMLAttributeDeclaration {
+
+ private HTMLCMDataTypeImpl type = null;
+ private int usage = 0;
+
+ /**
+ */
+ public HTMLAttrDeclImpl(String attrName, HTMLCMDataTypeImpl valueType, int valueUsage) {
+ super(attrName);
+ this.type = valueType;
+
+ switch (valueUsage) {
+ case OPTIONAL :
+ case REQUIRED :
+ case FIXED :
+ case PROHIBITED :
+ this.usage = valueUsage;
+ break;
+ default :
+ // should warn...
+ this.usage = OPTIONAL; // fall back
+ break;
+ }
+ }
+
+ /**
+ * getAttrName method
+ * @return java.lang.String
+ */
+ public String getAttrName() {
+ return getNodeName();
+ }
+
+ /**
+ * getAttrType method
+ * @return CMDataType
+ */
+ public CMDataType getAttrType() {
+ return type;
+ }
+
+ /**
+ * @deprecated in superclass
+ */
+ public String getDefaultValue() {
+ if (type.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_DEFAULT)
+ return null;
+ return type.getImpliedValue();
+ }
+
+ /**
+ * @deprecated in superclass
+ */
+ public Enumeration getEnumAttr() {
+ Vector v = new Vector(Arrays.asList(type.getEnumeratedValues()));
+ return v.elements();
+ }
+
+ /**
+ * getNodeType method
+ * @return int
+ *
+ * Returns one of :
+ * ELEMENT_DECLARATION, ATTRIBUTE_DECLARATION, GROUP, ENTITY_DECLARATION.
+ */
+ public int getNodeType() {
+ return CMNode.ATTRIBUTE_DECLARATION;
+ }
+
+ /**
+ * @return int
+ */
+ public int getUsage() {
+ return usage;
+ }
+
+ /**
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return true;
+ return super.supports(propertyName);
+ }
+
+ /**
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return new Boolean(true);
+ return super.getProperty(propertyName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMDataTypeImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMDataTypeImpl.java
new file mode 100644
index 0000000000..3757c6eea7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMDataTypeImpl.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDataType;
+
+
+
+/**
+ */
+class HTMLCMDataTypeImpl extends CMNodeImpl implements HTMLCMDataType {
+
+ private int impliedValueKind = IMPLIED_VALUE_NONE;
+ private String impliedValue = null;
+ private final static String[] emptyArray = new String[0];
+ private String[] enumValues = emptyArray;
+ private String instanceValue = null;
+
+ /**
+ * HTMLCMDataTypeImpl constructor comment.
+ * @param nm java.lang.String
+ */
+ public HTMLCMDataTypeImpl(String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * HTMLCMDataTypeImpl constructor comment.
+ * @param nm java.lang.String
+ */
+ public HTMLCMDataTypeImpl(String typeName, String instanceValue) {
+ super(typeName);
+ this.instanceValue = instanceValue;
+ }
+
+ /**
+ * getTypeName method
+ * @return java.lang.String
+ *
+ * This method returns a suitable default value that can be used when an instance of the data type is created.
+ * This returns null of a suitable default is not available.
+ */
+ public String generateInstanceValue() {
+ return instanceValue;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMDataType
+ */
+ public String getDataTypeName() {
+ return getNodeName();
+ }
+
+ /**
+ * getTypeName method
+ * @return java.lang.String[]
+ *
+ */
+ public String[] getEnumeratedValues() {
+ return enumValues;
+ }
+
+ /**
+ * getTypeName method
+ * @return java.lang.String
+ *
+ * Returns the implied value or null if none exists.
+ */
+ public String getImpliedValue() {
+ return impliedValue;
+ }
+
+ /**
+ * getImpliedValueKind method
+ * @return int
+ *
+ * Returns one of :
+ * IMPLIED_VALUE_NONE, IMPLIED_VALUE_FIXED, IMPLIED_VALUE_DEFAULT.
+ */
+ public int getImpliedValueKind() {
+ return impliedValueKind;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMNode
+ */
+ public int getNodeType() {
+ return CMNode.DATA_TYPE;
+ }
+
+ /**
+ */
+ void setEnumValues(String[] values) {
+ enumValues = new String[values.length];
+ for (int i = 0; i < values.length; i++) {
+ enumValues[i] = values[i];
+ }
+ }
+
+ /**
+ * package scope.
+ */
+ void setImpliedValue(int kind, String value) {
+ switch (kind) {
+ case IMPLIED_VALUE_FIXED :
+ case IMPLIED_VALUE_DEFAULT :
+ impliedValueKind = kind;
+ impliedValue = value;
+ break;
+ case IMPLIED_VALUE_NONE :
+ default :
+ impliedValueKind = IMPLIED_VALUE_NONE;
+ impliedValue = null; // maybe a null string?
+ break;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMNode.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMNode.java
new file mode 100644
index 0000000000..26166410de
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLCMNode.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+/**
+ * In HTML Documents, name and value of an attribute/element/entity
+ * should be treated ignoring theirs case. However, in XML documents,
+ * they should be distinguished with sensitiveness of their case.
+ * CMNode is basically designed to represent DTDs or Schemas for XML
+ * documents. So, it doesn't have interfaces to retrieve such information.
+ * However, declarations in the HTML CM should provide such information.
+ * This intermediate interface is intended to provide whether ignore cases
+ * or not.<br>
+ */
+interface HTMLCMNode extends org.eclipse.wst.common.contentmodel.CMNode {
+
+ /**
+ * Returns <code>true</code>, if declaration is for HTML attribute/element/entity.
+ * Otherwise, returns <code>false</code>.
+ * @return boolean
+ */
+ boolean shouldIgnoreCase();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLElemDeclImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLElemDeclImpl.java
new file mode 100644
index 0000000000..c1fac6421f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLElemDeclImpl.java
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLAttributeDeclaration;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+import org.eclipse.wst.html.core.contentmodel.HTMLPropertyDeclaration;
+
+/**
+ * Base class for all Hed???? classes.
+ */
+abstract class HTMLElemDeclImpl extends CMContentImpl implements HTMLElementDeclaration, HTMLPropertyDeclaration {
+
+ // DTD
+ protected CMNamedNodeMapImpl attributes = null;
+ protected String typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_EMPTY;
+ /** Never access this field directly. Instead, use getComplexTypeDefinition method. */
+ private ComplexTypeDefinition typeDefinition = null;
+ protected CMGroupImpl inclusion = null;
+ protected CMGroupImpl exclusion = null;
+ // advanced information
+ protected CMNamedNodeMap prohibitedAncestors = null;
+ protected int correctionType = CORRECT_NONE;
+ protected int formatType = FORMAT_HTML;
+ protected int layoutType = LAYOUT_NONE;
+ protected int omitType = OMIT_NONE;
+ protected boolean keepSpaces = false;
+ protected boolean indentChild = false;
+ protected ElementCollection elementCollection = null;
+ protected AttributeCollection attributeCollection = null;
+ protected final static CMNamedNodeMap EMPTY_MAP = new CMNamedNodeMap() {
+ public int getLength() {
+ return 0;
+ }
+
+ public CMNode getNamedItem(String name) {
+ return null;
+ }
+
+ public CMNode item(int index) {
+ return null;
+ }
+
+ public Iterator iterator() {
+ return new Iterator() {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ };
+ }
+ };
+
+ /**
+ * HTMLElemDeclImpl constructor.
+ * In the HTML DTD, an element declaration has no specification
+ * for its occurrence. Occurrence is specifed in content model, like
+ * <code>(LI)+</code>. To avoid confusion (and complexity),
+ * occurrence of an element declaration is always 1 (it means, min = 1 and
+ * max = 1). Instead, occurrence of CMGroup represents actual occurrence
+ * of the content.
+ * <br>
+ * @param name java.lang.String
+ */
+ public HTMLElemDeclImpl(String elementName, ElementCollection collection) {
+ super(elementName, 1, 1);
+ elementCollection = collection;
+ attributeCollection = collection.getAttributeCollection();
+ }
+
+ /**
+ */
+ protected abstract void createAttributeDeclarations();
+
+ /**
+ *
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ private ComplexTypeDefinition createComplexTypeDefinition() {
+ if (typeDefinitionName.equals(ComplexTypeDefinitionFactory.CTYPE_CDATA) || typeDefinitionName.equals(ComplexTypeDefinitionFactory.CTYPE_EMPTY) || typeDefinitionName.equals(ComplexTypeDefinitionFactory.CTYPE_PCDATA))
+ return null;
+
+ ComplexTypeDefinitionFactory factory = ComplexTypeDefinitionFactory.getInstance();
+ if (factory == null)
+ return null; // fatal error.
+
+ ComplexTypeDefinition def = factory.createTypeDefinition(typeDefinitionName, elementCollection);
+ return def;
+ }
+
+ /**
+ * Get an attribute declaration.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public HTMLAttributeDeclaration getAttributeDeclaration(String attrName) {
+ if (attributes == null) {
+ createAttributeDeclarations();
+ if (attributes == null)
+ return null; // fail to create
+ }
+
+ CMNode cmnode = attributes.getNamedItem(attrName);
+ if (cmnode == null) {
+ return null;
+ }
+ else {
+ return (HTMLAttributeDeclaration) cmnode; // already exists.
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMNamedNodeMap getAttributes() {
+ if (attributes == null)
+ createAttributeDeclarations(); // lazy eval.
+ return attributes;
+ }
+
+ /**
+ * Get an instance of complex type definition.
+ * @return com.ibm.sed.contentmodel.html.ComplexTypeDefinition
+ */
+ private ComplexTypeDefinition getComplexTypeDefinition() {
+ if (typeDefinition == null)
+ typeDefinition = createComplexTypeDefinition();
+ return typeDefinition;
+ }
+
+ /**
+ * Content.<br>
+ * Element declarations which type is EMPTY or CDATA (maybe PCDATA)
+ * <strong>MUST</strong> override this method and always return null.
+ * This default implementation always tries to create a complex type definition
+ * instance and access to it.
+ * <br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMContent getContent() {
+ ComplexTypeDefinition def = getComplexTypeDefinition(); // lazy eval.
+ return (def != null) ? def.getContent() : null;
+ }
+
+ /**
+ * Content type.<br>
+ * Element declarations which type is EMPTY or CDATA (maybe PCDATA)
+ * <strong>MUST</strong> override this method and return an appropriate type.
+ * This default implementation always tries to create a complex type definition
+ * instance and access to it.
+ * <br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public int getContentType() {
+ ComplexTypeDefinition def = getComplexTypeDefinition(); // lazy eval.
+ return (def != null) ? def.getContentType() : CMElementDeclaration.CDATA;
+ }
+
+ /**
+ * @see HTMLElementDeclaration#getCorrectionType
+ */
+ public int getCorrectionType() {
+ return correctionType;
+ }
+
+ /**
+ * HTML element doesn't have any data type. So, this method always
+ * returns <code>null</code>.<br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMDataType getDataType() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public String getElementName() {
+ return getNodeName();
+ }
+
+ /**
+ * Exclusion.
+ * Almost elements don't have a exclusion.
+ * Only classes those have exclusion should override this method.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ return null;
+ }
+
+ /**
+ * Default format type is <code>FORMAT_HTML</code>.<br>
+ */
+ public int getFormatType() {
+ return formatType;
+ }
+
+ /**
+ * Inclusion.
+ * Almost elements don't have a inclusion.
+ * Only classes those have inclusion should override this method.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getInclusion() {
+ return null;
+ }
+
+ /**
+ */
+ public int getLayoutType() {
+ return layoutType;
+ }
+
+ /**
+ * Line break hint is strongly related to layout type.
+ * Indeed, in the C++DOM, it is determined from layout type only.
+ * So, this implementation, as the default implementation for all declarations,
+ * also determines from layout type only.<br>
+ * @return int
+ */
+ public int getLineBreakHint() {
+ switch (getLayoutType()) {
+ case HTMLElementDeclaration.LAYOUT_BLOCK :
+ return HTMLElementDeclaration.BREAK_BEFORE_START_AND_AFTER_END;
+ case HTMLElementDeclaration.LAYOUT_BREAK :
+ return HTMLElementDeclaration.BREAK_AFTER_START;
+ case HTMLElementDeclaration.LAYOUT_HIDDEN :
+ return HTMLElementDeclaration.BREAK_BEFORE_START_AND_AFTER_END;
+ default :
+ return HTMLElementDeclaration.BREAK_NONE;
+ }
+ }
+
+ /**
+ * No HTML element has local elements. So, this method always
+ * returns an empty map.
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public CMNamedNodeMap getLocalElements() {
+ return EMPTY_MAP;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.contentmodel.CMNode
+ */
+ public int getNodeType() {
+ return CMNode.ELEMENT_DECLARATION;
+ }
+
+ /**
+ */
+ public int getOmitType() {
+ return omitType;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ return EMPTY_MAP;
+ }
+
+ /**
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return true;
+ }
+ else if (propertyName.equals(HTMLCMProperties.CONTENT_HINT)) {
+ ComplexTypeDefinition def = getComplexTypeDefinition();
+ return (def != null);
+ }
+ else {
+ PropertyProvider pp = PropertyProviderFactory.getProvider(propertyName);
+ if (pp == null)
+ return false;
+ return pp.supports(this);
+ }
+
+ }
+
+ /**
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return new Boolean(true);
+ }
+ else if (propertyName.equals(HTMLCMProperties.CONTENT_HINT)) {
+ ComplexTypeDefinition def = getComplexTypeDefinition();
+ return (def != null) ? def.getPrimaryCandidate() : null;
+ }
+ else {
+ PropertyProvider pp = PropertyProviderFactory.getProvider(propertyName);
+ if (pp == null)
+ return null;
+ return pp.get(this);
+ }
+ }
+
+ /**
+ * Return element names which terminates this element.<br>
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return null;
+ }
+
+ /**
+ * return true when the element is a JSP element.
+ */
+ public boolean isJSP() {
+ return false;
+ }
+
+ /**
+ * In some elements, such as APPLET, a source generator should indent child
+ * elements that their parents. That is, a source generator should generate
+ * source of APPLET and PARAMS like this:
+ * <PRE>
+ * &lt;APPLET ...&gt;
+ * &lt;PARAM ... &gt;
+ * &lt;PARAM ... &gt;
+ * &lt;/APPLET&gt;
+ * <PRE>
+ * @return boolean
+ */
+ public boolean shouldIndentChildSource() {
+ return indentChild;
+ }
+
+ /**
+ * Most of elements can compact spaces in their child text nodes.
+ * Some special elements should keep them in their source.
+ * @return boolean
+ */
+ public boolean shouldKeepSpaces() {
+ return keepSpaces;
+ }
+
+ /**
+ * @return boolean
+ */
+ public boolean shouldTerminateAt(HTMLElementDeclaration nextElement) {
+ Iterator i = getTerminators();
+ if (i == null)
+ return false;
+ String nextName = nextElement.getElementName();
+ while (i.hasNext()) {
+ if (nextName.equals(i.next()))
+ return true;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLEntityDeclImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLEntityDeclImpl.java
new file mode 100644
index 0000000000..5d91c853d2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HTMLEntityDeclImpl.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLEntityDeclaration;
+
+
+
+/**
+ */
+class HTMLEntityDeclImpl extends CMNodeImpl implements HTMLEntityDeclaration {
+
+ private java.lang.String value = null;
+
+ /**
+ * CMEntityDeclImpl constructor comment.
+ * @param entityName java.lang.String; Entity name.
+ * @param entityValue java.lang.String; Value string.
+ */
+ public HTMLEntityDeclImpl(String entityName, String entityValue) {
+ super(entityName);
+ value = entityValue;
+ }
+
+ /**
+ * getName method
+ * @return java.lang.String
+ */
+ public String getName() {
+ return getNodeName();
+ }
+
+ /**
+ * Get CMNode type.<br>
+ * @return int; Always return ENTITY_DECLARATION.
+ */
+ public int getNodeType() {
+ return CMNode.ENTITY_DECLARATION;
+ }
+
+ /**
+ * getValue method
+ * @return java.lang.String
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return true;
+ return super.supports(propertyName);
+ }
+
+ /**
+ * Entities in HTML documents are always treated with ignoring cases.
+ * Because no special entities are defined in JSP 1.0, this method
+ * can always return <code>true</code>.<br>
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return new Boolean(true);
+ return super.getProperty(propertyName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedA.java
new file mode 100644
index 0000000000..60aa5ba8f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedA.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * A.
+ */
+final class HedA extends HedInlineContainer {
+
+ /**
+ */
+ public HedA(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.A, collection);
+ // CORRECT_EMPTY - GROUP_COMPACT
+ correctionType = CORRECT_EMPTY;
+ }
+
+ /**
+ * %attrs;
+ * (charset %Charset; #IMPLIED)
+ * (type %ContentType; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (href %URI; #IMPLIED)
+ * (hreflang %LanguageCode; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ * (rel %LinkTypes; #IMPLIED)
+ * (rev %LinkTypes; #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (directkey %Character; #IMPLIED)
+ * (shape %Shape; rect)
+ * (coords %Coords; #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_NAME, CHTMLNamespace.ATTR_NAME_HREF,};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Exclusion.
+ * <code>A</code> has the exclusion.
+ * It is <code>A</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ CMNode a = elementCollection.getNamedItem(CHTMLNamespace.ElementName.A);
+ if (a != null)
+ exclusion.appendChild(a);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.A,};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedADDRESS.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedADDRESS.java
new file mode 100644
index 0000000000..3126e0d748
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedADDRESS.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * ADDRESS.
+ */
+final class HedADDRESS extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedADDRESS(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.ADDRESS, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_ADDRESS;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBASE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBASE.java
new file mode 100644
index 0000000000..a8564f192d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBASE.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * BASE.
+ */
+final class HedBASE extends HedEmpty {
+
+ /**
+ */
+ public HedBASE(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.BASE, collection);
+ // LAYOUT_HIDDEN.
+ // Because, BASE is GROUP_HIDDEN in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * BASE.
+ * (href %URI; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_HREF,};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBLOCKQUOTE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBLOCKQUOTE.java
new file mode 100644
index 0000000000..e730d080e5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBLOCKQUOTE.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * BLOCKQUOTE.
+ */
+final class HedBLOCKQUOTE extends HedFlowContainer {
+
+ /**
+ */
+ public HedBLOCKQUOTE(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.BLOCKQUOTE, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * (cite %URI; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBODY.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBODY.java
new file mode 100644
index 0000000000..7b0b2fde86
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBODY.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * BODY.
+ */
+final class HedBODY extends HedFlowContainer {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.HEAD, CHTMLNamespace.ElementName.BODY, CHTMLNamespace.ElementName.HTML};
+
+ /**
+ */
+ public HedBODY(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.BODY, collection);
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_BOTH;
+ }
+
+ /**
+ * %attrs;
+ * %bodycolors;
+ * (onload %Script; #IMPLIED)
+ * (onunload %Script; #IMPLIED)
+ * (background %URI; #IMPLIED)
+ * (marginwidth %Pixels; #IMPLIED) ... D205514
+ * (marginheight %Pixels; #IMPLIED) .. D205514
+ * (topmargin, CDATA, #IMPLIED) ...... D205514
+ * (bottommargin, CDATA, #IMPLIED) ... D205514
+ * (leftmargin, CDATA, #IMPLIED) ..... D205514
+ * (rightmargin, CDATA, #IMPLIED) .... D205514
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %bodycolors;
+ attributeCollection.getBodycolors(attributes);
+
+ }
+
+ /**
+ * BODY has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBR.java
new file mode 100644
index 0000000000..62d1e6400d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedBR.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.html.core.contentmodel.HTMLAttributeDeclaration;
+
+
+
+/**
+ * BR.
+ */
+final class HedBR extends HedEmpty {
+
+ /**
+ */
+ public HedBR(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.BR, collection);
+ // LAYOUT_BREAK.
+ // Because, BR is GROUP_BREAK in the C++DOM/DTDParser.cpp.
+ layoutType = LAYOUT_BREAK;
+ }
+
+ /**
+ * BR.
+ * %coreattrs;
+ * (clear (left | all | right | none) none)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %coreattrs;
+ attributeCollection.getCore(attributes);
+ // clear
+ HTMLAttributeDeclaration attr = attributeCollection.getDeclaration(CHTMLNamespace.ATTR_NAME_CLEAR);
+ if (attr != null)
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_CLEAR, attr);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedCENTER.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedCENTER.java
new file mode 100644
index 0000000000..115f7e22c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedCENTER.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * CENTER.
+ */
+final class HedCENTER extends HedFlowContainer {
+
+ /**
+ */
+ public HedCENTER(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.CENTER, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDD.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDD.java
new file mode 100644
index 0000000000..d27bd32da5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDD.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * DD.
+ */
+final class HedDD extends HedFlowContainer {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.DT, CHTMLNamespace.ElementName.DD};
+
+ /**
+ */
+ public HedDD(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.DD, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ * DD has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDIV.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDIV.java
new file mode 100644
index 0000000000..95b6c64007
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDIV.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * DIV.
+ */
+final class HedDIV extends HedFlowContainer {
+
+ /**
+ */
+ public HedDIV(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.DIV, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * %align;
+ * %reserved;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // %align;
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForParagraph();
+ if (attr != null)
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALIGN, attr);
+ // %reserved; ... empty
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDL.java
new file mode 100644
index 0000000000..9274ddf31f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDL.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * DL.
+ */
+final class HedDL extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedDL(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.DL, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_DEFINITION_LIST;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ indentChild = true;
+ }
+
+ /**
+ * %arrays;
+ * (compact (compact) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDT.java
new file mode 100644
index 0000000000..6dca71ec97
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedDT.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * DT.
+ */
+final class HedDT extends HedInlineContainer {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.DT, CHTMLNamespace.ElementName.DD};
+
+ /**
+ */
+ public HedDT(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.DT, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %attrs;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ }
+
+ /**
+ * DT has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedEmpty.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedEmpty.java
new file mode 100644
index 0000000000..188c107de3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedEmpty.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+
+/**
+ * Base class for EMPTY type element declarations.
+ */
+abstract class HedEmpty extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedEmpty(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_EMPTY;
+ // EMPTY type has no end tag.
+ omitType = OMIT_END_MUST;
+ }
+
+ /**
+ * Content.<br>
+ * EMPTY type always returns <code>null</code>.
+ * <br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getContent() {
+ return null;
+ }
+
+ /**
+ * Content type.<br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public int getContentType() {
+ return CMElementDeclaration.EMPTY;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFORM.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFORM.java
new file mode 100644
index 0000000000..3c05641966
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFORM.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ * FORM.
+ */
+final class HedFORM extends HedFlowContainer {
+
+ /**
+ */
+ public HedFORM(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.FORM, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs;
+ * (action %URI; #REQUIRED)
+ * (method (GET|POST) GET)
+ * (enctype %ContentType; "application/x-www-form-urlencoded")
+ * (accept %ContentTypes; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (onsubmit %Script; #IMPLIED)
+ * (onreset %Script; #IMPLIED)
+ * (target %FrameTarget; #IMPLIED)
+ * (accept-charset %Charsets; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_ACTION, CHTMLNamespace.ATTR_NAME_METHOD, CHTMLNamespace.ATTR_NAME_ENCTYPE, CHTMLNamespace.ATTR_NAME_NAME,};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * Exclusion.
+ * <code>FORM</code> has the exclusion.
+ * It is <code>FORM</code> itself.
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null; // fatal
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ CMNode form = elementCollection.getNamedItem(CHTMLNamespace.ElementName.FORM);
+ if (form != null)
+ exclusion.appendChild(form);
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.FORM, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFlowContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFlowContainer.java
new file mode 100644
index 0000000000..9820507b01
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedFlowContainer.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+/**
+ * Base class for (%flow;)* containers.
+ */
+abstract class HedFlowContainer extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedFlowContainer(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_FLOW_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHEAD.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHEAD.java
new file mode 100644
index 0000000000..f22d4f0f57
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHEAD.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * HTML.
+ */
+final class HedHEAD extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.HEAD, CHTMLNamespace.ElementName.BODY, CHTMLNamespace.ElementName.HTML};
+
+ /**
+ */
+ public HedHEAD(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.HEAD, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_HEAD;
+ layoutType = LAYOUT_HIDDEN;
+ omitType = OMIT_BOTH;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>HEAD</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td>%i18n;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * <tr>
+ * <td>profile</td><td>URI</td><td>#IMPLIED</td><td>N/A</td><td>-</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+ }
+
+ /**
+ * HEAD has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHR.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHR.java
new file mode 100644
index 0000000000..c94fd0d6c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHR.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * HR.
+ */
+final class HedHR extends HedEmpty {
+
+ /**
+ */
+ public HedHR(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.HR, collection);
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * %attrs
+ * (align (left|center|right) #IMPLIED) ... should be defined locally.
+ * (noshade (noshade) #IMPLIED)
+ * (size %Pixels; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (color %Color; #IMPLIED) ... D205514
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (align (left|center|right) #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {CHTMLNamespace.ATTR_VALUE_LEFT, CHTMLNamespace.ATTR_VALUE_CENTER, CHTMLNamespace.ATTR_VALUE_RIGHT};
+ atype.setEnumValues(values);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_ALIGN, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALIGN, attr);
+
+ // the rest.
+ String[] names = {CHTMLNamespace.ATTR_NAME_NOSHADE, CHTMLNamespace.ATTR_NAME_SIZE, CHTMLNamespace.ATTR_NAME_WIDTH,};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHTML.java
new file mode 100644
index 0000000000..c39f6661d6
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHTML.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.eclipse.wst.html.core.contentmodel.HTMLAttributeDeclaration;
+
+
+/**
+ * HTML.
+ */
+final class HedHTML extends HTMLElemDeclImpl {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.HTML};
+
+ /**
+ */
+ public HedHTML(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.HTML, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_HTML;
+ layoutType = LAYOUT_HIDDEN;
+ omitType = OMIT_BOTH;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>HTML</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td><code>%i18n;</code></td><td>-</td><td>-</td><td>-</td>
+ * <td>{@link PDCMDocImpl#getAttrDeclarationsI18n}</td>
+ * </tr>
+ * <tr>
+ * <td>version</td><td>CDATA</td><td>#FIXED</td>
+ * <td>{@link HTML_VERSION_TRANSITIONAL}</td><td>deplecated in HTML4.01</td>
+ * </tr>
+ * </tbody>
+ * </table><br>
+ * @see com.ibm.sed.contentmodel.html.AbstractHTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+ // version
+ HTMLAttributeDeclaration adec = attributeCollection.getDeclaration(CHTMLNamespace.ATTR_NAME_VERSION);
+ if (adec != null)
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_VERSION, adec);
+ }
+
+ /**
+ * HTML has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHeading.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHeading.java
new file mode 100644
index 0000000000..b93ecfa212
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedHeading.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * H[1-6].
+ */
+final class HedHeading extends HedInlineContainer {
+
+ /**
+ */
+ public HedHeading(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>H1</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td>%attrs;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * <tr>
+ * <td>%align;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * <p><b>%align;</b> means <code>align (left|center|right|justify) #IMPLIED</code>.
+ * Unfortunately, this <code>align</code> is different from one in
+ * <code>IMG</code> or <code>TABLE</code>. So, the attribute declaration
+ * of <code>align</code> should be localy created and it shouldn't be registered
+ * in a <code>HCMDocImpl</code> instance.</p>
+ * <p>However, %align is used in sevaral times. I wouldn't write same code
+ * in many times. So, I add a new utility method into <code>CMUtil</code>
+ * to create the attribute declaration.</p>
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // align
+ HTMLAttrDeclImpl attr = AttributeCollection.createAlignForParagraph();
+ if (attr != null)
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALIGN, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedIMG.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedIMG.java
new file mode 100644
index 0000000000..f6ace06817
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedIMG.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * IMG.
+ */
+final class HedIMG extends HedEmpty {
+
+ /**
+ */
+ public HedIMG(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.IMG, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * IMG.
+ * %attrs;
+ * (src %URI; #REQUIRED): should be defined locally.
+ * (alt %Text; #REQUIRED)
+ * (longdesc %URI; #IMPLIED)
+ * (name CDATA #IMPLIED)
+ * (height %Length; #IMPLIED)
+ * (width %Length; #IMPLIED)
+ * (usemap %URI; #IMPLIED)
+ * (ismap (ismap) #IMPLIED)
+ * (align %IAlign; #IMPLIED): should be defined locally.
+ * (border %Pixels; #IMPLIED)
+ * (hspace %Pixels; #IMPLIED)
+ * (vspace %Pixels; #IMPLIED)
+ * (mapfile %URI; #IMPLIED)
+ * @see com.ibm.sed.contentmodel.html.AbstractHTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (src %URI; #REQUIRED): should be defined locally.
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ atype = new HTMLCMDataTypeImpl(CMDataType.URI);
+ attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_SRC, atype, CMAttributeDeclaration.REQUIRED);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_SRC, attr);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_ALT, CHTMLNamespace.ATTR_NAME_NAME, CHTMLNamespace.ATTR_NAME_HEIGHT, CHTMLNamespace.ATTR_NAME_WIDTH, CHTMLNamespace.ATTR_NAME_BORDER, CHTMLNamespace.ATTR_NAME_HSPACE, CHTMLNamespace.ATTR_NAME_VSPACE,};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+
+ // align (local); should be defined locally.
+ attr = AttributeCollection.createAlignForImage();
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALIGN, attr);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.PRE};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedINPUT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedINPUT.java
new file mode 100644
index 0000000000..a4959345ec
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedINPUT.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+
+/**
+ * INPUT.
+ */
+final class HedINPUT extends HedEmpty {
+
+ /**
+ */
+ public HedINPUT(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.INPUT, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ * INPUT.
+ * %attrs;
+ * (type %InputType; TEXT) ... should be defined locally.
+ * (name CDATA #IMPLIED)
+ * (value CDATA #IMPLIED)
+ * (checked (checked) #IMPLIED)
+ * (disabled (disabled) #IMPLIED)
+ * (readonly (readonly) #IMPLIED)
+ * (size CDATA #IMPLIED) ... should be defined locally.
+ * (maxlength NUMBER #IMPLIED)
+ * (src %URI; #IMPLIED)
+ * (alt CDATA #IMPLIED) ... should be defined locally.
+ * (usemap %URI; #IMPLIED)
+ * (ismap (ismap) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ * (onselect %Script; #IMPLIED)
+ * (onchange %Script; #IMPLIED)
+ * (accept %ContentTypes; #IMPLIED)
+ * (align %IAlign; #IMPLIED) ... should be defined locally.
+ * (istyle CDATA #IMPLIED)
+ * <<D215684
+ * (width CDATA; #IMPLIED)
+ * (height CDATA; #IMPLIED)
+ * (border CDATA; #IMPLIED)
+ * D215684
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ HTMLCMDataTypeImpl atype = null;
+ HTMLAttrDeclImpl attr = null;
+ // (type %InputType; TEXT) ... should be defined locally.
+ // NOTE: %InputType is ENUM;
+ // (text | password | checkbox | radio | submit | reset |
+ // file | hidden | image | button)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {CHTMLNamespace.ATTR_VALUE_TEXT, CHTMLNamespace.ATTR_VALUE_PASSWORD, CHTMLNamespace.ATTR_VALUE_CHECKBOX, CHTMLNamespace.ATTR_VALUE_RADIO, CHTMLNamespace.ATTR_VALUE_SUBMIT, CHTMLNamespace.ATTR_VALUE_RESET, CHTMLNamespace.ATTR_VALUE_HIDDEN,};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, CHTMLNamespace.ATTR_VALUE_TEXT);
+ attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_TYPE, attr);
+
+ // (size CDATA #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_SIZE, attr);
+
+ // (alt CDATA #IMPLIED) ... should be defined locally.
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_ALT, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALT, attr);
+
+ // (align %IAlign; #IMPLIED) ... should be defined locally.
+ attr = AttributeCollection.createAlignForImage();
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALIGN, attr);
+
+ // the rest.
+ String[] names = {CHTMLNamespace.ATTR_NAME_NAME, CHTMLNamespace.ATTR_NAME_VALUE, CHTMLNamespace.ATTR_NAME_CHECKED, CHTMLNamespace.ATTR_NAME_SIZE, CHTMLNamespace.ATTR_NAME_MAXLENGTH, CHTMLNamespace.ATTR_NAME_SRC, CHTMLNamespace.ATTR_NAME_ALT, CHTMLNamespace.ATTR_NAME_ALIGN, CHTMLNamespace.ATTR_NAME_ISTYLE,
+ //<<D215684
+ CHTMLNamespace.ATTR_NAME_WIDTH, CHTMLNamespace.ATTR_NAME_HEIGHT, CHTMLNamespace.ATTR_NAME_BORDER
+ //<D215684
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedInlineContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedInlineContainer.java
new file mode 100644
index 0000000000..ba04b6673b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedInlineContainer.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+/**
+ * Base class for (%inline;)* containers.
+ */
+abstract class HedInlineContainer extends HTMLElemDeclImpl {
+
+ /**
+ * HedInlineContainer.
+ * @param elementName java.lang.String
+ * @param collection ElementCollection
+ */
+ public HedInlineContainer(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_INLINE_CONTAINER;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedLI.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedLI.java
new file mode 100644
index 0000000000..bfdb17c610
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedLI.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * LI.
+ */
+final class HedLI extends HedFlowContainer {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.LI};
+
+ /**
+ */
+ public HedLI(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.LI, collection);
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END_DEFAULT;
+ }
+
+ /**
+ * %attrs;
+ * (type %LIStyle; #IMPLIED) ... should be defined locally.
+ * (value NUMBER #IMPLIED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ }
+
+ /**
+ * LI has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedListItemContainer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedListItemContainer.java
new file mode 100644
index 0000000000..96343ea914
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedListItemContainer.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+/**
+ * Base class for list item container declarations.
+ * - OL, UL, MENU, DIR.
+ */
+abstract class HedListItemContainer extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedListItemContainer(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_LI_CONTAINER;
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ indentChild = true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMENU.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMENU.java
new file mode 100644
index 0000000000..ff8cc21618
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMENU.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * MENU/DIR.
+ */
+final class HedMENU extends HedListItemContainer {
+
+ /**
+ */
+ public HedMENU(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ }
+
+ /**
+ * MENU/DIR.
+ * (compact (compact) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ }
+
+ /**
+ * Exclusion.
+ * <code>MENU/DIR</code> has the exclusion.
+ * It is <code>%block;</code>.
+ * %block; is:
+ * P | %heading; | %list; | %preformatted; | DL | DIV | CENTER |
+ * NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR |
+ * TABLE | FIELDSET | ADDRESS.
+ * %heading; is: H1 | H2 | H3 | H4 | H5 | H6.
+ * %list; is : UL | OL | DIR | MENU.
+ * %preformatted; is PRE.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ // %block;
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ String[] names = {CHTMLNamespace.ElementName.P, CHTMLNamespace.ElementName.H1, CHTMLNamespace.ElementName.H2, CHTMLNamespace.ElementName.H3, CHTMLNamespace.ElementName.H4, CHTMLNamespace.ElementName.H5, CHTMLNamespace.ElementName.H6, CHTMLNamespace.ElementName.UL, CHTMLNamespace.ElementName.OL, CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU, CHTMLNamespace.ElementName.PRE, CHTMLNamespace.ElementName.DL, CHTMLNamespace.ElementName.DIV, CHTMLNamespace.ElementName.CENTER, CHTMLNamespace.ElementName.BLOCKQUOTE, CHTMLNamespace.ElementName.FORM, CHTMLNamespace.ElementName.HR, CHTMLNamespace.ElementName.ADDRESS};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMETA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMETA.java
new file mode 100644
index 0000000000..b7eac5d11b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedMETA.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDataType;
+
+/**
+ * META.
+ */
+final class HedMETA extends HedEmpty {
+
+ /**
+ */
+ public HedMETA(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.META, collection);
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * META.
+ * %i18n;
+ * (http-equiv NAME #IMPLIED)
+ * (name NAME #IMPLIED) ... should be defined locally.
+ * (content CDATA #REQUIRED)
+ * (scheme CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+
+ // (name NAME #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(HTMLCMDataType.NAME);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_NAME, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_NAME, attr);
+
+ // 249493
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_CONTENT, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_CONTENT, attr);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_HTTP_EQUIV,
+ // CHTMLNamespace.ATTR_NAME_CONTENT
+ };
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOL.java
new file mode 100644
index 0000000000..9e0fe9a9f9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOL.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * OL.
+ */
+final class HedOL extends HedListItemContainer {
+
+ /**
+ */
+ public HedOL(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.OL, collection);
+ }
+
+ /**
+ * OL.
+ * (type %OLStyle; #IMPLIED) ... should be defined locally.
+ * (compact (compact) #IMPLIED)
+ * (start NUMBER #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOPTION.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOPTION.java
new file mode 100644
index 0000000000..6cb7cfbfe7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedOPTION.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * OPTION.
+ */
+final class HedOPTION extends HedPcdata {
+
+ private static String[] terminators = {CHTMLNamespace.ElementName.OPTION};
+
+ /**
+ */
+ public HedOPTION(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.OPTION, collection);
+ layoutType = LAYOUT_HIDDEN;
+ omitType = OMIT_END;
+ }
+
+ /**
+ * OPTION.
+ * %attrs;
+ * (selected (selected) #IMPLIED)
+ * (disabled (disabled) #IMPLIED)
+ * (label %Text; #IMPLIED)
+ * (value CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_SELECTED, CHTMLNamespace.ATTR_NAME_VALUE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+
+ /**
+ * OPTION has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ return Arrays.asList(terminators).iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedP.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedP.java
new file mode 100644
index 0000000000..d04ffbcc6b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedP.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * P.
+ */
+final class HedP extends HedInlineContainer {
+
+ private static Collection terminators = null;
+
+ /**
+ */
+ public HedP(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.P, collection);
+ correctionType = CORRECT_EMPTY;
+ layoutType = LAYOUT_BLOCK;
+ omitType = OMIT_END;
+ }
+
+ /**
+ * Create all attribute declarations.
+ * This method is called once in the constructor of the super class.
+ * The <code>P</code> element may have the following attributes:
+ * <table>
+ * <tbody>
+ * <tr>
+ * <th>NAME</th><th>TYPE</th><th>USAGE</th><th>DEFAULT (INITIAL) VALUE</th><th>MEMO</th>
+ * </tr>
+ * <tr>
+ * <td>%attrs;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * <tr>
+ * <td>%align;</td><td>-</td><td>-</td><td>-</td><td>-</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * <p><b>%align;</b> means <code>align (left|center|right|justify) #IMPLIED</code>.
+ * Unfortunately, this <code>align</code> is different from one in
+ * <code>IMG</code> or <code>TABLE</code>. So, the attribute declaration
+ * of <code>align</code> should be localy created and it shouldn't be registered
+ * in a <code>HCMDocImpl</code> instance.</p>
+ * <p>However, %align is used in sevaral times. I wouldn't write same code
+ * in many times. So, I add a new utility method into <code>CMUtil</code>
+ * to create the attribute declaration.</p>
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // align
+ HTMLAttrDeclImpl adec = AttributeCollection.createAlignForParagraph();
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_ALIGN, adec);
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+ return prohibitedAncestors;
+ }
+
+ /**
+ * Return names of terminators.
+ * <code>P</code> has terminators.
+ * @return java.util.Iterator
+ */
+ protected Iterator getTerminators() {
+ if (terminators != null)
+ return terminators.iterator();
+ //<<D217982
+ terminators = new Vector();
+ terminators.addAll(elementCollection.getNamesOfBlock());
+ terminators.add(CHTMLNamespace.ElementName.LI);
+ terminators.add(CHTMLNamespace.ElementName.DT);
+ terminators.add(CHTMLNamespace.ElementName.DD);
+ //D217982
+ return terminators.iterator();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPRE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPRE.java
new file mode 100644
index 0000000000..f82d15ec5b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPRE.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * PRE.
+ */
+final class HedPRE extends HedInlineContainer {
+
+ /**
+ * PRE element should keep spaces in its source.
+ */
+ public HedPRE(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.PRE, collection);
+ // CORRECT_EMPTY - GROUP_COMPACT
+ correctionType = CORRECT_EMPTY;
+
+ keepSpaces = true;
+ }
+
+ /**
+ * %attrs;
+ * (width NUMBER #IMPLIED) ... should be defined locally.
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+ // (width NUMBER #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_WIDTH, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_WIDTH, attr);
+ }
+
+ /**
+ * Exclusion.
+ * <code>PRE</code> has the exclusion.
+ * It is <code>%pre.exclusion;</code>.
+ * %pre.exclusion is:
+ * IMG | OBJECT | APPLET | BIG | SMALL | SUB | SUP | FONT | BASEFONT
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+ String[] names = {CHTMLNamespace.ElementName.IMG,};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+
+ return exclusion;
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPcdata.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPcdata.java
new file mode 100644
index 0000000000..07460073d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedPcdata.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+
+/**
+ * Base class for PCDATA type element declarations.<br>
+ */
+abstract class HedPcdata extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedPcdata(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_PCDATA;
+ }
+
+ /**
+ * Content.<br>
+ * PCDATA type always returns <code>null</code>.
+ * <br>
+ * @return org.eclipse.wst.common.contentmodel.CMContent
+ */
+ public CMContent getContent() {
+ return null;
+ }
+
+ /**
+ * Content type.<br>
+ * @see org.eclipse.wst.common.contentmodel.CMElementDeclaration
+ */
+ public int getContentType() {
+ return CMElementDeclaration.PCDATA;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSELECT.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSELECT.java
new file mode 100644
index 0000000000..cc844f8c88
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSELECT.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+
+/**
+ * SELECT.
+ */
+final class HedSELECT extends HTMLElemDeclImpl {
+
+ /**
+ */
+ public HedSELECT(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SELECT, collection);
+ typeDefinitionName = ComplexTypeDefinitionFactory.CTYPE_SELECT;
+ layoutType = LAYOUT_OBJECT;
+ indentChild = true;
+ }
+
+ /**
+ * %attrs;
+ * %reserved;
+ * (name CDATA #IMPLIED)
+ * (size NUMBER #IMPLIED) ... should be defined locally.
+ * (multiple (multiple) #IMPLIED)
+ * (disabled (disabled) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ * (onchange %Script; #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ // (size NUMBER #IMPLIED) ... should be defined locally.
+ HTMLCMDataTypeImpl atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(CHTMLNamespace.ATTR_NAME_SIZE, atype, CMAttributeDeclaration.OPTIONAL);
+ attributes.putNamedItem(CHTMLNamespace.ATTR_NAME_SIZE, attr);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_NAME, CHTMLNamespace.ATTR_NAME_MULTIPLE,};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIBase.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIBase.java
new file mode 100644
index 0000000000..fd64d4a315
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIBase.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+
+
+
+
+/**
+ * Base class for SSI declarations.
+ */
+abstract class HedSSIBase extends HedEmpty {
+
+ /**
+ */
+ public HedSSIBase(String elementName, ElementCollection collection) {
+ super(elementName, collection);
+ layoutType = LAYOUT_OBJECT;
+ }
+
+ /**
+ */
+ public int getFormatType() {
+ return HTMLElementDeclaration.FORMAT_SSI;
+ }
+
+ /**
+ */
+ public boolean supports(String propName) {
+ if (propName.equals(HTMLCMProperties.IS_SSI))
+ return true;
+ return super.supports(propName);
+ }
+
+ /*
+ */
+ public Object getProperty(String propName) {
+ if (propName.equals(HTMLCMProperties.IS_SSI))
+ return new Boolean(true);
+ return super.getProperty(propName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIConfig.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIConfig.java
new file mode 100644
index 0000000000..a98fb71bf6
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIConfig.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:CONFIG.
+ */
+final class HedSSIConfig extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIConfig(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_CONFIG, collection);
+ }
+
+ /**
+ * SSI:CONFIG.
+ * (errmsg CDATA #IMPLIED)
+ * (sizefmt CDATA #IMPLIED)
+ * (timefmt CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_ERRMSG, CHTMLNamespace.ATTR_NAME_SIZEFMT, CHTMLNamespace.ATTR_NAME_TIMEFMT};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIEcho.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIEcho.java
new file mode 100644
index 0000000000..5e58a49256
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIEcho.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:ECHO.
+ */
+final class HedSSIEcho extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIEcho(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_ECHO, collection);
+ }
+
+ /**
+ * SSI:ECHO
+ * (var CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_VAR};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIExec.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIExec.java
new file mode 100644
index 0000000000..7ddc7c6d00
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIExec.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:EXEC.
+ */
+final class HedSSIExec extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIExec(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_EXEC, collection);
+ }
+
+ /**
+ * SSI:EXEC
+ * (cgi %URI; #IMPLIED)
+ * (cmd CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_CGI, CHTMLNamespace.ATTR_NAME_CMD};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFlastmod.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFlastmod.java
new file mode 100644
index 0000000000..1e5eac975a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFlastmod.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:FLASTMOD.
+ */
+final class HedSSIFlastmod extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIFlastmod(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_FLASTMOD, collection);
+ }
+
+ /**
+ * SSI:FLASTMOD
+ * (file %URI; #IMPLIED)
+ * (virtual %URI #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_FILE, CHTMLNamespace.ATTR_NAME_VIRTUAL};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFsize.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFsize.java
new file mode 100644
index 0000000000..b3acb6d5e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIFsize.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:FSIZE.
+ */
+final class HedSSIFsize extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIFsize(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_FSIZE, collection);
+ }
+
+ /**
+ * SSI:FSIZE
+ * (file %URI; #IMPLIED)
+ * (virtual %URI #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_FILE, CHTMLNamespace.ATTR_NAME_VIRTUAL};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIInclude.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIInclude.java
new file mode 100644
index 0000000000..0a06ca7815
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIInclude.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:INCLUDE.
+ */
+final class HedSSIInclude extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIInclude(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_INCLUDE, collection);
+ }
+
+ /**
+ * SSI:INCLUDE
+ * (file %URI; #IMPLIED)
+ * (virtual %URI #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_FILE, CHTMLNamespace.ATTR_NAME_VIRTUAL};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIPrintenv.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIPrintenv.java
new file mode 100644
index 0000000000..ff252708b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSIPrintenv.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * SSI:PRINTENV.
+ */
+final class HedSSIPrintenv extends HedSSIBase {
+
+ /**
+ */
+ public HedSSIPrintenv(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_PRINTENV, collection);
+ }
+
+ /**
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+ }
+
+ /**
+ * SSI:PRINTENV has no attributes. So, this method should
+ * always return <code>null</code>.
+ * Note: Since somebody doesn't expect null is returned, return the empty attribute
+ * like a custom tag which doesn't have attributes
+ */
+ public CMNamedNodeMap getAttributes() {
+ return super.getAttributes();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSISet.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSISet.java
new file mode 100644
index 0000000000..30210913c8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedSSISet.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * SSI:SET.
+ */
+final class HedSSISet extends HedSSIBase {
+
+ /**
+ */
+ public HedSSISet(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.SSI_SET, collection);
+ }
+
+ /**
+ * SSI:SET
+ * (var CDATA #IMPLIED)
+ * (value CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_VAR, CHTMLNamespace.ATTR_NAME_VALUE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTEXTAREA.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTEXTAREA.java
new file mode 100644
index 0000000000..229e52b71a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTEXTAREA.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+/**
+ * TEXTAREA.
+ */
+final class HedTEXTAREA extends HedPcdata {
+
+ /**
+ * TEXTAREA should keep spaces in its source.
+ */
+ public HedTEXTAREA(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.TEXTAREA, collection);
+ layoutType = LAYOUT_OBJECT;
+
+ keepSpaces = true;
+ }
+
+ /**
+ * TEXTAREA.
+ * %attrs;
+ * %reserved; ... empty
+ * (name CDATA #IMPLIED)
+ * (rows NUMBER #REQUIRED)
+ * (cols NUMBER #REQUIRED)
+ * (disabled (disabled) #IMPLIED)
+ * (readonly (readonly) #IMPLIED)
+ * (tabindex NUMBER #IMPLIED)
+ * (accesskey %Character; #IMPLIED)
+ * (onfocus %Script; #IMPLIED)
+ * (onblur %Script; #IMPLIED)
+ * (onselect %Script; #IMPLIED)
+ * (onchange %Script; #IMPLIED)
+ * (istyle CDATA #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ String[] names = {CHTMLNamespace.ATTR_NAME_NAME, CHTMLNamespace.ATTR_NAME_ROWS, CHTMLNamespace.ATTR_NAME_COLS, CHTMLNamespace.ATTR_NAME_ISTYLE};
+ attributeCollection.getDeclarations(attributes, Arrays.asList(names).iterator());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTITLE.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTITLE.java
new file mode 100644
index 0000000000..545848b40d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedTITLE.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import java.util.Arrays;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+
+/**
+ * TITLE.
+ */
+final class HedTITLE extends HedPcdata {
+
+ /**
+ */
+ public HedTITLE(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.TITLE, collection);
+ layoutType = LAYOUT_HIDDEN;
+ }
+
+ /**
+ * TITLE.
+ * %i18n;
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %i18n;
+ attributeCollection.getI18n(attributes);
+ }
+
+ /**
+ * Exclusion.
+ * <code>TITLE</code> has the exclusion.
+ * It is <code>%head.misc;</code>.
+ * %head.misc; is <code>SCRIPT|STYLE|META|LINK|OBJECT</code>.
+ * <br>
+ * @see com.ibm.sed.contentmodel.html.HTMLElementDeclaration
+ */
+ public CMContent getExclusion() {
+ if (exclusion != null)
+ return exclusion; // already created.
+ if (elementCollection == null)
+ return null;
+
+ // (SCRIPT|STYLE|META|LINK|OBJECT)
+ exclusion = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
+
+ String[] names = {CHTMLNamespace.ElementName.META,};
+ elementCollection.getDeclarations(exclusion, Arrays.asList(names).iterator());
+ return exclusion;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedUL.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedUL.java
new file mode 100644
index 0000000000..e7a23c0226
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/HedUL.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+
+/**
+ * UL.
+ */
+final class HedUL extends HedListItemContainer {
+
+ /**
+ */
+ public HedUL(ElementCollection collection) {
+ super(CHTMLNamespace.ElementName.UL, collection);
+ }
+
+ /**
+ * UL.
+ * (type %ULStyle; #IMPLIED) ... should be defined locally.
+ * (compact (compact) #IMPLIED)
+ */
+ protected void createAttributeDeclarations() {
+ if (attributes != null)
+ return; // already created.
+ if (attributeCollection == null)
+ return; // fatal
+
+ attributes = new CMNamedNodeMapImpl();
+
+ // %attrs;
+ attributeCollection.getAttrs(attributes);
+
+ }
+
+ /**
+ */
+ public CMNamedNodeMap getProhibitedAncestors() {
+ if (prohibitedAncestors != null)
+ return prohibitedAncestors;
+
+ String[] names = {CHTMLNamespace.ElementName.DIR, CHTMLNamespace.ElementName.MENU};
+ prohibitedAncestors = elementCollection.getDeclarations(names);
+
+ return prohibitedAncestors;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProvider.java
new file mode 100644
index 0000000000..db31375b90
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProvider.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+
+
+
+/**
+ * PropertyProvider class.
+ * This class is intended to be used in HTMLElementDeclaration instances.
+ */
+interface PropertyProvider {
+
+ boolean supports(HTMLElementDeclaration edecl);
+
+ Object get(HTMLElementDeclaration edecl);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProviderFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProviderFactory.java
new file mode 100644
index 0000000000..5512025995
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/chtml/PropertyProviderFactory.java
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.chtml;
+
+import java.util.Hashtable;
+
+import org.eclipse.wst.common.contentmodel.annotation.AnnotationMap;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+import org.eclipse.wst.html.core.contentmodel.HTMLPropertyDeclaration;
+
+/**
+ * The factory object of PropertyProvider.
+ */
+final class PropertyProviderFactory {
+
+
+ /**
+ * DefaultProvider is intended to be used for unknown properties.
+ * It always returns null value for any properties.
+ */
+ class DefaultProvider implements PropertyProvider {
+ public DefaultProvider() {
+ super();
+ }
+
+ public boolean supports(HTMLElementDeclaration edecl) {
+ return false;
+ }
+
+ public Object get(HTMLElementDeclaration edecl) {
+ return null;
+ }
+ }
+
+ abstract class AbstractElementPropertyProvider implements PropertyProvider {
+ protected AbstractElementPropertyProvider() {
+ super();
+ }
+
+ public boolean supports(HTMLElementDeclaration edecl) {
+ return (edecl != null);
+ }
+
+ public Object get(HTMLElementDeclaration edecl) {
+ if (!(edecl instanceof HTMLPropertyDeclaration))
+ return null;
+ return getElementProperty((HTMLPropertyDeclaration)edecl);
+ }
+
+ abstract protected Object getElementProperty(HTMLPropertyDeclaration decl);
+ }
+
+ /*
+ * "tagInfo"
+ * gets documentation for the element
+ */
+ class PPTagInfo extends AbstractElementPropertyProvider {
+ private final static String htmlAnnotationLoc = "platform:/plugin/org.eclipse.wst.html.core/data/htmref.xml"; //$NON-NLS-1$
+ protected AnnotationMap fAnnotationMap = null;
+
+ public PPTagInfo() {
+ super();
+ }
+
+ /**
+ * Gets the annotationMap.
+ * @return Returns a AnnotationMap
+ */
+ protected AnnotationMap getAnnotationMap() {
+ if (fAnnotationMap == null) {
+ fAnnotationMap = new AnnotationMap();
+ try {
+ fAnnotationMap.load(htmlAnnotationLoc);
+ }
+ catch (Exception e) {
+ // no annotation available
+ }
+ }
+ return fAnnotationMap;
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ if (decl instanceof HTMLElementDeclaration) {
+ return getAnnotationMap().getProperty(((HTMLElementDeclaration)decl).getElementName(), "tagInfo"); //$NON-NLS-1$
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /*
+ * "shouldKeepSpace"
+ */
+ class PPShouldKeepSpace extends AbstractElementPropertyProvider {
+ public PPShouldKeepSpace() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(decl.shouldKeepSpaces());
+ }
+ }
+
+ /*
+ * "shouldIndentChildSource"
+ */
+ class PPShouldIndentChildSource extends AbstractElementPropertyProvider {
+ public PPShouldIndentChildSource() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(decl.shouldIndentChildSource());
+ }
+ }
+
+ /*
+ * "terminators"
+ */
+ class PPTerminators extends AbstractElementPropertyProvider {
+ public PPTerminators() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ if (decl == null)
+ return null;
+ if (! (decl instanceof HTMLElemDeclImpl)) return null;
+ return ((HTMLElemDeclImpl)decl).getTerminators();
+ }
+ }
+
+ /*
+ * "prohibitedAncestors"
+ */
+ class PPProhibitedAncestors extends AbstractElementPropertyProvider {
+ public PPProhibitedAncestors() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return decl.getProhibitedAncestors();
+ }
+ }
+
+ /*
+ * "isJSP"
+ */
+ class PPIsJSP extends AbstractElementPropertyProvider {
+ public PPIsJSP() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(decl.isJSP());
+ }
+ }
+
+ /*
+ * "isXHTML"
+ * HTMLElementDeclaration itself never represent any XHTML element declaration.
+ * So, this property must be always false.
+ */
+ class PPIsXHTML extends AbstractElementPropertyProvider {
+ public PPIsXHTML() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(false);
+ }
+ }
+
+ /*
+ * "isSSI"
+ * Each declaration class for SSI elements must provide this property itself,
+ * and then return true. Other declaration must always return false.
+ */
+ class PPIsSSI extends AbstractElementPropertyProvider {
+ public PPIsSSI() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return new Boolean(false);
+ }
+ }
+
+ /*
+ * "lineBreakHint"
+ */
+ class PPLineBreakHint extends AbstractElementPropertyProvider {
+ public PPLineBreakHint() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ String hint = HTMLCMProperties.Values.BREAK_NONE;
+ switch (decl.getLineBreakHint()) {
+ case HTMLElementDeclaration.BREAK_AFTER_START :
+ hint = HTMLCMProperties.Values.BREAK_AFTER_START;
+ break;
+ case HTMLElementDeclaration.BREAK_BEFORE_START_AND_AFTER_END :
+ hint = HTMLCMProperties.Values.BREAK_BEFORE_START_AND_AFTER_END;
+ break;
+ case HTMLElementDeclaration.BREAK_NONE :
+ // nothing to do
+ default :
+ break;
+ }
+ return hint;
+ }
+ }
+
+ /*
+ * "layoutType"
+ */
+ class PPLayoutType extends AbstractElementPropertyProvider {
+ public PPLayoutType() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ String type = HTMLCMProperties.Values.LAYOUT_NONE;
+ switch (decl.getLayoutType()) {
+ case HTMLElementDeclaration.LAYOUT_BLOCK :
+ type = HTMLCMProperties.Values.LAYOUT_BLOCK;
+ break;
+ case HTMLElementDeclaration.LAYOUT_BREAK :
+ type = HTMLCMProperties.Values.LAYOUT_BREAK;
+ break;
+ case HTMLElementDeclaration.LAYOUT_HIDDEN :
+ type = HTMLCMProperties.Values.LAYOUT_HIDDEN;
+ break;
+ case HTMLElementDeclaration.LAYOUT_OBJECT :
+ type = HTMLCMProperties.Values.LAYOUT_OBJECT;
+ break;
+ case HTMLElementDeclaration.LAYOUT_WRAP :
+ type = HTMLCMProperties.Values.LAYOUT_WRAP;
+ break;
+ case HTMLElementDeclaration.LAYOUT_NONE :
+ // nothing to do.
+ default :
+ break;
+ }
+ return type;
+ }
+ }
+
+ /*
+ * "omitType"
+ */
+ class PPOmitType extends AbstractElementPropertyProvider {
+ public PPOmitType() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ String type = HTMLCMProperties.Values.OMIT_NONE;
+ switch (decl.getOmitType()) {
+ case HTMLElementDeclaration.OMIT_BOTH :
+ type = HTMLCMProperties.Values.OMIT_BOTH;
+ break;
+ case HTMLElementDeclaration.OMIT_END :
+ type = HTMLCMProperties.Values.OMIT_END;
+ break;
+ case HTMLElementDeclaration.OMIT_END_DEFAULT :
+ type = HTMLCMProperties.Values.OMIT_END_DEFAULT;
+ break;
+ case HTMLElementDeclaration.OMIT_END_MUST :
+ type = HTMLCMProperties.Values.OMIT_END_MUST;
+ break;
+ case HTMLElementDeclaration.OMIT_NONE :
+ // nothing to do.
+ default :
+ break;
+ }
+ return type;
+ }
+ }
+
+ /*
+ * "inclusion"
+ */
+ class PPInclusion extends AbstractElementPropertyProvider {
+ public PPInclusion() {
+ super();
+ }
+
+ protected Object getElementProperty(HTMLPropertyDeclaration decl) {
+ return decl.getInclusion();
+ }
+ }
+
+ public static PropertyProvider getProvider(String propName) {
+ PropertyProviderFactory factory = getInstance();
+ PropertyProvider pp = (PropertyProvider) factory.registry.get(propName);
+ if (pp != null)
+ return pp;
+
+ pp = factory.create(propName);
+ if (pp == null)
+ return factory.defaultProvider;
+
+ factory.registry.put(propName, pp);
+ return pp;
+ }
+
+ private static PropertyProviderFactory instance = null;
+
+ private synchronized static PropertyProviderFactory getInstance() {
+ if (instance != null)
+ return instance;
+ instance = new PropertyProviderFactory();
+ return instance;
+ }
+
+ private Hashtable registry = new Hashtable();
+ private PropertyProvider defaultProvider = new DefaultProvider();
+
+ private PropertyProviderFactory() {
+ super();
+ }
+
+ private PropertyProvider create(String propName) {
+ PropertyProvider pp = null;
+ if (propName.equals(HTMLCMProperties.IS_JSP))
+ pp = new PPIsJSP();
+ else if (propName.equals(HTMLCMProperties.IS_XHTML))
+ pp = new PPIsXHTML();
+ else if (propName.equals(HTMLCMProperties.IS_SSI))
+ pp = new PPIsSSI();
+ else if (propName.equals(HTMLCMProperties.LAYOUT_TYPE))
+ pp = new PPLayoutType();
+ else if (propName.equals(HTMLCMProperties.LINE_BREAK_HINT))
+ pp = new PPLineBreakHint();
+ else if (propName.equals(HTMLCMProperties.PROHIBITED_ANCESTORS))
+ pp = new PPProhibitedAncestors();
+ else if (propName.equals(HTMLCMProperties.SHOULD_KEEP_SPACE))
+ pp = new PPShouldKeepSpace();
+ else if (propName.equals(HTMLCMProperties.SHOULD_INDENT_CHILD_SOURCE))
+ pp = new PPShouldIndentChildSource();
+ else if (propName.equals(HTMLCMProperties.TERMINATORS))
+ pp = new PPTerminators();
+ else if (propName.equals(HTMLCMProperties.TAGINFO))
+ pp = new PPTagInfo();
+ else if (propName.equals(HTMLCMProperties.OMIT_TYPE))
+ pp = new PPOmitType();
+ else if (propName.equals(HTMLCMProperties.INCLUSION))
+ pp = new PPInclusion();
+
+ return pp;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ssi/SSICMDocumentFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ssi/SSICMDocumentFactory.java
new file mode 100644
index 0000000000..66fbaf1bb7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/contentmodel/ssi/SSICMDocumentFactory.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.contentmodel.ssi;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNamespace;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocumentFactory;
+import org.eclipse.wst.sse.core.contentmodel.CMDocType;
+
+/**
+ * CMDocument factory for SSI documents.
+ */
+public final class SSICMDocumentFactory {
+
+ private final static String PREFIX = "SSI";//$NON-NLS-1$
+ private final static String DOC_TYPE_NAME = "SSI";//$NON-NLS-1$
+
+ static class CMNamespaceImpl implements CMNamespace {
+ public CMNamespaceImpl() {
+ super();
+ }
+
+ public String getPrefix() {
+ return PREFIX;
+ }
+
+ public String getURI() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public String getNodeName() {
+ return DOC_TYPE_NAME;
+ }
+
+ public int getNodeType() {
+ return CMNode.NAME_SPACE;
+ }
+
+ public boolean supports(String propertyName) {
+ return false;
+ }
+
+ public Object getProperty(String propertyName) {
+ return null;
+ }
+
+ }
+
+ static class CMDocImpl implements CMDocument {
+ private static CMDocument hcm = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);
+
+ static class Elements implements CMNamedNodeMap {
+ private static String[] names = {HTML40Namespace.ElementName.SSI_CONFIG, HTML40Namespace.ElementName.SSI_ECHO, HTML40Namespace.ElementName.SSI_EXEC, HTML40Namespace.ElementName.SSI_FSIZE, HTML40Namespace.ElementName.SSI_FLASTMOD, HTML40Namespace.ElementName.SSI_INCLUDE, HTML40Namespace.ElementName.SSI_PRINTENV, HTML40Namespace.ElementName.SSI_SET};
+ private Hashtable map = new Hashtable();
+
+ public Elements() {
+ CMNamedNodeMap elems = hcm.getElements();
+ for (int i = 0; i < names.length; i++) {
+ String name = names[i];
+ CMElementDeclaration dec = (CMElementDeclaration) elems.getNamedItem(name);
+ if (dec != null)
+ map.put(name, dec);
+ }
+ }
+
+ public int getLength() {
+ return map.size();
+ }
+
+ public CMNode getNamedItem(String name) {
+ String cooked = getCanonicalName(name);
+ if (!map.containsKey(cooked))
+ return null;
+ return (CMNode) map.get(cooked);
+ }
+
+ public CMNode item(int index) {
+ Iterator iter = iterator();
+ while (iter.hasNext()) {
+ Object node = iter.next();
+ if (--index < 0)
+ return (CMNode) node;
+ }
+ return null;
+ }
+
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+
+ private String getCanonicalName(String rawName) {
+ return rawName.toUpperCase();
+ }
+ }
+
+ static private Elements elements = new Elements();
+
+
+ public CMDocImpl() {
+ super();
+ }
+
+ public String getNodeName() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public int getNodeType() {
+ return CMNode.DOCUMENT;
+ }
+
+ public CMNamedNodeMap getElements() {
+ return elements;
+ }
+
+ public CMNamedNodeMap getEntities() {
+ return null;
+ }
+
+ public CMNamespace getNamespace() {
+ return ssins;
+ }
+
+ public Object getProperty(String propertyName) {
+ return null;
+ }
+
+ public boolean supports(String propertyName) {
+ return false;
+ }
+ }
+
+ private static CMNamespace ssins = new CMNamespaceImpl();
+ private static CMDocument mycm = new CMDocImpl();
+
+ private SSICMDocumentFactory() {
+ super();
+ }
+
+ public static CMDocument getCMDocument() {
+ return mycm;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/DocumentStyleImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/DocumentStyleImpl.java
new file mode 100644
index 0000000000..77b9001c58
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/DocumentStyleImpl.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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
+ *******************************************************************************/
+/*
+ * Created on Sep 2, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.wst.html.core.document;
+
+import org.eclipse.wst.css.core.adapters.IStyleSheetListAdapter;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.DocumentCSS;
+import org.w3c.dom.stylesheets.StyleSheetList;
+
+/**
+ * @author davidw
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class DocumentStyleImpl extends DocumentImpl implements XMLDocument, DocumentCSS {
+ public DocumentStyleImpl() {
+ super();
+ }
+
+ public DocumentStyleImpl(DocumentImpl that) {
+ super(that);
+ }
+
+ public CSSStyleDeclaration getOverrideStyle(Element element, String pseudoName) {
+ INodeAdapter adapter = getAdapterFor(IStyleSheetListAdapter.class);
+ if (adapter == null)
+ return null;
+ return ((IStyleSheetListAdapter) adapter).getOverrideStyle(element, pseudoName);
+ }
+
+ public StyleSheetList getStyleSheets() {
+ INodeAdapter adapter = getAdapterFor(IStyleSheetListAdapter.class);
+ if (adapter == null)
+ return null;
+ return ((IStyleSheetListAdapter) adapter).getStyleSheets();
+ }
+
+ protected void releaseStyleSheets() {
+ INodeAdapter adapter = getExistingAdapter(IStyleSheetListAdapter.class);
+ if (adapter == null)
+ return;
+ ((IStyleSheetListAdapter) adapter).releaseStyleSheets();
+ }
+
+ /**
+ * createElement method
+ * @return org.w3c.dom.Element
+ * @param tagName java.lang.String
+ */
+ public Element createElement(String tagName) throws DOMException {
+ checkTagNameValidity(tagName);
+
+ ElementStyleImpl element = new ElementStyleImpl();
+ element.setOwnerDocument(this);
+ element.setTagName(tagName);
+ return element;
+ }
+
+ /**
+ * cloneNode method
+ * @return org.w3c.dom.Node
+ * @param deep boolean
+ */
+ public Node cloneNode(boolean deep) {
+ DocumentStyleImpl cloned = new DocumentStyleImpl(this);
+ if (deep)
+ cloned.importChildNodes(this, true);
+ return cloned;
+ }
+
+ protected void setModel(XMLModel model) {
+ super.setModel(model);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/ElementStyleImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/ElementStyleImpl.java
new file mode 100644
index 0000000000..6d97898507
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/ElementStyleImpl.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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
+ *******************************************************************************/
+/*
+ * Created on Sep 2, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.wst.html.core.document;
+
+import org.eclipse.wst.css.core.adapters.IStyleDeclarationAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.ElementCSSInlineStyle;
+import org.w3c.dom.stylesheets.LinkStyle;
+import org.w3c.dom.stylesheets.StyleSheet;
+
+public class ElementStyleImpl extends ElementImpl implements XMLElement, ElementCSSInlineStyle, LinkStyle {
+ public ElementStyleImpl() {
+ super();
+ }
+
+ public ElementStyleImpl(ElementImpl that) {
+ super(that);
+ }
+
+ public StyleSheet getSheet() {
+ INodeAdapter adapter = getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter == null)
+ return null;
+ if (!(adapter instanceof IStyleSheetAdapter))
+ return null;
+ return ((IStyleSheetAdapter) adapter).getSheet();
+ }
+
+ public CSSStyleDeclaration getStyle() {
+ INodeAdapter adapter = getAdapterFor(IStyleDeclarationAdapter.class);
+ if (adapter == null)
+ return null;
+ if (!(adapter instanceof IStyleDeclarationAdapter))
+ return null;
+ return ((IStyleDeclarationAdapter) adapter).getStyle();
+ }
+
+ protected void setOwnerDocument(Document ownerDocument) {
+ super.setOwnerDocument(ownerDocument);
+ }
+
+ protected void setTagName(String tagName) {
+ super.setTagName(tagName);
+ }
+
+ public Node cloneNode(boolean deep) {
+ ElementImpl cloned = new ElementStyleImpl(this);
+ if (deep)
+ cloneChildNodes(cloned, deep);
+ return cloned;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLConverter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLConverter.java
new file mode 100644
index 0000000000..c2bf955cc4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLConverter.java
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.html.core.cleanup.HTMLCleanupProcessorImpl;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupPreferences;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLDocumentType;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+
+/**
+ */
+public class HTMLConverter {
+
+ /**
+ */
+ public HTMLConverter() {
+ super();
+
+ }
+
+ public void cleanupModel(XMLModel model) {
+ if (model == null)
+ return;
+
+ HTMLCleanupProcessorImpl processor = new HTMLCleanupProcessorImpl();
+ IStructuredCleanupPreferences pref = processor.getCleanupPreferences();
+
+ // backup options
+ boolean compressEmptyElementTags = pref.getCompressEmptyElementTags();
+ boolean insertRequiredAttrs = pref.getInsertRequiredAttrs();
+ boolean insertMissingTags = pref.getInsertMissingTags();
+ boolean quoteAttrValues = pref.getQuoteAttrValues();
+ boolean formatSource = pref.getFormatSource();
+ int tagNameCase = pref.getTagNameCase();
+ int attrNameCase = pref.getAttrNameCase();
+
+ // setup options
+ pref.setCompressEmptyElementTags(true);
+ pref.setInsertRequiredAttrs(true);
+ pref.setInsertMissingTags(true);
+ pref.setQuoteAttrValues(true);
+ pref.setFormatSource(false);
+ if (model.getDocument().isXMLType()) { // XHTML
+ pref.setTagNameCase(CommonModelPreferenceNames.LOWER);
+ pref.setAttrNameCase(CommonModelPreferenceNames.LOWER);
+ }
+ else {
+ pref.setTagNameCase(CommonModelPreferenceNames.ASIS);
+ pref.setAttrNameCase(CommonModelPreferenceNames.ASIS);
+ }
+
+ processor.cleanupModel(model);
+
+ // set back options
+ pref.setCompressEmptyElementTags(compressEmptyElementTags);
+ pref.setInsertRequiredAttrs(insertRequiredAttrs);
+ pref.setInsertMissingTags(insertMissingTags);
+ pref.setQuoteAttrValues(quoteAttrValues);
+ pref.setFormatSource(formatSource);
+ pref.setTagNameCase(tagNameCase);
+ pref.setAttrNameCase(attrNameCase);
+ }
+
+ /**
+ * declaratoin: "data" for XML declaration, such as "version=\"1.0\""
+ * publicId: publicId for DOCTYPE declaration
+ */
+ public void convert(XMLModel model, String declaration, String publicId) {
+ if (model == null)
+ return;
+ setDeclaration(model, declaration, publicId);
+ cleanupModel(model);
+ }
+
+ /**
+ * declaratoin: "data" for XML declaration, such as "version=\"1.0\""
+ * publicId: publicId for DOCTYPE declaration
+ */
+ public void convert(InputStream input, OutputStream output, String declaration, String publicId) throws UnsupportedEncodingException, IOException, CoreException {
+ XMLModel model = readModel(input);
+ if (model == null)
+ return;
+ try {
+ convert(model, declaration, publicId);
+ writeModel(model, output);
+ }
+ finally {
+ if (model != null)
+ model.releaseFromEdit();
+ }
+ }
+
+ /**
+ * declaratoin: "data" for XML declaration, such as "version=\"1.0\""
+ * publicId: publicId for DOCTYPE declaration
+ */
+ public void convert(IFile file, String declaration, String publicId) throws IOException, CoreException {
+ XMLModel model = readModel(file);
+ if (model == null)
+ return;
+ try {
+ convert(model, declaration, publicId);
+ writeModel(model, file);
+ }
+ finally {
+ if (model != null)
+ model.releaseFromEdit();
+ }
+ }
+
+ /**
+ */
+ private static IModelManager getModelManager() {
+ return ((IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID)).getModelManager();
+ }
+
+ /**
+ */
+ private static void insertBreak(XMLModel model, Node node) {
+ if (model == null || node == null)
+ return;
+ if (node.getNodeType() == Node.TEXT_NODE)
+ return;
+
+ // get delimiter string
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ String delim = structuredDocument.getLineDelimiter();
+ if (delim == null || delim.length() == 0)
+ return;
+
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return;
+ Document document = node.getOwnerDocument();
+ if (document == null)
+ return;
+ Text text = document.createTextNode(delim);
+ parent.insertBefore(text, node);
+ }
+
+ /**
+ */
+ private XMLModel readModel(InputStream input) throws IOException, UnsupportedEncodingException {
+ if (input == null)
+ return null;
+ // create temporary model
+ String id = input.toString() + ".html"; //$NON-NLS-1$
+ IModelManager manager = getModelManager();
+ IStructuredModel model = manager.getModelForEdit(id, input, null);
+ if (!(model instanceof XMLModel)) {
+ if (model == null)
+ model.releaseFromEdit();
+ return null;
+ }
+ return (XMLModel) model;
+ }
+
+ /**
+ */
+ private XMLModel readModel(IFile file) throws IOException, CoreException {
+ if (file == null)
+ return null;
+ IModelManager manager = getModelManager();
+ IStructuredModel model = manager.getModelForEdit(file);
+ if (!(model instanceof XMLModel)) {
+ if (model != null)
+ model.releaseFromEdit();
+ return null;
+ }
+ return (XMLModel) model;
+ }
+
+ /**
+ */
+ public void setDeclaration(XMLModel model, String declaration, String publicId) {
+ if (model == null)
+ return;
+ XMLDocument document = model.getDocument();
+ if (document == null)
+ return;
+
+ try {
+ model.aboutToChangeModel();
+
+ ProcessingInstruction pi = null;
+ Node child = document.getFirstChild();
+ if (child != null && child.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
+ String target = child.getNodeName();
+ if (target != null && target.equals("xml")) { //$NON-NLS-1$
+ pi = (ProcessingInstruction) child;
+ child = child.getNextSibling();
+ }
+ }
+ XMLDocumentType docType = (XMLDocumentType) document.getDoctype();
+
+ if (declaration != null) {
+ if (pi != null) {
+ pi.setData(declaration);
+ }
+ else {
+ pi = document.createProcessingInstruction("xml", declaration); //$NON-NLS-1$
+ document.insertBefore(pi, child);
+ insertBreak(model, child);
+ }
+ }
+
+ if (publicId != null) {
+ HTMLDocumentTypeEntry entry = HTMLDocumentTypeRegistry.getInstance().getEntry(publicId);
+ String name = (entry != null ? entry.getName() : null);
+ if (name == null || name.length() == 0)
+ name = "HTML"; // default //$NON-NLS-1$
+ if (docType != null) {
+ if (!name.equals(docType.getName())) { // replace
+ Node parent = docType.getParentNode();
+ child = docType;
+ docType = (XMLDocumentType) document.createDoctype(name);
+ parent.insertBefore(docType, child);
+ parent.removeChild(child);
+ }
+ }
+ else {
+ docType = (XMLDocumentType) document.createDoctype(name);
+ document.insertBefore(docType, child);
+ insertBreak(model, child);
+ }
+ docType.setPublicId(publicId);
+ if (entry != null) {
+ String systemId = entry.getSystemId();
+ if (systemId != null)
+ docType.setSystemId(systemId);
+ String namespaceURI = entry.getNamespaceURI();
+ if (namespaceURI != null) {
+ Element element = document.getDocumentElement();
+ if (element != null) {
+ element.setAttribute("xmlns", namespaceURI); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+ finally {
+ model.changedModel();
+ }
+ }
+
+ /**
+ */
+ private void writeModel(XMLModel model, OutputStream output) throws UnsupportedEncodingException, IOException, CoreException {
+ if (model == null || output == null)
+ return;
+ model.save();
+ }
+
+ /**
+ */
+ private void writeModel(XMLModel model, IFile file) throws IOException, CoreException {
+ if (model == null || file == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ //ByteArrayOutputStream output = null;
+ ByteArrayInputStream input = null;
+ try {
+ //output = new
+ // ByteArrayOutputStream(structuredDocument.getLength());
+ model.save();
+ //input = new ByteArrayInputStream(output.toByteArray());
+ //file.setContents(input, true, true, null);
+ }
+ finally {
+ // if (output != null)
+ // output.close();
+ if (input != null)
+ input.close();
+ }
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java
new file mode 100644
index 0000000000..f51a30a9ed
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapter.java
@@ -0,0 +1,294 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.util.ResourceUtil;
+import org.eclipse.wst.sse.ui.contentproperties.ContentSettings;
+import org.eclipse.wst.sse.ui.contentproperties.ContentSettingsChangeSubject;
+import org.eclipse.wst.sse.ui.contentproperties.IContentSettings;
+import org.eclipse.wst.sse.ui.contentproperties.IContentSettingsListener;
+import org.eclipse.wst.xml.core.document.DocumentTypeAdapter;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLDocumentType;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapterImpl;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Node;
+
+/**
+ */
+public class HTMLDocumentTypeAdapter extends DocumentTypeAdapterImpl implements IContentSettingsListener, HTMLDocumentTypeConstants {
+
+ private HTMLDocumentTypeAdapterFactory factory = null;
+ private HTMLDocumentTypeEntry entry = null;
+ private boolean isXMLType = false;
+ private final static String XML = "xml"; //$NON-NLS-1$
+ private final static String XHTML = "xhtml"; //$NON-NLS-1$
+ private final static String WML = "wml"; //$NON-NLS-1$
+
+
+ /**
+ */
+ protected HTMLDocumentTypeAdapter() {
+ super();
+ }
+
+ /**
+ */
+ protected HTMLDocumentTypeAdapter(XMLDocument document, HTMLDocumentTypeAdapterFactory factory) {
+ super(document);
+
+ this.factory = factory;
+
+ // initialize
+ documentTypeChanged();
+
+ ContentSettingsChangeSubject.getSubject().addListener(this);
+ }
+
+ /**
+ */
+ public void contentSettingsChanged(IResource resource) {
+ if (resource == null)
+ return;
+ XMLDocument document = getDocument();
+ if (document == null)
+ return;
+ XMLModel model = document.getModel();
+ if (model == null)
+ return;
+ IFile file = ResourceUtil.getFileFor(model);
+ if (file == null)
+ return;
+ IProject project = file.getProject();
+ if (project == null)
+ return;
+ if (!project.equals(resource.getProject()))
+ return;
+ documentTypeChanged();
+ }
+
+ /**
+ */
+ private void documentTypeChanged() {
+ XMLDocument document = getDocument();
+ if (document == null)
+ return; // error
+ XMLModel model = document.getModel();
+ if (model == null)
+ return; // error
+ if (model.isReinitializationNeeded()) {
+ // we're may be looping. Even if not,
+ // if we're going to be reinitialized,
+ // no need to worry about document type
+ // this pass.
+ return;
+ }
+ IFile file = ResourceUtil.getFileFor(model);
+
+ // find DOCTYPE delcaration and Public ID
+ String publicId = null;
+ DocumentType newDocumentType = findDocumentType(document);
+ if (newDocumentType != null) {
+ publicId = newDocumentType.getPublicId();
+ } else {
+ // lookup default set by contentsettings
+ publicId = getDefaultPublicId(file);
+ }
+
+ // lookup DOCTYPE registry
+ HTMLDocumentTypeEntry newEntry = null;
+ if (publicId != null) {
+ newEntry = HTMLDocumentTypeRegistry.getInstance().getEntry(publicId);
+ }
+
+ boolean newXMLType = (newEntry != null ? newEntry.isXMLType() : false);
+ boolean newWMLType = (newEntry != null ? newEntry.isWMLType() : false);
+
+ if (!newXMLType) {
+ // find XML declaration
+ if (findXMLNode(document) != null) {
+ newXMLType = true;
+ }
+
+ // check file extension
+ if (file != null) {
+ String ext = file.getFileExtension();
+ if (ext != null && ext.equalsIgnoreCase(XHTML)) {
+ newXMLType = true;
+ }
+
+ if (ext != null && ext.equalsIgnoreCase(WML)) {
+ newXMLType = true;
+ newWMLType = true;
+ }
+ }
+
+ }
+
+ if (newEntry == null) {
+ // lookup system default
+ if (newXMLType && newDocumentType == null) {
+ // use default XHTML, if it's XML and no document type
+ // declared
+ if (newWMLType)
+ newEntry = HTMLDocumentTypeRegistry.getInstance().getDefaultEntry(HTMLDocumentTypeRegistry.DEFAULT_WML);
+ else
+ newEntry = HTMLDocumentTypeRegistry.getInstance().getDefaultEntry(HTMLDocumentTypeRegistry.DEFAULT_XHTML);
+
+ } else {
+ newEntry = HTMLDocumentTypeRegistry.getInstance().getDefaultEntry(HTMLDocumentTypeRegistry.DEFAULT_HTML);
+ }
+ if (newEntry == null)
+ return; // error
+ }
+
+ if (newDocumentType == null) {
+ DocumentType oldDocumentType = getDocumentType();
+ if (oldDocumentType == null || oldDocumentType.getName() != newEntry.getName()) {
+ // create implicit DocumentType
+ DOMImplementation impl = document.getImplementation();
+ if (impl != null) {
+ String name = newEntry.getName();
+ publicId = newEntry.getPublicId();
+ String systemId = newEntry.getSystemId();
+ newDocumentType = impl.createDocumentType(name, publicId, systemId);
+ }
+ }
+ }
+
+ boolean notify = false;
+ if (this.entry != null) { // do not notify on initialization
+ notify = (newEntry != this.entry || newXMLType != this.isXMLType);
+ }
+
+ if (newDocumentType != null)
+ setDocumentType(newDocumentType);
+ this.entry = newEntry;
+ this.isXMLType = newXMLType;
+
+ if (notify)
+ notifyDocumentTypeChanged();
+ }
+
+ /**
+ */
+ private XMLDocumentType findDocumentType(XMLDocument document) {
+ XMLDocumentType documentType = (XMLDocumentType) document.getDoctype();
+ if (documentType != null && documentType.getExistingAdapter(DocumentTypeAdapter.class) == null) {
+ // watch future changes
+ documentType.addAdapter(this);
+ }
+ return documentType;
+ }
+
+ /**
+ */
+ private Node findXMLNode(Document document) {
+ for (Node child = document.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE)
+ continue;
+ String target = child.getNodeName();
+ if (target != null && target.equals(XML)) {
+ return child;
+ }
+ }
+ return null;
+ }
+
+ /**
+ */
+ public int getAttrNameCase() {
+ if (isXMLType())
+ return LOWER_CASE; // XHTML
+ return this.factory.getAttrNameCase();
+ }
+
+ /**
+ */
+ private String getDefaultPublicId(IFile file) {
+ if (file == null)
+ return null;
+ IProject project = file.getProject();
+ if (project == null)
+ return null;
+ IContentSettings settings = ContentSettings.getInstance();
+ if (settings == null)
+ return null;
+ String publicId = settings.getProperty(file, IContentSettings.HTML_DOCUMENT_TYPE);
+ if (publicId == null || publicId.length() == 0) {
+ // look up project default
+ publicId = settings.getProperty(project, IContentSettings.HTML_DOCUMENT_TYPE);
+ }
+ return publicId;
+ }
+
+ /**
+ */
+ public int getTagNameCase() {
+ if (isXMLType())
+ return LOWER_CASE; // XHTML
+ return this.factory.getTagNameCase();
+ }
+
+ /**
+ */
+ public boolean hasFeature(String feature) {
+ if (feature == null)
+ return false;
+ if (feature.equals(HTML))
+ return true;
+ if (feature.equals(SSI))
+ return true;
+ if (feature.equals(FRAMESET)) {
+ if (this.entry == null)
+ return false;
+ return this.entry.hasFrameset();
+ }
+ return false;
+ }
+
+ /**
+ */
+ public boolean isXMLType() {
+ return this.isXMLType;
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (notifier == null)
+ return;
+ if (notifier instanceof XMLDocument) {
+ if (eventType != INodeNotifier.STRUCTURE_CHANGED)
+ return;
+ } else {
+ if (eventType != INodeNotifier.CHANGE)
+ return;
+ }
+ documentTypeChanged();
+ }
+
+ /**
+ */
+ public void release() {
+ ContentSettingsChangeSubject.getSubject().removeListener(this);
+ super.release();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapterFactory.java
new file mode 100644
index 0000000000..a6cd10121e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeAdapterFactory.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.xml.core.document.DocumentTypeAdapter;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+
+/**
+ */
+public class HTMLDocumentTypeAdapterFactory implements AdapterFactory, Preferences.IPropertyChangeListener, CommonModelPreferenceNames {
+
+ private static HTMLDocumentTypeAdapterFactory instance = null;
+ private int tagNameCase = DocumentTypeAdapter.UPPER_CASE;
+ private int attrNameCase = DocumentTypeAdapter.LOWER_CASE;
+ //private IPreferenceStore store = null;
+ private Preferences preferences = null;
+
+ /**
+ */
+ private HTMLDocumentTypeAdapterFactory() {
+ super();
+ this.preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
+ //this.store = CommonPreferencesPlugin.getDefault().getPreferenceStore(ContentTypeRegistry.HTML_ID);
+ if (this.preferences != null) {
+ updateCases(); // initialize
+ this.preferences.addPropertyChangeListener(this);
+ }
+ }
+
+ /**
+ * Method that returns the adapter associated with the given object.
+ * It may be a singleton or not ... depending on the needs of the INodeAdapter ...
+ * but in general it is recommended for an adapter to be stateless,
+ * so the efficiencies of a singleton can be gained.
+ *
+ * The implementation of this method should call addAdapter on the adapted
+ * object with the correct instance of the adapter.
+ */
+ public INodeAdapter adapt(INodeNotifier notifier) {
+ INodeAdapter adapter = notifier.getExistingAdapter(DocumentTypeAdapter.class);
+ if (adapter != null)
+ return adapter;
+ if (!(notifier instanceof XMLDocument))
+ return null;
+ adapter = new HTMLDocumentTypeAdapter((XMLDocument) notifier, this);
+ notifier.addAdapter(adapter);
+ return adapter;
+ }
+
+ /**
+ */
+ public int getAttrNameCase() {
+ return this.attrNameCase;
+ }
+
+ /**
+ * Insert the method's description here.
+ * @return com.ibm.iwt.css.adapters.HTMLStyleSelectorAdapterFactory
+ */
+ public synchronized static HTMLDocumentTypeAdapterFactory getInstance() {
+ if (instance == null)
+ instance = new HTMLDocumentTypeAdapterFactory();
+ return instance;
+ }
+
+ /**
+ */
+ public int getTagNameCase() {
+ return this.tagNameCase;
+ }
+
+ /**
+ */
+ public boolean isFactoryForType(Object type) {
+ return (type == DocumentTypeAdapter.class);
+ }
+
+ /**
+ */
+ public void propertyChange(Preferences.PropertyChangeEvent event) {
+ if (event == null)
+ return;
+ String property = event.getProperty();
+ if (property == null)
+ return;
+
+ if (property.equals(TAG_NAME_CASE) || property.equals(ATTR_NAME_CASE)) {
+ updateCases();
+ }
+ }
+
+ /**
+ */
+ private void updateCases() {
+ this.tagNameCase = DocumentTypeAdapter.UPPER_CASE;
+ this.attrNameCase = DocumentTypeAdapter.LOWER_CASE;
+
+ if (this.preferences == null)
+ return;
+
+ if (this.preferences.getInt(TAG_NAME_CASE) == LOWER) {
+ this.tagNameCase = DocumentTypeAdapter.LOWER_CASE;
+ }
+ if (this.preferences.getInt(ATTR_NAME_CASE) == UPPER) {
+ this.attrNameCase = DocumentTypeAdapter.UPPER_CASE;
+ }
+ }
+
+ /**
+ */
+ public void release() {
+ }
+
+ /**
+ * Overriding copy method
+ */
+ public AdapterFactory copy() {
+ return getInstance();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeConstants.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeConstants.java
new file mode 100644
index 0000000000..e44e5ec2fc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeConstants.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+public interface HTMLDocumentTypeConstants {
+
+ public final static String HTML = "HTML"; //$NON-NLS-1$
+ public final static String FRAMESET = "FRAMESET"; //$NON-NLS-1$
+ public final static String SSI = "SSI"; //$NON-NLS-1$
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeEntry.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeEntry.java
new file mode 100644
index 0000000000..b353c93b78
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeEntry.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+/**
+ */
+public class HTMLDocumentTypeEntry {
+
+ private String name;
+ private String publicId;
+ private String systemId;
+ private String namespaceURI;
+ private boolean isXMLType;
+ private boolean isXHTMLType;
+ private boolean isWMLType;
+ private boolean hasFrameset;
+ private String displayName;
+ private boolean isDefaultXHTML;
+ private boolean isDefaultWML;
+ private static String XHTML_NAME = "html"; //$NON-NLS-1$
+ private static String HTML_NAME = "HTML"; //$NON-NLS-1$
+ private static String WML_NAME = "wml"; //$NON-NLS-1$
+
+ /**
+ */
+ private HTMLDocumentTypeEntry() {
+ super();
+ }
+
+ /**
+ */
+ public HTMLDocumentTypeEntry(String name, String publicId, String systemId, String namespaceURI, boolean isXHTMLType, boolean hasFrameset, String displayName, boolean isDefaultXHTML, boolean isDefaultWML, boolean isWMLType) {
+ super();
+
+ if (name != null && name.length() > 0) {
+ this.name = name;
+ }
+ else {
+ if (isXMLType)
+ this.name = XHTML_NAME;// need code for wml?
+ else
+ this.name = HTML_NAME;
+ }
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.namespaceURI = namespaceURI;
+ this.isXMLType = isXHTMLType | isWMLType;
+ this.hasFrameset = hasFrameset;
+ this.displayName = displayName;
+ this.isDefaultXHTML = isDefaultXHTML;
+ this.isDefaultWML = isDefaultWML;
+ this.isXHTMLType = isXHTMLType;
+ this.isWMLType = isWMLType;
+ }
+
+ /**
+ */
+ public final String getName() {
+ return this.name;
+ }
+
+ /**
+ */
+ public final String getNamespaceURI() {
+ return this.namespaceURI;
+ }
+
+ /**
+ */
+ public final String getPublicId() {
+ return this.publicId;
+ }
+
+ /**
+ */
+ public final String getSystemId() {
+ return this.systemId;
+ }
+
+ /**
+ */
+ public final boolean isXMLType() {
+ return this.isXMLType;
+ }
+
+ /**
+ */
+ public final boolean hasFrameset() {
+ return this.hasFrameset;
+ }
+
+ /**
+ */
+ public final String getDisplayName() {
+ return this.displayName;
+ }
+
+ /**
+ */
+ public final boolean isDefaultXHTML() {
+ return this.isDefaultXHTML;
+ }
+
+ public final boolean isDefaultWML() {
+ return this.isDefaultWML;
+ }
+
+
+ public final boolean isXHTMLType() {
+ return isXHTMLType;
+ }
+
+ public final boolean isWMLType() {
+ return isWMLType;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistry.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistry.java
new file mode 100644
index 0000000000..9b18366831
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistry.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+/**
+ */
+public class HTMLDocumentTypeRegistry {
+
+ private static HTMLDocumentTypeRegistry instance = null;
+ private Hashtable entries = null;
+ private HTMLDocumentTypeEntry defaultEntry = null;
+ private HTMLDocumentTypeEntry defaultXHTMLEntry = null;
+ private HTMLDocumentTypeEntry defaultWMLEntry = null;
+ private HTMLDocumentTypeEntry defaultCHTMLEntry = null;
+
+ final static int DEFAULT_HTML = 0;
+ final static int DEFAULT_XHTML = 1;
+ final static int DEFAULT_WML = 2;
+ final static int DEFAULT_CHTML = 3;
+
+ public static final String CHTML_PUBLIC_ID = "-//W3C//DTD Compact HTML 1.0 Draft//EN";//$NON-NLS-1$
+
+ /**
+ */
+ private HTMLDocumentTypeRegistry() {
+ super();
+
+ this.entries = new Hashtable();
+ // HTML 4.01
+ String name = "HTML";//$NON-NLS-1$
+ String publicId = "-//W3C//DTD HTML 4.01 Transitional//EN";//$NON-NLS-1$
+ String displayName = "HTML 4.01 Transitional"; //$NON-NLS-1$
+ this.defaultEntry = new HTMLDocumentTypeEntry(name, publicId, null, null, false, false, displayName, false, false, false);
+ this.entries.put(publicId, this.defaultEntry);
+ publicId = "-//W3C//DTD HTML 4.01//EN";//$NON-NLS-1$
+ displayName = "HTML 4.01 Strict"; //$NON-NLS-1$
+ this.entries.put(publicId, new HTMLDocumentTypeEntry(name, publicId, null, null, false, false, displayName, false, false, false));
+ publicId = "-//W3C//DTD HTML 4.01 Frameset//EN";//$NON-NLS-1$
+ displayName = "HTML 4.01 Frameset"; //$NON-NLS-1$
+ this.entries.put(publicId, new HTMLDocumentTypeEntry(name, publicId, null, null, false, true, displayName, false, false, false));
+ // CHTML
+ name = "HTML";//$NON-NLS-1$
+ publicId = CHTML_PUBLIC_ID;
+ displayName = "Compact HTML 1.0 Draft"; //$NON-NLS-1$
+ this.defaultCHTMLEntry = new HTMLDocumentTypeEntry(name, publicId, null, null, false, false, displayName, false, false, false);
+ this.entries.put(publicId, this.defaultCHTMLEntry);
+
+ HTMLDocumentTypeRegistryReader reader = new HTMLDocumentTypeRegistryReader();
+ if (reader != null)
+ reader.readRegistry(this);
+ }
+
+ /**
+ */
+ void regist(String pid, HTMLDocumentTypeEntry doctype) {
+ if (pid == null || doctype == null)
+ return;
+ this.entries.put(pid, doctype);
+ if (this.defaultXHTMLEntry == null) {
+ if (doctype.isDefaultXHTML())
+ this.defaultXHTMLEntry = doctype;
+ }
+ if (this.defaultWMLEntry == null) {
+ if (doctype.isDefaultWML())
+ this.defaultWMLEntry = doctype;
+ }
+ }
+
+ /**
+ *
+ */
+ public HTMLDocumentTypeEntry getDefaultEntry(int type) {
+ HTMLDocumentTypeEntry entry = null;
+ switch (type) {
+ case DEFAULT_XHTML :
+ entry = this.defaultXHTMLEntry;
+ break;
+ case DEFAULT_WML :
+ entry = this.defaultWMLEntry;
+ break;
+ case DEFAULT_CHTML :
+ entry = this.defaultCHTMLEntry;
+ break;
+ case DEFAULT_HTML :
+ default :
+ entry = this.defaultEntry;
+ break;
+ }
+ return entry;
+ }
+
+ /**
+ *
+ */
+ public HTMLDocumentTypeEntry getDefaultEntry() {
+ return this.defaultEntry;
+ }
+
+ /**
+ */
+ public HTMLDocumentTypeEntry getXHTMLDefaultEntry() {
+ return this.defaultXHTMLEntry;
+ }
+
+ /**
+ */
+ public Enumeration getEntries() {
+ return this.entries.elements();
+ }
+
+ /**
+ */
+ public HTMLDocumentTypeEntry getEntry(String publicId) {
+ if (publicId == null)
+ return null;
+ return (HTMLDocumentTypeEntry) this.entries.get(publicId);
+ }
+
+ /**
+ */
+ public synchronized static HTMLDocumentTypeRegistry getInstance() {
+ if (instance == null)
+ instance = new HTMLDocumentTypeRegistry();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistryReader.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistryReader.java
new file mode 100644
index 0000000000..297b7a759d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLDocumentTypeRegistryReader.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPluginRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+
+/**
+ */
+class HTMLDocumentTypeRegistryReader {
+
+ //
+ private final static String PLUGIN_ID = IModelManagerPlugin.ID; //$NON-NLS-1$
+ private final static String EXTENSION_POINT_ID = "documentTypes"; //$NON-NLS-1$
+ private final static String TAG_NAME = "documentType"; //$NON-NLS-1$
+ private final static String ATT_PID = "publicID"; //$NON-NLS-1$
+ private final static String ATT_SID = "systemID"; //$NON-NLS-1$
+ private final static String ATT_IS_XHTML = "isXHTML"; //$NON-NLS-1$
+ private final static String ATT_IS_WML = "isWML"; //$NON-NLS-1$
+ private final static String ATT_HAS_FRAMESET = "hasFrameset"; //$NON-NLS-1$
+ private final static String ATT_NSURI = "namespaceURI"; //$NON-NLS-1$
+ private final static String ATT_ENAME = "elementName"; //$NON-NLS-1$
+ private final static String ATT_DNAME = "displayName"; //$NON-NLS-1$
+ private final static String ATT_IS_DEFAULT_XHTML = "defaultXHTML"; //$NON-NLS-1$
+ private final static String ATT_IS_DEFAULT_WML = "defaultWML"; //$NON-NLS-1$
+ private final static String ATV_TRUE = "true"; //$NON-NLS-1$
+ private final static String ATV_NULL_STRING = ""; //$NON-NLS-1$
+
+ /**
+ */
+ HTMLDocumentTypeRegistryReader() {
+ super();
+ }
+
+ /**
+ */
+ void readRegistry(HTMLDocumentTypeRegistry reg) {
+ if (reg == null)
+ return;
+ IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
+ IExtensionPoint point = pluginRegistry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);
+ if (point != null) {
+ IConfigurationElement[] elements = point.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ HTMLDocumentTypeEntry doctype = readElement(elements[i]);
+ // null can be returned if there's an error reading the element
+ if (doctype != null) {
+ reg.regist(doctype.getPublicId(), doctype);
+ }
+ }
+ }
+ }
+
+ /**
+ */
+ private HTMLDocumentTypeEntry readElement(IConfigurationElement element) {
+ HTMLDocumentTypeEntry doctype = null;
+ String pid = null;
+ String sid = null;
+ String nsuri = null;
+ String root = null;
+ boolean xhtml = true;
+ boolean frameset = false;
+ String dname = null;
+ boolean defaultXhtml = false;
+ boolean defaultWML = false;
+ boolean isWML = false;
+
+ if (element.getName().equals(TAG_NAME)) {
+ pid = element.getAttribute(ATT_PID);
+ // publicID attribute is mandatory.
+ if (pid == null || pid.equals(ATV_NULL_STRING))
+ return null;
+
+ sid = element.getAttribute(ATT_SID);
+ nsuri = element.getAttribute(ATT_NSURI);
+ root = element.getAttribute(ATT_ENAME);
+ xhtml = getBoolean(element, ATT_IS_XHTML);
+ frameset = getBoolean(element, ATT_HAS_FRAMESET);
+ dname = element.getAttribute(ATT_DNAME);
+ defaultXhtml = getBoolean(element, ATT_IS_DEFAULT_XHTML);
+ defaultWML = getBoolean(element, ATT_IS_DEFAULT_WML);
+ isWML = getBoolean(element, ATT_IS_WML);
+ doctype = new HTMLDocumentTypeEntry(root, pid, sid, nsuri, xhtml, frameset, dname, defaultXhtml, defaultWML, isWML);
+ }
+ return doctype;
+ }
+
+ /**
+ */
+ private boolean getBoolean(IConfigurationElement element, String att) {
+ String value = element.getAttribute(att);
+ if (value != null && value.equals(ATV_TRUE))
+ return true;
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapter.java
new file mode 100644
index 0000000000..e8b4fb3593
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapter.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.CMNodeList;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.document.TagAdapter;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLText;
+import org.eclipse.wst.xml.core.internal.document.CMNodeUtil;
+import org.eclipse.wst.xml.core.internal.document.ModelParserAdapter;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * HTMLDocumentImpl class
+ */
+public class HTMLModelParserAdapter implements ModelParserAdapter {
+ /**
+ * note: I made public, temparily, so could be used by JSPLoader
+ */
+ protected HTMLModelParserAdapter() {
+ super();
+ }
+
+ private boolean shouldTerminateAt(CMElementDeclaration parent, CMElementDeclaration child) {
+ if (!parent.supports(HTMLCMProperties.TERMINATORS))
+ return false;
+ java.util.Iterator i = (java.util.Iterator) parent.getProperty(HTMLCMProperties.TERMINATORS);
+ if (i == null)
+ return false;
+ String nextName = child.getElementName();
+ while (i.hasNext()) {
+ // NOTE: CMElementDeclaration of child is not always HTMLCMElementDeclaration.
+ // It might be one of based on DTD (for XHTML element). So, comparison must
+ // be performed ignoring case.
+ // -- 3/20/2002
+ String terminator = (String) i.next();
+ if (terminator == null)
+ continue;
+ if (nextName.equalsIgnoreCase(terminator))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ */
+ public boolean canContain(Element element, Node child) {
+ if (element == null || child == null)
+ return false;
+ XMLElement impl = (XMLElement) element;
+
+ if (child.getNodeType() == Node.ELEMENT_NODE) {
+ if (!impl.isGlobalTag())
+ return true; // non HTML tag
+ XMLElement childElement = (XMLElement) child;
+
+ CMElementDeclaration myDec = CMNodeUtil.getElementDeclaration(element);
+ if (myDec == null)
+ return true;
+ //if (!(myDec instanceof HTMLElementDeclaration)) return true;
+ if (myDec.getContentType() == CMElementDeclaration.EMPTY)
+ return false;
+
+ if (!childElement.isGlobalTag())
+ return true; // non HTML tag
+ CMElementDeclaration childDec = CMNodeUtil.getElementDeclaration(childElement);
+ if (childDec == null)
+ return true;
+ //if (!(childDec instanceof HTMLElementDeclaration)) return true;
+
+ if (myDec instanceof HTMLElementDeclaration) {
+ if (((Boolean) ((HTMLElementDeclaration) myDec).getProperty(HTMLCMProperties.IS_JSP)).booleanValue())
+ return true;
+ }
+ if (shouldTerminateAt(myDec, childDec) && !isValidChild(myDec, childDec)) {
+ return false;
+ }
+
+ String tagName = impl.getTagName();
+ if (tagName == null)
+ return true;
+ String childName = childElement.getTagName();
+ if (childName == null)
+ return true;
+ if (!impl.hasStartTag() && !impl.hasEndTag()) {
+ // implicit element
+ if (tagName.equalsIgnoreCase(childElement.getTagName()))
+ return false;
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD)) {
+ if (!childName.equalsIgnoreCase(HTML40Namespace.ElementName.META) && !childName.equalsIgnoreCase(HTML40Namespace.ElementName.TITLE) && !childName.equalsIgnoreCase(HTML40Namespace.ElementName.LINK) && !childName.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE) && !childName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE) && !childName.equalsIgnoreCase(HTML40Namespace.ElementName.ISINDEX)) {
+ return false;
+ }
+ }
+
+ Node parent = element.getParentNode();
+ if (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) {
+ XMLElement parentElement = (XMLElement) parent;
+ if (!parentElement.hasStartTag() && !parentElement.hasEndTag()) {
+ if (!canContain(parentElement, child))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // contexual termination for TABLE content tags
+ boolean isTableContent = false;
+ if (childName.equalsIgnoreCase(HTML40Namespace.ElementName.TBODY) || childName.equalsIgnoreCase(HTML40Namespace.ElementName.THEAD) || childName.equalsIgnoreCase(HTML40Namespace.ElementName.TFOOT)) {
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TABLE))
+ return true;
+ isTableContent = true;
+ }
+ else if (childName.equalsIgnoreCase(HTML40Namespace.ElementName.TR)) {
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TBODY) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.THEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TFOOT) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TABLE))
+ return true;
+ isTableContent = true;
+ }
+ else if (childName.equalsIgnoreCase(HTML40Namespace.ElementName.TD) || childName.equalsIgnoreCase(HTML40Namespace.ElementName.TH)) {
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TR) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TBODY) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.THEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TFOOT) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.TABLE))
+ return true;
+ isTableContent = true;
+ }
+ if (isTableContent) {
+ // TABLE content tags should terminate non TABLE content tags,
+ // if in TABLE
+ for (Node parent = element.getParentNode(); parent != null; parent = parent.getParentNode()) {
+ if (parent.getNodeType() != Node.ELEMENT_NODE)
+ break;
+ XMLElement parentElement = (XMLElement) parent;
+ String parentName = parentElement.getTagName();
+ if (parentName == null)
+ continue;
+ if (parentName.equalsIgnoreCase(HTML40Namespace.ElementName.TABLE))
+ return false;
+ }
+ }
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.EMBED)) {
+ if (!childName.equalsIgnoreCase(HTML40Namespace.ElementName.NOEMBED))
+ return false;
+ }
+ }
+ else if (child.getNodeType() == Node.TEXT_NODE) {
+ String tagName = impl.getTagName();
+ if (tagName != null && tagName.equalsIgnoreCase(HTML40Namespace.ElementName.EMBED)) {
+ XMLText text = (XMLText) child;
+ if (!text.isWhitespace())
+ return false;
+ }
+ }
+ else if (child.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
+ if (impl.isImplicitTag())
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ */
+ public boolean canBeImplicitTag(Element element) {
+ return false;
+ }
+
+ /**
+ */
+ public boolean canBeImplicitTag(Element element, Node child) {
+ return false;
+ }
+
+ /**
+ */
+ public Element createCommentElement(Document document, String data, boolean isJSPTag) {
+ if (document == null || data == null || data.length() == 0)
+ return null;
+
+ return createMetaElement(document, data, isJSPTag);
+ }
+
+ /**
+ * This routine create an implicit Element for given parent and child,
+ * such as HTML, BODY, HEAD, and TBODY for HTML document.
+ */
+ public Element createImplicitElement(Document document, Node parent, Node child) {
+ return null;
+ }
+
+ /**
+ */
+ private Element createMetaElement(Document document, String data, boolean isJSPTag) {
+ if (data == null || data.length() == 0)
+ return null;
+
+ TagScanner scanner = new TagScanner(data, 0, true); // one line
+ String name = scanner.nextName();
+ if (name == null || !name.equalsIgnoreCase(MetaData.METADATA))
+ return null;
+
+ String type = null;
+ boolean isStartSpan = false;
+ boolean isEndSpan = false;
+ name = scanner.nextName();
+ while (name != null) {
+ String value = scanner.nextValue();
+ if (name.equalsIgnoreCase(MetaData.TYPE)) {
+ if (value == null)
+ return null;
+ if (value.equalsIgnoreCase(MetaData.DESIGNER_CONTROL)) {
+ type = MetaData.DESIGNER_CONTROL;
+ }
+ else if (value.equalsIgnoreCase(MetaData.DYNAMIC_DATA)) {
+ type = MetaData.DYNAMIC_DATA;
+ }
+ else if (value.equalsIgnoreCase(MetaData.AUTHOR_TIME_VISUAL)) {
+ type = MetaData.AUTHOR_TIME_VISUAL;
+ }
+ else if (value.equalsIgnoreCase(MetaData.ANNOTATION)) {
+ type = MetaData.ANNOTATION;
+ }
+ else {
+ return null;
+ }
+ }
+ else if (name.equalsIgnoreCase(MetaData.STARTSPAN)) {
+ isStartSpan = true;
+ }
+ else if (name.equalsIgnoreCase(MetaData.ENDSPAN)) {
+ if (!isStartSpan)
+ isEndSpan = true;
+ }
+ name = scanner.nextName();
+ }
+ if (type == null)
+ return null;
+ if (!isStartSpan && !isEndSpan)
+ return null;
+ String metaData = null;
+ int offset = scanner.getNextOffset(); // skip new line
+ if (offset < data.length())
+ metaData = data.substring(offset);
+ if (metaData == null)
+ metaData = new String();
+
+ XMLElement element = (XMLElement) document.createElement(MetaData.PREFIX + type);
+
+ MetaDataAdapter adapter = new MetaDataAdapter(type);
+ if (isStartSpan) {
+ if (metaData != null)
+ adapter.setData(metaData);
+ }
+ else {
+ if (metaData != null)
+ adapter.setEndData(metaData);
+ }
+ element.addAdapter(adapter);
+ adapter.setElement(element);
+ element.setJSPTag(isJSPTag);
+
+ return element;
+ }
+
+ /**
+ */
+ public String getFindRootName(String tagName) {
+ if (tagName == null)
+ return null;
+ // tag matching should not beyond TABLE tag except BODY tag
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BODY))
+ return null;
+ return HTML40Namespace.ElementName.TABLE;
+ }
+
+ /**
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == ModelParserAdapter.class);
+ }
+
+ /**
+ */
+ public boolean isEndTag(XMLElement element) {
+ TagAdapter adapter = (TagAdapter) element.getExistingAdapter(TagAdapter.class);
+ if (adapter != null)
+ return adapter.isEndTag();
+ return element.isEndTag();
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ }
+
+ private static boolean isValidChild(CMElementDeclaration parent, CMElementDeclaration child) {
+ if (parent == null || child == null)
+ return false;
+ CMContent content = parent.getContent();
+ if (content == null)
+ return false;
+ return isChild(content, child);
+ }
+
+ /**
+ */
+ private static boolean isChild(CMContent content, CMElementDeclaration target) {
+ switch (content.getNodeType()) {
+ case CMNode.ELEMENT_DECLARATION :
+ return isSameDeclaration((CMElementDeclaration) content, target);
+ case CMNode.GROUP :
+ CMNodeList children = ((CMGroup) content).getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ CMNode child = children.item(i);
+ switch (child.getNodeType()) {
+ case CMNode.ELEMENT_DECLARATION :
+ if (isSameDeclaration((CMElementDeclaration) child, target))
+ return true;
+ continue; // Go next child.
+ case CMNode.GROUP :
+ if (isChild((CMContent) child, target))
+ return true;
+ continue; // Go next child.
+ default :
+ continue; // Go next child.
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ */
+ private static boolean isSameDeclaration(CMElementDeclaration aDec, CMElementDeclaration otherDec) {
+ return aDec.getElementName() == otherDec.getElementName();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapterFactory.java
new file mode 100644
index 0000000000..07a145fae7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/HTMLModelParserAdapterFactory.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.internal.document.ModelParserAdapter;
+
+/**
+ */
+public class HTMLModelParserAdapterFactory implements AdapterFactory {
+
+ private static HTMLModelParserAdapterFactory instance = null;
+
+ /**
+ */
+ private HTMLModelParserAdapterFactory() {
+ super();
+ }
+
+ /**
+ * Method that returns the adapter associated with the given object.
+ * It may be a singleton or not ... depending on the needs of the INodeAdapter ...
+ * but in general it is recommended for an adapter to be stateless,
+ * so the efficiencies of a singleton can be gained.
+ *
+ * The implementation of this method should call addAdapter on the adapted
+ * object with the correct instance of the adapter.
+ */
+ public INodeAdapter adapt(INodeNotifier notifier) {
+ return new HTMLModelParserAdapter();
+ }
+
+ /**
+ */
+ public synchronized static HTMLModelParserAdapterFactory getInstance() {
+ if (instance == null)
+ instance = new HTMLModelParserAdapterFactory();
+ return instance;
+ }
+
+ /**
+ */
+ public boolean isFactoryForType(Object type) {
+ return (type == ModelParserAdapter.class);
+ }
+
+ /**
+ */
+ public void release() {
+ }
+
+ /**
+ * Overriding copy method
+ */
+ public AdapterFactory copy() {
+ return getInstance();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaData.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaData.java
new file mode 100644
index 0000000000..31e732edcb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaData.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+/**
+ */
+public interface MetaData {
+
+ static final String METADATA = "METADATA";//$NON-NLS-1$
+ static final String TYPE = "type";//$NON-NLS-1$
+ static final String STARTSPAN = "startspan";//$NON-NLS-1$
+ static final String ENDSPAN = "endspan";//$NON-NLS-1$
+ static final String DESIGNER_CONTROL = "DesignerControl";//$NON-NLS-1$
+ static final String DYNAMIC_DATA = "DynamicData";//$NON-NLS-1$
+ static final String AUTHOR_TIME_VISUAL = "AuthorTimeVisual";//$NON-NLS-1$
+ static final String ANNOTATION = "Annotation";//$NON-NLS-1$
+ static final String PREFIX = "METADATA:";//$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaDataAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaDataAdapter.java
new file mode 100644
index 0000000000..a509467ea3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/MetaDataAdapter.java
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.xml.core.document.TagAdapter;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.jsp.model.parser.temp.XMLJSPRegionContexts;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+
+/**
+ */
+public class MetaDataAdapter implements TagAdapter, MetaData {
+
+ private XMLElement element = null;
+ private String type = null;
+ private String data = null;
+ private String endData = null;
+
+ /**
+ */
+ public MetaDataAdapter(String type) {
+ super();
+
+ if (type != null) {
+ if (type.equals(ANNOTATION)) {
+ this.type = ANNOTATION;
+ }
+ else if (type.equals(AUTHOR_TIME_VISUAL)) {
+ this.type = AUTHOR_TIME_VISUAL;
+ }
+ else {
+ this.type = type;
+ }
+ }
+ }
+
+ /**
+ */
+ private String getData(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null)
+ return null;
+ ITextRegionList regions = flatNode.getRegions();
+ if (regions == null)
+ return null;
+
+ String data = null;
+ Iterator e = regions.iterator();
+ while (e.hasNext()) {
+ ITextRegion region = (ITextRegion) e.next();
+ String regionType = region.getType();
+ if (regionType == XMLRegionContext.XML_COMMENT_TEXT || regionType == XMLJSPRegionContexts.JSP_COMMENT_TEXT) {
+ data = flatNode.getText(region);
+ break;
+ }
+ }
+ if (data == null)
+ return null;
+ int length = data.length();
+ int offset = 0;
+ for (; offset < length; offset++) {
+ char c = data.charAt(offset);
+ if (c == '\r' || c == '\n') {
+ offset++;
+ break;
+ }
+ }
+ for (; offset < length; offset++) {
+ char c = data.charAt(offset);
+ if (c != '\r' && c != '\n') {
+ break;
+ }
+ }
+ return data.substring(offset);
+ }
+
+ /**
+ */
+ public String getData() {
+ if (this.element == null)
+ return null;
+ IStructuredDocumentRegion flatNode = this.element.getStartStructuredDocumentRegion();
+ if (flatNode == null)
+ return null;
+ if (this.data != null)
+ return this.data;
+ return getData(flatNode);
+ }
+
+ /**
+ */
+ private String getDelimiter(XMLModel model) {
+ String delim = null;
+ if (model != null) {
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument != null)
+ delim = structuredDocument.getLineDelimiter();
+ }
+ if (delim == null)
+ delim = "\r\n";//$NON-NLS-1$
+ return delim;
+ }
+
+ /**
+ */
+ public String getEndData() {
+ if (this.element == null)
+ return null;
+ IStructuredDocumentRegion flatNode = this.element.getEndStructuredDocumentRegion();
+ if (flatNode == null)
+ return null;
+ if (this.endData != null)
+ return this.endData;
+ return getData(flatNode);
+ }
+
+ /**
+ */
+ public String getEndTag(XMLElement element) {
+ StringBuffer buffer = new StringBuffer();
+ if (element.isJSPTag())
+ buffer.append("<%--");//$NON-NLS-1$
+ else
+ buffer.append("<!--");//$NON-NLS-1$
+ buffer.append(METADATA);
+ buffer.append(' ');
+ buffer.append(TYPE);
+ buffer.append("=\"");//$NON-NLS-1$
+ buffer.append(this.type);
+ buffer.append("\" ");//$NON-NLS-1$
+ buffer.append(MetaData.ENDSPAN);
+ String data = getEndData();
+ if (data != null && data.length() > 0) {
+ String delim = getDelimiter(element.getModel());
+ buffer.append(delim);
+ buffer.append(data);
+ buffer.append(delim);
+ }
+ if (element.isJSPTag())
+ buffer.append("--%>");//$NON-NLS-1$
+ else
+ buffer.append("-->");//$NON-NLS-1$
+
+ return buffer.toString();
+ }
+
+ /**
+ */
+ public String getStartTag(XMLElement element) {
+ StringBuffer buffer = new StringBuffer();
+ if (element.isJSPTag())
+ buffer.append("<%--");//$NON-NLS-1$
+ else
+ buffer.append("<!--");//$NON-NLS-1$
+ buffer.append(METADATA);
+ buffer.append(' ');
+ buffer.append(TYPE);
+ buffer.append("=\"");//$NON-NLS-1$
+ buffer.append(this.type);
+ buffer.append("\" ");//$NON-NLS-1$
+ buffer.append(MetaData.STARTSPAN);
+ String data = getData();
+ if (data != null && data.length() > 0) {
+ String delim = getDelimiter(element.getModel());
+ buffer.append(delim);
+ buffer.append(data);
+ buffer.append(delim);
+ }
+ if (element.isJSPTag())
+ buffer.append("--%>");//$NON-NLS-1$
+ else
+ buffer.append("-->");//$NON-NLS-1$
+
+ return buffer.toString();
+ }
+
+ /**
+ */
+ public String getType() {
+ return this.type;
+ }
+
+ /**
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == TagAdapter.class || type == MetaDataAdapter.class);
+ }
+
+ /**
+ */
+ public boolean isEndTag() {
+ if (this.element == null)
+ return false;
+ if (this.element.hasStartTag())
+ return false;
+ if (this.element.hasEndTag())
+ return true;
+ if (this.data != null)
+ return false;
+ return (this.endData != null);
+ }
+
+ /**
+ */
+ public boolean isRuntimeContainer() {
+ return (this.type == ANNOTATION || this.type == AUTHOR_TIME_VISUAL);
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ }
+
+ /**
+ */
+ public void setData(String data) {
+ this.data = data;
+
+ if (this.element != null)
+ this.element.notifyStartTagChanged();
+ }
+
+ /**
+ */
+ public void setEndData(String data) {
+ this.endData = data;
+
+ if (this.element != null)
+ this.element.notifyEndTagChanged();
+ }
+
+ /**
+ */
+ public void setElement(XMLElement element) {
+ this.element = element;
+
+ if (this.element != null) {
+ this.element.setCommentTag(true);
+ if (this.type != MetaData.ANNOTATION) {
+ this.element.setJSPTag(true);
+ }
+ }
+ }
+
+ /**
+ */
+ public void setRuntimeSource(String source) {
+ if (source == null)
+ return;
+ if (this.element == null)
+ return;
+ if (isRuntimeContainer())
+ return;
+
+ XMLModel model = this.element.getModel();
+ if (model == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ int offset = this.element.getStartEndOffset();
+ int end = this.element.getEndStartOffset();
+ int length = end - offset;
+ structuredDocument.replaceText(model, offset, length, source);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/TagScanner.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/TagScanner.java
new file mode 100644
index 0000000000..b099e55f3a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/TagScanner.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+/**
+ */
+class TagScanner {
+
+ private String tag = null;
+ private int offset = 0;
+ private int length = 0;
+ private boolean oneLine = false;
+
+ /**
+ */
+ TagScanner(String tag, int offset) {
+ super();
+
+ this.tag = tag;
+ this.offset = offset;
+ if (tag != null)
+ this.length = tag.length();
+ }
+
+ /**
+ */
+ TagScanner(String tag, int offset, boolean oneLine) {
+ this(tag, offset);
+
+ this.oneLine = oneLine;
+ }
+
+ /**
+ */
+ int getNextOffset() {
+ for (; this.offset < this.length; this.offset++) {
+ char c = this.tag.charAt(this.offset);
+ if (!isEnd(c))
+ break;
+ }
+ return this.offset;
+ }
+
+ /**
+ */
+ int getOffset() {
+ return this.offset;
+ }
+
+ /**
+ */
+ private final boolean isEnd(char c) {
+ return (this.oneLine && (c == '\r' || c == '\n'));
+ }
+
+ /**
+ */
+ private static boolean isEqual(char c) {
+ return (c == '=');
+ }
+
+ /**
+ */
+ private static boolean isQuote(char c) {
+ return (c == '"' || c == '\'');
+ }
+
+ /**
+ */
+ private static boolean isSpace(char c) {
+ return Character.isWhitespace(c);
+ }
+
+ /**
+ */
+ private char nextChar() {
+ for (; this.offset < this.length; this.offset++) {
+ char c = this.tag.charAt(this.offset);
+ if (isEnd(c))
+ break;
+ if (!isSpace(c))
+ return c;
+ }
+ return 0;
+ }
+
+ /**
+ */
+ String nextName() {
+ if (this.tag == null)
+ return null;
+ if (this.offset >= this.length)
+ return null;
+
+ if (nextChar() == 0)
+ return null;
+
+ int nameOffset = this.offset;
+ for (; this.offset < this.length; this.offset++) {
+ char c = this.tag.charAt(this.offset);
+ if (isEnd(c) || isSpace(c))
+ break;
+ if (isEqual(c) && this.offset > nameOffset)
+ break;
+ }
+ if (this.offset == nameOffset)
+ return null;
+
+ return this.tag.substring(nameOffset, this.offset);
+ }
+
+ /**
+ */
+ String nextValue() {
+ if (this.tag == null)
+ return null;
+ if (this.offset >= this.length)
+ return null;
+
+ char seperator = nextChar();
+ if (!isEqual(seperator))
+ return null;
+ this.offset++; // skip '='
+ char quote = nextChar();
+ if (quote == 0)
+ return null;
+ if (isQuote(quote))
+ this.offset++;
+ else
+ quote = 0;
+
+ int valueOffset = this.offset;
+ for (; this.offset < this.length; this.offset++) {
+ char c = this.tag.charAt(this.offset);
+ if (isEnd(c)) {
+ quote = 0;
+ break;
+ }
+ if (quote == 0) {
+ if (isSpace(c))
+ break;
+ }
+ else {
+ if (c == quote)
+ break;
+ }
+ }
+ int valueEnd = this.offset;
+ if (quote != 0 && this.offset < this.length)
+ this.offset++;
+ if (valueEnd == valueOffset)
+ return null;
+
+ return this.tag.substring(valueOffset, valueEnd);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/UnknownTagAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/UnknownTagAdapter.java
new file mode 100644
index 0000000000..d320ac9305
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/UnknownTagAdapter.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.document;
+
+
+
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.document.TagAdapter;
+import org.eclipse.wst.xml.core.document.XMLElement;
+
+/**
+ */
+public class UnknownTagAdapter implements TagAdapter {
+
+ private String startTag = null;
+ private String endTag = null;
+
+ /**
+ */
+ public UnknownTagAdapter() {
+ super();
+ }
+
+ /**
+ */
+ public String getEndTag(XMLElement element) {
+ String tag = null;
+ if (this.endTag != null) {
+ tag = this.endTag;
+ this.endTag = null;
+ }
+ return tag;
+ }
+
+ /**
+ */
+ public String getStartTag(XMLElement element) {
+ String tag = null;
+ if (this.startTag != null) {
+ tag = this.startTag;
+ this.startTag = null;
+ }
+ return tag;
+ }
+
+ /**
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == TagAdapter.class);
+ }
+
+ /**
+ */
+ public boolean isEndTag() {
+ return false;
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ }
+
+ /**
+ */
+ public void setEndTag(String endTag) {
+ this.endTag = endTag;
+ }
+
+ /**
+ */
+ public void setStartTag(String startTag) {
+ this.startTag = startTag;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/XMLStyleModelImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/XMLStyleModelImpl.java
new file mode 100644
index 0000000000..62ea67e7ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/document/XMLStyleModelImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Sep 2, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.wst.html.core.document;
+
+import org.eclipse.wst.xml.core.internal.document.XMLModelImpl;
+import org.w3c.dom.Document;
+
+/**
+ * @author davidw
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class XMLStyleModelImpl extends XMLModelImpl {
+ public XMLStyleModelImpl() {
+ // remember, the document is created in super constructor,
+ // via internalCreateDocument
+ super();
+ }
+
+ public void releaseFromEdit() {
+ releaseStyleSheets();
+ super.releaseFromEdit();
+ }
+
+ /**
+ */
+ public void releaseFromRead() {
+ releaseStyleSheets();
+ super.releaseFromRead();
+ }
+
+ private void releaseStyleSheets() {
+ if (!isShared()) {
+ Document doc = getDocument();
+ if (doc instanceof DocumentStyleImpl) {
+ ((DocumentStyleImpl) doc).releaseStyleSheets();
+ }
+ }
+ }
+
+ /**
+ * createDocument method
+ * @return org.w3c.dom.Document
+ */
+ protected Document internalCreateDocument() {
+ DocumentStyleImpl document = new DocumentStyleImpl();
+ document.setModel(this);
+ return document;
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java
new file mode 100644
index 0000000000..01f8808e0d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.encoding;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.html.core.internal.contenttype.HTMLResourceEncodingDetector;
+import org.eclipse.wst.sse.core.document.DocumentReader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+
+/**
+ * This class parses beginning portion of HTML file to get the encoding value
+ * in a META tag. Example:
+ * <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ *
+ * Note: even though, technically, a META tag must come in a <HEAD>tag, we
+ * don't check for that, under the assumption that whatever, or whereever, the
+ * the first <META>tag is, it is the one intended to be used by the user, and
+ * they may just be trying to repair the error. The HTML validator will tell
+ * them if its in the wrong location.
+ *
+ */
+public class HTMLDocumentCharsetDetector extends HTMLResourceEncodingDetector implements IDocumentCharsetDetector {
+
+
+ public HTMLDocumentCharsetDetector() {
+ super();
+ }
+
+ public void set(IDocument document) {
+ set(new DocumentReader(document, 0));
+
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentLoader.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentLoader.java
new file mode 100644
index 0000000000..57f112e458
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentLoader.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.wst.common.encoding.ContentTypeEncodingPreferences;
+import org.eclipse.wst.common.encoding.EncodingGuesser;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeAdapterFactory;
+import org.eclipse.wst.html.core.document.HTMLModelParserAdapterFactory;
+import org.eclipse.wst.html.core.htmlcss.HTMLStyleSelectorAdapterFactory;
+import org.eclipse.wst.html.core.htmlcss.StyleAdapterFactory;
+import org.eclipse.wst.html.core.internal.text.rules.StructuredTextPartitionerForHTML;
+import org.eclipse.wst.html.core.modelquery.ModelQueryAdapterFactoryForHTML;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.PropagatingAdapter;
+import org.eclipse.wst.sse.core.document.AbstractDocumentLoader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.document.IEncodedDocument;
+import org.eclipse.wst.sse.core.document.StructuredDocumentFactory;
+import org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument;
+import org.eclipse.wst.sse.core.parser.BlockMarker;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.internal.parser.XMLSourceParser;
+import org.eclipse.wst.xml.core.internal.parser.XMLStructuredDocumentReParser;
+import org.eclipse.wst.xml.core.internal.propagate.PropagatingAdapterFactoryImpl;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+
+public class HTMLDocumentLoader extends AbstractDocumentLoader {
+
+ public HTMLDocumentLoader() {
+ super();
+ }
+
+ /**
+ * Convenience method to add tag names using BlockMarker object
+ */
+ protected void addHTMLishTag(XMLSourceParser parser, String tagname) {
+ //DMW: Nitin, perhaps we should provide some convenience methods
+ // in the parser itself? e.g. addCaseInsensitiveBlockedTag(tagname)
+ BlockMarker bm = new BlockMarker(tagname, null, XMLRegionContext.BLOCK_TEXT, false);
+ parser.addBlockMarker(bm);
+ }
+
+ /**
+ * Default encoding. For HTML, there is no spec.
+ */
+ protected String getSpecDefaultEncoding() {
+ return null;
+ }
+
+ /**
+ * @return java.lang.String
+ * @param string
+ * byte[]
+ * @param length
+ * int
+ *
+ * Do automatic encoding detection by guess
+ */
+ protected String getEncodingNameByGuess(byte[] string, int length) {
+ final String ianaEnc = EncodingGuesser.guessEncoding(string, length);
+ return ianaEnc;
+ }
+
+ /*
+ * @see AbstractLoader#createNewStructuredDocument()
+ */
+ protected IEncodedDocument newEncodedDocument() {
+ IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser());
+ ((BasicStructuredDocument) structuredDocument).setReParser(new XMLStructuredDocumentReParser());
+
+ return structuredDocument;
+ }
+
+ /*
+ * @see ModelLoader#getParser()
+ */
+ public RegionParser getParser() {
+ XMLSourceParser parser = new XMLSourceParser();
+ // for the "static HTML" case, we need to initialize
+ // Blocktags here.
+ addHTMLishTag(parser, "script"); //$NON-NLS-1$
+ addHTMLishTag(parser, "style"); //$NON-NLS-1$
+ return parser;
+ }
+
+ /**
+ * This method must return those factories which must be attached to the
+ * structuredModel before content is applied.
+ */
+ public List getAdapterFactories() {
+ List result = new ArrayList();
+ AdapterFactory factory = null;
+ factory = StyleAdapterFactory.getInstance();
+ result.add(factory);
+ factory = HTMLStyleSelectorAdapterFactory.getInstance();
+ result.add(factory);
+ factory = HTMLDocumentTypeAdapterFactory.getInstance();
+ result.add(factory);
+ factory = HTMLModelParserAdapterFactory.getInstance();
+ result.add(factory);
+ //
+ factory = new ModelQueryAdapterFactoryForHTML();
+ result.add(factory);
+
+ factory = new PropagatingAdapterFactoryImpl();
+ result.add(factory);
+
+
+ return result;
+ }
+
+ protected String getPreferredNewLineDelimiter() {
+ return ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(IContentTypeIdentifier.ContentTypeID_HTML);
+ }
+
+ public IDocumentCharsetDetector getDocumentEncodingDetector() {
+ if (fDocumentEncodingDetector == null) {
+ fDocumentEncodingDetector = new HTMLDocumentCharsetDetector();
+ }
+ return fDocumentEncodingDetector;
+ }
+
+ protected void preLoadAdapt(IStructuredModel structuredModel) {
+ // * TODO - how to best handle model requirements
+ // * if/when document already loaded?
+ // DMW: just added this preload on 8/16/2002
+ // I noticed the ProagatingAdapterFactory was being added,
+ // that that the ProagatingAdapterAdapter was not being
+ // preload adapted -- I'm assuing it ALWAYS has to be.
+ XMLModel domModel = (XMLModel) structuredModel;
+ // if there is a model in the adapter, this will adapt it to
+ // first node. After that the PropagatingAdater spreads over the
+ // children being
+ // created. Each time that happends, a side effect is to
+ // also "spread" sprecific registered adapters,
+ // they two can propigate is needed.
+ ((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
+ }
+
+ public IDocumentPartitioner getDefaultDocumentPartitioner() {
+ return new StructuredTextPartitionerForHTML();
+ }
+
+ public IDocumentLoader newInstance() {
+ return new HTMLDocumentLoader();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLModelLoader.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLModelLoader.java
new file mode 100644
index 0000000000..8f2cc454df
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLModelLoader.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeAdapterFactory;
+import org.eclipse.wst.html.core.document.HTMLModelParserAdapterFactory;
+import org.eclipse.wst.html.core.document.XMLStyleModelImpl;
+import org.eclipse.wst.html.core.htmlcss.HTMLStyleSelectorAdapterFactory;
+import org.eclipse.wst.html.core.htmlcss.StyleAdapterFactory;
+import org.eclipse.wst.html.core.modelquery.ModelQueryAdapterFactoryForHTML;
+import org.eclipse.wst.sse.core.AbstractModelLoader;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.ModelLoader;
+import org.eclipse.wst.sse.core.PropagatingAdapter;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.parser.BlockMarker;
+import org.eclipse.wst.sse.core.util.Debug;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.internal.DebugAdapterFactory;
+import org.eclipse.wst.xml.core.internal.parser.XMLSourceParser;
+import org.eclipse.wst.xml.core.internal.propagate.PropagatingAdapterFactoryImpl;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+
+public class HTMLModelLoader extends AbstractModelLoader {
+
+
+ public HTMLModelLoader() {
+ super();
+ }
+
+ /**
+ * Convenience method to add tag names using BlockMarker object
+ */
+ protected void addHTMLishTag(XMLSourceParser parser, String tagname) {
+ //DMW: Nitin, perhaps we should provide some convenience methods
+ // in the parser itself? e.g. addCaseInsensitiveBlockedTag(tagname)
+ BlockMarker bm = new BlockMarker(tagname, null, XMLRegionContext.BLOCK_TEXT, false);
+ parser.addBlockMarker(bm);
+ }
+
+ public IStructuredModel newModel() {
+ XMLStyleModelImpl model = new XMLStyleModelImpl();
+ return model;
+ }
+
+ /**
+ * This method must return those factories which must be attached to the
+ * structuredModel before content is applied.
+ */
+ public List getAdapterFactories() {
+ List result = new ArrayList();
+ AdapterFactory factory = null;
+ factory = StyleAdapterFactory.getInstance();
+ result.add(factory);
+ factory = HTMLStyleSelectorAdapterFactory.getInstance();
+ result.add(factory);
+ factory = HTMLDocumentTypeAdapterFactory.getInstance();
+ result.add(factory);
+ factory = HTMLModelParserAdapterFactory.getInstance();
+ result.add(factory);
+ //
+ factory = new ModelQueryAdapterFactoryForHTML();
+ result.add(factory);
+
+ factory = new PropagatingAdapterFactoryImpl();
+ result.add(factory);
+
+
+ return result;
+ }
+
+ protected void preLoadAdapt(IStructuredModel structuredModel) {
+ super.preLoadAdapt(structuredModel);
+ // DMW: just added this preload on 8/16/2002
+ // I noticed the ProagatingAdapterFactory was being added,
+ // that that the ProagatingAdapterAdapter was not being
+ // preload adapted -- I'm assuing it ALWAYS has to be.
+ XMLModel domModel = (XMLModel) structuredModel;
+ // if there is a model in the adapter, this will adapt it to
+ // first node. After that the PropagatingAdater spreads over the
+ // children being
+ // created. Each time that happends, a side effect is to
+ // also "spread" sprecific registered adapters,
+ // they two can propigate is needed.
+ ((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
+ if (Debug.debugNotificationAndEvents) {
+ PropagatingAdapter propagatingAdapter = (PropagatingAdapter) ((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
+ propagatingAdapter.addAdaptOnCreateFactory(new DebugAdapterFactory());
+ } }
+
+ public ModelLoader newInstance() {
+ return new HTMLModelLoader();
+ }
+
+ public IDocumentLoader getDocumentLoader() {
+ if (documentLoaderInstance == null) {
+ documentLoaderInstance = new HTMLDocumentLoader();
+ }
+ return documentLoaderInstance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/EmbeddedCSSFormatter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/EmbeddedCSSFormatter.java
new file mode 100644
index 0000000000..1ed9273904
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/EmbeddedCSSFormatter.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+
+
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.format.CSSSourceFormatter;
+import org.eclipse.wst.html.core.HTMLFormatContraints;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.document.XMLText;
+
+// nakamori_TODO: check and remove
+
+public class EmbeddedCSSFormatter extends HTMLFormatter {
+
+ //private AdapterFactory factory = new CSSSourceFormatterFactory(CSSSourceFormatter.class, true);
+ /**
+ */
+ protected EmbeddedCSSFormatter() {
+ super();
+ }
+
+ /**
+ */
+ protected void formatNode(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+ XMLText text = (XMLText) node;
+
+ String source = getCSSContent(node);
+ if (source == null) { // fallback
+ source = text.getSource();
+ }
+
+ int offset = text.getStartOffset();
+ int length = text.getEndOffset() - offset;
+ replaceSource(text.getModel(), offset, length, source);
+ setWidth(contraints, source);
+ }
+
+ /**
+ */
+ private String getCSSContent(XMLNode text) {
+ ICSSModel model = getCSSModel(text);
+ if (model == null)
+ return null;
+ ICSSNode document = model.getDocument();
+ if (document == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) document;
+ INodeAdapter adapter = notifier.getAdapterFor(CSSSourceFormatter.class);
+ if (adapter == null)
+ return null;
+ CSSSourceFormatter formatter = (CSSSourceFormatter) adapter;
+ StringBuffer buffer = formatter.format(document);
+ if (buffer == null)
+ return null;
+ return buffer.toString();
+ }
+
+ /**
+ */
+ private ICSSModel getCSSModel(XMLNode text) {
+ if (text == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) text.getParentNode();
+ if (notifier == null)
+ return null;
+ INodeAdapter adapter = notifier.getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter == null)
+ return null;
+ if (!(adapter instanceof IStyleSheetAdapter))
+ return null;
+ IStyleSheetAdapter styleAdapter = (IStyleSheetAdapter) adapter;
+ return styleAdapter.getModel();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLElementFormatter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLElementFormatter.java
new file mode 100644
index 0000000000..983ba21ad2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLElementFormatter.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.adapters.IStyleDeclarationAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.format.CSSSourceFormatter;
+import org.eclipse.wst.html.core.HTMLFormatContraints;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.format.IStructuredFormatPreferencesXML;
+import org.eclipse.wst.xml.core.jsp.model.parser.temp.XMLJSPRegionContexts;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+
+// nakamori_TODO: check and remove CSS formatting
+
+public class HTMLElementFormatter extends HTMLFormatter implements XMLRegionContext, XMLJSPRegionContexts {
+
+ /**
+ */
+ protected HTMLElementFormatter() {
+ super();
+ }
+
+ /**
+ */
+ private void compressTailingSpaces(IStructuredDocumentRegion flatNode, ITextRegion region) {
+ int offset = region.getTextEnd();
+ int count = region.getEnd() - offset;
+ if (count == 1) {
+ String source = flatNode.getFullText(region);
+ int start = region.getStart();
+ if (source != null && source.charAt(offset - start) == ' ') {
+ // nothing to do
+ return;
+ }
+ }
+ replaceSource(flatNode, offset, count, " ");//$NON-NLS-1$
+ }
+
+ /**
+ */
+ private void formatEndTag(XMLElement element, HTMLFormatContraints contraints) {
+ IStructuredDocumentRegion endStructuredDocumentRegion = element.getEndStructuredDocumentRegion();
+ if (endStructuredDocumentRegion == null)
+ return;
+
+ if (element.isJSPTag() || element.isCommentTag()) {
+ String endTag = endStructuredDocumentRegion.getText();
+ if (endTag != null && endTag.length() > 0) {
+ setWidth(contraints, endTag);
+ }
+ return;
+ }
+
+ ITextRegion prevRegion = null;
+ ITextRegionList regions = endStructuredDocumentRegion.getRegions();
+ Iterator e = regions.iterator();
+ while (e.hasNext()) {
+ ITextRegion region = (ITextRegion) e.next();
+ if (region == null)
+ continue;
+ String regionType = region.getType();
+ if (regionType == XML_TAG_NAME || regionType == JSP_ROOT_TAG_NAME || regionType == JSP_DIRECTIVE_NAME) {
+ if (prevRegion != null && prevRegion.getType() == XML_END_TAG_OPEN) {
+ removeTailingSpaces(endStructuredDocumentRegion, prevRegion);
+ }
+ }
+ else if (regionType == XML_TAG_CLOSE) {
+ if (prevRegion != null && (prevRegion.getType() == XML_TAG_NAME || prevRegion.getType() == JSP_ROOT_TAG_NAME)) {
+ removeTailingSpaces(endStructuredDocumentRegion, prevRegion);
+ }
+ }
+ prevRegion = region;
+ }
+ if (prevRegion != null && (prevRegion.getType() == XML_TAG_NAME || prevRegion.getType() == JSP_ROOT_TAG_NAME)) {
+ removeTailingSpaces(endStructuredDocumentRegion, prevRegion);
+ }
+
+ String newEndTag = endStructuredDocumentRegion.getText();
+ if (newEndTag != null && newEndTag.length() > 0) {
+ setWidth(contraints, newEndTag);
+ }
+ }
+
+ /**
+ */
+ protected void formatNode(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+ XMLElement element = (XMLElement) node;
+
+ formatStartTag(element, contraints);
+
+ formatChildNodes(element, contraints);
+
+ formatEndTag(element, contraints);
+ }
+
+ /**
+ */
+ private void formatStartTag(XMLElement element, HTMLFormatContraints contraints) {
+ IStructuredDocumentRegion startStructuredDocumentRegion = element.getStartStructuredDocumentRegion();
+ if (startStructuredDocumentRegion == null)
+ return;
+
+ // We should format attributes in JSPTag?
+ //if (element.isJSPTag() || element.isCommentTag()) {
+ if (element.isCommentTag()) {
+ String startTag = startStructuredDocumentRegion.getText();
+ if (startTag != null && startTag.length() > 0) {
+ setWidth(contraints, startTag);
+ }
+ return;
+ }
+
+ // first process style attribute
+ if (element.isGlobalTag()) {
+ Attr attr = element.getAttributeNode("style");//$NON-NLS-1$
+ if (attr != null)
+ formatStyleAttr(attr);
+ }
+ boolean insertBreak = false;
+ insertBreak = ((IStructuredFormatPreferencesXML) getFormatPreferences()).getSplitMultiAttrs();
+
+ if (insertBreak) {
+ NamedNodeMap attributes = element.getAttributes();
+ if (attributes == null || attributes.getLength() < 2)
+ insertBreak = false;
+ }
+ String breakSpaces = getBreakSpaces(element);
+ String indent = getIndent();
+ if (indent != null && indent.length() > 0) {
+ breakSpaces += indent;
+ }
+ ITextRegion lastBreakRegion = null;
+
+ ITextRegion prevRegion = null;
+ ITextRegionList regions = startStructuredDocumentRegion.getRegions();
+ Iterator e = regions.iterator();
+ while (e.hasNext()) {
+ ITextRegion region = (ITextRegion) e.next();
+ if (region == null)
+ continue;
+
+ ITextRegion breakRegion = null;
+
+ String regionType = region.getType();
+ if (regionType == XML_TAG_NAME || regionType == JSP_ROOT_TAG_NAME || regionType == JSP_DIRECTIVE_NAME) {
+ if (prevRegion != null && prevRegion.getType() == XML_TAG_OPEN) {
+ removeTailingSpaces(startStructuredDocumentRegion, prevRegion);
+ }
+ breakRegion = region;
+ }
+ else if (regionType == XML_TAG_ATTRIBUTE_NAME) {
+ if (prevRegion != null && (prevRegion.getType() == XML_TAG_ATTRIBUTE_NAME || prevRegion.getType() == XML_TAG_ATTRIBUTE_EQUALS)) {
+ // attribute name without value
+ breakRegion = prevRegion;
+ }
+ }
+ else if (regionType == XML_TAG_ATTRIBUTE_EQUALS) {
+ if (prevRegion != null && prevRegion.getType() == XML_TAG_ATTRIBUTE_NAME) {
+ removeTailingSpaces(startStructuredDocumentRegion, prevRegion);
+ }
+ }
+ else if (regionType == XML_TAG_ATTRIBUTE_VALUE) {
+ if (prevRegion != null && prevRegion.getType() == XML_TAG_ATTRIBUTE_EQUALS) {
+ removeTailingSpaces(startStructuredDocumentRegion, prevRegion);
+ }
+ breakRegion = region;
+ }
+ else if (regionType == XML_TAG_CLOSE || regionType == XML_EMPTY_TAG_CLOSE) {
+ if (prevRegion != null && (prevRegion.getType() == XML_TAG_ATTRIBUTE_NAME || prevRegion.getType() == XML_TAG_ATTRIBUTE_EQUALS)) {
+ // attribute name without value
+ breakRegion = prevRegion;
+ }
+ }
+
+ if (breakRegion != null) {
+ int end = breakRegion.getTextEnd();
+ if (lastBreakRegion != null) {
+ int offset = lastBreakRegion.getEnd();
+ int count = end - offset;
+ if (insertBreak || !isWidthAvailable(contraints, count + 1)) {
+ replaceTailingSpaces(startStructuredDocumentRegion, lastBreakRegion, breakSpaces);
+ setWidth(contraints, breakSpaces);
+ }
+ else {
+ compressTailingSpaces(startStructuredDocumentRegion, lastBreakRegion);
+ addWidth(contraints, 1);
+ }
+ addWidth(contraints, count);
+ }
+ else {
+ addWidth(contraints, end);
+ }
+ lastBreakRegion = breakRegion;
+ }
+
+ prevRegion = region;
+ }
+ if (prevRegion != null && (prevRegion.getType() == XML_TAG_ATTRIBUTE_NAME || prevRegion.getType() == XML_TAG_ATTRIBUTE_EQUALS)) {
+ // attribute name without value
+ int end = prevRegion.getTextEnd();
+ if (lastBreakRegion != null) {
+ int offset = lastBreakRegion.getEnd();
+ int count = end - offset;
+ if (insertBreak || !isWidthAvailable(contraints, count + 1)) {
+ replaceTailingSpaces(startStructuredDocumentRegion, lastBreakRegion, breakSpaces);
+ setWidth(contraints, breakSpaces);
+ }
+ else {
+ compressTailingSpaces(startStructuredDocumentRegion, lastBreakRegion);
+ addWidth(contraints, 1);
+ }
+ addWidth(contraints, count);
+ }
+ else {
+ addWidth(contraints, end);
+ }
+ lastBreakRegion = prevRegion;
+ }
+
+ if (lastBreakRegion != null) {
+ int offset = lastBreakRegion.getTextEnd();
+ int count = startStructuredDocumentRegion.getLength() - offset;
+ if (prevRegion != null && prevRegion.getType() == XML_EMPTY_TAG_CLOSE) {
+ compressTailingSpaces(startStructuredDocumentRegion, lastBreakRegion);
+ count++;
+ }
+ else
+ removeTailingSpaces(startStructuredDocumentRegion, lastBreakRegion);
+ addWidth(contraints, count);
+ }
+ else {
+ addWidth(contraints, startStructuredDocumentRegion.getLength());
+ }
+ }
+
+ /**
+ */
+ private void formatStyleAttr(Attr attr) {
+ if (attr == null)
+ return;
+ String value = getCSSValue(attr);
+ if (value == null)
+ return;
+ String oldValue = ((XMLNode) attr).getValueSource();
+ if (oldValue != null && value.equals(oldValue))
+ return;
+ attr.setValue(value);
+ }
+
+ /**
+ */
+ private ICSSModel getCSSModel(Attr attr) {
+ if (attr == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) attr.getOwnerElement();
+ if (notifier == null)
+ return null;
+ INodeAdapter adapter = notifier.getAdapterFor(IStyleDeclarationAdapter.class);
+ if (adapter == null)
+ return null;
+ if (!(adapter instanceof IStyleDeclarationAdapter))
+ return null;
+ IStyleDeclarationAdapter styleAdapter = (IStyleDeclarationAdapter) adapter;
+ return styleAdapter.getModel();
+ }
+
+ /**
+ */
+ private String getCSSValue(Attr attr) {
+ ICSSModel model = getCSSModel(attr);
+ if (model == null)
+ return null;
+ ICSSNode document = model.getDocument();
+ if (document == null)
+ return null;
+ INodeNotifier notifier = (INodeNotifier) document;
+ INodeAdapter adapter = notifier.getAdapterFor(CSSSourceFormatter.class);
+ if (adapter == null)
+ return null;
+ CSSSourceFormatter formatter = (CSSSourceFormatter) adapter;
+ StringBuffer buffer = formatter.format(document);
+ if (buffer == null)
+ return null;
+ return buffer.toString();
+ }
+
+ /**
+ */
+ private void removeTailingSpaces(IStructuredDocumentRegion flatNode, ITextRegion region) {
+ int offset = region.getTextEnd();
+ int count = region.getEnd() - offset;
+ if (count <= 0)
+ return;
+ replaceSource(flatNode, offset, count, null);
+ }
+
+ /**
+ */
+ private void replaceTailingSpaces(IStructuredDocumentRegion flatNode, ITextRegion region, String spaces) {
+ int offset = region.getTextEnd();
+ int count = region.getEnd() - offset;
+ if (count == spaces.length()) {
+ String source = flatNode.getFullText(region);
+ if (source != null && source.endsWith(spaces)) {
+ // nothing to do
+ return;
+ }
+ }
+ replaceSource(flatNode, offset, count, spaces);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatContraintsImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatContraintsImpl.java
new file mode 100644
index 0000000000..06c61cac56
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatContraintsImpl.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+import org.eclipse.wst.html.core.HTMLFormatContraints;
+import org.eclipse.wst.sse.core.format.StructuredFormatContraints;
+
+/**
+ * @deprecated
+ * Please un-deprecate this if Page Designer thinks they are needed.
+ */
+public class HTMLFormatContraintsImpl extends StructuredFormatContraints implements HTMLFormatContraints {
+ protected int fAvailableLineWidth;
+
+ /**
+ * @deprecated
+ * It's very hard to keep the available line width accurate.
+ * Sometimes a node wants to start on a new line, sometimes it doesn't.
+ * It's best for the node to figure out the available line width on the fly.
+ */
+ public int getAvailableLineWidth() {
+ return fAvailableLineWidth;
+ }
+
+ /**
+ * @deprecated
+ * It's very hard to keep the available line width accurate.
+ * Sometimes a node wants to start on a new line, sometimes it doesn't.
+ * It's best for the node to figure out the available line width on the fly.
+ */
+ public void setAvailableLineWidth(int availableLineWidth) {
+ fAvailableLineWidth = availableLineWidth;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatProcessorImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatProcessorImpl.java
new file mode 100644
index 0000000000..d5e8132bfd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatProcessorImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.format.IStructuredFormatPreferences;
+import org.eclipse.wst.sse.core.format.IStructuredFormatter;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.xml.core.format.FormatProcessorXML;
+import org.eclipse.wst.xml.core.format.IStructuredFormatPreferencesXML;
+import org.eclipse.wst.xml.core.format.StructuredFormatPreferencesXML;
+import org.w3c.dom.Node;
+
+public class HTMLFormatProcessorImpl extends FormatProcessorXML {
+ protected String getFileExtension() {
+ return "html"; //$NON-NLS-1$
+ }
+
+ protected IStructuredFormatter getFormatter(Node node) {
+ IStructuredFormatter formatter = HTMLFormatterFactory.getInstance().createFormatter(node, getFormatPreferences());
+
+ return formatter;
+ }
+
+ public IStructuredFormatPreferences getFormatPreferences() {
+ if (fFormatPreferences == null) {
+ fFormatPreferences = new StructuredFormatPreferencesXML();
+
+ Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
+ if (preferences != null) {
+ fFormatPreferences.setLineWidth(preferences.getInt(CommonModelPreferenceNames.LINE_WIDTH));
+ ((IStructuredFormatPreferencesXML) fFormatPreferences).setSplitMultiAttrs(preferences.getBoolean(CommonModelPreferenceNames.SPLIT_MULTI_ATTRS));
+ fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(CommonModelPreferenceNames.CLEAR_ALL_BLANK_LINES));
+
+ if (preferences.getBoolean(CommonModelPreferenceNames.INDENT_USING_TABS))
+ fFormatPreferences.setIndent("\t"); //$NON-NLS-1$
+ else {
+ int tabWidth = getModelManagerPlugin().getPluginPreferences().getInt(CommonModelPreferenceNames.TAB_WIDTH);
+ String indent = ""; //$NON-NLS-1$
+ for (int i = 0; i < tabWidth; i++) {
+ indent += " "; //$NON-NLS-1$
+ }
+ fFormatPreferences.setIndent(indent);
+ }
+ }
+ }
+
+ return fFormatPreferences;
+ }
+
+ private IModelManagerPlugin getModelManagerPlugin() {
+
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ return plugin;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatter.java
new file mode 100644
index 0000000000..1cc89110ce
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatter.java
@@ -0,0 +1,659 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.html.core.HTMLFormatContraints;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.format.IStructuredFormatContraints;
+import org.eclipse.wst.sse.core.format.IStructuredFormatPreferences;
+import org.eclipse.wst.sse.core.format.IStructuredFormatter;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.format.IStructuredFormatPreferencesXML;
+import org.eclipse.wst.xml.core.format.StructuredFormatPreferencesXML;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class HTMLFormatter implements IStructuredFormatter {
+
+ private static final String HTML_NAME = "html";//$NON-NLS-1$
+ private static final String BODY_NAME = "BODY";//$NON-NLS-1$
+
+ /**
+ */
+ protected void addWidth(HTMLFormatContraints contraints, int width) {
+ if (contraints == null)
+ return;
+ if (!splitLines() || getLineWidth() < 0)
+ return;
+
+ int availableWidth = contraints.getAvailableLineWidth() - width;
+ if (availableWidth < 0)
+ availableWidth = 0;
+ contraints.setAvailableLineWidth(availableWidth);
+ }
+
+ /**
+ */
+ protected boolean canFormatChild(Node node) {
+ while (node != null) {
+ if (node.getNodeType() != Node.ELEMENT_NODE)
+ return true;
+ CMElementDeclaration decl = getElementDeclaration((Element) node);
+ if (decl != null) {
+ if (decl.getContentType() == CMElementDeclaration.CDATA)
+ return false;
+ if (decl.supports(HTMLCMProperties.SHOULD_KEEP_SPACE)) {
+ boolean shouldKeepSpace = ((Boolean) decl.getProperty(HTMLCMProperties.SHOULD_KEEP_SPACE)).booleanValue();
+ if (shouldKeepSpace)
+ return false;
+ }
+ }
+ node = node.getParentNode();
+ }
+ return false;
+ }
+
+ /**
+ */
+ protected boolean canInsertBreakAfter(CMElementDeclaration decl) {
+ if (decl == null)
+ return false;
+ if (!decl.supports(HTMLCMProperties.LINE_BREAK_HINT))
+ return false;
+ String hint = (String) decl.getProperty(HTMLCMProperties.LINE_BREAK_HINT);
+ if (hint == null)
+ return false;
+ return (hint.equals(HTMLCMProperties.Values.BREAK_BEFORE_START_AND_AFTER_END) || hint.equals(HTMLCMProperties.Values.BREAK_AFTER_START));
+ }
+
+ /**
+ */
+ protected boolean canInsertBreakAfter(Node node) {
+ if (node == null)
+ return false;
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return false;
+ Node next = node.getNextSibling();
+
+ if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ // do not insert break after unclosed tag
+ if (!((XMLElement) node).isClosed())
+ return false;
+ }
+ return true;
+ }
+ else if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ XMLElement element = (XMLElement) parent;
+ // do not insert break before missing end tag
+ if (next == null && element.getEndStructuredDocumentRegion() == null)
+ return false;
+
+ // insert line break under non-HTML elements including JSP elements
+ if (element.getPrefix() != null)
+ return true;
+
+ CMElementDeclaration decl = getElementDeclaration(element);
+ if (decl != null) {
+ if (decl.getContentType() == CMElementDeclaration.ELEMENT)
+ return true;
+ String tagName = element.getTagName();
+ // special for direct children under BODY
+ if (tagName != null && tagName.equalsIgnoreCase(BODY_NAME))
+ return true;
+ }
+ }
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ XMLElement element = (XMLElement) node;
+ CMElementDeclaration decl = getElementDeclaration(element);
+ if (canInsertBreakAfter(decl)) {
+ // spcial for BR
+ return canFormatChild(parent);
+ }
+ }
+ if (next != null && next.getNodeType() == Node.ELEMENT_NODE) {
+ CMElementDeclaration decl = getElementDeclaration((Element) next);
+ if (canInsertBreakBefore(decl))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ */
+ protected boolean canInsertBreakBefore(CMElementDeclaration decl) {
+ if (decl == null)
+ return false;
+ if (!decl.supports(HTMLCMProperties.LINE_BREAK_HINT))
+ return false;
+ String hint = (String) decl.getProperty(HTMLCMProperties.LINE_BREAK_HINT);
+ if (hint == null)
+ return false;
+ return hint.equals(HTMLCMProperties.Values.BREAK_BEFORE_START_AND_AFTER_END);
+ }
+
+ /**
+ */
+ protected boolean canInsertBreakBefore(Node node) {
+ if (node == null)
+ return false;
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return false;
+ Node prev = node.getPreviousSibling();
+
+ if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+ if (prev == null)
+ return false;
+ return true;
+ }
+ else if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ XMLElement element = (XMLElement) parent;
+ // do not insert break after missing start tag
+ if (prev == null && element.getStartStructuredDocumentRegion() == null)
+ return false;
+
+ // insert line break under non-HTML elements including JSP elements
+ if (element.getPrefix() != null)
+ return true;
+
+ CMElementDeclaration decl = getElementDeclaration(element);
+ if (decl != null) {
+ if (decl.getContentType() == CMElementDeclaration.ELEMENT)
+ return true;
+ String tagName = element.getTagName();
+ // special for direct children under BODY
+ if (tagName != null && tagName.equalsIgnoreCase(BODY_NAME))
+ return true;
+ }
+ }
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ CMElementDeclaration decl = getElementDeclaration((Element) node);
+ if (canInsertBreakBefore(decl))
+ return true;
+ }
+ if (prev != null && prev.getNodeType() == Node.ELEMENT_NODE) {
+ CMElementDeclaration decl = getElementDeclaration((Element) prev);
+ if (canInsertBreakAfter(decl)) {
+ // spcial for BR
+ return canFormatChild(parent);
+ }
+ }
+ return false;
+ }
+
+ /**
+ */
+ public void format(Node node) {
+ format(node, getFormatContraints());
+ }
+
+ /**
+ */
+ public void format(Node node, IStructuredFormatContraints contraints) {
+ if (node instanceof XMLNode && contraints instanceof HTMLFormatContraints)
+ format((XMLNode) node, (HTMLFormatContraints) contraints);
+ }
+
+ public void format(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+ if (node.getParentNode() == null)
+ return; // do not format removed node
+
+ setWidth(contraints, node);
+
+ if (canInsertBreakBefore(node))
+ insertBreakBefore(node, contraints);
+
+ formatNode(node, contraints);
+
+ if (canInsertBreakAfter(node))
+ insertBreakAfter(node, contraints);
+ }
+
+ /**
+ */
+ protected void formatChildNodes(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+ if (!node.hasChildNodes())
+ return;
+
+ // concat adjacent texts
+ node.normalize();
+
+ // disable sibling indent during formatting all the children
+ boolean indent = false;
+ if (contraints != null) {
+ indent = contraints.getFormatWithSiblingIndent();
+ contraints.setFormatWithSiblingIndent(false);
+ }
+
+ boolean insertBreak = true;
+ XMLNode child = (XMLNode) node.getFirstChild();
+ while (child != null) {
+ if (child.getParentNode() != node)
+ break;
+ XMLNode next = (XMLNode) child.getNextSibling();
+
+ if (insertBreak && canInsertBreakBefore(child)) {
+ insertBreakBefore(child, contraints);
+ }
+
+ IStructuredFormatter formatter = HTMLFormatterFactory.getInstance().createFormatter(child, getFormatPreferences());
+ if (formatter != null) {
+ if (formatter instanceof HTMLFormatter) {
+ HTMLFormatter htmlFormatter = (HTMLFormatter) formatter;
+ htmlFormatter.formatNode(child, contraints);
+ }
+ else {
+ formatter.format(child);
+ }
+ }
+
+ if (canInsertBreakAfter(child)) {
+ insertBreakAfter(child, contraints);
+ insertBreak = false; // not to insert twice
+ }
+ else {
+ insertBreak = true;
+ }
+
+ child = next;
+ }
+
+ if (contraints != null)
+ contraints.setFormatWithSiblingIndent(indent);
+ }
+
+ /**
+ */
+ protected void formatNode(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+
+ if (node.hasChildNodes()) { // container
+ formatChildNodes(node, contraints);
+ }
+ else { // leaf
+ IStructuredDocumentRegion flatNode = node.getStartStructuredDocumentRegion();
+ if (flatNode != null) {
+ String source = flatNode.getText();
+ if (source != null && source.length() > 0) {
+ setWidth(contraints, source);
+ }
+ }
+ }
+ }
+
+ /**
+ */
+ protected String getBreakSpaces(Node node) {
+ if (node == null)
+ return null;
+ StringBuffer buffer = new StringBuffer();
+
+ String delim = ((XMLNode) node).getModel().getStructuredDocument().getLineDelimiter();
+ if (delim != null && delim.length() > 0)
+ buffer.append(delim);
+
+ String indent = getIndent();
+ if (indent != null && indent.length() > 0) {
+ for (Node parent = node.getParentNode(); parent != null; parent = parent.getParentNode()) {
+ if (parent.getNodeType() != Node.ELEMENT_NODE)
+ break;
+ // ignore omitted tag
+ if (((XMLNode) parent).getStartStructuredDocumentRegion() == null)
+ continue;
+
+ XMLElement element = (XMLElement) parent;
+ if (element.getPrefix() != null) {
+ String localName = element.getLocalName();
+ // special for html:html
+ if (localName != null && !localName.equals(HTML_NAME)) {
+ buffer.append(indent);
+ }
+ continue;
+ }
+
+ CMElementDeclaration decl = getElementDeclaration(element);
+ if (decl != null && decl.supports(HTMLCMProperties.SHOULD_INDENT_CHILD_SOURCE)) {
+ boolean shouldIndent = ((Boolean) decl.getProperty(HTMLCMProperties.SHOULD_INDENT_CHILD_SOURCE)).booleanValue();
+ if (shouldIndent)
+ buffer.append(indent);
+ }
+
+ }
+ }
+
+ return buffer.toString();
+ }
+
+ /**
+ */
+ protected String getIndent() {
+ return getFormatPreferences().getIndent();
+ }
+
+ /**
+ */
+ protected int getLineWidth() {
+ return getFormatPreferences().getLineWidth();
+ }
+
+ /**
+ */
+ protected CMElementDeclaration getElementDeclaration(Element element) {
+ if (element == null)
+ return null;
+ Document document = element.getOwnerDocument();
+ if (document == null)
+ return null;
+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
+ if (modelQuery == null)
+ return null;
+ return modelQuery.getCMElementDeclaration(element);
+ }
+
+ /**
+ */
+ protected void insertBreakAfter(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+ if (node.getNodeType() == Node.TEXT_NODE)
+ return;
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return;
+ Node next = node.getNextSibling();
+
+ String spaces = null;
+ if (next == null) { // last spaces
+ // use parent indent for the end tag
+ spaces = getBreakSpaces(parent);
+ }
+ else if (next.getNodeType() == Node.TEXT_NODE) {
+ if (contraints != null && contraints.getFormatWithSiblingIndent()) {
+ XMLNode text = (XMLNode) next;
+ IStructuredFormatter formatter = HTMLFormatterFactory.getInstance().createFormatter(text, getFormatPreferences());
+ if (formatter instanceof HTMLTextFormatter) {
+ HTMLTextFormatter textFormatter = (HTMLTextFormatter) formatter;
+ textFormatter.formatText(text, contraints, HTMLTextFormatter.FORMAT_HEAD);
+ }
+ }
+ return;
+ }
+ else {
+ spaces = getBreakSpaces(node);
+ }
+ if (spaces == null || spaces.length() == 0)
+ return;
+
+ replaceSource(node.getModel(), node.getEndOffset(), 0, spaces);
+ setWidth(contraints, spaces);
+ }
+
+ /**
+ */
+ protected void insertBreakBefore(XMLNode node, HTMLFormatContraints contraints) {
+ if (node == null)
+ return;
+ if (node.getNodeType() == Node.TEXT_NODE)
+ return;
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return;
+ Node prev = node.getPreviousSibling();
+
+ String spaces = null;
+ if (prev != null && prev.getNodeType() == Node.TEXT_NODE) {
+ if (contraints != null && contraints.getFormatWithSiblingIndent()) {
+ XMLNode text = (XMLNode) prev;
+ IStructuredFormatter formatter = HTMLFormatterFactory.getInstance().createFormatter(text, getFormatPreferences());
+ if (formatter instanceof HTMLTextFormatter) {
+ HTMLTextFormatter textFormatter = (HTMLTextFormatter) formatter;
+ textFormatter.formatText(text, contraints, HTMLTextFormatter.FORMAT_TAIL);
+ }
+ }
+ return;
+ }
+ else {
+ spaces = getBreakSpaces(node);
+ }
+ if (spaces == null || spaces.length() == 0)
+ return;
+
+ replaceSource(node.getModel(), node.getStartOffset(), 0, spaces);
+ setWidth(contraints, spaces);
+ }
+
+ /**
+ */
+ protected boolean isWidthAvailable(HTMLFormatContraints contraints, int width) {
+ if (contraints == null)
+ return true;
+ if (!splitLines() || getLineWidth() < 0)
+ return true;
+ return (contraints.getAvailableLineWidth() >= width);
+ }
+
+ /**
+ */
+ protected boolean keepBlankLines(HTMLFormatContraints contraints) {
+ if (contraints == null)
+ return true;
+ return (!contraints.getClearAllBlankLines());
+ }
+
+ /**
+ */
+ protected void replaceSource(IStructuredDocumentRegion flatNode, int offset, int length, String source) {
+ if (flatNode == null)
+ return;
+ IStructuredDocument structuredDocument = flatNode.getParentDocument();
+ if (structuredDocument == null)
+ return;
+ if (source == null)
+ source = new String();
+ int startOffset = flatNode.getStartOffset();
+ if (structuredDocument.containsReadOnly(startOffset + offset, length))
+ return;
+ // We use 'structuredDocument' as the requester object just so this and the other
+ // format-related 'repalceText' (in replaceSource) can use the same requester.
+ // Otherwise, if requester is not identical,
+ // the undo group gets "broken" into multiple pieces based
+ // on the requesters being different. Technically, any unique, common
+ // requester object would work.
+ structuredDocument.replaceText(structuredDocument, startOffset + offset, length, source);
+ }
+
+ /**
+ */
+ protected void replaceSource(XMLModel model, int offset, int length, String source) {
+ if (model == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ if (source == null)
+ source = new String();
+ if (structuredDocument.containsReadOnly(offset, length))
+ return;
+ // We use 'structuredDocument' as the requester object just so this and the other
+ // format-related 'repalceText' (in replaceSource) can use the same requester.
+ // Otherwise, if requester is not identical,
+ // the undo group gets "broken" into multiple pieces based
+ // on the requesters being different. Technically, any unique, common
+ // requester object would work.
+ structuredDocument.replaceText(structuredDocument, offset, length, source);
+ }
+
+ /**
+ */
+ protected void setWidth(HTMLFormatContraints contraints, String source) {
+ if (contraints == null)
+ return;
+ if (source == null)
+ return;
+ int length = source.length();
+ if (length == 0)
+ return;
+
+ if (!splitLines())
+ return;
+ int lineWidth = getLineWidth();
+ if (lineWidth < 0)
+ return;
+
+ int offset = source.lastIndexOf('\n');
+ int offset2 = source.lastIndexOf('\r');
+ if (offset2 > offset)
+ offset = offset2;
+ if (offset >= 0)
+ offset++;
+
+ int availableWidth = 0;
+ if (offset >= 0) {
+ availableWidth = lineWidth - (length - offset);
+ }
+ else {
+ availableWidth = contraints.getAvailableLineWidth() - length;
+ }
+ if (availableWidth < 0)
+ availableWidth = 0;
+ contraints.setAvailableLineWidth(availableWidth);
+ }
+
+ /**
+ */
+ protected void setWidth(HTMLFormatContraints contraints, Node node) {
+ if (contraints == null)
+ return;
+ if (node == null)
+ return;
+ IStructuredDocument structuredDocument = ((XMLNode) node).getStructuredDocument();
+ if (structuredDocument == null)
+ return; // error
+
+ if (!splitLines())
+ return;
+ int lineWidth = getLineWidth();
+ if (lineWidth < 0)
+ return;
+
+ int offset = ((XMLNode) node).getStartOffset();
+ int line = structuredDocument.getLineOfOffset(offset);
+ int lineOffset = 0;
+ try {
+ lineOffset = structuredDocument.getLineOffset(line);
+ }
+ catch (BadLocationException ex) {
+ return; // error
+ }
+ if (lineOffset > offset)
+ return; // error
+
+ int availableWidth = lineWidth - (offset - lineOffset);
+ if (availableWidth < 0)
+ availableWidth = 0;
+
+ contraints.setAvailableLineWidth(availableWidth);
+ }
+
+ /**
+ */
+ protected boolean splitLines() {
+ return true;//getFormatPreferences().getSplitLines();
+ }
+
+ protected IStructuredFormatPreferences fFormatPreferences = null;
+ protected HTMLFormatContraints fFormatContraints = null;
+ protected IProgressMonitor fProgressMonitor = null;
+
+ //public void format(XMLNode node, FormatContraints formatContraints) {
+ // if (formatContraints.getFormatWithSiblingIndent())
+ // formatContraints.setCurrentIndent(getSiblingIndent(node));
+ //
+ // formatNode(node, formatContraints);
+ //}
+
+ public void setFormatPreferences(IStructuredFormatPreferences formatPreferences) {
+ fFormatPreferences = formatPreferences;
+ }
+
+ public IStructuredFormatPreferences getFormatPreferences() {
+ if (fFormatPreferences == null) {
+ fFormatPreferences = new StructuredFormatPreferencesXML();
+
+ Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
+ if (preferences != null) {
+ fFormatPreferences.setLineWidth(preferences.getInt(CommonModelPreferenceNames.LINE_WIDTH));
+ ((IStructuredFormatPreferencesXML) fFormatPreferences).setSplitMultiAttrs(preferences.getBoolean(CommonModelPreferenceNames.SPLIT_MULTI_ATTRS));
+ fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(CommonModelPreferenceNames.CLEAR_ALL_BLANK_LINES));
+
+ if (preferences.getBoolean(CommonModelPreferenceNames.INDENT_USING_TABS))
+ fFormatPreferences.setIndent("\t"); //$NON-NLS-1$
+ else {
+ int tabWidth = getModelManagerPlugin().getPluginPreferences().getInt(CommonModelPreferenceNames.TAB_WIDTH);
+ String indent = ""; //$NON-NLS-1$
+ for (int i = 0; i < tabWidth; i++) {
+ indent += " "; //$NON-NLS-1$
+ }
+ fFormatPreferences.setIndent(indent);
+ }
+ }
+ }
+
+ return fFormatPreferences;
+ }
+
+ public IStructuredFormatContraints getFormatContraints() {
+ if (fFormatContraints == null) {
+ fFormatContraints = new HTMLFormatContraintsImpl();
+
+ fFormatContraints.setAvailableLineWidth(getFormatPreferences().getLineWidth());
+ fFormatContraints.setClearAllBlankLines(getFormatPreferences().getClearAllBlankLines());
+ }
+
+ return fFormatContraints;
+ }
+
+ public void setProgressMonitor(IProgressMonitor progressMonitor) {
+ fProgressMonitor = progressMonitor;
+ }
+
+ private IModelManagerPlugin getModelManagerPlugin() {
+
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ return plugin;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatterFactory.java
new file mode 100644
index 0000000000..79d0cc740a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLFormatterFactory.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.format.IStructuredFormatPreferences;
+import org.eclipse.wst.sse.core.format.IStructuredFormatter;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.xml.core.format.IStructuredFormatPreferencesXML;
+import org.eclipse.wst.xml.core.format.StructuredFormatPreferencesXML;
+import org.w3c.dom.Node;
+
+// nakamori_TODO: check and remove CSS formatting
+
+class HTMLFormatterFactory {
+ private static HTMLFormatterFactory fInstance = null;
+ protected IStructuredFormatPreferencesXML fFormatPreferences = null;
+
+ static synchronized HTMLFormatterFactory getInstance() {
+ if (fInstance == null) {
+ fInstance = new HTMLFormatterFactory();
+ }
+ return fInstance;
+ }
+
+ protected IStructuredFormatter createFormatter(Node node, IStructuredFormatPreferences formatPreferences) {
+ IStructuredFormatter formatter = null;
+
+ switch (node.getNodeType()) {
+ case Node.ELEMENT_NODE :
+ formatter = new HTMLElementFormatter();
+ break;
+ case Node.TEXT_NODE :
+ if (isEmbeddedCSS(node)) {
+ formatter = new EmbeddedCSSFormatter();
+ }
+ else {
+ formatter = new HTMLTextFormatter();
+ }
+ break;
+ default :
+ formatter = new HTMLFormatter();
+ break;
+ }
+
+ // init FormatPreferences
+ formatter.setFormatPreferences(formatPreferences);
+
+ return formatter;
+ }
+
+ /**
+ */
+ private boolean isEmbeddedCSS(Node node) {
+ if (node == null)
+ return false;
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return false;
+ if (parent.getNodeType() != Node.ELEMENT_NODE)
+ return false;
+ String name = parent.getNodeName();
+ if (name == null)
+ return false;
+ return name.equalsIgnoreCase("STYLE");//$NON-NLS-1$
+ }
+
+
+ private HTMLFormatterFactory() {
+ super();
+ }
+
+ protected IStructuredFormatPreferencesXML getFormatPreferences() {
+ if (fFormatPreferences == null) {
+ fFormatPreferences = new StructuredFormatPreferencesXML();
+
+ Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
+ if (preferences != null) {
+ fFormatPreferences.setLineWidth(preferences.getInt(CommonModelPreferenceNames.LINE_WIDTH));
+ fFormatPreferences.setSplitMultiAttrs(preferences.getBoolean(CommonModelPreferenceNames.SPLIT_MULTI_ATTRS));
+ fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(CommonModelPreferenceNames.CLEAR_ALL_BLANK_LINES));
+
+ if (preferences.getBoolean(CommonModelPreferenceNames.INDENT_USING_TABS))
+ fFormatPreferences.setIndent("\t"); //$NON-NLS-1$
+ else {
+ int tabWidth = getModelManagerPlugin().getPluginPreferences().getInt(CommonModelPreferenceNames.TAB_WIDTH);
+ String indent = ""; //$NON-NLS-1$
+ for (int i = 0; i < tabWidth; i++) {
+ indent += " "; //$NON-NLS-1$
+ }
+ fFormatPreferences.setIndent(indent);
+ }
+ }
+ }
+
+ return fFormatPreferences;
+ }
+
+ private IModelManagerPlugin getModelManagerPlugin() {
+
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ return plugin;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLStructuredFormattingStrategyImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLStructuredFormattingStrategyImpl.java
new file mode 100644
index 0000000000..9ce048679d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLStructuredFormattingStrategyImpl.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
+import org.eclipse.wst.sse.core.format.IStructuredFormattingStrategy;
+
+public class HTMLStructuredFormattingStrategyImpl implements IStructuredFormattingStrategy {
+
+ private String fInitialIndentation;
+ private ISourceViewer fViewer;
+ protected IProgressMonitor fProgressMonitor = null;
+
+ /**
+ * Constructor for HTMLStructuredFormattingStrategyImpl.
+ */
+ public HTMLStructuredFormattingStrategyImpl(ISourceViewer viewer) {
+ fViewer = viewer;
+ }
+
+ /**
+ * @see org.eclipse.jface.text.formatter.IFormattingStrategy#formatterStarts(java.lang.String)
+ */
+ public void formatterStarts(String initialIndentation) {
+ fInitialIndentation = initialIndentation;
+ }
+
+ /**
+ * @see org.eclipse.jface.text.formatter.IFormattingStrategy#format(java.lang.String, boolean, java.lang.String, int)
+ */
+ public String format(String content, boolean isLineStart, String indentation, int[] positions) {
+ return content;
+ }
+
+ public void format(IStructuredModel model, int start, int length, boolean isLineStart, String indentation, int[] positions) {
+ IStructuredFormatProcessor formatProcessor = new HTMLFormatProcessorImpl();
+ formatProcessor.formatModel(model, start, length);
+ }
+
+ /**
+ * @see org.eclipse.jface.text.formatter.IFormattingStrategy#formatterStops()
+ */
+ public void formatterStops() {
+ }
+
+ public void setProgressMonitor(IProgressMonitor progressMonitor) {
+ fProgressMonitor = progressMonitor;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLTextFormatter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLTextFormatter.java
new file mode 100644
index 0000000000..dd0650abfb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/HTMLTextFormatter.java
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.HTMLFormatContraints;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.document.XMLText;
+import org.eclipse.wst.xml.core.jsp.model.parser.temp.XMLJSPRegionContexts;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class HTMLTextFormatter extends HTMLFormatter {
+
+ public static int FORMAT_ALL = 0;
+ public static int FORMAT_HEAD = 1;
+ public static int FORMAT_TAIL = 2;
+
+ /**
+ */
+ protected HTMLTextFormatter() {
+ super();
+ }
+
+ /**
+ */
+ private boolean canFormatText(XMLText text) {
+ if (text == null)
+ return false;
+
+ IStructuredDocumentRegion flatNode = text.getFirstStructuredDocumentRegion();
+ if (flatNode != null) {
+ String type = flatNode.getType();
+ if (type == XMLJSPRegionContexts.JSP_CONTENT || type == XMLRegionContext.BLOCK_TEXT)
+ return false;
+ }
+
+ Node parent = text.getParentNode();
+ if (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) {
+ XMLElement element = (XMLElement) parent;
+ if (!element.isGlobalTag() && !text.isWhitespace())
+ return false;
+ }
+
+ return canFormatChild(parent);
+ }
+
+ /**
+ */
+ private boolean canRemoveHeadingSpaces(XMLNode node) {
+ if (node == null)
+ return false;
+ if (node.getPreviousSibling() != null)
+ return false;
+ Node parent = node.getParentNode();
+ if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE)
+ return false;
+
+ CMElementDeclaration decl = getElementDeclaration((Element) parent);
+ if (decl == null || (!decl.supports(HTMLCMProperties.LINE_BREAK_HINT)))
+ return false;
+ String hint = (String) decl.getProperty(HTMLCMProperties.LINE_BREAK_HINT);
+ return hint.equals(HTMLCMProperties.Values.BREAK_BEFORE_START_AND_AFTER_END);
+ }
+
+ /**
+ */
+ private boolean canRemoveTailingSpaces(XMLNode node) {
+ if (node == null)
+ return false;
+ if (node.getNextSibling() != null)
+ return false;
+ Node parent = node.getParentNode();
+ if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE)
+ return false;
+
+ CMElementDeclaration decl = getElementDeclaration((Element) parent);
+ if (decl == null || (!decl.supports(HTMLCMProperties.LINE_BREAK_HINT)))
+ return false;
+ String hint = (String) decl.getProperty(HTMLCMProperties.LINE_BREAK_HINT);
+ return hint.equals(HTMLCMProperties.Values.BREAK_BEFORE_START_AND_AFTER_END);
+ }
+
+ /**
+ */
+ protected void formatNode(XMLNode node, HTMLFormatContraints contraints) {
+ formatText(node, contraints, FORMAT_ALL); // full format
+ }
+
+ /**
+ */
+ protected void formatText(XMLNode node, HTMLFormatContraints contraints, int mode) {
+ if (node == null)
+ return;
+ Node parent = node.getParentNode();
+ if (parent == null)
+ return;
+
+ XMLText text = (XMLText) node;
+ String source = text.getSource();
+
+ if (!canFormatText(text)) {
+ setWidth(contraints, source);
+ return;
+ }
+
+ int offset = text.getStartOffset();
+ int length = text.getEndOffset() - offset;
+
+ // format adjacent text at once
+ if (mode == FORMAT_HEAD) {
+ Node next = node.getNextSibling();
+ while (next != null && next.getNodeType() == Node.TEXT_NODE) {
+ XMLText nextText = (XMLText) next;
+ length += (nextText.getEndOffset() - nextText.getStartOffset());
+ String nextSource = nextText.getSource();
+ if (nextSource != null && nextSource.length() > 0) {
+ if (source == null)
+ source = nextSource;
+ else
+ source += nextSource;
+ }
+ next = next.getNextSibling();
+ }
+ }
+ else if (mode == FORMAT_TAIL) {
+ Node prev = node.getPreviousSibling();
+ while (prev != null && prev.getNodeType() == Node.TEXT_NODE) {
+ XMLText prevText = (XMLText) prev;
+ offset = prevText.getStartOffset();
+ length += (prevText.getEndOffset() - offset);
+ String prevSource = prevText.getSource();
+ if (prevSource != null && prevSource.length() > 0) {
+ if (source == null)
+ source = prevSource;
+ else
+ source = prevSource + source;
+ }
+ prev = prev.getPreviousSibling();
+ }
+ }
+
+ SpaceConverter converter = new SpaceConverter(source, keepBlankLines(contraints));
+
+ int wordLength = converter.nextWord();
+ if (wordLength == 0) { // only spaces
+ if (!converter.hasSpaces())
+ return; // empty
+ boolean removeSpaces = false;
+ if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ // check if tags are omitted
+ XMLNode element = (XMLNode) parent;
+ if (node.getPreviousSibling() == null && element.getStartStructuredDocumentRegion() == null) {
+ removeSpaces = true;
+ }
+ else if (node.getNextSibling() == null && element.getEndStructuredDocumentRegion() == null) {
+ removeSpaces = true;
+ }
+ }
+ if (removeSpaces) {
+ converter.replaceSpaces(null);
+ }
+ else if (!isWidthAvailable(contraints, 2) || canInsertBreakAfter(node) || canInsertBreakBefore(node)) {
+ String spaces = null;
+ if (node.getNextSibling() == null) { // last spaces
+ // use parent indent for the end tag
+ spaces = getBreakSpaces(parent);
+ }
+ else {
+ spaces = getBreakSpaces(node);
+ }
+ converter.replaceSpaces(spaces);
+ setWidth(contraints, spaces);
+ }
+ else if (canRemoveHeadingSpaces(node) || canRemoveTailingSpaces(node)) {
+ converter.replaceSpaces(null);
+ }
+ else {
+ converter.compressSpaces();
+ addWidth(contraints, 1);
+ }
+ }
+ else {
+ String breakSpaces = null;
+
+ // format heading spaces
+ boolean hasSpaces = converter.hasSpaces();
+ if (mode == FORMAT_TAIL) {
+ // keep spaces as is
+ addWidth(contraints, converter.getSpaceCount());
+ }
+ else if ((hasSpaces && !isWidthAvailable(contraints, wordLength + 1)) || canInsertBreakBefore(node)) {
+ breakSpaces = getBreakSpaces(node);
+ converter.replaceSpaces(breakSpaces);
+ setWidth(contraints, breakSpaces);
+ }
+ else {
+ if (hasSpaces) {
+ if (canRemoveHeadingSpaces(node)) {
+ converter.replaceSpaces(null);
+ }
+ else {
+ converter.compressSpaces();
+ addWidth(contraints, 1);
+ }
+ }
+ }
+ addWidth(contraints, wordLength);
+
+ // format middle
+ wordLength = converter.nextWord();
+ while (wordLength > 0) {
+ if (mode != FORMAT_ALL) {
+ // keep spaces as is
+ addWidth(contraints, converter.getSpaceCount());
+ }
+ else if (!isWidthAvailable(contraints, wordLength + 1)) {
+ if (breakSpaces == null)
+ breakSpaces = getBreakSpaces(node);
+ converter.replaceSpaces(breakSpaces);
+ setWidth(contraints, breakSpaces);
+ }
+ else {
+ converter.compressSpaces();
+ addWidth(contraints, 1);
+ }
+ addWidth(contraints, wordLength);
+ wordLength = converter.nextWord();
+ }
+
+ // format tailing spaces
+ hasSpaces = converter.hasSpaces();
+ if (mode == FORMAT_HEAD) {
+ // keep spaces as is
+ addWidth(contraints, converter.getSpaceCount());
+ }
+ else if ((hasSpaces && !isWidthAvailable(contraints, 2)) || canInsertBreakAfter(node)) {
+ if (node.getNextSibling() == null) { // last test
+ // use parent indent for the end tag
+ breakSpaces = getBreakSpaces(parent);
+ }
+ else {
+ if (breakSpaces == null)
+ breakSpaces = getBreakSpaces(node);
+ }
+ converter.replaceSpaces(breakSpaces);
+ setWidth(contraints, breakSpaces);
+ }
+ else {
+ if (hasSpaces) {
+ if (canRemoveTailingSpaces(node)) {
+ converter.replaceSpaces(null);
+ }
+ else {
+ converter.compressSpaces();
+ addWidth(contraints, 1);
+ }
+ }
+ }
+ }
+
+ if (converter.isModified()) {
+ source = converter.getSource();
+ replaceSource(text.getModel(), offset, length, source);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/SpaceConverter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/SpaceConverter.java
new file mode 100644
index 0000000000..08b3016bd1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/format/SpaceConverter.java
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.format;
+
+
+
+final class SpaceConverter {
+
+ private String source = null;
+ private int length = 0;
+ private int startOffset = 0;
+ private int endOffset = 0;
+ private int spaceCount = 0;
+ private int wordCount = 0;
+ private StringBuffer buffer = null;
+ private int lastOffset = 0;
+ private boolean keepBlankLines = false;
+
+ /**
+ */
+ public SpaceConverter(String source) {
+ super();
+
+ if (source == null) {
+ this.source = new String();
+ }
+ else {
+ this.source = source;
+ this.length = source.length();
+ }
+ }
+
+ /**
+ */
+ public SpaceConverter(String source, boolean keepBlankLines) {
+ super();
+
+ if (source == null) {
+ this.source = new String();
+ }
+ else {
+ this.source = source;
+ this.length = source.length();
+ }
+ this.keepBlankLines = keepBlankLines;
+ }
+
+ /**
+ */
+ public void compressSpaces() {
+ if (this.spaceCount == 0)
+ return;
+ if (this.spaceCount == 1 && this.source.charAt(this.startOffset) == ' ')
+ return;
+
+ if (this.buffer == null)
+ this.buffer = new StringBuffer();
+ if (this.startOffset > this.lastOffset) {
+ this.buffer.append(this.source.substring(this.lastOffset, this.startOffset));
+ }
+
+ this.buffer.append(' ');
+
+ this.lastOffset = this.startOffset + this.spaceCount;
+ }
+
+ /**
+ */
+ public String getSource() {
+ if (this.buffer == null)
+ this.buffer = new StringBuffer();
+ if (this.length > this.lastOffset) {
+ this.buffer.append(this.source.substring(this.lastOffset, this.length));
+ }
+ return this.buffer.toString();
+ }
+
+ /**
+ */
+ public int getSpaceCount() {
+ return this.spaceCount;
+ }
+
+ /**
+ */
+ public boolean hasSpaces() {
+ return (this.spaceCount > 0);
+ }
+
+ /**
+ */
+ public boolean isModified() {
+ return (this.buffer != null);
+ }
+
+ /**
+ * Add number of the old blank lines to new space string
+ */
+ private static String mergeBlankLines(String newSpaces, String oldSpaces) {
+ if (newSpaces == null || newSpaces.length() == 0)
+ return newSpaces;
+ if (oldSpaces == null)
+ return newSpaces;
+
+ // count old new lines
+ int newLineCount = 0;
+ int oldLength = oldSpaces.length();
+ for (int i = 0; i < oldLength; i++) {
+ char c = oldSpaces.charAt(i);
+ if (c == '\r') {
+ newLineCount++;
+ if (i + 1 < oldLength) {
+ c = oldSpaces.charAt(i + 1);
+ if (c == '\n')
+ i++;
+ }
+ }
+ else {
+ if (c == '\n')
+ newLineCount++;
+ }
+ }
+ if (newLineCount < 2)
+ return newSpaces; // no blank line
+
+ // here assuming newSpaces starts with a new line if any
+ String delim = null;
+ char d = newSpaces.charAt(0);
+ if (d == '\r') {
+ if (newSpaces.length() > 1 && newSpaces.charAt(1) == '\n')
+ delim = "\r\n";//$NON-NLS-1$
+ else
+ delim = "\r";//$NON-NLS-1$
+ }
+ else {
+ if (d == '\n')
+ delim = "\n";//$NON-NLS-1$
+ else
+ return newSpaces; // no new line
+ }
+
+ newLineCount--;
+ StringBuffer buffer = new StringBuffer(newSpaces.length() + newLineCount * 2);
+ while (newLineCount > 0) {
+ buffer.append(delim);
+ newLineCount--;
+ }
+ buffer.append(newSpaces);
+ return buffer.toString();
+ }
+
+ /**
+ */
+ public int nextWord() {
+ if (this.endOffset == this.length) {
+ this.startOffset = this.endOffset;
+ this.spaceCount = 0;
+ this.wordCount = 0;
+ return 0;
+ }
+
+ this.startOffset = this.endOffset;
+ int i = this.startOffset;
+ for (; i < this.length; i++) {
+ if (!Character.isWhitespace(this.source.charAt(i)))
+ break;
+ }
+ this.spaceCount = i - this.startOffset;
+
+ int wordOffset = i;
+ for (; i < this.length; i++) {
+ if (Character.isWhitespace(this.source.charAt(i)))
+ break;
+ }
+ this.wordCount = i - wordOffset;
+ this.endOffset = i;
+
+ return this.wordCount;
+ }
+
+ /**
+ */
+ public void replaceSpaces(String spaces) {
+ int spaceLength = (spaces != null ? spaces.length() : 0);
+ String oldSpaces = null;
+ if (spaceLength == this.spaceCount) {
+ if (spaceLength == 0)
+ return;
+ if (this.startOffset == 0) {
+ if (this.source.startsWith(spaces))
+ return;
+ }
+ else if (this.endOffset == this.length) {
+ if (this.source.endsWith(spaces))
+ return;
+ }
+ else {
+ int textOffset = this.startOffset + this.spaceCount;
+ oldSpaces = this.source.substring(this.startOffset, textOffset);
+ if (oldSpaces.equals(spaces))
+ return;
+ }
+ }
+ if (this.keepBlankLines && this.spaceCount > 0) {
+ if (oldSpaces == null) {
+ int textOffset = this.startOffset + this.spaceCount;
+ oldSpaces = this.source.substring(this.startOffset, textOffset);
+ }
+ if (oldSpaces != null) {
+ spaces = mergeBlankLines(spaces, oldSpaces);
+ }
+ }
+
+ if (this.buffer == null)
+ this.buffer = new StringBuffer();
+ if (this.startOffset > this.lastOffset) {
+ this.buffer.append(this.source.substring(this.lastOffset, this.startOffset));
+ }
+
+ if (spaceLength > 0)
+ this.buffer.append(spaces);
+
+ this.lastOffset = this.startOffset + this.spaceCount;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractCSSModelAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractCSSModelAdapter.java
new file mode 100644
index 0000000000..ca925c56e4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractCSSModelAdapter.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.adapters.ICSSModelAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.internal.document.CSSModelImpl;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Element;
+
+/**
+ */
+public abstract class AbstractCSSModelAdapter implements ICSSModelAdapter {
+ private final static String CSS_ID = IContentTypeIdentifier.ContentTypeID_CSS;
+
+ private Element element = null;
+ private ICSSModel model = null;
+
+ /**
+ */
+ AbstractCSSModelAdapter() {
+ super();
+ }
+
+ /**
+ */
+ protected ICSSModel createModel() {
+ // create embedded CSS model (not for external CSS)
+ if (getElement() == null)
+ return null;
+ IStructuredModel baseModel = ((XMLNode) getElement()).getModel();
+ ICSSModel newModel = (ICSSModel) baseModel.getModelManager().createUnManagedStructuredModelFor(CSS_ID);
+ ((CSSModelImpl) newModel).setOwnerDOMNode(getElement());
+ return newModel;
+ }
+
+ /**
+ */
+ public Element getElement() {
+ return this.element;
+ }
+
+ /**
+ */
+ protected ICSSModel getExistingModel() {
+ return this.model;
+ }
+
+ /**
+ */
+ protected void notifyStyleChanged(Element target) {
+ INodeNotifier notifier = (INodeNotifier) target;
+ if (notifier == null)
+ return;
+ Collection adapters = notifier.getAdapters();
+ if (adapters == null)
+ return;
+ Iterator it = adapters.iterator();
+ if (it == null)
+ return;
+ while (it.hasNext()) {
+ INodeAdapter adapter = (INodeAdapter) it.next();
+ if (adapter instanceof StyleListener) {
+ StyleListener listener = (StyleListener) adapter;
+ listener.styleChanged();
+ }
+ }
+ }
+
+ /**
+ */
+ void setElement(Element element) {
+ this.element = element;
+ }
+
+ /**
+ * check
+ * 1. If attributes of element is valid (type,rel ...)
+ * 2. If content model supports this element / attribute (future ?)
+ */
+ protected boolean isValidAttribute() {
+ return (getElement() != null);
+ }
+
+ /**
+ */
+ protected void setModel(ICSSModel model) {
+ this.model = model;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractStyleSheetAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractStyleSheetAdapter.java
new file mode 100644
index 0000000000..6823541f6a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/AbstractStyleSheetAdapter.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.wst.css.core.adapters.IModelProvideAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.event.ICSSStyleListener;
+import org.eclipse.wst.css.core.util.ImportedCollector;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLModelNotifier;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.stylesheets.DocumentStyle;
+import org.w3c.dom.stylesheets.StyleSheet;
+import org.w3c.dom.stylesheets.StyleSheetList;
+import org.w3c.dom.traversal.DocumentTraversal;
+import org.w3c.dom.traversal.NodeFilter;
+import org.w3c.dom.traversal.NodeIterator;
+
+/**
+ */
+public abstract class AbstractStyleSheetAdapter extends AbstractCSSModelAdapter implements ICSSStyleListener, IStyleSheetAdapter {
+
+ // this variable to hold the class is just a VAJava trick.
+ // it improves performance in VAJava by minimizing class loading.
+ private final Class StyleSheetAdapterClass = IStyleSheetAdapter.class;
+ private Collection styleChangedNodes;
+
+ /**
+ */
+ protected AbstractStyleSheetAdapter() {
+ super();
+ }
+
+ /**
+ */
+ protected ICSSModel createModel() {
+ ICSSModel newModel = super.createModel();
+ if (newModel != null) {
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+ // notify adapter
+ if (adapter != null)
+ adapter.modelProvided(newModel);
+ }
+ return newModel;
+ }
+
+ /**
+ */
+ public StyleSheet getSheet() {
+ ICSSModel model = getModel();
+ if (model == null)
+ return null;
+ return (StyleSheet) model.getDocument();
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == StyleSheetAdapterClass);
+ }
+
+ /**
+ */
+ public void released() {
+ ICSSModel currentModel = getModel();
+
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+
+ setElement(null);
+ setModel(null);
+
+ if (adapter != null)
+ adapter.modelReleased(currentModel);
+
+ if (currentModel != null)
+ currentModel.releaseFromRead();
+ }
+
+ /**
+ */
+ public void removed() {
+ ICSSModel currentModel = getModel();
+
+ setModel(null);
+
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+ if (adapter != null)
+ adapter.modelRemoved(currentModel);
+
+ if (currentModel != null)
+ currentModel.releaseFromRead();
+ }
+
+ /**
+ * @param srcModel com.ibm.sed.css.model.interfaces.ICSSModel
+ * @param removed com.ibm.sed.css.model.interfaces.ICSSSelector[]
+ * @param added com.ibm.sed.css.model.interfaces.ICSSSelector[]
+ * @param media java.lang.String
+ */
+ public void styleChanged(ICSSModel srcModel, ICSSSelector[] removed, ICSSSelector[] added, String media) {
+ Element element = getElement();
+ if (element == null)
+ return; // might released
+ Document doc = element.getOwnerDocument();
+ if (doc == null)
+ return; // error
+
+ // to notify GEF tree
+ if (doc instanceof INodeNotifier) {
+ Collection adapters = ((INodeNotifier) doc).getAdapters();
+ if (adapters == null)
+ return;
+ Iterator it = adapters.iterator();
+ if (it == null)
+ return;
+ while (it.hasNext()) {
+ INodeAdapter adapter = (INodeAdapter) it.next();
+ if (adapter instanceof ICSSStyleListener) {
+ ((ICSSStyleListener) adapter).styleChanged(srcModel, removed, added, media);
+ }
+ }
+ }
+ //
+
+ if (styleChangedNodes == null) {
+ styleChangedNodes = new HashSet();
+ }
+
+ try {
+ int removedSelNum = removed != null ? removed.length : 0;
+ int addedSelNum = added != null ? added.length : 0;
+
+ NodeIterator iter = ((DocumentTraversal) doc).createNodeIterator(doc, NodeFilter.SHOW_ELEMENT, null, true);
+ Node node;
+ while ((node = iter.nextNode()) != null) {
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element elm = (Element) node;
+ boolean match = false;
+ int i;
+ for (i = 0; i < removedSelNum && !match; i++) {
+ match = removed[i].match(elm, null);
+ }
+ for (i = 0; i < addedSelNum && !match; i++) {
+ match = added[i].match(elm, null);
+ }
+ if (match) {
+ if (!styleChangedNodes.contains(elm))
+ styleChangedNodes.add(elm);
+ // notifyStyleChanged(elm);
+ }
+ }
+ }
+ }
+ catch (ClassCastException ex) {
+ // Document doesn't implement DocumentTraversal...
+ }
+
+ }
+
+ /**
+ * @param srcModel com.ibm.sed.css.model.interfaces.ICSSModel
+ */
+ public void styleUpdate(ICSSModel srcModel) {
+ XMLNode node = (XMLNode) getElement();
+ if (node == null)
+ return;
+ XMLModel model = node.getModel();
+ if (model == null)
+ return;
+ XMLModelNotifier notifier = model.getModelNotifier();
+ if (notifier == null)
+ return;
+
+ // before updating, all sub-models should be loaded!
+ DocumentStyle document = (DocumentStyle) model.getDocument();
+ StyleSheetList styles = document.getStyleSheets();
+ if (styles != null) {
+ int n = styles.getLength();
+ ImportedCollector trav = new ImportedCollector();
+ for (int i = 0; i < n; i++) {
+ org.w3c.dom.stylesheets.StyleSheet sheet = styles.item(i);
+ if (sheet instanceof ICSSNode)
+ trav.apply((ICSSNode) sheet);
+ }
+ }
+
+ // flash style changed events
+ if (styleChangedNodes != null) {
+ Object[] elements = styleChangedNodes.toArray();
+ for (int i = 0; elements != null && i < elements.length; i++)
+ notifyStyleChanged((Element) elements[i]);
+ styleChangedNodes.clear();
+ }
+
+ // to notify GEF tree
+ if (document instanceof INodeNotifier) {
+ Collection adapters = ((INodeNotifier) document).getAdapters();
+ if (adapters == null)
+ return;
+ Iterator it = adapters.iterator();
+ if (it == null)
+ return;
+ while (it.hasNext()) {
+ INodeAdapter adapter = (INodeAdapter) it.next();
+ if (adapter instanceof ICSSStyleListener) {
+ ((ICSSStyleListener) adapter).styleUpdate(srcModel);
+ }
+ }
+ }
+
+ notifier.propertyChanged(node);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryContext.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryContext.java
new file mode 100644
index 0000000000..2bd84f382e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryContext.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import java.util.Enumeration;
+
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSValue;
+import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty;
+import org.eclipse.wst.css.core.util.CSSLinkConverter;
+import org.eclipse.wst.css.core.util.declaration.CSSPropertyContext;
+
+/**
+ */
+class CSSQueryContext extends CSSPropertyContext {
+
+ /**
+ */
+ public CSSQueryContext() {
+ super();
+ }
+
+ /**
+ */
+ public CSSQueryContext(ICSSStyleDeclaration decl) {
+ super(decl);
+ }
+
+ /**
+ *
+ */
+ public void applyFull(ICSSStyleDeclaration decl) {
+ if (decl == null)
+ return;
+ Enumeration keys = fProperties.keys();
+ while (keys.hasMoreElements()) {
+ Object key = keys.nextElement();
+ Object val = fProperties.get(key);
+
+ if (val instanceof CSSQueryDeclarationData) {
+ ICSSStyleDeclItem declItem = ((CSSQueryDeclarationData) val).getDeclItem();
+ if (declItem.getLength() <= 0) {
+ ICSSStyleDeclItem itemToRemove = decl.getDeclItemNode(key.toString());
+ if (itemToRemove != null) {
+ decl.removeDeclItemNode(itemToRemove);
+ }
+ }
+ else {
+ decl.setDeclItemNode(declItem);
+ }
+ }
+ else {
+ String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : val.toString();
+
+ if (value == null || value.length() <= 0) {
+ ICSSStyleDeclItem itemToRemove = decl.getDeclItemNode(key.toString());
+ if (itemToRemove != null) {
+ decl.removeDeclItemNode(itemToRemove);
+ }
+ }
+ else {
+ decl.setProperty(key.toString(), value, null);
+ }
+ }
+ }
+ }
+
+ /**
+ */
+ private boolean check(String propName, boolean important, int specificity) {
+ Object current = fProperties.get(propName);
+ if (current != null && current instanceof CSSQueryValueData) {
+ CSSQueryValueData currentValue = (CSSQueryValueData) current;
+ if ((!important && currentValue.important) || (currentValue.getSpecificity() > specificity)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ */
+ public void overrideWithExpand(ICSSStyleDeclaration decl, int specificity) {
+ if (decl == null)
+ return;
+
+ CSSLinkConverter conv = new CSSLinkConverter(decl.getOwnerDocument().getModel());
+
+ int nProperties = decl.getLength();
+ for (int i = 0; i < nProperties; i++) {
+ String propName = decl.item(i);
+ if (propName != null) {
+ String propN = propName.trim().toLowerCase();
+ if (propN.length() != 0) {
+ PropCMProperty prop = PropCMProperty.getInstanceOf(propN);
+ String priority = decl.getPropertyPriority(propName);
+ boolean important = priority != null && priority.length() > 0;
+ if (prop != null && prop.isShorthand()) {
+ // expand shorthand property
+ CSSQueryContext context = new CSSQueryContext();
+ expandToLeaf(prop, decl.getPropertyValue(propName), context);
+
+ Enumeration properties = context.properties();
+ while (properties.hasMoreElements()) {
+ propN = properties.nextElement().toString();
+ if (check(propN, important, specificity)) {
+ fProperties.put(propN, new CSSQueryValueData(conv.toAbsolute(context.get(propN)), important, specificity));
+ }
+ }
+ }
+ else {
+ if (check(propN, important, specificity)) {
+ ICSSStyleDeclItem declItem = (ICSSStyleDeclItem) decl.getDeclItemNode(propName).cloneNode(true);
+ int nValues = declItem.getLength();
+ for (int j = 0; j < nValues; j++) {
+ conv.toAbsolute(declItem.item(j));
+ }
+ declItem.setPriority(null);
+ fProperties.put(propN, new CSSQueryDeclarationData(declItem, important, specificity));
+ }
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryDeclarationData.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryDeclarationData.java
new file mode 100644
index 0000000000..2b42b8d943
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryDeclarationData.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+import org.eclipse.wst.css.core.document.ICSSStyleDeclItem;
+
+
+
+/**
+ */
+public class CSSQueryDeclarationData extends CSSQueryValueData {
+
+
+ ICSSStyleDeclItem declItem;
+
+ public CSSQueryDeclarationData(ICSSStyleDeclItem declItem, boolean imp, int specificity) {
+ super(null, imp, specificity);
+ this.declItem = declItem;
+ }
+
+ /**
+ */
+ ICSSStyleDeclItem getDeclItem() {
+ return declItem;
+ }
+
+ /**
+ */
+ public String toString() {
+ if (value == null && declItem != null) {
+ value = declItem.getCSSValueText();
+ }
+ return value;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryTraverser.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryTraverser.java
new file mode 100644
index 0000000000..9cddce0c46
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryTraverser.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.document.ICSSSelector;
+import org.eclipse.wst.css.core.document.ICSSSelectorList;
+import org.eclipse.wst.css.core.document.ICSSStyleDeclaration;
+import org.eclipse.wst.css.core.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.util.AbstractCssTraverser;
+import org.eclipse.wst.css.core.util.CSSStyleDeclarationFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.css.ElementCSSInlineStyle;
+
+/**
+ */
+public class CSSQueryTraverser extends AbstractCssTraverser {
+
+ private Element element;
+ private String pseudoName;
+ private CSSQueryContext context = null;
+ ICSSStyleDeclaration decl = null;
+
+ /**
+ */
+ public ICSSStyleDeclaration getDeclaration() {
+ try {
+ ICSSStyleDeclaration inlineStyle = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) element).getStyle();
+ if (inlineStyle != null) {
+ if (context == null) {
+ context = new CSSQueryContext();
+ }
+ context.overrideWithExpand(inlineStyle, 10000);
+ // style attribute's specificity is 100 (in CSS2 spec.) and
+ // our implement use 100 as base number (see CSSSelector.java)
+ }
+ }
+ catch (ClassCastException ex) {
+ // element is not ElementCSSInlineStyle ???
+ }
+ if (context == null)
+ return null;
+
+ if (decl == null)
+ decl = CSSStyleDeclarationFactory.getInstance().createStyleDeclaration();
+ context.applyFull(decl);
+ return decl;
+ }
+
+ /**
+ */
+ private void overwriteDeclaration(ICSSStyleDeclaration d, int specificity) {
+ if (d == null)
+ return;
+ if (context == null)
+ context = new CSSQueryContext();
+ context.overrideWithExpand(d, specificity);
+ }
+
+ /**
+ */
+ protected short postNode(ICSSNode node) {
+ return TRAV_CONT;
+ }
+
+ /**
+ */
+ protected short preNode(ICSSNode node) {
+ if (node instanceof ICSSStyleRule) {
+ // style rule
+ ICSSStyleRule style = (ICSSStyleRule) node;
+ ICSSSelectorList list = style.getSelectors();
+ int nSelectors = list.getLength();
+ int maxSpecificity = -1;
+ for (int iSelector = 0; iSelector < nSelectors; iSelector++) {
+ // Check each Selector Lists
+ ICSSSelector selector = list.getSelector(iSelector);
+ int specificity = selector.getSpecificity();
+ if (maxSpecificity < specificity && selector.match(element, pseudoName)) {
+ maxSpecificity = specificity;
+ }
+ }
+ if (maxSpecificity >= 0) {
+ // apply this style to the element
+ overwriteDeclaration((ICSSStyleDeclaration) style.getStyle(), maxSpecificity);
+ }
+ return TRAV_PRUNE;
+ }
+ return TRAV_CONT;
+ }
+
+ /**
+ */
+ private void resetContext() {
+ context = null;
+ }
+
+ /**
+ */
+ public void setElement(Element element, String pseudoName) {
+ this.element = element;
+ this.pseudoName = pseudoName;
+ resetContext();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryValueData.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryValueData.java
new file mode 100644
index 0000000000..26f56b700e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/CSSQueryValueData.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+import org.eclipse.wst.css.core.util.declaration.ValueData;
+
+
+
+/**
+ */
+class CSSQueryValueData extends ValueData {
+
+ private int specificity;
+
+ /**
+ */
+ public CSSQueryValueData() {
+ super();
+ }
+
+ /**
+ */
+ public CSSQueryValueData(String val, boolean imp) {
+ super(val, imp);
+ }
+
+ /**
+ */
+ public CSSQueryValueData(String val, boolean imp, int specificity) {
+ super(val, imp);
+ this.specificity = specificity;
+ }
+
+ /**
+ */
+ int getSpecificity() {
+ return specificity;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLDocumentAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLDocumentAdapter.java
new file mode 100644
index 0000000000..a2ecc232dc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLDocumentAdapter.java
@@ -0,0 +1,398 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetListAdapter;
+import org.eclipse.wst.css.core.document.ICSSImportRule;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.document.ICSSNode;
+import org.eclipse.wst.css.core.util.CSSClassTraverser;
+import org.eclipse.wst.css.core.util.ImportRuleCollector;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.html.core.contentmodel.JSP11Namespace;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.stylesheets.StyleSheet;
+import org.w3c.dom.stylesheets.StyleSheetList;
+
+
+
+/**
+ */
+public class HTMLDocumentAdapter implements IStyleSheetListAdapter, StyleSheetList {
+
+ private Document document = null;
+ private Vector styleAdapters = null;
+ private Vector oldStyleAdapters = null;
+
+ /**
+ */
+ HTMLDocumentAdapter() {
+ super();
+ }
+
+ /**
+ */
+ private void addStyleSheet(Element node) {
+ XMLElement element = (XMLElement) node;
+ String tagName = element.getTagName();
+ if (tagName == null)
+ return;
+ boolean isContainer = false;
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.NOSCRIPT) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE) || tagName.equalsIgnoreCase(JSP11Namespace.ElementName.ROOT) || (!element.isGlobalTag() && element.isContainer())) {
+ isContainer = true;
+ }
+ else if (element.isCommentTag()) {
+ Node parent = element.getParentNode();
+ if (parent == element.getOwnerDocument()) {
+ // This condition is too severe, actually do not work for JSF template.
+ // But above (! globalTag() && isContainer()) cover JSF template + tpl template
+ isContainer = true;
+ }
+ else if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ tagName = ((Element) parent).getTagName();
+ if (tagName != null && tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD)) {
+ isContainer = true;
+ }
+ }
+ }
+
+ else {
+ String localName = element.getLocalName();
+ if (localName != null && localName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML)) {
+ // taglib html tag
+ isContainer = true;
+ }
+ else {
+ INodeNotifier notifier = element;
+ INodeAdapter adapter = notifier.getAdapterFor(IStyleSheetAdapter.class);
+ if (adapter != null && adapter instanceof IStyleSheetAdapter) {
+ this.styleAdapters.addElement(adapter);
+ }
+ }
+ }
+ if (isContainer) {
+ INodeNotifier notifier = element;
+ if (notifier.getExistingAdapter(IStyleSheetListAdapter.class) == null) {
+ notifier.addAdapter(this);
+ }
+ for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child.getNodeType() != Node.ELEMENT_NODE)
+ continue;
+ addStyleSheet((Element) child);
+ }
+ }
+ }
+
+ /**
+ */
+ void childReplaced() {
+ if (this.styleAdapters == null)
+ return;
+
+ // backup old adapters to be released on updating in getStyleSheets()
+ this.oldStyleAdapters = this.styleAdapters;
+ // invalidate the list
+ this.styleAdapters = null;
+
+ notifyStyleSheetsChanged(this.document);
+ }
+
+ /**
+ */
+ public Enumeration getClasses() {
+ StyleSheetList sheetList = getStyleSheets();
+ int nSheets = sheetList.getLength();
+
+ final ArrayList classes = new ArrayList();
+
+ CSSClassTraverser traverser = new CSSClassTraverser();
+ traverser.setTraverseImported(true);
+
+ for (int i = 0; i < nSheets; i++) {
+ org.w3c.dom.stylesheets.StyleSheet sheet = sheetList.item(i);
+ if (sheet instanceof ICSSNode) {
+ traverser.apply((ICSSNode) sheet);
+ }
+ }
+ classes.addAll(traverser.getClassNames());
+
+ return new Enumeration() {
+ int i = 0;
+
+ public boolean hasMoreElements() {
+ return i < classes.size();
+ }
+
+ public Object nextElement() {
+ return classes.get(i++);
+ }
+ };
+ }
+
+ /**
+ */
+ private List getValidAdapters() {
+ Vector validAdapters = new Vector();
+ if (this.styleAdapters != null) {
+ Iterator i = this.styleAdapters.iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof AbstractStyleSheetAdapter && ((AbstractStyleSheetAdapter) obj).isValidAttribute()) {
+ validAdapters.add(obj);
+ }
+ }
+ }
+ return validAdapters;
+ }
+
+ /**
+ */
+ public int getLength() {
+ return getValidAdapters().size();
+ }
+
+ /**
+ */
+ public CSSStyleDeclaration getOverrideStyle(Element element, String pseudoName) {
+ StyleSheetList ssl = getStyleSheets();
+ int numStyles = ssl.getLength();
+
+ CSSQueryTraverser query = new CSSQueryTraverser();
+ query.setTraverseImported(true);
+ query.setTraverseImportFirst(true);
+ query.setElement(element, pseudoName);
+
+ for (int i = 0; i < numStyles; i++) {
+ // loop for styles (<style> and <link>)
+ org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);
+
+ try {
+ query.apply((ICSSNode) ss);
+ }
+ catch (ClassCastException ex) {
+ // I can handle only CSS style
+ }
+ }
+
+ return query.getDeclaration();
+ }
+
+ /**
+ */
+ public StyleSheetList getStyleSheets() {
+ if (this.styleAdapters == null) {
+ if (this.document == null)
+ return null;
+
+ this.styleAdapters = new Vector();
+ for (Node child = this.document.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child.getNodeType() != Node.ELEMENT_NODE)
+ continue;
+ addStyleSheet((Element) child);
+ }
+
+ removeOldStyleSheets();
+ }
+ return this;
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == IStyleSheetListAdapter.class);
+ }
+
+ /**
+ */
+ public StyleSheet item(int index) {
+ if (this.styleAdapters == null)
+ return null;
+
+ List validAdapters = getValidAdapters();
+
+ if (index < 0 || index >= validAdapters.size())
+ return null;
+ org.w3c.dom.stylesheets.StyleSheet sheet = ((IStyleSheetAdapter) validAdapters.get(index)).getSheet();
+ if (sheet == null) {// for LINK element whose link is broken
+ ICSSModel model = ((AbstractStyleSheetAdapter) this.styleAdapters.elementAt(index)).createModel();
+ sheet = ((model != null) ? (StyleSheet) model.getDocument() : null);
+ }
+ return sheet;
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ Node node = null;
+ switch (eventType) {
+ case INodeNotifier.ADD :
+ node = (Node) newValue;
+ break;
+ case INodeNotifier.REMOVE :
+ node = (Node) oldValue;
+ break;
+ case INodeNotifier.CHANGE :
+ node = (Node) notifier;
+ break;
+ default :
+ break;
+ }
+ if (node == null || node.getNodeType() != Node.ELEMENT_NODE)
+ return;
+ XMLElement element = (XMLElement) node;
+ String tagName = element.getTagName();
+ if (tagName == null)
+ return;
+
+ if (eventType == INodeNotifier.CHANGE) {
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE)) {
+ refreshAdapters();
+ }
+ }
+ else {
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.LINK) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.NOSCRIPT) || tagName.equalsIgnoreCase(JSP11Namespace.ElementName.ROOT) || element.isCommentTag() || (!element.isGlobalTag() && element.isContainer())) {
+ childReplaced();
+ }
+ else if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE)) {
+ refreshAdapters();
+ }
+ else {
+ String localName = element.getLocalName();
+ if (localName != null && localName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML)) {
+ // taglib html tag
+ childReplaced();
+ }
+ }
+ }
+ }
+
+ /**
+ * reload LINK / @import if BASE changed
+ */
+ private void refreshAdapters() {
+ Iterator iAdapter = this.styleAdapters.iterator();
+ while (iAdapter.hasNext()) {
+ Object adapter = iAdapter.next();
+ if (adapter instanceof LinkElementAdapter) {
+ ((LinkElementAdapter) adapter).refreshSheet();
+ }
+ else if (adapter instanceof StyleElementAdapter) {
+ ICSSModel model = ((StyleElementAdapter) adapter).getModel();
+ ImportRuleCollector trav = new ImportRuleCollector();
+ trav.apply(model);
+ Iterator iRule = trav.getRules().iterator();
+ while (iRule.hasNext()) {
+ ICSSImportRule rule = (ICSSImportRule) iRule.next();
+ rule.refreshStyleSheet();
+ }
+ }
+ }
+ }
+
+ /**
+ */
+ private void notifyStyleSheetsChanged(Document target) {
+ INodeNotifier notifier = (INodeNotifier) target;
+ if (notifier == null)
+ return;
+ Collection adapters = notifier.getAdapters();
+ if (adapters == null)
+ return;
+ Iterator it = adapters.iterator();
+ if (it == null)
+ return;
+ while (it.hasNext()) {
+ INodeAdapter adapter = (INodeAdapter) it.next();
+ if (adapter instanceof StyleListener) {
+ StyleListener listener = (StyleListener) adapter;
+ listener.styleChanged();
+ }
+ }
+ }
+
+ /**
+ */
+ private void releaseOldStyleSheets() {
+ if (this.oldStyleAdapters == null)
+ return;
+ Iterator it = this.oldStyleAdapters.iterator();
+ while (it.hasNext()) {
+ IStyleSheetAdapter adapter = (IStyleSheetAdapter) it.next();
+ if (adapter == null)
+ continue;
+ // if the same adapter is in the current list,
+ // do not release
+ if (this.styleAdapters != null && this.styleAdapters.contains(adapter))
+ continue;
+ adapter.released();
+ }
+ this.oldStyleAdapters = null;
+ }
+
+ /**
+ */
+ public void releaseStyleSheets() {
+ releaseOldStyleSheets();
+
+ if (this.styleAdapters == null)
+ return;
+ Iterator it = this.styleAdapters.iterator();
+ while (it.hasNext()) {
+ IStyleSheetAdapter adapter = (IStyleSheetAdapter) it.next();
+ if (adapter != null)
+ adapter.released();
+ }
+ this.styleAdapters = null;
+ }
+
+ /**
+ */
+ private void removeOldStyleSheets() {
+ if (this.oldStyleAdapters == null)
+ return;
+ Iterator it = this.oldStyleAdapters.iterator();
+ while (it.hasNext()) {
+ IStyleSheetAdapter adapter = (IStyleSheetAdapter) it.next();
+ if (adapter == null)
+ continue;
+ // if the same adapter is in the current list,
+ // do not release
+ if (this.styleAdapters != null && this.styleAdapters.contains(adapter))
+ continue;
+ adapter.removed();
+ }
+ this.oldStyleAdapters = null;
+ }
+
+ /**
+ */
+ void setDocument(Document document) {
+ this.document = document;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapter.java
new file mode 100644
index 0000000000..d7a8426848
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapter.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import java.util.StringTokenizer;
+
+import org.eclipse.wst.css.core.adapters.IStyleSelectorAdapter;
+import org.eclipse.wst.css.core.document.ICSSSimpleSelector;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.w3c.dom.Element;
+
+/**
+ * Insert the type's description here.
+ */
+public class HTMLStyleSelectorAdapter implements IStyleSelectorAdapter {
+
+ static private HTMLStyleSelectorAdapter instance;
+ private Object toMatch = IStyleSelectorAdapter.class;
+
+ /**
+ * Insert the method's description here.
+ * @return com.ibm.sed.model.html.css.HTMLStyleSelectorAdapter
+ */
+ public synchronized static HTMLStyleSelectorAdapter getInstance() {
+ if (instance == null) {
+ instance = new HTMLStyleSelectorAdapter();
+ }
+ return instance;
+ }
+
+ /**
+ * @see com.ibm.sed.model.INodeAdapter
+ */
+ public boolean isAdapterForType(Object type) {
+ return type == toMatch;
+ }
+
+ /**
+ * @see com.ibm.sed.css.adapters.IStyleSelectorAdapter
+ */
+ public boolean match(ICSSSimpleSelector selector, Element element, String pseudoName) {
+ if (element == null)
+ return false;
+ int i;
+ String key;
+
+ // PseudoName
+ i = selector.getNumOfPseudoNames();
+ if (i > 0) {
+ if (pseudoName == null || pseudoName.length() == 0)
+ return false;
+ for (i = i - 1; i >= 0; i--) {
+ if (pseudoName.equalsIgnoreCase(selector.getPseudoName(i))) {
+ break;
+ }
+ }
+ if (i < 0)
+ return false;
+ }
+
+ // check tag name
+ if (!selector.isUniversal() && !element.getNodeName().equalsIgnoreCase(selector.getName()))
+ return false;
+
+ // check id
+ i = selector.getNumOfIDs();
+ if (i > 0) {
+ if (i > 1)
+ return false;
+ key = element.getAttribute("id");//$NON-NLS-1$
+ if (key == null)
+ return false;
+ if (!selector.getID(0).equals(key))
+ return false;
+ }
+
+ // check class
+ i = selector.getNumOfClasses();
+ if (i > 0) {
+ key = element.getAttribute("class");//$NON-NLS-1$
+ if (key == null)
+ return false;
+ StringTokenizer tokenizer = new StringTokenizer(key);
+ for (i = i - 1; i >= 0; i--) {
+ boolean ok = false;
+ while (tokenizer.hasMoreTokens()) {
+ if (selector.getClass(i).equals(tokenizer.nextToken())) {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok)
+ return false;
+ }
+ }
+
+ // check attributes
+ for (i = selector.getNumOfAttributes() - 1; i >= 0; i--) {
+ StringTokenizer tokenizer = new StringTokenizer(selector.getAttribute(i), "=~| \t\r\n\f");//$NON-NLS-1$
+ int countTokens = tokenizer.countTokens();
+ if (countTokens > 0) {
+ String attrValue = element.getAttribute(tokenizer.nextToken());
+ if (attrValue == null)
+ return false;
+ if (countTokens > 1) {
+ String token = tokenizer.nextToken("= \t\r\n\f");//$NON-NLS-1$
+ StringTokenizer attrValueTokenizer = null;
+ if (token.equals("~")) {//$NON-NLS-1$
+ attrValueTokenizer = new StringTokenizer(attrValue);
+ }
+ else if (token.equals("|")) {//$NON-NLS-1$
+ attrValueTokenizer = new StringTokenizer(attrValue, "-");//$NON-NLS-1$
+ }
+ if (attrValueTokenizer != null) {
+ if (tokenizer.hasMoreTokens()) {
+ token = tokenizer.nextToken();
+ boolean ok = false;
+ while (attrValueTokenizer.hasMoreTokens()) {
+ if (token.equals(attrValueTokenizer.nextToken())) {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok)
+ return false;
+ }
+ }
+ else {
+ if (!attrValue.equals(token))
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @see com.ibm.sed.model.INodeAdapter
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapterFactory.java
new file mode 100644
index 0000000000..3829934936
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/HTMLStyleSelectorAdapterFactory.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import org.eclipse.wst.css.core.adapters.IStyleSelectorAdapter;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+
+/**
+ * Insert the type's description here.
+ */
+public class HTMLStyleSelectorAdapterFactory implements AdapterFactory {
+
+ private static HTMLStyleSelectorAdapterFactory instance;
+ private Object toMatch = IStyleSelectorAdapter.class;
+
+ /**
+ * CSSModelProvideAdapterFactory constructor comment.
+ */
+ public HTMLStyleSelectorAdapterFactory() {
+ super();
+ }
+
+ /**
+ * Method that returns the adapter associated with the given object.
+ * It may be a singleton or not ... depending on the needs of the INodeAdapter ...
+ * but in general it is recommended for an adapter to be stateless,
+ * so the efficiencies of a singleton can be gained.
+ *
+ * The implementation of this method should call addAdapter on the adapted
+ * object with the correct instance of the adapter.
+ */
+ public INodeAdapter adapt(INodeNotifier notifier) {
+ INodeAdapter adapter = notifier.getExistingAdapter(IStyleSelectorAdapter.class);
+ if (adapter != null)
+ return adapter;
+ adapter = HTMLStyleSelectorAdapter.getInstance();
+ notifier.addAdapter(adapter);
+ return adapter;
+ }
+
+ /**
+ * Insert the method's description here.
+ * @return com.ibm.iwt.css.adapters.HTMLStyleSelectorAdapterFactory
+ */
+ public synchronized static HTMLStyleSelectorAdapterFactory getInstance() {
+ if (instance == null)
+ instance = new HTMLStyleSelectorAdapterFactory();
+ return instance;
+ }
+
+ /**
+ * isFactoryForType method comment.
+ */
+ public boolean isFactoryForType(Object type) {
+ return type == toMatch;
+ }
+
+ public void release() {
+ // default is to do nothing
+ }
+
+ /**
+ * Overriding copy method
+ */
+ public AdapterFactory copy() {
+ return getInstance();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/LinkElementAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/LinkElementAdapter.java
new file mode 100644
index 0000000000..9b412c22a0
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/LinkElementAdapter.java
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.core.adapters.IModelProvideAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetListAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.util.URIResolver;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ */
+public class LinkElementAdapter extends AbstractStyleSheetAdapter {
+
+ private final static String CSS_ID = IContentTypeIdentifier.ContentTypeID_CSS;
+ private boolean replaceModel = true;
+ // this variable to hold the class is just a VAJava trick.
+ // it improves performance in VAJava by minimizing class loading.
+ private final Class ModelProvideAdapterClass = IModelProvideAdapter.class;
+
+ /**
+ */
+ protected LinkElementAdapter() {
+ super();
+ }
+
+ /**
+ */
+ private void attrReplaced() {
+ this.replaceModel = true;
+
+ Element element = getElement();
+ if (element == null)
+ return; // error
+ Document document = element.getOwnerDocument();
+ if (document == null)
+ return; // error
+ INodeNotifier notifier = (INodeNotifier) document;
+ HTMLDocumentAdapter adapter = (HTMLDocumentAdapter) notifier.getAdapterFor(IStyleSheetListAdapter.class);
+ if (adapter == null)
+ return;
+ adapter.childReplaced();
+ }
+
+ /**
+ *
+ * @return com.ibm.sed.css.model.interfaces.ICSSModel
+ */
+ protected ICSSModel createModel() {
+ // create phantom(broken link) external CSS model
+ if (getElement() == null)
+ return null;
+ IStructuredModel baseModel = ((XMLNode) getElement()).getModel();
+ ICSSModel newModel = (ICSSModel) baseModel.getModelManager().createUnManagedStructuredModelFor(CSS_ID);
+
+ // calculate base location and set
+ // get resolver in Model
+ URIResolver resolver = baseModel.getResolver();
+
+ // resolve to absolute url : this need not exact location of css file. It is important that absurl is not null.
+ String ref = getElement().getAttribute(org.eclipse.wst.html.core.HTML40Namespace.ATTR_NAME_HREF);
+ String absurl = (resolver != null && ref != null) ? resolver.getLocationByURI(ref, true) : null;
+ if ((absurl == null) || (absurl.length() == 0)) {
+ IPath basePath = new Path(baseModel.getBaseLocation());
+ URLHelper helper = new URLHelper(basePath.removeLastSegments(1).toString());
+ absurl = helper.toAbsolute(ref == null ? "" : ref);//$NON-NLS-1$
+ }
+ if ((absurl == null) || (absurl.length() == 0)) {
+ absurl = ref;
+ }
+ if (absurl == null) {
+ absurl = "";//$NON-NLS-1$
+ }
+ newModel.setBaseLocation(absurl);
+
+ // set style listener
+ newModel.addStyleListener(this);
+
+ return newModel;
+ }
+
+ /**
+ */
+ public ICSSModel getModel() {
+ ICSSModel model = getExistingModel();
+ if (this.replaceModel) {
+ ICSSModel oldModel = model;
+
+ model = retrieveModel();
+ setModel(model);
+
+ // release old model
+ if (oldModel != null) {
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+ adapter.modelRemoved(oldModel);
+
+ oldModel.releaseFromRead();
+
+ }
+ this.replaceModel = false;
+ }
+ return model;
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (eventType != INodeNotifier.CHANGE)
+ return;
+ Attr attr = (Attr) changedFeature;
+ if (attr == null)
+ return;
+ String name = attr.getName();
+ if (name.equalsIgnoreCase("rel") || //$NON-NLS-1$
+ name.equalsIgnoreCase("type") || //$NON-NLS-1$
+ name.equalsIgnoreCase("href")) {//$NON-NLS-1$
+ attrReplaced();
+ }
+ }
+
+ /**
+ */
+ public void refreshSheet() {
+ if (!replaceModel) {
+ removed();
+ replaceModel = true;
+
+ XMLNode node = (XMLNode) getElement();
+ if (node != null) {
+ node.notify(INodeNotifier.CHANGE, getElement().getAttributeNode(org.eclipse.wst.html.core.HTML40Namespace.ATTR_NAME_HREF), null, null, node.getStartOffset());
+ }
+ }
+ }
+
+ /**
+ */
+ public void released() {
+ ICSSModel model = getExistingModel();
+ if (model != null) {
+ try {
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+
+ // set element to null first, so that no document wide updates
+ setElement(null);
+ setModel(null);
+
+ if (adapter != null)
+ adapter.modelReleased(model);
+ }
+ finally {
+ model.releaseFromRead();
+ }
+ }
+ this.replaceModel = false;
+ }
+
+ /**
+ */
+ public void removed() {
+ ICSSModel model = getExistingModel();
+ if (model != null) {
+ try {
+ setModel(null);
+
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+ if (adapter != null)
+ adapter.modelRemoved(model);
+ }
+ finally {
+ model.releaseFromRead();
+ }
+ }
+ this.replaceModel = false;
+ }
+
+ /**
+ */
+ protected boolean isValidAttribute() {
+ Element element = getElement();
+ if (element == null)
+ return false;
+ String rel = element.getAttribute("rel");//$NON-NLS-1$
+ if (rel == null || !rel.equalsIgnoreCase("stylesheet"))//$NON-NLS-1$
+ return false;
+ String type = element.getAttribute("type");//$NON-NLS-1$
+ if (type != null && !type.equalsIgnoreCase("text/css"))//$NON-NLS-1$
+ return false;
+ String href = element.getAttribute("href");//$NON-NLS-1$
+ if (href == null || href.length() == 0)
+ return false;
+ return true;
+ }
+
+ /**
+ */
+ private ICSSModel retrieveModel() {
+ if (!isValidAttribute()) {
+ return null;
+ }
+
+ // null,attr check is done in isValidAttribute()
+ Element element = getElement();
+ String href = element.getAttribute("href");//$NON-NLS-1$
+
+ XMLModel baseModel = ((XMLNode) element).getModel();
+ if (baseModel == null)
+ return null;
+ Object id = baseModel.getId();
+ if (!(id instanceof String))
+ return null;
+ //String base = (String)id;
+
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(ModelProvideAdapterClass);
+
+ URLModelProvider provider = new URLModelProvider();
+ try {
+ IStructuredModel newModel = provider.getModelForRead(baseModel, href);
+ if (newModel == null)
+ return null;
+ if (!(newModel instanceof ICSSModel)) {
+ newModel.releaseFromRead();
+ return null;
+ }
+
+ // notify adapter
+ if (adapter != null)
+ adapter.modelProvided(newModel);
+
+ return (ICSSModel) newModel;
+ }
+ catch (UnsupportedEncodingException e) {
+ }
+ catch (IOException e) {
+ }
+
+ return null;
+ }
+
+ /**
+ */
+ protected void setModel(ICSSModel model) {
+ ICSSModel oldModel = getExistingModel();
+ if (model == oldModel)
+ return;
+ super.setModel(model);
+ if (this.replaceModel)
+ this.replaceModel = false;
+ if (oldModel != null)
+ oldModel.removeStyleListener(this);
+ if (model != null)
+ model.addStyleListener(this);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAdapterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAdapterFactory.java
new file mode 100644
index 0000000000..30d88ad643
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAdapterFactory.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.css.core.adapters.IStyleDeclarationAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetListAdapter;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ */
+public class StyleAdapterFactory implements AdapterFactory {
+
+ private static StyleAdapterFactory instance = null;
+
+ // private static String CSS_CONTENT_TYPE = "text/css";//$NON-NLS-1$
+ /**
+ */
+ private StyleAdapterFactory() {
+ super();
+ }
+
+ /**
+ */
+ public INodeAdapter adapt(INodeNotifier notifier) {
+ if (notifier == null)
+ return null;
+
+ Node node = (Node) notifier;
+ short nodeType = node.getNodeType();
+ if (nodeType == Node.DOCUMENT_NODE) {
+ INodeAdapter adapter = notifier.getExistingAdapter(IStyleSheetListAdapter.class);
+ if (adapter != null)
+ return adapter;
+ HTMLDocumentAdapter newAdapter = new HTMLDocumentAdapter();
+ newAdapter.setDocument((Document) node);
+ notifier.addAdapter(newAdapter);
+ return newAdapter;
+ }
+ if (nodeType != Node.ELEMENT_NODE)
+ return null;
+
+ Element element = (Element) node;
+ String tagName = element.getTagName();
+ if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
+ if (!isTagAvailable(element.getOwnerDocument(), HTML40Namespace.ElementName.STYLE)) {
+ return null;
+ }
+ // String type = element.getAttribute(HTML40Namespace.ATTR_NAME_TYPE);
+ // if (type != null && ! type.equalsIgnoreCase(CSS_CONTENT_TYPE)) {
+ // return null;
+ // }
+ INodeAdapter adapter = notifier.getExistingAdapter(IStyleSheetAdapter.class);
+ if (adapter != null)
+ return adapter;
+ StyleElementAdapter newAdapter = new StyleElementAdapter();
+ newAdapter.setElement(element);
+ notifier.addAdapter(newAdapter);
+ return newAdapter;
+ }
+ else if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.LINK)) {
+ if (!isTagAvailable(element.getOwnerDocument(), HTML40Namespace.ElementName.LINK)) {
+ return null;
+ }
+ INodeAdapter adapter = notifier.getExistingAdapter(IStyleSheetAdapter.class);
+ if (adapter != null)
+ return adapter;
+ LinkElementAdapter newAdapter = new LinkElementAdapter();
+ newAdapter.setElement(element);
+ notifier.addAdapter(newAdapter);
+ return newAdapter;
+ }
+
+ INodeAdapter adapter = notifier.getExistingAdapter(IStyleDeclarationAdapter.class);
+ if (adapter != null)
+ return adapter;
+
+ if (!isAttributeAvailable(element, HTML40Namespace.ATTR_NAME_STYLE)) {
+ return null;
+ }
+ StyleAttrAdapter newAdapter = new StyleAttrAdapter();
+ newAdapter.setElement(element);
+ notifier.addAdapter(newAdapter);
+ return newAdapter;
+ }
+
+ /**
+ */
+ public synchronized static StyleAdapterFactory getInstance() {
+ if (instance == null)
+ instance = new StyleAdapterFactory();
+ return instance;
+ }
+
+ /**
+ */
+ public boolean isFactoryForType(Object type) {
+ return (type == IStyleSheetAdapter.class || type == IStyleDeclarationAdapter.class || type == IStyleSheetListAdapter.class);
+ }
+
+ public void release() {
+ // default is to do nothing
+ }
+
+ private static boolean isTagAvailable(Document document, String elementName) {
+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
+ if (modelQuery != null) {
+ CMDocument cmdoc = modelQuery.getCorrespondingCMDocument(document);
+ CMNamedNodeMap map = cmdoc.getElements();
+ if ((CMElementDeclaration) map.getNamedItem(elementName) != null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static boolean isAttributeAvailable(Element element, String attrName) {
+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
+ if (modelQuery != null) {
+ CMElementDeclaration decl = modelQuery.getCMElementDeclaration(element);
+ if (decl != null) {
+ CMNamedNodeMap map = decl.getAttributes();
+ if ((CMAttributeDeclaration) map.getNamedItem(attrName) != null) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Overriding Object's clone() method
+ */
+ public AdapterFactory copy() {
+ return getInstance();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAttrAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAttrAdapter.java
new file mode 100644
index 0000000000..145da41a34
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleAttrAdapter.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import org.eclipse.wst.css.core.adapters.IStyleDeclarationAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.css.core.internal.parser.CSSSourceParser;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.events.IStructuredDocumentListener;
+import org.eclipse.wst.sse.core.events.NewDocumentEvent;
+import org.eclipse.wst.sse.core.events.NoChangeEvent;
+import org.eclipse.wst.sse.core.events.RegionChangedEvent;
+import org.eclipse.wst.sse.core.events.RegionsReplacedEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.parser.RegionParser;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.css.CSSStyleDeclaration;
+
+/**
+ */
+public class StyleAttrAdapter extends AbstractCSSModelAdapter implements IStructuredDocumentListener, IStyleDeclarationAdapter {
+
+ private boolean ignoreNotification = false;
+ private final static String STYLE = "style";//$NON-NLS-1$
+
+ /**
+ */
+ StyleAttrAdapter() {
+ super();
+ }
+
+ /**
+ */
+ public ICSSModel getModel() {
+ ICSSModel model = getExistingModel();
+ if (model == null && isModelNecessary()) {
+ model = createModel();
+ if (model == null)
+ return null;
+
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return null;
+
+ RegionParser parser = structuredDocument.getParser();
+ if (parser instanceof CSSSourceParser) {
+ ((CSSSourceParser)parser).setParserMode(CSSSourceParser.MODE_DECLARATION);
+ } else {
+ return null;
+ }
+
+ structuredDocument.addDocumentChangedListener(this);
+
+ setModel(model); // need to set before valueChanged()
+ valueChanged();
+ }
+ if (model != null && !isModelNecessary()) {
+ model = null;
+ valueChanged();
+ }
+ return model;
+ }
+
+ /**
+ */
+ public CSSStyleDeclaration getStyle() {
+ ICSSModel model = getModel();
+ if (model == null)
+ return null;
+ return (CSSStyleDeclaration) model.getDocument();
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == IStyleDeclarationAdapter.class);
+ }
+
+ /**
+ */
+ public void newModel(NewDocumentEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == this)
+ return;
+
+ setValue();
+ }
+
+ /**
+ */
+ public void noChange(NoChangeEvent structuredDocumentEvent) {
+ }
+
+ /**
+ */
+ public void nodesReplaced(StructuredDocumentRegionsReplacedEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == this)
+ return;
+
+ setValue();
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (this.ignoreNotification)
+ return;
+
+ if (eventType != INodeNotifier.CHANGE)
+ return;
+ Attr attr = (Attr) changedFeature;
+ if (attr == null)
+ return;
+ String name = attr.getName();
+ if (name.equalsIgnoreCase(STYLE)) {
+ valueChanged();
+ }
+ }
+
+ /**
+ */
+ public void regionChanged(RegionChangedEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == this)
+ return;
+
+ setValue();
+ }
+
+ /**
+ */
+ public void regionsReplaced(RegionsReplacedEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == this)
+ return;
+
+ setValue();
+ }
+
+ /**
+ */
+ private void setValue() {
+ Element element = getElement();
+ if (element == null)
+ return;
+ ICSSModel model = getExistingModel();
+ if (model == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+
+ String value = null;
+ IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
+ if (flatNodes != null) {
+ int count = flatNodes.getLength();
+ if (count > 0) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < count; i++) {
+ IStructuredDocumentRegion flatNode = flatNodes.item(i);
+ if (flatNode == null)
+ continue;
+ buffer.append(flatNode.getText());
+ }
+ value = buffer.toString();
+ }
+ }
+
+ this.ignoreNotification = true;
+ if (value == null || value.length() == 0) {
+ element.removeAttribute(STYLE);
+ }
+ else {
+ Attr attr = element.getAttributeNode(STYLE);
+ if (attr != null) {
+ ((XMLNode) attr).setValueSource(value);
+ }
+ else {
+ Document document = element.getOwnerDocument();
+ attr = document.createAttribute(STYLE);
+ ((XMLNode) attr).setValueSource(value);
+ element.setAttributeNode(attr);
+ }
+ }
+ this.ignoreNotification = false;
+
+ notifyStyleChanged(element);
+ }
+
+ /**
+ */
+ private void valueChanged() {
+ Element element = getElement();
+ if (element == null)
+ return;
+ if (!isModelNecessary()) { // removed
+ setModel(null);
+
+ notifyStyleChanged(element);
+ return;
+ }
+
+ ICSSModel model = getExistingModel();
+ if (model == null)
+ return; // defer
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return; // error
+
+ String value = null;
+ Attr attr = element.getAttributeNode(org.eclipse.wst.html.core.HTML40Namespace.ATTR_NAME_STYLE);
+ if (attr != null)
+ value = ((XMLNode) attr).getValueSource();
+ structuredDocument.setText(this, value);
+
+ notifyStyleChanged(element);
+ }
+
+ /**
+ * @return boolean
+ */
+ private boolean isModelNecessary() {
+ return getElement() != null && getElement().getAttributeNode(org.eclipse.wst.html.core.HTML40Namespace.ATTR_NAME_STYLE) != null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleElementAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleElementAdapter.java
new file mode 100644
index 0000000000..5ab5c17b30
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleElementAdapter.java
@@ -0,0 +1,411 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import org.eclipse.wst.css.core.adapters.IModelProvideAdapter;
+import org.eclipse.wst.css.core.adapters.IStyleSheetListAdapter;
+import org.eclipse.wst.css.core.document.ICSSModel;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.events.IStructuredDocumentListener;
+import org.eclipse.wst.sse.core.events.NewDocumentEvent;
+import org.eclipse.wst.sse.core.events.NoChangeEvent;
+import org.eclipse.wst.sse.core.events.RegionChangedEvent;
+import org.eclipse.wst.sse.core.events.RegionsReplacedEvent;
+import org.eclipse.wst.sse.core.events.StructuredDocumentRegionsReplacedEvent;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegionList;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ */
+public class StyleElementAdapter extends AbstractStyleSheetAdapter implements IStructuredDocumentListener {
+
+ private boolean replaceModel = true;
+ private boolean ignoreNotification = false;
+
+ /**
+ */
+ protected StyleElementAdapter() {
+ super();
+ }
+
+ /**
+ * Preparation of applying changes from CSS sub-model to HTML model
+ */
+ private void changeStructuredDocumentRegion(IStructuredDocumentRegion flatNode) {
+ if (flatNode == null)
+ return;
+ Element element = getElement();
+ if (element == null)
+ return;
+ ICSSModel model = getExistingModel();
+ if (model == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+
+ // get old content length
+ Node child = element.getFirstChild();
+ if (child == null || child.getNodeType() != Node.TEXT_NODE)
+ return;
+ XMLNode content = (XMLNode) child;
+ int oldLength = content.getEndOffset() - content.getStartOffset();
+
+ // get new content length
+ int newLength = 0;
+ IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
+ if (flatNodes != null) {
+ int count = flatNodes.getLength();
+ if (count > 0) {
+ IStructuredDocumentRegion last = flatNodes.item(count - 1);
+ if (last != null)
+ newLength = last.getEnd();
+ }
+ }
+
+ int offset = flatNode.getStart();
+ int end = flatNode.getEnd();
+ int diff = oldLength - newLength;
+ int length = end - offset + diff;
+ String data = flatNode.getText();
+
+ replaceData(offset, length, data);
+ }
+
+ /**
+ * Apply changes from HTML model to CSS sub-model
+ */
+ private void contentChanged() {
+ Element element = getElement();
+ if (element == null)
+ return;
+ ICSSModel model = getExistingModel();
+ if (model == null)
+ return;
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+
+ String data = null;
+ Node child = element.getFirstChild();
+ if (child != null && child.getNodeType() == Node.TEXT_NODE && child.getNextSibling() == null) {
+ data = child.getNodeValue();
+ }
+ if (data == null)
+ data = "";//$NON-NLS-1$
+
+ // minimize replace range
+ int start = 0, end = 0;
+ String oldData = structuredDocument.get();
+ if (oldData == null)
+ oldData = "";//$NON-NLS-1$
+
+ // search differenct character position from first
+ for (; start < oldData.length() && start < data.length(); start++)
+ if (oldData.charAt(start) != data.charAt(start))
+ break;
+
+ if (start == oldData.length() && start == data.length())
+ return; // no change
+ else if (start == oldData.length()) {
+ structuredDocument.replaceText(getRequesterH2C(), start, 0, data.substring(start)); // append text to last
+ }
+ else if (start == data.length()) {
+ structuredDocument.replaceText(getRequesterH2C(), start, oldData.length() - start, ""); // remove text of last //$NON-NLS-1$
+ }
+ else {
+ // search differenct character position from last
+ for (; start < oldData.length() - end && start < data.length() - end; end++) {
+ if (oldData.charAt(oldData.length() - end - 1) != data.charAt(data.length() - end - 1))
+ break;
+ }
+ structuredDocument.replaceText(getRequesterH2C(), start, oldData.length() - end - start, data.substring(start, data.length() - end));
+ }
+
+ }
+
+ /**
+ */
+ public ICSSModel getModel() {
+ ICSSModel model = getExistingModel();
+ if (this.replaceModel) {
+ ICSSModel oldModel = model;
+ model = createModel();
+
+ setModel(model); // need to set before contentChanged()
+ contentChanged();
+
+ if (oldModel != null) {
+ // get ModelProvideAdapter
+ IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
+ if (adapter != null) {
+ adapter.modelRemoved(oldModel);
+ }
+ }
+
+ this.replaceModel = false;
+ }
+ return model;
+ }
+
+ /**
+ */
+ protected boolean isValidAttribute() {
+ Element element = getElement();
+ if (element == null) {
+ return false;
+ }
+ String type = element.getAttribute(HTML40Namespace.ATTR_NAME_TYPE);
+ if (type != null && !type.equalsIgnoreCase("text/css")) { //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ */
+ protected ICSSModel createModel() {
+ if (!isValidAttribute()) {
+ return null;
+ }
+
+ ICSSModel model = super.createModel();
+ IStructuredDocument structuredDocument = model.getStructuredDocument();
+ if (structuredDocument == null)
+ return null;
+ structuredDocument.addDocumentChangedListener(this);
+
+ return model;
+ }
+
+ /**
+ */
+ // public ICSSModel getModel() {
+ // ICSSModel model = getExistingModel();
+ // if (model == null) {
+ // model = createModel();
+ // if (model == null) return null;
+ // IStructuredDocument structuredDocument = model.getStructuredDocument();
+ // if (structuredDocument == null) return null;
+ // structuredDocument.addModelChangedListener(this);
+ // setModel(model); // need to set before contentChanged()
+ // contentChanged();
+ // }
+ // return model;
+ // }
+ /**
+ */
+ private Object getRequesterH2C() {
+ return (getElement() != null && ((XMLNode) getElement()).getModel() != null) ? (Object) ((XMLNode) getElement()).getModel() : this;
+ }
+
+ /**
+ */
+ private Object getRequesterC2H() {
+ return (getModel() != null) ? (Object) getModel() : this;
+ }
+
+ /**
+ * Implementing IStructuredDocumentListener's method
+ * Event from CSS Flat Model
+ */
+ public void newModel(NewDocumentEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == getRequesterH2C())
+ return;
+ IStructuredDocument structuredDocument = event.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
+ if (flatNodes == null)
+ return;
+
+ replaceStructuredDocumentRegions(flatNodes, null);
+ }
+
+ /**
+ * Implementing IStructuredDocumentListener's method
+ * Event from CSS Flat Model
+ */
+ public void noChange(NoChangeEvent structuredDocumentEvent) {
+ }
+
+ /**
+ * Implementing IStructuredDocumentListener's method
+ * Event from CSS Flat Model
+ */
+ public void nodesReplaced(StructuredDocumentRegionsReplacedEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == getRequesterH2C())
+ return;
+ IStructuredDocumentRegionList oldStructuredDocumentRegions = event.getOldStructuredDocumentRegions();
+ IStructuredDocumentRegionList newStructuredDocumentRegions = event.getNewStructuredDocumentRegions();
+ if (oldStructuredDocumentRegions == null && newStructuredDocumentRegions == null)
+ return;
+
+ replaceStructuredDocumentRegions(newStructuredDocumentRegions, oldStructuredDocumentRegions);
+ }
+
+ /**
+ * Overriding INodeAdapter's method
+ * Event from <STYLE> element
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ if (this.ignoreNotification)
+ return;
+
+ if (eventType == INodeNotifier.ADD || eventType == INodeNotifier.REMOVE || eventType == INodeNotifier.CONTENT_CHANGED) {
+ contentChanged();
+ }
+ else if (eventType == INodeNotifier.CHANGE) {
+ Attr attr = (Attr) changedFeature;
+ if (attr == null)
+ return;
+ String name = attr.getName();
+ if (name.equalsIgnoreCase("type")) { //$NON-NLS-1$
+ this.replaceModel = true;
+
+ Element element = getElement();
+ if (element == null) {
+ return;
+ }
+ Document document = element.getOwnerDocument();
+ if (document == null) {
+ return;
+ }
+ HTMLDocumentAdapter adapter = (HTMLDocumentAdapter) ((INodeNotifier) document).getAdapterFor(IStyleSheetListAdapter.class);
+ if (adapter != null) {
+ adapter.childReplaced();
+ }
+ }
+ }
+ }
+
+ /**
+ * Implementing IStructuredDocumentListener's method
+ * Event from CSS Flat Model
+ */
+ public void regionChanged(RegionChangedEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == getRequesterH2C())
+ return;
+ IStructuredDocumentRegion flatNode = event.getStructuredDocumentRegion();
+ if (flatNode == null)
+ return;
+
+ changeStructuredDocumentRegion(flatNode);
+ }
+
+ /**
+ * Implementing IStructuredDocumentListener's method
+ * Event from CSS Flat Model
+ */
+ public void regionsReplaced(RegionsReplacedEvent event) {
+ if (event == null)
+ return;
+ if (event.getOriginalSource() == getRequesterH2C())
+ return;
+ IStructuredDocumentRegion flatNode = event.getStructuredDocumentRegion();
+ if (flatNode == null)
+ return;
+
+ changeStructuredDocumentRegion(flatNode);
+ }
+
+ /**
+ * Apply changes from CSS sub-model to HTML model
+ */
+ private void replaceData(int offset, int length, String data) {
+ XMLNode element = (XMLNode) getElement();
+ if (element == null)
+ return;
+ XMLModel ownerModel = element.getModel();
+ if (ownerModel == null)
+ return;
+ IStructuredDocument structuredDocument = ownerModel.getStructuredDocument();
+ if (structuredDocument == null)
+ return;
+ IStructuredDocumentRegion flatNode = element.getStartStructuredDocumentRegion();
+ if (flatNode == null)
+ return;
+
+ int contentOffset = flatNode.getEndOffset();
+ if (data == null)
+ data = "";//$NON-NLS-1$
+
+ this.ignoreNotification = true;
+ structuredDocument.replaceText(getRequesterC2H(), contentOffset + offset, length, data);
+ this.ignoreNotification = false;
+ }
+
+ /**
+ * Preparation of applying changes from CSS sub-model to HTML model
+ */
+ private void replaceStructuredDocumentRegions(IStructuredDocumentRegionList newStructuredDocumentRegions, IStructuredDocumentRegionList oldStructuredDocumentRegions) {
+ int offset = 0;
+ int length = 0;
+ if (oldStructuredDocumentRegions != null) {
+ int count = oldStructuredDocumentRegions.getLength();
+ if (count > 0) {
+ IStructuredDocumentRegion first = oldStructuredDocumentRegions.item(0);
+ if (first != null)
+ offset = first.getStart();
+ IStructuredDocumentRegion last = oldStructuredDocumentRegions.item(count - 1);
+ if (last != null)
+ length = last.getEnd() - offset;
+ }
+ }
+ String data = null;
+ if (newStructuredDocumentRegions != null) {
+ int count = newStructuredDocumentRegions.getLength();
+ if (count > 0) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < count; i++) {
+ IStructuredDocumentRegion flatNode = newStructuredDocumentRegions.item(i);
+ if (flatNode == null)
+ continue;
+ buffer.append(flatNode.getText());
+ if (i == 0)
+ offset = flatNode.getStart();
+ }
+ data = buffer.toString();
+ }
+ }
+
+ replaceData(offset, length, data);
+ }
+
+ /**
+ */
+ protected void setModel(ICSSModel model) {
+ ICSSModel oldModel = getExistingModel();
+ if (model == oldModel)
+ return;
+ super.setModel(model);
+ if (oldModel != null)
+ oldModel.removeStyleListener(this);
+ if (model != null)
+ model.addStyleListener(this);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleListener.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleListener.java
new file mode 100644
index 0000000000..c6d78326b3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/StyleListener.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+/**
+ */
+public interface StyleListener {
+
+ /**
+ */
+ void styleChanged();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLHelper.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLHelper.java
new file mode 100644
index 0000000000..e62dd0de09
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLHelper.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+/**
+ * @deprecated - use com.ibm.sse.model.css.util.URLHelper
+ */
+public class URLHelper extends org.eclipse.wst.css.core.util.URLHelper {
+
+ /**
+ * @param baseUrl
+ */
+ public URLHelper(String baseUrl) {
+ super(baseUrl);
+ }
+
+ /**
+ * @param baseUrl
+ * @param docRoot
+ */
+ public URLHelper(String baseUrl, String docRoot) {
+ super(baseUrl, docRoot);
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLModelProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLModelProvider.java
new file mode 100644
index 0000000000..df26d79a2f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/htmlcss/URLModelProvider.java
@@ -0,0 +1,448 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.htmlcss;
+
+
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.UnsupportedCharsetException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.encoding.EncodingRule;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeConstants;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.exceptions.ResourceAlreadyExists;
+import org.eclipse.wst.sse.core.exceptions.ResourceInUse;
+import org.eclipse.wst.sse.core.util.PathHelper;
+import org.eclipse.wst.sse.core.util.ProjectResolver;
+import org.eclipse.wst.sse.core.util.URIResolver;
+import org.eclipse.wst.xml.core.document.DocumentTypeAdapter;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+// TODO when this class is removed from .core, PathHelper and URLHelper class
+// also can be removed.
+
+/**
+ */
+public class URLModelProvider {
+
+ private static final int GET_MODEL_FOR_READ = 1;
+ // private static final int GET_NEW_MODEL_FOR_READ = 2;
+ private static final int GET_MODEL_FOR_EDIT = 3;
+ // private static final int GET_NEW_MODEL_FOR_EDIT = 4;
+ // private static final int READ_BUFFER_SIZE = 4096;
+ // IModelManager
+ private IModelManager modelManager = null;
+
+ /**
+ */
+ public URLModelProvider() {
+ super();
+
+ // obtain model manager
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ modelManager = plugin.getModelManager();
+ }
+
+ /**
+ * Calculate ID from a filename. This must be same as
+ * FileModelProvider.calculateId(IFile)
+ */
+ private static String calculateId(IPath fullIPath) {
+ return fullIPath.toString();
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ */
+ private IStructuredModel getCommonModelFor(final IStructuredModel baseModel, final String ref, final int which) throws IOException {
+ // first, create absolute url
+ String absURL = resolveURI(baseModel, ref, true);
+ if ((absURL == null) || (absURL.length() == 0)) {
+ return null;
+ }
+
+ // need to remove file:// scheme if necessary
+ // see com.ibm.sed.util.ProjectResolver.getLocationByURI()
+ try {
+ final java.net.URL aURL = new java.net.URL(absURL);
+ // An actual URL was given, only file:/// is supported
+ // resolve it by finding the file it points to
+ if (!aURL.getProtocol().equals("platform")) { //$NON-NLS-1$
+ if (aURL.getProtocol().equals("file") && (aURL.getHost().equals("localhost") || aURL.getHost().length() == 0)) {//$NON-NLS-2$//$NON-NLS-1$
+ absURL = aURL.getFile();
+ final IPath ipath = new Path(absURL);
+ // if path has a device, and if it begins with
+ // IPath.SEPARATOR, remove it
+ final String device = ipath.getDevice();
+ if ((device != null) && (device.length() > 0)) {
+ if (device.charAt(0) == IPath.SEPARATOR) {
+ final String newDevice = device.substring(1);
+ absURL = ipath.setDevice(newDevice).toString();
+ }
+ }
+
+ }
+ }
+ }
+ catch (java.net.MalformedURLException mfuExc) {
+ }
+
+
+ // next, decide project
+ IProject project = null;
+ final IPath fullIPath = new Path(absURL);
+ IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot();
+ IContainer container = workspace.getContainerForLocation(fullIPath);
+ if (container != null) {
+ // fullIPath doesn't exist in workspace
+ project = container.getProject();
+ }
+
+ // If HTML document has a link to an extern CSS which is not in
+ // IProject
+ // workspace.getContainerForLoation() may return null. We need to take
+ // care
+ // of this case
+
+ // now, get absURL's IFile
+ if ((project != null) && (project.getLocation().isPrefixOf(fullIPath) == false)) {
+ // it's at outside of Project
+ return null;
+ }
+
+ IStructuredModel model = null;
+ if (project != null) {
+ IPath filePath = fullIPath.removeFirstSegments(project.getLocation().segmentCount());
+ IFile file = (filePath != null && !filePath.isEmpty()) ? project.getFile(filePath) : null;
+ if (file == null) {
+ return null;
+ }
+
+ // obtain model
+ if (which == GET_MODEL_FOR_EDIT) {
+ model = getModelForEdit(file);
+ }
+ else if (which == GET_MODEL_FOR_READ) {
+ model = getModelForRead(file);
+ }
+
+ // setting synchronization stamp is IModelManager's client's
+ // responsibility
+ if (model != null && model.getSynchronizationStamp() == IResource.NULL_STAMP)
+ model.resetSynchronizationStamp(file);
+ }
+ else {
+ String id = null;
+ InputStream inStream = null;
+ // obtain resolver
+ URIResolver resolver = (project != null) ? (URIResolver) project.getAdapter(URIResolver.class) : null;
+ if (resolver == null) {
+ // ProjectResolver can take care of the case if project is
+ // null.
+ resolver = new ProjectResolver(project);
+ }
+ if (resolver == null) {
+ return null;
+ }
+
+ // there is no project. we can't expect IProject help to create
+ // id/inputStream
+ java.io.File file = fullIPath.toFile();
+
+ // obatin id
+ id = calculateId(fullIPath);
+
+ // obtain InputStream
+ try {
+ inStream = new FileInputStream(file);
+ }
+ catch (FileNotFoundException fnfe) {
+ // the file does not exist, or we don't have read permission
+ return null;
+ }
+
+ // obtain model
+ try {
+ if (which == GET_MODEL_FOR_EDIT) {
+ model = getModelManager().getModelForEdit(id, inStream, resolver);
+ }
+ else if (which == GET_MODEL_FOR_READ) {
+ model = getModelManager().getModelForRead(id, inStream, resolver);
+ }
+ }
+ catch (UnsupportedEncodingException ue) {
+ }
+ catch (IOException ioe) {
+ }
+ finally {
+ // close now !
+ if (inStream != null) {
+ inStream.close();
+ }
+ }
+ }
+
+
+ // set locationid
+ if (model != null && model.getBaseLocation() == null) {
+ model.setBaseLocation(fullIPath.toString());
+ }
+
+ return model;
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ */
+ public IStructuredModel getModelForEdit(IStructuredModel baseModel, String ref) throws IOException {
+ return getCommonModelFor(baseModel, ref, GET_MODEL_FOR_EDIT);
+ }
+
+ /**
+ */
+ private IStructuredModel getModelForEdit(IFile file) throws IOException {
+ if (file == null)
+ return null;
+ IModelManager manager = getModelManager();
+
+ // create a fake InputStream
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForEdit(file);
+ }
+ catch (UnsupportedCharsetException ex) {
+ try {
+ model = manager.getModelForEdit(file, EncodingRule.FORCE_DEFAULT);
+ }
+ catch (IOException ioe) {
+ }
+ catch (CoreException ce) {
+ }
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ */
+ public IStructuredModel getModelForRead(IStructuredModel baseModel, String ref) throws UnsupportedEncodingException, IOException {
+ return getCommonModelFor(baseModel, ref, GET_MODEL_FOR_READ);
+ }
+
+ /**
+ */
+ private IStructuredModel getModelForRead(IFile file) throws IOException {
+ if (file == null)
+ return null;
+ IModelManager manager = getModelManager();
+
+ // create a fake InputStream
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ }
+ catch (UnsupportedCharsetException ex) {
+ try {
+ model = manager.getModelForRead(file, EncodingRule.FORCE_DEFAULT);
+ }
+ catch (IOException ioe) {
+ }
+ catch (CoreException ce) {
+ }
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ /**
+ */
+ private IModelManager getModelManager() {
+ return modelManager;
+ }
+
+ public IStructuredModel getNewModelForEdit(IFile iFile) {
+ if (iFile == null)
+ return null;
+ IModelManager manager = getModelManager();
+ if (manager == null)
+ return null;
+
+ IStructuredModel model = null;
+ try {
+ model = manager.getNewModelForEdit(iFile, false);
+ }
+ catch (IOException ex) {
+ }
+ catch (ResourceInUse riu) {
+ }
+ catch (ResourceAlreadyExists rae) {
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ public IStructuredModel getNewModelForRead(IFile iFile) {
+ if (iFile == null)
+ return null;
+ IModelManager manager = getModelManager();
+ if (manager == null)
+ return null;
+
+ IStructuredModel model = null;
+ try {
+ model = manager.getNewModelForEdit(iFile, false);
+ }
+ catch (IOException ex) {
+ }
+ catch (ResourceInUse riu) {
+ }
+ catch (ResourceAlreadyExists rae) {
+ }
+ catch (CoreException ce) {
+ }
+ return model;
+ }
+
+ /**
+ * Utility to check the model is HTML family or not
+ */
+ static private boolean isHTMLFamily(IStructuredModel model) {
+ if (model instanceof XMLModel) {
+ XMLDocument document = ((XMLModel) model).getDocument();
+ DocumentTypeAdapter adapter = (DocumentTypeAdapter) document.getAdapterFor(DocumentTypeAdapter.class);
+ if (adapter != null)
+ return adapter.hasFeature(HTMLDocumentTypeConstants.HTML);
+ }
+ return false;
+ }
+
+ /**
+ * <code>baseModel</code>: the model containing the link
+ * <code>ref</code>: the link URL string
+ * <code>resolveCrossProjectLinks</code>: If resolveCrossProjectLinks
+ * is set to true, then this method will properly resolve the URI if it is
+ * a valid URI pointing to another (appropriate) project.
+ */
+ public static String resolveURI(IStructuredModel baseModel, String ref, boolean resolveCrossProjectLinks) {
+ if (baseModel == null)
+ return null;
+ // for HTML, 'href' attribute value of BASE element
+ // should be used, if exists any
+ String baseHref = null;
+ // dmw_TODO needs to be changed to handle a content model
+ // of HTML or XHTML
+ if (isHTMLFamily(baseModel)) {
+ final XMLModel xmlmodel = (XMLModel) baseModel;
+ final XMLDocument doc = xmlmodel.getDocument();
+ // look for <BASE> w/ href
+ final NodeList nl = doc.getElementsByTagName("BASE");//$NON-NLS-1$
+ if ((nl != null) && (nl.getLength() > 0)) {
+ // per each <BASE>
+ for (int i = 0; i < nl.getLength(); i++) {
+ final Node baseNode = nl.item(i);
+ if (baseNode != null) {
+ // get all attrs
+ final NamedNodeMap attrNodes = baseNode.getAttributes();
+ if (attrNodes != null) {
+ final Node attrNode = attrNodes.getNamedItem("HREF");//$NON-NLS-1$
+ if (attrNode != null) {
+ // found href=""
+ final String attrValue = attrNode.getNodeValue();
+ if (attrValue != null) {
+ baseHref = attrValue.trim();
+ }
+ }
+ }
+ }
+ // what if there are multiple <BASE> tags ??
+ if (baseHref != null) {
+ break;
+ }
+ }
+ }
+ }
+
+ // get resolver in Model
+ final URIResolver resolver = baseModel.getResolver();
+
+ // resolve to absolute url
+ final String absurl = (resolver != null) ? ((baseHref != null) ? resolver.getLocationByURI(ref, baseHref, resolveCrossProjectLinks) : resolver.getLocationByURI(ref, resolveCrossProjectLinks)) : null;
+ if ((resolver != null) && (absurl == null) && (ref != null) && (ref.trim().length() > 0) && (ref.trim().charAt(0) == '/')) {
+ // to reach here means :
+ // ref is a Docroot relative
+ // resolver can't resolve ref
+ // so that href is a broken and should not create model
+ return null;
+ }
+ if ((absurl != null) && (absurl.length() > 0)) {
+ return absurl;
+ }
+
+ // maybe ref is at outside of the Project
+ // obtain docroot;
+ final IContainer container = (resolver != null) ? resolver.getRootLocation() : null;
+ String docroot = null;
+ if (container != null) {
+ docroot = container.getLocation().toString();
+ }
+ if (docroot == null) {
+ docroot = baseModel.getBaseLocation();
+ }
+ if (docroot == null) {
+ // should not be
+ return null;
+ }
+
+ // obtain document url
+ String modelBaseLocation = baseModel.getBaseLocation();
+ if ((modelBaseLocation == null) || (modelBaseLocation.length() == 0)) {
+ // fallback...
+ modelBaseLocation = baseModel.getId();
+ }
+ if ((modelBaseLocation == null) || (modelBaseLocation.length() == 0)) {
+ // i can't resolve uri !
+ return null;
+ }
+
+ // resolve url
+ URLHelper helper = new URLHelper(PathHelper.getContainingFolderPath(modelBaseLocation), PathHelper.getContainingFolderPath(PathHelper.appendTrailingURLSlash(docroot)));
+ return helper.toAbsolute(ref);
+ }
+
+}
+
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/Logger.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/Logger.java
new file mode 100644
index 0000000000..3f109b25ac
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/Logger.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.internal;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+
+/**
+ * Small convenience class to log messages to plugin's log file and also, if desired,
+ * the console. This class should only be used by classes in this plugin. Other
+ * plugins should make their own copy, with appropriate ID.
+ */
+public class Logger {
+ private static Plugin fPlugin = HTMLCorePlugin.getDefault();
+ private static final String fPluginId = fPlugin.getDescriptor().getUniqueIdentifier();
+
+ private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
+
+ public static final int OK = IStatus.OK; // 0
+ public static final int INFO = IStatus.INFO; // 1
+ public static final int WARNING = IStatus.WARNING; // 2
+ public static final int ERROR = IStatus.ERROR; // 4
+
+ public static final int OK_DEBUG = 200 + OK;
+ public static final int INFO_DEBUG = 200 + INFO;
+ public static final int WARNING_DEBUG = 200 + WARNING;
+ public static final int ERROR_DEBUG = 200 + ERROR;
+
+ /**
+ * Adds message to log.
+ * @param level severity level of the message (OK, INFO, WARNING, ERROR, OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
+ * @param message text to add to the log
+ * @param exception exception thrown
+ */
+ protected static void _log(int level, String message, Throwable exception) {
+ if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
+ if (!isDebugging())
+ return;
+ }
+
+ int severity = IStatus.OK;
+ switch (level) {
+ case INFO_DEBUG :
+ case INFO :
+ severity = IStatus.INFO;
+ break;
+ case WARNING_DEBUG :
+ case WARNING :
+ severity = IStatus.WARNING;
+ break;
+ case ERROR_DEBUG :
+ case ERROR :
+ severity = IStatus.ERROR;
+ }
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(severity, fPluginId, severity, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+
+ /**
+ * Prints message to log if category matches /debug/tracefilter option.
+ * @param message text to print
+ * @param category category of the message, to be compared with /debug/tracefilter
+ */
+ protected static void _trace(String category, String message, Throwable exception) {
+ if (isTracing(category)) {
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(IStatus.OK, fPluginId, IStatus.OK, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+ }
+
+ /**
+ * @return true if the plugin for this logger is debugging
+ */
+ public static boolean isDebugging() {
+ return fPlugin.isDebugging();
+ }
+
+ /**
+ * Determines if currently tracing a category
+ * @param category
+ * @return true if tracing category, false otherwise
+ */
+ public static boolean isTracing(String category) {
+ if (!isDebugging())
+ return false;
+
+ String traceFilter = Platform.getDebugOption(fPluginId + TRACEFILTER_LOCATION);
+ if (traceFilter != null) {
+ StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String cat = tokenizer.nextToken().trim();
+ if (category.equals(cat)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void log(int level, String message) {
+ _log(level, message, null);
+ }
+
+ public static void log(int level, String message, Throwable exception) {
+ _log(level, message, exception);
+ }
+
+ public static void logException(String message, Throwable exception) {
+ _log(ERROR, message, exception);
+ }
+
+ public static void logException(Throwable exception) {
+ _log(ERROR, exception.getMessage(), exception);
+ }
+
+ public static void traceException(String category, String message, Throwable exception) {
+ _trace(category, message, exception);
+ }
+
+ public static void traceException(String category, Throwable exception) {
+ _trace(category, exception.getMessage(), exception);
+ }
+
+ public static void trace(String category, String message) {
+ _trace(category, message, null);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/ContentDescriberForHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/ContentDescriberForHTML.java
new file mode 100644
index 0000000000..a125eb7d65
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/ContentDescriberForHTML.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.internal.contenttype;
+
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+import org.eclipse.wst.common.encoding.AbstractContentDescriber;
+import org.eclipse.wst.common.encoding.IResourceCharsetDetector;
+
+
+public class ContentDescriberForHTML extends AbstractContentDescriber implements ITextContentDescriber {
+
+
+ protected IResourceCharsetDetector getDetector() {
+ return new HTMLResourceEncodingDetector();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizer.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizer.java
new file mode 100644
index 0000000000..7dfa6948ca
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizer.java
@@ -0,0 +1,1692 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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
+ *******************************************************************************/
+/* The following code was generated by JFlex 1.2.2 on 1/27/04 6:41 PM */
+
+/*nlsXXX*/
+package org.eclipse.wst.html.core.internal.contenttype;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.eclipse.wst.common.encoding.EncodingParserConstants;
+import org.eclipse.wst.common.encoding.HeadParserToken;
+import org.eclipse.wst.common.encoding.IntStack;
+import org.eclipse.wst.xml.core.contenttype.XMLHeadTokenizerConstants;
+
+
+
+/**
+ * This class is a scanner generated by
+ * <a href="http://www.informatik.tu-muenchen.de/~kleing/jflex/">JFlex</a> 1.2.2
+ * on 1/27/04 6:41 PM from the specification file
+ * <tt>file:/D:/DevTimeSupport/HeadParsers/HTMLHeadTokenizer/HTMLHeadTokenizer.jflex</tt>
+ */
+public class HTMLHeadTokenizer {
+
+ /** this character denotes the end of file */
+ final public static int YYEOF = -1;
+
+ /** lexical states */
+ final public static int ST_META_TAG = 4;
+ final public static int YYINITIAL = 0;
+ final public static int UnDelimitedString = 12;
+ final public static int DQ_STRING = 8;
+ final public static int SQ_STRING = 10;
+ final public static int ST_XMLDecl = 2;
+ final public static int QuotedAttributeValue = 6;
+
+ /**
+ * YY_LEXSTATE[l] is the state in the DFA for the lexical state l
+ * YY_LEXSTATE[l+1] is the state in the DFA for the lexical state l
+ * at the beginning of a line
+ * l is of the form l = 2*k, k a non negative integer
+ */
+ private final static int YY_LEXSTATE[] = {0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static String yycmap_packed = "\11\0\1\6\1\7\2\0\1\11\22\0\1\22\1\0\1\40\2\0" + "\1\44\1\0\1\43\5\0\1\34\1\0\1\42\13\0\1\45\1\12" + "\1\10\1\31\1\13\1\0\1\21\1\0\1\24\1\26\1\17\1\0" + "\1\30\1\32\1\27\2\0\1\16\1\15\1\23\1\25\1\33\1\35" + "\2\0\1\20\1\36\1\37\1\0\1\14\1\41\7\0\1\21\1\0" + "\1\24\1\26\1\17\1\0\1\30\1\32\1\27\2\0\1\16\1\15" + "\1\23\1\25\1\33\1\35\2\0\1\20\1\36\1\37\1\0\1\14" + "\1\41\101\0\1\4\3\0\1\5\17\0\1\3\16\0\1\1\20\0" + "\1\3\16\0\1\1\1\2\170\0\1\2\ufe87\0";
+
+ /**
+ * Translates characters to character classes
+ */
+ final private static char[] yycmap = yy_unpack_cmap(yycmap_packed);
+
+
+ /* error codes */
+ final private static int YY_UNKNOWN_ERROR = 0;
+ final private static int YY_ILLEGAL_STATE = 1;
+ final private static int YY_NO_MATCH = 2;
+ final private static int YY_PUSHBACK_2BIG = 3;
+
+ /* error messages for the codes above */
+ final private static String YY_ERROR_MSG[] = {"Unkown internal scanner error", "Internal error: unknown state", "Error: could not match input", "Error: pushback value was too large"};
+
+ /** the input device */
+ private java.io.Reader yy_reader;
+
+ /** the current state of the DFA */
+ private int yy_state;
+
+ /** the current lexical state */
+ private int yy_lexical_state = YYINITIAL;
+
+ /** this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ private char yy_buffer[] = new char[16384];
+
+ /** the textposition at the last accepting state */
+ private int yy_markedPos;
+
+ /** the textposition at the last state to be included in yytext */
+ private int yy_pushbackPos;
+
+ /** the current text position in the buffer */
+ private int yy_currentPos;
+
+ /** startRead marks the beginning of the yytext() string in the buffer */
+ private int yy_startRead;
+
+ /** endRead marks the last character in the buffer, that has been read
+ from input */
+ private int yy_endRead;
+
+
+ /** the number of characters up to the start of the matched text */
+ private int yychar;
+
+
+ /**
+ * yy_atBOL == true <=> the scanner is currently at the beginning of a line
+ */
+ private boolean yy_atBOL;
+
+ /** yy_atEOF == true <=> the scanner has returned a value for EOF */
+ private boolean yy_atEOF;
+
+ /** denotes if the user-EOF-code has already been executed */
+ private boolean yy_eof_done;
+
+ /* user code: */
+
+
+ private boolean hasMore = true;
+ private final static int MAX_TO_SCAN = 1000;
+ StringBuffer string = new StringBuffer();
+ // state stack for easier state handling
+ private IntStack fStateStack = new IntStack();
+ private String valueText = null;
+ boolean foundContentTypeValue = false;
+
+
+
+ public HTMLHeadTokenizer() {
+ super();
+ }
+
+ public void reset(Reader in) {
+ /* the input device */
+ yy_reader = in;
+
+ /* the current state of the DFA */
+ yy_state = 0;
+
+ /* the current lexical state */
+ yy_lexical_state = YYINITIAL;
+
+ /* this buffer contains the current text to be matched and is
+ the source of the yytext() string */
+ java.util.Arrays.fill(yy_buffer, (char) 0);
+
+ /* the textposition at the last accepting state */
+ yy_markedPos = 0;
+
+ /* the textposition at the last state to be included in yytext */
+ yy_pushbackPos = 0;
+
+ /* the current text position in the buffer */
+ yy_currentPos = 0;
+
+ /* startRead marks the beginning of the yytext() string in the buffer */
+ yy_startRead = 0;
+
+ /**
+ * endRead marks the last character in the buffer, that has been read
+ * from input
+ */
+ yy_endRead = 0;
+
+
+ /* the number of characters up to the start of the matched text */
+ yychar = 0;
+
+
+ /**
+ * yy_atBOL == true <=> the scanner is currently at the beginning
+ * of a line
+ */
+ yy_atBOL = false;
+
+ /* yy_atEOF == true <=> the scanner has returned a value for EOF */
+ yy_atEOF = false;
+
+ /* denotes if the user-EOF-code has already been executed */
+ yy_eof_done = false;
+
+
+ fStateStack.clear();
+
+ hasMore = true;
+
+ // its a little wasteful to "throw away" first char array generated
+ // by class init (via auto generated code), but we really do want
+ // a small buffer for our head parsers.
+ if (yy_buffer.length != MAX_TO_SCAN) {
+ yy_buffer = new char[MAX_TO_SCAN];
+ }
+
+
+ }
+
+
+ public final HeadParserToken getNextToken() throws IOException {
+ String context = null;
+ context = primGetNextToken();
+ HeadParserToken result = null;
+ if (valueText != null) {
+ result = createToken(context, yychar, valueText);
+ valueText = null;
+ }
+ else {
+ result = createToken(context, yychar, yytext());
+ }
+ return result;
+ }
+
+ public final boolean hasMoreTokens() {
+ return hasMore && yychar < MAX_TO_SCAN;
+ }
+
+ private void pushCurrentState() {
+ fStateStack.push(yystate());
+
+ }
+
+ private void popState() {
+ yybegin(fStateStack.pop());
+ }
+
+ private HeadParserToken createToken(String context, int start, String text) {
+ return new HeadParserToken(context, start, text);
+ }
+
+
+
+ /**
+ * Creates a new scanner
+ * There is also a java.io.InputStream version of this constructor.
+ *
+ * @param in the java.io.Reader to read input from.
+ */
+ public HTMLHeadTokenizer(java.io.Reader in) {
+ this.yy_reader = in;
+ }
+
+ /**
+ * Creates a new scanner.
+ * There is also java.io.Reader version of this constructor.
+ *
+ * @param in the java.io.Inputstream to read input from.
+ */
+ public HTMLHeadTokenizer(java.io.InputStream in) {
+ this(new java.io.InputStreamReader(in));
+ }
+
+ /**
+ * Unpacks the compressed character translation table.
+ *
+ * @param packed the packed character translation table
+ * @return the unpacked character translation table
+ */
+ private static char[] yy_unpack_cmap(String packed) {
+ char[] map = new char[0x10000];
+ int i = 0; /* index in packed string */
+ int j = 0; /* index in unpacked array */
+ while (i < 174) {
+ int count = packed.charAt(i++);
+ char value = packed.charAt(i++);
+ do
+ map[j++] = value;
+ while (--count > 0);
+ }
+ return map;
+ }
+
+
+ /**
+ * Gets the next input character.
+ *
+ * @return the next character of the input stream, EOF if the
+ * end of the stream is reached.
+ * @exception IOException if any I/O-Error occurs
+ */
+ private int yy_advance() throws java.io.IOException {
+
+ /* standard case */
+ if (yy_currentPos < yy_endRead)
+ return yy_buffer[yy_currentPos++];
+
+ /* if the eof is reached, we don't need to work hard */
+ if (yy_atEOF)
+ return YYEOF;
+
+ /* otherwise: need to refill the buffer */
+
+ /* first: make room (if you can) */
+ if (yy_startRead > 0) {
+ System.arraycopy(yy_buffer, yy_startRead, yy_buffer, 0, yy_endRead - yy_startRead);
+
+ /* translate stored positions */
+ yy_endRead -= yy_startRead;
+ yy_currentPos -= yy_startRead;
+ yy_markedPos -= yy_startRead;
+ yy_pushbackPos -= yy_startRead;
+ yy_startRead = 0;
+ }
+
+ /* is the buffer big enough? */
+ if (yy_currentPos >= yy_buffer.length) {
+ /* if not: blow it up */
+ char newBuffer[] = new char[yy_currentPos * 2];
+ System.arraycopy(yy_buffer, 0, newBuffer, 0, yy_buffer.length);
+ yy_buffer = newBuffer;
+ }
+
+ /* finally: fill the buffer with new input */
+ int numRead = yy_reader.read(yy_buffer, yy_endRead, yy_buffer.length - yy_endRead);
+
+ if (numRead == -1)
+ return YYEOF;
+
+ yy_endRead += numRead;
+
+ return yy_buffer[yy_currentPos++];
+ }
+
+
+ /**
+ * Closes the input stream.
+ */
+ final public void yyclose() throws java.io.IOException {
+ yy_atEOF = true; /* indicate end of file */
+ yy_endRead = yy_startRead; /* invalidate buffer */
+ yy_reader.close();
+ }
+
+
+ /**
+ * Returns the current lexical state.
+ */
+ final public int yystate() {
+ return yy_lexical_state;
+ }
+
+ /**
+ * Enters a new lexical state
+ *
+ * @param newState the new lexical state
+ */
+ final public void yybegin(int newState) {
+ yy_lexical_state = newState;
+ }
+
+
+ /**
+ * Returns the text matched by the current regular expression.
+ */
+ final public String yytext() {
+ return new String(yy_buffer, yy_startRead, yy_markedPos - yy_startRead);
+ }
+
+ /**
+ * Returns the length of the matched text region.
+ */
+ final public int yylength() {
+ return yy_markedPos - yy_startRead;
+ }
+
+
+ /**
+ * Reports an error that occured while scanning.
+ *
+ * @param errorCode the code of the errormessage to display
+ */
+ private void yy_ScanError(int errorCode) {
+ try {
+ System.out.println(YY_ERROR_MSG[errorCode]);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println(YY_ERROR_MSG[YY_UNKNOWN_ERROR]);
+ }
+
+ System.exit(1);
+ }
+
+
+ /**
+ * Pushes the specified amount of characters back into the input stream.
+ *
+ * They will be read again by then next call of the scanning method
+ *
+ * @param number the number of characters to be read again.
+ * This number must not be greater than yylength()!
+ */
+ private void yypushback(int number) {
+ if (number > yylength())
+ yy_ScanError(YY_PUSHBACK_2BIG);
+
+ yy_markedPos -= number;
+ }
+
+
+ /**
+ * Contains user EOF-code, which will be executed exactly once,
+ * when the end of file is reached
+ */
+ private void yy_do_eof() {
+ if (!yy_eof_done) {
+ yy_eof_done = true;
+ hasMore = false;
+
+ }
+ }
+
+
+ /**
+ * Resumes scanning until the next regular expression is matched,
+ * the end of input is encountered or an I/O-Error occurs.
+ *
+ * @return the next token
+ * @exception IOException if any I/O-Error occurs
+ */
+ public String primGetNextToken() throws java.io.IOException {
+ int yy_input;
+ int yy_action;
+
+
+ while (true) {
+
+ yychar += yylength();
+
+ yy_atBOL = yy_markedPos <= 0 || yy_buffer[yy_markedPos - 1] == '\n';
+ if (!yy_atBOL && yy_buffer[yy_markedPos - 1] == '\r') {
+ yy_atBOL = yy_advance() != '\n';
+ if (!yy_atEOF)
+ yy_currentPos--;
+ }
+
+ yy_action = -1;
+
+ yy_currentPos = yy_startRead = yy_markedPos;
+
+ if (yy_atBOL)
+ yy_state = YY_LEXSTATE[yy_lexical_state + 1];
+ else
+ yy_state = YY_LEXSTATE[yy_lexical_state];
+
+
+ yy_forAction : {
+ while (true) {
+
+ yy_input = yy_advance();
+
+ if (yy_input == YYEOF)
+ break yy_forAction;
+
+ yy_input = yycmap[yy_input];
+
+ boolean yy_isFinal = false;
+ boolean yy_noLookAhead = false;
+
+ yy_forNext : {
+ switch (yy_state) {
+ case 0 :
+ switch (yy_input) {
+ case 1 :
+ yy_isFinal = true;
+ yy_state = 9;
+ break yy_forNext;
+ case 2 :
+ yy_isFinal = true;
+ yy_state = 10;
+ break yy_forNext;
+ case 3 :
+ yy_isFinal = true;
+ yy_state = 11;
+ break yy_forNext;
+ case 10 :
+ yy_isFinal = true;
+ yy_state = 12;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 1 :
+ switch (yy_input) {
+ case 1 :
+ yy_isFinal = true;
+ yy_state = 9;
+ break yy_forNext;
+ case 2 :
+ yy_isFinal = true;
+ yy_state = 10;
+ break yy_forNext;
+ case 3 :
+ yy_isFinal = true;
+ yy_state = 11;
+ break yy_forNext;
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 13;
+ break yy_forNext;
+ case 10 :
+ yy_isFinal = true;
+ yy_state = 14;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 2 :
+ switch (yy_input) {
+ case 11 :
+ yy_isFinal = true;
+ yy_state = 15;
+ break yy_forNext;
+ case 15 :
+ yy_isFinal = true;
+ yy_state = 16;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 3 :
+ switch (yy_input) {
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 17;
+ break yy_forNext;
+ case 26 :
+ yy_isFinal = true;
+ yy_state = 18;
+ break yy_forNext;
+ case 34 :
+ yy_isFinal = true;
+ yy_state = 19;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 8;
+ break yy_forNext;
+ }
+
+ case 4 :
+ switch (yy_input) {
+ case 6 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 21;
+ break yy_forNext;
+ case 7 :
+ yy_isFinal = true;
+ yy_state = 22;
+ break yy_forNext;
+ case 32 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 23;
+ break yy_forNext;
+ case 35 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 24;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 20;
+ break yy_forNext;
+ }
+
+ case 5 :
+ switch (yy_input) {
+ case 7 :
+ case 9 :
+ case 10 :
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 26;
+ break yy_forNext;
+ case 11 :
+ case 34 :
+ yy_isFinal = true;
+ yy_state = 27;
+ break yy_forNext;
+ case 32 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 28;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 25;
+ break yy_forNext;
+ }
+
+ case 6 :
+ switch (yy_input) {
+ case 7 :
+ case 9 :
+ case 10 :
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 26;
+ break yy_forNext;
+ case 34 :
+ yy_isFinal = true;
+ yy_state = 27;
+ break yy_forNext;
+ case 35 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 28;
+ break yy_forNext;
+ case 36 :
+ yy_isFinal = true;
+ yy_state = 29;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 25;
+ break yy_forNext;
+ }
+
+ case 7 :
+ switch (yy_input) {
+ case 10 :
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 26;
+ break yy_forNext;
+ case 34 :
+ yy_isFinal = true;
+ yy_state = 27;
+ break yy_forNext;
+ case 11 :
+ yy_isFinal = true;
+ yy_state = 29;
+ break yy_forNext;
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 30;
+ break yy_forNext;
+ case 32 :
+ case 35 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 31;
+ break yy_forNext;
+ case 37 :
+ yy_isFinal = true;
+ yy_state = 32;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 25;
+ break yy_forNext;
+ }
+
+ case 9 :
+ switch (yy_input) {
+ case 2 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 33;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 10 :
+ switch (yy_input) {
+ case 1 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 34;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 11 :
+ switch (yy_input) {
+ case 4 :
+ yy_state = 35;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 12 :
+ switch (yy_input) {
+ case 13 :
+ yy_state = 36;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 13 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 37;
+ break yy_forNext;
+ case 10 :
+ yy_state = 38;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 14 :
+ switch (yy_input) {
+ case 13 :
+ yy_state = 36;
+ break yy_forNext;
+ case 11 :
+ yy_state = 39;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 15 :
+ switch (yy_input) {
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 40;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 16 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 41;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 18 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 42;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 19 :
+ switch (yy_input) {
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 43;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 21 :
+ switch (yy_input) {
+ case 6 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 21;
+ break yy_forNext;
+ case 7 :
+ yy_state = 44;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 20;
+ break yy_forNext;
+ }
+
+ case 22 :
+ switch (yy_input) {
+ case 6 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 21;
+ break yy_forNext;
+ case 7 :
+ yy_state = 44;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 20;
+ break yy_forNext;
+ }
+
+ case 27 :
+ switch (yy_input) {
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 45;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 29 :
+ switch (yy_input) {
+ case 25 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 46;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 32 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 32;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 35 :
+ switch (yy_input) {
+ case 5 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 47;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 36 :
+ switch (yy_input) {
+ case 15 :
+ yy_state = 48;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 37 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 37;
+ break yy_forNext;
+ case 10 :
+ yy_state = 38;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 38 :
+ switch (yy_input) {
+ case 11 :
+ yy_state = 39;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 39 :
+ switch (yy_input) {
+ case 12 :
+ yy_state = 49;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 41 :
+ switch (yy_input) {
+ case 20 :
+ yy_state = 50;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 42 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 51;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 44 :
+ switch (yy_input) {
+ case 6 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 21;
+ break yy_forNext;
+ case 7 :
+ yy_state = 44;
+ break yy_forNext;
+ default :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 20;
+ break yy_forNext;
+ }
+
+ case 48 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 52;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 49 :
+ switch (yy_input) {
+ case 13 :
+ yy_state = 53;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 50 :
+ switch (yy_input) {
+ case 21 :
+ yy_state = 54;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 51 :
+ switch (yy_input) {
+ case 27 :
+ yy_state = 55;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 52 :
+ switch (yy_input) {
+ case 17 :
+ yy_state = 56;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 53 :
+ switch (yy_input) {
+ case 14 :
+ yy_state = 57;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 54 :
+ switch (yy_input) {
+ case 22 :
+ yy_state = 58;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 55 :
+ switch (yy_input) {
+ case 28 :
+ yy_state = 59;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 56 :
+ switch (yy_input) {
+ case 18 :
+ yy_isFinal = true;
+ yy_noLookAhead = true;
+ yy_state = 60;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 57 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 61;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 58 :
+ switch (yy_input) {
+ case 23 :
+ yy_state = 62;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 59 :
+ switch (yy_input) {
+ case 15 :
+ yy_state = 63;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 61 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 61;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 62 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 64;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 63 :
+ switch (yy_input) {
+ case 29 :
+ yy_state = 65;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 64 :
+ switch (yy_input) {
+ case 24 :
+ yy_state = 66;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 65 :
+ switch (yy_input) {
+ case 30 :
+ yy_state = 67;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 66 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 66;
+ break yy_forNext;
+ case 8 :
+ yy_isFinal = true;
+ yy_state = 68;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 67 :
+ switch (yy_input) {
+ case 23 :
+ yy_state = 69;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 68 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 68;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 69 :
+ switch (yy_input) {
+ case 31 :
+ yy_state = 70;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 70 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 70;
+ break yy_forNext;
+ case 8 :
+ yy_state = 71;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 71 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 71;
+ break yy_forNext;
+ case 20 :
+ yy_state = 72;
+ break yy_forNext;
+ case 32 :
+ yy_state = 73;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 72 :
+ switch (yy_input) {
+ case 21 :
+ yy_state = 74;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 73 :
+ switch (yy_input) {
+ case 20 :
+ yy_state = 72;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 74 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 75;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 75 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 76;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 76 :
+ switch (yy_input) {
+ case 15 :
+ yy_state = 77;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 77 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 78;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 78 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 79;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 79 :
+ switch (yy_input) {
+ case 28 :
+ yy_state = 80;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 80 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 81;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 81 :
+ switch (yy_input) {
+ case 33 :
+ yy_state = 82;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 82 :
+ switch (yy_input) {
+ case 27 :
+ yy_state = 83;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 83 :
+ switch (yy_input) {
+ case 15 :
+ yy_state = 84;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 84 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 85;
+ break yy_forNext;
+ case 32 :
+ yy_state = 86;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 85 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 85;
+ break yy_forNext;
+ case 20 :
+ yy_state = 87;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 86 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 85;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 87 :
+ switch (yy_input) {
+ case 21 :
+ yy_state = 88;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 88 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 89;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 89 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 90;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 90 :
+ switch (yy_input) {
+ case 15 :
+ yy_state = 91;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 91 :
+ switch (yy_input) {
+ case 19 :
+ yy_state = 92;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 92 :
+ switch (yy_input) {
+ case 16 :
+ yy_state = 93;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 93 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_state = 93;
+ break yy_forNext;
+ case 8 :
+ yy_isFinal = true;
+ yy_state = 94;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ case 94 :
+ switch (yy_input) {
+ case 6 :
+ case 7 :
+ case 9 :
+ case 18 :
+ yy_isFinal = true;
+ yy_state = 94;
+ break yy_forNext;
+ default :
+ break yy_forAction;
+ }
+
+ default :
+ yy_ScanError(YY_ILLEGAL_STATE);
+ break;
+ }
+ }
+
+ if (yy_isFinal) {
+ yy_action = yy_state;
+ yy_markedPos = yy_currentPos;
+ if (yy_noLookAhead)
+ break yy_forAction;
+ }
+
+ }
+ }
+
+
+ switch (yy_action) {
+
+ case 26 :
+ {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 96 :
+ break;
+ case 20 :
+ case 21 :
+ {
+ yypushback(1);
+ yybegin(UnDelimitedString);
+ string.setLength(0);
+ }
+ case 97 :
+ break;
+ case 17 :
+ {
+ yybegin(YYINITIAL);
+ if (foundContentTypeValue)
+ hasMore = false;
+ return HTMLHeadTokenizerConstants.MetaTagEnd;
+ }
+ case 98 :
+ break;
+ case 31 :
+ {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue;
+ }
+ case 99 :
+ break;
+ case 43 :
+ {
+ yybegin(YYINITIAL);
+ if (foundContentTypeValue)
+ hasMore = false;
+ return HTMLHeadTokenizerConstants.MetaTagEnd;
+ }
+ case 100 :
+ break;
+ case 45 :
+ {
+ yypushback(2);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 101 :
+ break;
+ case 46 :
+ {
+ yypushback(2);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.InvalidTerminatedStringValue;
+ }
+ case 102 :
+ break;
+ case 61 :
+ {
+ if (yychar == 0) {
+ yybegin(ST_XMLDecl);
+ return XMLHeadTokenizerConstants.XMLDeclStart;
+ }
+ }
+ case 103 :
+ break;
+ case 8 :
+ case 9 :
+ case 10 :
+ case 11 :
+ case 12 :
+ case 13 :
+ case 14 :
+ case 15 :
+ case 16 :
+ case 18 :
+ case 19 :
+ case 22 :
+ {
+ if (yychar > MAX_TO_SCAN) {
+ hasMore = false;
+ return EncodingParserConstants.MAX_CHARS_REACHED;
+ }
+ }
+ case 104 :
+ break;
+ case 60 :
+ {
+ yybegin(ST_META_TAG);
+ return HTMLHeadTokenizerConstants.MetaTagStart;
+ }
+ case 105 :
+ break;
+ case 40 :
+ {
+ yybegin(YYINITIAL);
+ return XMLHeadTokenizerConstants.XMLDeclEnd;
+ }
+ case 106 :
+ break;
+ case 94 :
+ {
+ pushCurrentState();
+ yybegin(QuotedAttributeValue);
+ foundContentTypeValue = true;
+ return HTMLHeadTokenizerConstants.MetaTagContentType;
+ }
+ case 107 :
+ break;
+ case 68 :
+ {
+ pushCurrentState();
+ yybegin(QuotedAttributeValue);
+ return XMLHeadTokenizerConstants.XMLDelEncoding;
+ }
+ case 108 :
+ break;
+ case 33 :
+ {
+ hasMore = false;
+ return EncodingParserConstants.UTF16BE;
+ }
+ case 109 :
+ break;
+ case 34 :
+ {
+ hasMore = false;
+ return EncodingParserConstants.UTF16LE;
+ }
+ case 110 :
+ break;
+ case 47 :
+ {
+ hasMore = false;
+ return EncodingParserConstants.UTF83ByteBOM;
+ }
+ case 111 :
+ break;
+ case 28 :
+ {
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.StringValue;
+ }
+ case 112 :
+ break;
+ case 25 :
+ case 27 :
+ case 29 :
+ case 32 :
+ {
+ string.append(yytext());
+ }
+ case 113 :
+ break;
+ case 24 :
+ {
+ yybegin(SQ_STRING);
+ string.setLength(0);
+ }
+ case 114 :
+ break;
+ case 23 :
+ {
+ yybegin(DQ_STRING);
+ string.setLength(0);
+ }
+ case 115 :
+ break;
+ case 30 :
+ {
+ yypushback(1);
+ popState();
+ valueText = string.toString();
+ return EncodingParserConstants.UnDelimitedStringValue;
+ }
+ case 116 :
+ break;
+ default :
+ if (yy_input == YYEOF && yy_startRead == yy_currentPos) {
+ yy_atEOF = true;
+ yy_do_eof();
+ {
+ hasMore = false;
+ return EncodingParserConstants.EOF;
+ }
+ }
+ else {
+ yy_ScanError(YY_NO_MATCH);
+ }
+ }
+ }
+ }
+
+ /**
+ * Runs the scanner on input files.
+ *
+ * This main method is the debugging routine for the scanner.
+ * It prints each returned token to System.out until the end of
+ * file is reached, or an error occured.
+ *
+ * @param argv the command line, contains the filenames to run
+ * the scanner on.
+ */
+ public static void main(String argv[]) {
+ for (int i = 0; i < argv.length; i++) {
+ HTMLHeadTokenizer scanner = null;
+ try {
+ scanner = new HTMLHeadTokenizer(new java.io.FileReader(argv[i]));
+ }
+ catch (java.io.FileNotFoundException e) {
+ System.out.println("File not found : \"" + argv[i] + "\"");
+ System.exit(1);
+ }
+ catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("Usage : java HTMLHeadTokenizer <inputfile>");
+ System.exit(1);
+ }
+
+ try {
+ do {
+ System.out.println(scanner.primGetNextToken());
+ }
+ while (!scanner.yy_atEOF);
+
+ }
+ catch (java.io.IOException e) {
+ System.out.println("An I/O error occured while scanning :");
+ System.out.println(e);
+ System.exit(1);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizerConstants.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizerConstants.java
new file mode 100644
index 0000000000..938bcde421
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLHeadTokenizerConstants.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.internal.contenttype;
+
+
+public interface HTMLHeadTokenizerConstants {
+
+ String MetaTagEnd = "MetaTagEnd"; //$NON-NLS-1$
+ String MetaTagStart = "MetaTagStart"; //$NON-NLS-1$
+ String MetaTagContentType = "MetaTagContentType"; //$NON-NLS-1$
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLResourceEncodingDetector.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLResourceEncodingDetector.java
new file mode 100644
index 0000000000..504a2758f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/HTMLResourceEncodingDetector.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.internal.contenttype;
+
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+import org.eclipse.wst.common.encoding.AbstractResourceEncodingDetector;
+import org.eclipse.wst.common.encoding.CodedIO;
+import org.eclipse.wst.common.encoding.EncodingGuesser;
+import org.eclipse.wst.common.encoding.EncodingMemento;
+import org.eclipse.wst.common.encoding.EncodingParserConstants;
+import org.eclipse.wst.common.encoding.HeadParserToken;
+import org.eclipse.wst.common.encoding.IResourceCharsetDetector;
+
+public class HTMLResourceEncodingDetector extends AbstractResourceEncodingDetector implements IResourceCharsetDetector {
+
+ private HTMLHeadTokenizer fTokenizer;
+
+ /**
+ * There is no spec defined encoding for HTML (historically), so null is
+ * returned.
+ */
+ public String getSpecDefaultEncoding() {
+ return null;
+ }
+
+ private boolean canHandleAsUnicodeStream(String tokenType) {
+ boolean canHandleAsUnicodeStream = false;
+ if (tokenType == EncodingParserConstants.UTF83ByteBOM) {
+ canHandleAsUnicodeStream = true;
+ String enc = "UTF-8"; //$NON-NLS-1$
+ createEncodingMemento(enc, EncodingMemento.DETECTED_STANDARD_UNICODE_BYTES);
+ fEncodingMemento.setUTF83ByteBOMUsed(true);
+ }
+ else if (tokenType == EncodingParserConstants.UTF16BE) {
+ canHandleAsUnicodeStream = true;
+ String enc = "UTF-16BE"; //$NON-NLS-1$
+ createEncodingMemento(enc, EncodingMemento.DETECTED_STANDARD_UNICODE_BYTES);
+ }
+ else if (tokenType == EncodingParserConstants.UTF16LE) {
+ canHandleAsUnicodeStream = true;
+ String enc = "UTF-16"; //$NON-NLS-1$
+ createEncodingMemento(enc, EncodingMemento.DETECTED_STANDARD_UNICODE_BYTES);
+ }
+ return canHandleAsUnicodeStream;
+ }
+
+ /**
+ * @return Returns the tokenizer.
+ */
+ private HTMLHeadTokenizer getTokenizer() {
+ // TODO: need to work on 'reset' in tokenizer, so new instance isn't
+ // always needed
+ //if (fTokenizer == null) {
+ fTokenizer = new HTMLHeadTokenizer();
+ // }
+ return fTokenizer;
+ }
+
+ private boolean isLegalString(String valueTokenType) {
+ if (valueTokenType == null)
+ return false;
+ else
+ return valueTokenType.equals(EncodingParserConstants.StringValue) || valueTokenType.equals(EncodingParserConstants.UnDelimitedStringValue) || valueTokenType.equals(EncodingParserConstants.InvalidTerminatedStringValue) || valueTokenType.equals(EncodingParserConstants.InvalidTermintatedUnDelimitedStringValue);
+ }
+
+ protected void parseInput() throws IOException {
+ checkInContent();
+ if (fEncodingMemento == null) {
+ checkHeuristics();
+ }
+ }
+
+ /**
+ *
+ */
+ private void checkHeuristics() throws IOException {
+ boolean noHeuristic = false;
+ String heuristicEncoding = null;
+ try {
+ fReader.reset();
+ fReader.mark(CodedIO.MAX_MARK_SIZE);
+ byte[] bytes = new byte[CodedIO.MAX_MARK_SIZE];
+ int nRead = 0;
+ for (int i = 0; i < bytes.length; i++) {
+ if (fReader.ready()) {
+ int oneByte = fReader.read();
+ nRead++;
+ if (oneByte <= 0xFF) {
+ bytes[i] = (byte) oneByte;
+ }
+ else {
+ noHeuristic = true;
+ break;
+ }
+ }
+ else {
+ break;
+ }
+ }
+ if (!noHeuristic) {
+ heuristicEncoding = EncodingGuesser.guessEncoding(bytes, nRead);
+ }
+ }
+ catch (IOException e) {
+ // if any IO exception, then not a heuristic case
+ }
+ finally {
+ fReader.reset();
+ }
+ if (heuristicEncoding != null) {
+ createEncodingMemento(heuristicEncoding, EncodingMemento.GUESSED_ENCODING_FROM_STREAM);
+ }
+
+ }
+
+ private void checkInContent() throws IOException {
+ HTMLHeadTokenizer tokenizer = getTokenizer();
+ tokenizer.reset(fReader);
+ HeadParserToken token = null;
+ String tokenType = null;
+ String contentTypeValue = null;
+ do {
+ token = tokenizer.getNextToken();
+ tokenType = token.getType();
+ if (canHandleAsUnicodeStream(tokenType)) {
+ // side effect of canHandle is to create appropriate
+ // memento
+ }
+ else if (tokenType == HTMLHeadTokenizerConstants.MetaTagContentType) {
+ if (tokenizer.hasMoreTokens()) {
+ HeadParserToken valueToken = tokenizer.getNextToken();
+ String valueTokenType = valueToken.getType();
+ if (isLegalString(valueTokenType)) {
+ contentTypeValue = valueToken.getText();
+
+ }
+ }
+ }
+
+ }
+ while (tokenizer.hasMoreTokens());
+ if (contentTypeValue != null) {
+ parseContentTypeValue(contentTypeValue);
+ }
+ }
+
+ private void parseContentTypeValue(String contentType) {
+ String charset = null;
+ Pattern pattern = Pattern.compile(";\\s*charset\\s*=\\s*"); //$NON-NLS-1$
+ String[] parts = pattern.split(contentType);
+ if (parts.length > 0) {
+ // if only one item, it can still be charset instead of
+ // contentType
+ if (parts.length == 1) {
+ if (parts[0].length() > 6) {
+ String checkForCharset = parts[0].substring(0, 7);
+ if (checkForCharset.equalsIgnoreCase("charset")) { //$NON-NLS-1$
+ int eqpos = parts[0].indexOf('=');
+ eqpos = eqpos + 1;
+ if (eqpos < parts[0].length()) {
+ charset = parts[0].substring(eqpos);
+ charset = charset.trim();
+ }
+ }
+ }
+ }
+ else {
+ //fContentType = parts[0];
+ }
+ }
+ if (parts.length > 1) {
+ charset = parts[1];
+ }
+
+ if (charset != null && charset.length() > 0) {
+ createEncodingMemento(charset, EncodingMemento.FOUND_ENCODING_IN_CONTENT);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/nls/ResourceHandler.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/nls/ResourceHandler.java
new file mode 100644
index 0000000000..c164012219
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/nls/ResourceHandler.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.internal.nls;
+
+
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ResourceHandler {
+
+
+ private static ResourceBundle fgResourceBundle;
+
+ /**
+ * Returns the resource bundle used by all classes in this Project
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("ModelsHTML");//$NON-NLS-1$
+ }
+ catch (MissingResourceException e) {
+ // does nothing - this method will return null and
+ // getString(String) will return the key
+ // it was called with
+ }
+ return null;
+ }
+
+ public static String getString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle = getResourceBundle();
+ }
+
+ if (fgResourceBundle != null) {
+ try {
+ return fgResourceBundle.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ else {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+
+ public static String getString(String key, Object[] args) {
+
+ try {
+ return MessageFormat.format(getString(key), args);
+ }
+ catch (IllegalArgumentException e) {
+ return getString(key);
+ }
+
+ }
+
+ public static String getString(String key, Object[] args, int x) {
+
+ return getString(key);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/rules/StructuredTextPartitionerForHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/rules/StructuredTextPartitionerForHTML.java
new file mode 100644
index 0000000000..0d501b9dfc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/text/rules/StructuredTextPartitionerForHTML.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.internal.text.rules;
+
+import java.util.Locale;
+
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.wst.css.core.internal.text.rules.StructuredTextPartitionerForCSS;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.sse.core.internal.parser.ForeignRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.IStructuredTextPartitioner;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.core.text.StructuredTypedRegion;
+import org.eclipse.wst.sse.core.util.ScriptLanguageKeys;
+import org.eclipse.wst.sse.core.util.StringUtils;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.eclipse.wst.xml.core.text.rules.StructuredTextPartitionerForXML;
+
+/**
+ * Document partitioner for HTML. Client-side scripts of type JavaScript are
+ * reported as ST_SCRIPT, all others for <script language="foo" type="foo2">
+ * as SCRIPT.language:FOO and SCRIPT.type:FOO2.
+ */
+public class StructuredTextPartitionerForHTML extends StructuredTextPartitionerForXML implements IStructuredTextPartitioner {
+
+ public final static String ST_DEFAULT_HTML = "org.eclipse.wst.html.DEFAULT_HTML"; //$NON-NLS-1$
+ public final static String ST_HTML_DECLARATION = "org.eclipse.wst.html.HTML_DECLARATION"; //$NON-NLS-1$
+ public final static String ST_HTML_COMMENT = "org.eclipse.wst.htmlHTML_COMMENT"; //$NON-NLS-1$
+ public final static String ST_SCRIPT = "org.eclipse.wst.html.SCRIPT"; //$NON-NLS-1$
+ private final static String[] configuredContentTypes = new String[]{ST_DEFAULT_HTML, ST_HTML_DECLARATION, ST_HTML_COMMENT, ST_SCRIPT, StructuredTextPartitionerForCSS.ST_STYLE};
+
+ public static final String JAVASCRIPT = "javascript"; //$NON-NLS-1$
+ public static final String JAVASCRIPT_APPLICATION = "application/x-javascript"; //$NON-NLS-1$
+
+
+ /**
+ * Constructor for JSPDocumentPartioner.
+ */
+ public StructuredTextPartitionerForHTML() {
+ super();
+ }
+
+ public StructuredTypedRegion createPartition(int offset, int length, String type) {
+ if (type == ST_SCRIPT) {
+ IStructuredDocumentRegion node = structuredDocument.getRegionAtCharacterOffset(offset);
+ if (node != null) {
+ String stype = getScriptingPartitionType(node);
+ return super.createPartition(offset, length, stype);
+ }
+ }
+ return super.createPartition(offset, length, type);
+ }
+
+ /**
+ * @see com.ibm.sed.structuredDocument.partition.StructuredTextPartitioner#createPartition(int,
+ * int, java.lang.String)
+ */
+ protected void setInternalPartition(int offset, int length, String type) {
+ String localType = type;
+ if (type == ST_SCRIPT) {
+ IStructuredDocumentRegion node = structuredDocument.getRegionAtCharacterOffset(offset);
+ if (node != null) {
+ localType = getScriptingPartitionType(node);
+ }
+ }
+ super.setInternalPartition(offset, length, localType);
+ }
+
+ private String getScriptingPartitionType(IStructuredDocumentRegion coreNode) {
+ String language = null;
+ String type = null;
+ String result = ST_SCRIPT;
+ IStructuredDocumentRegion node = coreNode;
+ ITextRegion attrNameRegion = null;
+ while (node != null && isValidScriptingRegionType(node.getType())) {
+ node = node.getPrevious();
+ }
+
+ ITextRegionList regions = node.getRegions();
+ if (regions.size() > 4 && regions.get(1).getType() == XMLRegionContext.XML_TAG_NAME) {
+ ITextRegion potentialLanguageRegion = regions.get(1);
+ String potentialLanguageString = node.getText(potentialLanguageRegion);
+ if (potentialLanguageString.equalsIgnoreCase(HTML40Namespace.ElementName.SCRIPT)) {
+ for (int i = 0; i < regions.size(); i++) {
+ ITextRegion region = regions.get(i);
+ String regionType = region.getType();
+ if (regionType == XMLRegionContext.XML_TAG_ATTRIBUTE_NAME)
+ attrNameRegion = region;
+ else if (regionType == XMLRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
+ String attrName = node.getText(attrNameRegion);
+ if (attrName.equalsIgnoreCase(HTML40Namespace.ATTR_NAME_LANGUAGE))
+ language = StringUtils.strip(node.getText(region));
+ else if (attrName.equalsIgnoreCase(HTML40Namespace.ATTR_NAME_TYPE)) {
+ type = StringUtils.strip(node.getText(region));
+ break;
+ }
+ attrNameRegion = null;
+ }
+ }
+ }
+ }
+ if (type != null)
+ result = lookupScriptType(type);
+ else if (language != null)
+ result = lookupScriptLanguage(language);
+ return result;
+ }
+
+ private boolean isValidScriptingRegionType(String type) {
+ return type == XMLRegionContext.BLOCK_TEXT || type == XMLRegionContext.XML_CDATA_OPEN || type == XMLRegionContext.XML_CDATA_TEXT || type == XMLRegionContext.XML_CDATA_CLOSE;
+ }
+
+ protected void initLegalContentTypes() {
+ fSupportedTypes = getConfiguredContentTypes();
+ }
+
+ private String lookupScriptType(String type) {
+ for (int i = 0; i < ScriptLanguageKeys.JAVASCRIPT_MIME_TYPE_KEYS.length; i++)
+ if (ScriptLanguageKeys.JAVASCRIPT_MIME_TYPE_KEYS[i].equalsIgnoreCase(type))
+ return ST_SCRIPT;
+ return "SCRIPT.type:" + type.toUpperCase(Locale.ENGLISH); //$NON-NLS-1$
+ }
+
+ private String lookupScriptLanguage(String language) {
+ for (int i = 0; i < ScriptLanguageKeys.JAVASCRIPT_LANGUAGE_KEYS.length; i++)
+ if (ScriptLanguageKeys.JAVASCRIPT_LANGUAGE_KEYS[i].equalsIgnoreCase(language))
+ return ST_SCRIPT;
+ return "SCRIPT.language:" + language.toUpperCase(Locale.ENGLISH); //$NON-NLS-1$
+ }
+
+ /**
+ * @see com.ibm.sed.model.StructuredTextPartitioner#getPartitionType(com.ibm.sed.structuredDocument.ITextRegion)
+ */
+ public String getPartitionType(ITextRegion region, int offset) {
+ String result = null;
+ if (region.getType() == XMLRegionContext.XML_COMMENT_TEXT || region.getType() == XMLRegionContext.XML_COMMENT_OPEN)
+ result = ST_HTML_COMMENT;
+ else if (region.getType() == XMLRegionContext.XML_DOCTYPE_DECLARATION || region.getType() == XMLRegionContext.XML_DECLARATION_OPEN)
+ result = ST_HTML_DECLARATION;
+ else
+ result = super.getPartitionType(region, offset);
+ return result;
+ }
+
+ /**
+ * @see com.ibm.sed.structuredDocument.partition.StructuredTextPartitioner#getPartitionTypeBetween(com.ibm.sed.structuredDocument.ITextRegion,
+ * com.ibm.sed.structuredDocument.ITextRegion)
+ */
+ public String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, ITextRegion previousStartTagNameRegion, IStructuredDocumentRegion nextNode, ITextRegion nextEndTagNameRegion) {
+ String name1 = previousNode.getText(previousStartTagNameRegion);
+ String name2 = nextNode.getText(nextEndTagNameRegion);
+ if (name1.equalsIgnoreCase(HTML40Namespace.ElementName.SCRIPT) && name2.equalsIgnoreCase(HTML40Namespace.ElementName.SCRIPT))
+ // return ST_SCRIPT;
+ return getScriptingPartitionType(structuredDocument.getRegionAtCharacterOffset(previousNode.getStartOffset(previousStartTagNameRegion)));
+ else if (name1.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE) && name2.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE))
+ return StructuredTextPartitionerForCSS.ST_STYLE;
+ return super.getPartitionTypeBetween(previousNode, previousStartTagNameRegion, nextNode, nextEndTagNameRegion);
+ }
+
+
+ protected String getPartitionType(ForeignRegion region, int offset) {
+ String tagname = region.getSurroundingTag();
+ String result = null;
+ // tagname should not be null,
+ // but see https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=4911
+ if (tagname == null) {
+ result = getUnknown();
+ }
+ else if (tagname.equalsIgnoreCase(HTML40Namespace.ElementName.SCRIPT))
+ result = ST_SCRIPT;
+ else if (tagname.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE))
+ result = StructuredTextPartitionerForCSS.ST_STYLE;
+ else
+ result = super.getPartitionType(region, offset);
+
+ return result;
+ }
+
+ public String getDefault() {
+ return ST_DEFAULT_HTML;
+ }
+
+ public IDocumentPartitioner newInstance() {
+ return new StructuredTextPartitionerForHTML();
+ }
+
+ /**
+ * @return
+ */
+ public static String[] getConfiguredContentTypes() {
+ return configuredContentTypes;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/EmbeddedHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/EmbeddedHTML.java
new file mode 100644
index 0000000000..daeb2164e3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/EmbeddedHTML.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelhandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeAdapterFactory;
+import org.eclipse.wst.html.core.document.HTMLModelParserAdapterFactory;
+import org.eclipse.wst.html.core.htmlcss.HTMLStyleSelectorAdapterFactory;
+import org.eclipse.wst.html.core.htmlcss.StyleAdapterFactory;
+import org.eclipse.wst.html.core.modelquery.ModelQueryAdapterFactoryForEmbeddedHTML;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.IFactoryRegistry;
+import org.eclipse.wst.sse.core.modelhandler.EmbeddedTypeHandler;
+import org.eclipse.wst.sse.core.parser.BlockMarker;
+import org.eclipse.wst.sse.core.parser.BlockTagParser;
+import org.eclipse.wst.sse.core.parser.JSPCapableParser;
+import org.eclipse.wst.sse.core.util.Assert;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+
+public class EmbeddedHTML implements EmbeddedTypeHandler {
+ public String ContentTypeID_EmbeddedHTML = "org.eclipse.wst.html.core.internal.contenttype.EmbeddedHTML"; //$NON-NLS-1$
+
+ private List supportedMimeTypes;
+
+ /**
+ * Constructor for EmbeddedHTML.
+ */
+ public EmbeddedHTML() {
+ super();
+ }
+
+ /**
+ * Convenience method to add tag names using BlockMarker object
+ */
+ protected void addHTMLishTag(BlockTagParser parser, String tagname) {
+ BlockMarker bm = new BlockMarker(tagname, null, XMLRegionContext.BLOCK_TEXT, false);
+ parser.addBlockMarker(bm);
+ }
+
+ /**
+ * @see EmbeddedContentType#getFamilyId()
+ */
+ public String getFamilyId() {
+ return ModelHandlerForHTML.AssociatedContentTypeID;
+ }
+
+ /*
+ * Only "model side" embedded factories can be added here.
+ */
+ public List getAdapterFactories() {
+ List factories = new ArrayList();
+ factories.add(new ModelQueryAdapterFactoryForEmbeddedHTML());
+ // factories.addAll(PluginContributedFactoryReader.getInstance().getFactories(this));
+ return factories;
+ }
+
+ /*
+ * @see EmbeddedContentType#initializeParser(RegionParser)
+ */
+ public void initializeParser(JSPCapableParser parser) {
+ addHTMLishTag(parser, "script"); //$NON-NLS-1$
+ addHTMLishTag(parser, "style"); //$NON-NLS-1$
+ }
+
+ public List getSupportedMimeTypes() {
+ if (supportedMimeTypes == null) {
+ supportedMimeTypes = new ArrayList();
+ supportedMimeTypes.add("text/html"); //$NON-NLS-1$
+ supportedMimeTypes.add("text/xhtml"); //$NON-NLS-1$
+ supportedMimeTypes.add("application/xhtml+xml"); //$NON-NLS-1$
+ supportedMimeTypes.add("application/xml"); //$NON-NLS-1$
+ supportedMimeTypes.add("text/vnd.wap.wml"); //$NON-NLS-1$
+ }
+ return supportedMimeTypes;
+ }
+
+ public void initializeFactoryRegistry(IFactoryRegistry registry) {
+ Assert.isNotNull(registry);
+ AdapterFactory factory = HTMLDocumentTypeAdapterFactory.getInstance();
+ registry.addFactory(factory);
+ factory = HTMLModelParserAdapterFactory.getInstance();
+ registry.addFactory(factory);
+ factory = StyleAdapterFactory.getInstance();
+ registry.addFactory(factory);
+ factory = HTMLStyleSelectorAdapterFactory.getInstance();
+ registry.addFactory(factory);
+ }
+
+ public void uninitializeFactoryRegistry(IFactoryRegistry registry) {
+ Assert.isNotNull(registry);
+ // note this BIG assumption about factory singletons!
+ // for this particular list, they are, but may not
+ // be in future.
+
+ AdapterFactory factory = HTMLDocumentTypeAdapterFactory.getInstance();
+ factory.release();
+ registry.removeFactory(factory);
+
+ factory = HTMLModelParserAdapterFactory.getInstance();
+ factory.release();
+ registry.removeFactory(factory);
+
+ factory = StyleAdapterFactory.getInstance();
+ factory.release();
+ registry.removeFactory(factory);
+
+ factory = HTMLStyleSelectorAdapterFactory.getInstance();
+ factory.release();
+ registry.removeFactory(factory);
+ }
+
+ public void uninitializeParser(JSPCapableParser parser) {
+ // I'm assuming block markers are unique based on name only
+ // we add these as full BlockMarkers, but remove based on name alone.
+ parser.removeBlockMarker("script"); //$NON-NLS-1$
+ parser.removeBlockMarker("script"); //$NON-NLS-1$
+ }
+
+ public EmbeddedTypeHandler newInstance() {
+ return new EmbeddedHTML();
+ }
+
+ /**
+ * will someday be controlled via extension point
+ */
+ public boolean isDefault() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/ModelHandlerForHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/ModelHandlerForHTML.java
new file mode 100644
index 0000000000..dd27aecfe7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelhandler/ModelHandlerForHTML.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelhandler;
+
+import org.eclipse.wst.html.core.encoding.HTMLDocumentCharsetDetector;
+import org.eclipse.wst.html.core.encoding.HTMLDocumentLoader;
+import org.eclipse.wst.html.core.encoding.HTMLModelLoader;
+import org.eclipse.wst.sse.core.ModelLoader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+import org.eclipse.wst.sse.core.document.IDocumentLoader;
+import org.eclipse.wst.sse.core.modelhandler.AbstractModelHandler;
+import org.eclipse.wst.sse.core.modelhandler.IModelHandler;
+
+public class ModelHandlerForHTML extends AbstractModelHandler implements IModelHandler {
+ /**
+ * Needs to match what's in plugin registry.
+ * In fact, can be overwritten at run time with
+ * what's in registry! (so should never be 'final')
+ */
+ static String AssociatedContentTypeID = "org.eclipse.wst.html.core.htmlsource"; //$NON-NLS-1$
+ /**
+ * Needs to match what's in plugin registry.
+ * In fact, can be overwritten at run time with
+ * what's in registry! (so should never be 'final')
+ */
+ private static String ModelHandlerID_HTML = "org.eclipse.wst.html.core.modelhandler"; //$NON-NLS-1$
+
+
+ public ModelHandlerForHTML() {
+ super();
+ setId(ModelHandlerID_HTML);
+ setAssociatedContentTypeId(AssociatedContentTypeID);
+ }
+
+ public ModelLoader getModelLoader() {
+ return new HTMLModelLoader();
+ }
+
+ public IDocumentCharsetDetector getEncodingDetector() {
+ return new HTMLDocumentCharsetDetector();
+ }
+
+ public IDocumentLoader getDocumentLoader() {
+ return new HTMLDocumentLoader();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMAttributeDeclarationBuddySystem.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMAttributeDeclarationBuddySystem.java
new file mode 100644
index 0000000000..9d38dad87c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMAttributeDeclarationBuddySystem.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+import java.util.Enumeration;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+
+/**
+ */
+class CMAttributeDeclarationBuddySystem extends CMNodeBuddySystem implements CMAttributeDeclaration {
+
+
+ public CMAttributeDeclarationBuddySystem(CMAttributeDeclaration self, CMAttributeDeclaration buddy, boolean isXHTML) {
+ super(self, buddy, isXHTML);
+ }
+
+ /*
+ * @see CMAttributeDeclaration#getAttrName()
+ */
+ public String getAttrName() {
+ return getSelf().getAttrName();
+ }
+
+ /*
+ * @see CMAttributeDeclaration#getAttrType()
+ */
+ public CMDataType getAttrType() {
+ return getSelf().getAttrType();
+ }
+
+ /*
+ * @see CMAttributeDeclaration#getDefaultValue()
+ * @deprecated in superclass
+ */
+ public String getDefaultValue() {
+ return getSelf().getDefaultValue();
+ }
+
+ /*
+ * @see CMAttributeDeclaration#getEnumAttr()
+ * @deprecated in superclass
+ */
+ public Enumeration getEnumAttr() {
+ return getSelf().getEnumAttr();
+ }
+
+ /*
+ * @see CMAttributeDeclaration#getUsage()
+ */
+ public int getUsage() {
+ return getSelf().getUsage();
+ }
+
+ private CMAttributeDeclaration getSelf() {
+ return (CMAttributeDeclaration) self;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMDocumentForBuddySystem.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMDocumentForBuddySystem.java
new file mode 100644
index 0000000000..b63c6a6116
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMDocumentForBuddySystem.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNamespace;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocumentFactory;
+import org.eclipse.wst.html.core.contentmodel.ssi.SSICMDocumentFactory;
+import org.eclipse.wst.sse.core.contentmodel.CMDocType;
+
+/**
+ */
+class CMDocumentForBuddySystem extends CMNodeBuddySystem implements CMDocument {
+
+
+ private static CMDocument getHTMLCMDocument() {
+ return HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);
+ }
+
+ class Elements extends CMNamedNodeMapForBuddySystem {
+ public Elements(CMNamedNodeMap elements, boolean isXHTML) {
+ super(isXHTML);
+ makeBuddySystem(elements);
+ addSSIDecls();
+ }
+
+ protected String getKeyName(CMNode original) {
+ CMElementDeclaration edecl = getDecl(original);
+ if (edecl == null)
+ return null;
+ return edecl.getElementName();
+ }
+
+ protected CMNode createBuddySystem(CMNode original) {
+ CMElementDeclaration edecl = getDecl(original);
+ return new CMElementDeclarationBuddySystem(edecl, isXHTML());
+ }
+
+ private CMElementDeclaration getDecl(CMNode cmnode) {
+ if (cmnode == null)
+ return null;
+ if (cmnode.getNodeType() != CMNode.ELEMENT_DECLARATION)
+ return null;
+ return (CMElementDeclaration) cmnode;
+ }
+
+ private void addSSIDecls() {
+ CMDocument ssi = SSICMDocumentFactory.getCMDocument();
+ if (ssi == null)
+ return;
+ CMNamedNodeMap elements = ssi.getElements();
+ Iterator i = elements.iterator();
+ while (i.hasNext()) {
+ CMElementDeclaration decl = (CMElementDeclaration) i.next();
+ if (decl == null)
+ continue;
+ put(decl.getElementName(), decl);
+ }
+ }
+ }
+
+ private Elements elements = null;
+
+ public CMDocumentForBuddySystem(CMDocument self, boolean isXHTML) {
+ super(self, getHTMLCMDocument(), isXHTML);
+ }
+
+ /*
+ * @see CMDocument#getElements()
+ */
+ public CMNamedNodeMap getElements() {
+ if (elements != null)
+ return elements;
+ CMDocument cmdoc = getSelf();
+ if (cmdoc == null)
+ return null;
+ elements = new Elements(cmdoc.getElements(), isXHTML);
+ return elements;
+ }
+
+ /*
+ * @see CMDocument#getEntities()
+ */
+ public CMNamedNodeMap getEntities() {
+ CMDocument cmdoc = getSelf();
+ if (cmdoc == null)
+ return null;
+ return cmdoc.getEntities();
+ }
+
+ /*
+ * @see CMDocument#getNamespace()
+ */
+ public CMNamespace getNamespace() {
+ CMDocument cmdoc = getSelf();
+ if (cmdoc == null)
+ return null;
+ return cmdoc.getNamespace();
+ }
+
+ private CMDocument getSelf() {
+ if (self.getNodeType() != CMNode.DOCUMENT)
+ return null;
+ return (CMDocument) self;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMElementDeclarationBuddySystem.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMElementDeclarationBuddySystem.java
new file mode 100644
index 0000000000..030b4f41ce
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMElementDeclarationBuddySystem.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocumentFactory;
+import org.eclipse.wst.sse.core.contentmodel.CMDocType;
+
+/**
+ */
+class CMElementDeclarationBuddySystem extends CMNodeBuddySystem implements CMElementDeclaration {
+
+
+ private static CMDocument htmlcm = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);
+
+ private static CMElementDeclaration getHTMLCMElemDecl(CMElementDeclaration original) {
+ CMElementDeclaration buddy = null;
+ if (htmlcm != null) {
+ CMNamedNodeMap elems = htmlcm.getElements();
+ if (elems != null) {
+ buddy = (CMElementDeclaration) elems.getNamedItem(original.getElementName());
+ }
+ }
+ return buddy;
+ }
+
+ private class Attrs extends CMNamedNodeMapForBuddySystem {
+ private CMNamedNodeMap buddyAttrs = null;
+
+ public Attrs(CMNamedNodeMap attrs, CMNamedNodeMap buddyAttrs, boolean isXHTML) {
+ super(isXHTML);
+ this.buddyAttrs = buddyAttrs;
+ makeBuddySystem(attrs);
+ }
+
+ protected String getKeyName(CMNode original) {
+ CMAttributeDeclaration adecl = getDecl(original);
+ if (adecl == null)
+ return null;
+ return adecl.getAttrName();
+ }
+
+ protected CMNode createBuddySystem(CMNode original) {
+ CMAttributeDeclaration adecl = getDecl(original);
+ if (adecl == null)
+ return null;
+ CMAttributeDeclaration buddy = null;
+ if (buddyAttrs != null) {
+ buddy = (CMAttributeDeclaration) buddyAttrs.getNamedItem(adecl.getAttrName());
+ }
+ return new CMAttributeDeclarationBuddySystem(adecl, buddy, isXHTML());
+ }
+
+ private CMAttributeDeclaration getDecl(CMNode cmnode) {
+ if (cmnode == null)
+ return null;
+ if (cmnode.getNodeType() != CMNode.ATTRIBUTE_DECLARATION)
+ return null;
+ return (CMAttributeDeclaration) cmnode;
+ }
+ }
+
+ private Attrs attributes = null;
+
+ public CMElementDeclarationBuddySystem(CMElementDeclaration self, boolean isXHTML) {
+ super(self, getHTMLCMElemDecl(self), isXHTML);
+ }
+
+ /*
+ * @see CMElementDeclaration#getAttributes()
+ */
+ public CMNamedNodeMap getAttributes() {
+ if (attributes != null)
+ return attributes;
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return null;
+ CMElementDeclaration htmlDecl = getBuddy();
+ CMNamedNodeMap htmlAttrs = (htmlDecl == null) ? null : htmlDecl.getAttributes();
+ attributes = new Attrs(edecl.getAttributes(), htmlAttrs, isXHTML);
+ return attributes;
+ }
+
+ /*
+ * @see CMElementDeclaration#getContent()
+ */
+ public CMContent getContent() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return null;
+ return edecl.getContent();
+ }
+
+ /*
+ * @see CMElementDeclaration#getContentType()
+ */
+ public int getContentType() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return CMElementDeclaration.ANY;
+ return edecl.getContentType();
+ }
+
+ /*
+ * @see CMElementDeclaration#getElementName()
+ */
+ public String getElementName() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return null;
+ return edecl.getElementName();
+ }
+
+ /*
+ * @see CMElementDeclaration#getDataType()
+ */
+ public CMDataType getDataType() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return null;
+ return edecl.getDataType();
+ }
+
+ /*
+ * @see CMElementDeclaration#getLocalElements()
+ */
+ public CMNamedNodeMap getLocalElements() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return null;
+ return edecl.getLocalElements();
+ }
+
+ /*
+ * @see CMContent#getMaxOccur()
+ */
+ public int getMaxOccur() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return -1;
+ return edecl.getMaxOccur();
+ }
+
+ /*
+ * @see CMContent#getMinOccur()
+ */
+ public int getMinOccur() {
+ CMElementDeclaration edecl = getSelf();
+ if (edecl == null)
+ return -1;
+ return edecl.getMinOccur();
+ }
+
+ /*
+ * @see CMNode#supports(String)
+ */
+ public boolean supports(String propertyName) {
+ if (isXHTML && propertyName.equals(HTMLCMProperties.OMIT_TYPE))
+ return true;
+ return super.supports(propertyName);
+ }
+
+ /*
+ * @see CMNode#getProperty(String)
+ */
+ public Object getProperty(String propertyName) {
+ if (isXHTML && propertyName.equals(HTMLCMProperties.OMIT_TYPE))
+ return HTMLCMProperties.Values.OMIT_NONE;
+ return super.getProperty(propertyName);
+ }
+
+ private CMElementDeclaration getSelf() {
+ if (self.getNodeType() != CMNode.ELEMENT_DECLARATION)
+ return null;
+ return (CMElementDeclaration) self;
+ }
+
+ private CMElementDeclaration getBuddy() {
+ if (buddy == null)
+ return null;
+ if (buddy.getNodeType() != CMNode.ELEMENT_DECLARATION)
+ return null;
+ return (CMElementDeclaration) buddy;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNamedNodeMapForBuddySystem.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNamedNodeMapForBuddySystem.java
new file mode 100644
index 0000000000..0969a93fdd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNamedNodeMapForBuddySystem.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+
+/**
+ */
+abstract class CMNamedNodeMapForBuddySystem implements CMNamedNodeMap {
+
+
+ private boolean isXHTML = false;
+ private Hashtable map = new Hashtable();
+
+ /**
+ * Constructor of CMNamedNodeMapForBuddySystem.
+ * CAUTION: Each derived class must call 'makeBuddySystem' method in its
+ * constructor to build up its contents.
+ */
+ public CMNamedNodeMapForBuddySystem(boolean isXHTML) {
+ super();
+ this.isXHTML = isXHTML;
+ }
+
+ /*
+ * @see CMNamedNodeMap#getLength()
+ */
+ public int getLength() {
+ return map.size();
+ }
+
+ /*
+ * @see CMNamedNodeMap#getNamedItem(String)
+ */
+ public CMNode getNamedItem(String name) {
+ String key = canonicalName(name);
+ if (!map.containsKey(key))
+ return null;
+ return (CMNode) map.get(key);
+ }
+
+ /*
+ * @see CMNamedNodeMap#item(int)
+ */
+ public CMNode item(int index) {
+ Iterator iter = iterator();
+ while (iter.hasNext()) {
+ Object node = iter.next();
+ if (--index < 0)
+ return (CMNode) node;
+ }
+ return null;
+ }
+
+ /*
+ * @see CMNamedNodeMap#iterator()
+ */
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+
+ /* package scope. */
+ void put(String name, CMNode cmnode) {
+ if (name == null || cmnode == null)
+ return;
+ map.put(canonicalName(name), cmnode);
+ }
+
+ abstract protected String getKeyName(CMNode original);
+
+ abstract protected CMNode createBuddySystem(CMNode original);
+
+ protected boolean isXHTML() {
+ return isXHTML;
+ }
+
+ /**
+ * Each derived class must call this method in its constructor
+ * to build up its contents.
+ */
+ protected void makeBuddySystem(CMNamedNodeMap original) {
+ Iterator i = original.iterator();
+ if (i == null)
+ return;
+ while (i.hasNext()) {
+ CMNode org = (CMNode) i.next();
+ String key = getKeyName(org);
+ CMNode newNode = createBuddySystem(org);
+ put(key, newNode);
+ }
+ }
+
+ private String canonicalName(String name) {
+ return name.toUpperCase();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNodeBuddySystem.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNodeBuddySystem.java
new file mode 100644
index 0000000000..908b7e18c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/CMNodeBuddySystem.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+
+/**
+ */
+class CMNodeBuddySystem implements CMNode {
+
+
+ protected boolean isXHTML = false;
+ protected CMNode self = null;
+ protected CMNode buddy = null;
+
+ public CMNodeBuddySystem(CMNode self, CMNode buddy, boolean isXHTML) {
+ super();
+ this.self = self;
+ this.buddy = buddy;
+ this.isXHTML = isXHTML;
+ }
+
+ /*
+ * @see CMNode#getNodeName()
+ */
+ public String getNodeName() {
+ return self.getNodeName();
+ }
+
+ /*
+ * @see CMNode#getNodeType()
+ */
+ public int getNodeType() {
+ return self.getNodeType();
+ }
+
+ /*
+ * @see CMNode#supports(String)
+ */
+ public boolean supports(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return true;
+ if (propertyName.equals(HTMLCMProperties.IS_XHTML))
+ return true;
+ if (buddy == null)
+ return false;
+ return buddy.supports(propertyName);
+ }
+
+ /*
+ * @see CMNode#getProperty(String)
+ */
+ public Object getProperty(String propertyName) {
+ if (propertyName.equals(HTMLCMProperties.SHOULD_IGNORE_CASE)) {
+ return new Boolean(!isXHTML);
+ }
+ if (propertyName.equals(HTMLCMProperties.IS_XHTML)) {
+ return new Boolean(isXHTML);
+ }
+
+ if (buddy == null || (!buddy.supports(propertyName)))
+ return null;
+ return buddy.getProperty(propertyName);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/DocumentQuery.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/DocumentQuery.java
new file mode 100644
index 0000000000..4613395cff
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/DocumentQuery.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.ranges.Range;
+
+/**
+ */
+public interface DocumentQuery {
+
+ /**
+ * isRenderRoot() returns true if - node is BODY element (both explicit
+ * and implicit) - node is portalhtml:body element - node is Document node
+ * and the document is treated as fragment (with BODY context) Note that
+ * in editing a fragment file, Document node should be treated as a
+ * substitute of BODY element.
+ */
+ boolean isRenderRoot(Node node);
+
+ /**
+ * isHeadCorrespondent() returns true if - node is HEAD element (both
+ * explicit and implicit) - node is portalhtml:head element - node is
+ * Document node and the document is treated as fragment (with HEAD
+ * context) Note that in editing a fragment file (with HEAD context),
+ * Document node should be treated as a substitute of HEAD element.
+ */
+ boolean isHeadCorrespondent(Node node);
+
+ /**
+ * Implicit BODY element will be gone in V6 SED model. So page designer
+ * provides an API to get a range whose content nodes are rendered in
+ * design view. getRenderRootRange() returns - a range from BODY's first
+ * to its last (if the document has BODY element) - a range form
+ * Document's first to its last (if the document is fragment with BODY
+ * context) - null (if the document is fragment with HEAD context) [The
+ * following cases will be supported since V6] - a range from a custom
+ * tag's first to its last (if the document has a custom tag which
+ * generates BODY element at runtime) - a range from Document's
+ * appropirate offset to its last (if the document does not have explicit
+ * BODY/HTML) - a range from HTML element's appropriate offset to its last
+ * (if the document does not have explicit BODY but have explicit HTML)
+ *
+ * @param doc
+ * @return
+ */
+ Range getRenderRootRange(Document doc);
+
+ /**
+ * Implicit HEAD element will be gone in V6 SED model. So page designer
+ * provides an API to get a range whose content nodes are treated as HEAD
+ * element's child. getHeadCorrespondentRange() returns - a range from
+ * HEAD's first to its last (if the document has HEAD element) - a range
+ * form Document's first to its last (if the document is fragment with
+ * HEAD context) - null (if the document is fragment with BODY context)
+ * [The following cases will be supported since V6] - a range from a
+ * custom tag's first to its last (if the document has a custom tag which
+ * generates HEAD element at runtime) - a range from Document's first to
+ * appropirate offset (if the document does not have explicit HEAD/HTML) -
+ * a range from HTML element's first to appropriate offset (if the
+ * document does not have explicit HEAD but have explicit HTML)
+ *
+ * @param doc
+ * @return
+ */
+ Range getHeadCorrespondentRange(Document doc);
+
+ /**
+ * getRenderRootNode() with [create=false] returns - BODY element if this
+ * document is not fragment and has BODY element - null if this document
+ * is not fragment and does not have BODY element - Document node if this
+ * document is fragment with BODY context - null if this document is
+ * fragment with HEAD context [The following cases will be supported since
+ * V6] - a custom tag which generates BODY tag at runtime - Document node
+ * or HTML element if this document is not fragment but does not have
+ * explicit BODY element getRenderRootNode() with [create=true] returns -
+ * BODY element if this document is not fragment and has BODY element (no
+ * modifictation) - newly created BODY element if this document is not
+ * fragment but does not have BODY element - Document node if this
+ * document is fragment with BODY context (no modifictation) [The
+ * following cases will be supported since V6] - a custom tag which
+ * generates BODY tag at runtime (no modifictation) - newly created BODY
+ * element if this document is not fragment but does not have explicit
+ * BODY element getRenderRootNode() throws HTMLCommandException (since V6)
+ * if - this document is fragment with HEAD context and - "create"
+ * parameter is true Note that in editing a fragment file, Document node
+ * should be treated as a substitute of BODY element.
+ *
+ * @param childOrDocument
+ * @param create
+ * @return
+ */
+ Node getRenderRootNode(Node childOrDocument, boolean create);
+
+ /**
+ * getHeadCorrespondentNode() with [create=false] returns - HEAD element
+ * if this document is not fragment and has HEAD element - null if this
+ * document is not fragment and does not have HEAD element - Document node
+ * if this document is fragment with HEAD context - null if this document
+ * is fragment with BODY context [The following cases will be supported
+ * since V6] - a custom tag which generates HEAD tag at runtime - Document
+ * node or HTML element if this document is not fragment but does not have
+ * explicit HEAD element getHeadCorrespondentNode() with [create=true]
+ * returns - HEAD element if this document is not fragment and has HEAD
+ * element (no modifictation) - newly created HEAD element if this
+ * document is not fragment but does not have HEAD element - Document node
+ * if this document is fragment with HEAD context (no modifictation) [The
+ * following cases will be supported since V6] - a custom tag which
+ * generates HEAD tag at runtime (no modifictation) - newly created HEAD
+ * element if this document is not fragment but does not have explicit
+ * HEAD element getHeadCorrespondentNode() throws HTMLCommandException
+ * (since V6) if - this document is fragment with BODY context and -
+ * "create" parameter is true Note that in editing a fragment file,
+ * Document node should be treated as a substitute of HEAD element.
+ *
+ * @param childOrDocument
+ * @param create
+ * @return
+ */
+ Node getHeadCorrespondentNode(Node childOrDocument, boolean create);
+
+ /**
+ * getHtmlCorrespondentNode() throws HTMLCommandException (since V6) if -
+ * this document is fragment and "create" parameter is true
+ *
+ * @param childOrDocument
+ * @param create
+ * @return
+ */
+ Node getHtmlCorrespondentNode(Node childOrDocument, boolean create);
+
+ /**
+ * This inner class is intended for insertion target. please use this like
+ * the following : DocumentQuery.InsertionTarget ins;
+ * ins.getParent().insertBefore(youInsertionNode, ins.getRef());
+ */
+ public class InsertionTarget {
+ private final Node parent;
+ private final Node ref;
+
+ public InsertionTarget(Node parent, Node ref) {
+ this.parent = parent;
+ this.ref = ref;
+ }
+
+ public Node getParent() {
+ return parent;
+ }
+
+ public Node getRef() {
+ return ref;
+ }
+ }
+
+ /**
+ * getHeadInsertionTarget() returns appropriate insetion target location
+ * for HEAD child tags such as <script>, <style>, <meta>etc. Basically
+ * this function returns <HEAD>tag's the last position. Note that this
+ * would not create actual <HEAD>tag when the document does not have it.
+ * <HEAD>is omittable tag so this function returns appropriate position
+ * to which implicit <HEAD>can be inserted, if the document has no
+ * <HEAD>.
+ *
+ * @param doc
+ * @return
+ */
+ InsertionTarget getHeadInsertionTarget(Document doc);
+
+ /**
+ * getPageInsertionTarget() returns appropriate insetion target location
+ * for page-level markups, such as JSP directives, usebean tags or <html>
+ * tag. Basically this function returns just before <HTML>tag. Note that
+ * this would not create actual <HTML>tag when the document does not have
+ * it. In such case, this function returns a position just before the
+ * meaningful tags such as HTML/JSP elements.
+ *
+ * @param doc
+ * @return
+ */
+ InsertionTarget getPageInsertionTarget(Document doc);
+
+ /**
+ * isFragment() returns whether the document is fragment or complete
+ * document
+ *
+ * @param doc
+ * @return
+ */
+ boolean isFragment(Document doc);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapter.java
new file mode 100644
index 0000000000..60545feedc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.sse.core.INodeAdapter;
+
+/**
+ */
+public interface ElementDeclarationAdapter extends INodeAdapter {
+
+ /**
+ */
+ CMElementDeclaration getDeclaration();
+
+ /**
+ */
+ void setDeclaration(CMElementDeclaration declaration);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapterFactory.java
new file mode 100644
index 0000000000..992ad77161
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ElementDeclarationAdapterFactory.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+
+/**
+ */
+public class ElementDeclarationAdapterFactory implements AdapterFactory {
+
+ private static ElementDeclarationAdapterFactory instance = null;
+
+ /**
+ */
+ private ElementDeclarationAdapterFactory() {
+ super();
+ }
+
+ /**
+ */
+ public INodeAdapter adapt(INodeNotifier notifier) {
+ if (notifier == null)
+ return null;
+ INodeAdapter adapter = notifier.getExistingAdapter(ElementDeclarationAdapter.class);
+ if (adapter != null)
+ return adapter;
+ adapter = new HTMLElementDeclarationAdapter();
+ notifier.addAdapter(adapter);
+ return adapter;
+ }
+
+ /**
+ */
+ public synchronized static ElementDeclarationAdapterFactory getInstance() {
+ if (instance == null)
+ instance = new ElementDeclarationAdapterFactory();
+ return instance;
+ }
+
+ /**
+ */
+ public boolean isFactoryForType(Object type) {
+ return (type == ElementDeclarationAdapter.class);
+ }
+
+ public void release() {
+ // default is to do nothing
+ }
+
+ /**
+ * Overriding copy method
+ */
+ public AdapterFactory copy() {
+ return getInstance();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HMQUtil.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HMQUtil.java
new file mode 100644
index 0000000000..38574c3a98
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HMQUtil.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.CMNodeList;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public final class HMQUtil {
+
+ private final static Vector nullVector = new Vector();
+
+ /* HMQUtil class must not instantiate. */
+ private HMQUtil() {
+ super();
+ }
+
+ /* gather all element declarations in inclusion of each parent of the target.
+ * the inclusion of the target is also gathered. */
+ public static Collection getInclusions(Element target) {
+ if (target == null)
+ return nullVector;
+ Collection inclusions = gatherInclusions(getAncestorDeclarations(target));
+
+ Hashtable availables = new Hashtable();
+ Iterator iter = inclusions.iterator();
+ while (iter.hasNext()) {
+ CMContent inclusion = (CMContent) iter.next();
+ switch (inclusion.getNodeType()) {
+ case CMNode.GROUP :
+ extractDeclarations(availables, (CMGroup) inclusion);
+ break;
+ case CMNode.ELEMENT_DECLARATION :
+ addInclusion(availables, (CMElementDeclaration) inclusion);
+ break;
+ }
+ }
+
+ return availables.values();
+ }
+
+ private static Collection getAncestorDeclarations(Element target) {
+ Vector ancestors = new Vector();
+
+ Document doc = target.getOwnerDocument();
+ ModelQuery query = ModelQueryUtil.getModelQuery(doc);
+ CMElementDeclaration decl = query.getCMElementDeclaration(target);
+ ancestors.add(decl);
+
+ Element parent = getParent(target);
+ while (parent != null) {
+ decl = query.getCMElementDeclaration(parent);
+ if (decl != null)
+ ancestors.add(decl);
+ parent = getParent(parent);
+ }
+ return ancestors;
+ }
+
+ private static void addInclusion(Hashtable availables, CMElementDeclaration decl) {
+ String name = decl.getElementName();
+ if (availables.containsKey(name))
+ return;
+ availables.put(name, decl);
+ }
+
+ private static Collection gatherInclusions(Collection ancestors) {
+ Vector inclusions = new Vector();
+ Iterator iter = ancestors.iterator();
+ while (iter.hasNext()) {
+ CMElementDeclaration decl = (CMElementDeclaration) iter.next();
+ if (decl.supports(HTMLCMProperties.INCLUSION)) {
+ CMContent inclusion = (CMContent) decl.getProperty(HTMLCMProperties.INCLUSION);
+ if (inclusion != null)
+ inclusions.add(inclusion);
+ }
+ }
+ return inclusions;
+ }
+
+ private static Element getParent(Node target) {
+ Node parent = target.getParentNode();
+ while (parent != null) {
+ if (parent.getNodeType() == Node.ELEMENT_NODE)
+ return (Element) parent;
+ parent = parent.getParentNode();
+ }
+ return null;
+ }
+
+ private static void extractDeclarations(Hashtable availables, CMGroup group) {
+ CMNodeList content = group.getChildNodes();
+ for (int i = 0; i < content.getLength(); i++) {
+ CMNode cmn = content.item(i);
+ if (cmn == null || cmn.getNodeType() != CMNode.ELEMENT_DECLARATION)
+ continue;
+ addInclusion(availables, (CMElementDeclaration) cmn);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLElementDeclarationAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLElementDeclarationAdapter.java
new file mode 100644
index 0000000000..0774d880df
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLElementDeclarationAdapter.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.sse.core.INodeNotifier;
+
+/**
+ */
+public class HTMLElementDeclarationAdapter implements ElementDeclarationAdapter {
+
+ private CMElementDeclaration declaration = null;
+
+ /**
+ */
+ public HTMLElementDeclarationAdapter() {
+ super();
+ }
+
+ /**
+ */
+ public CMElementDeclaration getDeclaration() {
+ return this.declaration;
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return (type == ElementDeclarationAdapter.class);
+ }
+
+ /**
+ */
+ public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
+ }
+
+ /**
+ */
+ public void setDeclaration(CMElementDeclaration declaration) {
+ this.declaration = declaration;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryAssociationProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryAssociationProvider.java
new file mode 100644
index 0000000000..6161a17728
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryAssociationProvider.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+
+import org.eclipse.wst.common.contentmodel.modelqueryimpl.SimpleAssociationProvider;
+import org.eclipse.wst.common.contentmodel.util.CMDocumentCache;
+import org.eclipse.wst.xml.uriresolver.util.IdResolver;
+
+/**
+ */
+public class HTMLModelQueryAssociationProvider extends SimpleAssociationProvider {
+
+ /**
+ * @param modelQueryCMProvider org.eclipse.wst.common.contentmodel.modelquery.ModelQueryCMProvider
+ */
+ public HTMLModelQueryAssociationProvider(CMDocumentCache cache, IdResolver idResolver) {
+ super(new HTMLModelQueryCMProvider(cache, idResolver));
+ }
+
+ // MIWA: We cannot cache a CMElementDeclaration any more. Because, when the DOCTYPE
+ // was changed, CMDocument would be changed. Then, a cached CMElementDeclaration
+ // would be invalid. If some performance problems occurs, we consider a smarter
+ // cache mechanism.
+ //
+ // public CMElementDeclaration getCMElementDeclaration(Element element) {
+ // // check if element declaration is cached
+ // INodeNotifier notifier = (INodeNotifier) element;
+ // ElementDeclarationAdapter adapter = (ElementDeclarationAdapter) notifier.getExistingAdapter(ElementDeclarationAdapter.class);
+ // if (adapter != null)
+ // return adapter.getDeclaration();
+ //
+ // CMElementDeclaration decl = super.getCMElementDeclaration(element);
+ //
+ // // cache HTML element declaration only
+ // if (decl != null && decl instanceof HTMLElementDeclaration) {
+ // AdapterFactory factory = ElementDeclarationAdapterFactory.getInstance();
+ // adapter = (ElementDeclarationAdapter) factory.adapt(notifier);
+ // if (adapter != null)
+ // adapter.setDeclaration(decl);
+ // }
+ //
+ // return decl;
+ // }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryCMProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryCMProvider.java
new file mode 100644
index 0000000000..c5c11ce428
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryCMProvider.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+import java.util.Hashtable;
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQueryCMProvider;
+import org.eclipse.wst.common.contentmodel.util.CMDocumentCache;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocumentFactory;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeEntry;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeRegistry;
+import org.eclipse.wst.sse.core.contentmodel.CMDocType;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.uriresolver.util.IdResolver;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Node;
+
+/**
+ * CMDocument provider for HTML and XHTML documents.
+ */
+public class HTMLModelQueryCMProvider implements ModelQueryCMProvider {
+
+
+ private static CMDocument staticHTML = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);
+ private static CMDocument staticCHTML = HTMLCMDocumentFactory.getCMDocument(CMDocType.CHTML_DOC_TYPE);
+ private static HTMLDocumentTypeRegistry doctypeRegistry = HTMLDocumentTypeRegistry.getInstance();
+ private static Hashtable buddyCache = new Hashtable();
+
+ private XHTMLAssociationProvider xhtmlassoc = null;
+
+ public HTMLModelQueryCMProvider(CMDocumentCache cache, IdResolver idResolver) {
+ super();
+ xhtmlassoc = new XHTMLAssociationProvider(cache, idResolver);
+ }
+
+ /**
+ * Returns the CMDocument that corresponds to the DOM Node.
+ * or null if no CMDocument is appropriate for the DOM Node.
+ */
+ public CMDocument getCorrespondingCMDocument(Node node) {
+ XMLDocument owner = getOwnerXMLDocument(node);
+ if (owner == null)
+ return null;
+
+ String pid = getPublicId(owner);
+ if (pid == null)
+ return staticHTML;
+
+ HTMLDocumentTypeEntry entry = doctypeRegistry.getEntry(pid);
+ if (entry == null)
+ return staticHTML;
+
+ pid = entry.getPublicId();
+ CMDocument dtdcm = xhtmlassoc.getXHTMLCMDocument(pid, entry.getSystemId());
+ if (dtdcm == null) {
+ if (pid != null && pid.equals(HTMLDocumentTypeRegistry.CHTML_PUBLIC_ID)) {
+ return staticCHTML;
+ }
+ return staticHTML;
+ }
+
+ CMDocument buddycm = (CMDocument) buddyCache.get(pid);
+ if (buddycm != null)
+ return buddycm;
+
+ buddycm = new CMDocumentForBuddySystem(dtdcm, entry.isXMLType());
+ buddyCache.put(pid, buddycm);
+ return buddycm;
+ }
+
+ // private methods
+ private XMLDocument getOwnerXMLDocument(Node node) {
+ if (node == null)
+ return null;
+ Document owner = (node.getNodeType() == Node.DOCUMENT_NODE) ? (Document) node : node.getOwnerDocument();
+ if (owner == null)
+ return null;
+ if (!(owner instanceof XMLDocument))
+ return null;
+ return (XMLDocument) owner;
+ }
+
+ private String getPublicId(XMLDocument doc) {
+ if (doc == null)
+ return null;
+ DocumentType doctype = doc.getDoctype();
+ return (doctype != null) ? doctype.getPublicId() : doc.getDocumentTypeId();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryImpl.java
new file mode 100644
index 0000000000..103bad13ae
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/HTMLModelQueryImpl.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.modelqueryimpl.ModelQueryImpl;
+import org.eclipse.wst.common.contentmodel.util.CMDocumentCache;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.sse.core.modelquery.MovableModelQuery;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.uriresolver.util.IdResolver;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class HTMLModelQueryImpl extends ModelQueryImpl implements MovableModelQuery {
+
+ protected CMDocumentCache fCache = null;
+
+ public HTMLModelQueryImpl(CMDocumentCache cache, IdResolver idResolver) {
+ super(new HTMLModelQueryAssociationProvider(cache, idResolver));
+ fCache = cache;
+ }
+
+ public List getAvailableContent(Element element, CMElementDeclaration ed, int includeOptions) {
+ List originalCandidates = super.getAvailableContent(element, ed, includeOptions);
+ if ((includeOptions & INCLUDE_CHILD_NODES) == 0)
+ return originalCandidates;
+ // When the target document is XHTML, it is waste to find inclusions,
+ // since inclusion is available in HTML only.
+ if (!ed.supports(HTMLCMProperties.IS_XHTML))
+ return originalCandidates;
+
+ Boolean isXhtml = Boolean.FALSE;
+ isXhtml = (Boolean) ed.getProperty(HTMLCMProperties.IS_XHTML);
+ if (isXhtml != null && isXhtml.booleanValue())
+ return originalCandidates;
+
+ // OK, the target is surely a HTML element, so it may have inclusion.
+ // Try to find it.
+ Vector candidates = new Vector(originalCandidates);
+
+ switch (ed.getContentType()) {
+ case CMElementDeclaration.ANY :
+ case CMElementDeclaration.ELEMENT :
+ case CMElementDeclaration.MIXED :
+ // do enumerate inclusions.
+ candidates.addAll(HMQUtil.getInclusions(element));
+ break;
+ case CMElementDeclaration.EMPTY :
+ case CMElementDeclaration.PCDATA :
+ case CMElementDeclaration.CDATA :
+ default :
+ // should not add any inclusions.
+ // so, nothing to do here.
+ break;
+ }
+ // If the current element does not available, it is impossible
+ // to filter out exclusion.
+ if (element == null)
+ return candidates;
+
+ // Now, the time to check exclusion.
+ Vector content = new Vector(candidates.size());
+ for (int i = 0; i < candidates.size(); i++) {
+ CMElementDeclaration candidate = (CMElementDeclaration) candidates.elementAt(i);
+ if (candidate == null)
+ continue;
+ if (isExcluded(candidate, element))
+ continue;
+ content.add(candidate);
+ }
+
+ return content;
+ }
+
+ /**
+ * @see MovableModelQuery#setIdResolver(IdResolver)
+ */
+ public void setIdResolver(IdResolver newIdResolver) {
+ modelQueryAssociationProvider = new HTMLModelQueryAssociationProvider(fCache, newIdResolver);
+ }
+
+ // utilities
+ private static boolean isExcluded(CMElementDeclaration candidate, Element target) {
+ CMNamedNodeMap prohibited = getProhibitedAncestors(candidate);
+ if (prohibited == null)
+ return false;
+ Element parent = target;
+ while (parent != null) {
+ CMNode pdec = prohibited.getNamedItem(parent.getNodeName());
+ if (pdec != null)
+ return true;
+ parent = getExplicitParentElement(parent);
+ }
+ return false;
+ }
+
+ private static CMNamedNodeMap getProhibitedAncestors(CMElementDeclaration dec) {
+ if (!dec.supports(HTMLCMProperties.PROHIBITED_ANCESTORS))
+ return null;
+ return (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS);
+ }
+
+ /* get an ancestor element ignoring implicit ones. */
+ private static Element getExplicitParentElement(Node child) {
+ if (child == null)
+ return null;
+
+ Node p = child.getParentNode();
+ while (p != null) {
+ if (p.getNodeType() == Node.ELEMENT_NODE) {
+ if (p instanceof XMLElement) {
+ if (((XMLElement) p).isImplicitTag()) {
+ p = p.getParentNode();
+ continue;
+ }
+ }
+ return (Element) p;
+ }
+ p = p.getParentNode();
+ }
+ return null;
+ }
+
+ /* check the target is implicit elemnt or not */
+ private static boolean isImplicitElement(Node node) {
+ if (node.getNodeType() != Node.ELEMENT_NODE)
+ return false;
+ if (!(node instanceof XMLElement))
+ return false;
+ return ((XMLElement) node).isImplicitTag();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForEmbeddedHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForEmbeddedHTML.java
new file mode 100644
index 0000000000..07ca873cc1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForEmbeddedHTML.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.modelquery.ModelQueryAdapter;
+
+public class ModelQueryAdapterFactoryForEmbeddedHTML extends ModelQueryAdapterFactoryForHTML {
+
+
+ /**
+ * Constructor for ModelQueryAdapterFactoryForEmbeddedHTML.
+ */
+ public ModelQueryAdapterFactoryForEmbeddedHTML() {
+ this(ModelQueryAdapter.class, false);
+ }
+
+ /**
+ * Constructor for ModelQueryAdapterFactoryForEmbeddedHTML.
+ * @param adapterKey
+ * @param registerAdapters
+ */
+ protected ModelQueryAdapterFactoryForEmbeddedHTML(Object adapterKey, boolean registerAdapters) {
+ super(adapterKey, registerAdapters);
+ }
+
+ /**
+ * @see AdapterFactory#adapt(INodeNotifier)
+ */
+ public INodeAdapter adapt(INodeNotifier object) {
+ if (object == null)
+ return null;
+ return adaptNew(object);
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+
+ return new ModelQueryAdapterFactoryForEmbeddedHTML(this.adapterKey, this.shouldRegisterAdapter);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java
new file mode 100644
index 0000000000..0aed9ca03f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/ModelQueryAdapterFactoryForHTML.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.common.contentmodel.util.CMDocumentCache;
+import org.eclipse.wst.sse.core.AbstractAdapterFactory;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.IModelStateListener;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.modelquery.ModelQueryAdapter;
+import org.eclipse.wst.sse.core.modelquery.ModelQueryAdapterImpl;
+import org.eclipse.wst.sse.core.util.Debug;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.modelquery.XMLCatalogIdResolver;
+import org.eclipse.wst.xml.uriresolver.util.IdResolver;
+
+/**
+ * Creates a ModelQueryAdapter for HTML models
+ */
+public class ModelQueryAdapterFactoryForHTML extends AbstractAdapterFactory implements IModelStateListener {
+
+ protected ModelQueryAdapterImpl modelQueryAdapterImpl;
+ protected IStructuredModel stateNotifier = null;
+
+ /**
+ * ModelQueryAdapterFactoryForHTML constructor comment.
+ */
+ public ModelQueryAdapterFactoryForHTML() {
+ this(ModelQueryAdapter.class, true);
+ }
+
+ /**
+ * ModelQueryAdapterFactoryForHTML constructor comment.
+ * @param adapterKey java.lang.Object
+ * @param registerAdapters boolean
+ */
+ public ModelQueryAdapterFactoryForHTML(Object adapterKey, boolean registerAdapters) {
+ super(adapterKey, registerAdapters);
+ }
+
+ /**
+ * createAdapter method comment.
+ */
+ protected INodeAdapter createAdapter(INodeNotifier target) {
+
+ if (Debug.displayInfo)
+ System.out.println("-----------------------ModelQueryAdapterFactoryForHTML.createAdapter" + target); //$NON-NLS-1$
+ if (modelQueryAdapterImpl == null) {
+ if (target instanceof XMLNode) {
+ XMLNode xmlNode = (XMLNode) target;
+ IStructuredModel model = stateNotifier = xmlNode.getModel();
+ stateNotifier.addModelStateListener(this);
+ String baseLocation = model.getBaseLocation();
+ if (Debug.displayInfo)
+ System.out.println("----------------ModelQueryAdapterFactoryForHTML... baseLocation : " + baseLocation); //$NON-NLS-1$
+
+ CMDocumentCache cmDocumentCache = new CMDocumentCache();
+ IdResolver idResolver = new XMLCatalogIdResolver(baseLocation, model.getResolver());
+ ModelQuery modelQuery = new HTMLModelQueryImpl(cmDocumentCache, idResolver);
+ modelQuery.setEditMode(ModelQuery.EDIT_MODE_UNCONSTRAINED);
+ modelQueryAdapterImpl = new ModelQueryAdapterImpl(cmDocumentCache, modelQuery, idResolver);
+ }
+ }
+ return modelQueryAdapterImpl;
+ }
+
+ protected void updateResolver(IStructuredModel model) {
+ modelQueryAdapterImpl.setIdResolver(new XMLCatalogIdResolver(model.getBaseLocation(), model.getResolver()));
+ }
+
+ /**
+ * @see IModelStateListener#modelAboutToBeChanged(IStructuredModel)
+ */
+ public void modelAboutToBeChanged(IStructuredModel model) {
+ }
+
+ /**
+ * @see IModelStateListener#modelChanged(IStructuredModel)
+ */
+ public void modelChanged(IStructuredModel model) {
+ }
+
+ /**
+ * @see IModelStateListener#modelDirtyStateChanged(IStructuredModel, boolean)
+ */
+ public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty) {
+ }
+
+ /**
+ * @see IModelStateListener#modelResourceDeleted(IStructuredModel)
+ */
+ public void modelResourceDeleted(IStructuredModel model) {
+ }
+
+ /**
+ * @see IModelStateListener#modelResourceMoved(IStructuredModel, IStructuredModel)
+ */
+ public void modelResourceMoved(IStructuredModel oldModel, IStructuredModel newModel) {
+ stateNotifier.removeModelStateListener(this);
+ stateNotifier = newModel;
+ updateResolver(stateNotifier);
+ stateNotifier.addModelStateListener(this);
+ }
+
+ public void release() {
+ super.release();
+ if (stateNotifier != null)
+ stateNotifier.removeModelStateListener(this);
+ stateNotifier = null;
+ if (modelQueryAdapterImpl != null)
+ modelQueryAdapterImpl.release();
+ }
+
+ public AdapterFactory copy() {
+
+ return new ModelQueryAdapterFactoryForHTML(this.adapterKey, this.shouldRegisterAdapter);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/XHTMLAssociationProvider.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/XHTMLAssociationProvider.java
new file mode 100644
index 0000000000..fe331c4059
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/modelquery/XHTMLAssociationProvider.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.modelquery;
+
+
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.modelqueryimpl.XMLAssociationProvider;
+import org.eclipse.wst.common.contentmodel.util.CMDocumentCache;
+import org.eclipse.wst.xml.uriresolver.util.IdResolver;
+import org.w3c.dom.Document;
+
+/**
+ * A Class to provide an association between XHTML documents and DTDs for
+ * XHTML. This class is intended to be used only in HTMLModelQueryCMProvider.
+ */
+/*
+ * This class closely resemble XMLModelQueryAssociationProvider.
+ */
+class XHTMLAssociationProvider extends XMLAssociationProvider {
+
+ protected IdResolver idResolver = null;
+ private String fCachedGrammerURI;
+ private String fCachedPublicID;
+ private String fCachedSystemID;
+ private static final boolean USE_QUICK_CACHE = true;
+
+ public XHTMLAssociationProvider(CMDocumentCache cache, IdResolver idResolver) {
+ super(cache);
+ this.idResolver = idResolver;
+ }
+
+ /**
+ *
+ * @param publicId
+ * @param systemId
+ * @return
+ */
+ public CMDocument getXHTMLCMDocument(String publicId, String systemId) {
+ String grammerURI = null;
+ if (USE_QUICK_CACHE) {
+ // In parsing a document, we get many identiical requests to this
+ // method, so instead of looking up (resolving) grammerURI each
+ // time,
+ // we'll just return previously cached one. Probably not worth
+ // have a
+ // more complex cache than that.
+ if (fCachedGrammerURI != null && fCachedPublicID.equals(publicId) && fCachedSystemID.equals(systemId)) {
+ grammerURI = fCachedGrammerURI;
+ }
+ else {
+ grammerURI = idResolver.resolveId(publicId, systemId);
+ fCachedGrammerURI = grammerURI;
+ fCachedPublicID = publicId;
+ fCachedSystemID = systemId;
+ }
+ }
+ else {
+ grammerURI = idResolver.resolveId(publicId, systemId);
+ }
+
+ if (grammerURI == null)
+ return null;
+ CMDocument cmDocument = documentManager.getCMDocument(publicId, grammerURI);
+ return cmDocument;
+ }
+
+ /**
+ */
+ protected String resolveGrammarURI(Document document, String publicId, String systemId) {
+ return idResolver.resolveId(publicId, systemId);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/preferences/HTMLContentBuilder.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/preferences/HTMLContentBuilder.java
new file mode 100644
index 0000000000..9ff0cf743a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/preferences/HTMLContentBuilder.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.preferences;
+
+
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.PreferenceNames;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.w3c.dom.Node;
+
+public class HTMLContentBuilder extends org.eclipse.wst.common.contentmodel.util.DOMContentBuilderImpl {
+
+ private String fTagCase;
+ private String fAttrCase;
+
+ /**
+ * DOMContentBuilder constructor comment.
+ * @param document org.w3c.dom.Document
+ */
+ public HTMLContentBuilder(org.w3c.dom.Document document) {
+ super(document);
+ Preferences prefs = Platform.getPlugin("org.eclipse.wst.html.core").getPluginPreferences();//$NON-NLS-1$
+ fTagCase = prefs.getString(CommonModelPreferenceNames.TAG_NAME_CASE);
+ fAttrCase = prefs.getString(CommonModelPreferenceNames.ATTR_NAME_CASE);
+ // Element caseSettings = HTMLPreferenceManager.getHTMLInstance().getElement(PreferenceNames.PREFERRED_CASE);
+ // fTagCase = caseSettings.getAttribute(PreferenceNames.TAGNAME);
+ // fAttrCase = caseSettings.getAttribute(PreferenceNames.ATTRIBUTENAME);
+ }
+
+ public String computeName(CMNode cmnode, Node parent) {
+ String name = super.computeName(cmnode, parent);
+ // don't change the case unless we're certain it is meaningless
+ // if (cmnode instanceof HTMLCMNode && ((HTMLCMNode) cmnode).shouldIgnoreCase()) {
+ if (shouldIgnoreCase(cmnode)) {
+ if (cmnode.getNodeType() == CMNode.ELEMENT_DECLARATION) {
+ if (fTagCase.length() > 0) {
+ if (fTagCase.equals(PreferenceNames.LOWER))
+ name = name.toLowerCase();
+ else if (fTagCase.equals(PreferenceNames.UPPER))
+ name = name.toUpperCase();
+ // else do nothing
+ }
+ }
+ else if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
+ if (fAttrCase.length() > 0) {
+ if (fAttrCase.equals(PreferenceNames.LOWER))
+ name = name.toLowerCase();
+ else if (fAttrCase.equals(PreferenceNames.UPPER))
+ name = name.toUpperCase();
+ // else do nothing
+ }
+ }
+ }
+ return name;
+
+ }
+
+ private boolean shouldIgnoreCase(CMNode cmnode) {
+ if (!cmnode.supports(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return false;
+ return ((Boolean) cmnode.getProperty(HTMLCMProperties.SHOULD_IGNORE_CASE)).booleanValue();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/AbstractErrorInfo.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/AbstractErrorInfo.java
new file mode 100644
index 0000000000..5e6ee85f30
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/AbstractErrorInfo.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+abstract class AbstractErrorInfo implements ErrorInfo, ErrorState {
+
+
+ private int state = NONE_ERROR;
+ private Segment seg = null;
+
+ public AbstractErrorInfo(int state, Segment seg) {
+ super();
+ this.state = state;
+ this.seg = seg;
+ }
+
+ abstract public String getHint();
+
+ abstract public short getTargetType();
+
+ public int getLength() {
+ return (seg == null) ? 0 : seg.getLength();
+ }
+
+ public int getOffset() {
+ return (seg == null) ? 0 : seg.getOffset();
+ }
+
+ public int getState() {
+ return this.state;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CMUtil.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CMUtil.java
new file mode 100644
index 0000000000..38f351d2e1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CMUtil.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMContent;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMGroup;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.CMNodeList;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.modelquery.HMQUtil;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+final class CMUtil {
+
+ /**
+ * Never instantiate!
+ */
+ private CMUtil() {
+ super();
+ }
+
+ /**
+ * You cannot always retrieve HTMLElementDeclaration via an Element instance.
+ * Because, it occasionally a JSP custom tag. -- 9/7/2001
+ */
+ public static CMElementDeclaration getDeclaration(Element target) {
+ Document doc = target.getOwnerDocument();
+ ModelQuery query = ModelQueryUtil.getModelQuery(doc);
+ return query.getCMElementDeclaration(target);
+ }
+
+ /**
+ */
+ public static boolean isCaseSensitive(CMElementDeclaration decl) {
+ if (decl == null || (!decl.supports(HTMLCMProperties.SHOULD_IGNORE_CASE)))
+ return false;
+ return !((Boolean) decl.getProperty(HTMLCMProperties.SHOULD_IGNORE_CASE)).booleanValue();
+ }
+
+ /**
+ */
+ private static boolean isChild(CMContent content, CMElementDeclaration target) {
+ switch (content.getNodeType()) {
+ case CMNode.ELEMENT_DECLARATION :
+ if (isWholeTagOmissible((CMElementDeclaration) content))
+ if (isChild(((CMElementDeclaration) content).getContent(), target))
+ return true;
+ return isSameDeclaration((CMElementDeclaration) content, target);
+ case CMNode.GROUP :
+ CMNodeList children = ((CMGroup) content).getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ CMNode child = children.item(i);
+ switch (child.getNodeType()) {
+ case CMNode.ELEMENT_DECLARATION :
+ if (isWholeTagOmissible((CMElementDeclaration) child))
+ if (isChild(((CMElementDeclaration) child).getContent(), target))
+ return true;
+ if (isSameDeclaration((CMElementDeclaration) child, target))
+ return true;
+ continue; // Go next child.
+ case CMNode.GROUP :
+ if (isChild((CMContent) child, target))
+ return true;
+ continue; // Go next child.
+ default :
+ continue; // Go next child.
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ */
+ public static boolean isEndTagOmissible(CMElementDeclaration decl) {
+ if (!(decl.supports(HTMLCMProperties.OMIT_TYPE)))
+ return false;
+ String omitType = (String) decl.getProperty(HTMLCMProperties.OMIT_TYPE);
+ return !omitType.equals(HTMLCMProperties.Values.OMIT_NONE);
+ }
+
+ /**
+ */
+ public static boolean isWholeTagOmissible(CMElementDeclaration decl) {
+ if (!(decl.supports(HTMLCMProperties.OMIT_TYPE)))
+ return false;
+ String omitType = (String) decl.getProperty(HTMLCMProperties.OMIT_TYPE);
+ return omitType.equals(HTMLCMProperties.Values.OMIT_BOTH);
+ }
+
+ /**
+ */
+ public static boolean isJSP(CMElementDeclaration decl) {
+ if (!decl.supports(HTMLCMProperties.IS_JSP))
+ return false;
+ return ((Boolean) decl.getProperty(HTMLCMProperties.IS_JSP)).booleanValue();
+ }
+
+ /**
+ */
+ public static boolean isXHTML(CMElementDeclaration decl) {
+ if (!decl.supports(HTMLCMProperties.IS_XHTML))
+ return false;
+ return ((Boolean) decl.getProperty(HTMLCMProperties.IS_XHTML)).booleanValue();
+ }
+
+ /**
+ * The method to distinguish HTML and XHTML from other mark up.
+ * This method returns true if the target is,
+ * (1) not JSP,
+ * (2) not SSI.
+ */
+ public static boolean isHTML(CMElementDeclaration decl) {
+ return (!isJSP(decl)) && (!isSSI(decl));
+ }
+
+ /**
+ */
+ private static boolean isSameDeclaration(CMElementDeclaration aDec, CMElementDeclaration otherDec) {
+ return aDec.getElementName() == otherDec.getElementName();
+ }
+
+ /**
+ */
+ public static boolean isSSI(CMElementDeclaration edec) {
+ if (edec == null)
+ return false;
+ if (!edec.supports(HTMLCMProperties.IS_SSI))
+ return false;
+ return ((Boolean) edec.getProperty(HTMLCMProperties.IS_SSI)).booleanValue();
+ }
+
+ /**
+ * Call this method only when the parent content type is one of
+ * the following: ANY, ELEMENT, or MIXED.
+ */
+ public static boolean isValidChild(CMElementDeclaration parent, CMElementDeclaration child) {
+ if (parent == null || child == null)
+ return false;
+ if (isHTML(parent) && (!isHTML(child)))
+ return true;
+ CMContent content = parent.getContent();
+ if (content == null)
+ return false;
+ return isChild(content, child);
+ }
+
+ public static boolean isForeign(Element target) {
+ if (!(target instanceof XMLElement))
+ return true;
+ XMLElement element = (XMLElement) target;
+ return !element.isGlobalTag();
+ }
+
+ /**
+ * This method returns true if all of the following conditions are met:
+ * (1) value type is ENUM,
+ * (2) only one value is defined in the enumeration,
+ * (3) the value has same name to the attribute name.
+ */
+ public static boolean isBooleanAttr(CMAttributeDeclaration adec) {
+ CMDataType attrtype = adec.getAttrType();
+ if (attrtype == null)
+ return false;
+ if (attrtype.getDataTypeName() != CMDataType.ENUM)
+ return false;
+ String[] values = attrtype.getEnumeratedValues();
+ if (values.length != 1)
+ return false;
+ return values[0].equals(adec.getAttrName());
+ }
+
+ public static boolean isValidInclusion(CMElementDeclaration decl, Element parent) {
+ Iterator iter = HMQUtil.getInclusions(parent).iterator();
+ while (iter.hasNext()) {
+ CMElementDeclaration inclusion = (CMElementDeclaration) iter.next();
+ if (isSameDeclaration(decl, inclusion))
+ return true;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CompositeValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CompositeValidator.java
new file mode 100644
index 0000000000..1c5a6017e5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/CompositeValidator.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.validate.ValidationAdapter;
+import org.eclipse.wst.sse.core.validate.ValidationReporter;
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+abstract class CompositeValidator extends ValidationComponent {
+
+ protected Vector components = new Vector();
+
+ /**
+ * CompositeValidator constructor comment.
+ */
+ public CompositeValidator() {
+ super();
+ }
+
+ /**
+ */
+ public void setReporter(ValidationReporter reporter) {
+ super.setReporter(reporter);
+
+ Iterator i = components.iterator();
+ while (i.hasNext()) {
+ ValidationAdapter component = (ValidationAdapter) i.next();
+ if (component == null)
+ continue;
+ component.setReporter(reporter);
+ }
+ }
+
+ /**
+ */
+ public void validate(IndexedRegion node) {
+ Iterator i = components.iterator();
+ while (i.hasNext()) {
+ ValidationComponent component = (ValidationComponent) i.next();
+ if (component == null)
+ continue;
+ component.validate(node);
+ }
+ }
+
+ /**
+ */
+ void add(ValidationComponent validator) {
+ components.add(validator);
+ }
+
+ /**
+ * This method registers all components in 'validators'.
+ * Each derivative must call this methid in its constructor.
+ */
+ protected void register(ValidationComponent[] validators) {
+ for (int i = 0; i < validators.length; i++) {
+ if (validators[i] != null)
+ add(validators[i]);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/DocumentPropagatingValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/DocumentPropagatingValidator.java
new file mode 100644
index 0000000000..51edfcda31
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/DocumentPropagatingValidator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.validate.ValidationAdapter;
+import org.eclipse.wst.sse.core.validate.ValidationReporter;
+import org.eclipse.wst.xml.core.internal.validate.AbstractPropagatingValidator;
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+class DocumentPropagatingValidator extends AbstractPropagatingValidator {
+
+
+ private ValidationComponent validator = new HTMLSimpleDocumentValidator();
+ private ElementPropagatingValidator propagatee = new ElementPropagatingValidator();
+
+ public DocumentPropagatingValidator() {
+ super();
+ }
+
+ public void validate(IndexedRegion node) {
+ getPropagatee().setReporter(this.reporter);
+ super.validate(node);
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return (type == DocumentPropagatingValidator.class || super.isAdapterForType(type));
+ }
+
+ public void setReporter(ValidationReporter reporter) {
+ super.setReporter(reporter);
+ validator.setReporter(reporter);
+ propagatee.setReporter(reporter);
+ }
+
+ /**
+ * @see com.ibm.sed.validate.html.AbstractPropagatingValidator#getPropagatee()
+ */
+ protected final ValidationComponent getPropagatee() {
+ return propagatee;
+ }
+
+ /**
+ * @see com.ibm.sed.validate.html.AbstractPropagatingValidator#getValidator()
+ */
+ protected final ValidationAdapter getValidator() {
+ return validator;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ElementPropagatingValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ElementPropagatingValidator.java
new file mode 100644
index 0000000000..bd10b279a2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ElementPropagatingValidator.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+import org.eclipse.wst.sse.core.validate.ValidationAdapter;
+import org.eclipse.wst.sse.core.validate.ValidationReporter;
+import org.eclipse.wst.xml.core.internal.validate.AbstractPropagatingValidator;
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+class ElementPropagatingValidator extends AbstractPropagatingValidator {
+
+
+ private ValidationComponent validator = new HTMLSimpleValidator();
+
+ public ElementPropagatingValidator() {
+ super();
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return (type == ElementPropagatingValidator.class || super.isAdapterForType(type));
+ }
+
+ public void setReporter(ValidationReporter reporter) {
+ super.setReporter(reporter);
+ validator.setReporter(reporter);
+ }
+
+ /**
+ * @see com.ibm.sed.validate.html.AbstractPropagatingValidator#getPropagatee()
+ */
+ protected ValidationComponent getPropagatee() {
+ return this;
+ }
+
+ /**
+ * @see com.ibm.sed.validate.html.AbstractPropagatingValidator#getValidator()
+ */
+ protected ValidationAdapter getValidator() {
+ return validator;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfo.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfo.java
new file mode 100644
index 0000000000..01ce2c0799
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfo.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+interface ErrorInfo {
+
+ public String getHint();
+
+ public int getLength();
+
+ public int getOffset();
+
+ public int getState();
+
+ public short getTargetType();
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfoImpl.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfoImpl.java
new file mode 100644
index 0000000000..f10294e99f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorInfoImpl.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+final class ErrorInfoImpl extends AbstractErrorInfo {
+
+ private Node target = null;
+
+ // private Segment seg = null;
+ /**
+ */
+ public ErrorInfoImpl(int state, Segment errorSeg, Node target) {
+ super(state, errorSeg);
+ this.target = target;
+ }
+
+ /**
+ */
+ public String getHint() {
+ switch (target.getNodeType()) {
+ case Node.ATTRIBUTE_NODE :
+ switch (getState()) {
+ case UNDEFINED_VALUE_ERROR :
+ case MISMATCHED_VALUE_ERROR :
+ case UNCLOSED_ATTR_VALUE :
+ //D210422
+ return ((Attr) target).getValue();
+ default :
+ return target.getNodeName();
+ }
+ case Node.TEXT_NODE :
+ return ((Text) target).getData();
+ case Node.ELEMENT_NODE :
+ default :
+ return target.getNodeName();
+ }
+ }
+
+ public short getTargetType() {
+ return target.getNodeType();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorState.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorState.java
new file mode 100644
index 0000000000..2c0eb26eba
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/ErrorState.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+interface ErrorState {
+ static final int NONE_ERROR = 0;
+ // generic error
+ static final int UNDEFINED_NAME_ERROR = 11;
+ static final int UNDEFINED_VALUE_ERROR = 12;
+ static final int MISMATCHED_VALUE_ERROR = 13;
+ // format error
+ static final int FORMAT_ERROR_LEVEL = 100;
+ static final int INVALID_NAME_ERROR = 101;
+ static final int INVALID_CHAR_ERROR = 102;
+ static final int MISMATCHED_ERROR = 103;
+ static final int MISMATCHED_END_TAG_ERROR = 104;
+ static final int MISSING_START_TAG_ERROR = 105;
+ static final int MISSING_END_TAG_ERROR = 106;
+ static final int UNNECESSARY_END_TAG_ERROR = 107;
+ static final int INVALID_ATTR_ERROR = 108;
+ static final int INVALID_DIRECTIVE_ERROR = 109;
+ static final int UNCLOSED_TAG_ERROR = 110;
+ static final int UNCLOSED_END_TAG_ERROR = 111;
+ static final int INVALID_EMPTY_ELEMENT_TAG = 112;
+ static final int UNCLOSED_ATTR_VALUE = 113; //D210422
+ // layout error
+ static final int LAYOUT_ERROR_LEVEL = 1000;
+ static final int INVALID_CONTENT_ERROR = 1001;
+ static final int DUPLICATE_ERROR = 1002;
+ static final int COEXISTENCE_ERROR = 1003;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/FMUtil.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/FMUtil.java
new file mode 100644
index 0000000000..da4f240415
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/FMUtil.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import java.util.Iterator;
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionContainer;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.jsp.model.parser.temp.XMLJSPRegionContexts;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+
+final class FMUtil {
+
+ public final static int SEG_NONE = 0;
+ public final static int SEG_WHOLE_TAG = 1;
+ public final static int SEG_START_TAG = 2;
+ public final static int SEG_END_TAG = 3;
+
+ /**
+ */
+ private FMUtil() {
+ super();
+ }
+
+ /**
+ */
+ public final static Segment getSegment(XMLNode target, int segType) {
+ if (target == null)
+ return new Segment(0, 0);
+ Segment seg = null;
+ IStructuredDocumentRegion startTag = null;
+ IStructuredDocumentRegion endTag = null;
+ switch (segType) {
+ case SEG_WHOLE_TAG :
+ startTag = target.getFirstStructuredDocumentRegion();
+ if (startTag != null) {
+ endTag = target.getLastStructuredDocumentRegion();
+ seg = new Segment(startTag, endTag);
+ }
+ else {
+ int startOffset = target.getStartOffset();
+ int endOffset = target.getEndOffset();
+ seg = new Segment(startOffset, endOffset - startOffset);
+ }
+ break;
+ case SEG_START_TAG :
+ startTag = target.getStartStructuredDocumentRegion();
+ if (startTag != null) {
+ seg = new Segment(startTag);
+ }
+ else {
+ seg = new Segment(target.getStartOffset(), 0);
+ }
+ break;
+ case SEG_END_TAG :
+ endTag = target.getEndStructuredDocumentRegion();
+ if (endTag != null) {
+ seg = new Segment(endTag);
+ }
+ else {
+ seg = new Segment(target.getEndOffset(), 0);
+ }
+ break;
+ case SEG_NONE :
+ default :
+ return new Segment(0, 0);
+ }
+ return seg;
+ }
+
+ /**
+ */
+ public final static boolean hasJSPRegion(ITextRegion container) {
+ if (!(container instanceof ITextRegionContainer))
+ return false;
+ ITextRegionList regions = ((ITextRegionContainer) container).getRegions();
+ if (regions == null)
+ return false;
+ Iterator e = regions.iterator();
+ while (e.hasNext()) {
+ ITextRegion region = (ITextRegion) e.next();
+ if (region == null)
+ continue;
+ String regionType = region.getType();
+ if (regionType == XMLRegionContext.XML_TAG_OPEN || regionType == XMLJSPRegionContexts.JSP_SCRIPTLET_OPEN || regionType == XMLJSPRegionContexts.JSP_EXPRESSION_OPEN || regionType == XMLJSPRegionContexts.JSP_DECLARATION_OPEN || regionType == XMLJSPRegionContexts.JSP_DIRECTIVE_OPEN)
+ return true;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLAttributeValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLAttributeValidator.java
new file mode 100644
index 0000000000..a57a30720d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLAttributeValidator.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMDataType;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.xml.core.document.XMLAttr;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+public class HTMLAttributeValidator extends PrimeValidator {
+
+ private static final int REGION_NAME = 1;
+ private static final int REGION_VALUE = 2;
+ //<<D210422
+ private static final char SINGLE_QUOTE = '\'';
+ private static final char DOUBLE_QUOTE = '\"';
+
+ //D210422
+ /**
+ * HTMLAttributeValidator constructor comment.
+ */
+ public HTMLAttributeValidator() {
+ super();
+ }
+
+ /**
+ */
+ private Segment getErrorSegment(XMLNode errorNode, int regionType) {
+ ITextRegion rgn = null;
+ switch (regionType) {
+ case REGION_NAME :
+ rgn = errorNode.getNameRegion();
+ break;
+ case REGION_VALUE :
+ rgn = errorNode.getValueRegion();
+ break;
+ default :
+ // nothing to do.
+ break;
+ }
+ if (rgn != null) {
+ if (errorNode instanceof XMLAttr) {
+ XMLElement ownerElement = (XMLElement) ((XMLAttr) errorNode).getOwnerElement();
+ if (ownerElement != null) {
+ int regionStartOffset = ownerElement.getFirstStructuredDocumentRegion().getStartOffset(rgn);
+ int regionLength = rgn.getLength();
+ return new Segment(regionStartOffset, regionLength);
+ }
+ }
+ }
+ return new Segment(errorNode.getStartOffset(), 0);
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return ((type == HTMLAttributeValidator.class) || super.isAdapterForType(type));
+ }
+
+ /**
+ */
+ public void validate(IndexedRegion node) {
+ Element target = (Element) node;
+ if (CMUtil.isForeign(target))
+ return;
+ CMElementDeclaration edec = CMUtil.getDeclaration(target);
+ if (edec == null)
+ return;
+ CMNamedNodeMap declarations = edec.getAttributes();
+
+ NamedNodeMap attrs = target.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ int rgnType = REGION_NAME;
+ int state = ErrorState.NONE_ERROR;
+ Attr a = (Attr) attrs.item(i);
+ // D203637; If the target attr has prefix, the validator should not
+ // warn about it. That is, just ignore. It is able to check whether
+ // an attr has prefix or not by calling XMLAttr#isGlobalAttr().
+ // When a attr has prefix (not global), it returns false.
+ boolean isXMLAttr = a instanceof XMLAttr;
+ if (isXMLAttr) {
+ XMLAttr xmlattr = (XMLAttr) a;
+ if (!xmlattr.isGlobalAttr())
+ continue; // skip futher validation and begin next loop.
+ }
+
+ CMAttributeDeclaration adec = (CMAttributeDeclaration) declarations.getNamedItem(a.getName());
+ if (adec == null) {
+ // No attr declaration was found. That is, the attr name is undefined.
+ // but not regard it as undefined name if it includes JSP
+ if (!FMUtil.hasJSPRegion(((XMLNode) a).getNameRegion())) {
+ rgnType = REGION_NAME;
+ state = ErrorState.UNDEFINED_NAME_ERROR;
+ }
+ }
+ else {
+ // The attr declaration was found.
+ // At 1st, the name should be checked.
+ if (CMUtil.isHTML(edec) && (!CMUtil.isXHTML(edec))) {
+ // If the target element is pure HTML (not XHTML), some attributes
+ // might be written in boolean format. It should be check specifically.
+ if (CMUtil.isBooleanAttr(adec) && ((XMLAttr) a).hasNameOnly())
+ continue; // OK, keep going. No more check is needed against this attr.
+ }
+ else {
+ // If the target is other than pure HTML (JSP or XHTML), the name
+ // must be checked exactly (ie in case sensitive way).
+ String actual = a.getName();
+ String desired = adec.getAttrName();
+ if (!actual.equals(desired)) { // case mismatch
+ rgnType = REGION_NAME;
+ state = ErrorState.MISMATCHED_ERROR;
+ }
+ }
+ // Then, the value must be checked.
+ if (state == ErrorState.NONE_ERROR) { // Need more check.
+ // Now, the value should be checked, if the type is ENUM.
+ CMDataType attrType = adec.getAttrType();
+ String actualValue = a.getValue();
+ if (attrType.getImpliedValueKind() == CMDataType.IMPLIED_VALUE_FIXED) {
+ // Check FIXED value.
+ String validValue = attrType.getImpliedValue();
+ if (!actualValue.equals(validValue)) {
+ rgnType = REGION_VALUE;
+ state = ErrorState.UNDEFINED_VALUE_ERROR;
+ }
+ }
+ else {
+ String[] candidates = attrType.getEnumeratedValues();
+ if (candidates != null && candidates.length > 0) {
+ // several candidates are found.
+ boolean found = false;
+ for (int index = 0; index < candidates.length; index++) {
+ String candidate = candidates[index];
+ // At 1st, compare ignoring case.
+ if (actualValue.equalsIgnoreCase(candidate)) {
+ found = true;
+ if (CMUtil.isCaseSensitive(edec) && (!actualValue.equals(candidate))) {
+ rgnType = REGION_VALUE;
+ state = ErrorState.MISMATCHED_VALUE_ERROR;
+ }
+ break; // exit the loop.
+ }
+ }
+ if (!found) {
+ // No candidate was found. That is, actualValue is invalid.
+ // but not regard it as undefined value if it includes JSP.
+ if (!FMUtil.hasJSPRegion(((XMLNode) a).getValueRegion())) {
+ rgnType = REGION_VALUE;
+ state = ErrorState.UNDEFINED_VALUE_ERROR;
+ }
+ }
+ }
+ }
+ }
+ //<<D210422
+ if (state == ErrorState.NONE_ERROR) { // Need more check.
+ if (isXMLAttr) {
+ String source = ((XMLAttr) a).getValueRegionText();
+ if (source != null) {
+ char firstChar = source.charAt(0);
+ char lastChar = source.charAt(source.length() - 1);
+ if (isQuote(firstChar) || isQuote(lastChar)) {
+ if (lastChar != firstChar) {
+ rgnType = REGION_VALUE;
+ state = ErrorState.UNCLOSED_ATTR_VALUE;
+ }
+ }
+ }
+ }
+ }
+ //D210422
+ }
+ if (state != ErrorState.NONE_ERROR) {
+ Segment seg = getErrorSegment((XMLNode) a, rgnType);
+ if (seg != null)
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(state, seg, a)));
+ }
+ }
+ }
+
+ //<<D214022
+ private boolean isQuote(char c) {
+ return (c == SINGLE_QUOTE) || (c == DOUBLE_QUOTE);
+ }
+ //D210422
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLDocumentContentValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLDocumentContentValidator.java
new file mode 100644
index 0000000000..14e298aed7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLDocumentContentValidator.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.xml.core.document.DocumentTypeAdapter;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.document.XMLText;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class HTMLDocumentContentValidator extends PrimeValidator {
+
+
+ private final static class Division {
+ private Vector explicitHtmls = new Vector();
+ private Vector rest = new Vector();
+
+ public Division(Document document, NodeList children) {
+ String rootTagName = getRootTagName(document);
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (isHtmlTag(child, rootTagName)) {
+ explicitHtmls.add(child);
+ }
+ else {
+ rest.add(child);
+ }
+ }
+ }
+
+ public boolean hasExplicitHtmls() {
+ return explicitHtmls.size() > 0;
+ }
+
+ public List getExplicitHtmls() {
+ return explicitHtmls;
+ }
+
+ public Iterator getRestNodes() {
+ return rest.iterator();
+ }
+
+ /* utilities */
+ private static boolean isHtmlTag(Node node, String tagName) {
+ if (node.getNodeType() != Node.ELEMENT_NODE)
+ return false;
+ return ((Element) node).getTagName().equalsIgnoreCase(tagName);
+ }
+
+ private static String getRootTagName(Document document) {
+ DocumentTypeAdapter adapter = (DocumentTypeAdapter) ((XMLDocument) document).getAdapterFor(DocumentTypeAdapter.class);
+ if (adapter != null) {
+ DocumentType docType = adapter.getDocumentType();
+ if (docType != null) {
+ return docType.getName();
+ }
+ }
+
+ return HTML40Namespace.ElementName.HTML;
+ }
+ }
+
+ /**
+ * HTMLDocumentContentValidator constructor comment.
+ */
+ public HTMLDocumentContentValidator() {
+ super();
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return ((type == HTMLDocumentContentValidator.class) || super.isAdapterForType(type));
+ }
+
+ /**
+ */
+ public void validate(IndexedRegion node) {
+ // isFragment check should be more intelligent.
+ boolean isFragment = true;
+
+ Document target = (Document) node;
+ NodeList children = target.getChildNodes();
+ if (children == null)
+ return;
+
+ Division division = new Division(target, children);
+ if (division.hasExplicitHtmls()) {
+ isFragment = false;
+
+ List explicits = division.getExplicitHtmls();
+ if (explicits.size() > 1) {
+ for (int i = 1; i < explicits.size(); i++) {
+ Element html = (Element) explicits.get(i);
+ // report error (duplicate)
+ Segment errorSeg = FMUtil.getSegment((XMLNode) html, FMUtil.SEG_START_TAG);
+ if (errorSeg != null)
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(ErrorState.DUPLICATE_ERROR, errorSeg, html)));
+ }
+ }
+ }
+ validateContent(division.getRestNodes(), isFragment);
+ }
+
+ /*
+ * This methods validate nodes other than HTML elements.
+ */
+ private void validateContent(Iterator children, boolean isFragment) {
+ boolean foundDoctype = false;
+ while (children.hasNext()) {
+ XMLNode child = (XMLNode) children.next();
+
+ int error = ErrorState.NONE_ERROR;
+ int segType = FMUtil.SEG_WHOLE_TAG;
+
+ switch (child.getNodeType()) {
+ case Node.ELEMENT_NODE :
+ if (! isFragment) {
+ Element childElem = (Element) child;
+ CMElementDeclaration ced = CMUtil.getDeclaration(childElem);
+ // Undefined element is valid.
+ if (ced == null)
+ continue;
+ // JSP (includes custom tags) and SSI are valid.
+ if (CMUtil.isForeign(childElem) || CMUtil.isSSI(ced))
+ continue; // Defect 186774
+
+ // report error (invalid content)
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ // mark the whole start tag as error.
+ segType = FMUtil.SEG_START_TAG;
+ }
+ break;
+ case Node.TEXT_NODE :
+ if (! isFragment) {
+ // TEXT node is valid when it contains white space characters only.
+ // Otherwise, it is invalid content.
+ if (((XMLText) child).isWhitespace())
+ continue;
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ segType = FMUtil.SEG_WHOLE_TAG;
+ }
+ break;
+ case Node.DOCUMENT_TYPE_NODE :
+ // DOCTYPE is also valid when it appears once and only once.
+ if (!foundDoctype) {
+ foundDoctype = true;
+ continue;
+ }
+ error = ErrorState.DUPLICATE_ERROR;
+ segType = FMUtil.SEG_WHOLE_TAG;
+ break;
+ case Node.COMMENT_NODE :
+ // always valid.
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ continue;
+ default :
+ if (! isFragment) {
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ segType = FMUtil.SEG_WHOLE_TAG;
+ }
+ break;
+ }
+ if (error != ErrorState.NONE_ERROR) {
+ Segment errorSeg = FMUtil.getSegment(child, segType);
+ if (errorSeg != null)
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(error, errorSeg, child)));
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementAncestorValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementAncestorValidator.java
new file mode 100644
index 0000000000..b4c26b4561
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementAncestorValidator.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.w3c.dom.Element;
+
+public class HTMLElementAncestorValidator extends PrimeValidator {
+
+ /**
+ * HTMLElementAncestorValidator constructor comment.
+ */
+ public HTMLElementAncestorValidator() {
+ super();
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return ((type == HTMLElementAncestorValidator.class) || super.isAdapterForType(type));
+ }
+
+ /**
+ * Check exclusion which is defined in only HTML DTD (SGML).
+ */
+ public void validate(IndexedRegion node) {
+ Element target = (Element) node;
+ if (CMUtil.isForeign(target))
+ return;
+ CMElementDeclaration dec = CMUtil.getDeclaration(target);
+ if (dec == null)
+ return; // cannot validate.
+ if (!CMUtil.isHTML(dec))
+ return; // no need to validate
+ if (!dec.supports(HTMLCMProperties.PROHIBITED_ANCESTORS))
+ return; // cannot validate.
+ CMNamedNodeMap prohibited = (CMNamedNodeMap) dec.getProperty(HTMLCMProperties.PROHIBITED_ANCESTORS);
+ if (prohibited.getLength() <= 0)
+ return; // no prohibited ancestors.
+
+ Element parent = SMUtil.getParentElement(target);
+ while (parent != null) {
+ CMNode pdec = prohibited.getNamedItem(parent.getNodeName());
+ if (pdec != null) { // prohibited element is found in ancestors.
+ Segment errorSeg = FMUtil.getSegment((XMLNode) node, FMUtil.SEG_START_TAG);
+ if (errorSeg != null)
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(ErrorState.INVALID_CONTENT_ERROR, errorSeg, target)));
+ break; // If one prohibited ancestor is found, it's enough.
+ }
+ parent = SMUtil.getParentElement(parent);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementContentValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementContentValidator.java
new file mode 100644
index 0000000000..007c225719
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLElementContentValidator.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.document.XMLText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class HTMLElementContentValidator extends PrimeValidator {
+
+ /**
+ * HTMLElementContentValidator constructor comment.
+ */
+ public HTMLElementContentValidator() {
+ super();
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return ((type == HTMLElementContentValidator.class) || super.isAdapterForType(type));
+ }
+
+ /**
+ */
+ public void validate(IndexedRegion node) {
+ Element target = (Element) node;
+ if (CMUtil.isForeign(target))
+ return;
+
+ validateContent(target, target.getChildNodes());
+ }
+
+ private void validateContent(Element parent, NodeList children) {
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child == null)
+ continue;
+
+ // perform actual validation
+ validateNode(parent, child);
+ }
+ }
+
+// private int countExplicitSiblings(Element parent, String tagName) {
+// NodeList children = parent.getChildNodes();
+// int count = 0;
+// for (int i = 0; i < children.getLength(); i++) {
+// Node child = children.item(i);
+// if (child.getNodeType() != Node.ELEMENT_NODE)
+// continue;
+// if (tagName.equalsIgnoreCase(((Element) child).getTagName())) {
+// count++;
+// }
+// }
+// return count;
+// }
+
+ /* The implementation of the following method is practical but accurate.
+ * The accurate maximum occurence should be retreive from the content model.
+ * However, it is useful enough, since almost implicit elements are HTML,
+ * HEAD, or BODY.
+ */
+// private int getMaxOccur(Element parent, String childTag) {
+// return 1;
+// }
+
+ private void validateNode(Element target, Node child) {
+ // NOTE: If the target element is 'UNKNOWN', that is, it has no
+ // element declaration, the content type of the element should be
+ // regarded as 'ANY'. -- 9/10/2001
+ int contentType = CMElementDeclaration.ANY;
+ CMElementDeclaration edec = CMUtil.getDeclaration(target);
+ if (edec != null)
+ contentType = edec.getContentType();
+
+ int error = ErrorState.NONE_ERROR;
+ int segType = FMUtil.SEG_WHOLE_TAG;
+
+ switch (child.getNodeType()) {
+ case Node.ELEMENT_NODE :
+ Element childElem = (Element) child;
+ // Defect 200321:
+ // This validator cares only HTML/XHTML elements. If a child is
+ // an element of foreign markup languages, just ignore it.
+ if (CMUtil.isForeign(childElem))
+ return;
+
+ CMElementDeclaration ced = CMUtil.getDeclaration((Element) child);
+ // Defect 186774: If a child is not one of HTML elements,
+ // it should be regarded as a valid child regardless the
+ // type of the parent content model. -- 10/12/2001
+ if (ced == null || CMUtil.isSSI(ced) || (!CMUtil.isHTML(ced)))
+ return;
+
+ switch (contentType) {
+ case CMElementDeclaration.ANY :
+ // Keep going.
+ return;
+ case CMElementDeclaration.ELEMENT :
+ case CMElementDeclaration.MIXED :
+ if (ced == null)
+ return;
+ if (CMUtil.isValidChild(edec, ced))
+ return;
+ // Now, it is the time to check inclusion, unless the target
+ // document is not a XHTML.
+ if (!CMUtil.isXHTML(edec)) {
+ // pure HTML
+ if (CMUtil.isValidInclusion(ced, target))
+ return;
+ }
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ break;
+ default :
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ break;
+ }
+ // Mark the whole START tag as an error segment.
+ segType = FMUtil.SEG_START_TAG;
+ break;
+ case Node.TEXT_NODE :
+ switch (contentType) {
+ case CMElementDeclaration.ANY :
+ case CMElementDeclaration.MIXED :
+ case CMElementDeclaration.PCDATA :
+ case CMElementDeclaration.CDATA :
+ // D184339
+ // Keep going.
+ return;
+ case CMElementDeclaration.ELEMENT :
+ case CMElementDeclaration.EMPTY :
+ if (((XMLText) child).isWhitespace())
+ return;
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ break;
+ default :
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ break;
+ }
+ // Mark the whole node as an error segment.
+ segType = FMUtil.SEG_WHOLE_TAG;
+ break;
+ case Node.COMMENT_NODE :
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ if (contentType != CMElementDeclaration.EMPTY)
+ return;
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ // Mark the whole node as an error segment.
+ segType = FMUtil.SEG_WHOLE_TAG;
+ break;
+ default :
+ error = ErrorState.INVALID_CONTENT_ERROR;
+ // Mark the whole node as an error segment.
+ segType = FMUtil.SEG_WHOLE_TAG;
+ break;
+ }
+ if (error != ErrorState.NONE_ERROR) {
+ Segment errorSeg = FMUtil.getSegment((XMLNode) child, segType);
+ if (errorSeg != null)
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(error, errorSeg, child)));
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleDocumentValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleDocumentValidator.java
new file mode 100644
index 0000000000..d3630a3626
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleDocumentValidator.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+class HTMLSimpleDocumentValidator extends CompositeValidator {
+
+ /**
+ * HTMLSimpleDocumentValidator constructor comment.
+ */
+ public HTMLSimpleDocumentValidator() {
+ super();
+
+ ValidationComponent[] validators = new ValidationComponent[2];
+
+ validators[0] = new HTMLDocumentContentValidator();
+ validators[1] = new SyntaxValidator();
+
+ register(validators);
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return ((type == HTMLSimpleDocumentValidator.class) || super.isAdapterForType(type));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleValidator.java
new file mode 100644
index 0000000000..47b6ff8f3e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLSimpleValidator.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+class HTMLSimpleValidator extends CompositeValidator {
+
+ /**
+ * HTMLSimpleValidator constructor comment.
+ */
+ public HTMLSimpleValidator() {
+ super();
+
+ ValidationComponent[] validators = new ValidationComponent[5];
+
+ validators[0] = new HTMLAttributeValidator();
+ validators[1] = new HTMLElementContentValidator();
+ validators[2] = new SyntaxValidator();
+ validators[3] = new HTMLElementAncestorValidator();
+ validators[4] = new NamespaceValidator();
+
+ register(validators);
+ }
+
+ /**
+ * Allowing the INodeAdapter to compare itself against the type
+ * allows it to return true in more than one case.
+ */
+ public boolean isAdapterForType(Object type) {
+ return ((type == HTMLSimpleValidator.class) || super.isAdapterForType(type));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLValidationAdapterFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLValidationAdapterFactory.java
new file mode 100644
index 0000000000..68185c317f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/HTMLValidationAdapterFactory.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import org.eclipse.wst.sse.core.AbstractAdapterFactory;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.validate.ValidationAdapter;
+import org.w3c.dom.Node;
+
+public class HTMLValidationAdapterFactory extends AbstractAdapterFactory {
+
+ private static HTMLValidationAdapterFactory instance = null;
+
+ /**
+ * HTMLValidationAdapterFactory constructor comment.
+ */
+ public HTMLValidationAdapterFactory() {
+ super(ValidationAdapter.class, true);
+ }
+
+ /**
+ * HTMLValidationAdapterFactory constructor comment.
+ * @param adapterKey java.lang.Object
+ * @param registerAdapters boolean
+ */
+ public HTMLValidationAdapterFactory(Object adapterKey, boolean registerAdapters) {
+ super(adapterKey, registerAdapters);
+ }
+
+ /**
+ */
+ protected INodeAdapter createAdapter(INodeNotifier target) {
+ Node node = (Node) target;
+ switch (node.getNodeType()) {
+ case Node.DOCUMENT_NODE :
+ return new DocumentPropagatingValidator();
+ case Node.ELEMENT_NODE :
+ return new ElementPropagatingValidator();
+ default :
+ return new NullValidator();
+ }
+ }
+
+ /**
+ */
+ public synchronized static HTMLValidationAdapterFactory getInstance() {
+ if (instance != null)
+ return instance;
+ instance = new HTMLValidationAdapterFactory();
+ return instance;
+ }
+
+ /**
+ * Overriding Object's clone() method
+ * This is used in IModelManager's IStructuredModel copying.
+ */
+ public AdapterFactory copy() {
+ return getInstance();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/MessageFactory.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/MessageFactory.java
new file mode 100644
index 0000000000..0419e925d5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/MessageFactory.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import java.text.MessageFormat;
+import java.util.Hashtable;
+
+import org.eclipse.wst.html.core.internal.Logger;
+import org.eclipse.wst.html.core.internal.nls.ResourceHandler;
+import org.eclipse.wst.sse.core.validate.ValidationMessage;
+import org.w3c.dom.Node;
+
+class MessageFactory implements ErrorState {
+
+
+ private static class ErrorTable {
+ private class Packet {
+ public Packet(String msg, int severity) {
+ this.msg = msg;
+ this.severity = severity;
+ }
+
+ public String getMessage() {
+ return msg;
+ }
+
+ public int getSeverity() {
+ return severity;
+ }
+
+ private String msg = null;
+ private int severity = -1;
+ }
+
+ public ErrorTable() {
+ }
+
+ public void put(int state, String msg, int severity) {
+ Packet packet = new Packet(msg, severity);
+ map.put(new Integer(state), packet);
+ }
+
+ public String getMessage(int state) {
+ return getPacket(state).getMessage();
+ }
+
+ public int getSeverity(int state) {
+ return getPacket(state).getSeverity();
+ }
+
+ private Packet getPacket(int state) {
+ return (Packet) map.get(new Integer(state));
+ }
+
+ private Hashtable map = new Hashtable();
+ }
+
+ private static interface NodeType {
+ static final int ATTRIBUTE = 0;
+ static final int ELEMENT = 1;
+ static final int DOCUMENT_TYPE = 2;
+ static final int TEXT = 3;
+ static final int COMMENT = 4;
+ static final int CDATA_SECTION = 5;
+ static final int PROCESSING_INSTRUCTION = 6;
+ static final int ENTITY_REFERENCE = 7;
+
+ static final int MAX_TYPE = 8;
+ }
+
+ // error messages
+ private static final String MSG_NO_ERROR = ResourceHandler.getString("No_error._UI_"); //$NON-NLS-1$ = "No error."
+ private static final String MSG_UNDEFINED_ATTR_ERROR = ResourceHandler.getString("Undefined_attribute_name_(_ERROR_"); //$NON-NLS-1$ = "Undefined attribute name ({0})."
+ private static final String MSG_UNDEFINED_VALUE_ERROR = ResourceHandler.getString("Undefined_attribute_value__ERROR_"); //$NON-NLS-1$ = "Undefined attribute value ({0})."
+ private static final String MSG_DUPLICATE_ATTR_ERROR = ResourceHandler.getString("Multiple_values_specified__ERROR_"); //$NON-NLS-1$ = "Multiple values specified for an attribute ({0})."
+ private static final String MSG_MISMATCHED_ATTR_ERROR = ResourceHandler.getString("Attribute_name_({0})_uses__ERROR_"); //$NON-NLS-1$ = "Attribute name ({0}) uses wrong case character."
+ private static final String MSG_INVALID_ATTR_ERROR = ResourceHandler.getString("Invalid_attribute_name_({0_ERROR_"); //$NON-NLS-1$ = "Invalid attribute name ({0})."
+ private static final String MSG_ATTR_NO_VALUE_ERROR = ResourceHandler.getString("Invalid_attribute_({0})._ERROR_"); //$NON-NLS-1$ = "Invalid attribute ({0})."
+ private static final String MSG_INVALID_CONTENT_ERROR = ResourceHandler.getString("Invalid_location_of_tag_({_ERROR_"); //$NON-NLS-1$ = "Invalid location of tag ({0})."
+ private static final String MSG_DUPLICATE_TAG_ERROR = ResourceHandler.getString("Duplicate_tag_({0})._ERROR_"); //$NON-NLS-1$ = "Duplicate tag ({0})."
+ private static final String MSG_MISSING_START_TAG_ERROR = ResourceHandler.getString("No_start_tag_(<{0}>)._ERROR_"); //$NON-NLS-1$ = "No start tag (<{0}>)."
+ private static final String MSG_MISSING_END_TAG_ERROR = ResourceHandler.getString("No_end_tag_(</{0}>)._ERROR_"); //$NON-NLS-1$ = "No end tag (</{0}>)."
+ private static final String MSG_UNNECESSARY_END_TAG_ERROR = ResourceHandler.getString("End_tag_(</{0}>)_not_neede_ERROR_"); //$NON-NLS-1$ = "End tag (</{0}>) not needed."
+ private static final String MSG_UNDEFINED_TAG_ERROR = ResourceHandler.getString("Unknown_tag_({0})._ERROR_"); //$NON-NLS-1$ = "Unknown tag ({0})."
+ private static final String MSG_MISMATCHED_TAG_ERROR = ResourceHandler.getString("Tag_name_({0})_uses_wrong__ERROR_"); //$NON-NLS-1$ = "Tag name ({0}) uses wrong case character."
+ private static final String MSG_INVALID_TAG_ERROR = ResourceHandler.getString("Invalid_tag_name_({0})._ERROR_"); //$NON-NLS-1$ = "Invalid tag name ({0})."
+ private static final String MSG_INVALID_DIRECTIVE_ERROR = ResourceHandler.getString("Invalid_JSP_directive_({0}_ERROR_"); //$NON-NLS-1$ = "Invalid JSP directive ({0})."
+ private static final String MSG_INVALID_TEXT_ERROR = ResourceHandler.getString("Invalid_text_string_({0})._ERROR_"); //$NON-NLS-1$ = "Invalid text string ({0})."
+ private static final String MSG_INVALID_CHAR_ERROR = ResourceHandler.getString("Invalid_character_used_in__ERROR_"); //$NON-NLS-1$ = "Invalid character used in text string ({0})."
+ private static final String MSG_UNKNOWN_ERROR = ResourceHandler.getString("Unknown_error._ERROR_"); //$NON-NLS-1$ = "Unknown error."
+ private static final String MSG_UNCLOSED_START_TAG_ERROR = ResourceHandler.getString("Start_tag_(<{0}>)_not_clos_ERROR_"); //$NON-NLS-1$ = "Start tag (<{0}>) not closed."
+ private static final String MSG_UNCLOSED_END_TAG_ERROR = ResourceHandler.getString("End_tag_(</{0}>)_not_close_ERROR_"); //$NON-NLS-1$ = "End tag (</{0}>) not closed."
+ private static final String MSG_UNCLOSED_TAG_ERROR = ResourceHandler.getString("Tag_({0})_not_closed._ERROR_"); //$NON-NLS-1$ = "Tag ({0}) not closed."
+ private static final String MSG_MISMATCHED_ATTR_VALUE_ERROR = ResourceHandler.getString("Attribute_value_({0})_uses_ERROR_"); //$NON-NLS-1$ = "Attribute value ({0}) uses wrong case character."
+ private static final String MSG_UNCLOSED_COMMENT_ERROR = ResourceHandler.getString("Comment_not_closed._ERROR_"); //$NON-NLS-1$ = "Comment not closed."
+ private static final String MSG_UNCLOSED_DOCTYPE_ERROR = ResourceHandler.getString("DOCTYPE_declaration_not_cl_ERROR_"); //$NON-NLS-1$ = "DOCTYPE declaration not closed."
+ private static final String MSG_UNCLOSED_PI_ERROR = ResourceHandler.getString("Processing_instruction_not_ERROR_"); //$NON-NLS-1$ = "Processing instruction not closed."
+ private static final String MSG_UNCLOSED_CDATA_SECTION_ERROR = ResourceHandler.getString("CDATA_section_not_closed._ERROR_"); //$NON-NLS-1$ = "CDATA section not closed."
+ private static final String MSG_INVALID_EMPTY_ELEMENT_TAG = ResourceHandler.getString("_ERROR_Tag_({0})_should_be_an_empty-element_tag_1"); //$NON-NLS-1$ = "Tag ({0}) should be an empty-element tag."
+ private static final String MSG_UNCLOSED_ATTR_VALUE_ERROR = ResourceHandler.getString("_ERROR_Attribute_value_({0})_not_closed._1"); //$NON-NLS-1$ ="Attribute value ({0}) not closed."
+ private static ErrorTable[] errTables = new ErrorTable[NodeType.MAX_TYPE];
+
+ static {
+ for (int i = 0; i < NodeType.MAX_TYPE; i++) {
+ errTables[i] = new ErrorTable();
+ }
+ // NOTE: The severities are just stub. They must be reviewed.
+ // -- 8/30/2001
+
+ // attribute error map
+ ErrorTable attrTable = errTables[NodeType.ATTRIBUTE];// short hand
+ attrTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ attrTable.put(UNDEFINED_NAME_ERROR, MSG_UNDEFINED_ATTR_ERROR, ValidationMessage.WARNING);
+ attrTable.put(UNDEFINED_VALUE_ERROR, MSG_UNDEFINED_VALUE_ERROR, ValidationMessage.WARNING);
+ attrTable.put(MISMATCHED_ERROR, MSG_MISMATCHED_ATTR_ERROR, ValidationMessage.WARNING);
+ attrTable.put(INVALID_NAME_ERROR, MSG_INVALID_ATTR_ERROR, ValidationMessage.WARNING);
+ attrTable.put(INVALID_ATTR_ERROR, MSG_ATTR_NO_VALUE_ERROR, ValidationMessage.WARNING);
+ attrTable.put(DUPLICATE_ERROR, MSG_DUPLICATE_ATTR_ERROR, ValidationMessage.WARNING);
+ attrTable.put(MISMATCHED_VALUE_ERROR, MSG_MISMATCHED_ATTR_VALUE_ERROR, ValidationMessage.ERROR);
+ //<<D210422
+ attrTable.put(UNCLOSED_ATTR_VALUE, MSG_UNCLOSED_ATTR_VALUE_ERROR, ValidationMessage.WARNING);
+ //D210422
+ // element error map
+ ErrorTable elemTable = errTables[NodeType.ELEMENT];// short hand
+ elemTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ elemTable.put(UNDEFINED_NAME_ERROR, MSG_UNDEFINED_TAG_ERROR, ValidationMessage.WARNING);
+ elemTable.put(INVALID_NAME_ERROR, MSG_INVALID_TAG_ERROR, ValidationMessage.ERROR);
+ elemTable.put(MISMATCHED_ERROR, MSG_MISMATCHED_TAG_ERROR, ValidationMessage.WARNING);
+ elemTable.put(MISMATCHED_END_TAG_ERROR, MSG_MISMATCHED_TAG_ERROR, ValidationMessage.ERROR);
+ elemTable.put(MISSING_START_TAG_ERROR, MSG_MISSING_START_TAG_ERROR, ValidationMessage.ERROR);
+ elemTable.put(MISSING_END_TAG_ERROR, MSG_MISSING_END_TAG_ERROR, ValidationMessage.WARNING);
+ elemTable.put(UNNECESSARY_END_TAG_ERROR, MSG_UNNECESSARY_END_TAG_ERROR, ValidationMessage.WARNING);
+ elemTable.put(INVALID_DIRECTIVE_ERROR, MSG_INVALID_DIRECTIVE_ERROR, ValidationMessage.ERROR);
+ elemTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ elemTable.put(DUPLICATE_ERROR, MSG_DUPLICATE_TAG_ERROR, ValidationMessage.WARNING);
+ elemTable.put(COEXISTENCE_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ elemTable.put(UNCLOSED_TAG_ERROR, MSG_UNCLOSED_START_TAG_ERROR, ValidationMessage.ERROR);
+ elemTable.put(UNCLOSED_END_TAG_ERROR, MSG_UNCLOSED_END_TAG_ERROR, ValidationMessage.ERROR);
+ elemTable.put(INVALID_EMPTY_ELEMENT_TAG, MSG_INVALID_EMPTY_ELEMENT_TAG, ValidationMessage.WARNING);
+
+ // document type error map
+ ErrorTable docTable = errTables[NodeType.DOCUMENT_TYPE];// short hand
+ docTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ docTable.put(DUPLICATE_ERROR, MSG_DUPLICATE_TAG_ERROR, ValidationMessage.ERROR);
+ docTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ docTable.put(UNCLOSED_TAG_ERROR, MSG_UNCLOSED_DOCTYPE_ERROR, ValidationMessage.ERROR);
+
+ // text error map
+ ErrorTable textTable = errTables[NodeType.TEXT];
+ textTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ textTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_TEXT_ERROR, ValidationMessage.WARNING);
+ textTable.put(INVALID_CHAR_ERROR, MSG_INVALID_CHAR_ERROR, ValidationMessage.WARNING);
+
+ // comment error map
+ ErrorTable commTable = errTables[NodeType.COMMENT];
+ commTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ commTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ commTable.put(UNCLOSED_TAG_ERROR, MSG_UNCLOSED_COMMENT_ERROR, ValidationMessage.ERROR);
+
+ // cdata section error map
+ ErrorTable cdatTable = errTables[NodeType.CDATA_SECTION];
+ cdatTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ cdatTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ cdatTable.put(UNCLOSED_TAG_ERROR, MSG_UNCLOSED_CDATA_SECTION_ERROR, ValidationMessage.ERROR);
+
+ // processing instruction error map
+ ErrorTable piTable = errTables[NodeType.PROCESSING_INSTRUCTION];
+ piTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ piTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ piTable.put(UNCLOSED_TAG_ERROR, MSG_UNCLOSED_PI_ERROR, ValidationMessage.ERROR);
+
+ // entity reference error map
+ ErrorTable erTable = errTables[NodeType.ENTITY_REFERENCE];
+ erTable.put(NONE_ERROR, MSG_NO_ERROR, 0);
+ erTable.put(UNDEFINED_NAME_ERROR, MSG_UNDEFINED_TAG_ERROR, ValidationMessage.WARNING);
+ erTable.put(INVALID_CONTENT_ERROR, MSG_INVALID_CONTENT_ERROR, ValidationMessage.WARNING);
+ }
+
+ /**
+ */
+ public static ValidationMessage createMessage(ErrorInfo info) {
+ String errorMsg = getErrorMessage(info);
+ int errorSeverity = getErrorSeverity(info);
+ return new ValidationMessage(errorMsg, info.getOffset(), info.getLength(), errorSeverity);
+ }
+
+ private static String getErrorMessage(ErrorInfo info) {
+ ErrorTable tab = getErrorTable(info.getTargetType());
+ if (tab == null)
+ return MSG_UNKNOWN_ERROR;
+
+ String template = tab.getMessage(info.getState());
+ Object[] arguments = {info.getHint()};
+ String s = null;
+ try {
+ s = MessageFormat.format(template, arguments);
+ }
+ catch (IllegalArgumentException e) {
+ Logger.logException(e);
+ s = template + ":" + arguments.toString(); //$NON-NLS-1$
+ }
+ return s;
+ }
+
+ /**
+ */
+ private static int getErrorSeverity(ErrorInfo info) {
+ ErrorTable tab = getErrorTable(info.getTargetType());
+ if (tab == null)
+ return 0;
+ return tab.getSeverity(info.getState());
+ }
+
+ private static ErrorTable getErrorTable(short nodetype) {
+ ErrorTable tab = null;
+ switch (nodetype) {
+ case Node.ATTRIBUTE_NODE :
+ tab = errTables[NodeType.ATTRIBUTE];
+ break;
+ case Node.ELEMENT_NODE :
+ tab = errTables[NodeType.ELEMENT];
+ break;
+ case Node.DOCUMENT_TYPE_NODE :
+ tab = errTables[NodeType.DOCUMENT_TYPE];
+ break;
+ case Node.TEXT_NODE :
+ tab = errTables[NodeType.TEXT];
+ break;
+ case Node.COMMENT_NODE :
+ tab = errTables[NodeType.COMMENT];
+ break;
+ case Node.CDATA_SECTION_NODE :
+ tab = errTables[NodeType.CDATA_SECTION];
+ break;
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ tab = errTables[NodeType.PROCESSING_INSTRUCTION];
+ break;
+ case Node.ENTITY_REFERENCE_NODE :
+ tab = errTables[NodeType.ENTITY_REFERENCE];
+ break;
+ default :
+ return null;
+ }
+ return tab;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NamespaceValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NamespaceValidator.java
new file mode 100644
index 0000000000..f2e605da44
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NamespaceValidator.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+import org.eclipse.wst.common.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.xml.core.document.XMLAttr;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+public class NamespaceValidator extends PrimeValidator implements ErrorState {
+
+ private final static String XMLNS_PREFIX = "xmlns";//$NON-NLS-1$
+ private final static String NS_SEPARATOR = ":";//$NON-NLS-1$
+
+ public NamespaceValidator() {
+ super();
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return ((type == NamespaceValidator.class) || super.isAdapterForType(type));
+ }
+
+ public void validate(IndexedRegion node) {
+ Element target = (Element) node;
+ if (isXMLElement(target) && hasUnknownPrefix(target)) {
+ XMLElement e = (XMLElement) target;
+ if (!isValidPrefix(e.getPrefix(), target) && !e.isCommentTag()) {
+ // report unknown tag error.
+ Segment errorSeg = FMUtil.getSegment(e, FMUtil.SEG_START_TAG);
+ if (errorSeg != null)
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(UNDEFINED_NAME_ERROR, errorSeg, e)));
+ }
+ }
+ // (2) check prefix of each attr
+ NamedNodeMap attrs = target.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Node n = attrs.item(i);
+ if (!(n instanceof XMLAttr))
+ continue;
+ XMLAttr a = (XMLAttr) n;
+ String prefix = a.getPrefix();
+ if ((prefix != null) && isUnknownAttr(a, target)) {
+ // The attr has unknown prefix. So, check it.
+ if (!isValidPrefix(prefix, target)) {
+ // report unknown attr error.
+ ITextRegion r = a.getNameRegion();
+ if (r == null)
+ continue;
+ int a_offset = a.getNameRegionStartOffset();
+ int a_length = a.getNameRegion().getLength();
+ reporter.report(MessageFactory.createMessage(new ErrorInfoImpl(UNDEFINED_NAME_ERROR, new Segment(a_offset, a_length), a)));
+ }
+ }
+ }
+ }
+
+ // private methods
+ private boolean isXMLElement(Element target) {
+ return target instanceof XMLElement;
+ }
+
+ private boolean hasUnknownPrefix(Element target) {
+ return isUnknownElement(target) && CMUtil.isForeign(target);
+ }
+
+ private boolean isUnknownElement(Element target) {
+ CMElementDeclaration dec = CMUtil.getDeclaration(target);
+ return dec == null;
+ }
+
+ private boolean isUnknownAttr(XMLAttr attr, Element target) {
+ CMElementDeclaration dec = CMUtil.getDeclaration(target);
+ if (dec == null)
+ return true; // unknown.
+ CMNamedNodeMap adecls = dec.getAttributes();
+ CMAttributeDeclaration adec = (CMAttributeDeclaration) adecls.getNamedItem(attr.getName());
+ return adec == null;
+ }
+
+ private boolean isValidPrefix(String prefix, Element e) {
+ if (prefix.equals(XMLNS_PREFIX))
+ return true; // "xmlns:foo" attr is always valid.
+
+ // (1) check the element has the namespace definition or not.
+ if (isValidPrefixWithinElement(prefix, e))
+ return true;
+
+ // (2) check ancestors of the element have the namespace definition or not.
+ Element parent = SMUtil.getParentElement(e);
+ while (parent != null) {
+ if (isValidPrefixWithinElement(prefix, parent))
+ return true;
+ parent = SMUtil.getParentElement(parent);
+ }
+ return false;
+ }
+
+ private boolean isValidPrefixWithinElement(String prefix, Element e) {
+ String ns = XMLNS_PREFIX + NS_SEPARATOR + prefix;
+ NamedNodeMap attrs = e.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Node n = attrs.item(i);
+ if (n == null)
+ continue;
+ if (n.getNodeType() != Node.ATTRIBUTE_NODE)
+ continue;
+ if (ns.equals(((Attr) n).getName()))
+ return true;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NullValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NullValidator.java
new file mode 100644
index 0000000000..1a9cbc0e7a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/NullValidator.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.validate.ValidationReporter;
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+/**
+ * NullValidator class is intended to be a replacement of null
+ * for ValidationComponent type.
+ */
+final class NullValidator extends ValidationComponent {
+
+ public NullValidator() {
+ super();
+ }
+
+ public void validate(IndexedRegion node) {
+ return;
+ }
+
+ public void setReporter(ValidationReporter reporter) {
+ return;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/PrimeValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/PrimeValidator.java
new file mode 100644
index 0000000000..6278a3ab23
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/PrimeValidator.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import org.eclipse.wst.xml.core.internal.validate.ValidationComponent;
+
+abstract class PrimeValidator extends ValidationComponent {
+
+ /**
+ * PrimeValidator constructor comment.
+ */
+ public PrimeValidator() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SMUtil.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SMUtil.java
new file mode 100644
index 0000000000..97adcf80fc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SMUtil.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+final class SMUtil {
+
+ private SMUtil() {
+ super();
+ }
+
+ /* get an ancestor element ignoring implicit ones. */
+ public static Element getParentElement(Node child) {
+ if (child == null)
+ return null;
+
+ Node p = child.getParentNode();
+ while (p != null) {
+ if (p.getNodeType() == Node.ELEMENT_NODE) {
+ return (Element) p;
+ }
+ p = p.getParentNode();
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/Segment.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/Segment.java
new file mode 100644
index 0000000000..2e5db726e5
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/Segment.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+
+
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+
+public class Segment {
+
+ private int offset = 0;
+ private int length = 0;
+
+ /**
+ */
+ public Segment(int offset, int length) {
+ super();
+ this.offset = offset;
+ this.length = length;
+ }
+
+ public Segment(IStructuredDocumentRegion region) {
+ super();
+ this.offset = region.getStartOffset();
+ this.length = region.getLength();
+ }
+
+ /**
+ * NOTE: 'start' and 'end' must be the start and end of the contiguous regions.
+ * Otherwise, this class cannot work correctly.
+ */
+ public Segment(IStructuredDocumentRegion start, IStructuredDocumentRegion end) {
+ super();
+ this.offset = start.getStartOffset();
+ int endOffset = (end == null) ? start.getEndOffset() : end.getEndOffset();
+ this.length = endOffset - this.offset;
+ }
+
+ //public Segment(ITextRegion start, ITextRegion end) {
+ // super();
+ // this.offset = start.getStartOffset();
+ // int endOffset = (end == null) ? start.getEndOffset() : end.getEndOffset();
+ // this.length = endOffset - this.offset;
+ //}
+ /**
+ */
+ public int getLength() {
+ return this.length;
+ }
+
+ /**
+ */
+ public int getOffset() {
+ return this.offset;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SyntaxValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SyntaxValidator.java
new file mode 100644
index 0000000000..01b217727e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/validate/SyntaxValidator.java
@@ -0,0 +1,345 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.core.validate;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeEntry;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeRegistry;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.xml.core.document.InvalidCharacterException;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLElement;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.internal.document.SourceValidator;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+class SyntaxValidator extends PrimeValidator implements ErrorState {
+
+
+ static private boolean isValidRegion(ITextRegion rgn) {
+ String type = rgn.getType();
+ if (type == null)
+ return false; // no type is invalid.
+ if (type == XMLRegionContext.XML_END_TAG_OPEN || type == XMLRegionContext.XML_TAG_NAME || type == XMLRegionContext.XML_TAG_CLOSE) {
+ return true;
+ }
+ return false;
+ }
+
+ static private String getTagName(IStructuredDocumentRegion tag) {
+ ITextRegionList regions = tag.getRegions();
+ Iterator iter = regions.iterator();
+ while (iter.hasNext()) {
+ ITextRegion rgn = (ITextRegion) iter.next();
+ if (rgn.getType() == XMLRegionContext.XML_TAG_NAME)
+ return tag.getText(rgn);
+ }
+ return "";//$NON-NLS-1$
+ }
+
+ static private boolean isEmptyContent(CMElementDeclaration decl) {
+ return (decl != null) && (decl.getContentType() == CMElementDeclaration.EMPTY);
+ }
+
+ public SyntaxValidator() {
+ super();
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return ((type == SyntaxValidator.class) || super.isAdapterForType(type));
+ }
+
+ class ElementInfo {
+ public ElementInfo() {
+ super();
+ }
+
+ public XMLElement target = null;
+ public CMElementDeclaration decl = null;
+ public IStructuredDocumentRegion startTag = null;
+ public IStructuredDocumentRegion endTag = null;
+ public boolean hasStartTag = false;
+ public boolean hasEndTag = false;
+ public boolean isXHTML = false;
+ }
+
+ public void validate(IndexedRegion indexedNode) {
+ Node node = (Node) indexedNode;
+ validateChildren(node);
+
+ if (node.getNodeType() != Node.ELEMENT_NODE)
+ return;
+ if (!(node instanceof XMLElement))
+ return;
+
+ ElementInfo info = new ElementInfo();
+ info.target = (XMLElement) node;
+
+ // gather information to validate from target at once.
+ getInfo(info);
+
+ if (info.target.isGlobalTag()) {
+ validateTags(info);
+ validateNames(info);
+ if (info.decl != null && info.isXHTML) {
+ validateTagCase(info);
+ }
+ }
+ }
+
+ private void getInfo(ElementInfo info) {
+ info.decl = CMUtil.getDeclaration(info.target);
+ info.startTag = info.target.getStartStructuredDocumentRegion();
+ info.endTag = info.target.getEndStructuredDocumentRegion();
+
+ info.hasStartTag = (info.startTag != null);
+ info.hasEndTag = (info.endTag != null);
+
+ Document doc = info.target.getOwnerDocument();
+ if (!(doc instanceof XMLDocument))
+ return;
+ String typeid = ((XMLDocument) doc).getDocumentTypeId();
+ if (typeid != null) {
+ HTMLDocumentTypeEntry entry = HTMLDocumentTypeRegistry.getInstance().getEntry(typeid);
+ info.isXHTML = (entry != null && entry.isXMLType());
+ }
+ }
+
+ class TagErrorInfoImpl extends AbstractErrorInfo {
+ private String hint = null;
+
+ public TagErrorInfoImpl(int state, IStructuredDocumentRegion tag, String hint) {
+ super(state, new Segment(tag));
+ this.hint = hint;
+ }
+
+ public String getHint() {
+ return hint;
+ }
+
+ public short getTargetType() {
+ return Node.ELEMENT_NODE;
+ }
+ }
+
+ private boolean isEndTagCorrupted(ElementInfo info) {
+ ITextRegionList regions = info.endTag.getRegions();
+ if (regions == null || regions.isEmpty())
+ return false;
+ Iterator iter = regions.iterator();
+ while (iter.hasNext()) {
+ ITextRegion rgn = (ITextRegion) iter.next();
+ if (!isValidRegion(rgn))
+ return true; // found invalid region type.
+ }
+ return false; // all regions are valid.
+ }
+
+ private String getEndTagFullText(ElementInfo info) {
+ String hint = "";//$NON-NLS-1$
+ ITextRegionList regions = info.endTag.getRegions();
+ Iterator iter = regions.iterator();
+ while (iter.hasNext()) {
+ ITextRegion rgn = (ITextRegion) iter.next();
+ String type = rgn.getType();
+ if (type == null)
+ continue;
+ if (type == XMLRegionContext.XML_END_TAG_OPEN || type == XMLRegionContext.XML_TAG_CLOSE)
+ continue;
+ hint += info.endTag.getFullText(rgn);
+ }
+ return hint;
+ }
+
+ private void reportCorruptedEndTagError(ElementInfo info) {
+ String hint = getEndTagFullText(info);
+ TagErrorInfoImpl error = new TagErrorInfoImpl(UNDEFINED_NAME_ERROR, info.endTag, hint);
+ this.reporter.report(MessageFactory.createMessage(error));
+ }
+
+ private void validateTags(ElementInfo info) {
+ if (info.hasStartTag) {
+ if (!info.target.isStartTagClosed()) {
+ // Mark the whole START tag as an error segment.
+ Segment errorSeg = new Segment(info.startTag);
+ report(UNCLOSED_TAG_ERROR, errorSeg, info.target);
+ }
+ }
+ else {
+ if (info.hasEndTag) {
+ if (info.decl != null) {
+ if (CMUtil.isHTML(info.decl) && !info.target.hasChildNodes()) {
+ if (info.target.isContainer()) {
+ // Set the error mark to the start of the element.
+ Segment errorSeg = new Segment(info.target.getStartOffset(), 0);
+ report(MISSING_START_TAG_ERROR, errorSeg, info.target);
+ }
+ else {
+ // Mark the whole END tag as an error segment.
+ Segment errorSeg = new Segment(info.endTag);
+ report(UNNECESSARY_END_TAG_ERROR, errorSeg, info.target);
+ }
+ }
+ else if (info.isXHTML) {
+ Segment errorSeg = new Segment(info.target.getStartOffset(), 0);
+ report(MISSING_START_TAG_ERROR, errorSeg, info.target);
+ }
+ }
+ }
+ }
+
+ if (info.hasEndTag) {
+ if (!info.target.isClosed()) {
+ // Set the whole END tag as error segment.
+ Segment errorSeg = new Segment(info.endTag);
+ report(UNCLOSED_END_TAG_ERROR, errorSeg, info.target);
+ }
+ }
+ else {
+ if (info.isXHTML) { // XHTML
+ if (!info.target.isEmptyTag()) {
+ if (isEmptyContent(info.decl)) {
+ // EMPTY element should be written in <.../> form.
+ Segment errorSeg = FMUtil.getSegment(info.target, FMUtil.SEG_START_TAG);
+ report(INVALID_EMPTY_ELEMENT_TAG, errorSeg, info.target);
+ }
+ else {
+ // end tag is required.
+ Segment errorSeg = new Segment(info.target.getEndOffset(), 0);
+ report(MISSING_END_TAG_ERROR, errorSeg, info.target);
+ }
+ }
+ }
+ else { // HTML
+ if (info.hasStartTag) {
+ if (info.decl != null && CMUtil.isHTML(info.decl) && !info.target.isEmptyTag() && !CMUtil.isEndTagOmissible(info.decl)) {
+ // Set the error mark to the end of the element.
+ Segment errorSeg = new Segment(info.target.getEndOffset(), 0);
+ report(MISSING_END_TAG_ERROR, errorSeg, info.target);
+ }
+ }
+ }
+ }
+ }
+
+ /* perform validation about tag name definition. */
+ private void validateNames(ElementInfo info) {
+ boolean corrupted = info.hasEndTag && isEndTagCorrupted(info);
+ if (info.decl == null) {
+ // If no declaration is retrieved, the target is really
+ // unknown element.
+ if (!info.hasStartTag && corrupted) {
+ reportCorruptedEndTagError(info);
+ }
+ else {
+ Segment errorSeg = FMUtil.getSegment(info.target, FMUtil.SEG_START_TAG);
+ report(UNDEFINED_NAME_ERROR, errorSeg, info.target);
+ }
+ }
+ else {
+ // Even if a declaration could be retrieved, if the end
+ // tag is corrupted, it should be reported as undefined
+ // name. (D202493)
+ if (corrupted) {
+ reportCorruptedEndTagError(info);
+ }
+ }
+ }
+
+ /* perform validation tag case only for XHTML document */
+ private void validateTagCase(ElementInfo info) {
+ String declared = info.decl.getElementName();
+ String startTagName = "";//$NON-NLS-1$
+ String endTagName = "";//$NON-NLS-1$
+ if (declared == null)
+ return;
+
+ // start tag
+ if (info.hasStartTag) {
+ startTagName = getTagName(info.startTag);
+ if (!declared.equals(startTagName)) {
+ TagErrorInfoImpl error = new TagErrorInfoImpl(MISMATCHED_ERROR, info.startTag, startTagName);
+ this.reporter.report(MessageFactory.createMessage(error));
+ }
+ }
+ // end tag
+ if (info.hasEndTag) {
+ endTagName = getTagName(info.endTag);
+ if (!info.hasStartTag || (!endTagName.equals(startTagName))) {
+ if (!declared.equals(endTagName)) {
+ TagErrorInfoImpl error = new TagErrorInfoImpl(MISMATCHED_ERROR, info.endTag, endTagName);
+ this.reporter.report(MessageFactory.createMessage(error));
+ }
+ }
+ }
+ }
+
+ private void validateChildren(Node target) {
+ if ((target.getNodeType() == Node.ELEMENT_NODE) && CMUtil.isForeign((Element) target))
+ return;
+
+ for (Node child = target.getFirstChild(); child != null; child = child.getNextSibling()) {
+ switch (child.getNodeType()) {
+ case Node.TEXT_NODE :
+ {
+ XMLNode text = (XMLNode) child;
+ int charOffset = validateTextSource(text);
+ if (charOffset >= 0) {
+ charOffset += text.getStartOffset();
+ Segment errorSeg = new Segment(charOffset, 1);
+ if (errorSeg != null)
+ report(INVALID_CHAR_ERROR, errorSeg, text);
+ }
+ break;
+ }
+ case Node.COMMENT_NODE :
+ case Node.DOCUMENT_TYPE_NODE :
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ case Node.CDATA_SECTION_NODE :
+ {
+ XMLNode tag = (XMLNode) child;
+ if (!tag.isClosed()) {
+ Segment errorSeg = FMUtil.getSegment(tag, FMUtil.SEG_WHOLE_TAG);
+ if (errorSeg != null)
+ report(UNCLOSED_TAG_ERROR, errorSeg, tag);
+ }
+ break;
+ }
+ default :
+ break;
+ }
+ }
+ }
+
+ private int validateTextSource(XMLNode text) {
+ try {
+ SourceValidator validator = new SourceValidator(text);
+ validator.validateSource(text.getSource());
+ }
+ catch (InvalidCharacterException ex) {
+ return ex.getOffset();
+ }
+ return -1;
+ }
+
+ private void report(int state, Segment errorSeg, Node node) {
+ ErrorInfo info = new ErrorInfoImpl(state, errorSeg, node);
+ reporter.report(MessageFactory.createMessage(info));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/.classpath b/bundles/org.eclipse.wst.html.ui/.classpath
new file mode 100644
index 0000000000..065ac06e19
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.html.ui/.compatibility b/bundles/org.eclipse.wst.html.ui/.compatibility
new file mode 100644
index 0000000000..730407f0af
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/.compatibility
@@ -0,0 +1,2 @@
+#Wed Mar 24 13:53:52 EST 2004
+.project=4633
diff --git a/bundles/org.eclipse.wst.html.ui/.cvsignore b/bundles/org.eclipse.wst.html.ui/.cvsignore
new file mode 100644
index 0000000000..2f941d80f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/.cvsignore
@@ -0,0 +1,4 @@
+bin
+htmleditor.jar
+temp.folder
+build.xml
diff --git a/bundles/org.eclipse.wst.html.ui/.project b/bundles/org.eclipse.wst.html.ui/.project
new file mode 100644
index 0000000000..38bee736ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.html.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.html.ui/build.properties b/bundles/org.eclipse.wst.html.ui/build.properties
new file mode 100644
index 0000000000..fb3c968eec
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+bin.includes = plugin.xml,\
+ *.jar,\
+ html.jar,\
+ icons/,\
+ plugin.properties,\
+ templates/
+source.htmleditor.jar = src/
+src.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ build.xml,\
+ templates/
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/table.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/table.gif
new file mode 100644
index 0000000000..b99b45cac1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/table.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-anchor.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-anchor.gif
new file mode 100644
index 0000000000..f58992d6c8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-anchor.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-body.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-body.gif
new file mode 100644
index 0000000000..005fa99b46
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-body.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-button.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-button.gif
new file mode 100644
index 0000000000..d143fcf621
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-button.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-font.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-font.gif
new file mode 100644
index 0000000000..bbb40cb3f1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-font.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-form.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-form.gif
new file mode 100644
index 0000000000..3b139588c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-form.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-html.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-html.gif
new file mode 100644
index 0000000000..fb39ba6f9e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-html.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image-map.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image-map.gif
new file mode 100644
index 0000000000..ef3235d170
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image-map.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image.gif
new file mode 100644
index 0000000000..a988c1d5fb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-image.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-jsp.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-jsp.gif
new file mode 100644
index 0000000000..4084602119
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-jsp.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-title.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-title.gif
new file mode 100644
index 0000000000..b129090b16
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag-title.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag.gif b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag.gif
new file mode 100644
index 0000000000..5e7fb33399
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/full/obj16/tag.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/icons/sourceEditor.gif b/bundles/org.eclipse.wst.html.ui/icons/sourceEditor.gif
new file mode 100644
index 0000000000..75ebdb8586
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/icons/sourceEditor.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.html.ui/plugin.properties b/bundles/org.eclipse.wst.html.ui/plugin.properties
new file mode 100644
index 0000000000..bfc85a9b2a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/plugin.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+SSE_HTML_Source_Editor.name=SSE HTML Source Editor
+SSE_HTML_Source_Editor_NL_Support.name=SSE HTML Source Editor NL Support
+HTML_Source_Page_Editor.name=HTML Source Page Editor
+HTML_Files.name=HTML Files
+HTML_Source.name=HTML Source
+HTML_Templates.name=HTML Templates
+HTML_Styles.name=HTML Styles
+HTML_Annotations.name=HTML Annotations
+WebContentSettings.name=Web Content Settings
diff --git a/bundles/org.eclipse.wst.html.ui/plugin.xml b/bundles/org.eclipse.wst.html.ui/plugin.xml
new file mode 100644
index 0000000000..75676e67bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/plugin.xml
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.wst.html.ui"
+ name="%SSE_HTML_Source_Editor.name"
+ version="1.0.0"
+ provider-name="IBM"
+ class="org.eclipse.wst.html.ui.HTMLEditorPlugin">
+
+ <runtime>
+ <library name="htmleditor.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="org.eclipse.core.runtime.compatibility"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.views"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.wst.sse.ui"/>
+ <import plugin="org.eclipse.wst.xml.ui"/>
+ <import plugin="org.eclipse.wst.css.ui"/>
+ <import plugin="org.eclipse.wst.sse.core"/>
+ <import plugin="org.eclipse.wst.css.core"/>
+ <import plugin="org.eclipse.wst.html.core"/>
+ <import plugin="org.eclipse.wst.javascript.common.ui"/>
+ <import plugin="org.eclipse.wst.xml.core"/>
+ <import plugin="org.eclipse.wst.common.contentmodel"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.wst.common.encoding"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ </requires>
+
+
+ <extension-point id="deviceProfileEntryProvider" name="DeviceProfileEntryProviderExtension"/>
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="%HTML_Source_Page_Editor.name"
+ icon="icons/sourceEditor.gif"
+ extensions="html, htm, xhtml, jhtml, shtml, shtm, html-ss, wml"
+ contributorClass="org.eclipse.wst.html.ui.edit.ui.ActionContributorHTML"
+ class="org.eclipse.wst.html.ui.StructuredTextEditorHTML"
+ symbolicFontName="org.eclipse.wst.sse.ui.textfont"
+ id="org.eclipse.wst.html.ui.StructuredTextEditorHTML">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.ui.extendedconfiguration">
+ <textviewerconfiguration
+ class="org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </textviewerconfiguration>
+ <contentoutlineconfiguration
+ class="org.eclipse.wst.html.ui.views.contentoutline.HTMLContentOutlineConfiguration"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </contentoutlineconfiguration>
+ <propertysheetconfiguration
+ class="org.eclipse.wst.xml.ui.views.properties.XMLPropertySheetConfiguration"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </propertysheetconfiguration>
+ <spellchecktarget
+ class="org.eclipse.wst.xml.ui.XMLSpellCheckTarget"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </spellchecktarget>
+ <sourceeditingtexttools
+ class="org.eclipse.wst.xml.ui.extensions.XMLSourceEditingTextTools"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </sourceeditingtexttools>
+ <characterpairmatcher
+ class="org.eclipse.wst.html.ui.text.HTMLDocumentRegionEdgeMatcher"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </characterpairmatcher>
+ <preferencepages
+ preferenceids="org.eclipse.wst.sse.ui.preferences/org.eclipse.wst.html.ui.preferences"
+ target="org.eclipse.wst.html.core.htmlsource">
+ </preferencepages>
+ </extension>
+ <extension
+ point="org.eclipse.core.filebuffers.annotationModelCreation">
+ <factory
+ contentTypeId="org.eclipse.wst.html.core.htmlsource"
+ class="org.eclipse.wst.sse.ui.StructuredResourceMarkerAnnotationModelFactory"/>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
+ <adapterFactoryDescription
+ class="org.eclipse.wst.html.ui.registry.AdapterFactoryProviderForHTML">
+ <contentType id="org.eclipse.wst.html.core.htmlsource"/>
+ </adapterFactoryDescription>
+ </extension>
+ <extension
+ point="org.eclipse.wst.sse.ui.embeddedAdapterFactoryProvider">
+ <embeddedAdapterFactoryProvider
+ class="org.eclipse.wst.html.ui.registry.AdapterFactoryProviderForEmbeddedHTML">
+ </embeddedAdapterFactoryProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+<!-- HTML PREFERENCE PAGES-->
+ <page
+ name="%HTML_Files.name"
+ category="org.eclipse.wst.sse.ui.preferences"
+ class="org.eclipse.wst.html.ui.preferences.ui.HTMLFilesPreferencePage"
+ id="org.eclipse.wst.html.ui.preferences">
+ </page>
+ <page
+ name="%HTML_Source.name"
+ category="org.eclipse.wst.html.ui.preferences"
+ class="org.eclipse.wst.html.ui.preferences.ui.HTMLSourcePreferencePage"
+ id="org.eclipse.wst.html.ui.preferences.source">
+ </page>
+ <page
+ name="%HTML_Templates.name"
+ category="org.eclipse.wst.html.ui.preferences"
+ class="org.eclipse.wst.html.ui.preferences.ui.HTMLTemplatePreferencePage"
+ id="org.eclipse.wst.html.ui.preferences.templates">
+ </page>
+ <page
+ name="%HTML_Styles.name"
+ category="org.eclipse.wst.html.ui.preferences"
+ class="org.eclipse.wst.html.ui.preferences.ui.HTMLColorPage"
+ id="org.eclipse.wst.html.ui.preferences.styles">
+ </page>
+ </extension>
+<!-- Web content settings -->
+ <extension
+ point="org.eclipse.ui.propertyPages">
+<!-- for j2ee web project -->
+ <page
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.ProjectContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.dynamicprojectpropertypage">
+ <filter
+ name="nature"
+ value="org.eclipse.wst.webproject.WebNature">
+ </filter>
+ </page>
+<!-- for static web project -->
+ <page
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.ProjectContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.staticprojectpropertypage">
+ <filter
+ name="nature"
+ value="org.eclipse.wst.webproject.StaticWebNature">
+ </filter>
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.htm*"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.shtml"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.xhtml"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.jhtml"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.jsp"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.jspf"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.jsf"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%WebContentSettings.name"
+ nameFilter="*.wml"
+ class="org.eclipse.wst.html.ui.contentproperties.ui.HTMLContentSettingsPropertyPage"
+ id="org.eclipse.wst.html.ui.htmlpropertypage">
+ </page>
+ </extension>
+<!-- Editor actionsets -->
+ <extension
+ point="org.eclipse.ui.actionSetPartAssociations">
+ <actionSetPartAssociation
+ targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
+ <part
+ id="org.eclipse.wst.html.ui.StructuredTextEditorHTML">
+ </part>
+ </actionSetPartAssociation>
+ <actionSetPartAssociation
+ targetID="org.eclipse.ui.NavigateActionSet">
+ <part
+ id="org.eclipse.wst.html.ui.StructuredTextEditorHTML">
+ </part>
+ </actionSetPartAssociation>
+ </extension>
+<!-- add a default open on action for html content type -->
+ <extension
+ point="org.eclipse.wst.sse.ui.openon">
+ <openon
+ class="org.eclipse.wst.html.ui.openon.DefaultOpenOnHTML"
+ id="org.eclipse.wst.html.ui.openon.DefaultOpenOnHTML">
+ <contenttypeidentifier
+ id="org.eclipse.wst.html.core.htmlsource" />
+ </openon>
+ </extension>
+<!-- Templates -->
+ <extension
+ point="org.eclipse.ui.editors.templates">
+ <contextType
+ name="All HTML context type"
+ class="org.eclipse.wst.html.ui.templates.TemplateContextTypeHTML"
+ id="html_all">
+ </contextType>
+ <contextType
+ name="HTML Tag context type"
+ class="org.eclipse.wst.html.ui.templates.TemplateContextTypeHTMLTag"
+ id="html_tag">
+ </contextType>
+ <contextType
+ name="HTML Attribute context type"
+ class="org.eclipse.wst.html.ui.templates.TemplateContextTypeHTMLAttribute"
+ id="html_attribute">
+ </contextType>
+ <contextType
+ name="HTML Attribute value context type"
+ class="org.eclipse.wst.html.ui.templates.TemplateContextTypeHTMLAttributeValue"
+ id="html_attribute_value">
+ </contextType>
+ <include
+ file="templates/htmldefault-templates.xml"
+ translations="templates/htmldefault-templates.properties">
+ </include>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.wst.html.ui/src/EditingHTML.properties b/bundles/org.eclipse.wst.html.ui/src/EditingHTML.properties
new file mode 100644
index 0000000000..0cbee1cfaf
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/EditingHTML.properties
@@ -0,0 +1,166 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+## The following line is a sample HTML document. Please translate only the following parts:
+## HTML Highlighting Preferences
+## we need a flaming logo
+Sample_HTML_doc=<!DOCTYPE HTML\n\tPUBLIC \"-//W3C/DTD/ HTML 4.01 Transitional//EN\"\n\t\"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML>\n\t<HEAD>\n\t\t<META content=\"text/html\">\n\t\t<TITLE>HTML Highlighting Preferences</TITLE>\n\t</HEAD>\n<BODY>\n\t<!--\n\t\twe need a flaming logo!\n\t-->\n</BODY>\n</HTML>
+! XML Common UI
+! Constants for strings
+
+NEW=New
+DELETE=Remove
+ADD_TEXT=Add Text
+ADD_CDATA_SECTION=Add CDATA Section
+ADD_COMMENT=Add Commen&t
+ADD_PROCESSING_INSTRUCTION=Add Processing Instruction
+
+_UI_MENU_ADD_AFTER=Add &After
+_UI_MENU_ADD_ATTRIBUTE=Add A&ttribute
+_UI_MENU_ADD_BEFORE=Add &Before
+_UI_MENU_ADD_CHILD=Add &Child
+_UI_MENU_REMOVE=Re&move
+_UI_MENU_REPLACE_WITH=Re&place With
+_UI_MENU_ADD_DOCTYPE=Add DOCTYPE...
+_UI_MENU_EDIT_DOCTYPE=Edit DOCTYPE...
+_UI_MENU_ADD_GRAMMAR_INFORMATION=Add Grammar Information
+_UI_MENU_VALIDATE_XML=Validate XML File
+_UI_LABEL_UNDO_ADD_DESCRIPTION=Add
+_UI_LABEL_UNDO_REPLACE_DESCRIPTION=Replace
+_UI_LABEL_EDIT_DOCTYPE=Edit DOCTYPE
+_UI_INFO_EXPAND_ALL=IWAK0105I Expand All
+_UI_INFO_COLLAPSE_ALL=IWAK0106I Collapse All
+
+_UI_MENU_ADD_DTD_INFORMATION=Add DTD Information...
+_UI_MENU_ADD_SCHEMA_INFORMATION=Add Schema Information...
+_UI_MENU_EDIT_SCHEMA_INFORMATION=Edit &Schema Information...
+_UI_MENU_EDIT_PROCESSING_INSTRUCTION=Edit Process&ing Instruction...
+
+_UI_MENU_ADD_DTD_INFORMATION_TITLE=Add DTD Information
+_UI_MENU_EDIT_PROCESSING_INSTRUCTION_TITLE=Edit Processing Instruction
+_UI_MENU_EDIT_SCHEMA_INFORMATION_TITLE=Edit Schema Information
+
+_UI_MENU_NEW_ATTRIBUTE=&New Attribute...
+_UI_MENU_NEW_ATTRIBUTE_TITLE=New Attribute
+_UI_MENU_EDIT_ATTRIBUTE=Edit Attribute...
+_UI_MENU_EDIT_ATTRIBUTE_TITLE=Edit Attribute
+_UI_MENU_NEW_ELEMENT=New &Element...
+_UI_MENU_NEW_ELEMENT_TITLE=New Element
+_UI_MENU_RENAME=R&ename
+_UI_MENU_RENAME_TITLE=Rename
+_UI_LABEL_ELEMENT_NAME=Element name:
+_UI_LABEL_LOADING_GRAMMAR=Loading grammar:
+
+_UI_MENU_ADD_COMMENT=Add Comment
+_UI_MENU_ADD_PROCESSING_INSTRUCTION=Add Processing Instruction
+_UI_MENU_ADD_CDATA_SECTION=Add CDATA Section
+_UI_MENU_ADD_PCDATA=Add #PCDATA;
+
+_UI_MENU_COMMENT=C&omment
+_UI_MENU_PROCESSING_INSTRUCTION=P&rocessing Instruction
+_UI_MENU_CDATA_SECTION=CDATA Section
+_UI_MENU_PCDATA=#PC&DATA;
+
+_UI_MENU_ADD=Add
+
+_UI_COMMENT_VALUE=comment
+_UI_PI_TARGET_VALUE=target
+_UI_PI_DATA_VALUE=data
+_UI_LABEL_ROOT_ELEMENT_VALUE=RootElement
+
+_UI_LABEL_TARGET_COLON=Target:
+_UI_LABEL_DATA_COLON=Data:
+_UI_LABEL_ROOT_ELEMENT_NAME_COLON=Root element name:
+_UI_LABEL_PUBLIC_ID_COLON=Public ID:
+_UI_LABEL_SYSTEM_ID_COLON=System ID:
+_UI_LABEL_BROWSE=Browse...
+_UI_LABEL_SELECT_XML_CATALOG_ENTRY=Select XML Catalog Entry
+_UI_LABEL_SPECIFY_SYSTEM_ID=Specify System ID
+_UI_LABEL_SELECT_FILE=Select File
+
+_UI_LABEL_KEY=Key
+_UI_LABEL_URI=URI:
+_UI_LABEL_XML_CATALOG_COLON=XML Catalog
+_UI_LABEL_NAMESPACE_NAME=Namespace Name
+_UI_LABEL_LOCATION_HINT=Location Hint
+_UI_LABEL_PREFIX=Prefix
+_UI_LABEL_NAMESPACE_NAME_COLON=Namespace Name:
+_UI_LABEL_LOCATION_HINT_COLON=Location Hint:
+_UI_LABEL_PREFIX_COLON=Prefix:
+_UI_NO_NAMESPACE_NAME=<no namespace name>
+_UI_NO_PREFIX=<no prefix>
+
+_UI_LABEL_XML_SCHEMA_INFORMATION=XML Schema Information
+
+_UI_LABEL_NAME_COLON=Name:
+_UI_LABEL_VALUE_COLON=Value:
+
+_UI_BUTTON_DELETE=Delete
+_UI_BUTTON_NEW=New...
+_UI_BUTTON_EDIT=Edit...
+
+_UI_LABEL_NEW_NAMESPACE_INFORMATION=New Namespace Information
+_UI_LABEL_EDIT_NAMESPACE_INFORMATION=Edit Namespace Information
+
+!
+! Assign links to an XML file
+!
+_UI_WORK_BENCH=Workbench Files...
+_UI_FILE_SYSTEM=Import Files...
+_UI_ASSIGN_XSL=Assign An XSL Stylesheet To The XML File
+_UI_ASSIGN_DTD=Assign A DTD file To The XML File
+_UI_ASSIGN_XSD=Assign An XML schema To The XML File
+_UI_SELECT_XSL_TITLE=Select an XSL File
+_UI_SELECT_XSL_DESC=Select an XSL file from the workbench.
+
+_UI_ASSIGN=Assign
+_UI_XSD=XML Schema...
+_UI_DTD=DTD...
+_UI_XSL=XSL Stylesheet...
+
+! XMLValidator.java
+_UI_XML_VALIDATOR=XML Validator
+! SelectFileOrXMLCatalogIdPanel.java
+
+_UI_RADIO_BUTTON_SELECT_FROM_WORKSPACE=Select file from workbench
+_UI_RADIO_BUTTON_SELECT_FROM_CATALOG=Select XML Catalog entry
+
+_UI_WARNING_TITLE_ROOT_ELEMENT_REQUIRED=Root Element Required
+_UI_WARNING_DOCUMENT_REQUIRES_ROOT=The document requires a root element in order to add schema information.
+_UI_WARNING_MORE_THAN_ONE_NS_WITH_NAME=More than one namespace has been specified with the namespace name :
+_UI_WARNING_MORE_THAN_ONE_NS_WITHOUT_NAME=More than one schema has been specified without a namespace name
+_UI_WARNING_MORE_THAN_ONE_NS_WITHOUT_PREFIX=More than one namespace has been specificed without a prefix
+_UI_WARNING_MORE_THAN_ONE_NS_WITH_PREFIX=More than one namespace has been specified with the prefix :
+_UI_WARNING_SCHEMA_CAN_NOT_BE_LOCATED=The specified schema can not be located :
+_UI_WARNING_LOCATION_HINT_NOT_SPECIFIED=A location hint has not been specified for the namespace with name
+_UI_WARNING_NAMESPACE_NAME_NOT_SPECIFIED=A name must be specified for the namespace with prefix :
+_UI_WARNING_PREFIX_NOT_SPECIFIED=A prefix must be specified for the namespace named :
+_UI_WARNING_ROOT_ELEMENT_MUST_BE_SPECIFIED=A root element name must be specified.
+_UI_WARNING_SYSTEM_ID_MUST_BE_SPECIFIED=A system ID must be specified.
+
+!======================================================================================
+!
+! Here is the list of Error string that have message IDs - make sure they are unique
+! Range for XMLBuilder messageIDs: IWAX1601E - IWAX1800E
+! Since we'll be combing these plugins at some later point we'll use the same range
+! and be carefull not to clobber those defined in xmlbuilder's plugin.properties
+!======================================================================================
+_ERROR_XML_ATTRIBUTE_ALREADY_EXISTS=IWAK0107E The element already has an attribute with this name.
+
+#
+TemplateContextTypeHTMLTag.0=HTML Tags
+TemplateContextTypeHTML.0=All HTML
+TemplateContextTypeHTMLAttributeValue.0=HTML Attribute Values
+TemplateContextTypeHTMLAttribute.0=HTML Attributes
+
+HTMLFilesPreferencePage.0=Loading files...
+HTMLFilesPreferencePage.1=Add this suffix (if not specified):
+HTMLFilesPreferencePage.2=Insert DOCTYPE declaration
+HTMLFilesPreferencePage.3=Insert GENERATOR with META tag \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/HTMLEditorPlugin.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/HTMLEditorPlugin.java
new file mode 100644
index 0000000000..66f160c303
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/HTMLEditorPlugin.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.templates.ContextTypeRegistry;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
+import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.ui.internal.Logger;
+import org.eclipse.wst.html.ui.style.IStyleConstantsHTML;
+import org.eclipse.wst.html.ui.templates.TemplateContextTypeHTML;
+import org.eclipse.wst.html.ui.templates.TemplateContextTypeHTMLAttribute;
+import org.eclipse.wst.html.ui.templates.TemplateContextTypeHTMLAttributeValue;
+import org.eclipse.wst.html.ui.templates.TemplateContextTypeHTMLTag;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.preferences.CommonEditorPreferenceNames;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.ColorHelper;
+import org.eclipse.wst.sse.ui.registry.AdapterFactoryRegistry;
+import org.eclipse.wst.sse.ui.registry.AdapterFactoryRegistryImpl;
+import org.eclipse.wst.sse.ui.registry.embedded.EmbeddedAdapterFactoryRegistryImpl;
+import org.eclipse.wst.xml.ui.style.IStyleConstantsXML;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class HTMLEditorPlugin extends AbstractUIPlugin {
+ public final static String ID = "org.eclipse.wst.html.ui"; //$NON-NLS-1$
+
+ protected static HTMLEditorPlugin instance = null;
+
+ /**
+ * The template store for the html editor.
+ */
+ private TemplateStore fTemplateStore;
+
+ /**
+ * The template context type registry for the html editor.
+ */
+ private ContextTypeRegistry fContextTypeRegistry;
+
+ public HTMLEditorPlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ instance = this;
+
+ // reference the preference store so
+ // initializeDefaultPreferences(IPreferenceStore preferenceStore) is called
+ getPreferenceStore();
+ }
+
+ public static HTMLEditorPlugin getDefault() {
+ return instance;
+ }
+
+ public synchronized static HTMLEditorPlugin getInstance() {
+ return instance;
+ }
+
+ public AdapterFactoryRegistry getAdapterFactoryRegistry() {
+ return AdapterFactoryRegistryImpl.getInstance();
+
+ }
+
+ public AdapterFactoryRegistry getEmbeddedAdapterFactoryRegistry() {
+ return EmbeddedAdapterFactoryRegistryImpl.getInstance();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPluginPreferences()
+ */
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+
+ // ignore this preference store
+ // use EditorPlugin preference store
+ IPreferenceStore editorStore = ((AbstractUIPlugin)Platform.getPlugin(EditorPlugin.ID)).getPreferenceStore();
+ EditorPlugin.initializeDefaultEditorPreferences(editorStore);
+ initializeDefaultHTMLPreferences(editorStore);
+ }
+
+ protected void initializeDefaultHTMLPreferences(IPreferenceStore store) {
+ String ctId = IContentTypeIdentifier.ContentTypeID_HTML;
+
+ store.setDefault(PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.CONTENT_ASSIST_SUPPORTED, ctId), true);
+ store.setDefault(PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.AUTO_PROPOSE, ctId), true);
+ store.setDefault(PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.AUTO_PROPOSE_CODE, ctId), CommonEditorPreferenceNames.LT);
+
+ store.setDefault(PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.EDITOR_VALIDATION_METHOD, ctId), CommonEditorPreferenceNames.EDITOR_VALIDATION_WORKBENCH_DEFAULT); //$NON-NLS-1$
+ store.setDefault(PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.EDITOR_USE_INFERRED_GRAMMAR, ctId), true);
+
+ // HTML Style Preferences
+ String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$
+ String styleValue = ColorHelper.getColorString(127, 0, 127) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.TAG_ATTRIBUTE_NAME, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(42, 0, 255) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.TAG_ATTRIBUTE_VALUE, ctId), styleValue);
+
+ styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.TAG_ATTRIBUTE_EQUALS, ctId), styleValue); // specified value is black; leaving as widget default
+
+ styleValue = ColorHelper.getColorString(63, 95, 191) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.COMMENT_BORDER, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.COMMENT_TEXT, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(0, 128, 128) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.DECL_BORDER, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(0, 0, 128) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.DOCTYPE_NAME, ctId), styleValue);
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.DOCTYPE_EXTERNAL_ID_PUBREF, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(128, 128, 128) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.DOCTYPE_EXTERNAL_ID, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(63, 127, 95) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.DOCTYPE_EXTERNAL_ID_SYSREF, ctId), styleValue);
+
+ styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.XML_CONTENT, ctId), styleValue); // specified value is black; leaving as widget default
+
+ styleValue = ColorHelper.getColorString(0, 128, 128) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.TAG_BORDER, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(63, 127, 127) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.TAG_NAME, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(0, 128, 128) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.PI_BORDER, ctId), styleValue);
+
+ styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.PI_CONTENT, ctId), styleValue); // specified value is black; leaving as widget default
+
+ styleValue = ColorHelper.getColorString(0, 128, 128) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.CDATA_BORDER, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(0, 0, 0) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsXML.CDATA_TEXT, ctId), styleValue);
+
+ styleValue = ColorHelper.getColorString(191, 95, 63) + NOBACKGROUNDBOLD;
+ store.setDefault(PreferenceKeyGenerator.generateKey(IStyleConstantsHTML.SCRIPT_AREA_BORDER, ctId), styleValue);
+ }
+
+ /**
+ * Returns the template store for the html editor templates.
+ *
+ * @return the template store for the html editor templates
+ */
+ public TemplateStore getTemplateStore() {
+ if (fTemplateStore == null) {
+ fTemplateStore= new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), CommonEditorPreferenceNames.TEMPLATES_KEY);
+
+ try {
+ fTemplateStore.load();
+ } catch (IOException e) {
+ Logger.logException(e);
+ }
+ }
+ return fTemplateStore;
+ }
+
+ /**
+ * Returns the template context type registry for the html plugin.
+ *
+ * @return the template context type registry for the html plugin
+ */
+ public ContextTypeRegistry getTemplateContextRegistry() {
+ if (fContextTypeRegistry == null) {
+ fContextTypeRegistry= new ContributionContextTypeRegistry();
+
+ fContextTypeRegistry.addContextType(new TemplateContextTypeHTML());
+ fContextTypeRegistry.addContextType(new TemplateContextTypeHTMLTag());
+ fContextTypeRegistry.addContextType(new TemplateContextTypeHTMLAttribute());
+ fContextTypeRegistry.addContextType(new TemplateContextTypeHTMLAttributeValue());
+ }
+
+ return fContextTypeRegistry;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextEditorHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextEditorHTML.java
new file mode 100644
index 0000000000..8704f70e53
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextEditorHTML.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wst.html.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.wst.html.ui.edit.ui.CleanupActionHTML;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesAction;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.edit.util.ActionDefinitionIds;
+import org.eclipse.wst.sse.ui.edit.util.StructuredTextEditorActionConstants;
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionProvider;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+import org.eclipse.wst.xml.ui.actions.AddBlockCommentActionXML;
+import org.eclipse.wst.xml.ui.actions.RemoveBlockCommentActionXML;
+import org.eclipse.wst.xml.ui.actions.ToggleCommentActionXML;
+
+
+public class StructuredTextEditorHTML extends StructuredTextEditor {
+ protected void createActions() {
+ super.createActions();
+
+ ResourceBundle resourceBundle = ResourceHandler.getResourceBundle();
+
+ Action action = new CleanupActionHTML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT + DOT, this);
+ action.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT, action);
+
+ action = new ToggleCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT + DOT, this);
+ action.setActionDefinitionId(ActionDefinitionIds.TOGGLE_COMMENT);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT, action);
+
+ action = new AddBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT + DOT, this);
+ action.setActionDefinitionId(ActionDefinitionIds.ADD_BLOCK_COMMENT);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT, action);
+
+ action = new RemoveBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT + DOT, this);
+ action.setActionDefinitionId(ActionDefinitionIds.REMOVE_BLOCK_COMMENT);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT, action);
+
+ FindOccurrencesActionProvider foAction = new FindOccurrencesActionProvider(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES + DOT, this);
+ foAction.addAction(new HTMLFindOccurrencesAction(resourceBundle, "", this)); //$NON-NLS-1$
+ foAction.setActionDefinitionId(ActionDefinitionIds.FIND_OCCURRENCES);
+ setAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, foAction);
+ markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, true);
+ }
+ protected void initializeEditor() {
+ super.initializeEditor();
+ setHelpContextId(IHelpContextIds.HTML_SOURCEVIEW_HELPID);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java
new file mode 100644
index 0000000000..2ea1c88751
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java
@@ -0,0 +1,384 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
+import org.eclipse.jdt.ui.text.JavaTextTools;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IAutoEditStrategy;
+import org.eclipse.jface.text.IAutoIndentStrategy;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.formatter.IContentFormatter;
+import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
+import org.eclipse.jface.text.information.IInformationPresenter;
+import org.eclipse.jface.text.information.IInformationProvider;
+import org.eclipse.jface.text.information.InformationPresenter;
+import org.eclipse.jface.text.reconciler.IReconciler;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.css.core.internal.text.rules.StructuredTextPartitionerForCSS;
+import org.eclipse.wst.css.ui.contentassist.CSSContentAssistProcessor;
+import org.eclipse.wst.css.ui.style.LineStyleProviderForEmbeddedCSS;
+import org.eclipse.wst.html.core.format.HTMLFormatProcessorImpl;
+import org.eclipse.wst.html.core.internal.text.rules.StructuredTextPartitionerForHTML;
+import org.eclipse.wst.html.ui.internal.contentassist.HTMLContentAssistProcessor;
+import org.eclipse.wst.html.ui.internal.contentassist.NoRegionContentAssistProcessorForHTML;
+import org.eclipse.wst.html.ui.style.LineStyleProviderForHTML;
+import org.eclipse.wst.html.ui.taginfo.HTMLBestMatchHoverProcessor;
+import org.eclipse.wst.html.ui.taginfo.HTMLInformationProvider;
+import org.eclipse.wst.html.ui.taginfo.HTMLTagInfoHoverProcessor;
+import org.eclipse.wst.javascript.common.ui.contentassist.JavaScriptContentAssistProcessor;
+import org.eclipse.wst.javascript.common.ui.style.LineStyleProviderForJavaScript;
+import org.eclipse.wst.javascript.common.ui.taginfo.JavaScriptBestMatchHoverProcessor;
+import org.eclipse.wst.javascript.common.ui.taginfo.JavaScriptInformationProvider;
+import org.eclipse.wst.javascript.common.ui.taginfo.JavaScriptTagInfoHoverProcessor;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.format.StructuredFormattingStrategy;
+import org.eclipse.wst.sse.core.text.rules.StructuredTextPartitioner;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.StructuredTextReconciler;
+import org.eclipse.wst.sse.ui.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.preferences.CommonEditorPreferenceNames;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.style.IHighlighter;
+import org.eclipse.wst.sse.ui.style.LineStyleProvider;
+import org.eclipse.wst.sse.ui.taginfo.AnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.taginfo.ProblemAnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.util.EditorUtility;
+import org.eclipse.wst.xml.core.text.rules.StructuredTextPartitionerForXML;
+import org.eclipse.wst.xml.ui.doubleclick.XMLDoubleClickStrategy;
+import org.eclipse.wst.xml.ui.internal.autoedit.StructuredAutoEditStrategyXML;
+import org.eclipse.wst.xml.ui.internal.correction.CorrectionProcessorXML;
+import org.eclipse.wst.xml.ui.reconcile.StructuredTextReconcilingStrategyForContentModel;
+import org.eclipse.wst.xml.ui.reconcile.StructuredTextReconcilingStrategyForMarkup;
+
+
+public class StructuredTextViewerConfigurationHTML extends StructuredTextViewerConfiguration {
+ InformationPresenter fInformationPresenter = null;
+
+ private boolean reconcilerStrategiesAreSet;
+
+ private JavaSourceViewerConfiguration fJavaSourceViewerConfiguration;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.sse.editor.StructuredTextViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public Map getAutoEditStrategies(ISourceViewer sourceViewer) {
+ Map result = super.getAutoEditStrategies(sourceViewer);
+
+ if (result.get(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML) == null)
+ result.put(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML, new ArrayList(1));
+ if (result.get(StructuredTextPartitionerForHTML.ST_HTML_DECLARATION) == null)
+ result.put(StructuredTextPartitionerForHTML.ST_HTML_DECLARATION, new ArrayList(1));
+
+ IAutoEditStrategy autoEditStrategy = new StructuredAutoEditStrategyXML();
+ List strategies = (List) result.get(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML);
+ strategies.add(autoEditStrategy);
+ strategies = (List) result.get(StructuredTextPartitionerForHTML.ST_HTML_DECLARATION);
+ strategies.add(autoEditStrategy);
+
+ return result;
+ }
+
+ public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
+ if (contentType.compareTo(StructuredTextPartitionerForHTML.ST_SCRIPT) == 0)
+ // JavaScript
+ return getJavaSourceViewerConfiguration().getAutoIndentStrategy(sourceViewer, StructuredTextPartitionerForHTML.ST_SCRIPT);
+ else
+ return super.getAutoIndentStrategy(sourceViewer, contentType);
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ if (configuredContentTypes == null) {
+ String[] xmlTypes = StructuredTextPartitionerForXML.getConfiguredContentTypes();
+ String[] htmlTypes = StructuredTextPartitionerForHTML.getConfiguredContentTypes();
+ configuredContentTypes = new String[2 + xmlTypes.length + htmlTypes.length];
+
+ configuredContentTypes[0] = StructuredTextPartitioner.ST_DEFAULT_PARTITION;
+ configuredContentTypes[1] = StructuredTextPartitioner.ST_UNKNOWN_PARTITION;
+
+ int index = 0;
+ System.arraycopy(xmlTypes, 0, configuredContentTypes, index += 2, xmlTypes.length);
+ System.arraycopy(htmlTypes, 0, configuredContentTypes, index += xmlTypes.length, htmlTypes.length);
+ }
+
+ return configuredContentTypes;
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ IContentAssistant ca = super.getContentAssistant(sourceViewer);
+
+ if (ca != null && ca instanceof ContentAssistant) {
+ ContentAssistant contentAssistant = (ContentAssistant) ca;
+
+ IContentAssistProcessor htmlContentAssistProcessor = new HTMLContentAssistProcessor();
+ IContentAssistProcessor jsContentAssistProcessor = new JavaScriptContentAssistProcessor();
+ IContentAssistProcessor cssContentAssistProcessor = new CSSContentAssistProcessor();
+ IContentAssistProcessor noRegionProcessorForHTML = new NoRegionContentAssistProcessorForHTML();
+
+ // HTML
+ addContentAssistProcessor(contentAssistant, htmlContentAssistProcessor, StructuredTextPartitionerForHTML.ST_DEFAULT_HTML);
+ addContentAssistProcessor(contentAssistant, htmlContentAssistProcessor, StructuredTextPartitionerForHTML.ST_HTML_COMMENT);
+
+ // JavaScript
+ addContentAssistProcessor(contentAssistant, jsContentAssistProcessor, StructuredTextPartitionerForHTML.ST_SCRIPT);
+
+ // CSS
+ addContentAssistProcessor(contentAssistant, cssContentAssistProcessor, StructuredTextPartitionerForCSS.ST_STYLE);
+
+ // unknown
+ addContentAssistProcessor(contentAssistant, noRegionProcessorForHTML, StructuredTextPartitioner.ST_UNKNOWN_PARTITION);
+ }
+
+ return ca;
+ }
+
+ public IContentAssistant getCorrectionAssistant(ISourceViewer sourceViewer) {
+ IContentAssistant ca = super.getCorrectionAssistant(sourceViewer);
+
+ if (ca != null && ca instanceof ContentAssistant) {
+ ContentAssistant correctionAssistant = (ContentAssistant) ca;
+ ITextEditor editor = getTextEditor();
+ if (editor != null) {
+ IContentAssistProcessor correctionProcessor = new CorrectionProcessorXML(editor);
+ correctionAssistant.setContentAssistProcessor(correctionProcessor, StructuredTextPartitionerForHTML.ST_DEFAULT_HTML);
+ correctionAssistant.setContentAssistProcessor(correctionProcessor, StructuredTextPartitionerForXML.ST_XML_CDATA);
+ correctionAssistant.setContentAssistProcessor(correctionProcessor, StructuredTextPartitionerForXML.ST_XML_COMMENT);
+ correctionAssistant.setContentAssistProcessor(correctionProcessor, StructuredTextPartitionerForXML.ST_XML_DECLARATION);
+ correctionAssistant.setContentAssistProcessor(correctionProcessor, StructuredTextPartitionerForXML.ST_XML_PI);
+ correctionAssistant.setContentAssistProcessor(correctionProcessor, StructuredTextPartitionerForXML.ST_DTD_SUBSET);
+ }
+ }
+
+ return ca;
+ }
+
+ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
+ final MultiPassContentFormatter formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), StructuredTextPartitionerForHTML.ST_DEFAULT_HTML);
+
+ formatter.setMasterStrategy(new StructuredFormattingStrategy(new HTMLFormatProcessorImpl()));
+
+ return formatter;
+ }
+
+ public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) {
+ if (contentType.compareTo(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML) == 0)
+ // HTML
+ return new XMLDoubleClickStrategy();
+ else if (contentType.compareTo(StructuredTextPartitionerForHTML.ST_SCRIPT) == 0)
+ // JavaScript
+ return getJavaSourceViewerConfiguration().getDoubleClickStrategy(sourceViewer, contentType);
+ else
+ return super.getDoubleClickStrategy(sourceViewer, contentType);
+ }
+
+ public IHighlighter getHighlighter(ISourceViewer sourceViewer) {
+ IHighlighter highlighter = super.getHighlighter(sourceViewer);
+
+ if (highlighter != null) {
+ // HTML
+ LineStyleProvider htmlLineStyleProvider = new LineStyleProviderForHTML();
+ highlighter.addProvider(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML, htmlLineStyleProvider);
+ highlighter.addProvider(StructuredTextPartitionerForHTML.ST_HTML_COMMENT, htmlLineStyleProvider);
+ highlighter.addProvider(StructuredTextPartitionerForHTML.ST_HTML_DECLARATION, htmlLineStyleProvider);
+
+ // JavaScript
+ LineStyleProvider jsLineStyleProvider = new LineStyleProviderForJavaScript();
+ highlighter.addProvider(StructuredTextPartitionerForHTML.ST_SCRIPT, jsLineStyleProvider);
+
+ // CSS
+ LineStyleProvider cssLineStyleProvider = new LineStyleProviderForEmbeddedCSS();
+ highlighter.addProvider(StructuredTextPartitionerForCSS.ST_STYLE, cssLineStyleProvider);
+ }
+
+ return highlighter;
+ }
+
+ public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
+ if (fInformationPresenter == null) {
+ fInformationPresenter = new InformationPresenter(getInformationPresenterControlCreator(sourceViewer));
+
+ // HTML
+ IInformationProvider htmlInformationProvider = new HTMLInformationProvider();
+ fInformationPresenter.setInformationProvider(htmlInformationProvider, StructuredTextPartitionerForHTML.ST_DEFAULT_HTML);
+
+ // JavaScript
+ IInformationProvider javascriptInformationProvider = new JavaScriptInformationProvider();
+ fInformationPresenter.setInformationProvider(javascriptInformationProvider, StructuredTextPartitionerForHTML.ST_SCRIPT);
+
+ fInformationPresenter.setSizeConstraints(60, 10, true, true);
+ }
+
+ return fInformationPresenter;
+ }
+
+ private IModelManager getModelManager() {
+
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ return plugin.getModelManager();
+ }
+
+ /**
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconcilerg(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public IReconciler getReconciler(ISourceViewer sourceViewer) {
+ if (fReconciler != null) {
+ // a reconciler should always be installed or disposed of
+ if (!fReconciler.isInstalled()) {
+ fReconciler = null;
+ reconcilerStrategiesAreSet = false;
+ }
+ }
+
+ // the first time running through, there's no model (so no pref store)
+ // but the reconciler still needs to be created so that its document gets set
+ if (fReconciler == null) {
+ // create one
+ fReconciler = new StructuredTextReconciler();
+ // a null editorPart is valid
+ //fReconciler.setEditor(editorPart);
+ }
+
+ IPreferenceStore store = ((AbstractUIPlugin) Platform.getPlugin(SSE_EDITOR_ID)).getPreferenceStore();
+ boolean reconcilingEnabled = store.getBoolean(CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS);
+
+ // the second time through, the strategies are set
+ if (fReconciler != null && !reconcilerStrategiesAreSet && reconcilingEnabled) {
+ StructuredTextViewer viewer = null;
+ if (sourceViewer instanceof StructuredTextViewer) {
+ viewer = ((StructuredTextViewer) sourceViewer);
+ }
+
+ IStructuredModel sModel = getModelManager().getExistingModelForRead(viewer.getDocument());
+ try {
+ if (sModel != null) {
+ // check language (ContentTypeID)....
+ String contentTypeId = sModel.getContentTypeIdentifier(); //sModel.getModelHandler().getAssociatedContentTypeId();
+ String generatedKey = PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.EDITOR_VALIDATION_METHOD, contentTypeId);
+ String validationMethodPref = EditorPlugin.getInstance().getPreferenceStore().getString(generatedKey);
+
+ IReconcilingStrategy defaultStrategy = null;
+
+ // pref set to no validation, so return
+ if (validationMethodPref.equals(CommonEditorPreferenceNames.EDITOR_VALIDATION_NONE) || validationMethodPref.trim().length() == 0)
+ return fReconciler;
+
+ // "Content Model" strategies (requires propagating adapter from AdapterFactoryProviderFor*)
+ else if (validationMethodPref.equals(CommonEditorPreferenceNames.EDITOR_VALIDATION_CONTENT_MODEL)) {
+ defaultStrategy = new StructuredTextReconcilingStrategyForContentModel((ITextEditor) editorPart);
+ }
+
+ // "workbench default" strategies
+ else if (validationMethodPref.equals(CommonEditorPreferenceNames.EDITOR_VALIDATION_WORKBENCH_DEFAULT)) {
+
+ IReconcilingStrategy markupStrategy = new StructuredTextReconcilingStrategyForMarkup((ITextEditor) editorPart);
+ IReconcilingStrategy xmlStrategy = new StructuredTextReconcilingStrategyForContentModel((ITextEditor) editorPart);
+
+ fReconciler.setReconcilingStrategy(markupStrategy, StructuredTextPartitioner.ST_DEFAULT_PARTITION);
+
+ fReconciler.setReconcilingStrategy(xmlStrategy, StructuredTextPartitionerForXML.ST_DEFAULT_XML);
+
+ //----------------------------------------------------------------------------------
+ // valdator extension point
+ //----------------------------------------------------------------------------------
+ fReconciler.setValidatorStrategy(createValidatorStrategy(contentTypeId));
+ //----------------------------------------------------------------------------------
+ defaultStrategy = markupStrategy;
+ }
+ fReconciler.setDefaultStrategy(defaultStrategy);
+ reconcilerStrategiesAreSet = true;
+ }
+ }
+ finally {
+ if(sModel != null)
+ sModel.releaseFromRead();
+ }
+ }
+ return fReconciler;
+ }
+
+ public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
+ // HTML
+ if (contentType.equals(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML)) {
+ TextHoverManager.TextHoverDescriptor[] hoverDescs= EditorPlugin.getDefault().getTextHoverManager().getTextHovers();
+ int i= 0;
+ while (i < hoverDescs.length) {
+ if (hoverDescs[i].isEnabled() && EditorUtility.computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+ String hoverType = hoverDescs[i].getId();
+ if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
+ return new HTMLBestMatchHoverProcessor();
+ else if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
+ return new ProblemAnnotationHoverProcessor();
+ else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
+ return new AnnotationHoverProcessor();
+ else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType))
+ return new HTMLTagInfoHoverProcessor();
+ }
+ i++;
+ }
+ }
+ // JavaScript
+ else if (contentType.equals(StructuredTextPartitionerForHTML.ST_SCRIPT)) {
+ TextHoverManager.TextHoverDescriptor[] hoverDescs= EditorPlugin.getDefault().getTextHoverManager().getTextHovers();
+ int i= 0;
+ while (i < hoverDescs.length) {
+ if (hoverDescs[i].isEnabled() && EditorUtility.computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+ String hoverType = hoverDescs[i].getId();
+ if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
+ return new JavaScriptBestMatchHoverProcessor();
+ else if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
+ return new ProblemAnnotationHoverProcessor();
+ else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
+ return new AnnotationHoverProcessor();
+ else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType))
+ return new JavaScriptTagInfoHoverProcessor();
+ }
+ i++;
+ }
+ }
+ return super.getTextHover(sourceViewer, contentType, stateMask);
+ }
+
+ public void unConfigure(ISourceViewer viewer) {
+ super.unConfigure(viewer);
+
+ // InformationPresenters
+ if (fInformationPresenter != null)
+ fInformationPresenter.uninstall();
+ }
+
+ private JavaSourceViewerConfiguration getJavaSourceViewerConfiguration() {
+ if (fJavaSourceViewerConfiguration == null) {
+ IPreferenceStore store = PreferenceConstants.getPreferenceStore();
+ JavaTextTools javaTextTools = new JavaTextTools(store);
+ fJavaSourceViewerConfiguration = new JavaSourceViewerConfiguration(javaTextTools, getTextEditor());
+ }
+ return fJavaSourceViewerConfiguration;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntry.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntry.java
new file mode 100644
index 0000000000..b27b15a244
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntry.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+public class AbstractDeviceProfileEntry implements DeviceProfileEntry {
+
+ public AbstractDeviceProfileEntry() {
+ super();
+ }
+
+ public String getEntryId() {
+ return null;
+ }
+
+ public String getEntryName() {
+ return null;
+ }
+
+ public void release() {
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntryProvider.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntryProvider.java
new file mode 100644
index 0000000000..5a21e4fb43
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/AbstractDeviceProfileEntryProvider.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+import java.util.Iterator;
+
+public class AbstractDeviceProfileEntryProvider implements
+ DeviceProfileEntryProvider {
+
+ public AbstractDeviceProfileEntryProvider() {
+ super();
+ }
+
+ public Iterator getDeviceProfileEntries() {
+ return null;
+ }
+
+ public void release() {
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ContentSettingsRegistry.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ContentSettingsRegistry.java
new file mode 100644
index 0000000000..4e75cdb47f
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ContentSettingsRegistry.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.eclipse.wst.common.encoding.CommonCharsetNames;
+import org.eclipse.wst.css.core.metamodel.CSSProfile;
+import org.eclipse.wst.css.core.metamodel.CSSProfileRegistry;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeEntry;
+import org.eclipse.wst.html.core.document.HTMLDocumentTypeRegistry;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ComboList;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+
+public final class ContentSettingsRegistry {
+
+ private static final String NONE = ResourceHandler.getString("UI_none"); //$NON-NLS-1$
+
+ public static String maxLengthStringInHTMLDocumentTypeRegistry = ""; //$NON-NLS-1$
+ public static String maxLengthStringInCharacterCodeRegistry = ""; //$NON-NLS-1$
+
+ private ContentSettingsRegistry() {
+ }
+
+ public static void setHTMLDocumentTypeRegistryInto(ComboList combo) {
+ combo.add(NONE, ""); //$NON-NLS-1$
+ HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
+ Enumeration e = reg.getEntries();
+ while (e.hasMoreElements()) {
+ HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
+ String publicId = entry.getPublicId();
+ String displayName = entry.getDisplayName();
+ if (displayName != null) {
+ combo.add(displayName, publicId);
+ if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
+ maxLengthStringInHTMLDocumentTypeRegistry = displayName;
+ }
+ else
+ combo.add(publicId, publicId);
+ if (publicId.length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
+ maxLengthStringInHTMLDocumentTypeRegistry = publicId;
+ if (entry.getSystemId() == null)
+ continue; // if HTML entry
+ if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length())
+ maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId();
+ }
+
+ combo.sortByKey(1);
+ }
+
+ public static void setCSSMetaModelRegistryInto(ComboList combo) {
+ combo.add(NONE, ""); //$NON-NLS-1$
+ CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
+ Iterator i = reg.getProfiles();
+ while (i.hasNext()) {
+ CSSProfile profile = (CSSProfile) i.next();
+ String id = profile.getProfileID();
+ String name = profile.getProfileName();
+ combo.add(name, id);
+ }
+ combo.sortByKey(1);
+ }
+
+ public static void setDeviceProfileRegistryInto(ComboList combo) {
+ combo.add(NONE, ""); //$NON-NLS-1$
+ DeviceProfileEntryProvider reg = DeviceProfileEntryProviderBuilder.getEntryProvider();
+ if (reg == null) {
+ return;
+ }
+ Iterator profiles = reg.getDeviceProfileEntries();
+ if (profiles == null) {
+ reg.release();
+ return;
+ }
+ DeviceProfileEntry entry;
+ while (profiles.hasNext()) {
+ entry = (DeviceProfileEntry) profiles.next();
+ combo.add(entry.getEntryName(), entry.getEntryId());
+ entry.release();
+ }
+ reg.release();
+ combo.sortByKey(1);
+ }
+
+ public static String getSystemIdFrom(String publicId) {
+ if (publicId == null || publicId.length() == 0)
+ return null;
+ HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance();
+ Enumeration e = reg.getEntries();
+ while (e.hasMoreElements()) {
+ HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement();
+ if (entry.getPublicId().equals(publicId))
+ return entry.getSystemId();
+ }
+ return null;
+ }
+
+ public static void setContentTypeInto(ComboList combo) {
+ String[] type = {"", //$NON-NLS-1$
+ "application/xhtml+xml", //$NON-NLS-1$
+ "application/xml", //$NON-NLS-1$
+ "text/html", //$NON-NLS-1$
+ "text/xml",}; //$NON-NLS-1$
+ String[] displayName = {NONE, "application/xhtml+xml", //$NON-NLS-1$
+ //$NON-NLS-1$
+ "application/xml", //$NON-NLS-1$
+ "text/html", //$NON-NLS-1$
+ "text/xml",}; //$NON-NLS-1$
+ for (int i = 0; i < type.length; i++) {
+ if (displayName[i] != null && displayName[i].length() != 0)
+ combo.add(displayName[i], type[i]);
+ else
+ combo.add(type[i], type[i]);
+ }
+
+ }
+
+ public static void setCharacterCodeInto(ComboList combo) {
+ combo.add(NONE, ""); //$NON-NLS-1$
+ String max = ""; //$NON-NLS-1$
+ //CommonCharsetNames encoding = new CommonCharsetNames();
+ String[] charCode = CommonCharsetNames.getCommonCharsetNames();
+ for (int i = 0; i < charCode.length; i++) {
+ String displayName = CommonCharsetNames.getDisplayString(charCode[i]);
+ if (displayName != null && displayName.length() != 0) {
+ combo.add(displayName, charCode[i]);
+ int n_byte = displayName.getBytes().length;
+ if (max.getBytes().length < n_byte)
+ max = displayName;
+ }
+ else
+ combo.add(charCode[i], charCode[i]);
+ }
+ /*
+ charCode = encoding.getSupportedJavaEncodings();
+ for(int i=0;i<charCode.length;i++){
+ String displayName = encoding.getDisplayString(charCode[i]);
+ if (displayName!=null && displayName.length()!=0)
+ combo.add(displayName,charCode[i]);
+ else
+ combo.add(charCode[i],charCode[i]);
+ }
+ */
+ // combo.sortByKey(1);
+ maxLengthStringInCharacterCodeRegistry = max;
+ }
+
+ public static void setLanguageInto(ComboList combo) {
+ String[] lang = {"", //$NON-NLS-1$
+ "java", //$NON-NLS-1$
+ "javascript",}; //$NON-NLS-1$
+ String[] displayName = {NONE, "java", //$NON-NLS-1$
+ //$NON-NLS-1$
+ "javascript",}; //$NON-NLS-1$
+ for (int i = 0; i < lang.length; i++) {
+ if (displayName[i] != null && displayName[i].length() != 0)
+ combo.add(displayName[i], lang[i]);
+ else
+ combo.add(lang[i], lang[i]);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntry.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntry.java
new file mode 100644
index 0000000000..489e2571a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntry.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+/**
+ * <p>
+ * This interface is not intended to be implemented by clients
+ * directly. Instead, please use abstract class(AbstractDeviceProfileEntry) instead.
+ * </p>
+ */
+public interface DeviceProfileEntry {
+ public String getEntryId();
+ public String getEntryName();
+ public void release();
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProvider.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProvider.java
new file mode 100644
index 0000000000..51915862df
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProvider.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+import java.util.Iterator;
+
+/**
+ * <p>
+ * This interface is not intended to be implemented by clients
+ * directly. Instead, please use abstract class(AbstractDeviceProfileEntryProvider) instead.
+ * </p>
+ */
+public interface DeviceProfileEntryProvider {
+ public Iterator getDeviceProfileEntries();
+ public void release();
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProviderBuilder.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProviderBuilder.java
new file mode 100644
index 0000000000..79fb3f6498
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/DeviceProfileEntryProviderBuilder.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+public class DeviceProfileEntryProviderBuilder {
+ private static final String EXTENSION_POINT_PLUGINID = "org.eclipse.wst.html.ui"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_NAME = "deviceProfileEntryProvider"; //$NON-NLS-1$
+ private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
+
+ public DeviceProfileEntryProviderBuilder() {
+ super();
+ }
+ static public DeviceProfileEntryProvider getEntryProvider() {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_PLUGINID, EXTENSION_POINT_NAME);
+ if (point != null) {
+ IExtension extensions[] = point.getExtensions();
+ if ((extensions != null) && (extensions.length > 0)) {
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement elements[] = extensions[i].getConfigurationElements();
+ if ((elements != null) && (elements.length > 0)) {
+ for (int j = 0; j < elements.length; j++) {
+ IConfigurationElement config = elements[j];
+ if ((config != null) && (config.getName().equals(EXTENSION_POINT_NAME) == true)) {
+ String className = config.getAttribute(ATTR_CLASS);
+ if (className != null) {
+ try {
+ DeviceProfileEntryProvider provider = (DeviceProfileEntryProvider)config.createExecutableExtension(ATTR_CLASS);
+ if (provider != null) {
+ return provider;
+ }
+ } catch (CoreException ignored) {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/HTMLContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/HTMLContentSettingsPropertyPage.java
new file mode 100644
index 0000000000..0cc12bdcdb
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/HTMLContentSettingsPropertyPage.java
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.html.ui.internal.Logger;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.ui.contentproperties.IContentSettings;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ComboListOnPropertyPage;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ContentSettingsPropertyPage;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+
+public final class HTMLContentSettingsPropertyPage extends ContentSettingsPropertyPage implements org.eclipse.swt.events.SelectionListener {
+
+
+ private final int N_DOCUMENT_TYPE = 0;
+ private final int N_CSS_PROFILE = 1;
+ private final int N_TARGET_DEVICE = 2;
+
+ private Text publicIdText;
+ private Text systemIdText;
+
+ public HTMLContentSettingsPropertyPage() {
+ super();
+ numberOfCombo = 3;
+ numCols = 2;
+ numRows = 8;
+ combo = new ComboListOnPropertyPage[super.numberOfCombo];
+
+ }
+
+
+
+ protected void createDocumentTypeComboBox() {
+
+ // create description of implecit DOCTYPE
+ Label label = new Label(propertyPage, SWT.LEFT);
+ label.setText(ResourceHandler.getString("UI_Description_of_role_of_following_DOCTYPE"));//$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = numCols;
+ label.setLayoutData(data);
+
+ // create combobox
+ super.combo[N_DOCUMENT_TYPE] = super.createComboBoxOf(DOCUMENT_LABEL);
+ super.combo[this.N_DOCUMENT_TYPE].addSelectionListener(this);
+ // set entry list into Combo
+ ContentSettingsRegistry.setHTMLDocumentTypeRegistryInto(combo[N_DOCUMENT_TYPE]);
+ // create TextField
+ createIDTextField();
+ if (combo[N_DOCUMENT_TYPE].getItemCount() <= 0)
+ return;
+
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_DOCUMENT_TYPE], initValue);
+ this.publicIdText.setText(initValue);
+ if (!initValue.equals("")) {//$NON-NLS-1$
+ // toro D210260
+ if (ContentSettingsRegistry.getSystemIdFrom(initValue) != null)
+ this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(initValue));
+ else
+ this.systemIdText.setText("");//$NON-NLS-1$
+ }
+ else
+ this.systemIdText.setText("");//$NON-NLS-1$
+
+ // create separator
+ label = new Label(propertyPage, SWT.SEPARATOR | SWT.HORIZONTAL);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = numCols;
+ data.verticalSpan = 8;
+ label.setLayoutData(data);
+
+ }
+
+
+
+ protected void createCSSComboBox() {
+ super.combo[N_CSS_PROFILE] = super.createComboBoxOf(CSS_LABEL);
+
+ ContentSettingsRegistry.setCSSMetaModelRegistryInto(combo[N_CSS_PROFILE]);
+ if (combo[N_CSS_PROFILE].getItemCount() <= 0)
+ return;
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_CSS_PROFILE], initValue);
+ }
+
+
+
+ protected void createDeviceComboBox() {
+ super.combo[N_TARGET_DEVICE] = super.createComboBoxOf(DEVICE_LABEL);
+
+ ContentSettingsRegistry.setDeviceProfileRegistryInto(combo[N_TARGET_DEVICE]);
+ if (combo[N_TARGET_DEVICE].getItemCount() <= 0)
+ return;
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_TARGET_DEVICE], initValue);
+ }
+
+
+ protected void createSettingsPageGUI() {
+ int type = ((IResource) getElement()).getType();
+ switch (type) {
+ case IResource.FILE :
+ // composite = createComposite(propertyPage,numCols,numRows);
+ createDocumentTypeComboBox();
+ createCSSComboBox();
+ createDeviceComboBox();
+ computeMaxWidthHint();
+ WorkbenchHelp.setHelp(propertyPage, IHelpContextIds.WEB_CONTENT_SETTINGS_HELPID);
+ break;
+
+ default :
+ Logger.log(Logger.WARNING, "HTMLContentSettingsPropertyPage is instantiated by resource except FILE");//$NON-NLS-1$
+ break;
+ }
+
+ }
+
+
+
+ protected void putSelectedPropertyInto(Map properties, String valueInCombo, int index) {
+
+ switch (index) {
+ case N_DOCUMENT_TYPE :
+ // doc type
+ properties.put(IContentSettings.HTML_DOCUMENT_TYPE, valueInCombo);
+ break;
+ case N_CSS_PROFILE :
+ // css
+ properties.put(IContentSettings.CSS_PROFILE, valueInCombo);
+ break;
+ case N_TARGET_DEVICE :
+ // device
+ properties.put(IContentSettings.DEVICE_PROFILE, valueInCombo);
+ break;
+ default :
+ Logger.log(Logger.ERROR, "Index is out of range in putSelectedPropertyInto() in class HTMLContentSettingsPropertyPage");//$NON-NLS-1$
+ break;
+ }
+
+ }
+
+ protected void deleteNoneProperty(int index) {
+ switch (index) {
+ case N_DOCUMENT_TYPE :
+ // doc type
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE);
+ break;
+ case N_CSS_PROFILE :
+ // css
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
+ break;
+ case N_TARGET_DEVICE :
+ // device
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE);
+ break;
+ default :
+ Logger.log(Logger.ERROR, "Index is out of range in deleteNoneProperty() in class HTMLContentSettingsPropertyPage");//$NON-NLS-1$
+ break;
+ }
+ }
+
+ private void createIDTextField() {
+ // public ID & System ID
+ Label publicLabel = new Label(super.propertyPage, SWT.NONE);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ data.horizontalIndent = 10;
+ publicLabel.setLayoutData(data);
+ publicLabel.setText(ResourceHandler.getString("UI_Public_ID"));//$NON-NLS-1$
+ publicIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData();
+
+ publicIdText.setLayoutData(data);
+
+ Label systemLabel = new Label(super.propertyPage, SWT.NONE);
+ data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ data.horizontalIndent = 10;
+ systemLabel.setLayoutData(data);
+ systemLabel.setText(ResourceHandler.getString("UI_System_ID"));//$NON-NLS-1$
+ systemIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData();
+
+ systemIdText.setLayoutData(data);
+ }
+
+
+
+ private void computeMaxWidthHint() {
+ // maxLengthString was set when HTMLDocumentTypeEntry was set in class ContentSettingsRegistry.
+ String maxLengthString = ContentSettingsRegistry.maxLengthStringInHTMLDocumentTypeRegistry;
+ String backup = this.systemIdText.getText();
+ this.systemIdText.setText(maxLengthString);
+ int maxWidthHint = this.systemIdText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
+ this.systemIdText.setText(backup);
+
+ if (this.combo[this.N_DOCUMENT_TYPE].getLayoutData() != null)
+ ((GridData) this.combo[this.N_DOCUMENT_TYPE].getLayoutData()).widthHint = maxWidthHint;
+ if (this.publicIdText.getLayoutData() != null)
+ ((GridData) this.publicIdText.getLayoutData()).widthHint = maxWidthHint;
+ if (this.systemIdText.getLayoutData() != null)
+ ((GridData) this.systemIdText.getLayoutData()).widthHint = maxWidthHint;
+ if (this.combo[this.N_CSS_PROFILE].getLayoutData() != null)
+ ((GridData) this.combo[this.N_CSS_PROFILE].getLayoutData()).widthHint = maxWidthHint;
+ if (this.combo[this.N_TARGET_DEVICE].getLayoutData() != null)
+ ((GridData) this.combo[this.N_TARGET_DEVICE].getLayoutData()).widthHint = maxWidthHint;
+
+ }
+
+
+ public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
+ }
+
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
+ Widget source = event.widget;
+
+ if (this.combo[this.N_DOCUMENT_TYPE].equals(source)) {
+ ComboListOnPropertyPage combo = this.combo[this.N_DOCUMENT_TYPE];
+ if (combo.getSelectionIndex() < 0)
+ return;
+ if (!combo.getSelectedValue().equals("")) {//$NON-NLS-1$
+ this.publicIdText.setText(combo.getSelectedValue());
+ if (ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue()) != null)
+ this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue()));
+ else
+ this.systemIdText.setText("");//$NON-NLS-1$
+ }
+ else {
+ this.publicIdText.setText("");//$NON-NLS-1$
+ this.systemIdText.setText(""); //$NON-NLS-1$
+ }
+
+ }
+ }
+
+ protected void performDefaults() {
+ super.performDefaults();
+ this.publicIdText.setText("");//$NON-NLS-1$
+ this.systemIdText.setText(""); //$NON-NLS-1$
+
+ }
+
+
+}
+
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ProjectContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ProjectContentSettingsPropertyPage.java
new file mode 100644
index 0000000000..e5203dbfd1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/contentproperties/ui/ProjectContentSettingsPropertyPage.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.contentproperties.ui;
+
+
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.html.ui.internal.Logger;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.sse.ui.contentproperties.IContentSettings;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ComboListOnPropertyPage;
+import org.eclipse.wst.sse.ui.contentproperties.ui.ContentSettingsPropertyPage;
+
+
+public final class ProjectContentSettingsPropertyPage extends ContentSettingsPropertyPage implements org.eclipse.swt.events.SelectionListener {
+
+
+ private final int N_DOCUMENT_TYPE = 0;
+ private final int N_CSS_PROFILE = 1;
+ private final int N_TARGET_DEVICE = 2;
+
+ private Text publicIdText;
+ private Text systemIdText;
+
+ public ProjectContentSettingsPropertyPage() {
+ super();
+ numberOfCombo = 3;
+ numCols = 2;
+ numRows = 8;
+ combo = new ComboListOnPropertyPage[super.numberOfCombo];
+
+ }
+
+
+
+ protected void createDocumentTypeComboBox() {
+
+ // create description of implecit DOCTYPE
+ Label label = new Label(propertyPage, SWT.LEFT);
+ label.setText(ResourceHandler.getString("UI_Description_of_role_of_following_DOCTYPE"));//$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = numCols;
+ label.setLayoutData(data);
+
+ // create combobox
+ super.combo[N_DOCUMENT_TYPE] = super.createComboBoxOf(DOCUMENT_LABEL);
+ super.combo[this.N_DOCUMENT_TYPE].addSelectionListener(this);
+ // set entry list into Combo
+ ContentSettingsRegistry.setHTMLDocumentTypeRegistryInto(combo[N_DOCUMENT_TYPE]);
+ // create TextField
+ createIDTextField();
+ if (combo[N_DOCUMENT_TYPE].getItemCount() <= 0)
+ return;
+
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_DOCUMENT_TYPE], initValue);
+ this.publicIdText.setText(initValue);
+ if (!initValue.equals("")) {//$NON-NLS-1$
+ // toro D210260
+ if (ContentSettingsRegistry.getSystemIdFrom(initValue) != null)
+ this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(initValue));
+ else
+ this.systemIdText.setText("");//$NON-NLS-1$
+ }
+ else
+ this.systemIdText.setText("");//$NON-NLS-1$
+
+ // create separator
+ label = new Label(propertyPage, SWT.SEPARATOR | SWT.HORIZONTAL);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = numCols;
+ data.verticalSpan = 8;
+ label.setLayoutData(data);
+
+ }
+
+
+
+ protected void createCSSComboBox() {
+ super.combo[N_CSS_PROFILE] = super.createComboBoxOf(CSS_LABEL);
+
+ ContentSettingsRegistry.setCSSMetaModelRegistryInto(combo[N_CSS_PROFILE]);
+ if (combo[N_CSS_PROFILE].getItemCount() <= 0)
+ return;
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_CSS_PROFILE], initValue);
+ }
+
+
+
+ protected void createDeviceComboBox() {
+ super.combo[N_TARGET_DEVICE] = super.createComboBoxOf(DEVICE_LABEL);
+
+ ContentSettingsRegistry.setDeviceProfileRegistryInto(combo[N_TARGET_DEVICE]);
+ if (combo[N_TARGET_DEVICE].getItemCount() <= 0)
+ return;
+ String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE);
+ // when either .contentsettings or element doesn't exist
+ // when attribute doesn't exists,getProperty returns empty string.
+ if (initValue == null)
+ initValue = ""; //$NON-NLS-1$
+ // set init selectionItem in Combo
+ super.setSelectionItem(combo[N_TARGET_DEVICE], initValue);
+ }
+
+
+ protected void createSettingsPageGUI() {
+ int type = ((IResource) getElement()).getType();
+ switch (type) {
+ case IResource.PROJECT :
+ // composite = createComposite(propertyPage,numCols,numRows);
+ createDocumentTypeComboBox();
+ createCSSComboBox();
+ createDeviceComboBox();
+ computeMaxWidthHint();
+ WorkbenchHelp.setHelp(propertyPage, IHelpContextIds.WEB_CONTENT_SETTINGS_HELPID);
+ break;
+
+ default :
+ Logger.log(Logger.WARNING, "ProjectContentSettingsPropertyPage is instantiated by resource except PROJECT");//$NON-NLS-1$
+ break;
+ }
+
+ }
+
+
+
+ protected void putSelectedPropertyInto(Map properties, String valueInCombo, int index) {
+
+ switch (index) {
+ case N_DOCUMENT_TYPE :
+ // doc type
+ properties.put(IContentSettings.HTML_DOCUMENT_TYPE, valueInCombo);
+ break;
+ case N_CSS_PROFILE :
+ // css
+ properties.put(IContentSettings.CSS_PROFILE, valueInCombo);
+ break;
+ case N_TARGET_DEVICE :
+ // device
+ properties.put(IContentSettings.DEVICE_PROFILE, valueInCombo);
+ break;
+ default :
+ Logger.log(Logger.ERROR, "Index is out of range in putSelectedPropertyInto() in class ProjectContentSettingsPropertyPage");//$NON-NLS-1$
+ break;
+ }
+
+ }
+
+ protected void deleteNoneProperty(int index) {
+ switch (index) {
+ case N_DOCUMENT_TYPE :
+ // doc type
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.HTML_DOCUMENT_TYPE);
+ break;
+
+ case N_CSS_PROFILE :
+ // css
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
+ break;
+
+ case N_TARGET_DEVICE :
+ // device
+ contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.DEVICE_PROFILE);
+ break;
+
+ default :
+ Logger.log(Logger.ERROR, "Index is out of range in deleteNoneProperty() in class ProjectContentSettingsPropertyPage");//$NON-NLS-1$
+ break;
+ }
+ }
+
+ private void createIDTextField() {
+ // public ID & System ID
+ Label publicLabel = new Label(super.propertyPage, SWT.NONE);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ data.horizontalIndent = 10;
+ publicLabel.setLayoutData(data);
+ publicLabel.setText(ResourceHandler.getString("UI_Public_ID"));//$NON-NLS-1$
+ publicIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData();
+
+ publicIdText.setLayoutData(data);
+
+ Label systemLabel = new Label(super.propertyPage, SWT.NONE);
+ data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ data.horizontalIndent = 10;
+ systemLabel.setLayoutData(data);
+ systemLabel.setText(ResourceHandler.getString("UI_System_ID"));//$NON-NLS-1$
+ systemIdText = new Text(super.propertyPage, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData();
+
+ systemIdText.setLayoutData(data);
+ }
+
+
+
+ private void computeMaxWidthHint() {
+ // maxLengthString was set when HTMLDocumentTypeEntry was set in class ContentSettingsRegistry.
+ String maxLengthString = ContentSettingsRegistry.maxLengthStringInHTMLDocumentTypeRegistry;
+ String backup = this.systemIdText.getText();
+ this.systemIdText.setText(maxLengthString);
+ int maxWidthHint = this.systemIdText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
+ this.systemIdText.setText(backup);
+
+ if (this.combo[this.N_DOCUMENT_TYPE].getLayoutData() != null)
+ ((GridData) this.combo[this.N_DOCUMENT_TYPE].getLayoutData()).widthHint = maxWidthHint;
+ if (this.publicIdText.getLayoutData() != null)
+ ((GridData) this.publicIdText.getLayoutData()).widthHint = maxWidthHint;
+ if (this.systemIdText.getLayoutData() != null)
+ ((GridData) this.systemIdText.getLayoutData()).widthHint = maxWidthHint;
+ if (this.combo[this.N_CSS_PROFILE].getLayoutData() != null)
+ ((GridData) this.combo[this.N_CSS_PROFILE].getLayoutData()).widthHint = maxWidthHint;
+ if (this.combo[this.N_TARGET_DEVICE].getLayoutData() != null)
+ ((GridData) this.combo[this.N_TARGET_DEVICE].getLayoutData()).widthHint = maxWidthHint;
+
+ }
+
+
+ public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
+ }
+
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
+ Widget source = event.widget;
+
+ if (this.combo[this.N_DOCUMENT_TYPE].equals(source)) {
+ ComboListOnPropertyPage combo = this.combo[this.N_DOCUMENT_TYPE];
+ if (combo.getSelectionIndex() < 0)
+ return;
+ if (!combo.getSelectedValue().equals("")) {//$NON-NLS-1$
+ this.publicIdText.setText(combo.getSelectedValue());
+ if (ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue()) != null)
+ this.systemIdText.setText(ContentSettingsRegistry.getSystemIdFrom(combo.getSelectedValue()));
+ else
+ this.systemIdText.setText("");//$NON-NLS-1$
+ }
+ else {
+ this.publicIdText.setText("");//$NON-NLS-1$
+ this.systemIdText.setText(""); //$NON-NLS-1$
+ }
+
+ }
+ }
+
+ protected void performDefaults() {
+ super.performDefaults();
+ this.publicIdText.setText("");//$NON-NLS-1$
+ this.systemIdText.setText(""); //$NON-NLS-1$
+
+ }
+
+}
+
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/ActionContributorHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/ActionContributorHTML.java
new file mode 100644
index 0000000000..13cdf1e763
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/ActionContributorHTML.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.edit.ui;
+
+import org.eclipse.wst.xml.ui.actions.ActionContributorXML;
+
+/**
+ *
+ * Instead, use SourcePageActionContributor for source page contributor
+ * of multi page editor.
+ *
+ * Note that this class is still valid for single page editor.
+ */
+public class ActionContributorHTML extends ActionContributorXML {
+ private static final String[] EDITOR_IDS = {"org.eclipse.wst.html.ui.StructuredTextEditorHTML", "org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.ui.actions.ActionContributor#getExtensionIDs()
+ */
+ protected String[] getExtensionIDs() {
+ return EDITOR_IDS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupActionHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupActionHTML.java
new file mode 100644
index 0000000000..615d9283b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupActionHTML.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.edit.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.html.core.cleanup.HTMLCleanupProcessorImpl;
+import org.eclipse.wst.sse.core.cleanup.IStructuredCleanupProcessor;
+import org.eclipse.wst.sse.ui.edit.util.CleanupAction;
+
+public class CleanupActionHTML extends CleanupAction {
+ protected IStructuredCleanupProcessor fCleanupProcessor;
+
+ public CleanupActionHTML(ResourceBundle bundle, String prefix, ITextEditor editor) {
+ super(bundle, prefix, editor);
+ }
+
+ protected Dialog getCleanupDialog(Shell shell) {
+ if (fCleanupDialog == null)
+ fCleanupDialog = new CleanupDialogHTML(shell);
+
+ return fCleanupDialog;
+ }
+
+ protected IStructuredCleanupProcessor getCleanupProcessor() {
+ if (fCleanupProcessor == null)
+ fCleanupProcessor = new HTMLCleanupProcessorImpl();
+
+ return fCleanupProcessor;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupDialogHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupDialogHTML.java
new file mode 100644
index 0000000000..1f1d042748
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/edit/ui/CleanupDialogHTML.java
@@ -0,0 +1,311 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.edit.ui;
+
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.CommonEncodingPreferenceNames;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.modelhandler.IModelHandler;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+import org.eclipse.wst.xml.core.cleanup.XMLCleanupPreferencesImpl;
+
+public class CleanupDialogHTML extends Dialog implements SelectionListener {
+
+ protected Button fRadioButtonTagNameCaseAsis;
+ protected Button fRadioButtonTagNameCaseLower;
+ protected Button fRadioButtonTagNameCaseUpper;
+ protected Button fRadioButtonAttrNameCaseAsis;
+ protected Button fRadioButtonAttrNameCaseLower;
+ protected Button fRadioButtonAttrNameCaseUpper;
+ protected Button fCheckBoxInsertRequiredAttrs;
+ protected Button fCheckBoxInsertMissingTags;
+ protected Button fCheckBoxQuoteAttrValues;
+ protected Button fCheckBoxFormatSource;
+ protected Button fCheckBoxConvertEOLCodes;
+ protected Button fRadioButtonConvertEOLWindows;
+ protected Button fRadioButtonConvertEOLUnix;
+ protected Button fRadioButtonConvertEOLMac;
+ protected IStructuredModel fModel = null;
+ protected Preferences fPreferences = null;
+
+ public CleanupDialogHTML(Shell shell) {
+ super(shell);
+ }
+
+ public Control createDialogArea(Composite parent) {
+ getShell().setText(ResourceHandler.getString("Cleanup_UI_")); //$NON-NLS-1$ = "Cleanup"
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ createDialogAreaInComposite(composite);
+ initializeOptions();
+
+ return composite;
+ }
+
+ protected void createDialogAreaInCompositeForHTML(Composite composite) {
+ // Convert tag name case
+ // d257064 need to associate group w/ radio buttons so radio buttons header can be read
+ Group tagNameCase = new Group(composite, SWT.NONE);
+ tagNameCase.setText(ResourceHandler.getString("Tag_name_case_for_HTML_UI_")); //$NON-NLS-1$ = "Tag name case for HTML:"
+ GridLayout hLayout = new GridLayout();
+ hLayout.numColumns = 3;
+ tagNameCase.setLayout(hLayout);
+ fRadioButtonTagNameCaseAsis = new Button(tagNameCase, SWT.RADIO);
+ fRadioButtonTagNameCaseAsis.setText(ResourceHandler.getString("Tag_name_case_As-is_UI_")); //$NON-NLS-1$ = "&As-is"
+ fRadioButtonTagNameCaseAsis.addSelectionListener(this);
+ fRadioButtonTagNameCaseLower = new Button(tagNameCase, SWT.RADIO);
+ fRadioButtonTagNameCaseLower.setText(ResourceHandler.getString("Tag_name_case_Lower_UI_")); //$NON-NLS-1$ = "&Lower"
+ fRadioButtonTagNameCaseLower.addSelectionListener(this);
+ fRadioButtonTagNameCaseUpper = new Button(tagNameCase, SWT.RADIO);
+ fRadioButtonTagNameCaseUpper.setText(ResourceHandler.getString("Tag_name_case_Upper_UI_")); //$NON-NLS-1$ = "&Upper"
+ fRadioButtonTagNameCaseUpper.addSelectionListener(this);
+
+ // Convert attr name case
+ // d257064 need to associate group w/ radio buttons so radio buttons header can be read
+ Group attrNameCase = new Group(composite, SWT.NONE);
+ attrNameCase.setText(ResourceHandler.getString("Attribute_name_case_for_HTML_UI_")); //$NON-NLS-1$ = "Attribute name case for HTML:"
+ attrNameCase.setLayout(hLayout);
+ fRadioButtonAttrNameCaseAsis = new Button(attrNameCase, SWT.RADIO);
+ fRadioButtonAttrNameCaseAsis.setText(ResourceHandler.getString("Attribute_name_case_As-is_UI_")); //$NON-NLS-1$ = "A&s-is"
+ fRadioButtonAttrNameCaseAsis.addSelectionListener(this);
+ fRadioButtonAttrNameCaseLower = new Button(attrNameCase, SWT.RADIO);
+ fRadioButtonAttrNameCaseLower.setText(ResourceHandler.getString("Attribute_name_case_Lower_UI_")); //$NON-NLS-1$ = "L&ower"
+ fRadioButtonAttrNameCaseLower.addSelectionListener(this);
+ fRadioButtonAttrNameCaseUpper = new Button(attrNameCase, SWT.RADIO);
+ fRadioButtonAttrNameCaseUpper.setText(ResourceHandler.getString("Attribute_name_case_Upper_UI_")); //$NON-NLS-1$ = "U&pper"
+ fRadioButtonAttrNameCaseUpper.addSelectionListener(this);
+ }
+
+ protected void createDialogAreaInComposite(Composite composite) {
+ if (isHTMLType()) {
+ createDialogAreaInCompositeForHTML(composite);
+ WorkbenchHelp.setHelp(composite, IHelpContextIds.CLEANUP_HTML_HELPID); // use HTML specific help
+ }
+ else
+ WorkbenchHelp.setHelp(composite, org.eclipse.wst.xml.ui.internal.editor.IHelpContextIds.CLEANUP_XML_HELPID); // use XML specific help
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.makeColumnsEqualWidth = true;
+ composite.setLayout(layout);
+
+ // Insert missing required attrs
+ fCheckBoxInsertRequiredAttrs = new Button(composite, SWT.CHECK);
+ fCheckBoxInsertRequiredAttrs.setText(ResourceHandler.getString("Insert_required_attributes_UI_")); //$NON-NLS-1$
+ fCheckBoxInsertRequiredAttrs.addSelectionListener(this);
+
+ // Insert missing begin/end tags
+ fCheckBoxInsertMissingTags = new Button(composite, SWT.CHECK);
+ fCheckBoxInsertMissingTags.setText(ResourceHandler.getString("Insert_missing_tags_UI_")); //$NON-NLS-1$ = "Insert missing tags"
+ fCheckBoxInsertMissingTags.addSelectionListener(this);
+
+ // Quote attribute values
+ fCheckBoxQuoteAttrValues = new Button(composite, SWT.CHECK);
+ fCheckBoxQuoteAttrValues.setText(ResourceHandler.getString("Quote_attribute_values_UI_")); //$NON-NLS-1$ = "Quote attribute values"
+ fCheckBoxQuoteAttrValues.addSelectionListener(this);
+
+ // Format source
+ fCheckBoxFormatSource = new Button(composite, SWT.CHECK);
+ fCheckBoxFormatSource.setText(ResourceHandler.getString("Format_source_UI_")); //$NON-NLS-1$ = "Format source"
+ fCheckBoxFormatSource.addSelectionListener(this);
+
+ // Convert EOL code
+ fCheckBoxConvertEOLCodes = new Button(composite, SWT.CHECK);
+ fCheckBoxConvertEOLCodes.setText(ResourceHandler.getString("Convert_EOL_codes_UI_")); //$NON-NLS-1$ = "Convert end-of-line codes"
+ fCheckBoxConvertEOLCodes.addSelectionListener(this);
+ Composite EOLCodes = new Composite(composite, SWT.NULL);
+ GridLayout hLayout = new GridLayout();
+ hLayout.numColumns = 3;
+ EOLCodes.setLayout(hLayout);
+ fRadioButtonConvertEOLWindows = new Button(EOLCodes, SWT.RADIO);
+ fRadioButtonConvertEOLWindows.setText(ResourceHandler.getString("EOL_Windows_UI")); //$NON-NLS-1$ = "Windows"
+ fRadioButtonConvertEOLWindows.addSelectionListener(this);
+ fRadioButtonConvertEOLUnix = new Button(EOLCodes, SWT.RADIO);
+ fRadioButtonConvertEOLUnix.setText(ResourceHandler.getString("EOL_Unix_UI")); //$NON-NLS-1$ = "Unix"
+ fRadioButtonConvertEOLUnix.addSelectionListener(this);
+ fRadioButtonConvertEOLMac = new Button(EOLCodes, SWT.RADIO);
+ fRadioButtonConvertEOLMac.setText(ResourceHandler.getString("EOL_Mac_UI")); //$NON-NLS-1$ = "Mac"
+ fRadioButtonConvertEOLMac.addSelectionListener(this);
+ }
+
+ protected void okPressed() {
+ storeOptions();
+
+ super.okPressed();
+ }
+
+ protected void initializeOptionsForHTML() {
+ int tagNameCase = getModelPreferences().getInt(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE);
+ if (tagNameCase == CommonModelPreferenceNames.UPPER)
+ fRadioButtonTagNameCaseUpper.setSelection(true);
+ else if (tagNameCase == CommonModelPreferenceNames.LOWER)
+ fRadioButtonTagNameCaseLower.setSelection(true);
+ else
+ fRadioButtonTagNameCaseAsis.setSelection(true);
+
+ int attrNameCase = getModelPreferences().getInt(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE);
+ if (attrNameCase == CommonModelPreferenceNames.UPPER)
+ fRadioButtonAttrNameCaseUpper.setSelection(true);
+ else if (attrNameCase == CommonModelPreferenceNames.LOWER)
+ fRadioButtonAttrNameCaseLower.setSelection(true);
+ else
+ fRadioButtonAttrNameCaseAsis.setSelection(true);
+ }
+
+ protected void initializeOptions() {
+ if (isHTMLType())
+ initializeOptionsForHTML();
+
+ fCheckBoxInsertRequiredAttrs.setSelection(getModelPreferences().getBoolean(CommonModelPreferenceNames.INSERT_REQUIRED_ATTRS));
+ fCheckBoxInsertMissingTags.setSelection(getModelPreferences().getBoolean(CommonModelPreferenceNames.INSERT_MISSING_TAGS));
+ fCheckBoxQuoteAttrValues.setSelection(getModelPreferences().getBoolean(CommonModelPreferenceNames.QUOTE_ATTR_VALUES));
+ fCheckBoxFormatSource.setSelection(getModelPreferences().getBoolean(CommonModelPreferenceNames.FORMAT_SOURCE));
+ fCheckBoxConvertEOLCodes.setSelection(getModelPreferences().getBoolean(CommonModelPreferenceNames.CONVERT_EOL_CODES));
+ if (fCheckBoxConvertEOLCodes.getSelection()) {
+ String EOLCode = getModelPreferences().getString(CommonModelPreferenceNames.CLEANUP_EOL_CODE);
+ if (EOLCode == CommonEncodingPreferenceNames.LF)
+ fRadioButtonConvertEOLUnix.setSelection(true);
+ else if (EOLCode == CommonEncodingPreferenceNames.CR)
+ fRadioButtonConvertEOLMac.setSelection(true);
+ else
+ fRadioButtonConvertEOLWindows.setSelection(true);
+ }
+ enableEOLCodeRadios(fCheckBoxConvertEOLCodes.getSelection());
+ }
+
+ protected void storeOptionsForHTML() {
+ if (fRadioButtonTagNameCaseUpper.getSelection())
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE, CommonModelPreferenceNames.UPPER);
+ else if (fRadioButtonTagNameCaseLower.getSelection())
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE, CommonModelPreferenceNames.LOWER);
+ else
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE, CommonModelPreferenceNames.ASIS);
+
+ if (fRadioButtonAttrNameCaseUpper.getSelection())
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE, CommonModelPreferenceNames.UPPER);
+ else if (fRadioButtonAttrNameCaseLower.getSelection())
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE, CommonModelPreferenceNames.LOWER);
+ else
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE, CommonModelPreferenceNames.ASIS);
+
+ // explicitly save plugin preferences so values are stored
+ HTMLCorePlugin.getDefault().savePluginPreferences();
+ }
+
+ protected void storeOptions() {
+ if (isHTMLType()) {
+ storeOptionsForHTML();
+ XMLCleanupPreferencesImpl.getInstance().setTagNameCase(getModelPreferences().getInt(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE));
+ XMLCleanupPreferencesImpl.getInstance().setAttrNameCase(getModelPreferences().getInt(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE));
+ }
+ else {
+ XMLCleanupPreferencesImpl.getInstance().setTagNameCase(CommonModelPreferenceNames.ASIS);
+ XMLCleanupPreferencesImpl.getInstance().setAttrNameCase(CommonModelPreferenceNames.ASIS);
+ }
+
+ getModelPreferences().setValue(CommonModelPreferenceNames.INSERT_REQUIRED_ATTRS, fCheckBoxInsertRequiredAttrs.getSelection());
+ getModelPreferences().setValue(CommonModelPreferenceNames.INSERT_MISSING_TAGS, fCheckBoxInsertMissingTags.getSelection());
+ getModelPreferences().setValue(CommonModelPreferenceNames.QUOTE_ATTR_VALUES, fCheckBoxQuoteAttrValues.getSelection());
+ getModelPreferences().setValue(CommonModelPreferenceNames.FORMAT_SOURCE, fCheckBoxFormatSource.getSelection());
+ getModelPreferences().setValue(CommonModelPreferenceNames.CONVERT_EOL_CODES, fCheckBoxConvertEOLCodes.getSelection());
+ XMLCleanupPreferencesImpl.getInstance().setInsertMissingTags(fCheckBoxInsertMissingTags.getSelection());
+ XMLCleanupPreferencesImpl.getInstance().setQuoteAttrValues(fCheckBoxQuoteAttrValues.getSelection());
+ XMLCleanupPreferencesImpl.getInstance().setFormatSource(fCheckBoxFormatSource.getSelection());
+ XMLCleanupPreferencesImpl.getInstance().setConvertEOLCodes(fCheckBoxConvertEOLCodes.getSelection());
+ if (fCheckBoxConvertEOLCodes.getSelection()) {
+ if (fRadioButtonConvertEOLUnix.getSelection()) {
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_EOL_CODE, CommonEncodingPreferenceNames.LF);
+ XMLCleanupPreferencesImpl.getInstance().setEOLCode(CommonEncodingPreferenceNames.LF);
+ }
+ else if (fRadioButtonConvertEOLMac.getSelection()) {
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_EOL_CODE, CommonEncodingPreferenceNames.CR);
+ XMLCleanupPreferencesImpl.getInstance().setEOLCode(CommonEncodingPreferenceNames.CR);
+ }
+ else {
+ getModelPreferences().setValue(CommonModelPreferenceNames.CLEANUP_EOL_CODE, CommonEncodingPreferenceNames.CRLF);
+ XMLCleanupPreferencesImpl.getInstance().setEOLCode(CommonEncodingPreferenceNames.CRLF);
+ }
+ }
+
+ // explicitly save plugin preferences so values are stored
+ HTMLCorePlugin.getDefault().savePluginPreferences();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ getButton(OK).setEnabled((fRadioButtonTagNameCaseLower != null && (fRadioButtonTagNameCaseLower.getSelection() || fRadioButtonTagNameCaseUpper.getSelection())) || (fRadioButtonAttrNameCaseLower != null && (fRadioButtonAttrNameCaseLower.getSelection() || fRadioButtonAttrNameCaseUpper.getSelection())) || fCheckBoxInsertMissingTags.getSelection() || fCheckBoxQuoteAttrValues.getSelection() || fCheckBoxFormatSource.getSelection() || fCheckBoxConvertEOLCodes.getSelection() || (fRadioButtonConvertEOLUnix != null && (fRadioButtonConvertEOLUnix.getSelection() || fRadioButtonConvertEOLMac.getSelection() || fRadioButtonConvertEOLWindows.getSelection())));
+ if (e.widget == fCheckBoxConvertEOLCodes)
+ enableEOLCodeRadios(fCheckBoxConvertEOLCodes.getSelection());
+ }
+
+ public void setModel(IStructuredModel model) {
+ fModel = model;
+ }
+
+ protected Preferences getModelPreferences() {
+ return HTMLCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ protected boolean isXMLType() {
+ boolean result = false;
+
+ if (fModel != null) {
+ IModelHandler modelHandler = fModel.getModelHandler();
+ if (modelHandler.getAssociatedContentTypeId().equals(IContentTypeIdentifier.ContentTypeID_SSEXML))
+ result = true;
+ }
+
+ return result;
+ }
+
+ protected boolean isHTMLType() {
+ boolean result = true;
+
+ if (fModel != null) {
+ IModelHandler modelHandler = fModel.getModelHandler();
+ if (modelHandler.getAssociatedContentTypeId().equals(IContentTypeIdentifier.ContentTypeID_HTML))
+ result = true;
+ }
+
+ return result;
+ }
+
+ protected void enableEOLCodeRadios(boolean enable) {
+ if ((fRadioButtonConvertEOLWindows != null) && (fRadioButtonConvertEOLUnix != null) && (fRadioButtonConvertEOLMac != null)) {
+ fRadioButtonConvertEOLWindows.setEnabled(enable);
+ fRadioButtonConvertEOLUnix.setEnabled(enable);
+ fRadioButtonConvertEOLMac.setEnabled(enable);
+
+ if (!fRadioButtonConvertEOLWindows.getSelection() && !fRadioButtonConvertEOLUnix.getSelection() && !fRadioButtonConvertEOLMac.getSelection())
+ fRadioButtonConvertEOLWindows.setSelection(true);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/Logger.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/Logger.java
new file mode 100644
index 0000000000..65f2d6da70
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/Logger.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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
+ * Jens Lukowski/Innoopract - initial renaming/restructuring
+ *
+ *******************************************************************************/
+package org.eclipse.wst.html.ui.internal;
+
+
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.html.ui.HTMLEditorPlugin;
+
+
+/**
+ * Small convenience class to log messages to plugin's log file and also, if
+ * desired, the console. This class should only be used by classes in this
+ * plugin. Other plugins should make their own copy, with appropriate ID.
+ */
+public class Logger {
+ public static final int ERROR = IStatus.ERROR; // 4
+ public static final int ERROR_DEBUG = 200 + ERROR;
+ private static final Plugin fPlugin = HTMLEditorPlugin.getDefault();
+ private static final String fPluginId = fPlugin.getDescriptor().getUniqueIdentifier();
+ public static final int INFO = IStatus.INFO; // 1
+ public static final int INFO_DEBUG = 200 + INFO;
+
+ public static final int OK = IStatus.OK; // 0
+
+ public static final int OK_DEBUG = 200 + OK;
+
+ private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
+ public static final int WARNING = IStatus.WARNING; // 2
+ public static final int WARNING_DEBUG = 200 + WARNING;
+
+ /**
+ * Adds message to log.
+ *
+ * @param level
+ * severity level of the message (OK, INFO, WARNING, ERROR,
+ * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
+ * @param message
+ * text to add to the log
+ * @param exception
+ * exception thrown
+ */
+ protected static void _log(int level, String message, Throwable exception) {
+ if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
+ if (!isDebugging())
+ return;
+ }
+
+ int severity = IStatus.OK;
+ switch (level) {
+ case INFO_DEBUG :
+ case INFO :
+ severity = IStatus.INFO;
+ break;
+ case WARNING_DEBUG :
+ case WARNING :
+ severity = IStatus.WARNING;
+ break;
+ case ERROR_DEBUG :
+ case ERROR :
+ severity = IStatus.ERROR;
+ }
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(severity, fPluginId, severity, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+
+ /**
+ * Prints message to log if category matches /debug/tracefilter option.
+ *
+ * @param message
+ * text to print
+ * @param category
+ * category of the message, to be compared with
+ * /debug/tracefilter
+ */
+ protected static void _trace(String category, String message, Throwable exception) {
+ if (isTracing(category)) {
+ message = (message != null) ? message : "null"; //$NON-NLS-1$
+ Status statusObj = new Status(IStatus.OK, fPluginId, IStatus.OK, message, exception);
+ fPlugin.getLog().log(statusObj);
+ }
+ }
+
+ /**
+ * @return true if the plugin for this logger is debugging
+ */
+ public static boolean isDebugging() {
+ return fPlugin.isDebugging();
+ }
+
+ /**
+ * Determines if currently tracing a category
+ *
+ * @param category
+ * @return true if tracing category, false otherwise
+ */
+ public static boolean isTracing(String category) {
+ if (!isDebugging())
+ return false;
+
+ String traceFilter = Platform.getDebugOption(fPluginId + TRACEFILTER_LOCATION);
+ if (traceFilter != null) {
+ StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String cat = tokenizer.nextToken().trim();
+ if (category.equals(cat)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void log(int level, String message) {
+ _log(level, message, null);
+ }
+
+ public static void log(int level, String message, Throwable exception) {
+ _log(level, message, exception);
+ }
+
+ public static void logException(String message, Throwable exception) {
+ _log(ERROR, message, exception);
+ }
+
+ public static void logException(Throwable exception) {
+ _log(ERROR, exception.getMessage(), exception);
+ }
+
+ public static void trace(String category, String message) {
+ _trace(category, message, null);
+ }
+
+ public static void traceException(String category, String message, Throwable exception) {
+ _trace(category, message, exception);
+ }
+
+ public static void traceException(String category, Throwable exception) {
+ _trace(category, exception.getMessage(), exception);
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/SharedHTMLEditorPluginImageHelper.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/SharedHTMLEditorPluginImageHelper.java
new file mode 100644
index 0000000000..68dc842246
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/SharedHTMLEditorPluginImageHelper.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.html.ui.internal.editor.HTMLEditorPluginImageHelper;
+import org.eclipse.wst.html.ui.internal.editor.HTMLEditorPluginImages;
+
+
+public class SharedHTMLEditorPluginImageHelper {
+ public static final String IMG_OBJ_TABLE = HTMLEditorPluginImages.IMG_OBJ_TABLE;
+ public static final String IMG_OBJ_TAG_ANCHOR = HTMLEditorPluginImages.IMG_OBJ_TAG_ANCHOR;
+ public static final String IMG_OBJ_TAG_BODY = HTMLEditorPluginImages.IMG_OBJ_TAG_BODY;
+ public static final String IMG_OBJ_TAG_BUTTON = HTMLEditorPluginImages.IMG_OBJ_TAG_BUTTON;
+ public static final String IMG_OBJ_TAG_FONT = HTMLEditorPluginImages.IMG_OBJ_TAG_FONT;
+ public static final String IMG_OBJ_TAG_FORM = HTMLEditorPluginImages.IMG_OBJ_TAG_FORM;
+ public static final String IMG_OBJ_TAG_HTML = HTMLEditorPluginImages.IMG_OBJ_TAG_HTML;
+ public static final String IMG_OBJ_TAG_IMAGE_MAP = HTMLEditorPluginImages.IMG_OBJ_TAG_IMAGE_MAP;
+ public static final String IMG_OBJ_TAG_IMAGE = HTMLEditorPluginImages.IMG_OBJ_TAG_IMAGE;
+ public static final String IMG_OBJ_TAG_JSP = HTMLEditorPluginImages.IMG_OBJ_TAG_JSP;
+ public static final String IMG_OBJ_TAG_TITLE = HTMLEditorPluginImages.IMG_OBJ_TAG_TITLE;
+ public static final String IMG_OBJ_TAG = HTMLEditorPluginImages.IMG_OBJ_TAG;
+
+ /**
+ * Retrieves the specified image from the html source editor plugin's image registry.
+ * Note: The returned <code>Image</code> is managed by the workbench; clients
+ * must <b>not</b> dispose of the returned image.
+ *
+ * @param symbolicName the symbolic name of the image; there are constants
+ * declared in this class for build-in images that come with the html source editor
+ * @return the image, or <code>null</code> if not found
+ */
+ public static Image getImage(String symbolicName) {
+ return HTMLEditorPluginImageHelper.getInstance().getImage(symbolicName);
+ }
+
+ /**
+ * Retrieves the image descriptor for specified image from the html source editor plugin's
+ * image registry. Unlike <code>Image</code>s, image descriptors themselves do
+ * not need to be disposed.
+ *
+ * @param symbolicName the symbolic name of the image; there are constants
+ * declared in this interface for build-in images that come with the html source editor
+ * @return the image descriptor, or <code>null</code> if not found
+ */
+ public static ImageDescriptor getImageDescriptor(String symbolicName) {
+ return HTMLEditorPluginImageHelper.getInstance().getImageDescriptor(symbolicName);
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java
new file mode 100644
index 0000000000..6bd1f74e78
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLContentAssistProcessor.java
@@ -0,0 +1,428 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.contentassist;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.wst.common.contentmodel.CMDocument;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.css.ui.contentassist.CSSContentAssistProcessor;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLCMDocument;
+import org.eclipse.wst.javascript.common.ui.contentassist.JavaScriptContentAssistProcessor;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.IndexedRegion;
+import org.eclipse.wst.sse.core.modelquery.ModelQueryAdapter;
+import org.eclipse.wst.sse.core.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.core.text.ITextRegionList;
+import org.eclipse.wst.sse.ui.EditorPlugin;
+import org.eclipse.wst.sse.ui.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.edit.util.SharedEditorPluginImageHelper;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
+import org.eclipse.wst.sse.ui.preferences.CommonEditorPreferenceNames;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.xml.core.document.XMLDocument;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.core.document.XMLNode;
+import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.eclipse.wst.xml.ui.contentassist.AbstractContentAssistProcessor;
+import org.eclipse.wst.xml.ui.contentassist.AbstractTemplateCompletionProcessor;
+import org.eclipse.wst.xml.ui.contentassist.ContentAssistRequest;
+import org.eclipse.wst.xml.ui.contentassist.XMLContentModelGenerator;
+import org.eclipse.wst.xml.ui.contentassist.XMLRelevanceConstants;
+import org.eclipse.wst.xml.ui.util.SharedXMLEditorPluginImageHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class HTMLContentAssistProcessor extends AbstractContentAssistProcessor implements IPropertyChangeListener {
+ private AdapterFactory factoryForCSS = null;
+ protected IPreferenceStore fPreferenceStore = null;
+ protected AbstractTemplateCompletionProcessor fTemplateProcessor = null;
+ protected boolean isXHTML = false;
+ protected IResource fResource = null;
+
+ public HTMLContentAssistProcessor() {
+
+ super();
+ }
+
+ /**
+ * @see AbstractContentAssistProcessor#addXMLProposal(ContentAssistRequest)
+ */
+ protected void addXMLProposal(ContentAssistRequest contentAssistRequest) {
+ if (isXHTML)
+ super.addXMLProposal(contentAssistRequest);
+ }
+
+ /**
+ * Add the proposals for a completely empty document
+ */
+ protected void addEmptyDocumentProposals(ContentAssistRequest contentAssistRequest) {
+ // addMacros(contentAssistRequest, MacroHelper.TAG);
+ }
+
+ protected void addPCDATAProposal(String nodeName, ContentAssistRequest contentAssistRequest) {
+ if (isXHTML)
+ super.addPCDATAProposal(nodeName, contentAssistRequest);
+ }
+
+ protected void addStartDocumentProposals(ContentAssistRequest contentAssistRequest) {
+ if (isXHTML)
+ addEmptyDocumentProposals(contentAssistRequest);
+ }
+
+ protected boolean beginsWith(String aString, String prefix) {
+ if (aString == null || prefix == null || prefix.length() == 0)
+ return true;
+ int minimumLength = Math.min(prefix.length(), aString.length());
+ String beginning = aString.substring(0, minimumLength);
+ return beginning.equalsIgnoreCase(prefix);
+ }
+
+ /**
+ * Return a list of proposed code completions based on the
+ * specified location within the document that corresponds
+ * to the current cursor position within the text-editor control.
+ *
+ * @param documentPosition a location within the document
+ * @return an array of code-assist items
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int documentPosition) {
+
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt((StructuredTextViewer) textViewer, documentPosition);
+ XMLNode node = (XMLNode) treeNode;
+ setErrorMessage(null);
+
+ // check if it's in a comment node
+ IStructuredDocument structuredDocument = (IStructuredDocument) textViewer.getDocument();
+ IStructuredDocumentRegion fn = structuredDocument.getRegionAtCharacterOffset(documentPosition);
+ if (fn != null && fn.getType() == XMLRegionContext.XML_COMMENT_TEXT && documentPosition != fn.getStartOffset()) {
+ return new ICompletionProposal[0];
+ }
+
+ // CMVC 242695
+ // if it's a </script> tag, bounce back to JS ca processor...
+ if (fn != null && fn.getType() == XMLRegionContext.XML_TAG_NAME && documentPosition == fn.getStartOffset()) {
+ ITextRegionList v = fn.getRegions();
+ if (v.size() > 1) {
+ // determine that it's a close tag
+ if ((v.get(0)).getType() == XMLRegionContext.XML_END_TAG_OPEN) {
+ Iterator it = v.iterator();
+ ITextRegion region = null;
+ // search for script tag name
+ while (it.hasNext()) {
+ region = (ITextRegion) it.next();
+ if (fn.getText(region).equalsIgnoreCase("script")) { //$NON-NLS-1$
+ // return JS content assist...
+ JavaScriptContentAssistProcessor jsProcessor = new JavaScriptContentAssistProcessor();
+ return jsProcessor.computeCompletionProposals(textViewer, documentPosition);
+ }
+ }
+ }
+ }
+ }
+
+ isXHTML = getXHTML(node);
+
+ fGenerator = null; // force reload of content generator
+
+ // handle blank HTML document case
+ if (treeNode == null || isViewerEmpty(textViewer)) {
+ // cursor is at the EOF
+ ICompletionProposal htmlTagProposal = getHTMLTagPropsosal((StructuredTextViewer) textViewer, documentPosition);
+ ICompletionProposal[] superResults = super.computeCompletionProposals(textViewer, documentPosition);
+ if (superResults != null && superResults.length > 0 && htmlTagProposal != null) {
+ ICompletionProposal[] blankHTMLDocResults = new ICompletionProposal[superResults.length + 1];
+ blankHTMLDocResults[0] = htmlTagProposal;
+ System.arraycopy(superResults, 0, blankHTMLDocResults, 1, superResults.length);
+ return blankHTMLDocResults;
+ }
+ }
+
+ if (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+
+ // check embedded CSS proposals at the beginning of the STYLE end tag
+ Element element = (Element) node;
+ String tagName = element.getTagName();
+ if (tagName != null && tagName.equalsIgnoreCase(HTML40Namespace.ATTR_NAME_STYLE)) {//$NON-NLS-1$
+ IStructuredDocumentRegion endStructuredDocumentRegion = node.getEndStructuredDocumentRegion();
+ if (endStructuredDocumentRegion != null && endStructuredDocumentRegion.getStartOffset() == documentPosition) {
+ IStructuredDocumentRegion startStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
+ if (startStructuredDocumentRegion != null) {
+ int offset = startStructuredDocumentRegion.getEndOffset();
+ int pos = documentPosition - offset;
+ ICompletionProposal[] proposals = getCSSProposals(textViewer, pos, node, offset, (char) 0);
+ if (proposals != null)
+ return proposals;
+ }
+ }
+ }
+
+ // check inline CSS proposals
+ // need to find attr region from sd region
+ IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion((StructuredTextViewer) textViewer, documentPosition);
+ Iterator regions = sdRegion.getRegions().iterator();
+ ITextRegion styleNameRegion = null;
+ ITextRegion styleValueRegion = null;
+ while (regions.hasNext()) {
+ styleNameRegion = (ITextRegion) regions.next();
+ if (styleNameRegion.getType().equals(XMLRegionContext.XML_TAG_ATTRIBUTE_NAME) && sdRegion.getText(styleNameRegion).equalsIgnoreCase(HTML40Namespace.ATTR_NAME_STYLE)) { //$NON-NLS-1$
+ // the next region should be "="
+ if (regions.hasNext()) {
+ regions.next(); // skip the "="
+ // next region should be attr value region
+ if (regions.hasNext()) {
+ styleValueRegion = (ITextRegion) regions.next();
+ break;
+ }
+ }
+ }
+ }
+
+ if (styleValueRegion != null) {
+ int offset = sdRegion.getStartOffset(styleValueRegion);
+ int end = sdRegion.getTextEndOffset(styleValueRegion);
+ if (documentPosition >= offset && documentPosition <= end) {
+ boolean askCSS = true;
+ char quote = (char) 0;
+ String text = sdRegion.getText(styleValueRegion);
+ int length = (text != null ? text.length() : 0);
+ if (length > 0) {
+ char firstChar = text.charAt(0);
+ if (firstChar == '"' || firstChar == '\'') {
+ if (documentPosition == offset) {
+ // before quote
+ askCSS = false;
+ }
+ else {
+ offset++;
+ quote = firstChar;
+ }
+ }
+ if (documentPosition == end) {
+ if (length > 1 && text.charAt(length - 1) == quote) {
+ // after quote
+ askCSS = false;
+ }
+ }
+ }
+ if (askCSS) {
+ int pos = documentPosition - offset;
+ ICompletionProposal[] proposals = getCSSProposals(textViewer, pos, node, offset, quote);
+ if (proposals != null)
+ return proposals;
+ }
+ }
+ }
+ }
+
+ return super.computeCompletionProposals(textViewer, documentPosition);
+ }
+
+ /**
+ * Returns true if there is no text or it's all white space, otherwise returns false
+ *
+ * @param treeNode
+ * @param textViewer
+ * @return boolean
+ */
+ private boolean isViewerEmpty(ITextViewer textViewer) {
+ boolean isEmpty = false;
+ String text = textViewer.getTextWidget().getText();
+ if (text == null || (text != null && text.trim().equals(""))) //$NON-NLS-1$
+ isEmpty = true;
+ return isEmpty;
+ }
+
+ /**
+ * @return ICompletionProposal
+ */
+ private ICompletionProposal getHTMLTagPropsosal(StructuredTextViewer viewer, int documentPosition) {
+
+ IModelManagerPlugin mmp = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ IModelManager mm = mmp.getModelManager();
+ IStructuredModel model = null;
+ try {
+ if (mm != null)
+ model = mm.getExistingModelForRead(viewer.getDocument());
+
+ XMLDocument doc = ((XMLModel) model).getDocument();
+
+ ModelQuery mq = ModelQueryUtil.getModelQuery(doc);
+ // XHTML requires lowercase tagname for lookup
+ CMElementDeclaration htmlDecl = (CMElementDeclaration) mq.getCorrespondingCMDocument(doc).getElements().getNamedItem(HTML40Namespace.ElementName.HTML.toLowerCase());
+ if (htmlDecl != null) {
+ StringBuffer proposedTextBuffer = new StringBuffer();
+ getContentGenerator().generateTag(doc, htmlDecl, proposedTextBuffer);
+
+ String proposedText = proposedTextBuffer.toString();
+ String requiredName = getContentGenerator().getRequiredName(doc, htmlDecl);
+
+ CustomCompletionProposal proposal = new CustomCompletionProposal(proposedText, documentPosition, // start pos
+ 0, // replace length
+ requiredName.length() + 2, // cursor position after (relavtive to start)
+ SharedEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_TAG_GENERIC),
+ requiredName, null, null, XMLRelevanceConstants.R_TAG_NAME);
+ return proposal;
+ }
+ }
+ finally {
+ if (model != null)
+ model.releaseFromRead();
+ }
+ return null;
+ }
+
+ /**
+ * @see AbstractContentAssistProcessor#getContentGenerator()
+ */
+ public XMLContentModelGenerator getContentGenerator() {
+ if (fGenerator == null) {
+ if (isXHTML)
+ fGenerator = XHTMLMinimalContentModelGenerator.getInstance();
+ else
+ fGenerator = HTMLMinimalContentModelGenerator.getInstance();
+ }
+ return fGenerator;
+ }
+
+ protected ICompletionProposal[] getCSSProposals(ITextViewer viewer, int pos, XMLNode element, int offset, char quote) {
+
+ CSSContentAssistProcessor cssProcessor = new CSSContentAssistProcessor();
+ cssProcessor.setDocumentOffset(offset);
+ cssProcessor.setQuoteCharOfStyleAttribute(quote);
+
+ return cssProcessor.computeCompletionProposals(viewer, pos);
+ }
+
+ protected String getEmptyTagCloseString() {
+ if (isXHTML)
+ return " />"; //$NON-NLS-1$
+ return ">"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.contentassist.AbstractContentAssistProcessor#getTemplateCompletionProcessor()
+ */
+ protected AbstractTemplateCompletionProcessor getTemplateCompletionProcessor() {
+ if (fTemplateProcessor == null) {
+ fTemplateProcessor = new HTMLTemplateCompletionProcessor();
+ }
+ return fTemplateProcessor;
+ }
+
+ /**
+ * Determine if this Document is an XHTML Document. Oprates solely
+ * off of the Document Type declaration
+ */
+ protected boolean getXHTML(Node node) {
+ if (node == null)
+ return false;
+
+ Document doc = null;
+ if (node.getNodeType() != Node.DOCUMENT_NODE)
+ doc = node.getOwnerDocument();
+ else
+ doc = ((Document) node);
+
+ if (doc instanceof XMLDocument)
+ return ((XMLDocument) doc).isXMLType();
+
+
+ if (doc instanceof INodeNotifier) {
+ ModelQueryAdapter adapter = (ModelQueryAdapter) ((INodeNotifier) doc).getAdapterFor(ModelQueryAdapter.class);
+ CMDocument cmdoc = null;
+ if (adapter != null && adapter.getModelQuery() != null)
+ cmdoc = adapter.getModelQuery().getCorrespondingCMDocument(doc);
+ if (cmdoc != null) {
+ // treat as XHTML unless we've got the in-code HTML content model
+ if (cmdoc instanceof HTMLCMDocument)
+ return false;
+ if (cmdoc.supports(HTMLCMProperties.IS_XHTML))
+ return Boolean.TRUE.equals(cmdoc.getProperty(HTMLCMProperties.IS_XHTML));
+ }
+ }
+ // this should never be reached
+ DocumentType docType = doc.getDoctype();
+ return docType != null && docType.getPublicId() != null && docType.getPublicId().indexOf("-//W3C//DTD XHTML ") == 0; //$NON-NLS-1$
+ }
+
+ protected void init() {
+ getPreferenceStore().addPropertyChangeListener(this);
+ reinit();
+ }
+
+ protected void reinit() {
+ String key = PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.AUTO_PROPOSE, IContentTypeIdentifier.ContentTypeID_HTML);
+ boolean doAuto = getPreferenceStore().getBoolean(key);
+ if (doAuto) {
+ key = PreferenceKeyGenerator.generateKey(CommonEditorPreferenceNames.AUTO_PROPOSE_CODE, IContentTypeIdentifier.ContentTypeID_HTML);
+ completionProposalAutoActivationCharacters = getPreferenceStore().getString(key).toCharArray();
+ }
+ else {
+ completionProposalAutoActivationCharacters = null;
+ }
+ }
+
+ public void release() {
+ if (factoryForCSS != null) {
+ factoryForCSS.release();
+ }
+ getPreferenceStore().removePropertyChangeListener(this);
+ super.release();
+ }
+
+ protected boolean stringsEqual(String a, String b) {
+ return a.equalsIgnoreCase(b);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+
+ if (property.compareTo(CommonEditorPreferenceNames.AUTO_PROPOSE) == 0 || property.compareTo(CommonEditorPreferenceNames.AUTO_PROPOSE_CODE) == 0) {
+ reinit();
+ }
+ }
+
+ protected IPreferenceStore getPreferenceStore() {
+ if (fPreferenceStore == null)
+ fPreferenceStore = EditorPlugin.getDefault().getPreferenceStore();
+
+ return fPreferenceStore;
+ }
+
+ /**
+ * @see com.ibm.sed.edit.adapters.ExtendedContentAssistAdapter#computeCompletionProposals(ITextViewer, int, IndexedRegion, ITextRegion)
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentPosition, IndexedRegion indexedNode, ITextRegion region) {
+ return computeCompletionProposals(viewer, documentPosition);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java
new file mode 100644
index 0000000000..1d04f65b89
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.contentassist;
+
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.xml.ui.contentassist.XMLContentModelGenerator;
+import org.w3c.dom.Node;
+
+public class HTMLMinimalContentModelGenerator extends XMLContentModelGenerator {
+
+ private static HTMLMinimalContentModelGenerator instance = null;
+ protected int fTagCase;
+ protected int fAttrCase;
+
+ /**
+ * HTMLMinimalContentModelGenerator constructor comment.
+ */
+ private HTMLMinimalContentModelGenerator() {
+ super();
+ }
+
+ private void init() {
+ //IPreferenceStore prefs = CommonPreferencesPlugin.getDefault().getPreferenceStore(ContentType.ContentTypeID_HTML);
+ Preferences prefs = HTMLCorePlugin.getDefault().getPluginPreferences();
+ fTagCase = prefs.getInt(CommonModelPreferenceNames.TAG_NAME_CASE);
+ fAttrCase = prefs.getInt(CommonModelPreferenceNames.ATTR_NAME_CASE);
+ }
+
+ protected void generateEndTag(String tagName, Node parentNode, CMElementDeclaration elementDecl, StringBuffer buffer) {
+ if (elementDecl == null)
+ return;
+ if (elementDecl instanceof HTMLElementDeclaration) {
+ if (((Boolean) elementDecl.getProperty(HTMLCMProperties.IS_JSP)).booleanValue()) {
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY)
+ return;
+ }
+ else {
+ String ommission = (String) elementDecl.getProperty(HTMLCMProperties.OMIT_TYPE);
+ if (ommission.equals(HTMLCMProperties.Values.OMIT_END) || ommission.equals(HTMLCMProperties.Values.OMIT_END_DEFAULT) || ommission.equals(HTMLCMProperties.Values.OMIT_END_MUST)) {
+ return;
+ }
+ }
+ }
+
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY)
+ return;
+ buffer.append("</" + tagName + ">"); //$NON-NLS-2$//$NON-NLS-1$
+ return;
+ }
+
+ private boolean shouldIgnoreCase(CMNode cmnode) {
+ if (!cmnode.supports(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return false;
+ return ((Boolean) cmnode.getProperty(HTMLCMProperties.SHOULD_IGNORE_CASE)).booleanValue();
+ }
+
+ public String getRequiredName(Node ownerNode, CMNode cmnode) {
+ String name = super.getRequiredName(ownerNode, cmnode);
+ // don't change the case unless we're certain it is meaningless
+ if (shouldIgnoreCase(cmnode)) {
+ int caseVal = -1;
+ if (cmnode.getNodeType() == CMNode.ELEMENT_DECLARATION)
+ caseVal = fTagCase;
+ else if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION)
+ caseVal = fAttrCase;
+ switch (caseVal) {
+ case CommonModelPreferenceNames.LOWER :
+ {
+ name = name.toLowerCase();
+ }
+ break;
+ case CommonModelPreferenceNames.UPPER :
+ {
+ name = name.toUpperCase();
+ }
+ break;
+ }
+ }
+ return name;
+ }
+
+ public String getStartTagClose(Node parentNode, CMElementDeclaration elementDecl) {
+ String other = getOtherClose(parentNode);
+ if (other != null)
+ return other;
+ if (elementDecl == null)
+ return ">"; //$NON-NLS-1$
+ if (elementDecl instanceof HTMLElementDeclaration) {
+ if (((Boolean) elementDecl.getProperty(HTMLCMProperties.IS_JSP)).booleanValue()) {
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY)
+ return "/>"; //$NON-NLS-1$
+ }
+ else {
+ String ommission = (String) elementDecl.getProperty(HTMLCMProperties.OMIT_TYPE);
+ if (ommission.equals(HTMLCMProperties.Values.OMIT_END) || ommission.equals(HTMLCMProperties.Values.OMIT_END_DEFAULT) || ommission.equals(HTMLCMProperties.Values.OMIT_END_MUST)) {
+ return ">"; //$NON-NLS-1$
+ }
+ }
+ }
+
+ return ">"; //$NON-NLS-1$
+ }
+
+ /**
+ * Gets the instance.
+ * @return Returns a HTMLMinimalContentModelGenerator
+ */
+ public synchronized static HTMLMinimalContentModelGenerator getInstance() {
+ if (instance == null)
+ instance = new HTMLMinimalContentModelGenerator();
+ instance.init();
+ return instance;
+ }
+
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTemplateCompletionProcessor.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTemplateCompletionProcessor.java
new file mode 100644
index 0000000000..1d9e798109
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTemplateCompletionProcessor.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.contentassist;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.text.templates.ContextTypeRegistry;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.wst.html.ui.HTMLEditorPlugin;
+import org.eclipse.wst.html.ui.templates.TemplateContextTypeHTML;
+import org.eclipse.wst.xml.ui.contentassist.AbstractTemplateCompletionProcessor;
+
+
+/**
+ * Completion processor for HTML Templates
+ */
+public class HTMLTemplateCompletionProcessor extends AbstractTemplateCompletionProcessor {
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.contentassist.AbstractTemplateCompletionProcessor#getTemplateStore()
+ */
+ protected TemplateStore getTemplateStore() {
+ return getHTMLEditorPlugin().getTemplateStore();
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.contentassist.AbstractTemplateCompletionProcessor#getTemplateContextRegistry()
+ */
+ protected ContextTypeRegistry getTemplateContextRegistry() {
+ return getHTMLEditorPlugin().getTemplateContextRegistry();
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.contentassist.AbstractTemplateCompletionProcessor#getContextTypeId()
+ */
+ protected String getContextTypeId() {
+ // turn the context type id into content type specific
+ return TemplateContextTypeHTML.generateContextTypeId(super.getContextTypeId());
+ }
+
+ /**
+ * Returns the HTMLEditorPlugin
+ * @return HTMLEditorPlugin
+ */
+ private HTMLEditorPlugin getHTMLEditorPlugin() {
+ return (HTMLEditorPlugin) Platform.getPlugin(HTMLEditorPlugin.ID);
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/NoRegionContentAssistProcessorForHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/NoRegionContentAssistProcessorForHTML.java
new file mode 100644
index 0000000000..10bf7fc184
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/NoRegionContentAssistProcessorForHTML.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.contentassist;
+
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.wst.css.core.internal.text.rules.StructuredTextPartitionerForCSS;
+import org.eclipse.wst.css.ui.contentassist.CSSContentAssistProcessor;
+import org.eclipse.wst.html.core.internal.text.rules.StructuredTextPartitionerForHTML;
+import org.eclipse.wst.javascript.common.ui.contentassist.JavaScriptContentAssistProcessor;
+import org.eclipse.wst.xml.ui.contentassist.NoRegionContentAssistProcessor;
+
+/**
+ *
+ * @author pavery
+ */
+public class NoRegionContentAssistProcessorForHTML extends NoRegionContentAssistProcessor {
+ /*
+ * @see com.ibm.sse.editor.xml.contentassist.NoRegionContentAssistProcessor#initPartitionToProcessorMap()
+ */
+ protected void initPartitionToProcessorMap() {
+ super.initPartitionToProcessorMap();
+ IContentAssistProcessor htmlProcessor = new HTMLContentAssistProcessor();
+ fPartitionToProcessorMap.put(StructuredTextPartitionerForHTML.ST_DEFAULT_HTML, htmlProcessor);
+ fPartitionToProcessorMap.put(StructuredTextPartitionerForHTML.ST_HTML_COMMENT, htmlProcessor);
+
+ IContentAssistProcessor jsContentAssistProcessor = new JavaScriptContentAssistProcessor();
+ fPartitionToProcessorMap.put(StructuredTextPartitionerForHTML.ST_SCRIPT, jsContentAssistProcessor);
+
+ IContentAssistProcessor cssContentAssistProcessor = new CSSContentAssistProcessor();
+ fPartitionToProcessorMap.put(StructuredTextPartitionerForCSS.ST_STYLE, cssContentAssistProcessor);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/XHTMLMinimalContentModelGenerator.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/XHTMLMinimalContentModelGenerator.java
new file mode 100644
index 0000000000..e64bb1fe1c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/XHTMLMinimalContentModelGenerator.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.contentassist;
+
+
+
+import org.eclipse.wst.common.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.contentmodel.HTMLElementDeclaration;
+import org.eclipse.wst.xml.ui.contentassist.XMLContentModelGenerator;
+import org.w3c.dom.Node;
+
+public class XHTMLMinimalContentModelGenerator extends XMLContentModelGenerator {
+
+ private static XHTMLMinimalContentModelGenerator instance = null;
+
+ private XHTMLMinimalContentModelGenerator() {
+ super();
+ }
+
+ protected void generateEndTag(String tagName, Node parentNode, CMElementDeclaration elementDecl, StringBuffer buffer) {
+ if (elementDecl == null)
+ return;
+ if (elementDecl instanceof HTMLElementDeclaration) {
+ if (((Boolean) elementDecl.getProperty(HTMLCMProperties.IS_JSP)).booleanValue()) {
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY)
+ return;
+ }
+ else {
+ String ommission = (String) elementDecl.getProperty(HTMLCMProperties.OMIT_TYPE);
+ if (ommission.equals(HTMLCMProperties.Values.OMIT_END) || ommission.equals(HTMLCMProperties.Values.OMIT_END_DEFAULT) || ommission.equals(HTMLCMProperties.Values.OMIT_END_MUST)) {
+ return;
+ }
+ }
+ }
+
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY)
+ return;
+ buffer.append("</" + tagName + ">"); //$NON-NLS-2$//$NON-NLS-1$
+ return;
+ }
+
+
+ public String getStartTagClose(Node parentNode, CMElementDeclaration elementDecl) {
+ String other = getOtherClose(parentNode);
+ if (other != null)
+ return other;
+ if (elementDecl == null)
+ return ">"; //$NON-NLS-1$
+ // EMPTY tag, do a self-close
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY) {
+ // if it's a JSP element, don't add the space since the JSP container doesn't/shouldn't care
+ if (elementDecl instanceof HTMLElementDeclaration && (((Boolean) elementDecl.getProperty(HTMLCMProperties.IS_JSP)).booleanValue()))
+ // if it's not JSP, conform to XHTML guidelines and add the space
+ return "/>"; //$NON-NLS-1$
+ else
+ return " />"; //$NON-NLS-1$
+ }
+ // not defined as EMPTY, but should be treated as such anyway
+ else if (elementDecl instanceof HTMLElementDeclaration) {
+ String ommission = (String) elementDecl.getProperty(HTMLCMProperties.OMIT_TYPE);
+ if (ommission.equals(HTMLCMProperties.Values.OMIT_END) || ommission.equals(HTMLCMProperties.Values.OMIT_END_DEFAULT) || ommission.equals(HTMLCMProperties.Values.OMIT_END_MUST)) {
+ return " />"; //$NON-NLS-1$
+ }
+ }
+
+ return ">"; //$NON-NLS-1$
+ }
+
+ public synchronized static XHTMLMinimalContentModelGenerator getInstance() {
+ if (instance == null)
+ instance = new XHTMLMinimalContentModelGenerator();
+ return instance;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImageHelper.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImageHelper.java
new file mode 100644
index 0000000000..587ea0c2e1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImageHelper.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.editor;
+
+import java.util.HashMap;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.html.ui.HTMLEditorPlugin;
+
+
+/**
+ * Helper class to handle images provided by this plug-in.
+ *
+ * NOTE: For internal use only. For images used externally, please use the
+ * Shared***ImageHelper class instead.
+ *
+ * @author amywu
+ */
+public class HTMLEditorPluginImageHelper {
+ private final String PLUGINID = HTMLEditorPlugin.ID;
+ private static HTMLEditorPluginImageHelper instance = null;
+
+ // save a descriptor for each image
+ private HashMap fImageDescRegistry = null;
+
+ /**
+ * Gets the instance.
+ *
+ * @return Returns a HTMLEditorPluginImageHelper
+ */
+ public synchronized static HTMLEditorPluginImageHelper getInstance() {
+ if (instance == null)
+ instance = new HTMLEditorPluginImageHelper();
+ return instance;
+ }
+
+ /**
+ * Retrieves the image associated with resource from the image registry.
+ * If the image cannot be retrieved, attempt to find and load the image at
+ * the location specified in resource.
+ *
+ * @param resource
+ * the image to retrieve
+ * @return Image the image associated with resource or null if one could
+ * not be found
+ */
+ public Image getImage(String resource) {
+ Image image = getImageRegistry().get(resource);
+ if (image == null) {
+ // create an image
+ image = createImage(resource);
+ }
+ return image;
+ }
+
+ /**
+ * Retrieves the image descriptor associated with resource from the image
+ * descriptor registry. If the image descriptor cannot be retrieved,
+ * attempt to find and load the image descriptor at the location specified
+ * in resource.
+ *
+ * @param resource
+ * the image descriptor to retrieve
+ * @return ImageDescriptor the image descriptor assocated with resource or
+ * the default "missing" image descriptor if one could not be
+ * found
+ */
+ public ImageDescriptor getImageDescriptor(String resource) {
+ ImageDescriptor imageDescriptor = null;
+ Object o = getImageDescriptorRegistry().get(resource);
+ if (o == null) {
+ //create a descriptor
+ imageDescriptor = createImageDescriptor(resource);
+ }
+ else {
+ imageDescriptor = (ImageDescriptor) o;
+ }
+ return imageDescriptor;
+ }
+
+ /**
+ * Returns the image descriptor registry for this plugin.
+ *
+ * @return HashMap - image descriptor registry for this plugin
+ */
+ private HashMap getImageDescriptorRegistry() {
+ if (fImageDescRegistry == null)
+ fImageDescRegistry = new HashMap();
+ return fImageDescRegistry;
+ }
+
+ /**
+ * Returns the image registry for this plugin.
+ *
+ * @return ImageRegistry - image registry for this plugin
+ */
+ private ImageRegistry getImageRegistry() {
+ return JFaceResources.getImageRegistry();
+ }
+
+ /**
+ * Creates an image from the given resource and adds the image to the
+ * image registry.
+ *
+ * @param resource
+ * @return Image
+ */
+ private Image createImage(String resource) {
+ ImageDescriptor desc = getImageDescriptor(resource);
+ Image image = null;
+
+ if (desc != null) {
+ image = desc.createImage();
+ // dont add the missing image descriptor image to the image registry
+ if (!desc.equals(ImageDescriptor.getMissingImageDescriptor()))
+ getImageRegistry().put(resource, image);
+ }
+ return image;
+ }
+
+ /**
+ * Creates an image descriptor from the given imageFilePath and adds the
+ * image descriptor to the image descriptor registry. If an image
+ * descriptor could not be created, the default "missing" image descriptor
+ * is returned but not added to the image descriptor registry.
+ *
+ * @param imageFilePath
+ * @return ImageDescriptor image descriptor for imageFilePath or default
+ * "missing" image descriptor if resource could not be found
+ */
+ private ImageDescriptor createImageDescriptor(String imageFilePath) {
+ ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID, imageFilePath);
+ if (imageDescriptor != null) {
+ getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
+ }
+ else {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ return imageDescriptor;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImages.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImages.java
new file mode 100644
index 0000000000..fbf3aec847
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/HTMLEditorPluginImages.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.editor;
+
+/**
+ * Bundle of most images used by the HTML Editor plug-in.
+ */
+public class HTMLEditorPluginImages {
+ public static final String IMG_OBJ_TABLE = "icons/full/obj16/table.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_ANCHOR = "icons/full/obj16/tag-anchor.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_BODY = "icons/full/obj16/tag-body.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_BUTTON = "icons/full/obj16/tag-button.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_FONT = "icons/full/obj16/tag-font.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_FORM = "icons/full/obj16/tag-form.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_HTML = "icons/full/obj16/tag-html.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_IMAGE_MAP = "icons/full/obj16/tag-image-map.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_IMAGE = "icons/full/obj16/tag-image.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_JSP = "icons/full/obj16/tag-jsp.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG_TITLE = "icons/full/obj16/tag-title.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJ_TAG = "icons/full/obj16/tag.gif"; //$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/IHelpContextIds.java
new file mode 100644
index 0000000000..c7e40934a7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/editor/IHelpContextIds.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.editor;
+
+import org.eclipse.wst.html.ui.HTMLEditorPlugin;
+
+/**
+ * Help context ids for the HTML Source Editor.
+ * <p>
+ * This interface contains constants only; it is not intended to be implemented.
+ * </p>
+ *
+ */
+public interface IHelpContextIds {
+ // org.eclipse.wst.html.ui.
+ public static final String PREFIX = HTMLEditorPlugin.ID + "."; //$NON-NLS-1$
+
+ // HTML Source page editor
+ public static final String HTML_SOURCEVIEW_HELPID = PREFIX + "ehtm0000"; //$NON-NLS-1$
+
+ // HTML Files Preference page
+ public static final String HTML_PREFWEBX_FILES_HELPID = PREFIX + "webx0030"; //$NON-NLS-1$
+ // HTML Source Preference page
+ public static final String HTML_PREFWEBX_SOURCE_HELPID = PREFIX + "webx0031"; //$NON-NLS-1$
+ // HTML Styles Preference page
+ public static final String HTML_PREFWEBX_STYLES_HELPID = PREFIX + "webx0032"; //$NON-NLS-1$
+ // HTML Templates Preference page
+ public static final String HTML_PREFWEBX_TEMPLATES_HELPID = PREFIX + "webx0033"; //$NON-NLS-1$
+
+ // HTML Cleanup dialog
+ public static final String CLEANUP_HTML_HELPID = PREFIX + "xmlm1100"; //$NON-NLS-1$
+
+ // HTML Content Settings
+ public static final String WEB_CONTENT_SETTINGS_HELPID = PREFIX + "misc0170"; //$NON-NLS-1$
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/nls/ResourceHandler.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/nls/ResourceHandler.java
new file mode 100644
index 0000000000..a629f04897
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/nls/ResourceHandler.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.nls;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ResourceHandler {
+
+
+ private static ResourceBundle fgResourceBundle;
+
+ /**
+ * Returns the resource bundle used by all classes in this Project
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("EditingHTML");//$NON-NLS-1$
+ }
+ catch (MissingResourceException e) {
+ // does nothing - this method will return null and
+ // getString(String) will return the key
+ // it was called with
+ }
+ return null;
+ }
+
+ public static String getString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle = getResourceBundle();
+ }
+
+ if (fgResourceBundle != null) {
+ try {
+ return fgResourceBundle.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ else {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+
+ public static String getString(String key, Object[] args) {
+
+ try {
+ return MessageFormat.format(getString(key), args);
+ }
+ catch (IllegalArgumentException e) {
+ return getString(key);
+ }
+
+ }
+
+ public static String getString(String key, Object[] args, int x) {
+
+ return getString(key);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java
new file mode 100644
index 0000000000..5790f76aff
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.internal.search;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.html.core.internal.text.rules.StructuredTextPartitionerForHTML;
+import org.eclipse.wst.sse.ui.internal.search.BasicFindOccurrencesAction;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.eclipse.wst.xml.core.text.rules.StructuredTextPartitionerForXML;
+
+
+/**
+ * Configures a BasicFindOccurrencesAction with HTML partitions and regions
+ *
+ * @author pavery
+ */
+public class HTMLFindOccurrencesAction extends BasicFindOccurrencesAction {
+
+ public HTMLFindOccurrencesAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
+ super(bundle, prefix, editor);
+ }
+
+ /**
+ * @see com.ibm.sse.editor.internal.search.BasicFindOccurrencesAction#getPartitionTypes()
+ */
+ public String[] getPartitionTypes() {
+
+ return new String[]{StructuredTextPartitionerForHTML.ST_DEFAULT_HTML, StructuredTextPartitionerForXML.ST_DEFAULT_XML};
+ }
+
+ /**
+ * @see com.ibm.sse.editor.internal.search.BasicFindOccurrencesAction#getRegionTypes()
+ */
+ public String[] getRegionTypes() {
+
+ return new String[]{XMLRegionContext.XML_TAG_NAME, XMLRegionContext.XML_TAG_ATTRIBUTE_NAME, XMLRegionContext.XML_TAG_ATTRIBUTE_VALUE};
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/openon/DefaultOpenOnHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/openon/DefaultOpenOnHTML.java
new file mode 100644
index 0000000000..4ecfcc8c5d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/openon/DefaultOpenOnHTML.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.openon;
+
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.util.PathHelper;
+import org.eclipse.wst.sse.core.util.URIResolver;
+import org.eclipse.wst.xml.ui.openon.DefaultOpenOnXML;
+
+/**
+ * This action class retrieves the link/file selected by the cursor and
+ * attempts to open the link/file in the default editor or web browser
+ */
+public class DefaultOpenOnHTML extends DefaultOpenOnXML {
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.openon.DefaultOpenOnXML#resolveURI(java.lang.String, java.lang.String, java.lang.String)
+ */
+ protected String resolveURI(String baseLocation, String publicId, String systemId) {
+ // currently using model's URI resolver until a better resolver is extended to common extensible URI resolver
+ // future_TODO: should use the new common extensible URI resolver when clients start implementing it
+ String resolvedURI = systemId;
+
+ if (systemId != null) {
+ IStructuredModel sModel = getModelManager().getExistingModelForRead(getDocument());
+ if (sModel != null) {
+ URIResolver resolver = sModel.getResolver();
+ resolvedURI = resolver != null ? resolver.getLocationByURI(systemId, true) : systemId;
+
+ sModel.releaseFromRead();
+ }
+ // special adjustment for file protocol
+ if (systemId.startsWith(FILE_PROTOCOL)) {
+ PathHelper.removeLeadingSeparator(resolvedURI);
+ }
+ }
+ return resolvedURI;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLColorPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLColorPage.java
new file mode 100644
index 0000000000..b224dd6b2b
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLColorPage.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.preferences.ui;
+
+
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.sse.core.IModelManager;
+import org.eclipse.wst.sse.core.IModelManagerPlugin;
+import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
+import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.preferences.ui.StyledTextColorPicker;
+import org.eclipse.wst.xml.core.internal.parser.XMLSourceParser;
+import org.eclipse.wst.xml.core.jsp.model.parser.temp.XMLJSPRegionContexts;
+import org.eclipse.wst.xml.ui.preferences.XMLColorPage;
+import org.eclipse.wst.xml.ui.style.IStyleConstantsXML;
+
+public class HTMLColorPage extends XMLColorPage {
+
+ /**
+ * Set up all the style preference keys in the overlay store
+ */
+ protected OverlayKey[] createOverlayStoreKeys() {
+ ArrayList overlayKeys = new ArrayList();
+
+ ArrayList styleList = new ArrayList();
+ initStyleList(styleList);
+ Iterator i = styleList.iterator();
+ while (i.hasNext()) {
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceKeyGenerator.generateKey((String)i.next(), IContentTypeIdentifier.ContentTypeID_HTML)));
+ }
+
+ OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
+ overlayKeys.toArray(keys);
+ return keys;
+ }
+
+ public String getSampleText() {
+ return ResourceHandler.getString("Sample_HTML_doc"); //$NON-NLS-1$ = "<!DOCTYPE HTML\n\tPUBLIC \"-//W3C/DTD/ HTML 4.01 Transitional//EN\"\n\t\"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML>\n\t<HEAD>\n\t\t<META content=\"text/html\">\n\t\t<TITLE>HTML Highlighting Preferences</TITLE>\n\t</HEAD>\n<BODY>\n\t<!--\n\t\twe need a flaming logo!\n\t-->\n\t<%\t%>\n</BODY>\n</HTML>"
+
+ }
+
+ protected void initContextStyleMap(Dictionary contextStyleMap) {
+
+ initCommonContextStyleMap(contextStyleMap);
+ initDocTypeContextStyleMap(contextStyleMap);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_SCRIPTLET_OPEN, HTMLColorManager.SCRIPT_AREA_BORDER);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_CONTENT, HTMLColorManager.SCRIPT_AREA);
+ // contextStyleMap.put(XMLJSPRegionContexts.BLOCK_TEXT, HTMLColorManager.SCRIPT_AREA);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_DECLARATION_OPEN, HTMLColorManager.SCRIPT_AREA_BORDER);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_EXPRESSION_OPEN, HTMLColorManager.SCRIPT_AREA_BORDER);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_DIRECTIVE_OPEN, HTMLColorManager.SCRIPT_AREA_BORDER);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_DIRECTIVE_CLOSE, HTMLColorManager.SCRIPT_AREA_BORDER);
+ // contextStyleMap.put(XMLJSPRegionContexts.JSP_CLOSE, HTMLColorManager.SCRIPT_AREA_BORDER);
+ contextStyleMap.put(XMLJSPRegionContexts.JSP_DIRECTIVE_NAME, IStyleConstantsXML.TAG_NAME);
+ contextStyleMap.put(XMLJSPRegionContexts.JSP_COMMENT_OPEN, IStyleConstantsXML.COMMENT_BORDER);
+ contextStyleMap.put(XMLJSPRegionContexts.JSP_COMMENT_TEXT, IStyleConstantsXML.COMMENT_TEXT);
+ contextStyleMap.put(XMLJSPRegionContexts.JSP_COMMENT_CLOSE, IStyleConstantsXML.COMMENT_BORDER);
+ }
+
+ protected void initDescriptions(Dictionary descriptions) {
+
+ initCommonDescriptions(descriptions);
+ initDocTypeDescriptions(descriptions);
+ }
+
+ protected void initStyleList(ArrayList list) {
+ initCommonStyleList(list);
+ initDocTypeStyleList(list);
+ // list.add(HTMLColorManager.SCRIPT_AREA_BORDER);
+
+ }
+
+ protected void setupPicker(StyledTextColorPicker picker) {
+
+ IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
+ if (plugin != null) {
+ IModelManager mmanager = plugin.getModelManager();
+ picker.setParser(mmanager.createStructuredDocumentFor(IContentTypeIdentifier.ContentTypeID_HTML).getParser());
+ }
+ else
+ picker.setParser(new XMLSourceParser());
+
+ // create descriptions for hilighting types
+ Dictionary descriptions = new Hashtable();
+ initDescriptions(descriptions);
+
+ // map region types to hilighting types
+ Dictionary contextStyleMap = new Hashtable();
+ initContextStyleMap(contextStyleMap);
+
+ ArrayList styleList = new ArrayList();
+ initStyleList(styleList);
+
+ picker.setContextStyleMap(contextStyleMap);
+ picker.setDescriptions(descriptions);
+ picker.setStyleList(styleList);
+
+ picker.setGeneratorKey(IContentTypeIdentifier.ContentTypeID_HTML);
+ // updatePickerFont(picker);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ WorkbenchHelp.setHelp(c, IHelpContextIds.HTML_PREFWEBX_STYLES_HELPID);
+ return c;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLFilesPreferencePage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLFilesPreferencePage.java
new file mode 100644
index 0000000000..fd070b4aa2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLFilesPreferencePage.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.preferences.ui;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.CommonEncodingPreferenceNames;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.html.core.HTMLFilesPreferenceNames;
+import org.eclipse.wst.html.ui.HTMLEditorPlugin;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.xml.ui.preferences.EncodingSettings;
+import org.eclipse.wst.xml.ui.preferences.WorkbenchDefaultEncodingSettings;
+import org.eclipse.wst.xml.ui.preferences.XMLFilesPreferencePage;
+
+
+public class HTMLFilesPreferencePage extends XMLFilesPreferencePage {
+ private WorkbenchDefaultEncodingSettings fInputEncodingSettings = null;
+ private Text fHtmlext_Field;
+ private Button fDoctype_Button;
+ private Button fGenerator_Button;
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.preferences.ui.AbstractPreferencePage#getModelPreferences()
+ */
+ protected Preferences getModelPreferences() {
+ return HTMLCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return HTMLEditorPlugin.getDefault().getPreferenceStore();
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#doSavePreferenceStore()
+ */
+ protected void doSavePreferenceStore() {
+ HTMLCorePlugin.getDefault().savePluginPreferences(); // model
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite scrolledComposite = createScrolledComposite(parent);
+ createContentsForCreatingOrSavingGroup(scrolledComposite);
+ createContentsForCreatingGroup(scrolledComposite);
+ createContentsForLoadingGroup(scrolledComposite);
+
+ WorkbenchHelp.setHelp(scrolledComposite, IHelpContextIds.HTML_PREFWEBX_FILES_HELPID);
+
+ setSize(scrolledComposite);
+ loadPreferences();
+
+ return scrolledComposite;
+ }
+
+ protected void createContentsForLoadingGroup(Composite parent) {
+ Group group = createGroup(parent, 1);
+ group.setText(ResourceHandler.getString("HTMLFilesPreferencePage.0")); //$NON-NLS-1$
+
+ fInputEncodingSettings = new WorkbenchDefaultEncodingSettings(group);
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.preferences.ui.AbstractPreferencePage#initializeValues()
+ */
+ protected void initializeValues() {
+ super.initializeValues();
+ initializeValuesForLoadingGroup();
+ }
+
+ protected void initializeValuesForLoadingGroup() {
+ String encoding = getModelPreferences().getString(CommonEncodingPreferenceNames.INPUT_CODESET);
+
+ fInputEncodingSettings.setIANATag(encoding);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ super.performDefaults();
+ performDefaultsForLoadingGroup();
+ }
+
+ protected void performDefaultsForLoadingGroup() {
+ String encoding = getModelPreferences().getDefaultString(CommonEncodingPreferenceNames.INPUT_CODESET);
+
+ fInputEncodingSettings.setIANATag(encoding);
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.preferences.ui.AbstractPreferencePage#storeValues()
+ */
+ protected void storeValues() {
+ super.storeValues();
+ storeValuesForLoadingGroup();
+ }
+
+ protected void storeValuesForLoadingGroup() {
+ getModelPreferences().setValue(CommonEncodingPreferenceNames.INPUT_CODESET, fInputEncodingSettings.getIANATag());
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#createContentsForCreatingGroup(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createContentsForCreatingGroup(Composite parent) {
+ Group creatingGroup = createGroup(parent, 2);
+ creatingGroup.setText(org.eclipse.wst.sse.ui.nls.ResourceHandler.getString("Creating_files")); //$NON-NLS-1$
+
+ // Add this suffix..
+ createLabel(creatingGroup, ResourceHandler.getString("HTMLFilesPreferencePage.1")); //$NON-NLS-1$
+ fHtmlext_Field = createTextField(creatingGroup);
+
+ // Encoding..
+ Label label = createLabel(creatingGroup, org.eclipse.wst.sse.ui.nls.ResourceHandler.getString("Encoding_desc")); //$NON-NLS-1$
+ ((GridData)label.getLayoutData()).horizontalSpan = 2;
+ fEncodingSettings = new EncodingSettings(creatingGroup);
+ ((GridData)fEncodingSettings.getLayoutData()).horizontalSpan = 2;
+
+ // Insert DOCTYPE declaration
+ fDoctype_Button = createCheckBox(creatingGroup, ResourceHandler.getString("HTMLFilesPreferencePage.2")); //$NON-NLS-1$
+ ((GridData)fDoctype_Button.getLayoutData()).horizontalSpan = 2;
+
+ // Insert GENERATOR with META tag
+ fGenerator_Button = createCheckBox(creatingGroup, ResourceHandler.getString("HTMLFilesPreferencePage.3")); //$NON-NLS-1$
+ ((GridData)fGenerator_Button.getLayoutData()).horizontalSpan = 2;
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#initializeValuesForCreatingGroup()
+ */
+ protected void initializeValuesForCreatingGroup() {
+ super.initializeValuesForCreatingGroup();
+
+ String defaultSuffix = getModelPreferences().getString(HTMLFilesPreferenceNames.DEFAULT_SUFFIX);
+ if (defaultSuffix.length() > 0) {
+ fHtmlext_Field.setText(defaultSuffix);
+ }
+
+ boolean bCheck;
+ bCheck = getModelPreferences().getBoolean(HTMLFilesPreferenceNames.GENERATE_DOCUMENT_TYPE);
+ fDoctype_Button.setSelection(bCheck);
+
+ bCheck = getModelPreferences().getBoolean(HTMLFilesPreferenceNames.GENERATE_GENERATOR);
+ fGenerator_Button.setSelection(bCheck);
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#performDefaultsForCreatingGroup()
+ */
+ protected void performDefaultsForCreatingGroup() {
+ super.performDefaultsForCreatingGroup();
+
+ fHtmlext_Field.setText(getModelPreferences().getDefaultString(HTMLFilesPreferenceNames.DEFAULT_SUFFIX));
+
+ fDoctype_Button.setSelection(getModelPreferences().getDefaultBoolean(HTMLFilesPreferenceNames.GENERATE_DOCUMENT_TYPE));
+ fGenerator_Button.setSelection(getModelPreferences().getDefaultBoolean(HTMLFilesPreferenceNames.GENERATE_GENERATOR));
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLFilesPreferencePage#storeValuesForCreatingGroup()
+ */
+ protected void storeValuesForCreatingGroup() {
+ super.storeValuesForCreatingGroup();
+
+ String str_ext = fHtmlext_Field.getText();
+ getModelPreferences().setValue(HTMLFilesPreferenceNames.DEFAULT_SUFFIX, str_ext);
+
+ getModelPreferences().setValue(HTMLFilesPreferenceNames.GENERATE_DOCUMENT_TYPE, fDoctype_Button.getSelection());
+
+ getModelPreferences().setValue(HTMLFilesPreferenceNames.GENERATE_GENERATOR, fGenerator_Button.getSelection());
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLSourcePreferencePage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLSourcePreferencePage.java
new file mode 100644
index 0000000000..35fbea7fe2
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLSourcePreferencePage.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.preferences.ui;
+
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.core.HTMLCorePlugin;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.sse.ui.nls.ResourceHandler;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.xml.ui.preferences.XMLSourcePreferencePage;
+
+public class HTMLSourcePreferencePage extends XMLSourcePreferencePage {
+
+ protected Button fTagNameAsIs = null;
+ protected Button fTagNameUpper = null;
+ protected Button fTagNameLower = null;
+ protected Button fAttrNameAsIs = null;
+ protected Button fAttrNameUpper = null;
+ protected Button fAttrNameLower = null;
+
+ protected void createContentsForGrammarConstraintsGroup(Composite parent) {
+ // do nothing
+ }
+
+ protected void performDefaultsForGrammarConstraintsGroup() {
+ // do nothing
+ }
+
+ protected void initializeValuesForGrammarConstraintsGroup() {
+ // do nothing
+ }
+
+ protected void storeValuesForGrammarConstraintsGroup() {
+ // do nothing
+ }
+
+ protected void createContentsForContentAssistGroup(Composite parent) {
+ super.createContentsForContentAssistGroup(parent);
+
+ // add one more group of preferences
+ createContentsForPreferredCaseGroup(parent, 2);
+ }
+
+ protected Composite createContentsForPreferredCaseGroup(Composite parent, int columnSpan) {
+ Group caseGroup = createGroup(parent, columnSpan);
+ caseGroup.setText(ResourceHandler.getString("Preferred_markup_case_UI_")); //$NON-NLS-1$ = "Preferred markup case"
+
+ // d257064 need to associate group w/ radio buttons so radio buttons header can be read
+ Group tagNameGroup = createGroup(caseGroup, 1);
+ tagNameGroup.setText(ResourceHandler.getString("Tag_names__UI_")); //$NON-NLS-1$ = "Tag names:"
+ fTagNameUpper = createRadioButton(tagNameGroup, ResourceHandler.getString("Tag_names_Upper_case_UI_")); //$NON-NLS-1$ = "&Upper case"
+ fTagNameLower = createRadioButton(tagNameGroup, ResourceHandler.getString("Tag_names_Lower_case_UI_")); //$NON-NLS-1$ = "&Lower case"
+
+ // d257064 need to associate group w/ radio buttons so radio buttons header can be read
+ Group attrNameGroup = createGroup(caseGroup, 1);
+ attrNameGroup.setText(ResourceHandler.getString("Attribute_names__UI_")); //$NON-NLS-1$ = "Attribute names:"
+ fAttrNameUpper = createRadioButton(attrNameGroup, ResourceHandler.getString("Attribute_names_Upper_case_UI_")); //$NON-NLS-1$ = "U&pper case"
+ fAttrNameLower = createRadioButton(attrNameGroup, ResourceHandler.getString("Attribute_names_Lower_case_UI_")); //$NON-NLS-1$ = "L&ower case"
+
+ return parent;
+
+ }
+
+ protected void performDefaults() {
+ fTagNameUpper.setSelection(getModelPreferences().getDefaultInt(CommonModelPreferenceNames.TAG_NAME_CASE) == CommonModelPreferenceNames.UPPER);
+ fTagNameLower.setSelection(getModelPreferences().getDefaultInt(CommonModelPreferenceNames.TAG_NAME_CASE) == CommonModelPreferenceNames.LOWER);
+ fAttrNameUpper.setSelection(getModelPreferences().getDefaultInt(CommonModelPreferenceNames.ATTR_NAME_CASE) == CommonModelPreferenceNames.UPPER);
+ fAttrNameLower.setSelection(getModelPreferences().getDefaultInt(CommonModelPreferenceNames.ATTR_NAME_CASE) == CommonModelPreferenceNames.LOWER);
+
+ super.performDefaults();
+ }
+
+ protected void initializeValues() {
+ fTagNameUpper.setSelection(getModelPreferences().getInt(CommonModelPreferenceNames.TAG_NAME_CASE) == CommonModelPreferenceNames.UPPER);
+ fTagNameLower.setSelection(getModelPreferences().getInt(CommonModelPreferenceNames.TAG_NAME_CASE) == CommonModelPreferenceNames.LOWER);
+ fAttrNameUpper.setSelection(getModelPreferences().getInt(CommonModelPreferenceNames.ATTR_NAME_CASE) == CommonModelPreferenceNames.UPPER);
+ fAttrNameLower.setSelection(getModelPreferences().getInt(CommonModelPreferenceNames.ATTR_NAME_CASE) == CommonModelPreferenceNames.LOWER);
+
+ super.initializeValues();
+ }
+
+ protected void storeValues() {
+ if (fTagNameUpper.getSelection())
+ getModelPreferences().setValue(CommonModelPreferenceNames.TAG_NAME_CASE, CommonModelPreferenceNames.UPPER);
+ else
+ getModelPreferences().setValue(CommonModelPreferenceNames.TAG_NAME_CASE, CommonModelPreferenceNames.LOWER);
+ if (fAttrNameUpper.getSelection())
+ getModelPreferences().setValue(CommonModelPreferenceNames.ATTR_NAME_CASE, CommonModelPreferenceNames.UPPER);
+ else
+ getModelPreferences().setValue(CommonModelPreferenceNames.ATTR_NAME_CASE, CommonModelPreferenceNames.LOWER);
+
+ super.storeValues();
+ }
+
+ public boolean performOk() {
+ boolean result = super.performOk();
+
+ doSavePreferenceStore();
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.preferences.ui.xml.XMLSourcePreferencePage#getModelPreferences()
+ */
+ protected Preferences getModelPreferences() {
+ return HTMLCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.preferences.ui.XMLSourcePreferencePage#getKey(java.lang.String)
+ */
+ protected String getKey(String key) {
+ String contentTypeId = IContentTypeIdentifier.ContentTypeID_HTML;
+ return PreferenceKeyGenerator.generateKey(key, contentTypeId);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ WorkbenchHelp.setHelp(c, IHelpContextIds.HTML_PREFWEBX_SOURCE_HELPID);
+ return c;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLTemplatePreferencePage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLTemplatePreferencePage.java
new file mode 100644
index 0000000000..509916a4f3
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/preferences/ui/HTMLTemplatePreferencePage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.preferences.ui;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
+import org.eclipse.wst.html.ui.HTMLEditorPlugin;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+
+
+/**
+ * Preference page for HTML templates
+ */
+public class HTMLTemplatePreferencePage extends TemplatePreferencePage {
+
+ public HTMLTemplatePreferencePage() {
+ HTMLEditorPlugin htmlEditorPlugin = (HTMLEditorPlugin) Platform.getPlugin(HTMLEditorPlugin.ID);
+
+ setPreferenceStore(htmlEditorPlugin.getPreferenceStore());
+ setTemplateStore(htmlEditorPlugin.getTemplateStore());
+ setContextTypeRegistry(htmlEditorPlugin.getTemplateContextRegistry());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ boolean ok = super.performOk();
+ Platform.getPlugin(HTMLEditorPlugin.ID).savePluginPreferences();
+ return ok;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#isShowFormatterSetting()
+ */
+ protected boolean isShowFormatterSetting() {
+ // template formatting has not been implemented
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite ancestor) {
+ Control c = super.createContents(ancestor);
+ WorkbenchHelp.setHelp(c, IHelpContextIds.HTML_PREFWEBX_TEMPLATES_HELPID);
+ return c;
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForEmbeddedHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForEmbeddedHTML.java
new file mode 100644
index 0000000000..910c2e2071
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForEmbeddedHTML.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.registry;
+
+import org.eclipse.wst.html.core.modelhandler.EmbeddedHTML;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.modelhandler.EmbeddedTypeHandler;
+import org.eclipse.wst.sse.ui.registry.embedded.EmbeddedAdapterFactoryProvider;
+
+public class AdapterFactoryProviderForEmbeddedHTML implements EmbeddedAdapterFactoryProvider {
+
+ /*
+ * @see AdapterFactoryProvider#addAdapterFactories(IStructuredModel)
+ */
+ public void addAdapterFactories(IStructuredModel structuredModel) {
+ // if (structuredModel instanceof XMLModel) {
+ // XMLDocument doc = ((XMLModel) structuredModel).getDocument();
+ // }
+ }
+
+ /*
+ * @see AdapterFactoryProvider#isFor(ContentTypeDescription)
+ */
+ public boolean isFor(EmbeddedTypeHandler contentTypeDescription) {
+ return (contentTypeDescription instanceof EmbeddedHTML);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForHTML.java
new file mode 100644
index 0000000000..fa3530532a
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/registry/AdapterFactoryProviderForHTML.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.registry;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.wst.html.core.modelhandler.ModelHandlerForHTML;
+import org.eclipse.wst.html.ui.views.contentoutline.JFaceNodeAdapterFactoryForHTML;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.IFactoryRegistry;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.modelhandler.IDocumentTypeHandler;
+import org.eclipse.wst.sse.ui.registry.AdapterFactoryProvider;
+import org.eclipse.wst.sse.ui.util.Assert;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapter;
+import org.eclipse.wst.xml.core.document.XMLModel;
+import org.eclipse.wst.xml.ui.views.properties.XMLPropertySourceAdapterFactory;
+
+/**
+ *
+ */
+public class AdapterFactoryProviderForHTML implements AdapterFactoryProvider {
+
+ /*
+ * @see AdapterFactoryProvider#addAdapterFactories(IStructuredModel)
+ */
+ public void addAdapterFactories(IStructuredModel structuredModel) {
+
+ // these are the normal edit side content based factories
+ addContentBasedFactories(structuredModel);
+ // ===
+ // Must update/add to propagating adapter here too
+ if (structuredModel instanceof XMLModel) {
+ addPropagatingAdapters(structuredModel);
+ }
+ // ===
+ }
+
+ protected void addContentBasedFactories(IStructuredModel structuredModel) {
+
+ IFactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
+ Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$
+ AdapterFactory factory = null;
+ // == this list came from the previous "HTML only" list
+ // factory = factoryRegistry.getFactoryFor(ContentAssistAdapter.class);
+
+ // Doc Partion change: no more adapter factories for edit side functions
+
+ // if (factory == null) {
+ // factory = new HTMLContentAssistAdapterFactory();
+ // factoryRegistry.addFactory(factory);
+ // }
+
+ // factory = factoryRegistry.getFactoryFor(DoubleClickAdapter.class);
+ // if (factory == null) {
+ // factory = new DoubleClickAdapterFactory(DoubleClickAdapter.class, true);
+ // factoryRegistry.addFactory(factory);
+ // }
+ // // == New adapter factories for tagInfo
+ // factory = factoryRegistry.getFactoryFor(HoverHelpAdapter.class);
+ // if (factory == null) {
+ // factory = new HTMLHoverHelpAdapterFactory(HoverHelpAdapter.class, true);
+ // factoryRegistry.addFactory(factory);
+ // }
+ // factory = factoryRegistry.getFactoryFor(TagInfoProviderAdapter.class);
+ // if (factory == null) {
+ // factory = new JSTagInfoProviderAdapterFactory(TagInfoProviderAdapter.class, true);
+ // factoryRegistry.addFactory(factory);
+ // }
+ // ==
+ // == this list came from the previous 'for both XML and HTML' list
+ factory = factoryRegistry.getFactoryFor(IPropertySource.class);
+ if (factory == null) {
+ factory = new XMLPropertySourceAdapterFactory();
+ factoryRegistry.addFactory(factory);
+ }
+ factory = factoryRegistry.getFactoryFor(IJFaceNodeAdapter.class);
+ if (factory == null) {
+ factory = new JFaceNodeAdapterFactoryForHTML();
+ factoryRegistry.addFactory(factory);
+ }
+ // factory = factoryRegistry.getFactoryFor(com.ibm.sed.edit.adapters.LineStyleProvider.class);
+ // if (factory == null) {
+ // factory = new LineStyleProviderFactoryForHTML();
+ // factoryRegistry.addFactory(factory);
+ // }
+
+ // factory = factoryRegistry.getFactoryFor(ReconcilerAdapter.class);
+ // if (factory == null) {
+ // // can't use Propagating system since the Node tree is already built by now
+ // ReconcilerAdapterFactoryForXML reconcilerFactory = new ReconcilerAdapterFactoryForXML();
+ // factoryRegistry.addFactory(reconcilerFactory);
+ // reconcilerFactory.adaptAll((XMLModel) structuredModel);
+ // }
+ }
+
+ protected void addPropagatingAdapters(IStructuredModel structuredModel) {
+// XMLModel xmlModel = (XMLModel) structuredModel;
+// XMLDocument document = xmlModel.getDocument();
+// PropagatingAdapter propagatingAdapter = (PropagatingAdapter) document.getAdapterFor(PropagatingAdapter.class);
+// if (propagatingAdapter != null) {
+ // no longer needs?
+ // factory = new HTMLLineStyeUpdaterFactory();
+ // propagatingAdapter.addAdaptOnCreateFactory(factory);
+ // propagatingAdapter.initializeForFactory(factory, document);
+
+ // checking if we should bother adding this factory
+ // if the preference says not to check validity, we don't bother creating this factory
+ // to improve performance...
+ //if(structuredModel.getStructuredPreferenceStore().getPreferenceString(CommonPreferenceNames.EDITOR_VALIDATION_METHOD).equals(CommonPreferenceNames.EDITOR_VALIDATION_CONTENT_MODEL)) {
+ //factory = new ReconcilerAdapterFactoryForXML();
+ //propagatingAdapter.addAdaptOnCreateFactory(factory);
+ // (pa) perf:
+ //propagatingAdapter.initializeForFactory(factory, xmlModel.getDocument());
+ //}
+
+// }
+ }
+
+ /*
+ * @see AdapterFactoryProvider#isFor(ContentTypeDescription)
+ */
+ public boolean isFor(IDocumentTypeHandler contentTypeDescription) {
+ return (contentTypeDescription instanceof ModelHandlerForHTML);
+ }
+
+ public void reinitializeFactories(IStructuredModel structuredModel) {
+ // nothing to do, since no embedded type
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/IStyleConstantsHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/IStyleConstantsHTML.java
new file mode 100644
index 0000000000..d0df826f56
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/IStyleConstantsHTML.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.style;
+
+import org.eclipse.wst.xml.ui.style.IStyleConstantsXML;
+
+/**
+ * Contains the symbolic name of styles used by LineStyleProvider, ColorManager, and
+ * any others who may be interested
+ */
+public interface IStyleConstantsHTML extends IStyleConstantsXML {
+ public static final String SCRIPT_AREA_BORDER = "SCRIPT_AREA_BORDER";//$NON-NLS-1$
+ public static final String SCRIPT_AREA = "SCRIPT_AREA";//$NON-NLS-1$
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/LineStyleProviderForHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/LineStyleProviderForHTML.java
new file mode 100644
index 0000000000..a1d4e5445e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/style/LineStyleProviderForHTML.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.style;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.sse.core.text.ITextRegion;
+import org.eclipse.wst.sse.ui.preferences.PreferenceKeyGenerator;
+import org.eclipse.wst.sse.ui.style.LineStyleProvider;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+import org.eclipse.wst.xml.ui.style.IStyleConstantsXML;
+import org.eclipse.wst.xml.ui.style.LineStyleProviderForXML;
+
+public class LineStyleProviderForHTML extends LineStyleProviderForXML implements LineStyleProvider {
+
+ public LineStyleProviderForHTML() {
+ super();
+ }
+
+ /**
+ * a method to centralize all the "format rules" for regions
+ * specifically associated for how to "open" the region.
+ */
+ // NOTE: this method was just copied down form LineStyleProviderForXML
+ public TextAttribute getAttributeFor(ITextRegion region) {
+ // not sure why this is coming through null, but just to catch it
+ if (region == null) {
+ return (TextAttribute)getTextAttributes().get(IStyleConstantsXML.XML_CONTENT);
+ }
+ if (region.getType() == XMLRegionContext.BLOCK_TEXT) {
+ return (TextAttribute)getTextAttributes().get(IStyleConstantsXML.XML_CONTENT);
+ }
+ // first try "standard" tag attributes from super class
+ TextAttribute result = super.getAttributeFor(region);
+ if (result == null) {
+ // the HTML adapter is used for *embedded* JSP code,
+ // so the HTML adapter can decide whether to treat
+ // as HTML, or as JSP code. By *embedded* when mean when
+ // it is postioned as something other than content (e.g. an
+ // attribute value)
+ // String type = region.getType();
+ // if ((type == XMLJSPRegionContexts.JSP_SCRIPTLET_OPEN) // || (type == XMLJSPRegionContexts.JSP_DECLARATION_OPEN)
+ // || (type == XMLJSPRegionContexts.JSP_EXPRESSION_OPEN) // || (type == XMLJSPRegionContexts.JSP_DIRECTIVE_OPEN)
+ // // || (type == XMLJSPRegionContexts.JSP_DIRECTIVE_CLOSE)
+ // || (type == XMLJSPRegionContexts.JSP_CLOSE)) {
+ // result = fStructuredTextColors.SCRIPT_AREA_BORDER;
+ // } else
+ // // Nitin: do you recall why these were put here? from their name, sounds like
+ // // they should be in "XML one"?
+ // if ((type == XMLRegionContext.XML_TAG_ATTRIBUTE_VALUE_DQUOTE) || (type == XMLRegionContext.XML_TAG_ATTRIBUTE_VALUE_SQUOTE)) {
+ // result = fStructuredTextColors.RTF_TAG_ATTRIBUTE_VALUE;
+ // }
+
+ }
+ return result;
+ }
+
+ protected String getPreferenceKey(String key) {
+ String contentTypeId = IContentTypeIdentifier.ContentTypeID_HTML;
+ return PreferenceKeyGenerator.generateKey(key, contentTypeId);
+ }
+
+ protected void loadColors() {
+ super.loadColors();
+
+ addTextAttribute(IStyleConstantsHTML.SCRIPT_AREA_BORDER);
+ }
+
+
+ protected void handlePropertyChange(PropertyChangeEvent event) {
+ if (event != null) {
+ String prefKey = event.getProperty();
+ // check if preference changed is a style preference
+ if (getPreferenceKey(IStyleConstantsHTML.SCRIPT_AREA_BORDER).equals(prefKey)) {
+ addTextAttribute(IStyleConstantsHTML.SCRIPT_AREA_BORDER);
+
+ // this is what AbstractLineStyleProvider.propertyChange() does
+ getHighlighter().refreshDisplay();
+ } else {
+ super.handlePropertyChange(event);
+ }
+ } else {
+ super.handlePropertyChange(event);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLBestMatchHoverProcessor.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLBestMatchHoverProcessor.java
new file mode 100644
index 0000000000..6437dff225
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLBestMatchHoverProcessor.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.taginfo;
+
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.wst.sse.ui.taginfo.AbstractBestMatchHoverProcessor;
+
+/**
+ * Provides the best html hover help documentation (by using other hover help processors)
+ * Priority of hover help processors is:
+ * ProblemHoverProcessor, HTMLTagInfoHoverProcessor, AnnotationHoverProcessor
+ */
+public class HTMLBestMatchHoverProcessor extends AbstractBestMatchHoverProcessor {
+ HTMLTagInfoHoverProcessor fTagInfoHover;
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.structured.taginfo.AbstractBestMatchHoverProcessor#getTagInfoHover()
+ */
+ protected ITextHover getTagInfoHover() {
+ if (fTagInfoHover == null) {
+ fTagInfoHover = new HTMLTagInfoHoverProcessor();
+ }
+ return fTagInfoHover;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLInformationProvider.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLInformationProvider.java
new file mode 100644
index 0000000000..8f78ff2eb7
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLInformationProvider.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.taginfo;
+
+
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.information.IInformationProvider;
+import org.eclipse.jface.text.information.IInformationProviderExtension;
+
+/**
+ * Provides context information for HTML tags (Shows tooltip description)
+ *
+ * @author amywu
+ */
+public class HTMLInformationProvider implements IInformationProvider, IInformationProviderExtension {
+
+ private HTMLBestMatchHoverProcessor fTextHover = null;
+
+ public HTMLInformationProvider() {
+ fTextHover = new HTMLBestMatchHoverProcessor();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IRegion getSubject(ITextViewer textViewer, int offset) {
+ return fTextHover.getHoverRegion(textViewer, offset);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ public String getInformation(ITextViewer textViewer, IRegion subject) {
+ return (String)getInformation2(textViewer, subject);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ public Object getInformation2(ITextViewer textViewer, IRegion subject) {
+ return fTextHover.getHoverInfo(textViewer, subject);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLTagInfoHoverProcessor.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLTagInfoHoverProcessor.java
new file mode 100644
index 0000000000..7633baaa03
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/taginfo/HTMLTagInfoHoverProcessor.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.taginfo;
+
+
+
+import org.eclipse.wst.xml.ui.taginfo.XMLTagInfoHoverProcessor;
+
+/**
+ * Provides hover help documentation for HTML tags
+ *
+ * @author amywu
+ */
+public class HTMLTagInfoHoverProcessor extends XMLTagInfoHoverProcessor {
+ // currently empty because XMLTagInfoHoverProcessor handles all cases relevant to HTML
+ public HTMLTagInfoHoverProcessor() {
+ super();
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTML.java
new file mode 100644
index 0000000000..a06a0377e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTML.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.templates;
+
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.xml.ui.templates.TemplateContextTypeIds;
+import org.eclipse.wst.xml.ui.templates.TemplateContextTypeXML;
+
+
+/**
+ * Base class for HTML template context types. Templates of this context
+ * type apply to any place within HTML content type.
+ */
+public class TemplateContextTypeHTML extends TemplateContextTypeXML {
+ public static final String HTML_PREFIX = "html_"; //$NON-NLS-1$
+
+ public TemplateContextTypeHTML() {
+ this(generateContextTypeId(TemplateContextTypeIds.ALL), ResourceHandler.getString("TemplateContextTypeHTML.0")); //$NON-NLS-1$
+ }
+
+ /**
+ * @param id
+ */
+ public TemplateContextTypeHTML(String id) {
+ this(id, null);
+ }
+
+ /**
+ * @param id
+ * @param name
+ */
+ public TemplateContextTypeHTML(String id, String name) {
+ super(id, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.templates.TemplateContextTypeXML#generateContextTypeId(java.lang.String)
+ */
+ public static String generateContextTypeId(String base_contextTypeId) {
+ return HTML_PREFIX+base_contextTypeId;
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttribute.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttribute.java
new file mode 100644
index 0000000000..1ad10c7050
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttribute.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.templates;
+
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.xml.ui.templates.TemplateContextTypeIds;
+
+
+
+/**
+ * Templates of this context type apply to any attributes within HTML content type.
+ */
+public class TemplateContextTypeHTMLAttribute extends TemplateContextTypeHTML {
+
+ public TemplateContextTypeHTMLAttribute() {
+ super(generateContextTypeId(TemplateContextTypeIds.ATTRIBUTE), ResourceHandler.getString("TemplateContextTypeHTMLAttribute.0")); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttributeValue.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttributeValue.java
new file mode 100644
index 0000000000..33f1ecb949
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLAttributeValue.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.templates;
+
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.xml.ui.templates.TemplateContextTypeIds;
+
+
+/**
+ * Templates of this context type apply to any attribute values
+ * within HTML content type.
+ */
+public class TemplateContextTypeHTMLAttributeValue extends TemplateContextTypeHTML {
+
+ public TemplateContextTypeHTMLAttributeValue() {
+ super(generateContextTypeId(TemplateContextTypeIds.ATTRIBUTEVALUE), ResourceHandler.getString("TemplateContextTypeHTMLAttributeValue.0")); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLTag.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLTag.java
new file mode 100644
index 0000000000..ee62385096
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/templates/TemplateContextTypeHTMLTag.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.templates;
+
+import org.eclipse.wst.html.ui.internal.nls.ResourceHandler;
+import org.eclipse.wst.xml.ui.templates.TemplateContextTypeIds;
+
+
+/**
+ * Templates of this context type apply to any tags within HTML content type.
+ */
+public class TemplateContextTypeHTMLTag extends TemplateContextTypeHTML {
+
+ public TemplateContextTypeHTMLTag() {
+ super(generateContextTypeId(TemplateContextTypeIds.TAG), ResourceHandler.getString("TemplateContextTypeHTMLTag.0")); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/text/HTMLDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/text/HTMLDocumentRegionEdgeMatcher.java
new file mode 100644
index 0000000000..4507f4304d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/text/HTMLDocumentRegionEdgeMatcher.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.text;
+
+import org.eclipse.jdt.internal.ui.text.JavaPairMatcher;
+import org.eclipse.wst.sse.ui.text.DocumentRegionEdgeMatcher;
+import org.eclipse.wst.xml.core.parser.XMLRegionContext;
+
+public class HTMLDocumentRegionEdgeMatcher extends DocumentRegionEdgeMatcher {
+
+ protected final static char[] BRACKETS = {'{', '}', '(', ')', '[', ']'};
+
+ /**
+ * @param validContexts
+ * @param nextMatcher
+ */
+ public HTMLDocumentRegionEdgeMatcher() {
+ super(new String[]{XMLRegionContext.XML_TAG_NAME, XMLRegionContext.XML_COMMENT_TEXT, XMLRegionContext.XML_CDATA_TEXT, XMLRegionContext.XML_PI_OPEN, XMLRegionContext.XML_PI_CONTENT}, new JavaPairMatcher(BRACKETS));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java
new file mode 100644
index 0000000000..0df237a563
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.views.contentoutline;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration;
+import org.eclipse.wst.xml.ui.views.contentoutline.XMLNodeActionManager;
+
+public class HTMLContentOutlineConfiguration extends XMLContentOutlineConfiguration {
+
+ /**
+ * @param editor
+ */
+ public HTMLContentOutlineConfiguration() {
+ super();
+ }
+
+ /**
+ * @see com.ibm.sse.editor.xml.views.contentoutline.XMLContentOutlineConfiguration#createNodeActionManager(org.eclipse.jface.viewers.TreeViewer)
+ */
+ protected XMLNodeActionManager createNodeActionManager(TreeViewer treeViewer) {
+ return new HTMLNodeActionManager(getEditor().getModel(), treeViewer);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLNodeActionManager.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLNodeActionManager.java
new file mode 100644
index 0000000000..c35883d375
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLNodeActionManager.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.views.contentoutline;
+
+
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.common.contentmodel.CMNode;
+import org.eclipse.wst.common.contentmodel.util.DOMContentBuilder;
+import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.eclipse.wst.html.core.HTMLCMProperties;
+import org.eclipse.wst.html.core.PreferenceNames;
+import org.eclipse.wst.html.core.format.HTMLFormatProcessorImpl;
+import org.eclipse.wst.html.core.preferences.HTMLContentBuilder;
+import org.eclipse.wst.sse.core.IStructuredModel;
+import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
+import org.eclipse.wst.sse.core.preferences.CommonModelPreferenceNames;
+import org.eclipse.wst.xml.ui.views.contentoutline.XMLNodeActionManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class HTMLNodeActionManager extends XMLNodeActionManager {
+ protected String fTagCase;
+ protected String fAttrCase;
+
+ public HTMLNodeActionManager(IStructuredModel model, Viewer viewer) {
+ super(model, viewer);
+ updateCase();
+ }
+
+ /**
+ * If neccessary, employ a DOMContentBuilder that understands how to
+ * change the case of HTML tags (but NOT taglib derived tags).
+ */
+ public DOMContentBuilder createDOMContentBuilder(Document document) {
+ DOMContentBuilder builder = null;
+ if (model.getModelHandler().getId().equals(IContentTypeIdentifier.ContentTypeID_HTML))
+ builder = new HTMLContentBuilder(document);
+ else
+ builder = super.createDOMContentBuilder(document);
+
+ return builder;
+ }
+
+ private boolean shouldIgnoreCase(CMNode cmnode) {
+ if (!cmnode.supports(HTMLCMProperties.SHOULD_IGNORE_CASE))
+ return false;
+ return ((Boolean) cmnode.getProperty(HTMLCMProperties.SHOULD_IGNORE_CASE)).booleanValue();
+ }
+
+ /**
+ * Modify the displayed menuitem label to change the case of HTML children
+ * but neither XML nor taglib-derived children.
+ */
+ public String getLabel(Node parent, CMNode cmnode) {
+ String result = null;
+ //CMNode cmnode = action.getCMNode();
+ // don't change the case unless we're certain it is meaningless
+ if (shouldIgnoreCase(cmnode)) {
+ String name = cmnode.getNodeName();
+ if (cmnode.getNodeType() == CMNode.ELEMENT_DECLARATION) {
+ if (fTagCase.length() > 0) {
+ if (fTagCase.equals(PreferenceNames.LOWER))
+ name = name.toLowerCase();
+ else if (fTagCase.equals(PreferenceNames.UPPER))
+ name = name.toUpperCase();
+ // else do nothing
+ }
+ }
+ else if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
+ if (fAttrCase.length() > 0) {
+ if (fAttrCase.equals(PreferenceNames.LOWER))
+ name = name.toLowerCase();
+ else if (fAttrCase.equals(PreferenceNames.UPPER))
+ name = name.toUpperCase();
+ // else do nothing
+ }
+ }
+ result = name;
+ }
+ else {
+ result = super.getLabel(parent, cmnode);
+ }
+
+ return result;
+ }
+
+ /**
+ * Another HTML specific detail.
+ */
+ protected void updateCase() {
+ if (model.getModelHandler().getAssociatedContentTypeId().equals(IContentTypeIdentifier.ContentTypeID_HTML)) {
+ Preferences prefs = Platform.getPlugin("com.ibm.sse.model.html").getPluginPreferences(); //$NON-NLS-1$
+ fTagCase = prefs.getString(CommonModelPreferenceNames.TAG_NAME_CASE);
+ fAttrCase = prefs.getString(CommonModelPreferenceNames.ATTR_NAME_CASE);
+ // Element caseSettings = HTMLPreferenceManager.getHTMLInstance().getElement(PreferenceNames.PREFERRED_CASE);
+ // fTagCase = caseSettings.getAttribute(PreferenceNames.TAGNAME);
+ // fAttrCase = caseSettings.getAttribute(PreferenceNames.ATTRIBUTENAME);
+ }
+ else {
+ fTagCase = "";//$NON-NLS-1$
+ fAttrCase = "";//$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.ibm.sse.editor.xml.ui.actions.AbstractNodeActionManager#reformat(org.w3c.dom.Node, boolean)
+ */
+ public void reformat(Node newElement, boolean deep) {
+ try {
+ // tell the model that we are about to make a big model change
+ model.aboutToChangeModel();
+
+ // format selected node
+ IStructuredFormatProcessor formatProcessor = new HTMLFormatProcessorImpl();
+ formatProcessor.formatNode(newElement);
+ }
+ finally {
+ // tell the model that we are done with the big model change
+ model.changedModel();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterFactoryForHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterFactoryForHTML.java
new file mode 100644
index 0000000000..22c2483321
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterFactoryForHTML.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.views.contentoutline;
+
+
+
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.sse.core.INodeAdapter;
+import org.eclipse.wst.sse.core.INodeNotifier;
+import org.eclipse.wst.sse.ui.views.contentoutline.IJFaceNodeAdapter;
+import org.eclipse.wst.xml.ui.views.contentoutline.JFaceNodeAdapterFactory;
+
+/**
+ * An adapter factory to create JFaceNodeAdapters. Use this
+ * adapter factory with a JFaceAdapterContentProvider to display
+ * DOM nodes in a tree.
+ */
+public class JFaceNodeAdapterFactoryForHTML extends JFaceNodeAdapterFactory {
+
+
+ public JFaceNodeAdapterFactoryForHTML() {
+ this(IJFaceNodeAdapter.class, true);
+ }
+
+ public JFaceNodeAdapterFactoryForHTML(Object adapterKey, boolean registerAdapters) {
+ super(adapterKey, registerAdapters);
+ }
+
+ protected INodeAdapter createAdapter(INodeNotifier node) {
+ if (singletonAdapter == null) {
+ // create the JFaceNodeAdapter
+ singletonAdapter = new JFaceNodeAdapterForHTML(this);
+ initAdapter(singletonAdapter, node);
+ }
+ return singletonAdapter;
+ }
+
+ public AdapterFactory copy() {
+ return new JFaceNodeAdapterFactoryForHTML(this.adapterKey, this.shouldRegisterAdapter);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterForHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterForHTML.java
new file mode 100644
index 0000000000..1dc777e615
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/JFaceNodeAdapterForHTML.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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.wst.html.ui.views.contentoutline;
+
+
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.html.core.HTML40Namespace;
+import org.eclipse.wst.html.ui.internal.editor.HTMLEditorPluginImageHelper;
+import org.eclipse.wst.html.ui.internal.editor.HTMLEditorPluginImages;
+import org.eclipse.wst.sse.core.AdapterFactory;
+import org.eclipse.wst.xml.ui.views.contentoutline.JFaceNodeAdapter;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Adapts a DOM node to a JFace viewer.
+ */
+public class JFaceNodeAdapterForHTML extends JFaceNodeAdapter {
+
+ private Image createHTMLImage(String imageResourceName) {
+ ImageDescriptor imageDescriptor = HTMLEditorPluginImageHelper.getInstance().getImageDescriptor(imageResourceName);
+ if (imageDescriptor != null)
+ return imageDescriptor.createImage();
+ return null;
+ }
+
+ /**
+ * Constructor for JFaceNodeAdapterForHTML.
+ * @param adapterFactory
+ */
+ public JFaceNodeAdapterForHTML(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ protected Image createImage(Node node) {
+ Image image = null;
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ if (node.getNodeName().equalsIgnoreCase("table")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TABLE);
+ else if (node.getNodeName().equalsIgnoreCase("a")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_ANCHOR);
+ else if (node.getNodeName().equalsIgnoreCase("body")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_BODY);
+ else if (node.getNodeName().equalsIgnoreCase("button")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_BUTTON);
+ else if (node.getNodeName().equalsIgnoreCase("font")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_FONT);
+ else if (node.getNodeName().equalsIgnoreCase("form")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_FORM);
+ else if (node.getNodeName().equalsIgnoreCase("html")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_HTML);
+ else if (node.getNodeName().equalsIgnoreCase("img")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_IMAGE);
+ else if (node.getNodeName().equalsIgnoreCase("map")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_IMAGE_MAP);
+ else if (node.getNodeName().equalsIgnoreCase("title")) //$NON-NLS-1$
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG_TITLE);
+ else
+ image = createHTMLImage(HTMLEditorPluginImages.IMG_OBJ_TAG);
+ }
+ if (image == null) {
+ image = super.createImage(node);
+ }
+ return image;
+ }
+
+ /*
+ * @see IJFaceNodeAdapter#getLabelText(Node)
+ */
+ public String getLabelText(Node node) {
+ // TODO (pa) eventually showing ID, NAME, etc..might be a preference
+ // - like in the package explorer for java.. (along w/ being able to customize delimiters)
+ // - possibly for all (or filtered list of) elements
+ String text = null;
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ if (node.getNodeName().equalsIgnoreCase("table")) { //$NON-NLS-1$
+ // won't update properly as-is
+ // it will only update if you change the attr name,
+ // delete a ", or add a new element to the tree
+ text = node.getNodeName();
+
+ // get attr values
+ String tableID = null;
+ tableID = ((Element) node).getAttribute(HTML40Namespace.ATTR_NAME_ID);
+ String tableName = null;
+ tableName = ((Element) node).getAttribute(HTML40Namespace.ATTR_NAME_NAME);
+
+ // if there's ID or NAME, add a ">"
+ if ((tableID != null && tableID.length() > 0) || (tableName != null && tableName.length() > 0)) {
+ text += " > "; //$NON-NLS-1$
+ }
+
+ if (tableID != null && tableID.length() > 0)
+ text += " ID:[" + tableID + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (tableName != null && tableName.length() > 0)
+ text += " NAME:[" + tableName + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ if (text == null)
+ text = super.getLabelText(node);
+ return text;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.properties
new file mode 100644
index 0000000000..7498861ece
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=comment
+Templates.comment.desc=comment
+Templates.ul.name=ul
+Templates.ul.desc=ul (template)
+Templates.ul.content=<ul>\n <li> Item one </li>\n <li> Item two </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (template)
+Templates.dl.content=<dl>\n <dt> First definition <dd> First explanation\n <dt> Second definition <dd> Second explanation\n</dl>\n
+Templates.table.name=table
+Templates.table.desc=table (template)
+Templates.table.content=<table border>\n <tr>\n <th>Column 1 Heading</th>\n <th>Column 2 Heading</th>\n </tr>\n <tr>\n <td>Row 1: Col 1</td>\n <td>Row 1: Col 2</td>\n </tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (template)
+Templates.ol.content=<ol>\n <li> Item one </li>\n <li> Item two </li>\n</ol>\n
+Templates.html.name=html
+Templates.html.desc=html (template)
+Templates.html.content=<html>\n<head>\n<title>Insert title here</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=script (commented)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=style
+Templates.style.desc=style (commented)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (map) \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.xml b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.xml
new file mode 100644
index 0000000000..7d145b2ffc
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates>
+
+<template name="%Templates.comment.name" description="%Templates.comment.desc" id="com.ibm.sse.editor.html.templates.comment" context="html_tag" enabled="true">&lt;!-- ${cursor} --&gt;</template>
+
+<template name="%Templates.imgmap.name" description="%Templates.imgmap.desc" id="com.ibm.sse.editor.html.templates.imgmap" context="html_tag" enabled="true">&lt;img ismap&gt;</template>
+
+<template name="%Templates.ul.name" description="%Templates.ul.desc" id="com.ibm.sse.editor.html.templates.ul" context="html_tag" enabled="true">%Templates.ul.content</template>
+
+<template name="%Templates.dl.name" description="%Templates.dl.desc" id="com.ibm.sse.editor.html.templates.dl" context="html_tag" enabled="true">%Templates.dl.content</template>
+
+<template name="%Templates.table.name" description="%Templates.table.desc" id="com.ibm.sse.editor.html.templates.table" context="html_tag" enabled="true">%Templates.table.content</template>
+
+<template name="%Templates.ol.name" description="%Templates.ol.desc" id="com.ibm.sse.editor.html.templates.ol" context="html_tag" enabled="true">%Templates.ol.content</template>
+
+<template name="%Templates.html.name" description="%Templates.html.desc" id="com.ibm.sse.editor.html.templates.html" context="html_tag" enabled="true">%Templates.html.content</template>
+
+<template name="%Templates.html.name" description="%Templates.html.desc" id="com.ibm.sse.editor.html.templates.html" context="html_tag" enabled="true">%Templates.html.content</template>
+
+<template name="%Templates.script.name" description="%Templates.script.desc" id="com.ibm.sse.editor.html.templates.script" context="html_tag" enabled="true">%Templates.script.content</template>
+
+<template name="%Templates.style.name" description="%Templates.style.desc" id="com.ibm.sse.editor.html.templates.style" context="html_tag" enabled="true">%Templates.style.content</template>
+
+</templates>
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_de.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_de.properties
new file mode 100644
index 0000000000..58df23f7e8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_de.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=Kommentar
+Templates.comment.desc=Kommentar
+Templates.ul.name=ul
+Templates.ul.desc=ul (Schablone)
+Templates.ul.content=<ul>\n <li> Eintrag 1</li>\n <li> Eintrag 2</li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (Schablone)
+Templates.dl.content=<dl>\n <dt> Erste Definition <dd> Erste Erl\u00e4uterung\n <dt> Zweite Definition <dd> Zweite Erl\u00e4uterung\n</dl>\n
+Templates.table.name=Tabelle
+Templates.table.desc=Tabelle (Schablone)
+Templates.table.content=<table border>\n <tr>\n <th>Spalte 1 \u00dcberschrift</th>\n <th>Spalte 2 \u00dcberschrift</th>\n </tr>\n <tr>\n <td>Zeile 1: Spalte 1</td>\n <td>Zeile 1: Spalte 2</td>\n </tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (Schablone)
+Templates.ol.content=<ol>\n <li> Eintrag 1</li>\n <li> Eintrag 2</li>\n </ol>\n
+Templates.html.name=html
+Templates.html.desc=html (Schablone)
+Templates.html.content=<html>\n<head>\n<title>Hier Titel einf\u00fcgen</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=Script
+Templates.script.desc=Script (Kommentar)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=Darstellung
+Templates.style.desc=Darstellung (Kommentar)
+Templates.style.content=<style>\n<!--\n${Cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (Abbildung)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_es.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_es.properties
new file mode 100644
index 0000000000..58a3cd638e
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_es.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=comment
+Templates.comment.desc=comment
+Templates.ul.name=ul
+Templates.ul.desc=ul (plantilla)
+Templates.ul.content=<ul>\n <li> Elemento uno </li>\n <li> Elemento dos </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (plantilla)
+Templates.dl.content=<dl>\n <dt> Primera definici\u00f3n <dd> Primera explicaci\u00f3n\n <dt> Segunda definici\u00f3n <dd> Segunda explicaci\u00f3n\n</dl>\n
+Templates.table.name=table
+Templates.table.desc=table (plantilla)
+Templates.table.content=<table border>\n <tr>\n <th>Cabecera de columna 1</th>\n <th>Cabecera de columna 2</th>\n </tr>\n <tr>\n <td>Fila 1: Col 1</td>\n <td>Fila 1: Col 2</td>\n </tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (plantilla)
+Templates.ol.content=<ol>\n <li> Elemento uno </li>\n <li> Elemento dos </li>\n</ol>\n
+Templates.html.name=html
+Templates.html.desc=html (plantilla)
+Templates.html.content=<html>\n<head>\n<title>Insertar t\u00edtulo aqu\u00ed</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=script (comentado)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=style
+Templates.style.desc=style (comentado)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (mapa)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_fr.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_fr.properties
new file mode 100644
index 0000000000..f5973262b9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_fr.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=commentaire
+Templates.comment.desc=commentaire
+Templates.ul.name=ul
+Templates.ul.desc=ul (mod\u00e8le)
+Templates.ul.content=<ul>\n <li> El\u00e9ment un </li>\n <li> El\u00e9ment deux </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (mod\u00e8le)
+Templates.dl.content=<dl>\n <dt> Premi\u00e8re d\u00e9finition <dd> Premi\u00e8re explication\n <dt> Seconde d\u00e9finition <dd> Seconde explication\n</dl>\n
+Templates.table.name=table
+Templates.table.desc=table (mod\u00e8le)
+Templates.table.content=<table border>\n <tr>\n <th>Colonne 1 En-t\u00eate</th>\n <th>Colonne 2 En-t\u00eate</th>\n </tr>\n <tr>\n <td>Ligne 1 : Col 1</td>\n <td>Ligne 1 : Col 2</td>\n </tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (mod\u00e8le)
+Templates.ol.content=<ol>\n <li> El\u00e9ment un </li>\n <li> El\u00e9ment deux </li>\n </ol>\n
+Templates.html.name=html
+Templates.html.desc=html (mod\u00e8le)
+Templates.html.content=<html>\n<head>\n<title>Ins\u00e9rer le titre ici</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=script (comment\u00e9)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=style
+Templates.style.desc=style (comment\u00e9)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (mappe)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_it.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_it.properties
new file mode 100644
index 0000000000..1e159ce6c4
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_it.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=commento
+Templates.comment.desc=commento
+Templates.ul.name=ul
+Templates.ul.desc=ul (modello)
+Templates.ul.content=<ul>\n <li> Elemento uno </li>\n <li> Elemento due </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (modello)
+Templates.dl.content=<dl>\n <dt> Prima definizione <dd> Prima spiegazione\n <dt> Seconda definizione <dd> Seconda spiegazione\n</dl>\n
+Templates.table.name=tabella
+Templates.table.desc=tabella (modello)
+Templates.table.content=<table border>\n <tr>\n <th>Intestazione colonna 1</th>\n <th>Intestazione colonna 2</th>\n </tr>\n <tr>\n <td>Riga 1: Colonna 1</td>\n <td>Riga 1: Colonna 2</td>\n </tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (modello)
+Templates.ol.content=<ol>\n <li> Elemento uno </li>\n <li> Elemento due </li>\n</ol>\n
+Templates.html.name=html
+Templates.html.desc=html (modello)
+Templates.html.content=<html>\n<head>\n<title>Inserire il titolo in questo punto</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=script (commentato)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=stile
+Templates.style.desc=stile (commentato)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (mappa)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ja.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ja.properties
new file mode 100644
index 0000000000..229ced96a1
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ja.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=\u30b3\u30e1\u30f3\u30c8
+Templates.comment.desc=\u30b3\u30e1\u30f3\u30c8
+Templates.ul.name=ul
+Templates.ul.desc=ul (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8)
+Templates.ul.content=<ul>\n <li> \u9805\u76ee 1 </li>\n <li> \u9805\u76ee 2 </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8)
+Templates.dl.content=<dl>\n <dt> 1 \u756a\u76ee\u306e\u5b9a\u7fa9 <dd> 1 \u756a\u76ee\u306e\u8aac\u660e\n <dt> 2 \u756a\u76ee\u306e\u5b9a\u7fa9 <dd> 2 \u756a\u76ee\u306e\u8aac\u660e\n</dl>\n
+Templates.table.name=table
+Templates.table.desc=\u30c6\u30fc\u30d6\u30eb (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8)
+Templates.table.content=<table border>\n <tr>\n <th>\u5217 1 \u898b\u51fa\u3057</th>\n <th>\u5217 2 \u898b\u51fa\u3057</th>\n </tr>\n <tr>\n <td>\u884c 1: \u5217 1</td>\n <td>\u884c 1: \u5217 2</td>\n </tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8)
+Templates.ol.content=<ol>\n <li> \u9805\u76ee 1 </li>\n <li> \u9805\u76ee 2 </li>\n</ol>\n
+Templates.html.name=html
+Templates.html.desc=html (\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8)
+Templates.html.content=<html>\n<head>\n<title>\u3053\u3053\u306b\u30bf\u30a4\u30c8\u30eb\u3092\u633f\u5165</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=\u30b9\u30af\u30ea\u30d7\u30c8 (\u30b3\u30e1\u30f3\u30c8)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=style
+Templates.style.desc=\u30b9\u30bf\u30a4\u30eb (\u30b3\u30e1\u30f3\u30c8)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (\u30de\u30c3\u30d7)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ko.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ko.properties
new file mode 100644
index 0000000000..c45f44b70c
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_ko.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=\uc8fc\uc11d
+Templates.comment.desc=\uc8fc\uc11d
+Templates.ul.name=ul
+Templates.ul.desc=ul (\ud15c\ud50c\ub9ac\ud2b8)
+Templates.ul.content=<ul>\n<li> \ud56d\ubaa9 1 </li>\n<li> \ud56d\ubaa9 2 </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (\ud15c\ud50c\ub9ac\ud2b8)
+Templates.dl.content=<dl>\n<dt> \uc81c1 \uc815\uc758 <dd> \uc81c1 \uc124\uba85\n<dt> \uc81c2 \uc815\uc758 <dd> \uc81c2 \uc124\uba85\n</dl>\n
+Templates.table.name=table
+Templates.table.desc=table (\ud15c\ud50c\ub9ac\ud2b8)
+Templates.table.content=<table border>\n<tr>\n<th>\uc5f4 1 \ud45c\uc81c</th>\n<th>\uc5f4 2 \ud45c\uc81c</th>\n</tr>\n<tr>\n<td>\ud589 1: \uc5f4 1</td>\n<td>\ud589 1: \uc5f4 2</td>\n</tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (\ud15c\ud50c\ub9ac\ud2b8)
+Templates.ol.content=<ol>\n<li> \ud56d\ubaa9 1 </li>\n<li> \ud56d\ubaa9 2 </li>\n</ol>\n
+Templates.html.name=html
+Templates.html.desc=html (\ud15c\ud50c\ub9ac\ud2b8)
+Templates.html.content=<html>\n<head>\n<title>\uc5ec\uae30\uc5d0 \uc81c\ubaa9 \uc0bd\uc785</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=script (\uc8fc\uc11d\ucc98\ub9ac)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=style
+Templates.style.desc=style (\uc8fc\uc11d\ucc98\ub9ac)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (\ub9f5)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_pt_BR.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_pt_BR.properties
new file mode 100644
index 0000000000..282472b2fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_pt_BR.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=coment\u00e1rio
+Templates.comment.desc=coment\u00e1rio
+Templates.ul.name=ul
+Templates.ul.desc=ul (modelo)
+Templates.ul.content=<ul>\n<li> Item um </li>\n<li> Item dois </li>\n</ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl (modelo)
+Templates.dl.content=<dl>\n<dt> Primeira defini\u00e7\u00e3o <dd> Primeira explica\u00e7\u00e3o\n<dt> Segunda defini\u00e7\u00e3o <dd> Segunda explica\u00e7\u00e3o\n</dl>\n
+Templates.table.name=tabela
+Templates.table.desc=tabela (modelo)
+Templates.table.content=<table border>\n<tr>\n<th>T\u00edtulo da Coluna 1</th>\n<th>T\u00edtulo da Coluna 2</th>\n</tr>\n <tr>\n<td>Linha 1: Col 1</td>\n<td>Linha 1: Col 2</td>\n</tr>\n</table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol (modelo)
+Templates.ol.content=<ol>\n<li> Item um </li>\n<li> Item dois </li>\n</ol>\n
+Templates.html.name=html
+Templates.html.desc=html (modelo)
+Templates.html.content=<html>\n<head>\n<title>Inserir t\u00edtulo aqui</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=script
+Templates.script.desc=script (comentado)
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=estilo
+Templates.style.desc=estilo (comentado)
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img (mapa)
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_CN.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_CN.properties
new file mode 100644
index 0000000000..0ccbd24f73
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_CN.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=\u6ce8\u91ca
+Templates.comment.desc=\u6ce8\u91ca
+Templates.ul.name=ul
+Templates.ul.desc=ul \uff08\u6a21\u677f\uff09
+Templates.ul.content=<ul>\n <li> \u7b2c\u4e00\u9879 </li>\n <li> \u7b2c\u4e8c\u9879 </li>\n </ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl \uff08\u6a21\u677f\uff09
+Templates.dl.content=<dl>\n <dt> \u7b2c\u4e00\u4e2a\u5b9a\u4e49 <dd> \u7b2c\u4e00\u4e2a\u8bf4\u660e\n <dt> \u7b2c\u4e8c\u4e2a\u5b9a\u4e49 <dd> \u7b2c\u4e8c\u4e2a\u8bf4\u660e\n </dl>\n
+Templates.table.name=\u8868
+Templates.table.desc=\u8868 \uff08\u6a21\u677f\uff09
+Templates.table.content=<table border>\n <tr>\n <th>\u7b2c 1 \u5217\u6807\u9898</th>\n <th>\u7b2c 2 \u5217\u6807\u9898</th>\n </tr>\n <tr>\n <td>\u7b2c 1 \u884c\uff1a\u7b2c 1 \u5217</td>\n <td>\u7b2c 1 \u884c\uff1a\u7b2c 2 \u5217</td>\n </tr>\n </table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol \uff08\u6a21\u677f\uff09
+Templates.ol.content=<ol>\n <li> \u7b2c\u4e00\u9879 </li>\n <li> \u7b2c\u4e8c\u9879 </li>\n </ol>\n
+Templates.html.name=html
+Templates.html.desc=html \uff08\u6a21\u677f\uff09
+Templates.html.content=<html>\n<head>\n<title>\u5728\u6b64\u5904\u63d2\u5165\u6807\u9898</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=\u811a\u672c
+Templates.script.desc=\u811a\u672c \uff08\u5df2\u52a0\u6ce8\u91ca\uff09
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=\u6837\u5f0f
+Templates.style.desc=\u6837\u5f0f \uff08\u5df2\u52a0\u6ce8\u91ca\uff09
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img \uff08\u6620\u5c04\uff09
diff --git a/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_TW.properties b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_TW.properties
new file mode 100644
index 0000000000..ff357930e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/templates/htmldefault-templates_zh_TW.properties
@@ -0,0 +1,35 @@
+###############################################################################
+# Copyright (c) 2004 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
+###############################################################################
+Templates.comment.name=\u8a3b\u89e3
+Templates.comment.desc=\u8a3b\u89e3
+Templates.ul.name=ul
+Templates.ul.desc=ul \uff08\u7bc4\u672c\uff09
+Templates.ul.content=<ul>\n <li> \u9805\u76ee 1 </li>\n <li> \u9805\u76ee 2 </li>\n </ul>\n
+Templates.dl.name=dl
+Templates.dl.desc=dl \uff08\u7bc4\u672c\uff09
+Templates.dl.content=<dl>\n <dt> \u7b2c\u4e00\u500b\u5b9a\u7fa9 <dd> \u7b2c\u4e00\u500b\u8aaa\u660e\n <dt> \u7b2c\u4e8c\u500b\u5b9a\u7fa9 <dd> \u7b2c\u4e8c\u500b\u8aaa\u660e\n </dl>\n
+Templates.table.name=table
+Templates.table.desc=table \uff08\u7bc4\u672c\uff09
+Templates.table.content=<table border>\n <tr>\n <th>\u7b2c 1 \u6b04\u6a19\u984c</th>\n <th>\u7b2c 2 \u6b04\u6a19\u984c</th>\n </tr>\n <tr>\n <td>\u5217 1\uff1a\u76f4\u6b04 1</td>\n <td>\u5217 1\uff1a\u76f4\u6b04 2</td>\n </tr>\n </table>\n
+Templates.ol.name=ol
+Templates.ol.desc=ol \uff08\u7bc4\u672c\uff09
+Templates.ol.content=<ol>\n <li> \u9805\u76ee 1 </li>\n <li> \u9805\u76ee 2 </li>\n </ol>\n
+Templates.html.name=html
+Templates.html.desc=html \uff08\u7bc4\u672c\uff09
+Templates.html.content=<html>\n<head>\n<title>\u5728\u9019\u88e1\u63d2\u5165\u6a19\u984c</title>\n</head>\n<body>\n${cursor}\n</body>\n</html>
+Templates.script.name=Script
+Templates.script.desc=script \uff08\u52a0\u8a3b\uff09
+Templates.script.content=<script type=\"${cursor}text/javascript\">\n<!--\n\n//-->\n</script>
+Templates.style.name=style
+Templates.style.desc=style \uff08\u52a0\u8a3b\uff09
+Templates.style.content=<style>\n<!--\n${cursor}\n-->\n</style>
+Templates.imgmap.name=img
+Templates.imgmap.desc=img \uff08\u5c0d\u6620\uff09

Back to the top