diff options
author | Tor Norbye <tnorbye@google.com> | 2013-08-07 11:11:08 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-08-07 11:11:08 -0700 |
commit | 6739a8f0977b70ddc8a8283b169902da3f2eecb3 (patch) | |
tree | 5c5573c2ac01544f02d9318671aa558769726289 /xml | |
parent | c1ace1f7e1e49c81bb4b75377c99f07be340abfe (diff) | |
download | idea-6739a8f0977b70ddc8a8283b169902da3f2eecb3.tar.gz |
Snapshot af729d01433bb5bbd6ca93c0fdf9778b36d624ce from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I214dd066d0d27444a26166c0eae1a5aaf3705d49
Diffstat (limited to 'xml')
123 files changed, 10700 insertions, 617 deletions
diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java index 63e594371589..17b61ba22aec 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java @@ -31,7 +31,7 @@ public class DomUsageTypeProvider implements UsageTypeProvider { @Nullable public UsageType getUsageType(PsiElement element) { final PsiFile psiFile = element.getContainingFile(); - if (XMLLanguage.INSTANCE.equals(psiFile.getLanguage()) && + if (psiFile != null && XMLLanguage.INSTANCE.equals(psiFile.getLanguage()) && DomManager.getDomManager(element.getProject()).getFileElement((XmlFile)psiFile, DomElement.class) != null) { return DOM_USAGE_TYPE; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java index d6b13e393e03..e6ef0e450433 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java @@ -26,7 +26,12 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; -import com.intellij.psi.xml.*; +import com.intellij.psi.xml.XmlAttributeValue; +import com.intellij.psi.xml.XmlElement; +import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlText; +import com.intellij.util.ArrayUtil; +import com.intellij.util.FunctionUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xml.*; import org.jetbrains.annotations.NotNull; @@ -59,7 +64,7 @@ public class DomElementProblemDescriptorImpl implements DomElementProblemDescrip public DomElementProblemDescriptorImpl(@NotNull final DomElement domElement, final String message, final HighlightSeverity type, - final LocalQuickFix... fixes) { + @NotNull LocalQuickFix... fixes) { this(domElement, message, type, null, null, fixes); } @@ -68,7 +73,7 @@ public class DomElementProblemDescriptorImpl implements DomElementProblemDescrip final HighlightSeverity type, @Nullable final TextRange textRange, ProblemHighlightType highlightType, - final LocalQuickFix... fixes) { + @NotNull LocalQuickFix... fixes) { myDomElement = domElement; final XmlElement element = domElement.getXmlElement(); if (element != null && !ApplicationManager.getApplication().isUnitTestMode()) { @@ -76,7 +81,7 @@ public class DomElementProblemDescriptorImpl implements DomElementProblemDescrip } mySeverity = type; myMessage = message; - myFixes = fixes; + myFixes = ArrayUtil.contains(null, fixes) ? ContainerUtil.mapNotNull(fixes, FunctionUtil.<LocalQuickFix>id(), LocalQuickFix.EMPTY_ARRAY) : fixes; if (textRange != null) { final PsiElement psiElement = getPsiElement(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java index f83280c85c98..a6427a417d84 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java @@ -16,7 +16,7 @@ package com.intellij.util.xml.impl; import com.intellij.diagnostic.LogMessageEx; -import com.intellij.diagnostic.errordialog.Attachment; +import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.PsiElement; import com.intellij.psi.impl.DebugUtil; diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java index eb79b6e56acc..eee6ed52e305 100644 --- a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java +++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java @@ -20,19 +20,20 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlTag; +import com.intellij.util.xml.XmlName; import com.intellij.util.xml.impl.DomInvocationHandler; import com.intellij.util.xml.impl.DomManagerImpl; import com.intellij.util.xml.reflect.DomAttributeChildDescription; -import com.intellij.util.xml.XmlName; -import com.intellij.xml.XmlAttributeDescriptor; +import com.intellij.xml.NamespaceAwareXmlAttributeDescriptor; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author mike */ -public class DomAttributeXmlDescriptor implements XmlAttributeDescriptor { +public class DomAttributeXmlDescriptor implements NamespaceAwareXmlAttributeDescriptor { private final DomAttributeChildDescription myDescription; private final Project myProject; @@ -114,6 +115,16 @@ public class DomAttributeXmlDescriptor implements XmlAttributeDescriptor { return myDescription.getXmlName().getLocalName(); } + @Nullable + public String getNamespace(@NotNull XmlTag context) { + final DomInvocationHandler handler = DomManagerImpl.getDomManager(myProject).getDomHandler(context); + + if (handler == null) { + return null; + } + return handler.createEvaluatedXmlName(myDescription.getXmlName()).getNamespace(context, handler.getFile()); + } + public void init(final PsiElement element) { throw new UnsupportedOperationException("Method init not implemented in " + getClass()); } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java index fb6829c7ab00..7b83f07041d3 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java @@ -128,7 +128,7 @@ public class DomBasicsTest extends DomTestCase { assertEquals("foo", rootElement.getValue()); } - public void testAcceptChidren() throws Throwable { + public void testAcceptChildren() throws Throwable { final MyElement element = createElement("<a><child-element/><child/><child-element/></a>"); final Set<DomElement> visited = new HashSet<DomElement>(); element.acceptChildren(new DomElementVisitor() { diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java index bed5072249bc..af533a782bdb 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java @@ -15,29 +15,55 @@ */ package com.intellij.codeInsight.completion; +import com.intellij.codeInsight.AutoPopupController; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.lang.html.HTMLLanguage; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ScrollType; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; +import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.psi.xml.XmlAttribute; +import com.intellij.psi.xml.XmlFile; +import com.intellij.psi.xml.XmlTag; +import com.intellij.util.IncorrectOperationException; import com.intellij.util.text.CharArrayUtil; +import com.intellij.xml.XmlNamespaceHelper; import com.intellij.xml.util.HtmlUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; /** * @author peter */ public class XmlAttributeInsertHandler implements InsertHandler<LookupElement> { + private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.XmlAttributeInsertHandler"); + public static final XmlAttributeInsertHandler INSTANCE = new XmlAttributeInsertHandler(); - public void handleInsert(InsertionContext context, LookupElement item) { + private final String myNamespaceToInsert; + + public XmlAttributeInsertHandler() { + this(null); + } + + public XmlAttributeInsertHandler(@Nullable String namespaceToInsert) { + myNamespaceToInsert = namespaceToInsert; + } + + public void handleInsert(final InsertionContext context, final LookupElement item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); final int caretOffset = editor.getCaretModel().getOffset(); - PsiFile file = context.getFile(); + final PsiFile file = context.getFile(); if (file.getLanguage() == HTMLLanguage.INSTANCE && HtmlUtil.isSingleHtmlAttribute((String)item.getObject())) { return; @@ -67,5 +93,60 @@ public class XmlAttributeInsertHandler implements InsertHandler<LookupElement> { editor.getCaretModel().moveToOffset(caretOffset + 2); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); editor.getSelectionModel().removeSelection(); + AutoPopupController.getInstance(editor.getProject()).scheduleAutoPopup(editor); + + if (myNamespaceToInsert != null && file instanceof XmlFile) { + final PsiElement element = file.findElementAt(context.getStartOffset()); + final XmlTag tag = element != null ? PsiTreeUtil.getParentOfType(element, XmlTag.class) : null; + + if (tag != null) { + String prefix = ExtendedTagInsertHandler.suggestPrefix((XmlFile)file, myNamespaceToInsert); + + if (prefix != null) { + prefix = makePrefixUnique(prefix, tag); + final XmlNamespaceHelper helper = XmlNamespaceHelper.getHelper(context.getFile()); + + if (helper != null) { + final Project project = context.getProject(); + PsiDocumentManager.getInstance(project).commitDocument(document); + qualifyWithPrefix(prefix, element); + helper.insertNamespaceDeclaration((XmlFile)file, editor, Collections.singleton( + myNamespaceToInsert), prefix, null); + } + } + } + } + } + + private static void qualifyWithPrefix(@NotNull String namespacePrefix, @NotNull PsiElement context) { + final PsiElement parent = context.getParent(); + + if (parent instanceof XmlAttribute) { + final XmlAttribute attribute = (XmlAttribute)parent; + final String prefix = attribute.getNamespacePrefix(); + + if (!prefix.equals(namespacePrefix) && StringUtil.isNotEmpty(namespacePrefix)) { + final String name = namespacePrefix + ":" + attribute.getLocalName(); + try { + attribute.setName(name); + } + catch (IncorrectOperationException e) { + LOG.error(e); + } + } + } + } + + @NotNull + private static String makePrefixUnique(@NotNull String basePrefix, @NotNull XmlTag context) { + if (context.getNamespaceByPrefix(basePrefix).isEmpty()) { + return basePrefix; + } + int i = 1; + + while (!context.getNamespaceByPrefix(basePrefix + i).isEmpty()) { + i++; + } + return basePrefix + i; } } diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeReferenceCompletionProvider.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeReferenceCompletionProvider.java index 4f102c185312..6b0debbb8896 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeReferenceCompletionProvider.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeReferenceCompletionProvider.java @@ -18,13 +18,16 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; import com.intellij.psi.impl.source.xml.XmlAttributeImpl; import com.intellij.psi.impl.source.xml.XmlAttributeReference; import com.intellij.psi.meta.PsiPresentableMetaData; import com.intellij.psi.xml.XmlAttribute; +import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; import com.intellij.util.ProcessingContext; +import com.intellij.xml.NamespaceAwareXmlAttributeDescriptor; import com.intellij.xml.XmlAttributeDescriptor; import com.intellij.xml.XmlElementDescriptor; import com.intellij.xml.XmlExtension; @@ -68,7 +71,8 @@ public class XmlAttributeReferenceCompletionProvider extends CompletionProvider< XmlAttribute attribute, @Nullable InsertHandler<LookupElement> replacementInsertHandler) { final XmlTag tag = attribute.getParent(); - final XmlExtension extension = XmlExtension.getExtension(tag.getContainingFile()); + final PsiFile file = tag.getContainingFile(); + final XmlExtension extension = XmlExtension.getExtension(file); final String prefix = attribute.getName().contains(":") && ((XmlAttributeImpl) attribute).getRealLocalName().length() > 0 ? attribute.getNamespacePrefix() + ":" : null; @@ -80,6 +84,23 @@ public class XmlAttributeReferenceCompletionProvider extends CompletionProvider< for (XmlAttributeDescriptor descriptor : descriptors) { if (isValidVariant(attribute, descriptor, attributes, extension)) { String name = descriptor.getName(tag); + + InsertHandler<LookupElement> insertHandler = XmlAttributeInsertHandler.INSTANCE; + + if (replacementInsertHandler != null) { + insertHandler = replacementInsertHandler; + } + else if (descriptor instanceof NamespaceAwareXmlAttributeDescriptor) { + final String namespace = ((NamespaceAwareXmlAttributeDescriptor)descriptor).getNamespace(tag); + + if (file instanceof XmlFile && + namespace != null && + namespace.length() > 0 && + !name.contains(":") && + tag.getPrefixByNamespace(namespace) == null) { + insertHandler = new XmlAttributeInsertHandler(namespace); + } + } if (prefix == null || name.startsWith(prefix)) { if (prefix != null && name.length() > prefix.length()) { name = descriptor.getName(tag).substring(prefix.length()); @@ -94,7 +115,7 @@ public class XmlAttributeReferenceCompletionProvider extends CompletionProvider< } element = element .withCaseSensitivity(caseSensitive) - .withInsertHandler(replacementInsertHandler != null ? replacementInsertHandler : XmlAttributeInsertHandler.INSTANCE); + .withInsertHandler(insertHandler); result.addElement( descriptor.isRequired() ? PrioritizedLookupElement.withPriority(element.appendTailText("(required)", true), 100) : element); } diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java index e6dcde0779bc..49ca11297004 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java @@ -25,7 +25,6 @@ import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.text.StringUtil; import com.intellij.patterns.XmlPatterns; @@ -163,23 +162,20 @@ public class XmlCompletionContributor extends CompletionContributor { final CompletionResultSet newResult = result.withPrefixMatcher(pos >= 0 ? prefix.substring(pos + 1) : prefix); final XmlFile file = (XmlFile)parameters.getOriginalFile(); - final List<Pair<String,String>> names = XmlExtension.getExtension(file).getAvailableTagNames(file, tag); - for (Pair<String, String> pair : names) { - final String name = pair.getFirst(); - final String ns = pair.getSecond(); - final LookupElement item = createLookupElement(name, ns, ns, namespacePrefix.isEmpty() ? null : namespacePrefix); + final List<XmlExtension.TagInfo> names = XmlExtension.getExtension(file).getAvailableTagNames(file, tag); + for (XmlExtension.TagInfo info : names) { + final LookupElement item = createLookupElement(info, info.namespace, namespacePrefix.isEmpty() ? null : namespacePrefix); newResult.addElement(item); } } } - public static LookupElement createLookupElement(final String name, - final String namespace, + public static LookupElement createLookupElement(XmlExtension.TagInfo tagInfo, final String tailText, @Nullable String namespacePrefix) { LookupElementBuilder builder = - LookupElementBuilder.create(Pair.create(name, namespace), name).withInsertHandler( - new ExtendedTagInsertHandler(name, namespace, namespacePrefix)); - if (!StringUtil.isEmpty(namespace)) { + LookupElementBuilder.create(tagInfo, tagInfo.name).withInsertHandler( + new ExtendedTagInsertHandler(tagInfo.name, tagInfo.namespace, namespacePrefix)); + if (!StringUtil.isEmpty(tailText)) { builder = builder.withTypeText(tailText, true); } return builder; diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java index 0509068e1dcf..4162ec0b509c 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java @@ -25,7 +25,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixActionRegistrarImpl; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider; -import com.intellij.codeInspection.InspectionProfile; +import com.intellij.codeInspection.*; import com.intellij.codeInspection.htmlInspections.RequiredAttributesInspection; import com.intellij.codeInspection.htmlInspections.XmlEntitiesInspection; import com.intellij.lang.ASTNode; @@ -619,7 +619,17 @@ public class XmlHighlightVisitor extends XmlElementVisitor implements HighlightV .range(startOffset + referenceRange.getStartOffset(), startOffset + referenceRange.getEndOffset()) .descriptionAndTooltip(description).create(); addToResults(info); - if (reference instanceof QuickFixProvider) ((QuickFixProvider)reference).registerQuickfix(info, reference); + if (reference instanceof LocalQuickFixProvider) { + LocalQuickFix[] fixes = ((LocalQuickFixProvider)reference).getQuickFixes(); + if (fixes != null) { + InspectionManager manager = InspectionManager.getInstance(reference.getElement().getProject()); + for (LocalQuickFix fix : fixes) { + ProblemDescriptor descriptor = manager.createProblemDescriptor(value, description, fix, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true); + QuickFixAction.registerQuickFixAction(info, new LocalQuickFixAsIntentionAdapter(fix, descriptor)); + } + } + } UnresolvedReferenceQuickFixProvider.registerReferenceFixes(reference, new QuickFixActionRegistrarImpl(info)); } } diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitorBasedInspection.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitorBasedInspection.java index 50a9665f00e0..e57862db16f5 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitorBasedInspection.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitorBasedInspection.java @@ -43,7 +43,7 @@ public class XmlHighlightVisitorBasedInspection extends GlobalSimpleInspectionTo @NotNull ProblemsHolder problemsHolder, @NotNull final GlobalInspectionContext globalContext, @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) { - HighlightInfoHolder myHolder = new HighlightInfoHolder(file, HighlightInfoFilter.EMPTY_ARRAY) { + HighlightInfoHolder myHolder = new HighlightInfoHolder(file) { @Override public boolean add(@Nullable HighlightInfo info) { if (info != null) { diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnusedNamespaceInspection.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnusedNamespaceInspection.java index fb366d7aacf7..2db87f70c7a9 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnusedNamespaceInspection.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnusedNamespaceInspection.java @@ -24,6 +24,7 @@ import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.psi.impl.source.resolve.reference.impl.providers.URLReference; import com.intellij.psi.impl.source.xml.SchemaPrefix; @@ -73,21 +74,21 @@ public class XmlUnusedNamespaceInspection extends XmlSuppressableInspectionTool XmlAttributeValue value = attribute.getValueElement(); assert value != null; holder.registerProblem(attribute, "Namespace declaration is never used", ProblemHighlightType.LIKE_UNUSED_SYMBOL, - new RemoveNamespaceDeclarationFix(declaredPrefix, false)); + new RemoveNamespaceDeclarationFix(declaredPrefix, false, !refCountHolder.isUsedNamespace(namespace))); XmlTag parent = attribute.getParent(); if (declaredPrefix.length() == 0) { XmlAttribute location = getDefaultLocation(parent); if (location != null) { holder.registerProblem(location, NAMESPACE_LOCATION_IS_NEVER_USED, ProblemHighlightType.LIKE_UNUSED_SYMBOL, - new RemoveNamespaceDeclarationFix(declaredPrefix, true)); + new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } else if (!refCountHolder.isUsedNamespace(namespace)) { for (PsiReference reference : getLocationReferences(namespace, parent)) { if (!XmlHighlightVisitor.hasBadResolve(reference, false)) holder.registerProblemForReference(reference, ProblemHighlightType.LIKE_UNUSED_SYMBOL, NAMESPACE_LOCATION_IS_NEVER_USED, - new RemoveNamespaceDeclarationFix(declaredPrefix, true)); + new RemoveNamespaceDeclarationFix(declaredPrefix, true, true)); } } } @@ -236,10 +237,12 @@ public class XmlUnusedNamespaceInspection extends XmlSuppressableInspectionTool protected final String myPrefix; private final boolean myLocationFix; + private final boolean myRemoveLocation; - private RemoveNamespaceDeclarationFix(@Nullable String prefix, boolean locationFix) { + private RemoveNamespaceDeclarationFix(@Nullable String prefix, boolean locationFix, boolean removeLocation) { myPrefix = prefix; myLocationFix = locationFix; + myRemoveLocation = removeLocation; } @NotNull @@ -306,17 +309,19 @@ public class XmlUnusedNamespaceInspection extends XmlSuppressableInspectionTool Document document = documentManager.getDocument(attribute.getContainingFile()); assert document != null; attribute.delete(); - if (prefix.length() == 0) { - XmlAttribute locationAttr = getDefaultLocation(parent); - if (locationAttr != null) { - locationAttr.delete(); + if (myRemoveLocation) { + if (prefix.length() == 0) { + XmlAttribute locationAttr = getDefaultLocation(parent); + if (locationAttr != null) { + locationAttr.delete(); + } + } + else { + documentManager.doPostponedOperationsAndUnblockDocument(document); + PsiReference[] references = getLocationReferences(namespace, parent); + removeReferencesOrAttribute(references); + documentManager.commitDocument(document); } - } - else { - documentManager.doPostponedOperationsAndUnblockDocument(document); - PsiReference[] references = getLocationReferences(namespace, parent); - removeReferencesOrAttribute(references); - documentManager.commitDocument(document); } } @@ -349,7 +354,7 @@ public class XmlUnusedNamespaceInspection extends XmlSuppressableInspectionTool public static final String NAME = "Remove unused namespace location"; private RemoveNamespaceLocationFix(String namespace) { - super(namespace, true); + super(namespace, true, true); } @NotNull @@ -360,7 +365,7 @@ public class XmlUnusedNamespaceInspection extends XmlSuppressableInspectionTool @Override protected void doRemove(Project project, XmlAttribute attribute, XmlTag parent) { - if (myPrefix.length() == 0) { + if (StringUtil.isEmpty(myPrefix)) { attribute.delete(); } else { diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java index 3c11f27fc83a..0e09baa2ec57 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java @@ -15,6 +15,7 @@ */ package com.intellij.codeInsight.editorActions; +import com.intellij.codeInsight.AutoPopupController; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileTypes.FileType; @@ -45,11 +46,12 @@ public class XmlEqTypedHandler extends TypedHandlerDelegate { } @Override - public Result charTyped(char c, Project project, Editor editor, @NotNull PsiFile file) { + public Result charTyped(char c, Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (needToInsertQuotes) { int offset = editor.getCaretModel().getOffset(); editor.getDocument().insertString(offset, "\"\""); editor.getCaretModel().moveToOffset(offset + 1); + AutoPopupController.getInstance(project).scheduleAutoPopup(editor); } needToInsertQuotes = false; return super.charTyped(c, project, editor, file); diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java index b3bf0c26de73..11677b3ed5b5 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java @@ -30,7 +30,10 @@ import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.html.HtmlTag; +import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.impl.source.xml.XmlTokenImpl; +import com.intellij.psi.templateLanguages.OuterLanguageElement; +import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; @@ -46,8 +49,7 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile editedFile, final FileType fileType) { final WebEditorOptions webEditorOptions = WebEditorOptions.getInstance(); - if (c == '>' && webEditorOptions != null && webEditorOptions.isAutomaticallyInsertClosingTag() - && (editedFile.getLanguage() instanceof XMLLanguage || editedFile.getViewProvider().getBaseLanguage() instanceof XMLLanguage)) { + if (c == '>' && webEditorOptions != null && webEditorOptions.isAutomaticallyInsertClosingTag() && fileContainsXmlLanguage(editedFile)) { PsiDocumentManager.getInstance(project).commitAllDocuments(); PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); @@ -58,7 +60,19 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { if (offset < editor.getDocument().getTextLength()) { elementAtCaret = element = provider.findElementAt(offset, XMLLanguage.class); - + + if (element == null && offset > 0) { + // seems like a template language + // <xml_code><caret><outer_element> + elementAtCaret = element = provider.findElementAt(offset - 1, XMLLanguage.class); + } + if (element == null && offset > 0) { + // seems like an injection in a template file + final PsiElement injectedElement = InjectedLanguageUtil.findInjectedElementNoCommit(file, offset); + if (injectedElement != null && injectedElement.getContainingFile() instanceof XmlFile) { + elementAtCaret = element = injectedElement; + } + } if (!(element instanceof PsiWhiteSpace)) { boolean nonAcceptableDelimiter = true; @@ -112,7 +126,8 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { return Result.CONTINUE; // already seen / } element = parent.getPrevSibling(); - } else if (parent instanceof XmlTag && !(element.getPrevSibling() instanceof XmlTag)) { + } else if (parent instanceof XmlTag && !(element.getPrevSibling() instanceof XmlTag) && + !(element.getPrevSibling() instanceof OuterLanguageElement)) { element = parent; } else if (parent instanceof XmlAttributeValue) { element = parent; @@ -134,7 +149,7 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { element = element.getParent().getParent(); } - while(element instanceof PsiWhiteSpace) element = element.getPrevSibling(); + while(element instanceof PsiWhiteSpace || element instanceof OuterLanguageElement) element = element.getPrevSibling(); if (element instanceof XmlDocument) { // hack for closing tags in RHTML element = element.getLastChild(); } @@ -161,7 +176,7 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { name = name.substring(0, offset - elementAtCaret.getTextOffset()); } if (tag instanceof HtmlTag && HtmlUtil.isSingleHtmlTag(name)) return Result.CONTINUE; - if ("".equals(name)) return Result.CONTINUE; + if (name.isEmpty()) return Result.CONTINUE; int tagOffset = tag.getTextRange().getStartOffset(); @@ -256,4 +271,16 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { } return Result.CONTINUE; } + + private static boolean fileContainsXmlLanguage(PsiFile editedFile) { + if (editedFile.getLanguage() instanceof XMLLanguage) { + return true; + } + final FileViewProvider provider = editedFile.getViewProvider(); + if (provider.getBaseLanguage() instanceof XMLLanguage) { + return true; + } + return provider instanceof TemplateLanguageFileViewProvider && + ((TemplateLanguageFileViewProvider)provider).getTemplateDataLanguage() instanceof XMLLanguage; + } }
\ No newline at end of file diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java index 8794fe0d0521..3a7ab2a3e0e2 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java @@ -32,6 +32,7 @@ import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; import com.intellij.xml.util.XmlUtil; +import org.jetbrains.annotations.NotNull; public class XmlSlashTypedHandler extends TypedHandlerDelegate { public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile editedFile, final FileType fileType) { @@ -67,7 +68,7 @@ public class XmlSlashTypedHandler extends TypedHandlerDelegate { return Result.CONTINUE; } - public Result charTyped(final char c, final Project project, final Editor editor, final PsiFile editedFile) { + public Result charTyped(final char c, final Project project, @NotNull final Editor editor, @NotNull final PsiFile editedFile) { if ((editedFile.getLanguage() instanceof XMLLanguage || editedFile.getViewProvider().getBaseLanguage() instanceof XMLLanguage) && c == '/') { PsiDocumentManager.getInstance(project).commitAllDocuments(); diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java index 803b955a41ed..0dd6ae7c7715 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java @@ -24,7 +24,9 @@ import com.intellij.codeInsight.template.impl.TemplateImpl; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; +import com.intellij.psi.XmlElementFactory; import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlTag; import com.intellij.psi.xml.XmlTokenType; import com.intellij.util.containers.Stack; @@ -347,12 +349,21 @@ public class XmlEmmetParser extends EmmetParser { return null; } - final String name = ((IdentifierToken)token).getText(); + String name = ((IdentifierToken)token).getText(); if (name.isEmpty()) { return null; } + final XmlTag tag = XmlElementFactory.getInstance(myCallback.getProject()).createTagFromText("<tag " + name + "=''/>"); + XmlAttribute[] attributes = tag.getAttributes(); + if (attributes.length == 1) { + name = attributes[0].getName(); + } + else { + return null; + } + advance(); token = getToken(); if (token != ZenCodingTokens.EQ) { diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/SingleLineEmmetFilter.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/SingleLineEmmetFilter.java index c3556448ecfd..acd047a26d1f 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/SingleLineEmmetFilter.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/SingleLineEmmetFilter.java @@ -16,8 +16,10 @@ package com.intellij.codeInsight.template.emmet.filters; import com.intellij.codeInsight.template.emmet.nodes.GenerationNode; +import com.intellij.codeInsight.template.emmet.tokens.TemplateToken; import com.intellij.codeInsight.template.impl.TemplateImpl; import com.intellij.lang.xml.XMLLanguage; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; @@ -34,6 +36,12 @@ public class SingleLineEmmetFilter extends ZenCodingFilter { @NotNull @Override + public String filterText(@NotNull String text, @NotNull TemplateToken token) { + return StringUtil.replace(text, "\n", ""); + } + + @NotNull + @Override public GenerationNode filterNode(@NotNull GenerationNode node) { TemplateImpl template = node.getTemplateToken().getTemplate(); if (template != null) { diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java index e31b36ccb00b..c7ff99fac640 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java @@ -26,8 +26,11 @@ import com.intellij.codeInsight.template.emmet.generators.XmlZenCodingGeneratorI import com.intellij.codeInsight.template.emmet.generators.ZenCodingGenerator; import com.intellij.codeInsight.template.emmet.tokens.TemplateToken; import com.intellij.codeInsight.template.impl.TemplateImpl; +import com.intellij.injected.editor.DocumentWindowImpl; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; @@ -135,23 +138,48 @@ public class GenerationNode extends UserDataHolderBase { boolean insertSurroundedText) { myContainsSurroundedTextMarker = !(insertSurroundedText && myInsertSurroundedTextAtTheEnd); - boolean singleLineFilterEnabled = false; - GenerationNode generationNode = this; + if (generationNode != this) { + return generationNode.generate(callback, generator, Collections.<ZenCodingFilter>emptyList(), insertSurroundedText); + } + + boolean shouldNotReformatTemplate = false; + boolean oneLineTemplateExpanding = false; for (ZenCodingFilter filter : filters) { generationNode = filter.filterNode(generationNode); if(filter instanceof SingleLineEmmetFilter) { - singleLineFilterEnabled = true; + shouldNotReformatTemplate = true; + oneLineTemplateExpanding = true; } } - if (generationNode != this) { - return generationNode.generate(callback, generator, Collections.<ZenCodingFilter>emptyList(), insertSurroundedText); + CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(callback.getProject()); + String indentStr; + if (callback.isInInjectedFragment()) { + Editor editor = callback.getEditor(); + Document document = editor.getDocument(); + if(document instanceof DocumentWindowImpl && ((DocumentWindowImpl)document).isOneLine()) { + /* + * If document is one-line that in the moment of inserting text, + * new line chars will be filtered (see DocumentWindowImpl#insertString). + * So in this case we should filter text by SingleLineAvoid in order to avoid + * inconsistency of template segments. + */ + oneLineTemplateExpanding = true; + filters.add(new SingleLineEmmetFilter()); + } + indentStr = ""; + } + else if (settings.useTabCharacter(callback.getFileType())) { + indentStr = "\t"; + } + else { + int tabSize = settings.getTabSize(callback.getFileType()); + indentStr = StringUtil.repeatSymbol(' ', tabSize); } LiveTemplateBuilder builder = new LiveTemplateBuilder(); int end = -1; - boolean hasChildren = myChildren.size() > 0; TemplateImpl parentTemplate; @@ -188,26 +216,14 @@ public class GenerationNode extends UserDataHolderBase { } LiveTemplateBuilder.Marker marker = offset < builder.length() ? builder.createMarker(offset) : null; - CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(callback.getProject()); - String indentStr; - if (callback.isInInjectedFragment()) { - indentStr = ""; - } - else if (settings.useTabCharacter(callback.getFileType())) { - indentStr = "\t"; - } - else { - int tabSize = settings.getTabSize(callback.getFileType()); - indentStr = StringUtil.repeatSymbol(' ', tabSize); - } - + //noinspection ForLoopReplaceableByForEach for (int i = 0, myChildrenSize = myChildren.size(); i < myChildrenSize; i++) { GenerationNode child = myChildren.get(i); TemplateImpl childTemplate = child.generate(callback, generator, filters, !myContainsSurroundedTextMarker); boolean blockTag = child.isBlockTag(); - if (!singleLineFilterEnabled && blockTag && !isNewLineBefore(builder.getText(), offset)) { + if (!oneLineTemplateExpanding && blockTag && !isNewLineBefore(builder.getText(), offset)) { builder.insertText(offset, "\n" + indentStr, false); offset += indentStr.length() + 1; } @@ -215,7 +231,7 @@ public class GenerationNode extends UserDataHolderBase { int e = builder.insertTemplate(offset, childTemplate, null); offset = marker != null ? marker.getEndOffset() : builder.length(); - if (!singleLineFilterEnabled && ((blockTag && !isNewLineAfter(builder.getText(), offset)) || myInsertNewLineBetweenNodes)) { + if (!oneLineTemplateExpanding && ((blockTag && !isNewLineAfter(builder.getText(), offset)) || myInsertNewLineBetweenNodes)) { builder.insertText(offset, "\n" + indentStr, false); offset += indentStr.length() + 1; } @@ -224,7 +240,7 @@ public class GenerationNode extends UserDataHolderBase { end = e; } } - if(singleLineFilterEnabled) { + if(shouldNotReformatTemplate) { builder.setIsToReformat(false); } return builder.buildTemplate(); diff --git a/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java b/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java index 3eafa6e21725..12e495eaf69b 100644 --- a/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java +++ b/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java @@ -16,12 +16,9 @@ package com.intellij.ide.browsers; import com.intellij.icons.AllIcons; -import com.intellij.ide.BrowserUtil; import com.intellij.ide.browsers.chrome.ChromeSettings; import com.intellij.ide.browsers.firefox.FirefoxSettings; -import com.intellij.ide.browsers.impl.DefaultUrlOpener; import com.intellij.openapi.components.*; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; @@ -111,6 +108,7 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element> private final Map<BrowserFamily, WebBrowserSettings> myBrowserToSettingsMap = new HashMap<BrowserFamily, WebBrowserSettings>(); + @Override @SuppressWarnings({"HardCodedStringLiteral"}) public Element getState() { @NonNls Element element = new Element("WebBrowsersConfiguration"); @@ -132,20 +130,18 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element> return element; } - @SuppressWarnings({"unchecked"}) + @Override public void loadState(@NonNls Element element) { - for (@NonNls Element child : (Iterable<? extends Element>)element.getChildren("browser")) { + for (@NonNls Element child : element.getChildren("browser")) { String family = child.getAttributeValue("family"); final String path = child.getAttributeValue("path"); final String active = child.getAttributeValue("active"); final BrowserFamily browserFamily; Element settingsElement = child.getChild("settings"); - try { browserFamily = BrowserFamily.valueOf(family); - BrowserSpecificSettings specificSettings = null; - if (settingsElement != null) { - specificSettings = browserFamily.createBrowserSpecificSettings(); + BrowserSpecificSettings specificSettings = settingsElement == null ? null : browserFamily.createBrowserSpecificSettings(); + if (specificSettings != null) { XmlSerializer.deserializeInto(specificSettings, settingsElement); } myBrowserToSettingsMap.put(browserFamily, new WebBrowserSettings(path, Boolean.parseBoolean(active), specificSettings)); @@ -190,46 +186,6 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element> return ServiceManager.getService(BrowsersConfiguration.class); } - /** @deprecated use {@link DefaultUrlOpener} (to remove in IDEA 13) */ - @SuppressWarnings("unused") - public static void launchBrowser(final @Nullable BrowserFamily family, @NotNull final String url) { - if (family == null) { - BrowserUtil.launchBrowser(url); - } - else { - for (UrlOpener urlOpener : UrlOpener.EP_NAME.getExtensions()) { - if (urlOpener.openUrl(family, url)) { - return; - } - } - } - } - - /** @deprecated use {@link DefaultUrlOpener} (to remove in IDEA 13) */ - @SuppressWarnings("unused") - public static void launchBrowser(final @NotNull BrowserFamily family, @NotNull final String url, String... parameters) { - DefaultUrlOpener.launchBrowser(family, url, false, parameters); - } - - /** @deprecated use {@link DefaultUrlOpener} (to remove in IDEA 13) */ - @SuppressWarnings("unused") - public static void launchBrowser(final @NotNull BrowserFamily family, - @Nullable final String url, - final boolean forceOpenNewInstanceOnMac, - String... parameters) { - DefaultUrlOpener.launchBrowser(family, url, forceOpenNewInstanceOnMac, parameters); - } - - /** @deprecated use {@link DefaultUrlOpener} (to remove in IDEA 13) */ - @SuppressWarnings("unused") - public static void launchBrowser(final @NotNull BrowserFamily family, - @NotNull final String url, - final boolean forceOpenNewInstanceOnMac, - final Condition<String> browserSpecificParametersFilter, - String... parameters) { - DefaultUrlOpener.launchBrowser(family, url, forceOpenNewInstanceOnMac, parameters); - } - @Nullable public BrowserFamily findFamilyByName(@Nullable String name) { for (BrowserFamily family : BrowserFamily.values()) { @@ -253,4 +209,4 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element> return null; } -} +}
\ No newline at end of file diff --git a/xml/impl/src/com/intellij/ide/browsers/LocalFileUrl.java b/xml/impl/src/com/intellij/ide/browsers/LocalFileUrl.java index 85993b40cf85..7307725b6082 100644 --- a/xml/impl/src/com/intellij/ide/browsers/LocalFileUrl.java +++ b/xml/impl/src/com/intellij/ide/browsers/LocalFileUrl.java @@ -71,4 +71,9 @@ public final class LocalFileUrl implements Url { public int hashCode() { return path.hashCode(); } + + @Override + public String toString() { + return toExternalForm(); + } }
\ No newline at end of file diff --git a/xml/impl/src/com/intellij/ide/browsers/OpenFileInBrowserAction.java b/xml/impl/src/com/intellij/ide/browsers/OpenFileInBrowserAction.java deleted file mode 100644 index 969e7f8b3793..000000000000 --- a/xml/impl/src/com/intellij/ide/browsers/OpenFileInBrowserAction.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.ide.browsers; - -import com.intellij.ide.BrowserUtil; -import com.intellij.ide.GeneralSettings; -import com.intellij.ide.browsers.impl.WebBrowserServiceImpl; -import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.project.DumbAwareAction; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.Pair; -import com.intellij.psi.PsiFile; -import com.intellij.testFramework.LightVirtualFile; -import com.intellij.xml.XmlBundle; -import com.intellij.xml.util.HtmlUtil; - -import java.awt.event.InputEvent; - -public class OpenFileInBrowserAction extends DumbAwareAction { - private static final Logger LOG = Logger.getInstance("#com.intellij.ide.browsers.OpenFileInBrowserAction"); - - @Override - public void update(AnActionEvent e) { - final DataContext dataContext = e.getDataContext(); - final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext); - final Presentation presentation = e.getPresentation(); - - if (file == null || file.getVirtualFile() == null) { - presentation.setVisible(false); - presentation.setEnabled(false); - return; - } - - Pair<WebBrowserUrlProvider, Url> browserUrlProvider = WebBrowserServiceImpl.getProvider(file); - final boolean isHtmlFile = HtmlUtil.isHtmlFile(file); - if (browserUrlProvider == null) { - if (file.getVirtualFile() instanceof LightVirtualFile) { - presentation.setVisible(false); - presentation.setEnabled(false); - return; - } - else { - presentation.setEnabled(isHtmlFile); - } - } - else { - presentation.setEnabled(true); - } - presentation.setVisible(true); - - String text = getTemplatePresentation().getText(); - String description = getTemplatePresentation().getDescription(); - - if (browserUrlProvider != null) { - final String customText = browserUrlProvider.first.getOpenInBrowserActionText(file); - if (customText != null) { - text = customText; - } - final String customDescription = browserUrlProvider.first.getOpenInBrowserActionDescription(file); - if (customDescription != null) { - description = customDescription; - } - if (isHtmlFile) { - description += " (hold Shift to open URL of local file)"; - } - } - - presentation.setText(text); - presentation.setDescription(description); - - GeneralSettings settings = GeneralSettings.getInstance(); - if (!settings.isUseDefaultBrowser()) { - BrowsersConfiguration.BrowserFamily family = BrowsersConfiguration.getInstance().findFamilyByPath(settings.getBrowserPath()); - if (family != null) { - presentation.setIcon(family.getIcon()); - } - } - - if (ActionPlaces.isPopupPlace(e.getPlace())) { - presentation.setVisible(presentation.isEnabled()); - } - } - - @Override - public void actionPerformed(AnActionEvent e) { - final DataContext dataContext = e.getDataContext(); - final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext); - LOG.assertTrue(psiFile != null); - try { - final InputEvent event = e.getInputEvent(); - Url url = WebBrowserService.getInstance().getUrlToOpen(psiFile, event != null && event.isShiftDown()); - if (url != null) { - ApplicationManager.getApplication().saveAll(); - BrowserUtil.launchBrowser(url.toExternalForm()); - } - } - catch (WebBrowserUrlProvider.BrowserException e1) { - Messages.showErrorDialog(e1.getMessage(), XmlBundle.message("browser.error")); - } - catch (Exception e1) { - LOG.error(e1); - } - } -} diff --git a/xml/impl/src/com/intellij/ide/browsers/SelectInDefaultBrowserTarget.java b/xml/impl/src/com/intellij/ide/browsers/SelectInDefaultBrowserTarget.java new file mode 100644 index 000000000000..e223ee3d6bcb --- /dev/null +++ b/xml/impl/src/com/intellij/ide/browsers/SelectInDefaultBrowserTarget.java @@ -0,0 +1,94 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.browsers; + +import com.intellij.ide.BrowserUtil; +import com.intellij.ide.SelectInContext; +import com.intellij.ide.SelectInTargetBase; +import com.intellij.ide.StandardTargetWeights; +import com.intellij.ide.browsers.impl.WebBrowserServiceImpl; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.ui.Messages; +import com.intellij.openapi.util.Pair; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.testFramework.LightVirtualFile; +import com.intellij.xml.XmlBundle; +import com.intellij.xml.util.HtmlUtil; + +class SelectInDefaultBrowserTarget extends SelectInTargetBase { + private static final Logger LOG = Logger.getInstance(SelectInDefaultBrowserTarget.class); + + private String currentName = ""; + + @Override + public boolean canSelect(SelectInContext context) { + Object selectorInFile = context.getSelectorInFile(); + if (!(selectorInFile instanceof PsiElement)) { + return false; + } + + PsiFile file = ((PsiElement)selectorInFile).getContainingFile(); + if (file == null || file.getVirtualFile() == null) { + return false; + } + + Pair<WebBrowserUrlProvider, Url> browserUrlProvider = WebBrowserServiceImpl.getProvider(file); + currentName = XmlBundle.message("browser.select.in.default.name"); + if (browserUrlProvider == null) { + return HtmlUtil.isHtmlFile(file) && !(file.getVirtualFile() instanceof LightVirtualFile); + } + else { + String customText = browserUrlProvider.first.getOpenInBrowserActionText(file); + if (customText != null) { + currentName = customText; + } + } + return true; + } + + @Override + public String toString() { + return currentName; + } + + @Override + public void selectIn(SelectInContext context, boolean requestFocus) { + PsiElement psiElement = (PsiElement)context.getSelectorInFile(); + LOG.assertTrue(psiElement != null); + PsiFile psiFile = psiElement.getContainingFile(); + LOG.assertTrue(psiFile != null); + try { + Url url = WebBrowserService.getInstance().getUrlToOpen(psiFile, false); + if (url != null) { + ApplicationManager.getApplication().saveAll(); + BrowserUtil.launchBrowser(url.toExternalForm()); + } + } + catch (WebBrowserUrlProvider.BrowserException e1) { + Messages.showErrorDialog(e1.getMessage(), XmlBundle.message("browser.error")); + } + catch (Exception e1) { + LOG.error(e1); + } + } + + @Override + public float getWeight() { + return StandardTargetWeights.OS_FILE_MANAGER; + } +} diff --git a/xml/impl/src/com/intellij/ide/browsers/Urls.java b/xml/impl/src/com/intellij/ide/browsers/Urls.java index a7e13061ec01..bee9e7dda49f 100644 --- a/xml/impl/src/com/intellij/ide/browsers/Urls.java +++ b/xml/impl/src/com/intellij/ide/browsers/Urls.java @@ -22,7 +22,7 @@ public final class Urls { public static final CharMatcher SLASH_MATCHER = CharMatcher.is('/'); // about ";" see WEB-100359 - private static final Pattern URI_PATTERN = Pattern.compile("^(?:([^:/?#]+)://)?([^/?#]*)([^?#;]*)(.*)"); + private static final Pattern URI_PATTERN = Pattern.compile("^([^:/?#]+)://([^/?#]*)([^?#;]*)(.*)"); @NotNull public static Url newFromEncoded(@NotNull String url) { diff --git a/xml/impl/src/com/intellij/ide/browsers/impl/WebBrowserServiceImpl.java b/xml/impl/src/com/intellij/ide/browsers/impl/WebBrowserServiceImpl.java index bee53af627be..b35748c4d196 100644 --- a/xml/impl/src/com/intellij/ide/browsers/impl/WebBrowserServiceImpl.java +++ b/xml/impl/src/com/intellij/ide/browsers/impl/WebBrowserServiceImpl.java @@ -31,9 +31,6 @@ import com.intellij.xml.util.HtmlUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.List; - public class WebBrowserServiceImpl extends WebBrowserService { @Override public boolean canOpenInBrowser(@NotNull PsiElement psiElement) { @@ -100,9 +97,9 @@ public class WebBrowserServiceImpl extends WebBrowserService { private static Pair<WebBrowserUrlProvider, Url> getProvider(PsiElement element, PsiFile psiFile) { Ref<Url> result = Ref.create(); - List<WebBrowserUrlProvider> allProviders = Arrays.asList(WebBrowserUrlProvider.EP_NAME.getExtensions()); - for (WebBrowserUrlProvider urlProvider : DumbService.getInstance(element.getProject()).filterByDumbAwareness(allProviders)) { - if (urlProvider.canHandleElement(element, psiFile, result)) { + DumbService dumbService = DumbService.getInstance(element.getProject()); + for (WebBrowserUrlProvider urlProvider : WebBrowserUrlProvider.EP_NAME.getExtensions()) { + if ((!dumbService.isDumb() || DumbService.isDumbAware(urlProvider)) && urlProvider.canHandleElement(element, psiFile, result)) { return Pair.create(urlProvider, result.get()); } } diff --git a/xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java b/xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java index 994765736f1e..c8f23585d100 100644 --- a/xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java +++ b/xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java @@ -89,7 +89,7 @@ public class DtdFileTreeElement extends PsiTreeElementBase<XmlFile> { public String getLocationString() { final XmlElement owner = (XmlElement)getElement(); - final XmlAttlistDecl[] attLists= owner instanceof XmlElementDecl ? XmlElementDescriptorImpl.getCachedAttDecls(owner): XmlAttlistDecl.EMPTY_ARRAY; + final XmlAttlistDecl[] attLists= owner instanceof XmlElementDecl ? XmlElementDescriptorImpl.getCachedAttributeDeclarations(owner): XmlAttlistDecl.EMPTY_ARRAY; if (attLists.length > 0) { Map<String,XmlAttributeDecl> attrMap = null; diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java b/xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java index 39d5d6b39f58..de191736db75 100644 --- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java +++ b/xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java @@ -25,10 +25,14 @@ import com.intellij.psi.scope.processor.FilterElementProcessor; import com.intellij.psi.xml.XmlDocument; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; +import com.intellij.util.SmartList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; class HtmlFileTreeElement extends PsiTreeElementBase<XmlFile> { private final boolean myInStructureViewPopup; @@ -47,30 +51,31 @@ class HtmlFileTreeElement extends PsiTreeElementBase<XmlFile> { final XmlFile xmlFile = getElement(); final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument(); - if (document == null) return Collections.emptyList(); + if (document == null) { + return Collections.emptyList(); + } - final List<XmlTag> rootTags = new ArrayList<XmlTag>(); + final List<XmlTag> rootTags = new SmartList<XmlTag>(); document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document); - if (rootTags.isEmpty()) return Collections.emptyList(); - - if (rootTags.size() == 1) { + if (rootTags.isEmpty()) { + return Collections.emptyList(); + } + else if (rootTags.size() == 1) { final XmlTag rootTag = rootTags.get(0); - if ("html".equalsIgnoreCase(rootTag.getLocalName())) { final XmlTag[] subTags = rootTag.getSubTags(); if (subTags.length == 1 && ("head".equalsIgnoreCase(subTags[0].getLocalName()) || "body".equalsIgnoreCase(subTags[0].getLocalName()))) { return new HtmlTagTreeElement(subTags[0]).getChildrenBase(); } - return new HtmlTagTreeElement(rootTag).getChildrenBase(); } - return Arrays.<StructureViewTreeElement>asList(new HtmlTagTreeElement(rootTag)); + return Collections.<StructureViewTreeElement>singletonList(new HtmlTagTreeElement(rootTag)); } else { - final Collection<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>(); + final Collection<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>(rootTags.size()); for (XmlTag tag : rootTags) { result.add(new HtmlTagTreeElement(tag)); } diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java b/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java index f2bc5c148b85..077b79234c71 100644 --- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java +++ b/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java @@ -15,11 +15,12 @@ */ package com.intellij.lang.html.structureView; +import com.intellij.icons.AllIcons; +import com.intellij.ide.IdeBundle; import com.intellij.ide.actions.ViewStructureAction; import com.intellij.ide.structureView.StructureViewTreeElement; import com.intellij.ide.structureView.impl.xml.XmlStructureViewTreeModel; -import com.intellij.ide.util.treeView.smartTree.NodeProvider; -import com.intellij.ide.util.treeView.smartTree.Sorter; +import com.intellij.ide.util.treeView.smartTree.*; import com.intellij.openapi.editor.Editor; import com.intellij.psi.xml.XmlFile; import com.intellij.ui.PlaceHolder; @@ -28,13 +29,63 @@ import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.Collection; +import java.util.Comparator; class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements PlaceHolder<String> { private final Collection<NodeProvider> myNodeProviders; - private String myStructureViewPlace; + private static Sorter HTML_ALPHA_SORTER = new Sorter() { + @Override + public Comparator getComparator() { + return new Comparator() { + @Override + public int compare(Object o1, Object o2) { + String s1 = SorterUtil.getStringPresentation(o1); + String s2 = SorterUtil.getStringPresentation(o2); + + if (isTagPresenation(s1, "head") && isTagPresenation(s2, "body")) return -1; + if (isTagPresenation(s1, "body") && isTagPresenation(s2, "head")) return 1; + + return s1.compareToIgnoreCase(s2); + } + + private boolean isTagPresenation(final String presentation, final String tagName) { + // "head", "head#id", "head.cls" + final String lowercased = presentation.toLowerCase(); + return lowercased.startsWith(tagName) && + (lowercased.length() == tagName.length() || !Character.isLetter(lowercased.charAt(tagName.length()))); + } + }; + } + + @Override + public boolean isVisible() { + return true; + } + + public String toString() { + return getName(); + } + + @Override + @NotNull + public ActionPresentation getPresentation() { + return new ActionPresentationData(IdeBundle.message("action.sort.alphabetically"), + IdeBundle.message("action.sort.alphabetically"), + AllIcons.ObjectBrowser.Sorted); + } + + @Override + @NotNull + public String getName() { + return ALPHA_SORTER_ID; + } + }; + + private static final Sorter[] ourSorters = {HTML_ALPHA_SORTER}; + public HtmlStructureViewTreeModel(final XmlFile file, @Nullable Editor editor) { super(file, editor); @@ -54,7 +105,11 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl @Override @NotNull public Sorter[] getSorters() { - return Sorter.EMPTY_ARRAY; + if (ViewStructureAction.isInStructureViewPopup(this)) { + return Sorter.EMPTY_ARRAY; // because in popup there's no option to disable sorter + } + + return ourSorters; } @Override diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java b/xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java index bf9c08ab8a5b..d3bc34b8d18d 100644 --- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java +++ b/xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java @@ -70,20 +70,25 @@ class HtmlTagTreeElement extends PsiTreeElementBase<XmlTag> implements LocationP } if (tag.getName().equalsIgnoreCase("img") || tag.getName().equalsIgnoreCase("script")) { - String src = tag.getAttributeValue("src"); - if (StringUtil.isEmpty(src)) { - return null; - } - else { - assert src != null; - return StringUtil.shortenPathWithEllipsis(src, MAX_TEXT_LENGTH, true); - } + return getPathDescription(tag.getAttributeValue("src")); + } + else if (tag.getName().equalsIgnoreCase("link")) { + return getPathDescription(tag.getAttributeValue("href")); } else { return StringUtil.nullize(normalizeSpacesAndShortenIfLong(tag.getValue().getTrimmedText())); } } + private static String getPathDescription(String src) { + if (StringUtil.isEmpty(src)) { + return null; + } + else { + return StringUtil.shortenPathWithEllipsis(src, MAX_TEXT_LENGTH, true); + } + } + @Override public boolean isSearchInLocationString() { return true; diff --git a/xml/impl/src/com/intellij/lang/xml/XmlLiteralEscaper.java b/xml/impl/src/com/intellij/lang/xml/XmlLiteralEscaper.java deleted file mode 100644 index 74df4c229d54..000000000000 --- a/xml/impl/src/com/intellij/lang/xml/XmlLiteralEscaper.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.lang.xml; - -import com.intellij.lang.ASTNode; -import com.intellij.lang.LiteralEscaper; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.psi.PsiElement; -import com.intellij.psi.xml.XmlElementType; -import com.intellij.psi.xml.XmlToken; - -/** - * @author Gregory.Shrago - */ -public class XmlLiteralEscaper implements LiteralEscaper { - public String getEscapedText(PsiElement context, String originalText) { - if (context instanceof XmlToken) { - context = context.getParent(); - } - - ASTNode contextNode = context != null ? context.getNode():null; - if (contextNode != null && contextNode.getElementType() == XmlElementType.XML_CDATA) { - return originalText; - } - return escapeText(originalText); - } - - public String escapeText(String originalText) { - return StringUtil.escapeXml(originalText); - } - - public String unescapeText(String originalText) { - return StringUtil.unescapeXml(originalText); - } -} diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java index 8b602e1b51a7..4fbc8328e5dd 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java @@ -21,7 +21,6 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; -import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.formatter.WhiteSpaceFormattingStrategy; import com.intellij.psi.formatter.WhiteSpaceFormattingStrategyFactory; @@ -338,10 +337,6 @@ public abstract class AbstractXmlBlock extends AbstractBlock { return myXmlFormattingPolicy; } - private CodeStyleSettings getSettings() { - return myXmlFormattingPolicy.getSettings(); - } - @Nullable protected XmlTag getAnotherTreeTag(final ASTNode child) { return null; diff --git a/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java b/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java index 726b9d4d0ad1..23c9cfdac3dd 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java +++ b/xml/impl/src/com/intellij/psi/impl/source/html/HtmlScriptLanguageInjector.java @@ -35,16 +35,25 @@ import java.util.List; public class HtmlScriptLanguageInjector implements MultiHostInjector { @Override public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement host) { - if (!(host instanceof XmlText) || !HtmlUtil.isHtmlTagContainingFile(host)) { + if (!host.isValid() || !(host instanceof XmlText) || !HtmlUtil.isHtmlTagContainingFile(host)) { return; } XmlTag scriptTag = ((XmlText)host).getParentTag(); - if (!"script".equalsIgnoreCase(scriptTag.getLocalName())) { + if (scriptTag == null || !"script".equalsIgnoreCase(scriptTag.getLocalName())) { return; } String mimeType = scriptTag.getAttributeValue("type"); Collection<Language> languages = Language.findInstancesByMimeType(mimeType); - Language language = languages.isEmpty() ? StdLanguages.TEXT : languages.iterator().next(); + Language language; + if (!languages.isEmpty()) { + language = languages.iterator().next(); + } + else if (mimeType != null && mimeType.contains("template")) { + language = StdLanguages.HTML; + } + else { + language = StdLanguages.TEXT; + } if (LanguageUtil.isInjectableLanguage(language)) { registrar .startInjecting(language) diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java b/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java index afd757c11c9c..0601b92c40a1 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/DefaultXmlTagNameProvider.java @@ -19,12 +19,18 @@ import com.intellij.codeInsight.completion.XmlTagInsertHandler; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.PsiElement; import com.intellij.psi.xml.XmlTag; -import com.intellij.xml.*; +import com.intellij.xml.XmlElementDescriptor; +import com.intellij.xml.XmlExtension; +import com.intellij.xml.XmlTagNameProvider; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; public class DefaultXmlTagNameProvider implements XmlTagNameProvider { @Override @@ -39,13 +45,17 @@ public class DefaultXmlTagNameProvider implements XmlTagNameProvider { } XmlExtension xmlExtension = XmlExtension.getExtension(tag.getContainingFile()); List<String> nsInfo = new ArrayList<String>(); - final String[] variants = TagNameVariantCollector.getTagNameVariants(tag, namespaces, nsInfo); - for (int i = 0, variantsLength = variants.length; i < variantsLength; i++) { - String qname = variants[i]; + @SuppressWarnings("unchecked") List<XmlElementDescriptor> variants = TagNameVariantCollector + .getTagDescriptors(tag, namespaces, nsInfo); + + for (int i = 0; i < variants.size(); i++) { + XmlElementDescriptor descriptor = variants.get(i); + String qname = descriptor.getName(tag); if (!prefix.isEmpty() && qname.startsWith(prefix + ":")) { qname = qname.substring(prefix.length() + 1); } - LookupElementBuilder lookupElement = LookupElementBuilder.create(qname); + PsiElement declaration = descriptor.getDeclaration(); + LookupElementBuilder lookupElement = declaration == null ? LookupElementBuilder.create(qname) : LookupElementBuilder.create(declaration, qname); final int separator = qname.indexOf(':'); if (separator > 0) { lookupElement = lookupElement.withLookupString(qname.substring(separator + 1)); diff --git a/xml/impl/src/com/intellij/xml/XmlPsiManager.java b/xml/impl/src/com/intellij/xml/XmlPsiManager.java new file mode 100644 index 000000000000..8492313042f3 --- /dev/null +++ b/xml/impl/src/com/intellij/xml/XmlPsiManager.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.xml; + +import com.intellij.lang.xml.XMLLanguage; +import com.intellij.openapi.components.AbstractProjectComponent; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFileSystemItem; +import com.intellij.psi.impl.PsiManagerImpl; +import com.intellij.psi.impl.PsiTreeChangePreprocessorBase; + +/** + * Created by fedorkorotkov. + */ +public class XmlPsiManager extends AbstractProjectComponent { + + private final PsiManagerImpl myPsiManager; + + protected XmlPsiManager(Project project, PsiManagerImpl psiManager) { + super(project); + myPsiManager = psiManager; + } + + @Override + public void initComponent() { + super.initComponent(); + new PsiTreeChangePreprocessorBase(myPsiManager) { + @Override + protected boolean isInsideCodeBlock(PsiElement element) { + if (element instanceof PsiFileSystemItem) { + return false; + } + + if (element == null || element.getParent() == null) return true; + + final boolean isXml = element.getLanguage() instanceof XMLLanguage; + // any xml element isn't inside a "code block" + // cause we display even attributes and tag values in structure view + return !isXml; + } + }; + } +} diff --git a/xml/impl/src/com/intellij/xml/XmlUndefinedElementFixProvider.java b/xml/impl/src/com/intellij/xml/XmlUndefinedElementFixProvider.java index 9de1c06bf50a..16d96b512325 100644 --- a/xml/impl/src/com/intellij/xml/XmlUndefinedElementFixProvider.java +++ b/xml/impl/src/com/intellij/xml/XmlUndefinedElementFixProvider.java @@ -16,6 +16,7 @@ package com.intellij.xml; import com.intellij.codeInsight.intention.IntentionAction; +import com.intellij.codeInspection.LocalQuickFix; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlTag; @@ -46,7 +47,7 @@ public abstract class XmlUndefinedElementFixProvider { * providers should be asked */ @Nullable - public IntentionAction[] createFixes(final @NotNull XmlTag tag) { + public LocalQuickFix[] createFixes(final @NotNull XmlTag tag) { return null; } } diff --git a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java index 8af0acc7fc75..ff05952cf910 100644 --- a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java +++ b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java @@ -34,10 +34,7 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; import com.intellij.util.IncorrectOperationException; import com.intellij.util.Processor; -import com.intellij.xml.XmlAttributeDescriptor; -import com.intellij.xml.XmlBundle; -import com.intellij.xml.XmlElementDescriptor; -import com.intellij.xml.XmlNSDescriptor; +import com.intellij.xml.*; import com.intellij.xml.impl.schema.*; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NonNls; @@ -334,6 +331,11 @@ public class XmlDocumentationProvider implements DocumentationProvider { } public PsiElement getDocumentationElementForLookupItem(final PsiManager psiManager, Object object, PsiElement element) { + + if (object instanceof XmlExtension.TagInfo) { + return ((XmlExtension.TagInfo)object).getDeclaration(); + } + final PsiElement originalElement = element; boolean isAttrCompletion = element instanceof XmlAttribute; diff --git a/xml/openapi/src/com/intellij/ide/browsers/WebBrowserUrlProvider.java b/xml/openapi/src/com/intellij/ide/browsers/WebBrowserUrlProvider.java index 688191fcef19..2bdf78c50732 100644 --- a/xml/openapi/src/com/intellij/ide/browsers/WebBrowserUrlProvider.java +++ b/xml/openapi/src/com/intellij/ide/browsers/WebBrowserUrlProvider.java @@ -35,26 +35,23 @@ public abstract class WebBrowserUrlProvider { } } - public boolean canHandleElement(@NotNull PsiElement element, @NotNull PsiFile psiFile, Ref<Url> result) { + public boolean canHandleElement(@NotNull PsiElement element, @NotNull PsiFile psiFile, @NotNull Ref<Url> result) { VirtualFile file = psiFile.getVirtualFile(); if (file == null) { return false; } - Url url; try { - url = getUrl(element, psiFile, file); + Url url = getUrl(element, psiFile, file); + if (url != null) { + result.set(url); + return true; + } } catch (BrowserException ignored) { - return false; - } - - if (url == null) { - return false; } - result.set(url); - return true; + return false; } @Nullable diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/ReferenceAnnotator.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/ReferenceAnnotator.java index d4f236fb878b..9b2ef11a395f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/ReferenceAnnotator.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/ReferenceAnnotator.java @@ -17,14 +17,10 @@ package org.intellij.plugins.relaxNG.compact; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; -import com.intellij.codeInsight.daemon.QuickFixProvider; -import com.intellij.codeInsight.daemon.impl.HighlightInfo; -import com.intellij.codeInsight.daemon.impl.HighlightInfoType; -import com.intellij.codeInspection.ProblemHighlightType; +import com.intellij.codeInspection.*; import com.intellij.lang.annotation.Annotation; import com.intellij.lang.annotation.AnnotationHolder; import com.intellij.lang.annotation.Annotator; -import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiPolyVariantReference; @@ -33,7 +29,6 @@ import org.intellij.plugins.relaxNG.compact.psi.*; import org.jetbrains.annotations.NotNull; import java.text.MessageFormat; -import java.util.List; /** * Created by IntelliJ IDEA. @@ -110,16 +105,14 @@ public class ReferenceAnnotator extends RncElementVisitor implements Annotator { } annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); - if (reference instanceof QuickFixProvider) { - HighlightInfo info = - HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(annotation.getStartOffset(), annotation.getEndOffset()).create(); - - ((QuickFixProvider)reference).registerQuickfix(info, reference); - - List<Pair<HighlightInfo.IntentionActionDescriptor,TextRange>> ranges = info.quickFixActionRanges; - if (ranges != null) { - for (Pair<HighlightInfo.IntentionActionDescriptor, TextRange> pair : ranges) { - annotation.registerFix(pair.first.getAction(), pair.second); + if (reference instanceof LocalQuickFixProvider) { + LocalQuickFix[] fixes = ((LocalQuickFixProvider)reference).getQuickFixes(); + if (fixes != null) { + InspectionManager inspectionManager = InspectionManager.getInstance(reference.getElement().getProject()); + for (LocalQuickFix fix : fixes) { + ProblemDescriptor descriptor = inspectionManager.createProblemDescriptor(reference.getElement(), annotation.getMessage(), fix, + ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, true); + annotation.registerFix(fix, null, null, descriptor); } } } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java index 2b5375229e9f..f73aa00751f9 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java @@ -18,7 +18,7 @@ package org.intellij.plugins.relaxNG.compact; import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.HighlighterColors; -import com.intellij.openapi.editor.SyntaxHighlighterColors; +import com.intellij.openapi.editor.DefaultLanguageHighlighterColors; import com.intellij.openapi.editor.colors.CodeInsightColors; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.fileTypes.SyntaxHighlighterBase; @@ -45,24 +45,24 @@ public class RncHighlighter extends SyntaxHighlighterBase { static { ourMap1 = new HashMap<IElementType, TextAttributesKey>(); - fillMap(ourMap1, RncTokenTypes.KEYWORDS, SyntaxHighlighterColors.KEYWORD); - fillMap(ourMap1, RncTokenTypes.OPERATORS, SyntaxHighlighterColors.OPERATION_SIGN); + fillMap(ourMap1, RncTokenTypes.KEYWORDS, DefaultLanguageHighlighterColors.KEYWORD); + fillMap(ourMap1, RncTokenTypes.OPERATORS, DefaultLanguageHighlighterColors.OPERATION_SIGN); - fillMap(ourMap1, RncTokenTypes.STRINGS, SyntaxHighlighterColors.STRING); + fillMap(ourMap1, RncTokenTypes.STRINGS, DefaultLanguageHighlighterColors.STRING); - ourMap1.put(RncTokenTypes.LBRACE, SyntaxHighlighterColors.BRACES); - ourMap1.put(RncTokenTypes.RBRACE, SyntaxHighlighterColors.BRACES); + ourMap1.put(RncTokenTypes.LBRACE, DefaultLanguageHighlighterColors.BRACES); + ourMap1.put(RncTokenTypes.RBRACE, DefaultLanguageHighlighterColors.BRACES); - ourMap1.put(RncTokenTypes.LBRACKET, SyntaxHighlighterColors.BRACKETS); - ourMap1.put(RncTokenTypes.RBRACKET, SyntaxHighlighterColors.BRACKETS); + ourMap1.put(RncTokenTypes.LBRACKET, DefaultLanguageHighlighterColors.BRACKETS); + ourMap1.put(RncTokenTypes.RBRACKET, DefaultLanguageHighlighterColors.BRACKETS); - ourMap1.put(RncTokenTypes.LPAREN, SyntaxHighlighterColors.PARENTHS); - ourMap1.put(RncTokenTypes.RPAREN, SyntaxHighlighterColors.PARENTHS); + ourMap1.put(RncTokenTypes.LPAREN, DefaultLanguageHighlighterColors.PARENTHESES); + ourMap1.put(RncTokenTypes.RPAREN, DefaultLanguageHighlighterColors.PARENTHESES); - ourMap1.put(RncTokenTypes.COMMA, SyntaxHighlighterColors.COMMA); + ourMap1.put(RncTokenTypes.COMMA, DefaultLanguageHighlighterColors.COMMA); - fillMap(ourMap1, RncTokenTypes.DOC_TOKENS, SyntaxHighlighterColors.DOC_COMMENT); - fillMap(ourMap1, RncTokenTypes.COMMENTS, SyntaxHighlighterColors.LINE_COMMENT); + fillMap(ourMap1, RncTokenTypes.DOC_TOKENS, DefaultLanguageHighlighterColors.DOC_COMMENT); + fillMap(ourMap1, RncTokenTypes.COMMENTS, DefaultLanguageHighlighterColors.LINE_COMMENT); fillMap(ourMap1, RncTokenTypes.IDENTIFIERS, CodeInsightColors.LOCAL_VARIABLE_ATTRIBUTES); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java index 8aeab6059c17..b32f7a7ae37c 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java @@ -17,15 +17,15 @@ package org.intellij.plugins.relaxNG.compact.psi.impl; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; -import com.intellij.codeInsight.daemon.QuickFixProvider; -import com.intellij.codeInsight.daemon.impl.HighlightInfo; -import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; -import com.intellij.codeInsight.intention.IntentionAction; +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.LocalQuickFixProvider; +import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.lang.ASTNode; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.ScrollType; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.util.PsiTreeUtil; @@ -52,7 +52,7 @@ import java.util.Set; * Date: 13.08.2007 */ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function<Define, ResolveResult>, - QuickFixProvider<PatternReference>, EmptyResolveMessageProvider { + LocalQuickFixProvider, EmptyResolveMessageProvider { public PatternReference(RncRef ref) { super(ref); @@ -152,14 +152,16 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function return "Unresolved pattern reference ''{0}''"; } - public void registerQuickfix(HighlightInfo info, final PatternReference reference) { - if (reference.getScope() == null) { - return; + @Nullable + @Override + public LocalQuickFix[] getQuickFixes() { + if (getScope() != null) { + return new LocalQuickFix[] { new CreatePatternFix(this) }; } - QuickFixAction.registerQuickFixAction(info, new CreatePatternFix(reference)); + return LocalQuickFix.EMPTY_ARRAY; } - static class CreatePatternFix implements IntentionAction { + static class CreatePatternFix implements LocalQuickFix { private final PatternReference myReference; public CreatePatternFix(PatternReference reference) { @@ -167,7 +169,8 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function } @NotNull - public String getText() { + @Override + public String getName() { return "Create Pattern '" + myReference.getCanonicalText() + "'"; } @@ -176,11 +179,8 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function return "Create Pattern"; } - public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { - return myReference.getElement().isValid() && myReference.getScope() != null; - } - - public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { + @Override + public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final RncFile rncfile = (RncFile)PsiFileFactory.getInstance(myReference.getElement().getProject()).createFileFromText("dummy.rnc", RncFileType.getInstance(), "dummy = xxx"); final RncGrammar grammar = rncfile.getGrammar(); @@ -207,8 +207,6 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function CodeStyleManager.getInstance(e.getManager().getProject()).reformatNewlyAddedElement(blockNode, newNode); - PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument()); - final RncDefine d = p.getElement(); assert d != null; @@ -217,13 +215,12 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function final int offset = definition.getTextRange().getStartOffset(); - editor.getCaretModel().moveToOffset(offset); - editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); - editor.getDocument().deleteString(offset, definition.getTextRange().getEndOffset()); - } + definition.delete(); - public boolean startInWriteAction() { - return true; + VirtualFile virtualFile = myReference.getElement().getContainingFile().getVirtualFile(); + if (virtualFile != null) { + FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, virtualFile, offset), true); + } } } } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNameImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNameImpl.java index 6dc7ad54df8e..b1cf38bd2a0f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNameImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNameImpl.java @@ -16,19 +16,25 @@ package org.intellij.plugins.relaxNG.compact.psi.impl; +import com.intellij.codeInsight.CodeInsightUtilCore; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; -import com.intellij.codeInsight.daemon.QuickFixProvider; -import com.intellij.codeInsight.daemon.impl.HighlightInfo; -import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; -import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.lookup.LookupItem; import com.intellij.codeInsight.template.*; +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.LocalQuickFixProvider; +import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.lang.ASTNode; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.TextRange; -import com.intellij.psi.*; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFileFactory; +import com.intellij.psi.PsiReference; +import com.intellij.psi.ResolveState; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.scope.BaseScopeProcessor; import com.intellij.psi.tree.IElementType; @@ -49,7 +55,7 @@ import org.jetbrains.annotations.Nullable; * Date: 14.08.2007 */ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference, - EmptyResolveMessageProvider, QuickFixProvider<RncNameImpl> { + EmptyResolveMessageProvider, LocalQuickFixProvider { private enum Kind { NAMESPACE, DATATYPES @@ -140,10 +146,13 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference return "Unresolved namespace prefix ''{0}''"; } - public void registerQuickfix(HighlightInfo info, final RncNameImpl reference) { - if (reference.getPrefix() == null) return; // huh? - - QuickFixAction.registerQuickFixAction(info, new CreateDeclFix(reference)); + @Nullable + @Override + public LocalQuickFix[] getQuickFixes() { + if (getPrefix() != null) { + return new LocalQuickFix[] { new CreateDeclFix(this) }; + } + return LocalQuickFix.EMPTY_ARRAY; } private static class MyResolver extends BaseScopeProcessor { @@ -187,7 +196,7 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference } } - public static class CreateDeclFix implements IntentionAction { + public static class CreateDeclFix implements LocalQuickFix { private final RncNameImpl myReference; public CreateDeclFix(RncNameImpl reference) { @@ -195,7 +204,7 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference } @NotNull - public String getText() { + public String getName() { return getFamilyName() + " '" + myReference.getPrefix() + "'"; } @@ -204,11 +213,8 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference return "Create " + myReference.getKind().name().toLowerCase() + " declaration"; } - public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { - return myReference.isValid(); - } - - public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { + @Override + public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final String prefix = myReference.getPrefix(); final PsiFileFactory factory = PsiFileFactory.getInstance(myReference.getProject()); final RncFile psiFile = (RncFile)factory.createFileFromText("dummy.rnc", @@ -237,13 +243,7 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference CodeStyleManager.getInstance(e.getManager().getProject()).reformatNewlyAddedElement(blockNode, newNode); - final SmartPsiElementPointer<RncDecl> p = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(e); - PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument()); - - final RncDecl d = p.getElement(); - assert d != null; - - final PsiElement literal = d.getLastChild(); + final PsiElement literal = e.getLastChild(); assert literal != null; final ASTNode literalNode = literal.getNode(); @@ -252,34 +252,39 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference assert literalNode.getElementType() == RncTokenTypes.LITERAL; final int offset = literal.getTextRange().getStartOffset(); - editor.getDocument().deleteString(literal.getTextRange().getStartOffset(), literal.getTextRange().getEndOffset()); - - final TemplateManager manager = TemplateManager.getInstance(project); - final Template t = manager.createTemplate("", ""); - t.addTextSegment("\""); - final Expression expression = new Expression() { - public Result calculateResult(ExpressionContext context) { - return new TextResult(""); - } - - public Result calculateQuickResult(ExpressionContext context) { - return calculateResult(context); - } - public LookupItem[] calculateLookupItems(ExpressionContext context) { - return LookupItem.EMPTY_ARRAY; + literal.delete(); + + VirtualFile virtualFile = myReference.getElement().getContainingFile().getVirtualFile(); + if (virtualFile != null) { + Editor editor = FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, virtualFile, offset), true); + if (editor != null) { + RncDecl rncDecl = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(e); + + final TemplateManager manager = TemplateManager.getInstance(project); + final Template t = manager.createTemplate("", ""); + t.addTextSegment(" \""); + final Expression expression = new Expression() { + public Result calculateResult(ExpressionContext context) { + return new TextResult(""); + } + + public Result calculateQuickResult(ExpressionContext context) { + return calculateResult(context); + } + + public LookupItem[] calculateLookupItems(ExpressionContext context) { + return LookupItem.EMPTY_ARRAY; + } + }; + t.addVariable("uri", expression, expression, true); + t.addTextSegment("\""); + t.addEndVariable(); + + editor.getCaretModel().moveToOffset(rncDecl.getTextRange().getEndOffset()); + manager.startTemplate(editor, t); } - }; - t.addVariable("uri", expression, expression, true); - t.addTextSegment("\""); - t.addEndVariable(); - - editor.getCaretModel().moveToOffset(offset); - manager.startTemplate(editor, t); - } - - public boolean startInWriteAction() { - return true; + } } } } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java index df9bcc8d5cf2..a1a42ac4b64e 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java @@ -17,10 +17,9 @@ package org.intellij.plugins.relaxNG.references; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; -import com.intellij.codeInsight.daemon.QuickFixProvider; -import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInsight.daemon.impl.analysis.CreateNSDeclarationIntentionFix; -import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; +import com.intellij.codeInspection.LocalQuickFix; +import com.intellij.codeInspection.LocalQuickFixProvider; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.TextRange; @@ -62,7 +61,7 @@ public class PrefixReferenceProvider extends PsiReferenceProvider { }; } - private static class PrefixReference extends BasicAttributeValueReference implements EmptyResolveMessageProvider, QuickFixProvider<PrefixReference> { + private static class PrefixReference extends BasicAttributeValueReference implements EmptyResolveMessageProvider, LocalQuickFixProvider { public PrefixReference(XmlAttributeValue value, int length) { super(value, TextRange.from(1, length)); } @@ -94,19 +93,16 @@ public class PrefixReferenceProvider extends PsiReferenceProvider { return super.isReferenceTo(element); } - public void registerQuickfix(HighlightInfo info, PrefixReference reference) { - try { - final PsiElement element = reference.getElement(); - final XmlElementFactory factory = XmlElementFactory.getInstance(element.getProject()); - final String value = ((XmlAttributeValue)element).getValue(); - final String[] name = value.split(":"); - final XmlTag tag = factory.createTagFromText("<" + (name.length > 1 ? name[1] : value) + " />", XMLLanguage.INSTANCE); + @Nullable + @Override + public LocalQuickFix[] getQuickFixes() { + final PsiElement element = getElement(); + final XmlElementFactory factory = XmlElementFactory.getInstance(element.getProject()); + final String value = ((XmlAttributeValue)element).getValue(); + final String[] name = value.split(":"); + final XmlTag tag = factory.createTagFromText("<" + (name.length > 1 ? name[1] : value) + " />", XMLLanguage.INSTANCE); - CreateNSDeclarationIntentionFix fix = CreateNSDeclarationIntentionFix.createFix(tag, reference.getCanonicalText()); - QuickFixAction.registerQuickFixAction(info, fix); - } catch (Throwable e) { - LOG.error(e); - } + return new LocalQuickFix[] { CreateNSDeclarationIntentionFix.createFix(tag, getCanonicalText()) }; } @NotNull diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java index 31b1950c9a8f..9ac61ebb9a20 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java @@ -17,9 +17,6 @@ package org.intellij.plugins.relaxNG.xml.dom.impl; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; -import com.intellij.codeInsight.daemon.QuickFixProvider; -import com.intellij.codeInsight.daemon.impl.HighlightInfo; -import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; import com.intellij.codeInsight.lookup.LookupValueFactory; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.LocalQuickFixProvider; @@ -53,7 +50,7 @@ import java.util.Set; * Date: 18.08.2007 */ public class DefinitionReference extends PsiReferenceBase.Poly<XmlAttributeValue> - implements QuickFixProvider<DefinitionReference>, LocalQuickFixProvider, + implements LocalQuickFixProvider, EmptyResolveMessageProvider, Function<Define, ResolveResult> { private final boolean myIsParentRef; @@ -143,16 +140,6 @@ public class DefinitionReference extends PsiReferenceBase.Poly<XmlAttributeValue return LocalQuickFix.EMPTY_ARRAY; } - public void registerQuickfix(HighlightInfo info, final DefinitionReference reference) { - assert reference == this; - final XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class); - assert tag != null; - final RngGrammar scope = myValue.getParentOfType(RngGrammar.class, true); - if (scope != null) { - QuickFixAction.registerQuickFixAction(info, new CreatePatternFix(this)); - } - } - @NotNull public String getUnresolvedMessagePattern() { return "Unresolved pattern reference ''{0}''"; diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java index cb889b3843f9..986578ba75ef 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java @@ -16,22 +16,17 @@ package org.intellij.plugins.relaxNG; -import com.intellij.codeInsight.daemon.QuickFixProvider; import com.intellij.codeInsight.daemon.impl.HighlightInfo; -import com.intellij.codeInsight.daemon.impl.HighlightInfoType; -import com.intellij.codeInsight.intention.IntentionAction; -import com.intellij.codeInspection.InspectionToolProvider; -import com.intellij.codeInspection.LocalInspectionTool; +import com.intellij.codeInspection.*; import com.intellij.codeInspection.htmlInspections.RequiredAttributesInspection; import com.intellij.javaee.ExternalResourceManagerEx; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.Result; import com.intellij.openapi.application.WriteAction; +import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.io.FileUtil; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; @@ -210,18 +205,23 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide protected void doTestQuickFix(String file, String ext) throws Throwable { final PsiReference psiReference = myTestFixture.getReferenceAtCaretPositionWithAssertion(file + "." + ext); assertNull("Reference", psiReference.resolve()); - assertTrue("QuickFixProvider", psiReference instanceof QuickFixProvider); + assertTrue(psiReference.getClass().getName() + " is not a QuickFixProvider", psiReference instanceof LocalQuickFixProvider); - HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(0, 0).descriptionAndTooltip("").create(); - ((QuickFixProvider)psiReference).registerQuickfix(info, psiReference); - assertTrue("One action expected", info.quickFixActionRanges.size() == 1); + final LocalQuickFix[] fixes = ((LocalQuickFixProvider)psiReference).getQuickFixes(); - final Pair<HighlightInfo.IntentionActionDescriptor, TextRange> rangePair = info.quickFixActionRanges.get(0); - final IntentionAction action = rangePair.first.getAction(); - - assertTrue("action is enabled", action.isAvailable(myTestFixture.getProject(), myTestFixture.getEditor(), myTestFixture.getFile())); - myTestFixture.launchAction(action); + assertTrue("One action expected", fixes != null && fixes.length == 1); + final Project project = myTestFixture.getProject(); + new WriteCommandAction.Simple(project, myTestFixture.getFile()) { + @Override + protected void run() throws Throwable { + ProblemDescriptor problemDescriptor = InspectionManager.getInstance(project).createProblemDescriptor(psiReference.getElement(), "foo", + fixes, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, + true); + fixes[0].applyFix(project, problemDescriptor); + } + }.execute(); myTestFixture.checkResultByFile(file + "_after." + ext); } diff --git a/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java b/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java new file mode 100644 index 000000000000..319d3941e267 --- /dev/null +++ b/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java @@ -0,0 +1,174 @@ +package com.intellij.codeInsight; + +import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase; +import com.intellij.codeInsight.documentation.DocumentationManager; +import com.intellij.lang.documentation.DocumentationProvider; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtilCore; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiDocumentManager; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.testFramework.PlatformTestUtil; +import org.jetbrains.annotations.Nullable; + +import java.io.File; + +/** + * @by maxim + */ +@SuppressWarnings("ConstantConditions") +public class XmlDocumentationTest extends DaemonAnalyzerTestCase { + + public void testXmlDoc() throws Exception { + doOneTest("1.xml", "display-name", false, "web-app_2_3.dtd"); + doOneTest("2.xml", null, false, "web-app_2_4.xsd"); + doOneTest("3.xml", null, false, "web-app_2_4.xsd", "j2ee_1_4.xsd"); + doOneTest("3_2.xml", null, false, "web-app_2_4.xsd", "j2ee_1_4.xsd"); + doOneTest("3_3.xml", null, false, "web-app_2_4.xsd", "j2ee_1_4.xsd"); + + doOneTest("4.xml", "context-param", false, false, "web-app_2_4.xsd"); + doOneTest("5.xml", "aaa:context-param", false, false, "web-app_2_4.xsd"); + doOneTest("6.xsd", "xs:complexType", true, true); + doOneTest("7.xml", "bbb", false); + doOneTest("8.xml", "bbb", false); + doOneTest("9.xml", "laquo", false); + } + + public void testXmlDocWithCData() throws Exception { + doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml","spring-beans.xsd"); + doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + "2.xml","spring-beans.xsd"); + } + + public void testXmlDoc2() throws Exception { + doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml", "web-app_2_4.xsd"); + } + + public void testXmlDoc3() throws Exception { + doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml", "hibernate-mapping-3.0.dtd"); + } + + public void testXmlDoc4() throws Exception { + final String testName = getTestName(false); + doQuickDocGenerationTestWithCheckExpectedResult(testName + ".xml", testName + ".xsd"); + } + + public void testSchemaPrefix() throws Exception { + DocumentationTestContext context = new DocumentationTestContext("SchemaPrefix.xml"); + assertEquals("XML Namespace Prefix \"xs\" (http://www.w3.org/2001/XMLSchema)", context.getQuickNavigateInfo()); + } + + public void testXmlDoc6() throws Exception { + final String testName = getTestName(false); + doQuickDocGenerationTestWithCheckExpectedResult((Object)"car",testName + ".xml", testName + ".xsd"); + } + + public void testXmlDoc7() throws Exception { + final String testName = getTestName(false); + doQuickDocGenerationTestWithCheckExpectedResult((Object)"$Paste",testName + ".xml", testName + ".xsd"); + } + + private void doQuickDocGenerationTestWithCheckExpectedResult(final String... baseFileNames) throws Exception { + doQuickDocGenerationTestWithCheckExpectedResult(null, baseFileNames); + } + + private void doQuickDocGenerationTestWithCheckExpectedResult(Object completionVariant, final String... baseFileNames) throws Exception { + final DocumentationTestContext context = new DocumentationTestContext(baseFileNames); + String pathname = getTestDataPath() + baseFileNames[0] + ".expected.html"; + VirtualFile vfile = LocalFileSystem.getInstance().findFileByIoFile(new File(pathname)); + assertNotNull(pathname + " not found", vfile); + String expectedText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(vfile)); + assertEquals(expectedText, StringUtil.convertLineSeparators(context.generateDoc())); + + if (completionVariant != null) { + vfile = LocalFileSystem.getInstance().findFileByIoFile(new File(getTestDataPath() +baseFileNames[0] + ".expected.completion.html")); + expectedText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(vfile), "\n"); + assertEquals(expectedText, StringUtil.convertLineSeparators(context.generateDocForCompletion(completionVariant), "\n")); + } + } + + public void testDtdDoc() throws Exception { + doOneTest("dtd.dtd", "foo", false, true, "web-app_2_4.xsd"); + doOneTest("dtd.xml", "foo", false, true, "web-app_2_4.xsd"); + } + + private void doOneTest(String fileName, String lookupObject, boolean testExternal, String... additional) throws Exception { + configureByFiles(null, additional); + doOneTest(fileName, lookupObject, testExternal, true, "web-app_2_4.xsd"); + } + + @SuppressWarnings("ConstantConditions") + public class DocumentationTestContext { + final DocumentationProvider documentationProvider; + final PsiElement originalElement; + PsiElement element; + final PsiFile psiFile; + + DocumentationTestContext(String... fileNames) throws Exception { + configureByFiles(null,fileNames); + psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument()); + originalElement = psiFile.findElementAt(myEditor.getCaretModel().getOffset()); + element = DocumentationManager.getInstance(myProject).findTargetElement(myEditor, myFile, originalElement); + + if (element == null) { + element = originalElement; + } + + documentationProvider = DocumentationManager.getProviderFromElement(element); + } + + @Nullable + String generateDoc() { + return documentationProvider.generateDoc(element, originalElement); + } + + @Nullable + String getQuickNavigateInfo() { + return documentationProvider.getQuickNavigateInfo(element, originalElement); + } + + @Nullable + public String generateDocForCompletion(Object completionVariant) { + PsiElement lookupItem = documentationProvider.getDocumentationElementForLookupItem(myPsiManager, completionVariant, originalElement); + assert lookupItem != null; + return documentationProvider.generateDoc(lookupItem, originalElement); + } + } + + private void doOneTest(String fileName, String lookupObject, boolean testExternal, boolean testForElementUnderCaret, String... additional) throws Exception { + + configureByFiles(null, additional); + final DocumentationTestContext context = new DocumentationTestContext(fileName); + + if (testForElementUnderCaret) { + assertNotNull( "inline help for " + fileName, context.generateDoc() ); + if (testExternal) { + assertNotNull( "external help", context.documentationProvider.getUrlFor(context.element, context.originalElement) ); + } + } + + if(lookupObject!=null) { + PsiElement docElement = context.documentationProvider.getDocumentationElementForLookupItem( + context.psiFile.getManager(), lookupObject,context.originalElement); + assertNotNull("no element for " + fileName, docElement); + assertNotNull( "inline help for lookup", context.documentationProvider.generateDoc(docElement, context.originalElement) ); + if (testExternal) { + assertNotNull( "external help for lookup", context.documentationProvider.getUrlFor(docElement, context.originalElement) ); + } + } + } + + public void testScopeAttribute() throws Exception { + doQuickDocGenerationTestWithCheckExpectedResult(getTestName(false) + ".xml","spring-beans.xsd"); + } + + public void testXslCompletion() throws Exception { + doQuickDocGenerationTestWithCheckExpectedResult((Object)"apply-imports", "xslCompletion.xsl"); + } + + @Override + protected String getTestDataPath() { + return PlatformTestUtil.getCommunityPath() + "/xml/tests/testData/documentation/"; + } +}
\ No newline at end of file diff --git a/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java b/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java index da3254a24815..ebcacc5b9fed 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlParsingTest.java @@ -670,6 +670,15 @@ public class XmlParsingTest extends ParsingTestCase { doTest("<script type=\"application/custom\">Custom Script</script>", "test.html"); } + public void testKeywordsAsName() throws Exception { + doTestDtd("<!ELEMENT FIELD ANY>\n" + + "<!ELEMENT PUBLIC ANY>\n" + + "<!ELEMENT EMPTY ANY>\n" + + "<!ELEMENT ANY ANY>\n" + + "<!ELEMENT AND (FIELD|PUBLIC|EMPTY|ANY)*>"); + + } + static class MyLanguage extends Language implements InjectableLanguage { protected MyLanguage() { super("MyLanguage", "application/custom"); diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java index 574942bc1207..e86012369ebb 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java @@ -646,5 +646,23 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase { assertEquals("src", strings.get(1)); assertEquals("align", strings.get(2)); } + + public void testDoNotProcessAnyInRestrictions() throws Exception { + myFixture.configureByText("foo.xsd", "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + + " <<caret>\n" + + "</xs:schema>"); + myFixture.completeBasic(); + assertSameElements(myFixture.getLookupElementStrings(), "xs:annotation", + "xs:attribute", + "xs:attributeGroup", + "xs:complexType", + "xs:element", + "xs:group", + "xs:import", + "xs:include", + "xs:notation", + "xs:redefine", + "xs:simpleType"); + } } diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java index 476e91b40970..51e0ff29c816 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java @@ -1992,6 +1992,11 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { doTest(getFullRelativeTestName(".html"), true, true); } + public void testAnyAttribute() throws Exception { + configureByFiles(null, BASE_PATH + "anyAttribute.xml", BASE_PATH + "services-1.0.xsd"); + doDoTest(true, false); + } + @Override protected void setUp() throws Exception { super.setUp(); diff --git a/xml/tests/src/com/intellij/codeInsight/template/XmlLiveTemplateTest.groovy b/xml/tests/src/com/intellij/codeInsight/template/XmlLiveTemplateTest.groovy index c928a92a7e57..db73bb1dd610 100644 --- a/xml/tests/src/com/intellij/codeInsight/template/XmlLiveTemplateTest.groovy +++ b/xml/tests/src/com/intellij/codeInsight/template/XmlLiveTemplateTest.groovy @@ -52,5 +52,13 @@ public class XmlLiveTemplateTest extends LightCodeInsightFixtureTestCase { manager.startTemplate(myFixture.getEditor(), template); myFixture.checkResult '<tag><selection><</selection><caret></tag>' } + + public void "test insert CDATA by CD and tab"() { + myFixture.configureByText 'a.xml', '<tag><caret></tag>' + myFixture.type('CD\t') + myFixture.checkResult '''<tag><![CDATA[ + +]]></tag>''' + } } diff --git a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java index 03d221ce29d3..e457bdc1cfb9 100644 --- a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java +++ b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java @@ -4,7 +4,7 @@ import com.intellij.codeInsight.actions.OptimizeImportsProcessor; import com.intellij.codeInsight.daemon.impl.analysis.XmlUnusedNamespaceInspection; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInspection.htmlInspections.XmlInspectionToolProvider; -import com.intellij.javaee.ExternalResourceManagerImpl; +import com.intellij.javaee.ExternalResourceManagerExImpl; import com.intellij.openapi.application.Result; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.testFramework.IdeaTestCase; @@ -208,6 +208,14 @@ public class XmlNamespacesTest extends CodeInsightFixtureTestCase { doOptimizeImportsTest(text); } + public void testUsedInXmlns() throws Exception { + myFixture.testHighlighting("spring.xml", "spring-beans-2.5.xsd", "spring-batch-2.1.xsd"); + IntentionAction action = myFixture.getAvailableIntention(XmlUnusedNamespaceInspection.RemoveNamespaceDeclarationFix.NAME); + assertNotNull(action); + myFixture.launchAction(action); + myFixture.checkResultByFile("spring_after.xml"); + } + private void doUnusedDeclarationTest(String text, String after, String name) throws Exception { doUnusedDeclarationTest(text, after, name, true); } @@ -241,12 +249,12 @@ public class XmlNamespacesTest extends CodeInsightFixtureTestCase { protected void setUp() throws Exception { super.setUp(); myFixture.enableInspections(new XmlInspectionToolProvider()); - ExternalResourceManagerImpl.registerResourceTemporarily("http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd", - getTestDataPath() + "/web-app_2_5.xsd", getTestRootDisposable()); - ExternalResourceManagerImpl.registerResourceTemporarily("http://xml.apache.org/axis/wsdd/", - getTestDataPath() + "/wsdd.dtd", getTestRootDisposable()); - ExternalResourceManagerImpl.registerResourceTemporarily("http://xml.apache.org/axis/wsdd/providers/java", - getTestDataPath() + "/wsdd_provider_java.xsd", getTestRootDisposable()); + ExternalResourceManagerExImpl.registerResourceTemporarily("http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd", + getTestDataPath() + "/web-app_2_5.xsd", getTestRootDisposable()); + ExternalResourceManagerExImpl.registerResourceTemporarily("http://xml.apache.org/axis/wsdd/", + getTestDataPath() + "/wsdd.dtd", getTestRootDisposable()); + ExternalResourceManagerExImpl.registerResourceTemporarily("http://xml.apache.org/axis/wsdd/providers/java", + getTestDataPath() + "/wsdd_provider_java.xsd", getTestRootDisposable()); } @Override diff --git a/xml/tests/testData/documentation/1.xml b/xml/tests/testData/documentation/1.xml new file mode 100644 index 000000000000..40e49779e7c1 --- /dev/null +++ b/xml/tests/testData/documentation/1.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "web-app_2_3.dtd"> + +<we<caret>b-app> +</web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/2.xml b/xml/tests/testData/documentation/2.xml new file mode 100644 index 000000000000..e937206a8036 --- /dev/null +++ b/xml/tests/testData/documentation/2.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<web-a<caret>pp xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" + version="2.4"> +</web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/3.xml b/xml/tests/testData/documentation/3.xml new file mode 100644 index 000000000000..a537c4674105 --- /dev/null +++ b/xml/tests/testData/documentation/3.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" + version="2.4"> + <ejb-ref></ejb-ref> +</web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/3_2.xml b/xml/tests/testData/documentation/3_2.xml new file mode 100644 index 000000000000..0645e7280ff6 --- /dev/null +++ b/xml/tests/testData/documentation/3_2.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" + version="2.4"> + <ejb-ref> </ejb-ref> +</web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/3_3.xml b/xml/tests/testData/documentation/3_3.xml new file mode 100644 index 000000000000..22a1ccbcfb10 --- /dev/null +++ b/xml/tests/testData/documentation/3_3.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" + version="2.4"> + <ejb-ref > </ejb-ref> +</web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/4.xml b/xml/tests/testData/documentation/4.xml new file mode 100644 index 000000000000..62d4d03d072d --- /dev/null +++ b/xml/tests/testData/documentation/4.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" + version="2.4"> + <<caret>ejb-ref></ejb-ref> +</web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/5.xml b/xml/tests/testData/documentation/5.xml new file mode 100644 index 000000000000..85938d58595c --- /dev/null +++ b/xml/tests/testData/documentation/5.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<aaa:web-app xmlns:aaa="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" + version="2.4"> + <<caret> +</aaa:web-app>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/6.xsd b/xml/tests/testData/documentation/6.xsd new file mode 100644 index 000000000000..9234c160ff46 --- /dev/null +++ b/xml/tests/testData/documentation/6.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:schemas-dig-de:test2"> + <xs:in<caret>clude schemaLocation="XsiSchemaLocation3.xsd"/> +</xs:schema> diff --git a/xml/tests/testData/documentation/7.xml b/xml/tests/testData/documentation/7.xml new file mode 100644 index 000000000000..56129c999ac1 --- /dev/null +++ b/xml/tests/testData/documentation/7.xml @@ -0,0 +1,6 @@ +<!DOCTYPE aaa [ + <!ELEMENT aaa (#PCDATA)> + <!ATTLIST aaa + bbb CDATA #REQUIRED> <!-- this is the class name --> + ]> +<aaa b<caret>bb="ccc"/> diff --git a/xml/tests/testData/documentation/8.xml b/xml/tests/testData/documentation/8.xml new file mode 100644 index 000000000000..05b075cb66c2 --- /dev/null +++ b/xml/tests/testData/documentation/8.xml @@ -0,0 +1,7 @@ +<!DOCTYPE aaa [ + <!ELEMENT aaa (#PCDATA)> + <!-- this is the class name --> + <!ATTLIST aaa + bbb CDATA #REQUIRED> + ]> +<aaa b<caret>bb="ccc"/> diff --git a/xml/tests/testData/documentation/9.xml b/xml/tests/testData/documentation/9.xml new file mode 100644 index 000000000000..8a837978823d --- /dev/null +++ b/xml/tests/testData/documentation/9.xml @@ -0,0 +1,5 @@ +<!DOCTYPE aaa [ + <!ENTITY laquo "«"> <!-- left-pointing double angle quotation mark + = left pointing guillemet, U+00AB ISOnum --> + ]> +<aaa bbb="c&la<caret>quo;cc"/> diff --git a/xml/tests/testData/documentation/SchemaPrefix.xml b/xml/tests/testData/documentation/SchemaPrefix.xml new file mode 100644 index 000000000000..9929db069fdb --- /dev/null +++ b/xml/tests/testData/documentation/SchemaPrefix.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema targetNamespace="http://mySchema" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:my="http://mySchema"> + + <xs:element name="myElement" type="my:TYPE"/> + <xs:simpleType name="TYPE" id="TYPE"> + <xs:restriction base="xs:integer"> + <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="T" id="T"> + <xs:restriction base="xs:integer"> + <xs:minInclusive value="0" id="id"/> + </xs:restriction> + </xs:simpleType> +</x<caret>s:schema>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/ScopeAttribute.xml b/xml/tests/testData/documentation/ScopeAttribute.xml new file mode 100644 index 000000000000..f23c6b0b59af --- /dev/null +++ b/xml/tests/testData/documentation/ScopeAttribute.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <bean id="s" class="java.lang.String" sco<caret>pe=""/> +</beans>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/ScopeAttribute.xml.expected.html b/xml/tests/testData/documentation/ScopeAttribute.xml.expected.html new file mode 100644 index 000000000000..1e7166fa0a5b --- /dev/null +++ b/xml/tests/testData/documentation/ScopeAttribute.xml.expected.html @@ -0,0 +1,17 @@ +Tag name: <b>scope</b><br>Description : The scope of this bean: typically "singleton" (one shared instance,<br> + which will be returned by all calls to getBean() with the id),<br> + or "prototype" (independent instance resulting from each call to<br> + getBean(). Default is "singleton".<br> +<br> + Singletons are most commonly used, and are ideal for multi-threaded<br> + service objects. Further scopes, such as "request" or "session",<br> + might be supported by extended bean factories (for example, in a<br> + web environment).<br> +<br> + Note: This attribute will not be inherited by child bean definitions.<br> + Hence, it needs to be specified per concrete bean definition.<br> +<br> + Inner bean definitions inherit the singleton status of their containing<br> + bean definition, unless explicitly specified: The inner bean will be a<br> + singleton if the containing bean is a singleton, and a prototype if<br> + the containing bean has any other scope.
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc2.xml b/xml/tests/testData/documentation/XmlDoc2.xml new file mode 100644 index 000000000000..efcb0dcb5dd3 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc2.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<web-app version="2.4" + xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"> + <servlet-mapping> + <caret><servlet-name>Faces Servlet</servlet-name> + <url-pattern>*.seam</url-pattern> + </servlet-mapping> + +</web-app> diff --git a/xml/tests/testData/documentation/XmlDoc2.xml.expected.html b/xml/tests/testData/documentation/XmlDoc2.xml.expected.html new file mode 100644 index 000000000000..a627f0f766fe --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc2.xml.expected.html @@ -0,0 +1,3 @@ +Complex type: <b>servlet-nameType</b><br>Description : The servlet-name element contains the canonical name of the + servlet. Each servlet name is unique within the web + application.
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc3.xml b/xml/tests/testData/documentation/XmlDoc3.xml new file mode 100644 index 000000000000..004d3665b454 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc3.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "hibernate-mapping-3.0.dtd"> +<hibernate-mapping package="auction"> + + <class name="Bid" discriminator-value="N"> + <sub<caret>class/> + </class> + +</hibernate-mapping>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc3.xml.expected.html b/xml/tests/testData/documentation/XmlDoc3.xml.expected.html new file mode 100644 index 000000000000..24d43f973500 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc3.xml.expected.html @@ -0,0 +1,4 @@ +Tag name: <b>subclass</b><br>Description : Subclass declarations are nested beneath the root class declaration to achieve<br> + polymorphic persistence with the table-per-hierarchy mapping strategy.<br> +<br> + See the note on the class element regarding <pojo/> vs. @name usage...
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc4.xml b/xml/tests/testData/documentation/XmlDoc4.xml new file mode 100644 index 000000000000..5b13d87c444f --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc4.xml @@ -0,0 +1 @@ +<test att<caret>ribute="aaa" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XmlDoc4.xsd"/>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc4.xml.expected.html b/xml/tests/testData/documentation/XmlDoc4.xml.expected.html new file mode 100644 index 000000000000..3d80f11b15ea --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc4.xml.expected.html @@ -0,0 +1 @@ +Complex type: <b>myRefType</b><br>Description : Hello, world!
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc4.xsd b/xml/tests/testData/documentation/XmlDoc4.xsd new file mode 100644 index 000000000000..6e075d9132de --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc4.xsd @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:element name="test" type="testType"/> + <xs:complexType name="testType"> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute type="myRefType" name="attribute"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <xs:simpleType name="myRefType"> + <xs:annotation> + <xs:documentation> + Hello, world! + </xs:documentation> + </xs:annotation> + <xs:union memberTypes="xs:string"/> +</xs:simpleType> +</xs:schema>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc5.xml b/xml/tests/testData/documentation/XmlDoc5.xml new file mode 100644 index 000000000000..4303cefe8ecd --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc5.xml @@ -0,0 +1,3 @@ +<pro<caret>ject xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 maven-4.0.0.xsd"> +</project>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc5.xml.expected.html b/xml/tests/testData/documentation/XmlDoc5.xml.expected.html new file mode 100644 index 000000000000..f2f8cd645567 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc5.xml.expected.html @@ -0,0 +1,2 @@ +Tag name: <b>project</b><br>Description : The <code>&lt;project&gt;</code> element is the root of the descriptor. + The following table lists all of the possible child elements.<br>Version : 3.0.0+
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc6.xml b/xml/tests/testData/documentation/XmlDoc6.xml new file mode 100644 index 000000000000..c9515d1ef739 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc6.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<root xmlns="http://test.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://test.com XmlDoc6.xsd"> + + <foo value="b<caret>ar"/> +</root>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc6.xml.expected.completion.html b/xml/tests/testData/documentation/XmlDoc6.xml.expected.completion.html new file mode 100644 index 000000000000..d0211d404da1 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc6.xml.expected.completion.html @@ -0,0 +1 @@ +Enumeration value: <b>car</b><br>Description : A vehicle to get you from A to B
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc6.xml.expected.html b/xml/tests/testData/documentation/XmlDoc6.xml.expected.html new file mode 100644 index 000000000000..87aeb0d9c110 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc6.xml.expected.html @@ -0,0 +1 @@ +Enumeration value: <b>bar</b><br>Description : A great place to get a drink
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc6.xsd b/xml/tests/testData/documentation/XmlDoc6.xsd new file mode 100644 index 000000000000..a7ecb63df49f --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc6.xsd @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<xsd:schema xmlns="http://test.com" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + targetNamespace="http://test.com"> + + <xsd:element name="root" type="rootType"> + <xsd:annotation> + <xsd:documentation> + The root of foo + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:complexType name="rootType"> + <xsd:sequence> + <xsd:element name="foo"> + <xsd:annotation> + <xsd:documentation> + A generic non-useful element + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="value"> + <xsd:annotation> + <xsd:documentation> + A value for Foo + </xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="bar"> + <xsd:annotation> + <xsd:documentation> + A great place to get a drink + </xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="car"> + <xsd:annotation> + <xsd:documentation> + A vehicle to get you from A to B + </xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="dar"> + <xsd:annotation> + <xsd:documentation> + A made up word + </xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> +</xsd:schema>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc7.xml b/xml/tests/testData/documentation/XmlDoc7.xml new file mode 100644 index 000000000000..a0253aaeaae9 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc7.xml @@ -0,0 +1,2 @@ +<shortcut xmlns="http://test.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://test.com XmlDoc7.xsd" key="$C<caret>ut">gero cum</shortcut>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc7.xml.expected.completion.html b/xml/tests/testData/documentation/XmlDoc7.xml.expected.completion.html new file mode 100644 index 000000000000..b8200aa7c47c --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc7.xml.expected.completion.html @@ -0,0 +1 @@ +Enumeration value: <b>$Paste</b><br>Description : Ctrl+V
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc7.xml.expected.html b/xml/tests/testData/documentation/XmlDoc7.xml.expected.html new file mode 100644 index 000000000000..0c3926313f7c --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc7.xml.expected.html @@ -0,0 +1 @@ +Enumeration value: <b>$Cut</b><br>Description : Ctrl+X, Shift+Delete
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDoc7.xsd b/xml/tests/testData/documentation/XmlDoc7.xsd new file mode 100644 index 000000000000..055da8210710 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDoc7.xsd @@ -0,0 +1,26 @@ +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test.com"> + <xs:element name="shortcut"> + <xs:complexType mixed="true"> + <xs:attribute name="key" type="KeyboardShortcutType" use="optional"/> + </xs:complexType> + </xs:element> + <xs:simpleType name="KeyboardShortcutType"> + <xs:restriction base="xs:token"> + <xs:enumeration value="$Copy"> + <xs:annotation> + <xs:documentation>Ctrl+C, Ctrl+Insert</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="$Cut"> + <xs:annotation> + <xs:documentation>Ctrl+X, Shift+Delete</xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="$Paste"> + <xs:annotation> + <xs:documentation>Ctrl+V</xs:documentation> + </xs:annotation> + </xs:enumeration> + </xs:restriction> + </xs:simpleType> +</xs:schema> diff --git a/xml/tests/testData/documentation/XmlDocWithCData.xml b/xml/tests/testData/documentation/XmlDocWithCData.xml new file mode 100644 index 000000000000..1386d40b9fb9 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDocWithCData.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<be<caret>ans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation="http://www.springframework.org/schema/beans spring-beans.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + <util:properties id="myProperties" location="classpath:org/springframework/beans/factory/config/util.properties"/> + <util:constant id="min" static-field="java.lang.Integer.MIN_VALUE"/> + <util:map id="myProps"> + <entry key="bbb" value="aaa"/> + </util:map> +</beans>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDocWithCData.xml.expected.html b/xml/tests/testData/documentation/XmlDocWithCData.xml.expected.html new file mode 100644 index 000000000000..ede11d80edb6 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDocWithCData.xml.expected.html @@ -0,0 +1,2 @@ +Tag name: <b>beans</b><br>Description : The top level (typically root) element. Allows the definition <>"'/><br> + of default values for all nested bean definitions.
\ No newline at end of file diff --git a/xml/tests/testData/documentation/XmlDocWithCData2.xml b/xml/tests/testData/documentation/XmlDocWithCData2.xml new file mode 100644 index 000000000000..a8ae51922936 --- /dev/null +++ b/xml/tests/testData/documentation/XmlDocWithCData2.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.0.xsd + http://www.springframework.org/schema/aop + http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> + + <bean class="java.lang.String" scope="request"> + <co<caret>nstructor-arg value="foo"/> + <aop:scoped-proxy/> + </bean> +</beans> diff --git a/xml/tests/testData/documentation/XmlDocWithCData2.xml.expected.html b/xml/tests/testData/documentation/XmlDocWithCData2.xml.expected.html new file mode 100644 index 000000000000..f6c63d90f42f --- /dev/null +++ b/xml/tests/testData/documentation/XmlDocWithCData2.xml.expected.html @@ -0,0 +1,11 @@ +Tag name: <b>constructor-arg</b><br>Description : Bean definitions can specify zero or more constructor arguments.<br> + This is an alternative to "autowire constructor".<br> + Arguments correspond to either a specific index of the constructor<br> + argument list or are supposed to be matched generically by type.<br> +<br> + Note: A single generic argument value will just be used once, rather<br> + than potentially matched multiple times (as of Spring 1.1).<br> +<br> + constructor-arg elements are also used in conjunction with the<br> + factory-method element to construct beans using static or instance<br> + factory methods.
\ No newline at end of file diff --git a/xml/tests/testData/documentation/dtd.dtd b/xml/tests/testData/documentation/dtd.dtd new file mode 100644 index 000000000000..4043164cbadf --- /dev/null +++ b/xml/tests/testData/documentation/dtd.dtd @@ -0,0 +1,3 @@ +<!--Foo--> +<!ELEMENT foo (#PCDATA)> +<!ELEMENT bar (f<caret>oo)> diff --git a/xml/tests/testData/documentation/dtd.xml b/xml/tests/testData/documentation/dtd.xml new file mode 100644 index 000000000000..8219bc630925 --- /dev/null +++ b/xml/tests/testData/documentation/dtd.xml @@ -0,0 +1,5 @@ +<!DOCTYPE foo [ + <!--Foo--> + <!ELEMENT foo (#PCDATA)> + ]> +<f<caret>oo /> diff --git a/xml/tests/testData/documentation/hibernate-mapping-3.0.dtd b/xml/tests/testData/documentation/hibernate-mapping-3.0.dtd new file mode 100644 index 000000000000..de7bf3d1ff1d --- /dev/null +++ b/xml/tests/testData/documentation/hibernate-mapping-3.0.dtd @@ -0,0 +1,1036 @@ +<!-- Hibernate Mapping DTD. + +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +An instance of this XML document may contain mappings for an arbitrary +number of classes. The class mappings may contain associations to classes +mapped in the same document or in another document. No class may be +mapped more than once. Each document may also contain definitions of an +arbitrary number of queries, and import declarations of arbitrary classes. + +--> + +<!-- + The document root. + --> + +<!ELEMENT hibernate-mapping ( + meta*, + typedef*, + import*, + (class|subclass|joined-subclass|union-subclass)*, + resultset*, + (query|sql-query)*, + filter-def*, + database-object* +)> + <!ATTLIST hibernate-mapping schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST hibernate-mapping catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST hibernate-mapping default-cascade CDATA "none"> + <!ATTLIST hibernate-mapping default-access CDATA "property"> + <!ATTLIST hibernate-mapping default-lazy (true|false) "true"> + <!ATTLIST hibernate-mapping auto-import (true|false) "true"> + <!ATTLIST hibernate-mapping package CDATA #IMPLIED> <!-- default: none --> + +<!-- + META element definition; used to assign meta-level attributes to a class + or property. Is currently used by codegenerator as a placeholder for + values that is not directly related to OR mappings. +--> +<!ELEMENT meta (#PCDATA)> + <!ATTLIST meta attribute CDATA #REQUIRED> + <!ATTLIST meta inherit (true|false) "true"> + +<!-- + TYPEDEF element definition; defines a new name for a Hibernate type. May + contain parameters for parameterizable types. +--> +<!ELEMENT typedef (param*)> + <!ATTLIST typedef class CDATA #REQUIRED> + <!ATTLIST typedef name CDATA #REQUIRED> + +<!-- + IMPORT element definition; an explicit query language "import" +--> +<!ELEMENT import EMPTY> + <!ATTLIST import class CDATA #REQUIRED> + <!ATTLIST import rename CDATA #IMPLIED> <!-- default: unqualified class name --> + +<!-- + Root entity mapping. Poorly named as entities do not have to be represented by + classes at all. Mapped entities may be represented via different methodologies + (POJO, Map, Dom4j). +--> +<!ELEMENT class ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + tuplizer*, + (id|composite-id), + discriminator?, + natural-id?, + (version|timestamp)?, + (property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*, + ((join*,subclass*)|joined-subclass*|union-subclass*), + loader?,sql-insert?,sql-update?,sql-delete?, + filter*, + resultset*, + (query|sql-query)* +)> + <!ATTLIST class entity-name CDATA #IMPLIED> + <!ATTLIST class name CDATA #IMPLIED> <!-- this is the class name --> + <!ATTLIST class proxy CDATA #IMPLIED> <!-- default: no proxy interface --> + <!ATTLIST class lazy (true|false) #IMPLIED> + <!ATTLIST class table CDATA #IMPLIED> <!-- default: unqualified classname --> + <!ATTLIST class schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST class catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST class subselect CDATA #IMPLIED> + <!ATTLIST class discriminator-value CDATA #IMPLIED> <!-- default: unqualified class name | none --> + <!ATTLIST class mutable (true|false) "true"> + <!ATTLIST class abstract (true|false) #IMPLIED> + <!ATTLIST class polymorphism (implicit|explicit) "implicit"> + <!ATTLIST class where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST class persister CDATA #IMPLIED> + <!ATTLIST class dynamic-update (true|false) "false"> + <!ATTLIST class dynamic-insert (true|false) "false"> + <!ATTLIST class batch-size CDATA #IMPLIED> + <!ATTLIST class select-before-update (true|false) "false"> + <!ATTLIST class optimistic-lock (none|version|dirty|all) "version"> + <!ATTLIST class check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST class rowid CDATA #IMPLIED> + <!ATTLIST class node CDATA #IMPLIED> + +<!-- + TUPLIZER element; defines tuplizer to use for a component/entity for a given entity-mode +--> +<!ELEMENT tuplizer EMPTY> + <!ATTLIST tuplizer entity-mode (pojo|dom4j|dynamic-map) #IMPLIED> <!-- entity mode for which tuplizer is in effect --> + <!ATTLIST tuplizer class CDATA #REQUIRED> <!-- the tuplizer class to use --> + +<!-- + FILTER-DEF element; top-level filter definition. +--> +<!ELEMENT filter-def (#PCDATA|filter-param)*> + <!ATTLIST filter-def name CDATA #REQUIRED> <!-- The filter name --> + <!ATTLIST filter-def condition CDATA #IMPLIED> + +<!-- + FILTER-PARAM element; qualifies parameters found within a FILTER-DEF + condition. +--> +<!ELEMENT filter-param EMPTY> + <!ATTLIST filter-param name CDATA #REQUIRED> <!-- The parameter name --> + <!ATTLIST filter-param type CDATA #REQUIRED> <!-- The parameter type --> + +<!-- + FILTER element; used to apply a filter. +--> +<!ELEMENT filter (#PCDATA)> + <!ATTLIST filter name CDATA #REQUIRED> + <!ATTLIST filter condition CDATA #IMPLIED> + + +<!-- A join allows some properties of a class to be persisted to a second table --> + +<!ELEMENT join ( + subselect?, + comment?, + key, + (property|many-to-one|component|dynamic-component|any)*, + sql-insert?,sql-update?,sql-delete? +)> + <!ATTLIST join table CDATA #REQUIRED> + <!ATTLIST join schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST join catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST join subselect CDATA #IMPLIED> + <!ATTLIST join fetch (join|select) "join"> + <!ATTLIST join inverse (true|false) "false"> + <!ATTLIST join optional (true|false) "false"> + +<!-- A natural-id element allows declaration of the unique business key --> + +<!ELEMENT natural-id ( (property|many-to-one|component|dynamic-component|any)* )> + <!ATTLIST natural-id mutable (true|false) "false"> + +<!-- Declares the id type, column and generation algorithm for an entity class. +If a name attribut is given, the id is exposed to the application through the +named property of the class. If not, the id is only exposed to the application +via Session.getIdentifier() --> + +<!ELEMENT id (meta*,column*,type?,generator?)> + <!ATTLIST id name CDATA #IMPLIED> + <!ATTLIST id node CDATA #IMPLIED> + <!ATTLIST id access CDATA #IMPLIED> + <!ATTLIST id column CDATA #IMPLIED> + <!ATTLIST id type CDATA #IMPLIED> + <!ATTLIST id length CDATA #IMPLIED> + <!ATTLIST id unsaved-value CDATA #IMPLIED> <!-- any|none|null|undefined|0|-1|... --> + +<!-- A composite key may be modelled by a java class with a property for each +key column. The class must implement java.io.Serializable and reimplement equals() +and hashCode(). --> + +<!ELEMENT composite-id ( meta*, (key-property|key-many-to-one)+ )> + <!ATTLIST composite-id class CDATA #IMPLIED> + <!ATTLIST composite-id mapped (true|false) "false"> + <!ATTLIST composite-id name CDATA #IMPLIED> + <!ATTLIST composite-id node CDATA #IMPLIED> + <!ATTLIST composite-id access CDATA #IMPLIED> + <!ATTLIST composite-id unsaved-value (undefined|any|none) "undefined"> + +<!-- Polymorphic data requires a column holding a class discriminator value. This +value is not directly exposed to the application. --> + +<!ELEMENT discriminator ((column|formula)?)> + <!ATTLIST discriminator column CDATA #IMPLIED> <!-- default: "class"|none --> + <!ATTLIST discriminator formula CDATA #IMPLIED> + <!ATTLIST discriminator type CDATA "string"> + <!ATTLIST discriminator not-null (true|false) "true"> + <!ATTLIST discriminator length CDATA #IMPLIED> + <!ATTLIST discriminator force (true|false) "false"> + <!ATTLIST discriminator insert (true|false) "true"> + +<!-- Versioned data requires a column holding a version number. This is exposed to the +application through a property of the Java class. --> + +<!ELEMENT version (meta*,column*)> + <!ATTLIST version name CDATA #REQUIRED> + <!ATTLIST version node CDATA #IMPLIED> + <!ATTLIST version access CDATA #IMPLIED> + <!ATTLIST version column CDATA #IMPLIED> + <!ATTLIST version type CDATA "integer"> + <!ATTLIST version unsaved-value (null|negative|undefined) "undefined"> + <!ATTLIST version generated (never|always) "never"> + <!ATTLIST version insert (true|false) #IMPLIED> + +<!ELEMENT timestamp (meta*)> + <!ATTLIST timestamp name CDATA #REQUIRED> + <!ATTLIST timestamp node CDATA #IMPLIED> + <!ATTLIST timestamp column CDATA #IMPLIED> + <!ATTLIST timestamp access CDATA #IMPLIED> + <!ATTLIST timestamp unsaved-value (null|undefined) "null"> + <!ATTLIST timestamp source (vm|db) "vm"> + <!ATTLIST timestamp generated (never|always) "never"> + + +<!-- + Subclass declarations are nested beneath the root class declaration to achieve + polymorphic persistence with the table-per-hierarchy mapping strategy. + + See the note on the class element regarding <pojo/> vs. @name usage... +--> +<!ELEMENT subclass ( + meta*, + tuplizer*, + synchronize*, + (property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*, + join*, + subclass*, + loader?,sql-insert?,sql-update?,sql-delete?, + resultset*, + (query|sql-query)* +)> + <!ATTLIST subclass entity-name CDATA #IMPLIED> + <!ATTLIST subclass name CDATA #IMPLIED> + <!ATTLIST subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface --> + <!ATTLIST subclass discriminator-value CDATA #IMPLIED> <!-- default: unqualified class name | none --> + <!ATTLIST subclass dynamic-update (true|false) "false"> + <!ATTLIST subclass dynamic-insert (true|false) "false"> + <!ATTLIST subclass select-before-update (true|false) "false"> + <!ATTLIST subclass extends CDATA #IMPLIED> <!-- default: empty when a toplevel, otherwise the nearest class definition --> + <!ATTLIST subclass lazy (true|false) #IMPLIED> + <!ATTLIST subclass abstract (true|false) #IMPLIED> + <!ATTLIST subclass persister CDATA #IMPLIED> + <!ATTLIST subclass batch-size CDATA #IMPLIED> + <!ATTLIST subclass node CDATA #IMPLIED> + +<!-- + Joined subclasses are used for the normalized table-per-subclass mapping strategy + + See the note on the class element regarding <pojo/> vs. @name usage... +--> +<!ELEMENT joined-subclass ( + meta*, + subselect?, + synchronize*, + comment?, + tuplizer*, + key, + (property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*, + joined-subclass*, + loader?,sql-insert?,sql-update?,sql-delete?, + resultset*, + (query|sql-query)* +)> + <!ATTLIST joined-subclass entity-name CDATA #IMPLIED> + <!ATTLIST joined-subclass name CDATA #IMPLIED> + <!ATTLIST joined-subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface --> + <!ATTLIST joined-subclass table CDATA #IMPLIED> <!-- default: unqualified class name --> + <!ATTLIST joined-subclass schema CDATA #IMPLIED> + <!ATTLIST joined-subclass catalog CDATA #IMPLIED> + <!ATTLIST joined-subclass subselect CDATA #IMPLIED> + <!ATTLIST joined-subclass dynamic-update (true|false) "false"> + <!ATTLIST joined-subclass dynamic-insert (true|false) "false"> + <!ATTLIST joined-subclass select-before-update (true|false) "false"> + <!ATTLIST joined-subclass extends CDATA #IMPLIED> <!-- default: none when toplevel, otherwise the nearest class definition --> + <!ATTLIST joined-subclass lazy (true|false) #IMPLIED> + <!ATTLIST joined-subclass abstract (true|false) #IMPLIED> + <!ATTLIST joined-subclass persister CDATA #IMPLIED> + <!ATTLIST joined-subclass check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST joined-subclass batch-size CDATA #IMPLIED> + <!ATTLIST joined-subclass node CDATA #IMPLIED> + +<!-- + Union subclasses are used for the table-per-concrete-class mapping strategy + + See the note on the class element regarding <pojo/> vs. @name usage... +--> +<!ELEMENT union-subclass ( + meta*, + subselect?, + synchronize*, + comment?, + tuplizer*, + (property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*, + union-subclass*, + loader?,sql-insert?,sql-update?,sql-delete?, + resultset*, + (query|sql-query)* +)> + <!ATTLIST union-subclass entity-name CDATA #IMPLIED> + <!ATTLIST union-subclass name CDATA #IMPLIED> + <!ATTLIST union-subclass proxy CDATA #IMPLIED> <!-- default: no proxy interface --> + <!ATTLIST union-subclass table CDATA #IMPLIED> <!-- default: unqualified class name --> + <!ATTLIST union-subclass schema CDATA #IMPLIED> + <!ATTLIST union-subclass catalog CDATA #IMPLIED> + <!ATTLIST union-subclass subselect CDATA #IMPLIED> + <!ATTLIST union-subclass dynamic-update (true|false) "false"> + <!ATTLIST union-subclass dynamic-insert (true|false) "false"> + <!ATTLIST union-subclass select-before-update (true|false) "false"> + <!ATTLIST union-subclass extends CDATA #IMPLIED> <!-- default: none when toplevel, otherwise the nearest class definition --> + <!ATTLIST union-subclass lazy (true|false) #IMPLIED> + <!ATTLIST union-subclass abstract (true|false) #IMPLIED> + <!ATTLIST union-subclass persister CDATA #IMPLIED> + <!ATTLIST union-subclass check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST union-subclass batch-size CDATA #IMPLIED> + <!ATTLIST union-subclass node CDATA #IMPLIED> + +<!-- Property of an entity class or component, component-element, composite-id, etc. +JavaBeans style properties are mapped to table columns. --> + +<!ELEMENT property (meta*,(column|formula)*,type?)> + <!ATTLIST property name CDATA #REQUIRED> + <!ATTLIST property node CDATA #IMPLIED> + <!ATTLIST property access CDATA #IMPLIED> + <!ATTLIST property type CDATA #IMPLIED> + <!ATTLIST property column CDATA #IMPLIED> + <!ATTLIST property length CDATA #IMPLIED> + <!ATTLIST property precision CDATA #IMPLIED> + <!ATTLIST property scale CDATA #IMPLIED> + <!ATTLIST property not-null (true|false) #IMPLIED> + <!ATTLIST property unique (true|false) "false"> + <!ATTLIST property unique-key CDATA #IMPLIED> + <!ATTLIST property index CDATA #IMPLIED> <!-- include the columns spanned by this property in an index --> + <!ATTLIST property update (true|false) #IMPLIED> + <!ATTLIST property insert (true|false) #IMPLIED> + <!ATTLIST property optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST property formula CDATA #IMPLIED> + <!ATTLIST property lazy (true|false) "false"> + <!ATTLIST property generated (never|insert|always) "never"> + +<!-- Declares the type of the containing property (overrides an eventually existing type +attribute of the property). May contain param elements to customize a ParametrizableType. --> +<!ELEMENT type (param*)> + <!ATTLIST type name CDATA #REQUIRED> + +<!-- Declares an association between two entities (Or from a component, component element, +etc. to an entity). --> + +<!ELEMENT many-to-one (meta*,(column|formula)*)> + <!ATTLIST many-to-one name CDATA #REQUIRED> + <!ATTLIST many-to-one access CDATA #IMPLIED> + <!ATTLIST many-to-one class CDATA #IMPLIED> + <!ATTLIST many-to-one entity-name CDATA #IMPLIED> + <!ATTLIST many-to-one column CDATA #IMPLIED> + <!ATTLIST many-to-one not-null (true|false) #IMPLIED> + <!ATTLIST many-to-one unique (true|false) "false"> + <!ATTLIST many-to-one unique-key CDATA #IMPLIED> + <!ATTLIST many-to-one index CDATA #IMPLIED> + <!ATTLIST many-to-one cascade CDATA #IMPLIED> + <!ATTLIST many-to-one outer-join (true|false|auto) #IMPLIED> + <!ATTLIST many-to-one fetch (join|select) #IMPLIED> + <!ATTLIST many-to-one update (true|false) "true"> + <!ATTLIST many-to-one insert (true|false) "true"> + <!ATTLIST many-to-one optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST many-to-one foreign-key CDATA #IMPLIED> + <!ATTLIST many-to-one property-ref CDATA #IMPLIED> + <!ATTLIST many-to-one formula CDATA #IMPLIED> + <!ATTLIST many-to-one lazy (false|proxy|no-proxy) #IMPLIED> + <!ATTLIST many-to-one not-found (exception|ignore) "exception"> + <!ATTLIST many-to-one node CDATA #IMPLIED> + <!ATTLIST many-to-one embed-xml (true|false) "true"> + +<!-- Declares a one-to-one association between two entities (Or from a component, +component element, etc. to an entity). --> + +<!ELEMENT one-to-one (meta*,formula*)> + <!ATTLIST one-to-one name CDATA #REQUIRED> + <!ATTLIST one-to-one formula CDATA #IMPLIED> + <!ATTLIST one-to-one access CDATA #IMPLIED> + <!ATTLIST one-to-one class CDATA #IMPLIED> + <!ATTLIST one-to-one entity-name CDATA #IMPLIED> + <!ATTLIST one-to-one cascade CDATA #IMPLIED> + <!ATTLIST one-to-one outer-join (true|false|auto) #IMPLIED> + <!ATTLIST one-to-one fetch (join|select) #IMPLIED> + <!ATTLIST one-to-one constrained (true|false) "false"> + <!ATTLIST one-to-one foreign-key CDATA #IMPLIED> + <!ATTLIST one-to-one property-ref CDATA #IMPLIED> + <!ATTLIST one-to-one lazy (false|proxy|no-proxy) #IMPLIED> + <!ATTLIST one-to-one node CDATA #IMPLIED> + <!ATTLIST one-to-one embed-xml (true|false) "true"> + +<!-- A property embedded in a composite identifier or map index (always not-null). --> + +<!ELEMENT key-property (meta*,column*,type?)> + <!ATTLIST key-property name CDATA #REQUIRED> + <!ATTLIST key-property access CDATA #IMPLIED> + <!ATTLIST key-property type CDATA #IMPLIED> + <!ATTLIST key-property column CDATA #IMPLIED> + <!ATTLIST key-property length CDATA #IMPLIED> + <!ATTLIST key-property node CDATA #IMPLIED> + +<!-- A many-to-one association embedded in a composite identifier or map index +(always not-null, never cascade). --> + +<!ELEMENT key-many-to-one (meta*,column*)> + <!ATTLIST key-many-to-one name CDATA #REQUIRED> + <!ATTLIST key-many-to-one access CDATA #IMPLIED> + <!ATTLIST key-many-to-one class CDATA #IMPLIED> + <!ATTLIST key-many-to-one entity-name CDATA #IMPLIED> + <!ATTLIST key-many-to-one column CDATA #IMPLIED> + <!ATTLIST key-many-to-one foreign-key CDATA #IMPLIED> + <!ATTLIST key-many-to-one lazy (false|proxy) #IMPLIED> + +<!-- An "any" association is a polymorphic association to any table with +the given identifier type. The first listed column is a VARCHAR column +holding the name of the class (for that row). --> + +<!ELEMENT any (meta*,meta-value*,column,column+)> + <!ATTLIST any id-type CDATA #REQUIRED> + <!ATTLIST any meta-type CDATA #IMPLIED> <!--- default: Hibernate.STRING --> + <!ATTLIST any name CDATA #REQUIRED> + <!ATTLIST any access CDATA #IMPLIED> + <!ATTLIST any insert (true|false) "true"> + <!ATTLIST any update (true|false) "true"> + <!ATTLIST any cascade CDATA #IMPLIED> + <!ATTLIST any index CDATA #IMPLIED> <!-- include the columns spanned by this association in an index --> + <!ATTLIST any optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST any lazy (true|false) "false"> + <!ATTLIST any node CDATA #IMPLIED> + +<!ELEMENT meta-value EMPTY> + <!ATTLIST meta-value value CDATA #REQUIRED> + <!ATTLIST meta-value class CDATA #REQUIRED> + +<!-- A component is a user-defined class, persisted along with its containing entity +to the table of the entity class. JavaBeans style properties of the component are +mapped to columns of the table of the containing entity. A null component reference +is mapped to null values in all columns and vice versa. Components do not support +shared reference semantics. --> + +<!ELEMENT component ( + meta*, + tuplizer*, + parent?, + (property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|array|primitive-array)* +)> + <!ATTLIST component class CDATA #IMPLIED> + <!ATTLIST component name CDATA #REQUIRED> + <!ATTLIST component access CDATA #IMPLIED> + <!ATTLIST component unique (true|false) "false"> + <!ATTLIST component update (true|false) "true"> + <!ATTLIST component insert (true|false) "true"> + <!ATTLIST component lazy (true|false) "false"> + <!ATTLIST component optimistic-lock (true|false) "true"> + <!ATTLIST component node CDATA #IMPLIED> + +<!-- A dynamic-component maps columns of the database entity to a java.util.Map +at the Java level --> + +<!ELEMENT dynamic-component ( + (property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|array|primitive-array)* +)> + <!ATTLIST dynamic-component name CDATA #REQUIRED> + <!ATTLIST dynamic-component access CDATA #IMPLIED> + <!ATTLIST dynamic-component unique (true|false) "false"> + <!ATTLIST dynamic-component update (true|false) "true"> + <!ATTLIST dynamic-component insert (true|false) "true"> + <!ATTLIST dynamic-component optimistic-lock (true|false) "true"> + <!ATTLIST dynamic-component node CDATA #IMPLIED> + +<!-- properties declares that the contained properties form an alternate key. The name +attribute allows an alternate key to be used as the target of a property-ref. --> + +<!ELEMENT properties ( + (property|many-to-one|component|dynamic-component)* +)> + <!ATTLIST properties name CDATA #REQUIRED> + <!ATTLIST properties unique (true|false) "false"> + <!ATTLIST properties insert (true|false) "true"> + <!ATTLIST properties update (true|false) "true"> + <!ATTLIST properties optimistic-lock (true|false) "true"> + <!ATTLIST properties node CDATA #IMPLIED> + +<!-- The parent element maps a property of the component class as a pointer back to +the owning entity. --> + +<!ELEMENT parent EMPTY> + <!ATTLIST parent name CDATA #REQUIRED> + +<!-- Collection declarations nested inside a class declaration indicate a foreign key +relationship from the collection table to the enclosing class. --> + +<!ELEMENT map ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + key, + (map-key|composite-map-key|map-key-many-to-many|index|composite-index|index-many-to-many|index-many-to-any), + (element|one-to-many|many-to-many|composite-element|many-to-any), + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?, + filter* +)> + <!ATTLIST map name CDATA #REQUIRED> + <!ATTLIST map access CDATA #IMPLIED> + <!ATTLIST map table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST map schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST map subselect CDATA #IMPLIED> + <!ATTLIST map catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST map lazy (true|false|extra) #IMPLIED> + <!ATTLIST map mutable (true|false) "true"> + <!ATTLIST map inverse (true|false) "false"> + <!ATTLIST map sort CDATA "unsorted"> <!-- unsorted|natural|"comparator class", default: unsorted --> + <!ATTLIST map cascade CDATA #IMPLIED> + <!ATTLIST map order-by CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST map where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST map batch-size CDATA #IMPLIED> + <!ATTLIST map outer-join (true|false|auto) #IMPLIED> + <!ATTLIST map fetch (join|select|subselect) #IMPLIED> + <!ATTLIST map check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST map persister CDATA #IMPLIED> + <!ATTLIST map collection-type CDATA #IMPLIED> + <!ATTLIST map optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST map node CDATA #IMPLIED> + <!ATTLIST map embed-xml (true|false) "true"> + +<!ELEMENT set ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + key, + (element|one-to-many|many-to-many|composite-element|many-to-any), + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?, + filter* +)> + <!ATTLIST set name CDATA #REQUIRED> + <!ATTLIST set access CDATA #IMPLIED> + <!ATTLIST set table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST set schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST set catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST set subselect CDATA #IMPLIED> + <!ATTLIST set lazy (true|false|extra) #IMPLIED> + <!ATTLIST set sort CDATA "unsorted"> <!-- unsorted|natural|"comparator class" --> + <!ATTLIST set inverse (true|false) "false"> + <!ATTLIST set mutable (true|false) "true"> + <!ATTLIST set cascade CDATA #IMPLIED> + <!ATTLIST set order-by CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST set where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST set batch-size CDATA #IMPLIED> + <!ATTLIST set outer-join (true|false|auto) #IMPLIED> + <!ATTLIST set fetch (join|select|subselect) #IMPLIED> + <!ATTLIST set persister CDATA #IMPLIED> + <!ATTLIST set collection-type CDATA #IMPLIED> + <!ATTLIST set check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST set optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST set node CDATA #IMPLIED> + <!ATTLIST set embed-xml (true|false) "true"> + +<!ELEMENT bag ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + key, + (element|one-to-many|many-to-many|composite-element|many-to-any), + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?, + filter* +)> + <!ATTLIST bag name CDATA #REQUIRED> + <!ATTLIST bag access CDATA #IMPLIED> + <!ATTLIST bag table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST bag schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST bag catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST bag subselect CDATA #IMPLIED> + <!ATTLIST bag lazy (true|false|extra) #IMPLIED> + <!ATTLIST bag inverse (true|false) "false"> + <!ATTLIST bag mutable (true|false) "true"> + <!ATTLIST bag cascade CDATA #IMPLIED> + <!ATTLIST bag order-by CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST bag where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST bag batch-size CDATA #IMPLIED> + <!ATTLIST bag outer-join (true|false|auto) #IMPLIED> + <!ATTLIST bag fetch (join|select|subselect) #IMPLIED> + <!ATTLIST bag persister CDATA #IMPLIED> + <!ATTLIST bag collection-type CDATA #IMPLIED> + <!ATTLIST bag check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST bag optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST bag node CDATA #IMPLIED> + <!ATTLIST bag embed-xml (true|false) "true"> + +<!ELEMENT idbag ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + collection-id, + key, + (element|many-to-many|composite-element|many-to-any), + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?, + filter* +)> + <!ATTLIST idbag name CDATA #REQUIRED> + <!ATTLIST idbag access CDATA #IMPLIED> + <!ATTLIST idbag table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST idbag schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST idbag catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST idbag subselect CDATA #IMPLIED> + <!ATTLIST idbag lazy (true|false|extra) #IMPLIED> + <!ATTLIST idbag mutable (true|false) "true"> + <!ATTLIST idbag cascade CDATA #IMPLIED> + <!ATTLIST idbag order-by CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST idbag where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST idbag batch-size CDATA #IMPLIED> + <!ATTLIST idbag outer-join (true|false|auto) #IMPLIED> + <!ATTLIST idbag fetch (join|select|subselect) #IMPLIED> + <!ATTLIST idbag persister CDATA #IMPLIED> + <!ATTLIST idbag collection-type CDATA #IMPLIED> + <!ATTLIST idbag check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST idbag optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST idbag node CDATA #IMPLIED> + <!ATTLIST idbag embed-xml (true|false) "true"> + +<!ELEMENT list ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + key, + (index|list-index), + (element|one-to-many|many-to-many|composite-element|many-to-any), + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?, + filter* +)> + <!ATTLIST list name CDATA #REQUIRED> + <!ATTLIST list access CDATA #IMPLIED> + <!ATTLIST list table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST list schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST list catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST list subselect CDATA #IMPLIED> + <!ATTLIST list lazy (true|false|extra) #IMPLIED> + <!ATTLIST list inverse (true|false) "false"> + <!ATTLIST list mutable (true|false) "true"> + <!ATTLIST list cascade CDATA #IMPLIED> + <!ATTLIST list where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST list batch-size CDATA #IMPLIED> + <!ATTLIST list outer-join (true|false|auto) #IMPLIED> + <!ATTLIST list fetch (join|select|subselect) #IMPLIED> + <!ATTLIST list persister CDATA #IMPLIED> + <!ATTLIST list collection-type CDATA #IMPLIED> + <!ATTLIST list check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST list optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST list node CDATA #IMPLIED> + <!ATTLIST list embed-xml (true|false) "true"> + +<!ELEMENT array ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + key, + (index|list-index), + (element|one-to-many|many-to-many|composite-element|many-to-any), + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all? +)> + <!ATTLIST array name CDATA #REQUIRED> + <!ATTLIST array access CDATA #IMPLIED> + <!ATTLIST array table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST array schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST array catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST array subselect CDATA #IMPLIED> + <!ATTLIST array inverse (true|false) "false"> + <!ATTLIST array mutable (true|false) "true"> + <!ATTLIST array element-class CDATA #IMPLIED> + <!ATTLIST array cascade CDATA #IMPLIED> + <!ATTLIST array where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST array batch-size CDATA #IMPLIED> + <!ATTLIST array outer-join (true|false|auto) #IMPLIED> + <!ATTLIST array fetch (join|select|subselect) #IMPLIED> + <!ATTLIST array persister CDATA #IMPLIED> + <!ATTLIST array collection-type CDATA #IMPLIED> + <!ATTLIST array check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST array optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST array node CDATA #IMPLIED> + <!ATTLIST array embed-xml (true|false) "true"> + +<!ELEMENT primitive-array ( + meta*, + subselect?, + cache?, + synchronize*, + comment?, + key, + (index|list-index), + element, + loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all? +)> + <!ATTLIST primitive-array name CDATA #REQUIRED> + <!ATTLIST primitive-array access CDATA #IMPLIED> + <!ATTLIST primitive-array table CDATA #IMPLIED> <!-- default: name --> + <!ATTLIST primitive-array schema CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST primitive-array catalog CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST primitive-array subselect CDATA #IMPLIED> + <!ATTLIST primitive-array mutable (true|false) "true"> + <!ATTLIST primitive-array where CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST primitive-array batch-size CDATA #IMPLIED> + <!ATTLIST primitive-array outer-join (true|false|auto) #IMPLIED> + <!ATTLIST primitive-array fetch (join|select|subselect) #IMPLIED> + <!ATTLIST primitive-array persister CDATA #IMPLIED> + <!ATTLIST primitive-array collection-type CDATA #IMPLIED> + <!ATTLIST primitive-array check CDATA #IMPLIED> <!-- default: none --> + <!ATTLIST primitive-array optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) --> + <!ATTLIST primitive-array node CDATA #IMPLIED> + <!ATTLIST primitive-array embed-xml (true|false) "true"> + +<!-- Declares the element type of a collection of basic type --> + +<!ELEMENT element ( (column|formula)*, type? )> + <!ATTLIST element column CDATA #IMPLIED> + <!ATTLIST element node CDATA #IMPLIED> + <!ATTLIST element formula CDATA #IMPLIED> + <!ATTLIST element type CDATA #IMPLIED> + <!ATTLIST element length CDATA #IMPLIED> + <!ATTLIST element precision CDATA #IMPLIED> + <!ATTLIST element scale CDATA #IMPLIED> + <!ATTLIST element not-null (true|false) "false"> + <!ATTLIST element unique (true|false) "false"> + +<!-- One to many association. This tag declares the entity-class +element type of a collection and specifies a one-to-many relational model --> + +<!ELEMENT one-to-many EMPTY> + <!ATTLIST one-to-many class CDATA #IMPLIED> + <!ATTLIST one-to-many not-found (exception|ignore) "exception"> + <!ATTLIST one-to-many node CDATA #IMPLIED> + <!ATTLIST one-to-many embed-xml (true|false) "true"> + <!ATTLIST one-to-many entity-name CDATA #IMPLIED> + <!-- No column declaration attributes required in this case. The primary + key column of the associated class is already mapped elsewhere.--> + +<!-- Many to many association. This tag declares the entity-class +element type of a collection and specifies a many-to-many relational model --> + +<!ELEMENT many-to-many (meta*,(column|formula)*,filter*)> + <!ATTLIST many-to-many class CDATA #IMPLIED> + <!ATTLIST many-to-many node CDATA #IMPLIED> + <!ATTLIST many-to-many embed-xml (true|false) "true"> + <!ATTLIST many-to-many entity-name CDATA #IMPLIED> + <!ATTLIST many-to-many column CDATA #IMPLIED> + <!ATTLIST many-to-many formula CDATA #IMPLIED> + <!ATTLIST many-to-many not-found (exception|ignore) "exception"> + <!ATTLIST many-to-many outer-join (true|false|auto) #IMPLIED> + <!ATTLIST many-to-many fetch (join|select) #IMPLIED> + <!ATTLIST many-to-many lazy (false|proxy) #IMPLIED> + <!ATTLIST many-to-many foreign-key CDATA #IMPLIED> + <!ATTLIST many-to-many unique (true|false) "false"> + <!ATTLIST many-to-many where CDATA #IMPLIED> + <!ATTLIST many-to-many order-by CDATA #IMPLIED> + <!ATTLIST many-to-many property-ref CDATA #IMPLIED> + +<!-- A composite element allows a collection to hold instances of an arbitrary +class, without the requirement of joining to an entity table. Composite elements +have component semantics - no shared references and ad hoc null value semantics. +Composite elements may not hold nested collections. --> + +<!ELEMENT composite-element ( + (meta*), + parent?, + (property|many-to-one|any|nested-composite-element)* +)> + <!ATTLIST composite-element class CDATA #REQUIRED> + <!ATTLIST composite-element node CDATA #IMPLIED> + +<!ELEMENT nested-composite-element ( + parent?, + (property|many-to-one|any|nested-composite-element)* +)> + <!ATTLIST nested-composite-element class CDATA #REQUIRED> + <!ATTLIST nested-composite-element name CDATA #REQUIRED> + <!ATTLIST nested-composite-element access CDATA #IMPLIED> + <!ATTLIST nested-composite-element node CDATA #IMPLIED> + +<!-- Declares the column name of a foreign key. --> + +<!ELEMENT key (column*)> + <!ATTLIST key column CDATA #IMPLIED> + <!ATTLIST key property-ref CDATA #IMPLIED> + <!ATTLIST key foreign-key CDATA #IMPLIED> + <!ATTLIST key on-delete (cascade|noaction) "noaction"> + <!ATTLIST key not-null (true|false) #IMPLIED> + <!ATTLIST key update (true|false) #IMPLIED> + <!ATTLIST key unique (true|false) #IMPLIED> + +<!-- Declares the type and column mapping for a collection index (array or +list index, or key of a map). --> + +<!ELEMENT list-index (column?)> + <!ATTLIST list-index column CDATA #IMPLIED> + <!ATTLIST list-index base CDATA "0"> + +<!ELEMENT map-key ((column|formula)*)> + <!ATTLIST map-key column CDATA #IMPLIED> + <!ATTLIST map-key formula CDATA #IMPLIED> + <!ATTLIST map-key type CDATA #REQUIRED> + <!ATTLIST map-key length CDATA #IMPLIED> + <!ATTLIST map-key node CDATA #IMPLIED> + +<!ELEMENT index (column*)> + <!ATTLIST index column CDATA #IMPLIED> + <!ATTLIST index type CDATA #IMPLIED> <!-- required for maps --> + <!ATTLIST index length CDATA #IMPLIED> + +<!-- Many to many association mapped to the key of a map. ie. a map keyed +on entities. --> + +<!ELEMENT map-key-many-to-many ((column|formula)*)> + <!ATTLIST map-key-many-to-many class CDATA #IMPLIED> + <!ATTLIST map-key-many-to-many entity-name CDATA #IMPLIED> + <!ATTLIST map-key-many-to-many column CDATA #IMPLIED> + <!ATTLIST map-key-many-to-many formula CDATA #IMPLIED> + <!ATTLIST map-key-many-to-many foreign-key CDATA #IMPLIED> + +<!ELEMENT index-many-to-many (column*)> + <!ATTLIST index-many-to-many class CDATA #REQUIRED> + <!ATTLIST index-many-to-many entity-name CDATA #IMPLIED> + <!ATTLIST index-many-to-many column CDATA #IMPLIED> + <!ATTLIST index-many-to-many foreign-key CDATA #IMPLIED> + +<!-- Composite index of a map ie. a map keyed on components. --> + +<!ELEMENT composite-map-key ( (key-property|key-many-to-one)+ )> + <!ATTLIST composite-map-key class CDATA #REQUIRED> + +<!ELEMENT composite-index ( (key-property|key-many-to-one)+ )> + <!ATTLIST composite-index class CDATA #REQUIRED> + +<!-- A "many to any" defines a polymorphic association to any table +with the given identifier type. The first listed column is a VARCHAR column +holding the name of the class (for that row). --> + +<!ELEMENT many-to-any (meta-value*,column, column+)> + <!ATTLIST many-to-any id-type CDATA #REQUIRED> + <!ATTLIST many-to-any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS --> + +<!ELEMENT index-many-to-any (column, column+)> + <!ATTLIST index-many-to-any id-type CDATA #REQUIRED> + <!ATTLIST index-many-to-any meta-type CDATA #IMPLIED> <!--- default: Hibernate.CLASS --> + +<!ELEMENT collection-id (meta*, column*, generator)> + <!ATTLIST collection-id column CDATA #REQUIRED> + <!ATTLIST collection-id type CDATA #REQUIRED> + <!ATTLIST collection-id length CDATA #IMPLIED> + +<!-- Generators generate unique identifiers. The class attribute specifies a Java +class implementing an id generation algorithm. --> + +<!ELEMENT generator (param*)> + <!ATTLIST generator class CDATA #REQUIRED> +<!ELEMENT param (#PCDATA)> + <!ATTLIST param name CDATA #REQUIRED> + +<!-- The column element is an alternative to column attributes and required for +mapping associations to classes with composite ids. --> + +<!ELEMENT column (comment?)> + <!ATTLIST column name CDATA #REQUIRED> + <!ATTLIST column length CDATA #IMPLIED> <!-- default: 255 --> + <!ATTLIST column precision CDATA #IMPLIED> + <!ATTLIST column scale CDATA #IMPLIED> + <!ATTLIST column not-null (true|false) #IMPLIED> <!-- default: false (except for id properties) --> + <!ATTLIST column unique (true|false) #IMPLIED> <!-- default: false (except for id properties) --> + <!ATTLIST column unique-key CDATA #IMPLIED> <!-- default: no unique key --> + <!ATTLIST column sql-type CDATA #IMPLIED> <!-- override default column type for hibernate type --> + <!ATTLIST column index CDATA #IMPLIED> + <!ATTLIST column check CDATA #IMPLIED> <!-- default: no check constraint --> + <!ATTLIST column default CDATA #IMPLIED> <!-- default: no default value --> + +<!-- The formula and subselect elements allow us to map derived properties and +entities. --> + +<!ELEMENT formula (#PCDATA)> +<!ELEMENT subselect (#PCDATA)> + +<!-- The cache element enables caching of an entity class. --> +<!ELEMENT cache EMPTY> + <!ATTLIST cache usage (read-only|read-write|nonstrict-read-write|transactional) #REQUIRED> + <!ATTLIST cache region CDATA #IMPLIED> <!-- default: class or collection role name --> + <!ATTLIST cache include (all|non-lazy) "all"> + +<!-- The comment element allows definition of a database table or column comment. --> + +<!ELEMENT comment (#PCDATA)> + +<!-- The loader element allows specification of a named query to be used for fetching +an entity or collection --> + +<!ELEMENT loader EMPTY> + <!ATTLIST loader query-ref CDATA #REQUIRED> + +<!-- The query element declares a named Hibernate query string --> + +<!ELEMENT query (#PCDATA|query-param)*> + <!ATTLIST query name CDATA #REQUIRED> + <!ATTLIST query flush-mode (auto|never|always) #IMPLIED> + <!ATTLIST query cacheable (true|false) "false"> + <!ATTLIST query cache-region CDATA #IMPLIED> + <!ATTLIST query fetch-size CDATA #IMPLIED> + <!ATTLIST query timeout CDATA #IMPLIED> + <!ATTLIST query cache-mode (get|ignore|normal|put|refresh) #IMPLIED> + <!ATTLIST query read-only (true|false) #IMPLIED> + <!ATTLIST query comment CDATA #IMPLIED> + +<!-- The sql-query element declares a named SQL query string --> + +<!ELEMENT sql-query (#PCDATA|return-scalar|return|return-join|load-collection|synchronize|query-param)*> + <!ATTLIST sql-query name CDATA #REQUIRED> + <!ATTLIST sql-query resultset-ref CDATA #IMPLIED> + <!ATTLIST sql-query flush-mode (auto|never|always) #IMPLIED> + <!ATTLIST sql-query cacheable (true|false) "false"> + <!ATTLIST sql-query cache-region CDATA #IMPLIED> + <!ATTLIST sql-query fetch-size CDATA #IMPLIED> + <!ATTLIST sql-query timeout CDATA #IMPLIED> + <!ATTLIST sql-query cache-mode (get|ignore|normal|put|refresh) #IMPLIED> + <!ATTLIST sql-query read-only (true|false) #IMPLIED> + <!ATTLIST sql-query comment CDATA #IMPLIED> + <!ATTLIST sql-query callable (true|false) "false"> + +<!-- The query-param element is used only by tools that generate +finder methods for named queries --> + +<!ELEMENT query-param EMPTY> + <!ATTLIST query-param name CDATA #REQUIRED> + <!ATTLIST query-param type CDATA #REQUIRED> + +<!-- The resultset element declares a named resultset mapping definition for SQL queries --> +<!ELEMENT resultset (return-scalar|return|return-join|load-collection)*> + <!ATTLIST resultset name CDATA #REQUIRED> + +<!-- + Defines a return component for a sql-query. Alias refers to the alias + used in the actual sql query; lock-mode specifies the locking to be applied + when the query is executed. The class, collection, and role attributes are mutually exclusive; + class refers to the class name of a "root entity" in the object result; collection refers + to a collection of a given class and is used to define custom sql to load that owned collection + and takes the form "ClassName.propertyName"; role refers to the property path for an eager fetch + and takes the form "owningAlias.propertyName" +--> +<!ELEMENT return (return-discriminator?,return-property)*> + <!ATTLIST return alias CDATA #IMPLIED> + <!ATTLIST return entity-name CDATA #IMPLIED> + <!ATTLIST return class CDATA #IMPLIED> + <!ATTLIST return lock-mode (none|read|upgrade|upgrade-nowait|write) "read"> + +<!ELEMENT return-property (return-column*)> + <!ATTLIST return-property name CDATA #REQUIRED> + <!ATTLIST return-property column CDATA #IMPLIED> + +<!ELEMENT return-column EMPTY> + <!ATTLIST return-column name CDATA #REQUIRED> + +<!ELEMENT return-discriminator EMPTY> + <!ATTLIST return-discriminator column CDATA #REQUIRED> + +<!ELEMENT return-join (return-property)*> + <!ATTLIST return-join alias CDATA #REQUIRED> + <!ATTLIST return-join property CDATA #REQUIRED> + <!ATTLIST return-join lock-mode (none|read|upgrade|upgrade-nowait|write) "read"> + +<!ELEMENT load-collection (return-property)*> + <!ATTLIST load-collection alias CDATA #REQUIRED> + <!ATTLIST load-collection role CDATA #REQUIRED> + <!ATTLIST load-collection lock-mode (none|read|upgrade|upgrade-nowait|write) "read"> + +<!ELEMENT return-scalar EMPTY> + <!ATTLIST return-scalar column CDATA #REQUIRED> + <!ATTLIST return-scalar type CDATA #IMPLIED> + +<!ELEMENT synchronize EMPTY> + <!ATTLIST synchronize table CDATA #REQUIRED> + +<!-- custom sql operations --> +<!ELEMENT sql-insert (#PCDATA)> + <!ATTLIST sql-insert callable (true|false) "false"> + <!ATTLIST sql-insert check (none|rowcount|param) #IMPLIED> + +<!ELEMENT sql-update (#PCDATA)> + <!ATTLIST sql-update callable (true|false) "false"> + <!ATTLIST sql-update check (none|rowcount|param) #IMPLIED> + +<!ELEMENT sql-delete (#PCDATA)> + <!ATTLIST sql-delete callable (true|false) "false"> + <!ATTLIST sql-delete check (none|rowcount|param) #IMPLIED> + +<!ELEMENT sql-delete-all (#PCDATA)> + <!ATTLIST sql-delete-all callable (true|false) "false"> + <!ATTLIST sql-delete-all check (none|rowcount|param) #IMPLIED> + +<!-- + Element for defining "auxiliary" database objects. Must be one of two forms: + + #1 : + <database-object> + <definition class="CustomClassExtendingAuxiliaryObject"/> + </database-object> + + #2 : + <database-object> + <create>CREATE OR REPLACE ....</create> + <drop>DROP ....</drop> + </database-object> +--> +<!ELEMENT database-object ( (definition|(create,drop)), dialect-scope* )> + +<!ELEMENT definition EMPTY> + <!ATTLIST definition class CDATA #REQUIRED> + +<!ELEMENT create (#PCDATA)> +<!ELEMENT drop (#PCDATA)> + +<!-- + dialect-scope element allows scoping auxiliary-objects to a particular + Hibernate dialect implementation. +--> +<!ELEMENT dialect-scope (#PCDATA)> + <!ATTLIST dialect-scope name CDATA #REQUIRED> + diff --git a/xml/tests/testData/documentation/j2ee_1_4.xsd b/xml/tests/testData/documentation/j2ee_1_4.xsd new file mode 100644 index 000000000000..3955cef2982a --- /dev/null +++ b/xml/tests/testData/documentation/j2ee_1_4.xsd @@ -0,0 +1,1607 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema + targetNamespace="http://java.sun.com/xml/ns/j2ee" + xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="1.4"> + <xsd:annotation> + <xsd:documentation> + @(#)j2ee_1_4.xsds 1.43 03/09/16 + </xsd:documentation> + </xsd:annotation> + + <xsd:annotation> + <xsd:documentation> + + Copyright 2003 Sun Microsystems, Inc., 901 San Antonio + Road, Palo Alto, California 94303, U.S.A. All rights + reserved. + + Sun Microsystems, Inc. has intellectual property rights + relating to technology described in this document. In + particular, and without limitation, these intellectual + property rights may include one or more of the U.S. patents + listed at http://www.sun.com/patents and one or more + additional patents or pending patent applications in the + U.S. and other countries. + + This document and the technology which it describes are + distributed under licenses restricting their use, copying, + distribution, and decompilation. No part of this document + may be reproduced in any form by any means without prior + written authorization of Sun and its licensors, if any. + + Third-party software, including font technology, is + copyrighted and licensed from Sun suppliers. + + Sun, Sun Microsystems, the Sun logo, Solaris, Java, J2EE, + JavaServer Pages, Enterprise JavaBeans and the Java Coffee + Cup logo are trademarks or registered trademarks of Sun + Microsystems, Inc. in the U.S. and other countries. + + Federal Acquisitions: Commercial Software - Government Users + Subject to Standard License Terms and Conditions. + + </xsd:documentation> + </xsd:annotation> + +<xsd:annotation> +<xsd:documentation> + +The following definitions that appear in the common +shareable schema(s) of J2EE deployment descriptors should be +interpreted with respect to the context they are included: + +Deployment Component may indicate one of the following: + j2ee application; + application client; + web application; + enterprise bean; + resource adapter; + +Deployment File may indicate one of the following: + ear file; + war file; + jar file; + rar file; + +</xsd:documentation> +</xsd:annotation> + + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + + <xsd:include schemaLocation= + "http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd"/> + + +<!-- **************************************************** --> + + <xsd:group name="descriptionGroup"> + <xsd:annotation> + <xsd:documentation> + + This group keeps the usage of the contained description related + elements consistent across J2EE deployment descriptors. + + All elements may occur multiple times with different languages, + to support localization of the content. + + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="display-name" + type="j2ee:display-nameType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="icon" + type="j2ee:iconType" + minOccurs="0" + maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:group> + +<!-- **************************************************** --> + + <xsd:complexType name="descriptionType"> + <xsd:annotation> + <xsd:documentation> + + The description type is used by a description element to + provide text describing the parent element. The elements + that use this type should include any information that the + Deployment Component's Deployment File file producer wants + to provide to the consumer of the Deployment Component's + Deployment File (i.e., to the Deployer). Typically, the + tools used by such a Deployment File consumer will display + the description when processing the parent element that + contains the description. + + The lang attribute defines the language that the + description is provided in. The default value is "en" (English). + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="j2ee:xsdStringType"> + <xsd:attribute ref="xml:lang"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:simpleType name="dewey-versionType"> + <xsd:annotation> + <xsd:documentation> + + This type defines a dewey decimal which is used + to describe versions of documents. + + </xsd:documentation> + </xsd:annotation> + + <xsd:restriction base="xsd:decimal"> + <xsd:whiteSpace value="collapse"/> + </xsd:restriction> + + </xsd:simpleType> + +<!-- **************************************************** --> + + <xsd:complexType name="display-nameType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The display-name type contains a short name that is intended + to be displayed by tools. It is used by display-name + elements. The display name need not be unique. + + Example: + + ... + <display-name xml:lang="en">Employee Self Service</display-name> + + The value of the xml:lang attribute is "en" (English) by default. + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="j2ee:string"> + <xsd:attribute ref="xml:lang"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="ejb-linkType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The ejb-linkType is used by ejb-link + elements in the ejb-ref or ejb-local-ref elements to specify + that an EJB reference is linked to enterprise bean. + + The value of the ejb-link element must be the ejb-name of an + enterprise bean in the same ejb-jar file or in another ejb-jar + file in the same J2EE application unit. + + Alternatively, the name in the ejb-link element may be + composed of a path name specifying the ejb-jar containing the + referenced enterprise bean with the ejb-name of the target + bean appended and separated from the path name by "#". The + path name is relative to the Deployment File containing + Deployment Component that is referencing the enterprise + bean. This allows multiple enterprise beans with the same + ejb-name to be uniquely identified. + + Examples: + + <ejb-link>EmployeeRecord</ejb-link> + + <ejb-link>../products/product.jar#ProductEJB</ejb-link> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="ejb-local-refType"> + <xsd:annotation> + <xsd:documentation> + + The ejb-local-refType is used by ejb-local-ref elements for + the declaration of a reference to an enterprise bean's local + home. The declaration consists of: + + - an optional description + - the EJB reference name used in the code of the Deployment + Component that's referencing the enterprise bean + - the expected type of the referenced enterprise bean + - the expected local home and local interfaces of the + referenced enterprise bean + - optional ejb-link information, used to specify the + referenced enterprise bean + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="ejb-ref-name" + type="j2ee:ejb-ref-nameType"/> + <xsd:element name="ejb-ref-type" + type="j2ee:ejb-ref-typeType"/> + <xsd:element name="local-home" + type="j2ee:local-homeType"/> + <xsd:element name="local" + type="j2ee:localType"/> + <xsd:element name="ejb-link" + type="j2ee:ejb-linkType" + minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="ejb-ref-nameType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The ejb-ref-name element contains the name of an EJB + reference. The EJB reference is an entry in the + Deployment Component's environment and is relative to the + java:comp/env context. The name must be unique within the + Deployment Component. + + It is recommended that name is prefixed with "ejb/". + + Example: + + <ejb-ref-name>ejb/Payroll</ejb-ref-name> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:jndi-nameType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="ejb-ref-typeType"> + <xsd:annotation> + <xsd:documentation> + + The ejb-ref-typeType contains the expected type of the + referenced enterprise bean. + + The ejb-ref-type designates a value + that must be one of the following: + + Entity + Session + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="Entity"/> + <xsd:enumeration value="Session"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="ejb-refType"> + <xsd:annotation> + <xsd:documentation> + + The ejb-refType is used by ejb-ref elements for the + declaration of a reference to an enterprise bean's home. The + declaration consists of: + + - an optional description + - the EJB reference name used in the code of + the Deployment Component that's referencing the enterprise + bean + - the expected type of the referenced enterprise bean + - the expected home and remote interfaces of the referenced + enterprise bean + - optional ejb-link information, used to specify the + referenced enterprise bean + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="ejb-ref-name" + type="j2ee:ejb-ref-nameType"/> + <xsd:element name="ejb-ref-type" + type="j2ee:ejb-ref-typeType"/> + + <xsd:element name="home" + type="j2ee:homeType"/> + <xsd:element name="remote" + type="j2ee:remoteType"/> + <xsd:element name="ejb-link" + type="j2ee:ejb-linkType" + minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="emptyType"> + <xsd:annotation> + <xsd:documentation> + + This type is used to designate an empty + element when used. + + </xsd:documentation> + </xsd:annotation> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="env-entry-type-valuesType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + This type contains the fully-qualified Java type of the + environment entry value that is expected by the + application's code. + + The following are the legal values of env-entry-type-valuesType: + + java.lang.Boolean + java.lang.Byte + java.lang.Character + java.lang.String + java.lang.Short + java.lang.Integer + java.lang.Long + java.lang.Float + java.lang.Double + + Example: + + <env-entry-type>java.lang.Boolean</env-entry-type> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="java.lang.Boolean"/> + <xsd:enumeration value="java.lang.Byte"/> + <xsd:enumeration value="java.lang.Character"/> + <xsd:enumeration value="java.lang.String"/> + <xsd:enumeration value="java.lang.Short"/> + <xsd:enumeration value="java.lang.Integer"/> + <xsd:enumeration value="java.lang.Long"/> + <xsd:enumeration value="java.lang.Float"/> + <xsd:enumeration value="java.lang.Double"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="env-entryType"> + <xsd:annotation> + <xsd:documentation> + + The env-entryType is used to declare an application's + environment entry. The declaration consists of an optional + description, the name of the environment entry, and an + optional value. If a value is not specified, one must be + supplied during deployment. + + It is used by env-entry elements. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="env-entry-name" + type="j2ee:jndi-nameType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The env-entry-name element contains the name of a + Deployment Component's environment entry. The name + is a JNDI name relative to the java:comp/env + context. The name must be unique within a + Deployment Component. The uniqueness + constraints must be defined within the declared + context. + + Example: + + <env-entry-name>minAmount</env-entry-name> + + ]]> + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="env-entry-type" + type="j2ee:env-entry-type-valuesType"/> + + <xsd:element name="env-entry-value" + type="j2ee:xsdStringType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The env-entry-value designates the value of a + Deployment Component's environment entry. The value + must be a String that is valid for the + constructor of the specified type that takes a + single String parameter, or for java.lang.Character, + a single character. + + Example: + + <env-entry-value>100.00</env-entry-value> + + ]]> + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The elements that use this type designate the name of a + Java class or interface. The name is in the form of a + "binary name", as defined in the JLS. This is the form + of name used in Class.forName(). Tools that need the + canonical name (the name used in source code) will need + to convert this binary name to the canonical name. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="generic-booleanType"> + <xsd:annotation> + <xsd:documentation> + + This type defines four different values which can designate + boolean values. This includes values yes and no which are + not designated by xsd:boolean + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="true"/> + <xsd:enumeration value="false"/> + <xsd:enumeration value="yes"/> + <xsd:enumeration value="no"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="homeType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The homeType defines the fully-qualified name of + an enterprise bean's home interface. + + Example: + + <home>com.aardvark.payroll.PayrollHome</home> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:fully-qualified-classType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="iconType"> + <xsd:annotation> + <xsd:documentation> + + The icon type contains small-icon and large-icon elements + that specify the file names for small and large GIF or + JPEG icon images used to represent the parent element in a + GUI tool. + + The xml:lang attribute defines the language that the + icon file names are provided in. Its value is "en" (English) + by default. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="small-icon" type="j2ee:pathType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The small-icon element contains the name of a file + containing a small (16 x 16) icon image. The file + name is a relative path within the Deployment + Component's Deployment File. + + The image may be either in the JPEG or GIF format. + The icon can be used by tools. + + Example: + + <small-icon>employee-service-icon16x16.jpg</small-icon> + + ]]> + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="large-icon" type="j2ee:pathType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The large-icon element contains the name of a file + containing a large + (32 x 32) icon image. The file name is a relative + path within the Deployment Component's Deployment + File. + + The image may be either in the JPEG or GIF format. + The icon can be used by tools. + + Example: + + <large-icon>employee-service-icon32x32.jpg</large-icon> + + ]]> + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + </xsd:sequence> + + <xsd:attribute ref="xml:lang"/> + <xsd:attribute name="id" type="xsd:ID"/> + + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="java-identifierType"> + <xsd:annotation> + <xsd:documentation> + + The java-identifierType defines a Java identifier. + The users of this type should further verify that + the content does not contain Java reserved keywords. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:pattern value="($|_|\p{L})(\p{L}|\p{Nd}|_|$)*"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="java-typeType"> + <xsd:annotation> + <xsd:documentation> + + This is a generic type that designates a Java primitive + type or a fully qualified name of a Java interface/type, + or an array of such types. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:pattern value="[^\p{Z}]*"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="jndi-nameType"> + <xsd:annotation> + <xsd:documentation> + + The jndi-nameType type designates a JNDI name in the + Deployment Component's environment and is relative to the + java:comp/env context. A JNDI name must be unique within the + Deployment Component. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:group name="jndiEnvironmentRefsGroup"> + <xsd:annotation> + <xsd:documentation> + + This group keeps the usage of the contained JNDI environment + reference elements consistent across J2EE deployment descriptors. + + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="env-entry" + type="j2ee:env-entryType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ejb-ref" + type="j2ee:ejb-refType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="ejb-local-ref" + type="j2ee:ejb-local-refType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:group ref="j2ee:service-refGroup"/> + <xsd:element name="resource-ref" + type="j2ee:resource-refType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="resource-env-ref" + type="j2ee:resource-env-refType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="message-destination-ref" + type="j2ee:message-destination-refType" + minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:group> + +<!-- **************************************************** --> + + <xsd:complexType name="listenerType"> + <xsd:annotation> + <xsd:documentation> + + The listenerType indicates the deployment properties for a web + application listener bean. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:group ref="j2ee:descriptionGroup"/> + <xsd:element name="listener-class" + type="j2ee:fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The listener-class element declares a class in the + application must be registered as a web + application listener bean. The value is the fully + qualified classname of the listener class. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="local-homeType"> + <xsd:annotation> + <xsd:documentation> + + The local-homeType defines the fully-qualified + name of an enterprise bean's local home interface. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:fully-qualified-classType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="localType"> + <xsd:annotation> + <xsd:documentation> + + The localType defines the fully-qualified name of an + enterprise bean's local interface. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:fully-qualified-classType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="message-destination-linkType"> + <xsd:annotation> + <xsd:documentation> + + The message-destination-linkType is used to link a message + destination reference or message-driven bean to a message + destination. + + The Assembler sets the value to reflect the flow of messages + between producers and consumers in the application. + + The value must be the message-destination-name of a message + destination in the same Deployment File or in another + Deployment File in the same J2EE application unit. + + Alternatively, the value may be composed of a path name + specifying a Deployment File containing the referenced + message destination with the message-destination-name of the + destination appended and separated from the path name by + "#". The path name is relative to the Deployment File + containing Deployment Component that is referencing the + message destination. This allows multiple message + destinations with the same name to be uniquely identified. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="message-destination-refType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The message-destination-ref element contains a declaration + of Deployment Component's reference to a message destination + associated with a resource in Deployment Component's + environment. It consists of: + + - an optional description + - the message destination reference name + - the message destination type + - a specification as to whether the + destination is used for + consuming or producing messages, or both + - a link to the message destination + + Examples: + + <message-destination-ref> + <message-destination-ref-name>jms/StockQueue + </message-destination-ref-name> + <message-destination-type>javax.jms.Queue + </message-destination-type> + <message-destination-usage>Consumes + </message-destination-usage> + <message-destination-link>CorporateStocks + </message-destination-link> + </message-destination-ref> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="message-destination-ref-name" + type="j2ee:jndi-nameType"> + <xsd:annotation> + <xsd:documentation> + + The message-destination-ref-name element specifies + the name of a message destination reference; its + value is the environment entry name used in + Deployment Component code. The name is a JNDI name + relative to the java:comp/env context and must be + unique within an ejb-jar (for enterprise beans) or a + Deployment File (for others). + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="message-destination-type" + type="j2ee:message-destination-typeType"/> + <xsd:element name="message-destination-usage" + type="j2ee:message-destination-usageType"/> + <xsd:element name="message-destination-link" + type="j2ee:message-destination-linkType" + minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="message-destination-typeType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The message-destination-typeType specifies the type of + the destination. The type is specified by the Java interface + expected to be implemented by the destination. + + Example: + + <message-destination-type>javax.jms.Queue + </message-destination-type> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:fully-qualified-classType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="message-destination-usageType"> + <xsd:annotation> + <xsd:documentation> + + The message-destination-usageType specifies the use of the + message destination indicated by the reference. The value + indicates whether messages are consumed from the message + destination, produced for the destination, or both. The + Assembler makes use of this information in linking producers + of a destination with its consumers. + + The value of the message-destination-usage element must be + one of the following: + Consumes + Produces + ConsumesProduces + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="Consumes"/> + <xsd:enumeration value="Produces"/> + <xsd:enumeration value="ConsumesProduces"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="message-destinationType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The message-destinationType specifies a message + destination. The logical destination described by this + element is mapped to a physical destination by the Deployer. + + The message destination element contains: + + - an optional description + - an optional display-name + - an optional icon + - a message destination name which must be unique + among message destination names within the same + Deployment File. + + Example: + + <message-destination> + <message-destination-name>CorporateStocks + </message-destination-name> + </message-destination> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="j2ee:descriptionGroup"/> + <xsd:element name="message-destination-name" + type="j2ee:string"> + <xsd:annotation> + <xsd:documentation> + + The message-destination-name element specifies a + name for a message destination. This name must be + unique among the names of message destinations + within the Deployment File. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="param-valueType"> + <xsd:annotation> + <xsd:documentation> + + This type is a general type that can be used to declare + parameter/value lists. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="param-name" + type="j2ee:string"> + <xsd:annotation> + <xsd:documentation> + + The param-name element contains the name of a + parameter. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="param-value" + type="j2ee:xsdStringType"> + <xsd:annotation> + <xsd:documentation> + + The param-value element contains the value of a + parameter. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="pathType"> + <xsd:annotation> + <xsd:documentation> + + The elements that use this type designate either a relative + path or an absolute path starting with a "/". + + In elements that specify a pathname to a file within the + same Deployment File, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the Deployment File's namespace. Absolute filenames (i.e., + those starting with "/") also specify names in the root of + the Deployment File's namespace. In general, relative names + are preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="remoteType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The remote element contains the fully-qualified name + of the enterprise bean's remote interface. + + Example: + + <remote>com.wombat.empl.EmployeeService</remote> + + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:fully-qualified-classType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="res-authType"> + <xsd:annotation> + <xsd:documentation> + + The res-authType specifies whether the Deployment Component + code signs on programmatically to the resource manager, or + whether the Container will sign on to the resource manager + on behalf of the Deployment Component. In the latter case, + the Container uses information that is supplied by the + Deployer. + + The value must be one of the two following: + + Application + Container + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="Application"/> + <xsd:enumeration value="Container"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="res-sharing-scopeType"> + <xsd:annotation> + <xsd:documentation> + + The res-sharing-scope type specifies whether connections + obtained through the given resource manager connection + factory reference can be shared. The value, if specified, + must be one of the two following: + + Shareable + Unshareable + + The default value is Shareable. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="Shareable"/> + <xsd:enumeration value="Unshareable"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="resource-env-refType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The resource-env-refType is used to define + resource-env-type elements. It contains a declaration of a + Deployment Component's reference to an administered object + associated with a resource in the Deployment Component's + environment. It consists of an optional description, the + resource environment reference name, and an indication of + the resource environment reference type expected by the + Deployment Component code. + + Example: + + <resource-env-ref> + <resource-env-ref-name>jms/StockQueue + </resource-env-ref-name> + <resource-env-ref-type>javax.jms.Queue + </resource-env-ref-type> + </resource-env-ref> + + ]]> + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="resource-env-ref-name" + type="j2ee:jndi-nameType"> + <xsd:annotation> + <xsd:documentation> + + The resource-env-ref-name element specifies the name + of a resource environment reference; its value is + the environment entry name used in + the Deployment Component code. The name is a JNDI + name relative to the java:comp/env context and must + be unique within a Deployment Component. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="resource-env-ref-type" + type="j2ee:fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The resource-env-ref-type element specifies the type + of a resource environment reference. It is the + fully qualified name of a Java language class or + interface. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="resource-refType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The resource-refType contains a declaration of a + Deployment Component's reference to an external resource. It + consists of an optional description, the resource manager + connection factory reference name, the indication of the + resource manager connection factory type expected by the + Deployment Component code, the type of authentication + (Application or Container), and an optional specification of + the shareability of connections obtained from the resource + (Shareable or Unshareable). + + Example: + + <resource-ref> + <res-ref-name>jdbc/EmployeeAppDB</res-ref-name> + <res-type>javax.sql.DataSource</res-type> + <res-auth>Container</res-auth> + <res-sharing-scope>Shareable</res-sharing-scope> + </resource-ref> + + ]]> + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="res-ref-name" + type="j2ee:jndi-nameType"> + <xsd:annotation> + <xsd:documentation> + + The res-ref-name element specifies the name of a + resource manager connection factory reference. + The name is a JNDI name relative to the + java:comp/env context. + The name must be unique within a Deployment File. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="res-type" + type="j2ee:fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The res-type element specifies the type of the data + source. The type is specified by the fully qualified + Java language class or interface + expected to be implemented by the data source. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="res-auth" + type="j2ee:res-authType"/> + + <xsd:element name="res-sharing-scope" + type="j2ee:res-sharing-scopeType" + minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="role-nameType"> + <xsd:annotation> + <xsd:documentation> + + The role-nameType designates the name of a security role. + + The name must conform to the lexical rules for a token. + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="run-asType"> + <xsd:annotation> + <xsd:documentation> + + The run-asType specifies the run-as identity to be + used for the execution of a component. It contains an + optional description, and the name of a security role. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="role-name" + type="j2ee:role-nameType"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="security-role-refType"> + <xsd:annotation> + <xsd:documentation> + + The security-role-refType contains the declaration of a + security role reference in a component's or a + Deployment Component's code. The declaration consists of an + optional description, the security role name used in the + code, and an optional link to a security role. If the + security role is not specified, the Deployer must choose an + appropriate security role. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="role-name" + type="j2ee:role-nameType"> + <xsd:annotation> + <xsd:documentation> + + The value of the role-name element must be the String used + as the parameter to the + EJBContext.isCallerInRole(String roleName) method or the + HttpServletRequest.isUserInRole(String role) method. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="role-link" + type="j2ee:role-nameType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + + The role-link element is a reference to a defined + security role. The role-link element must contain + the name of one of the security roles defined in the + security-role elements. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="security-roleType"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + The security-roleType contains the definition of a security + role. The definition consists of an optional description of the + security role, and the security role name. + + Example: + + <security-role> + <description> + This role includes all employees who are authorized + to access the employee service application. + </description> + <role-name>employee</role-name> + </security-role> + + ]]> + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="role-name" + type="j2ee:role-nameType"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="string"> + <xsd:annotation> + <xsd:documentation> + + This is a special string datatype that is defined by J2EE as + a base type for defining collapsed strings. When schemas + require trailing/leading space elimination as well as + collapsing the existing whitespace, this base type may be + used. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:token"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="true-falseType"> + <xsd:annotation> + <xsd:documentation> + + This simple type designates a boolean with only two + permissible values + + - true + - false + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:xsdBooleanType"> + <xsd:pattern value="(true|false)"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="url-patternType"> + <xsd:annotation> + <xsd:documentation> + + The url-patternType contains the url pattern of the mapping. + It must follow the rules specified in Section 11.2 of the + Servlet API Specification. This pattern is assumed to be in + URL-decoded form and must not contain CR(#xD) or LF(#xA). + If it contains those characters, the container must inform + the developer with a descriptive error message. + The container must preserve all characters including whitespaces. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdAnyURIType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:anyURI. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:anyURI"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdBooleanType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:boolean. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:boolean"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdIntegerType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:integer. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:integer"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdNMTOKENType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:NMTOKEN. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:NMTOKEN"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdNonNegativeIntegerType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:nonNegativeInteger. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:nonNegativeInteger"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdPositiveIntegerType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:positiveInteger. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:positiveInteger"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdQNameType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:QName. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:QName"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="xsdStringType"> + <xsd:annotation> + <xsd:documentation> + + This type adds an "id" attribute to xsd:string. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + +</xsd:schema> + diff --git a/xml/tests/testData/documentation/spring-beans.xsd b/xml/tests/testData/documentation/spring-beans.xsd new file mode 100644 index 000000000000..04f42d5fe513 --- /dev/null +++ b/xml/tests/testData/documentation/spring-beans.xsd @@ -0,0 +1,1077 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> + +<xsd:schema xmlns="http://www.springframework.org/schema/beans" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.springframework.org/schema/beans"> + + <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/> + + <xsd:annotation> + <xsd:documentation><![CDATA[ + Spring XML Beans Schema, version 2.0 + Authors: Rob Harrop, Juergen Hoeller + + This defines a simple and consistent way of creating a namespace + of JavaBeans objects, managed by a Spring BeanFactory, read by + XmlBeanDefinitionReader (with DefaultBeanDefinitionDocumentReader). + + This document type is used by most Spring functionality, including + web application contexts, which are based on bean factories. + + Each "bean" element in this document defines a JavaBean. + Typically the bean class is specified, along with JavaBean properties + and/or constructor arguments. + + A bean instance can be a "singleton" (shared instance) or a "prototype" + (independent instance). Further scopes can be provided by extended + bean factories, for example in a web environment. + + References among beans are supported, that is, setting a JavaBean property + or a constructor argument to refer to another bean in the same factory + (or an ancestor factory). + + As alternative to bean references, "inner bean definitions" can be used. + Singleton flags of such inner bean definitions are effectively ignored: + inner beans are typically anonymous prototypes. + + There is also support for lists, sets, maps, and java.util.Properties + as bean property types or constructor argument types. + ]]></xsd:documentation> + </xsd:annotation> + + <!-- base types --> + <xsd:complexType name="identifiedType" abstract="true"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The unique identifier for a bean. The scope of the identifier + is the enclosing bean factory. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:attribute name="id" type="xsd:ID"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The unique identifier for a bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Top-level <beans> tag --> + <xsd:element name="beans"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The top level (typically root) element. Allows the definition <>"'/> + of default values for all nested bean definitions. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="import"/> + <xsd:element ref="alias"/> + <xsd:element ref="bean"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="default-lazy-init" default="false" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'lazy-init' value; see the documentation for the + 'lazy-init' attribute of the '<bean>/' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-merge" default="false" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'merge' value; see the documentation for the + 'merge' attribute of the various collection elements. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-dependency-check" default="none"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'dependency-check' value; see the documentation for the + 'dependency-check' attribute of the '<bean>/' element. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="none"/> + <xsd:enumeration value="all"/> + <xsd:enumeration value="objects"/> + <xsd:enumeration value="simple"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="default-autowire" default="no"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'autowire' value; see the documentation for the + 'autowire' attribute of the '<bean>/' element. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="byType"/> + <xsd:enumeration value="byName"/> + <xsd:enumeration value="no"/> + <xsd:enumeration value="autodetect"/> + <xsd:enumeration value="constructor"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="default-init-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'init-method' value; see the documentation for the + 'init-method' attribute of the '<bean>/' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-destroy-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'destroy-method' value; see the documentation for the + 'destroy-method' attribute of the '<bean>/' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="description"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains informative text describing the purpose of the enclosing + element. + Used primarily for user documentation of XML bean definition documents. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="import"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.core.io.Resource"><![CDATA[ + Specifies an XML bean definition resource to import. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="resource" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The relative resource location of the XML (bean definition) file to import, + for example "myImport.xml" or "includes/myImport.xml" or "../myImport.xml". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="alias"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines an alias for a bean (which can reside in a different definition + resource). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the bean to define an alias for. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="alias" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The alias name to define for the bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:group name="beanElements"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="meta"/> + <xsd:element ref="constructor-arg"/> + <xsd:element ref="property"/> + <xsd:element ref="lookup-method"/> + <xsd:element ref="replaced-method"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + </xsd:group> + + <xsd:attributeGroup name="beanAttributes"> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Can be used to create one or more aliases illegal in an (XML) id. + Multiple aliases can be separated by any number of spaces, commas, + or semi-colons (or indeed any mixture of the three). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="class" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The fully qualified name of the bean's class, except if it pure serves as parent for child bean definitions. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="parent" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the parent bean definition. + + Will use the bean class of the parent if none is specified, but can + also override it. In the latter case, the child bean class must be + compatible with the parent, i.e. accept the parent's property values + and constructor argument values, if any. + + A child bean definition will inherit constructor argument values, + property values and method overrides from the parent, with the option + to add new values. If init method, destroy method, factory bean and/or + factory method are specified, they will override the corresponding + parent settings. + + The remaining settings will always be taken from the child definition: + depends on, autowire mode, dependency check, scope, lazy init. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="scope" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The scope of this bean: typically "singleton" (one shared instance, + which will be returned by all calls to getBean() with the id), + or "prototype" (independent instance resulting from each call to + getBean(). Default is "singleton". + + Singletons are most commonly used, and are ideal for multi-threaded + service objects. Further scopes, such as "request" or "session", + might be supported by extended bean factories (for example, in a + web environment). + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + + Inner bean definitions inherit the singleton status of their containing + bean definition, unless explicitly specified: The inner bean will be a + singleton if the containing bean is a singleton, and a prototype if + the containing bean has any other scope. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="abstract" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Is this bean "abstract", that is, not meant to be instantiated itself + but rather just serving as parent for concrete child bean definitions? + The default is "false". Specify "true" to tell the bean factory to not + try to instantiate that particular bean in any case. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per abstract bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lazy-init" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Indicates whether or not this bean is to be lazily initialized. + If false, it will be instantiated on startup by bean factories + that perform eager initialization of singletons. The default is + "false". + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="autowire" default="default"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Controls whether bean properties are "autowired". + This is an automagical process in which bean references don't need + to be coded explicitly in the XML bean definition file, but rather the + Spring container works out dependencies. + + There are 5 modes: + + 1. "no" + The traditional Spring default. No automagical wiring. Bean references + must be defined in the XML file via the <ref/> element (or "ref" + attribute). We recommend this in most cases as it makes documentation + more explicit. + + 2. "byName" + Autowiring by property name. If a bean of class Cat exposes a dog + property, Spring will try to set this to the value of the bean "dog" + in the current container. If there is no matching bean by name, nothing + special happens; use dependency-check="objects" to raise an error in + that case. + + 3. "byType" + Autowiring if there is exactly one bean of the property type in the + container. If there is more than one, a fatal error is raised, and + you cannot use byType autowiring for that bean. If there is none, + nothing special happens; use dependency-check="objects" to raise an + error in that case. + + 4. "constructor" + Analogous to "byType" for constructor arguments. If there is not exactly + one bean of the constructor argument type in the bean factory, a fatal + error is raised. + + 5. "autodetect" + Chooses "constructor" or "byType" through introspection of the bean + class. If a default constructor is found, "byType" gets applied. + + Note that explicit dependencies, i.e. "property" and "constructor-arg" + elements, always override autowiring. Autowire behavior can be combined + with dependency checking, which will be performed after all autowiring + has been completed. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="byType"/> + <xsd:enumeration value="byName"/> + <xsd:enumeration value="default"/> + <xsd:enumeration value="no"/> + <xsd:enumeration value="autodetect"/> + <xsd:enumeration value="constructor"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="dependency-check" default="default"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Controls whether or not to check whether all of this + beans dependencies, expressed in its properties, are satisfied. + The default is to perform no dependency checking. + + "simple" type dependency checking includes primitives and String + "object" includes collaborators (other beans in the factory) + "all" includes both types of dependency checking + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="none"/> + <xsd:enumeration value="all"/> + <xsd:enumeration value="objects"/> + <xsd:enumeration value="simple"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="depends-on" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The names of the beans that this bean depends on being initialized. + The bean factory will guarantee that these beans get initialized + before this bean. + + Note that dependencies are normally expressed through bean properties + or constructor arguments. This property should just be necessary for + other kinds of dependencies like statics (*ugh*) or database preparation + on startup. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="init-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the custom initialization method to invoke after setting + bean properties. The method must have no arguments, but may throw any + exception. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="destroy-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the custom destroy method to invoke on bean factory + shutdown. The method must have no arguments, but may throw any + exception. + + Note: Only invoked on beans whose lifecycle is under the full + control of the factory - which is always the case for singletons, + but not guaranteed for any other scope. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="factory-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of a factory method to use to create this object. Use + constructor-arg elements to specify arguments to the factory method, + if it takes arguments. Autowiring does not apply to factory methods. + + If the "class" attribute is present, the factory method will be a static + method on the class specified by the "class" attribute on this bean + definition. Often this will be the same class as that of the constructed + object - for example, when the factory method is used as an alternative + to a constructor. However, it may be on a different class. In that case, + the created object will *not* be of the class specified in the "class" + attribute. This is analogous to FactoryBean behavior. + + If the "factory-bean" attribute is present, the "class" attribute is not + used, and the factory method will be an instance method on the object + returned from a getBean call with the specified bean name. The factory + bean may be defined as a singleton or a prototype. + + The factory method can have any number of arguments. Autowiring is not + supported. Use indexed constructor-arg elements in conjunction with the + factory-method attribute. + + Setter Injection can be used in conjunction with a factory method. + Method Injection cannot, as the factory method returns an instance, + which will be used when the container creates the bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="factory-bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Alternative to class attribute for factory-method usage. + If this is specified, no class attribute should be used. + This must be set to the name of a bean in the current or + ancestor factories that contains the relevant factory method. + This allows the factory itself to be configured using Dependency + Injection, and an instance (rather than static) method to be used. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="autowire-candidate" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Indicates whether or not this bean should be considered when looking + for candidates to satisfy another beans autowiring requirements. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:anyAttribute namespace="##other" processContents="lax"/> + </xsd:attributeGroup> + + <xsd:element name="meta" type="metaType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Arbitrary metadata attached to a bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:complexType name="metaType"> + <xsd:attribute name="key" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The key name of the metadata parameter being defined. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The value of the metadata parameter being defined (as a simple String). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:element name="bean"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.config.BeanDefinition"><![CDATA[ + Defines a single (usually named) bean. + + A bean definition may contain nested tags for constructor arguments, + property values, lookup methods, and replaced methods. Mixing constructor + injection and setter injection on the same bean is explicitly supported. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="identifiedType"> + <xsd:group ref="beanElements"/> + <xsd:attributeGroup ref="beanAttributes"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="constructor-arg"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.config.ConstructorArgumentValues"> + <![CDATA[ + Bean definitions can specify zero or more constructor arguments. + This is an alternative to "autowire constructor". + Arguments correspond to either a specific index of the constructor + argument list or are supposed to be matched generically by type. + + Note: A single generic argument value will just be used once, rather + than potentially matched multiple times (as of Spring 1.1). + + constructor-arg elements are also used in conjunction with the + factory-method element to construct beans using static or instance + factory methods. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="index" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact index of thr argument in the constructor argument list. + Only needed to avoid ambiguities, e.g. in case of 2 arguments of + the exact same type. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact type of the constructor argument. Only needed to avoid + ambiguities, e.g. in case of 2 single argument constructors + that can both be converted from a String. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...<value/>" + element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="property" type="propertyType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Bean definitions can have zero or more properties. + Property elements correspond to JavaBean setter methods exposed + by the bean classes. Spring supports primitives, references to other + beans in the same or related factories, lists, maps and properties. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="lookup-method"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A lookup method causes the IoC container to override the given method + and return the bean with the name given in the bean attribute. This is + a form of Method Injection. It is particularly useful as an alternative + to implementing the BeanFactoryAware interface, in order to be able to + make getBean() calls for non-singleton instances at runtime. In this + case, Method Injection is a less invasive alternative. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the lookup method. This method must take no arguments. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the bean in the current or ancestor factories that + the lookup method should resolve to. Often this bean will be a + prototype, in which case the lookup method will return a distinct + instance on every invocation. This is useful for single-threaded objects. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="replaced-method"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Similar to the lookup method mechanism, the replaced-method element + is used to control IoC container method overriding: Method Injection. + This mechanism allows the overriding of a method with arbitrary code. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="arg-type"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the method whose implementation must be replaced by the + IoC container. If this method is not overloaded, there is no need + to use arg-type subelements. If this method is overloaded, arg-type + subelements must be used for all override definitions for the method. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="replacer" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.support.MethodReplacer"><![CDATA[ + Bean name of an implementation of the MethodReplacer interface in the + current or ancestor factories. This may be a singleton or prototype + bean. If it is a prototype, a new instance will be used for each + method replacement. Singleton usage is the norm. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="arg-type"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Identifies an argument for a replaced method in the event of + method overloading. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="match" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Specification of the type of an overloaded method argument as a String. + For convenience, this may be a substring of the FQN. E.g. all the + following would match "java.lang.String": + - java.lang.String + - String + - Str + + As the number of arguments will be checked also, this convenience + can often be used to save typing. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="ref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines a reference to another bean in this factory or an external + factory (parent or included factory). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="local" type="xsd:IDREF"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. The value must be a bean ID, + and thus can be checked by the XML parser, thus should be preferred + for references within the same bean factory XML file. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="parent" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean *in a parent factory*. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="idref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The id of another bean in this factory or an external factory + (parent or included factory). + While a regular 'value' element could instead be used for the + same effect, using idref in this case allows validation of local + bean ids by the XML parser, and name completion by supporting tools. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="local" type="xsd:IDREF"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. The value must be a bean ID, + and thus can be checked by the XML parser, thus should be preferred + for references within the same bean factory XML file. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="value"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains a string representation of a property value. + The property may be a string, or may be converted to the required + type using the JavaBeans PropertyEditor machinery. This makes it + possible for application developers to write custom PropertyEditor + implementations that can convert strings to arbitrary target objects. + + Note that this is recommended for simple objects only. Configure + more complex objects by populating JavaBean properties with + references to other beans. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact type that the value should be converted to. Only needed + if the type of the target property or constructor argument is + too generic: for example, in case of a collection element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="null"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Denotes a Java null value. Necessary because an empty "value" tag + will resolve to an empty String, which will not be resolved to a + null value unless a special PropertyEditor does so. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + </xsd:complexType> + </xsd:element> + + <!-- Collection Elements --> + <xsd:group name="collectionElements"> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + </xsd:group> + + <xsd:element name="list" type="listOrSetType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A list can contain multiple inner bean, ref, collection, or value + elements. Java lists are untyped, pending generics support in Java5, + although references will be strongly typed. A list can also map to + an array type. The necessary conversion is automatically performed + by the BeanFactory. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="set" type="listOrSetType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A set can contain multiple inner bean, ref, collection, or value + elements. Java sets are untyped, pending generics support in Java5, + although references will be strongly typed. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="map" type="mapType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A mapping from a key to an object. Maps may be empty. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="entry" type="entryType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A map entry can be an inner bean, ref, value, or collection. + The key of the entry is given by the "key" attribute or child element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="props" type="propsType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Props elements differ from map elements in that values must be strings. + Props may be empty. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="key"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A key element can contain an inner bean, ref, value, or collection. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="collectionElements"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="prop"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The string value of the property. Note that whitespace is trimmed + off to avoid unwanted whitespace caused by typical XML formatting. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="key" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The key of the property entry. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="propertyType"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element ref="meta"/> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the property, following JavaBean naming conventions. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...</value>" + element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Collection Types --> + + <!-- base collection type --> + <xsd:complexType name="baseCollectionType"> + <xsd:attribute name="merge" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- base type for collections that have (possibly) typed nested values --> + <xsd:complexType name="typedCollectionType"> + <xsd:complexContent> + <xsd:extension base="baseCollectionType"> + <xsd:attribute name="value-type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The default Java type for nested values. Must be a fully qualified + class name. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'map' element type --> + <xsd:complexType name="mapType"> + <xsd:complexContent> + <xsd:extension base="typedCollectionType"> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="entry"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="key-type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The default Java type for nested entry keys. Must be a fully qualified + class name. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'entry' element type --> + <xsd:complexType name="entryType"> + <xsd:sequence> + <xsd:element ref="key" minOccurs="0"/> + <xsd:group ref="collectionElements"/> + </xsd:sequence> + <xsd:attribute name="key" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Each map element must specify its key as attribute or as child element. + A key attribute is always a String value. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="key-ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a to a "key" element with a nested + "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...</value>" + element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value-ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- 'list' and 'set' collection type --> + <xsd:complexType name="listOrSetType"> + <xsd:complexContent> + <xsd:extension base="typedCollectionType"> + <xsd:group ref="collectionElements"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'props' collection type --> + <xsd:complexType name="propsType"> + <xsd:complexContent> + <xsd:extension base="baseCollectionType"> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="prop"/> + </xsd:choice> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- simple internal types --> + <xsd:simpleType name="defaultable-boolean"> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="true"/> + <xsd:enumeration value="false"/> + </xsd:restriction> + </xsd:simpleType> + +</xsd:schema> diff --git a/xml/tests/testData/documentation/web-app_2_3.dtd b/xml/tests/testData/documentation/web-app_2_3.dtd new file mode 100644 index 000000000000..5e3ab01c0fe8 --- /dev/null +++ b/xml/tests/testData/documentation/web-app_2_3.dtd @@ -0,0 +1,1063 @@ +<!-- +Copyright (c) 2000 Sun Microsystems, Inc., +901 San Antonio Road, +Palo Alto, California 94303, U.S.A. +All rights reserved. + +Sun Microsystems, Inc. has intellectual property rights relating to +technology embodied in the product that is described in this document. +In particular, and without limitation, these intellectual property +rights may include one or more of the U.S. patents listed at +http://www.sun.com/patents and one or more additional patents or +pending patent applications in the U.S. and in other countries. + +This document and the product to which it pertains are distributed +under licenses restricting their use, copying, distribution, and +decompilation. This document may be reproduced and distributed but may +not be changed without prior written authorization of Sun and its +licensors, if any. + +Third-party software, including font technology, is copyrighted and +licensed from Sun suppliers. + +Sun, Sun Microsystems, the Sun logo, Java, JavaServer Pages, Java +Naming and Directory Interface, JDBC, JDK, JavaMail and and +Enterprise JavaBeans are trademarks or registered trademarks of Sun +Microsystems, Inc. in the U.S. and other countries. + +Federal Acquisitions: Commercial Software - Government Users Subject to +Standard License Terms and Conditions. + +DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED +CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED +WARRANTY OF MERCHANTABILITY, FITNESS FOR FOR A PARTICULAR PURPOSE OR +NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH +DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. + + +_________________________________________________________________________ + +Copyright (c) 2000 Sun Microsystems, Inc., +901 San Antonio Road, +Palo Alto, California 94303, E'tats-Unis. +Tous droits re'serve's. + +Sun Microsystems, Inc. a les droits de proprie'te' intellectuels +relatants a` la technologie incorpore'e dans le produit qui est de'crit +dans ce document. En particulier, et sans la limitation, ces droits de +proprie'te' intellectuels peuvent inclure un ou plus des brevets +ame'ricains e'nume're's a` http://www.sun.com/patents et un ou les +brevets plus supple'mentaires ou les applications de brevet en attente +dans les E'tats-Unis et dans les autres pays. + +Ce produit ou document est prote'ge' par un copyright et distribue' +avec des licences qui en restreignent l'utilisation, la copie, la +distribution, et la de'compilation. Ce documention associe n peut +e^tre reproduite et distribuer, par quelque moyen que ce soit, sans +l'autorisation pre'alable et e'crite de Sun et de ses bailleurs de +licence, le cas e'che'ant. + +Le logiciel de'tenu par des tiers, et qui comprend la technologie +relative aux polices de caracte`res, est prote'ge' par un copyright et +licencie' par des fournisseurs de Sun. + +Sun, Sun Microsystems, le logo Sun, Java, JavaServer Pages, Java +Naming and Directory Interface, JDBC, JDK, JavaMail et and +Enterprise JavaBeans sont des marques de fabrique ou des marques +de'pose'es de Sun Microsystems, Inc. aux E'tats-Unis et dans d'autres +pays. + +LA DOCUMENTATION EST FOURNIE "EN L'E'TAT" ET TOUTES AUTRES CONDITIONS, +DECLARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT +EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS +NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A +L'APTITUDE A UNE UTILISATION PARTICULIERE OU A L'ABSENCE DE +CONTREFAC,ON. +--> + +<!-- +This is the XML DTD for the Servlet 2.3 deployment descriptor. +All Servlet 2.3 deployment descriptors must include a DOCTYPE +of the following form: + + <!DOCTYPE web-app PUBLIC + "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> + +--> + +<!-- +The following conventions apply to all J2EE deployment descriptor +elements unless indicated otherwise. + +- In elements that contain PCDATA, leading and trailing whitespace + in the data may be ignored. + +- In elements whose value is an "enumerated type", the value is + case sensitive. + +- In elements that specify a pathname to a file within the same + JAR file, relative filenames (i.e., those not starting with "/") + are considered relative to the root of the JAR file's namespace. + Absolute filenames (i.e., those starting with "/") also specify + names in the root of the JAR file's namespace. In general, relative + names are preferred. The exception is .war files where absolute + names are preferred for consistency with the servlet API. +--> + + +<!-- +The web-app element is the root of the deployment descriptor for +a web application. +--> +<!ELEMENT web-app (icon?, display-name?, description?, distributable?, +context-param*, filter*, filter-mapping*, listener*, servlet*, +servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, +error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, +login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*)> + +<!-- +The auth-constraint element indicates the user roles that should +be permitted access to this resource collection. The role-name +used here must either correspond to the role-name of one of the +security-role elements defined for this web application, or be +the specially reserved role-name "*" that is a compact syntax for +indicating all roles in the web application. If both "*" and +rolenames appear, the container interprets this as all roles. +If no roles are defined, no user is allowed access to the portion of +the web application described by the containing security-constraint. +The container matches role names case sensitively when determining +access. + + +Used in: security-constraint +--> +<!ELEMENT auth-constraint (description?, role-name*)> + +<!-- +The auth-method element is used to configure the authentication +mechanism for the web application. As a prerequisite to gaining access to any web resources which are protected by an authorization +constraint, a user must have authenticated using the configured +mechanism. Legal values for this element are "BASIC", "DIGEST", +"FORM", or "CLIENT-CERT". + +Used in: login-config +--> +<!ELEMENT auth-method (#PCDATA)> + +<!-- +The context-param element contains the declaration of a web +application's servlet context initialization parameters. + +Used in: web-app +--> +<!ELEMENT context-param (param-name, param-value, description?)> + +<!-- +The description element is used to provide text describing the parent +element. The description element should include any information that +the web application war file producer wants to provide to the consumer of +the web application war file (i.e., to the Deployer). Typically, the tools +used by the web application war file consumer will display the description +when processing the parent element that contains the description. + +Used in: auth-constraint, context-param, ejb-local-ref, ejb-ref, +env-entry, filter, init-param, resource-env-ref, resource-ref, run-as, +security-role, security-role-ref, servlet, user-data-constraint, +web-app, web-resource-collection +--> +<!ELEMENT description (#PCDATA)> + +<!-- +The display-name element contains a short name that is intended to be +displayed by tools. The display name need not be unique. + +Used in: filter, security-constraint, servlet, web-app + +Example: + +<display-name>Employee Self Service</display-name> +--> +<!ELEMENT display-name (#PCDATA)> + +<!-- +The distributable element, by its presence in a web application +deployment descriptor, indicates that this web application is +programmed appropriately to be deployed into a distributed servlet +container + +Used in: web-app +--> +<!ELEMENT distributable EMPTY> + +<!-- +The ejb-link element is used in the ejb-ref or ejb-local-ref +elements to specify that an EJB reference is linked to an +enterprise bean. + +The name in the ejb-link element is composed of a +path name specifying the ejb-jar containing the referenced enterprise +bean with the ejb-name of the target bean appended and separated from +the path name by "#". The path name is relative to the war file +containing the web application that is referencing the enterprise bean. +This allows multiple enterprise beans with the same ejb-name to be +uniquely identified. + +Used in: ejb-local-ref, ejb-ref + +Examples: + + <ejb-link>EmployeeRecord</ejb-link> + + <ejb-link>../products/product.jar#ProductEJB</ejb-link> + +--> +<!ELEMENT ejb-link (#PCDATA)> + +<!-- +The ejb-local-ref element is used for the declaration of a reference to +an enterprise bean's local home. The declaration consists of: + + - an optional description + - the EJB reference name used in the code of the web application + that's referencing the enterprise bean + - the expected type of the referenced enterprise bean + - the expected local home and local interfaces of the referenced + enterprise bean + - optional ejb-link information, used to specify the referenced + enterprise bean + +Used in: web-app +--> +<!ELEMENT ejb-local-ref (description?, ejb-ref-name, ejb-ref-type, + local-home, local, ejb-link?)> + +<!-- +The ejb-ref element is used for the declaration of a reference to +an enterprise bean's home. The declaration consists of: + + - an optional description + - the EJB reference name used in the code of + the web application that's referencing the enterprise bean + - the expected type of the referenced enterprise bean + - the expected home and remote interfaces of the referenced + enterprise bean + - optional ejb-link information, used to specify the referenced + enterprise bean + +Used in: web-app +--> +<!ELEMENT ejb-ref (description?, ejb-ref-name, ejb-ref-type, + home, remote, ejb-link?)> + +<!-- +The ejb-ref-name element contains the name of an EJB reference. The +EJB reference is an entry in the web application's environment and is +relative to the java:comp/env context. The name must be unique +within the web application. + +It is recommended that name is prefixed with "ejb/". + +Used in: ejb-local-ref, ejb-ref + +Example: + +<ejb-ref-name>ejb/Payroll</ejb-ref-name> +--> +<!ELEMENT ejb-ref-name (#PCDATA)> + +<!-- +The ejb-ref-type element contains the expected type of the +referenced enterprise bean. + +The ejb-ref-type element must be one of the following: + + <ejb-ref-type>Entity</ejb-ref-type> + <ejb-ref-type>Session</ejb-ref-type> + +Used in: ejb-local-ref, ejb-ref +--> +<!ELEMENT ejb-ref-type (#PCDATA)> + +<!-- +The env-entry element contains the declaration of a web application's +environment entry. The declaration consists of an optional +description, the name of the environment entry, and an optional +value. If a value is not specified, one must be supplied +during deployment. +--> +<!ELEMENT env-entry (description?, env-entry-name, env-entry-value?, +env-entry-type)> + +<!-- +The env-entry-name element contains the name of a web applications's +environment entry. The name is a JNDI name relative to the +java:comp/env context. The name must be unique within a web application. + +Example: + +<env-entry-name>minAmount</env-entry-name> + +Used in: env-entry +--> +<!ELEMENT env-entry-name (#PCDATA)> + +<!-- +The env-entry-type element contains the fully-qualified Java type of +the environment entry value that is expected by the web application's +code. + +The following are the legal values of env-entry-type: + + java.lang.Boolean + java.lang.Byte + java.lang.Character + java.lang.String + java.lang.Short + java.lang.Integer + java.lang.Long + java.lang.Float + java.lang.Double + +Used in: env-entry +--> +<!ELEMENT env-entry-type (#PCDATA)> + +<!-- +The env-entry-value element contains the value of a web application's +environment entry. The value must be a String that is valid for the +constructor of the specified type that takes a single String +parameter, or for java.lang.Character, a single character. + +Example: + +<env-entry-value>100.00</env-entry-value> + +Used in: env-entry +--> +<!ELEMENT env-entry-value (#PCDATA)> + +<!-- +The error-code contains an HTTP error code, ex: 404 + +Used in: error-page +--> +<!ELEMENT error-code (#PCDATA)> + +<!-- +The error-page element contains a mapping between an error code +or exception type to the path of a resource in the web application + +Used in: web-app +--> +<!ELEMENT error-page ((error-code | exception-type), location)> + +<!-- +The exception type contains a fully qualified class name of a +Java exception type. + +Used in: error-page +--> +<!ELEMENT exception-type (#PCDATA)> + +<!-- +The extension element contains a string describing an +extension. example: "txt" + +Used in: mime-mapping +--> +<!ELEMENT extension (#PCDATA)> + +<!-- +Declares a filter in the web application. The filter is mapped to +either a servlet or a URL pattern in the filter-mapping element, using +the filter-name value to reference. Filters can access the +initialization parameters declared in the deployment descriptor at +runtime via the FilterConfig interface. + +Used in: web-app +--> +<!ELEMENT filter (icon?, filter-name, display-name?, description?, +filter-class, init-param*)> + +<!-- +The fully qualified classname of the filter. + +Used in: filter +--> +<!ELEMENT filter-class (#PCDATA)> + +<!-- +Declaration of the filter mappings in this web application. The +container uses the filter-mapping declarations to decide which filters +to apply to a request, and in what order. The container matches the +request URI to a Servlet in the normal way. To determine which filters +to apply it matches filter-mapping declarations either on servlet-name, +or on url-pattern for each filter-mapping element, depending on which +style is used. The order in which filters are invoked is the order in +which filter-mapping declarations that match a request URI for a +servlet appear in the list of filter-mapping elements.The filter-name +value must be the value of the <filter-name> sub-elements of one of the +<filter> declarations in the deployment descriptor. + +Used in: web-app +--> +<!ELEMENT filter-mapping (filter-name, (url-pattern | servlet-name))> + +<!-- +The logical name of the filter. This name is used to map the filter. +Each filter name is unique within the web application. + +Used in: filter, filter-mapping +--> +<!ELEMENT filter-name (#PCDATA)> + +<!-- +The form-error-page element defines the location in the web app +where the error page that is displayed when login is not successful +can be found. The path begins with a leading / and is interpreted +relative to the root of the WAR. + +Used in: form-login-config +--> +<!ELEMENT form-error-page (#PCDATA)> + +<!-- +The form-login-config element specifies the login and error pages +that should be used in form based login. If form based authentication +is not used, these elements are ignored. + +Used in: login-config +--> +<!ELEMENT form-login-config (form-login-page, form-error-page)> + +<!-- +The form-login-page element defines the location in the web app +where the page that can be used for login can be found. The path +begins with a leading / and is interpreted relative to the root of the WAR. + +Used in: form-login-config +--> +<!ELEMENT form-login-page (#PCDATA)> + +<!-- +The home element contains the fully-qualified name of the enterprise +bean's home interface. + +Used in: ejb-ref + +Example: + +<home>com.aardvark.payroll.PayrollHome</home> +--> +<!ELEMENT home (#PCDATA)> + +<!-- +The http-method contains an HTTP method (GET | POST |...). + +Used in: web-resource-collection +--> +<!ELEMENT http-method (#PCDATA)> + +<!-- +The icon element contains small-icon and large-icon elements that +specify the file names for small and a large GIF or JPEG icon images +used to represent the parent element in a GUI tool. + +Used in: filter, servlet, web-app +--> +<!ELEMENT icon (small-icon?, large-icon?)> + +<!-- +The init-param element contains a name/value pair as an +initialization param of the servlet + +Used in: filter, servlet +--> +<!ELEMENT init-param (param-name, param-value, description?)> + +<!-- +The jsp-file element contains the full path to a JSP file within +the web application beginning with a `/'. + +Used in: servlet +--> +<!ELEMENT jsp-file (#PCDATA)> + +<!-- +The large-icon element contains the name of a file +containing a large (32 x 32) icon image. The file +name is a relative path within the web application's +war file. + +The image may be either in the JPEG or GIF format. +The icon can be used by tools. + +Used in: icon + +Example: + +<large-icon>employee-service-icon32x32.jpg</large-icon> +--> +<!ELEMENT large-icon (#PCDATA)> + +<!-- +The listener element indicates the deployment properties for a web +application listener bean. + +Used in: web-app +--> +<!ELEMENT listener (listener-class)> + +<!-- +The listener-class element declares a class in the application must be +registered as a web application listener bean. The value is the fully qualified classname of the listener class. + + +Used in: listener +--> +<!ELEMENT listener-class (#PCDATA)> + +<!-- +The load-on-startup element indicates that this servlet should be +loaded (instantiated and have its init() called) on the startup +of the web application. The optional contents of +these element must be an integer indicating the order in which +the servlet should be loaded. If the value is a negative integer, +or the element is not present, the container is free to load the +servlet whenever it chooses. If the value is a positive integer +or 0, the container must load and initialize the servlet as the +application is deployed. The container must guarantee that +servlets marked with lower integers are loaded before servlets +marked with higher integers. The container may choose the order +of loading of servlets with the same load-on-start-up value. + +Used in: servlet +--> +<!ELEMENT load-on-startup (#PCDATA)> + +<!-- + +The local element contains the fully-qualified name of the +enterprise bean's local interface. + +Used in: ejb-local-ref + +--> +<!ELEMENT local (#PCDATA)> + +<!-- + +The local-home element contains the fully-qualified name of the +enterprise bean's local home interface. + +Used in: ejb-local-ref +--> +<!ELEMENT local-home (#PCDATA)> + +<!-- +The location element contains the location of the resource in the web +application relative to the root of the web application. The value of +the location must have a leading `/'. + +Used in: error-page +--> +<!ELEMENT location (#PCDATA)> + +<!-- +The login-config element is used to configure the authentication +method that should be used, the realm name that should be used for +this application, and the attributes that are needed by the form login +mechanism. + +Used in: web-app +--> +<!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)> + +<!-- +The mime-mapping element defines a mapping between an extension +and a mime type. + +Used in: web-app +--> +<!ELEMENT mime-mapping (extension, mime-type)> + +<!-- +The mime-type element contains a defined mime type. example: +"text/plain" + +Used in: mime-mapping +--> +<!ELEMENT mime-type (#PCDATA)> + +<!-- +The param-name element contains the name of a parameter. Each parameter +name must be unique in the web application. + + +Used in: context-param, init-param +--> +<!ELEMENT param-name (#PCDATA)> + +<!-- +The param-value element contains the value of a parameter. + +Used in: context-param, init-param +--> +<!ELEMENT param-value (#PCDATA)> + +<!-- +The realm name element specifies the realm name to use in HTTP +Basic authorization. + +Used in: login-config +--> +<!ELEMENT realm-name (#PCDATA)> + +<!-- +The remote element contains the fully-qualified name of the enterprise +bean's remote interface. + +Used in: ejb-ref + +Example: + +<remote>com.wombat.empl.EmployeeService</remote> +--> +<!ELEMENT remote (#PCDATA)> + +<!-- +The res-auth element specifies whether the web application code signs +on programmatically to the resource manager, or whether the Container +will sign on to the resource manager on behalf of the web application. In the +latter case, the Container uses information that is supplied by the +Deployer. + +The value of this element must be one of the two following: + + <res-auth>Application</res-auth> + <res-auth>Container</res-auth> + +Used in: resource-ref +--> +<!ELEMENT res-auth (#PCDATA)> + +<!-- +The res-ref-name element specifies the name of a resource manager +connection factory reference. The name is a JNDI name relative to the +java:comp/env context. The name must be unique within a web application. + +Used in: resource-ref +--> +<!ELEMENT res-ref-name (#PCDATA)> + +<!-- +The res-sharing-scope element specifies whether connections obtained +through the given resource manager connection factory reference can be +shared. The value of this element, if specified, must be one of the +two following: + + <res-sharing-scope>Shareable</res-sharing-scope> + <res-sharing-scope>Unshareable</res-sharing-scope> + +The default value is Shareable. + +Used in: resource-ref +--> +<!ELEMENT res-sharing-scope (#PCDATA)> + +<!-- +The res-type element specifies the type of the data source. The type +is specified by the fully qualified Java language class or interface +expected to be implemented by the data source. + +Used in: resource-ref +--> +<!ELEMENT res-type (#PCDATA)> + +<!-- +The resource-env-ref element contains a declaration of a web application's +reference to an administered object associated with a resource +in the web application's environment. It consists of an optional +description, the resource environment reference name, and an +indication of the resource environment reference type expected by +the web application code. + +Used in: web-app + +Example: + +<resource-env-ref> + <resource-env-ref-name>jms/StockQueue</resource-env-ref-name> + <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type> +</resource-env-ref> +--> +<!ELEMENT resource-env-ref (description?, resource-env-ref-name, + resource-env-ref-type)> + +<!-- +The resource-env-ref-name element specifies the name of a resource +environment reference; its value is the environment entry name used in +the web application code. The name is a JNDI name relative to the +java:comp/env context and must be unique within a web application. + +Used in: resource-env-ref +--> +<!ELEMENT resource-env-ref-name (#PCDATA)> + +<!-- +The resource-env-ref-type element specifies the type of a resource +environment reference. It is the fully qualified name of a Java +language class or interface. + +Used in: resource-env-ref +--> +<!ELEMENT resource-env-ref-type (#PCDATA)> + +<!-- +The resource-ref element contains a declaration of a web application's +reference to an external resource. It consists of an optional +description, the resource manager connection factory reference name, +the indication of the resource manager connection factory type +expected by the web application code, the type of authentication +(Application or Container), and an optional specification of the +shareability of connections obtained from the resource (Shareable or +Unshareable). + +Used in: web-app + +Example: + + <resource-ref> + <res-ref-name>jdbc/EmployeeAppDB</res-ref-name> + <res-type>javax.sql.DataSource</res-type> + <res-auth>Container</res-auth> + <res-sharing-scope>Shareable</res-sharing-scope> + </resource-ref> +--> +<!ELEMENT resource-ref (description?, res-ref-name, res-type, res-auth, + res-sharing-scope?)> + +<!-- +The role-link element is a reference to a defined security role. The +role-link element must contain the name of one of the security roles +defined in the security-role elements. + +Used in: security-role-ref +--> +<!ELEMENT role-link (#PCDATA)> + +<!-- +The role-name element contains the name of a security role. + +The name must conform to the lexical rules for an NMTOKEN. + +Used in: auth-constraint, run-as, security-role, security-role-ref +--> +<!ELEMENT role-name (#PCDATA)> + +<!-- +The run-as element specifies the run-as identity to be used for the +execution of the web application. It contains an optional description, and +the name of a security role. + +Used in: servlet +--> +<!ELEMENT run-as (description?, role-name)> + +<!-- +The security-constraint element is used to associate security +constraints with one or more web resource collections + +Used in: web-app +--> +<!ELEMENT security-constraint (display-name?, web-resource-collection+, +auth-constraint?, user-data-constraint?)> + +<!-- +The security-role element contains the definition of a security +role. The definition consists of an optional description of the +security role, and the security role name. + +Used in: web-app + +Example: + + <security-role> + <description> + This role includes all employees who are authorized + to access the employee service application. + </description> + <role-name>employee</role-name> + </security-role> +--> +<!ELEMENT security-role (description?, role-name)> + +<!-- +The security-role-ref element contains the declaration of a security +role reference in the web application's code. The declaration consists +of an optional description, the security role name used in the code, +and an optional link to a security role. If the security role is not +specified, the Deployer must choose an appropriate security role. + +The value of the role-name element must be the String used as the +parameter to the EJBContext.isCallerInRole(String roleName) method +or the HttpServletRequest.isUserInRole(String role) method. + +Used in: servlet + +--> +<!ELEMENT security-role-ref (description?, role-name, role-link?)> + +<!-- +The servlet element contains the declarative data of a +servlet. If a jsp-file is specified and the load-on-startup element is +present, then the JSP should be precompiled and loaded. + +Used in: web-app +--> +<!ELEMENT servlet (icon?, servlet-name, display-name?, description?, +(servlet-class|jsp-file), init-param*, load-on-startup?, run-as?, security-role-ref*)> + +<!-- +The servlet-class element contains the fully qualified class name +of the servlet. + +Used in: servlet +--> +<!ELEMENT servlet-class (#PCDATA)> + +<!-- +The servlet-mapping element defines a mapping between a servlet +and a url pattern + +Used in: web-app +--> +<!ELEMENT servlet-mapping (servlet-name, url-pattern)> + +<!-- +The servlet-name element contains the canonical name of the +servlet. Each servlet name is unique within the web application. + +Used in: filter-mapping, servlet, servlet-mapping +--> +<!ELEMENT servlet-name (#PCDATA)> + +<!-- +The session-config element defines the session parameters for +this web application. + +Used in: web-app +--> +<!ELEMENT session-config (session-timeout?)> + +<!-- +The session-timeout element defines the default session timeout +interval for all sessions created in this web application. The +specified timeout must be expressed in a whole number of minutes. +If the timeout is 0 or less, the container ensures the default +behaviour of sessions is never to time out. + +Used in: session-config +--> +<!ELEMENT session-timeout (#PCDATA)> + +<!-- +The small-icon element contains the name of a file +containing a small (16 x 16) icon image. The file +name is a relative path within the web application's +war file. + +The image may be either in the JPEG or GIF format. +The icon can be used by tools. + +Used in: icon + +Example: + +<small-icon>employee-service-icon16x16.jpg</small-icon> +--> +<!ELEMENT small-icon (#PCDATA)> + +<!-- +The taglib element is used to describe a JSP tag library. + +Used in: web-app +--> +<!ELEMENT taglib (taglib-uri, taglib-location)> + +<!-- +the taglib-location element contains the location (as a resource +relative to the root of the web application) where to find the Tag +Libary Description file for the tag library. + +Used in: taglib +--> +<!ELEMENT taglib-location (#PCDATA)> + +<!-- +The taglib-uri element describes a URI, relative to the location +of the web.xml document, identifying a Tag Library used in the Web +Application. + +Used in: taglib +--> +<!ELEMENT taglib-uri (#PCDATA)> + +<!-- +The transport-guarantee element specifies that the communication +between client and server should be NONE, INTEGRAL, or +CONFIDENTIAL. NONE means that the application does not require any +transport guarantees. A value of INTEGRAL means that the application +requires that the data sent between the client and server be sent in +such a way that it can't be changed in transit. CONFIDENTIAL means +that the application requires that the data be transmitted in a +fashion that prevents other entities from observing the contents of +the transmission. In most cases, the presence of the INTEGRAL or +CONFIDENTIAL flag will indicate that the use of SSL is required. + +Used in: user-data-constraint +--> +<!ELEMENT transport-guarantee (#PCDATA)> + +<!-- +The url-pattern element contains the url pattern of the mapping. Must +follow the rules specified in Section 11.2 of the Servlet API +Specification. + +Used in: filter-mapping, servlet-mapping, web-resource-collection +--> +<!ELEMENT url-pattern (#PCDATA)> + +<!-- +The user-data-constraint element is used to indicate how data +communicated between the client and container should be protected. + +Used in: security-constraint +--> +<!ELEMENT user-data-constraint (description?, transport-guarantee)> + +<!-- +The web-resource-collection element is used to identify a subset +of the resources and HTTP methods on those resources within a web +application to which a security constraint applies. If no HTTP methods +are specified, then the security constraint applies to all HTTP +methods. + +Used in: security-constraint +--> +<!ELEMENT web-resource-collection (web-resource-name, description?, +url-pattern*, http-method*)> + +<!-- +The web-resource-name contains the name of this web resource +collection. + +Used in: web-resource-collection +--> +<!ELEMENT web-resource-name (#PCDATA)> + +<!-- +The welcome-file element contains file name to use as a default +welcome file, such as index.html + +Used in: welcome-file-list +--> +<!ELEMENT welcome-file (#PCDATA)> + +<!-- +The welcome-file-list contains an ordered list of welcome files +elements. + +Used in: web-app +--> +<!ELEMENT welcome-file-list (welcome-file+)> + +<!-- +The ID mechanism is to allow tools that produce additional deployment +information (i.e., information beyond the standard deployment +descriptor information) to store the non-standard information in a +separate file, and easily refer from these tool-specific files to the +information in the standard deployment descriptor. + +Tools are not allowed to add the non-standard information into the +standard deployment descriptor. +--> + +<!ATTLIST auth-constraint id ID #IMPLIED> +<!ATTLIST auth-method id ID #IMPLIED> +<!ATTLIST context-param id ID #IMPLIED> +<!ATTLIST description id ID #IMPLIED> +<!ATTLIST display-name id ID #IMPLIED> +<!ATTLIST distributable id ID #IMPLIED> +<!ATTLIST ejb-link id ID #IMPLIED> +<!ATTLIST ejb-local-ref id ID #IMPLIED> +<!ATTLIST ejb-ref id ID #IMPLIED> +<!ATTLIST ejb-ref-name id ID #IMPLIED> +<!ATTLIST ejb-ref-type id ID #IMPLIED> +<!ATTLIST env-entry id ID #IMPLIED> +<!ATTLIST env-entry-name id ID #IMPLIED> +<!ATTLIST env-entry-type id ID #IMPLIED> +<!ATTLIST env-entry-value id ID #IMPLIED> +<!ATTLIST error-code id ID #IMPLIED> +<!ATTLIST error-page id ID #IMPLIED> +<!ATTLIST exception-type id ID #IMPLIED> +<!ATTLIST extension id ID #IMPLIED> +<!ATTLIST filter id ID #IMPLIED> +<!ATTLIST filter-class id ID #IMPLIED> +<!ATTLIST filter-mapping id ID #IMPLIED> +<!ATTLIST filter-name id ID #IMPLIED> +<!ATTLIST form-error-page id ID #IMPLIED> +<!ATTLIST form-login-config id ID #IMPLIED> +<!ATTLIST form-login-page id ID #IMPLIED> +<!ATTLIST home id ID #IMPLIED> +<!ATTLIST http-method id ID #IMPLIED> +<!ATTLIST icon id ID #IMPLIED> +<!ATTLIST init-param id ID #IMPLIED> +<!ATTLIST jsp-file id ID #IMPLIED> +<!ATTLIST large-icon id ID #IMPLIED> +<!ATTLIST listener id ID #IMPLIED> +<!ATTLIST listener-class id ID #IMPLIED> +<!ATTLIST load-on-startup id ID #IMPLIED> +<!ATTLIST local id ID #IMPLIED> +<!ATTLIST local-home id ID #IMPLIED> +<!ATTLIST location id ID #IMPLIED> +<!ATTLIST login-config id ID #IMPLIED> +<!ATTLIST mime-mapping id ID #IMPLIED> +<!ATTLIST mime-type id ID #IMPLIED> +<!ATTLIST param-name id ID #IMPLIED> +<!ATTLIST param-value id ID #IMPLIED> +<!ATTLIST realm-name id ID #IMPLIED> +<!ATTLIST remote id ID #IMPLIED> +<!ATTLIST res-auth id ID #IMPLIED> +<!ATTLIST res-ref-name id ID #IMPLIED> +<!ATTLIST res-sharing-scope id ID #IMPLIED> +<!ATTLIST res-type id ID #IMPLIED> +<!ATTLIST resource-env-ref id ID #IMPLIED> +<!ATTLIST resource-env-ref-name id ID #IMPLIED> +<!ATTLIST resource-env-ref-type id ID #IMPLIED> +<!ATTLIST resource-ref id ID #IMPLIED> +<!ATTLIST role-link id ID #IMPLIED> +<!ATTLIST role-name id ID #IMPLIED> +<!ATTLIST run-as id ID #IMPLIED> +<!ATTLIST security-constraint id ID #IMPLIED> +<!ATTLIST security-role id ID #IMPLIED> +<!ATTLIST security-role-ref id ID #IMPLIED> +<!ATTLIST servlet id ID #IMPLIED> +<!ATTLIST servlet-class id ID #IMPLIED> +<!ATTLIST servlet-mapping id ID #IMPLIED> +<!ATTLIST servlet-name id ID #IMPLIED> +<!ATTLIST session-config id ID #IMPLIED> +<!ATTLIST session-timeout id ID #IMPLIED> +<!ATTLIST small-icon id ID #IMPLIED> +<!ATTLIST taglib id ID #IMPLIED> +<!ATTLIST taglib-location id ID #IMPLIED> +<!ATTLIST taglib-uri id ID #IMPLIED> +<!ATTLIST transport-guarantee id ID #IMPLIED> +<!ATTLIST url-pattern id ID #IMPLIED> +<!ATTLIST user-data-constraint id ID #IMPLIED> +<!ATTLIST web-app id ID #IMPLIED> +<!ATTLIST web-resource-collection id ID #IMPLIED> +<!ATTLIST web-resource-name id ID #IMPLIED> +<!ATTLIST welcome-file id ID #IMPLIED> +<!ATTLIST welcome-file-list id ID #IMPLIED> diff --git a/xml/tests/testData/documentation/web-app_2_4.xsd b/xml/tests/testData/documentation/web-app_2_4.xsd new file mode 100644 index 000000000000..9e4f58dc238a --- /dev/null +++ b/xml/tests/testData/documentation/web-app_2_4.xsd @@ -0,0 +1,1242 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://java.sun.com/xml/ns/j2ee" + xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="2.4"> + <xsd:annotation> + <xsd:documentation> + @(#)web-app_2_4.xsds 1.61 04/04/16 + </xsd:documentation> + </xsd:annotation> + + <xsd:annotation> + <xsd:documentation> + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2007 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + </xsd:documentation> + </xsd:annotation> + + <xsd:annotation> + <xsd:documentation> + <![CDATA[ + + This is the XML Schema for the Servlet 2.4 deployment descriptor. + The deployment descriptor must be named "WEB-INF/web.xml" in the + web application's war file. All Servlet deployment descriptors + must indicate the web application schema by using the J2EE + namespace: + + http://java.sun.com/xml/ns/j2ee + + and by indicating the version of the schema by + using the version element as shown below: + + <web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="..." + version="2.4"> + ... + </web-app> + + The instance documents may indicate the published version of + the schema using the xsi:schemaLocation attribute for J2EE + namespace with the following location: + + http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd + + ]]> + </xsd:documentation> + </xsd:annotation> + + <xsd:annotation> + <xsd:documentation> + + The following conventions apply to all J2EE + deployment descriptor elements unless indicated otherwise. + + - In elements that specify a pathname to a file within the + same JAR file, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the JAR file's namespace. Absolute filenames (i.e., those + starting with "/") also specify names in the root of the + JAR file's namespace. In general, relative names are + preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + </xsd:documentation> + </xsd:annotation> + + <xsd:include schemaLocation="j2ee_1_4.xsd"/> + <xsd:include schemaLocation="jsp_2_0.xsd"/> + + +<!-- **************************************************** --> + + + <xsd:element name="web-app" type="j2ee:web-appType"> + <xsd:annotation> + <xsd:documentation> + + The web-app element is the root of the deployment + descriptor for a web application. Note that the sub-elements + of this element can be in the arbitrary order. Because of + that, the multiplicity of the elements of distributable, + session-config, welcome-file-list, jsp-config, login-config, + and locale-encoding-mapping-list was changed from "?" to "*" + in this schema. However, the deployment descriptor instance + file must not contain multiple elements of session-config, + jsp-config, and login-config. When there are multiple elements of + welcome-file-list or locale-encoding-mapping-list, the container + must concatinate the element contents. The multiple occurance + of the element distributable is redundant and the container + treats that case exactly in the same way when there is only + one distributable. + + </xsd:documentation> + </xsd:annotation> + + <xsd:unique name="web-app-servlet-name-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The servlet element contains the name of a servlet. + The name must be unique within the web application. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:servlet"/> + <xsd:field xpath="j2ee:servlet-name"/> + </xsd:unique> + + <xsd:unique name="web-app-filter-name-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The filter element contains the name of a filter. + The name must be unique within the web application. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:filter"/> + <xsd:field xpath="j2ee:filter-name"/> + </xsd:unique> + + <xsd:unique name="web-app-ejb-local-ref-name-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The ejb-local-ref-name element contains the name of an EJB + reference. The EJB reference is an entry in the web + application's environment and is relative to the + java:comp/env context. The name must be unique within + the web application. + + It is recommended that name is prefixed with "ejb/". + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:ejb-local-ref"/> + <xsd:field xpath="j2ee:ejb-ref-name"/> + </xsd:unique> + + <xsd:unique name="web-app-ejb-ref-name-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The ejb-ref-name element contains the name of an EJB + reference. The EJB reference is an entry in the web + application's environment and is relative to the + java:comp/env context. The name must be unique within + the web application. + + It is recommended that name is prefixed with "ejb/". + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:ejb-ref"/> + <xsd:field xpath="j2ee:ejb-ref-name"/> + </xsd:unique> + + <xsd:unique name="web-app-resource-env-ref-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The resource-env-ref-name element specifies the name of + a resource environment reference; its value is the + environment entry name used in the web application code. + The name is a JNDI name relative to the java:comp/env + context and must be unique within a web application. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:resource-env-ref"/> + <xsd:field xpath="j2ee:resource-env-ref-name"/> + </xsd:unique> + + <xsd:unique name="web-app-message-destination-ref-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The message-destination-ref-name element specifies the name of + a message destination reference; its value is the + environment entry name used in the web application code. + The name is a JNDI name relative to the java:comp/env + context and must be unique within a web application. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:message-destination-ref"/> + <xsd:field xpath="j2ee:message-destination-ref-name"/> + </xsd:unique> + + <xsd:unique name="web-app-res-ref-name-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The res-ref-name element specifies the name of a + resource manager connection factory reference. The name + is a JNDI name relative to the java:comp/env context. + The name must be unique within a web application. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:resource-ref"/> + <xsd:field xpath="j2ee:res-ref-name"/> + </xsd:unique> + + <xsd:unique name="web-app-env-entry-name-uniqueness"> + <xsd:annotation> + <xsd:documentation> + + The env-entry-name element contains the name of a web + application's environment entry. The name is a JNDI + name relative to the java:comp/env context. The name + must be unique within a web application. + + </xsd:documentation> + </xsd:annotation> + + <xsd:selector xpath="j2ee:env-entry"/> + <xsd:field xpath="j2ee:env-entry-name"/> + </xsd:unique> + + <xsd:key name="web-app-role-name-key"> + <xsd:annotation> + <xsd:documentation> + + A role-name-key is specified to allow the references + from the security-role-refs. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:security-role"/> + <xsd:field xpath="j2ee:role-name"/> + </xsd:key> + + <xsd:keyref name="web-app-role-name-references" + refer="j2ee:web-app-role-name-key"> + <xsd:annotation> + <xsd:documentation> + + The keyref indicates the references from + security-role-ref to a specified role-name. + + </xsd:documentation> + </xsd:annotation> + <xsd:selector xpath="j2ee:servlet/j2ee:security-role-ref"/> + <xsd:field xpath="j2ee:role-link"/> + </xsd:keyref> + </xsd:element> + + +<!-- **************************************************** --> + + <xsd:complexType name="auth-constraintType"> + <xsd:annotation> + <xsd:documentation> + + The auth-constraintType indicates the user roles that + should be permitted access to this resource + collection. The role-name used here must either correspond + to the role-name of one of the security-role elements + defined for this web application, or be the specially + reserved role-name "*" that is a compact syntax for + indicating all roles in the web application. If both "*" + and rolenames appear, the container interprets this as all + roles. If no roles are defined, no user is allowed access + to the portion of the web application described by the + containing security-constraint. The container matches + role names case sensitively when determining access. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="role-name" + type="j2ee:role-nameType" + minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="auth-methodType"> + <xsd:annotation> + <xsd:documentation> + + The auth-methodType is used to configure the authentication + mechanism for the web application. As a prerequisite to + gaining access to any web resources which are protected by + an authorization constraint, a user must have authenticated + using the configured mechanism. Legal values are "BASIC", + "DIGEST", "FORM", "CLIENT-CERT", or a vendor-specific + authentication scheme. + + Used in: login-config + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="dispatcherType"> + <xsd:annotation> + <xsd:documentation> + + The dispatcher has four legal values: FORWARD, REQUEST, INCLUDE, + and ERROR. A value of FORWARD means the Filter will be applied + under RequestDispatcher.forward() calls. A value of REQUEST + means the Filter will be applied under ordinary client calls to + the path or servlet. A value of INCLUDE means the Filter will be + applied under RequestDispatcher.include() calls. A value of + ERROR means the Filter will be applied under the error page + mechanism. The absence of any dispatcher elements in a + filter-mapping indicates a default of applying filters only under + ordinary client calls to the path or servlet. + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="FORWARD"/> + <xsd:enumeration value="INCLUDE"/> + <xsd:enumeration value="REQUEST"/> + <xsd:enumeration value="ERROR"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:simpleType name="encodingType"> + <xsd:annotation> + <xsd:documentation> + + The encodingType defines IANA character sets. + + </xsd:documentation> + </xsd:annotation> + + <xsd:restriction base="xsd:string"> + <xsd:pattern value="[^\s]+"/> + </xsd:restriction> + </xsd:simpleType> + +<!-- **************************************************** --> + + <xsd:complexType name="error-codeType"> + <xsd:annotation> + <xsd:documentation> + + The error-code contains an HTTP error code, ex: 404 + + Used in: error-page + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:xsdPositiveIntegerType"> + <xsd:pattern value="\d{3}"/> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="error-pageType"> + <xsd:annotation> + <xsd:documentation> + + The error-pageType contains a mapping between an error code + or exception type to the path of a resource in the web + application. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:choice> + <xsd:element name="error-code" + type="j2ee:error-codeType"/> + + <xsd:element name="exception-type" + type="j2ee:fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The exception-type contains a fully qualified class + name of a Java exception type. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + + <xsd:element name="location" + type="j2ee:war-pathType"> + <xsd:annotation> + <xsd:documentation> + + The location element contains the location of the + resource in the web application relative to the root of + the web application. The value of the location must have + a leading `/'. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="filter-mappingType"> + <xsd:annotation> + <xsd:documentation> + + Declaration of the filter mappings in this web + application is done by using filter-mappingType. + The container uses the filter-mapping + declarations to decide which filters to apply to a request, + and in what order. The container matches the request URI to + a Servlet in the normal way. To determine which filters to + apply it matches filter-mapping declarations either on + servlet-name, or on url-pattern for each filter-mapping + element, depending on which style is used. The order in + which filters are invoked is the order in which + filter-mapping declarations that match a request URI for a + servlet appear in the list of filter-mapping elements.The + filter-name value must be the value of the filter-name + sub-elements of one of the filter declarations in the + deployment descriptor. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="filter-name" + type="j2ee:filter-nameType"/> + <xsd:choice> + <xsd:element name="url-pattern" + type="j2ee:url-patternType"/> + <xsd:element name="servlet-name" + type="j2ee:servlet-nameType"/> + </xsd:choice> + <xsd:element name="dispatcher" + type="j2ee:dispatcherType" + minOccurs="0" maxOccurs="4"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="filter-nameType"> + <xsd:annotation> + <xsd:documentation> + + The logical name of the filter is declare + by using filter-nameType. This name is used to map the + filter. Each filter name is unique within the web + application. + + Used in: filter, filter-mapping + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:extension base="j2ee:nonEmptyStringType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="filterType"> + <xsd:annotation> + <xsd:documentation> + + The filterType is used to declare a filter in the web + application. The filter is mapped to either a servlet or a + URL pattern in the filter-mapping element, using the + filter-name value to reference. Filters can access the + initialization parameters declared in the deployment + descriptor at runtime via the FilterConfig interface. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:group ref="j2ee:descriptionGroup"/> + <xsd:element name="filter-name" + type="j2ee:filter-nameType"/> + <xsd:element name="filter-class" + type="j2ee:fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The fully qualified classname of the filter. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="init-param" + type="j2ee:param-valueType" + minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation> + + The init-param element contains a name/value pair as + an initialization param of a servlet filter + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="form-login-configType"> + <xsd:annotation> + <xsd:documentation> + + The form-login-configType specifies the login and error + pages that should be used in form based login. If form based + authentication is not used, these elements are ignored. + + Used in: login-config + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + + <xsd:element name="form-login-page" + type="j2ee:war-pathType"> + <xsd:annotation> + <xsd:documentation> + + The form-login-page element defines the location in the web + app where the page that can be used for login can be + found. The path begins with a leading / and is interpreted + relative to the root of the WAR. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="form-error-page" + type="j2ee:war-pathType"> + <xsd:annotation> + <xsd:documentation> + + The form-error-page element defines the location in + the web app where the error page that is displayed + when login is not successful can be found. + The path begins with a leading / and is interpreted + relative to the root of the WAR. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="http-methodType"> + <xsd:annotation> + + <xsd:documentation> + + The http-method contains an HTTP method recognized by the + web-app, for example GET, POST, ... + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="GET"/> + <xsd:enumeration value="POST"/> + <xsd:enumeration value="PUT"/> + <xsd:enumeration value="DELETE"/> + <xsd:enumeration value="HEAD"/> + <xsd:enumeration value="OPTIONS"/> + <xsd:enumeration value="TRACE"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="locale-encoding-mapping-listType"> + <xsd:annotation> + <xsd:documentation> + + The locale-encoding-mapping-list contains one or more + locale-encoding-mapping(s). + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="locale-encoding-mapping" + type="j2ee:locale-encoding-mappingType" + maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="locale-encoding-mappingType"> + <xsd:annotation> + <xsd:documentation> + + The locale-encoding-mapping contains locale name and + encoding name. The locale name must be either "Language-code", + such as "ja", defined by ISO-639 or "Language-code_Country-code", + such as "ja_JP". "Country code" is defined by ISO-3166. + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="locale" + type="j2ee:localeType"/> + <xsd:element name="encoding" + type="j2ee:encodingType"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:simpleType name="localeType"> + <xsd:annotation> + <xsd:documentation> + + The localeType defines valid locale defined by ISO-639-1 + and ISO-3166. + + </xsd:documentation> + </xsd:annotation> + + <xsd:restriction base="xsd:string"> + <xsd:pattern value="[a-z]{2}(_|-)?([\p{L}\-\p{Nd}]{2})?"/> + </xsd:restriction> + </xsd:simpleType> + +<!-- **************************************************** --> + + <xsd:complexType name="login-configType"> + <xsd:annotation> + <xsd:documentation> + + The login-configType is used to configure the authentication + method that should be used, the realm name that should be + used for this application, and the attributes that are + needed by the form login mechanism. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="auth-method" + type="j2ee:auth-methodType" + minOccurs="0"/> + <xsd:element name="realm-name" + type="j2ee:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + + The realm name element specifies the realm name to + use in HTTP Basic authorization. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="form-login-config" + type="j2ee:form-login-configType" + minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="mime-mappingType"> + <xsd:annotation> + <xsd:documentation> + + The mime-mappingType defines a mapping between an extension + and a mime type. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:annotation> + <xsd:documentation> + + The extension element contains a string describing an + extension. example: "txt" + + </xsd:documentation> + </xsd:annotation> + + <xsd:element name="extension" + type="j2ee:string"/> + <xsd:element name="mime-type" + type="j2ee:mime-typeType"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="mime-typeType"> + <xsd:annotation> + <xsd:documentation> + + The mime-typeType is used to indicate a defined mime type. + + Example: + "text/plain" + + Used in: mime-mapping + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:pattern value="[^\p{Cc}^\s]+/[^\p{Cc}^\s]+"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="nonEmptyStringType"> + <xsd:annotation> + <xsd:documentation> + This type defines a string which contains at least one + character. + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:minLength value="1"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="security-constraintType"> + <xsd:annotation> + <xsd:documentation> + + The security-constraintType is used to associate + security constraints with one or more web resource + collections + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="display-name" + type="j2ee:display-nameType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="web-resource-collection" + type="j2ee:web-resource-collectionType" + maxOccurs="unbounded"/> + <xsd:element name="auth-constraint" + type="j2ee:auth-constraintType" + minOccurs="0"/> + <xsd:element name="user-data-constraint" + type="j2ee:user-data-constraintType" + minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="servlet-mappingType"> + <xsd:annotation> + <xsd:documentation> + + The servlet-mappingType defines a mapping between a + servlet and a url pattern. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="servlet-name" + type="j2ee:servlet-nameType"/> + <xsd:element name="url-pattern" + type="j2ee:url-patternType"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="servlet-nameType"> + <xsd:annotation> + <xsd:documentation> + + The servlet-name element contains the canonical name of the + servlet. Each servlet name is unique within the web + application. + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:extension base="j2ee:nonEmptyStringType"/> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="servletType"> + <xsd:annotation> + <xsd:documentation> + + The servletType is used to declare a servlet. + It contains the declarative data of a + servlet. If a jsp-file is specified and the load-on-startup + element is present, then the JSP should be precompiled and + loaded. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:group ref="j2ee:descriptionGroup"/> + <xsd:element name="servlet-name" + type="j2ee:servlet-nameType"/> + <xsd:choice> + <xsd:element name="servlet-class" + type="j2ee:fully-qualified-classType"> + <xsd:annotation> + <xsd:documentation> + + The servlet-class element contains the fully + qualified class name of the servlet. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="jsp-file" + type="j2ee:jsp-fileType"/> + + </xsd:choice> + + <xsd:element name="init-param" + type="j2ee:param-valueType" + minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="load-on-startup" + type="j2ee:xsdIntegerType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + + The load-on-startup element indicates that this + servlet should be loaded (instantiated and have + its init() called) on the startup of the web + application. The optional contents of these + element must be an integer indicating the order in + which the servlet should be loaded. If the value + is a negative integer, or the element is not + present, the container is free to load the servlet + whenever it chooses. If the value is a positive + integer or 0, the container must load and + initialize the servlet as the application is + deployed. The container must guarantee that + servlets marked with lower integers are loaded + before servlets marked with higher integers. The + container may choose the order of loading of + servlets with the same load-on-start-up value. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="run-as" + type="j2ee:run-asType" + minOccurs="0"/> + <xsd:element name="security-role-ref" + type="j2ee:security-role-refType" + minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="session-configType"> + <xsd:annotation> + <xsd:documentation> + + The session-configType defines the session parameters + for this web application. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="session-timeout" + type="j2ee:xsdIntegerType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + + The session-timeout element defines the default + session timeout interval for all sessions created + in this web application. The specified timeout + must be expressed in a whole number of minutes. + If the timeout is 0 or less, the container ensures + the default behaviour of sessions is never to time + out. If this element is not specified, the container + must set its default timeout period. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="transport-guaranteeType"> + <xsd:annotation> + <xsd:documentation> + + The transport-guaranteeType specifies that the communication + between client and server should be NONE, INTEGRAL, or + CONFIDENTIAL. NONE means that the application does not + require any transport guarantees. A value of INTEGRAL means + that the application requires that the data sent between the + client and server be sent in such a way that it can't be + changed in transit. CONFIDENTIAL means that the application + requires that the data be transmitted in a fashion that + prevents other entities from observing the contents of the + transmission. In most cases, the presence of the INTEGRAL or + CONFIDENTIAL flag will indicate that the use of SSL is + required. + + Used in: user-data-constraint + + </xsd:documentation> + </xsd:annotation> + + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:enumeration value="NONE"/> + <xsd:enumeration value="INTEGRAL"/> + <xsd:enumeration value="CONFIDENTIAL"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="user-data-constraintType"> + <xsd:annotation> + <xsd:documentation> + + The user-data-constraintType is used to indicate how + data communicated between the client and container should be + protected. + + Used in: security-constraint + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="transport-guarantee" + type="j2ee:transport-guaranteeType"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="war-pathType"> + <xsd:annotation> + <xsd:documentation> + + The elements that use this type designate a path starting + with a "/" and interpreted relative to the root of a WAR + file. + + </xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:restriction base="j2ee:string"> + <xsd:pattern value="/.*"/> + </xsd:restriction> + </xsd:simpleContent> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:simpleType name="web-app-versionType"> + <xsd:annotation> + <xsd:documentation> + + This type contains the recognized versions of + web-application supported. It is used to designate the + version of the web application. + + </xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="2.4"/> + </xsd:restriction> + </xsd:simpleType> + +<!-- **************************************************** --> + + <xsd:complexType name="web-appType"> + + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:group ref="j2ee:descriptionGroup"/> + <xsd:element name="distributable" + type="j2ee:emptyType"/> + <xsd:element name="context-param" + type="j2ee:param-valueType"> + + <xsd:annotation> + <xsd:documentation> + + The context-param element contains the declaration + of a web application's servlet context + initialization parameters. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="filter" + type="j2ee:filterType"/> + <xsd:element name="filter-mapping" + type="j2ee:filter-mappingType"/> + <xsd:element name="listener" + type="j2ee:listenerType"/> + <xsd:element name="servlet" + type="j2ee:servletType"/> + <xsd:element name="servlet-mapping" + type="j2ee:servlet-mappingType"/> + <xsd:element name="session-config" + type="j2ee:session-configType"/> + <xsd:element name="mime-mapping" + type="j2ee:mime-mappingType"/> + <xsd:element name="welcome-file-list" + type="j2ee:welcome-file-listType"/> + <xsd:element name="error-page" + type="j2ee:error-pageType"/> + <xsd:element name="jsp-config" + type="j2ee:jsp-configType"/> + <xsd:element name="security-constraint" + type="j2ee:security-constraintType"/> + <xsd:element name="login-config" + type="j2ee:login-configType"/> + <xsd:element name="security-role" + type="j2ee:security-roleType"/> + <xsd:group ref="j2ee:jndiEnvironmentRefsGroup"/> + <xsd:element name="message-destination" + type="j2ee:message-destinationType"/> + <xsd:element name="locale-encoding-mapping-list" + type="j2ee:locale-encoding-mapping-listType"/> + </xsd:choice> + + <xsd:attribute name="version" + type="j2ee:web-app-versionType" + use="required"/> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="web-resource-collectionType"> + <xsd:annotation> + <xsd:documentation> + + The web-resource-collectionType is used to identify a subset + of the resources and HTTP methods on those resources within + a web application to which a security constraint applies. If + no HTTP methods are specified, then the security constraint + applies to all HTTP methods. + + Used in: security-constraint + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="web-resource-name" + type="j2ee:string"> + <xsd:annotation> + <xsd:documentation> + + The web-resource-name contains the name of this web + resource collection. + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="description" + type="j2ee:descriptionType" + minOccurs="0" + maxOccurs="unbounded"/> + <xsd:element name="url-pattern" + type="j2ee:url-patternType" + maxOccurs="unbounded"/> + <xsd:element name="http-method" + type="j2ee:http-methodType" + minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +<!-- **************************************************** --> + + <xsd:complexType name="welcome-file-listType"> + <xsd:annotation> + <xsd:documentation> + + The welcome-file-list contains an ordered list of welcome + files elements. + + Used in: web-app + + </xsd:documentation> + </xsd:annotation> + + <xsd:sequence> + <xsd:element name="welcome-file" + type="xsd:string" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation> + + The welcome-file element contains file name to use + as a default welcome file, such as index.html + + </xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID"/> + </xsd:complexType> + +</xsd:schema> + diff --git a/xml/tests/testData/documentation/xslCompletion.xsl b/xml/tests/testData/documentation/xslCompletion.xsl new file mode 100644 index 000000000000..d953aabf6cec --- /dev/null +++ b/xml/tests/testData/documentation/xslCompletion.xsl @@ -0,0 +1,12 @@ +<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="text" omit-xml-declaration="yes" encoding="UTF-8"/> + + <xsl:template match="/agent-definition/agent[@name='CustomAppsNexus']/properties/group[@id='nexusConfig']"> + <xsl:apply-templates select="string|integer|boolean"/> + </xsl:template> + + <xsl:template match="string"> + <xsl:a<caret>ttribute select="@id"/><xsl:text></xsl:text> + </xsl:template> + +</xsl:stylesheet>
\ No newline at end of file diff --git a/xml/tests/testData/documentation/xslCompletion.xsl.expected.completion.html b/xml/tests/testData/documentation/xslCompletion.xsl.expected.completion.html new file mode 100644 index 000000000000..2bcda1af66c3 --- /dev/null +++ b/xml/tests/testData/documentation/xslCompletion.xsl.expected.completion.html @@ -0,0 +1,230 @@ +<html x:found="true" x:href="http://www.w3.org/TR/xslt#element-apply-imports" xmlns:x="urn:xslt-documentation" xmlns="http://www.w3.org/1999/xhtml"> +<head> + +<style type="text/css" id="w3c"> + a.external { + text-decoration: none; + border-bottom-color: blue; + border-bottom-style: dashed; + border-bottom-width: thin; + } + + p.element-syntax { + border-color: black; + border-style: solid; + border-width: thin; + } + + /* 2005-10-03: Modified to work with Java's HTML displaying capabilities */ + + /* Style for a "Recommendation" (http://www.w3.org/StyleSheets/TR/W3C-REC) */ + + /* + Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved. + The following software licensing rules apply: + http://www.w3.org/Consortium/Legal/copyright-software */ + + body { + margin: 0; + font-family: sans-serif; + color: black; + background-position: top left; + } + + :link { + color: #00C; + background: transparent + } + + :visited { + color: #609; + background: transparent + } + + a:active { + color: #C00; + background: transparent + } + + a:link img, a:visited img { + border-style: none + } + + /* no border on img links */ + + a img { + color: white; + } + + th, td { + /* ns 4 */ + font-family: sans-serif; + } + + h1, h2, h3, h4, h5, h6 { + text-align: left + } + + /* background should be transparent, but WebTV has a bug */ + h1, h2, h3 { + color: #005A9C; + } + + h1 { + font: 170% sans-serif + } + + h2 { + font: 140% sans-serif + } + + h3 { + font: 100% sans-serif + } + + h4 { + font: bold 100% sans-serif + } + + h5 { + font: italic 100% sans-serif + } + + h6 { + font: small-caps 100% sans-serif + } + + .hide { + display: none + } + + div.head { + margin-bottom: 1em + } + + div.head h1 { + margin-top: 2em; + clear: both + } + + div.head table { + margin-left: 2em; + margin-top: 2em + } + + p.copyright { + margin-top: 15px; + font-size: 90% + } + + p.copyright small { + font-size: small + } + + /* hide from IE3 */ + a[href]:hover { + background: #ffa + } + + pre { + margin-left: 2em + } + + /* + p { + margin-top: 0.6em; + margin-bottom: 0.6em; + } + */ + dt, dd { + margin-top: 0; + margin-bottom: 0 + } + + /* opera 3.50 */ + dt { + font-weight: bold + } + + pre, code { + font-family: monospace + } + + /* navigator 4 requires this */ + + ul.toc { + list-style: disc; /* Mac NS has problem with 'none' */ + list-style: none; + } +</style> +</head> +<body> + +<h3> +<a name="apply-imports"></a>Overriding Template Rules</h3> + + +<p class="element-syntax"> +<a name="element-apply-imports"></a><code><!-- + Category: instruction --><br> + <xsl:apply-imports /></code> +</p> + + +<p>A template rule that is being used to override a template rule in an + imported stylesheet (see <a class="external" href="http://www.w3.org/TR/xslt#conflict">[<b>5.5 Conflict Resolution for + Template Rules</b>]</a>) can use the <code>xsl:apply-imports</code> element + to invoke the overridden template rule.</p> + + +<p> +<a name="dt-current-template-rule"></a>At any point in the processing of a + stylesheet, there is a <b>current template rule</b>. Whenever a template + rule is chosen by matching a pattern, the template rule becomes the current + template rule for the instantiation of the rule's template. When an + <code>xsl:for-each</code> element is instantiated, the current template rule + becomes null for the instantiation of the content of the + <code>xsl:for-each</code> element.</p> + + +<p> +<code>xsl:apply-imports</code> processes the current node using only + template rules that were imported into the stylesheet element containing the + current template rule; the node is processed in the current template rule's + mode. It is an error if <code>xsl:apply-imports</code> is instantiated when + the current template rule is null.</p> + + +<p>For example, suppose the stylesheet <code>doc.xsl</code> contains a + template rule for <code>example</code> elements:</p> + +<pre><xsl:template match="example"> + <pre><xsl:apply-templates/></pre> + </xsl:template></pre> + + +<p>Another stylesheet could import <code>doc.xsl</code> and modify the + treatment of <code>example</code> elements as follows:</p> + +<pre><xsl:import href="doc.xsl"/> + +<xsl:template match="example"> + <div style="border: solid red"> + <xsl:apply-imports/> + </div> +</xsl:template></pre> + + +<p>The combined effect would be to transform an <code>example</code> into an + element of the form:</p> + +<pre><div style="border: solid red"><pre>...</pre></div></pre> + +<p id="w3c-footer" class="copyright"> +<a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Copyright">Copyright</a> + © 1999 <a href="http://www.w3.org">W3C</a><sup>®</sup> + (<a href="http://www.lcs.mit.edu">MIT</a>, <a href="http://www.inria.fr/">INRIA</a>, + <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. + </p> +</body> +</html> diff --git a/xml/tests/testData/documentation/xslCompletion.xsl.expected.html b/xml/tests/testData/documentation/xslCompletion.xsl.expected.html new file mode 100644 index 000000000000..931a18156073 --- /dev/null +++ b/xml/tests/testData/documentation/xslCompletion.xsl.expected.html @@ -0,0 +1,283 @@ +<html x:found="true" x:href="http://www.w3.org/TR/xslt#element-attribute" xmlns:x="urn:xslt-documentation" xmlns="http://www.w3.org/1999/xhtml"> +<head> + +<style type="text/css" id="w3c"> + a.external { + text-decoration: none; + border-bottom-color: blue; + border-bottom-style: dashed; + border-bottom-width: thin; + } + + p.element-syntax { + border-color: black; + border-style: solid; + border-width: thin; + } + + /* 2005-10-03: Modified to work with Java's HTML displaying capabilities */ + + /* Style for a "Recommendation" (http://www.w3.org/StyleSheets/TR/W3C-REC) */ + + /* + Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved. + The following software licensing rules apply: + http://www.w3.org/Consortium/Legal/copyright-software */ + + body { + margin: 0; + font-family: sans-serif; + color: black; + background-position: top left; + } + + :link { + color: #00C; + background: transparent + } + + :visited { + color: #609; + background: transparent + } + + a:active { + color: #C00; + background: transparent + } + + a:link img, a:visited img { + border-style: none + } + + /* no border on img links */ + + a img { + color: white; + } + + th, td { + /* ns 4 */ + font-family: sans-serif; + } + + h1, h2, h3, h4, h5, h6 { + text-align: left + } + + /* background should be transparent, but WebTV has a bug */ + h1, h2, h3 { + color: #005A9C; + } + + h1 { + font: 170% sans-serif + } + + h2 { + font: 140% sans-serif + } + + h3 { + font: 100% sans-serif + } + + h4 { + font: bold 100% sans-serif + } + + h5 { + font: italic 100% sans-serif + } + + h6 { + font: small-caps 100% sans-serif + } + + .hide { + display: none + } + + div.head { + margin-bottom: 1em + } + + div.head h1 { + margin-top: 2em; + clear: both + } + + div.head table { + margin-left: 2em; + margin-top: 2em + } + + p.copyright { + margin-top: 15px; + font-size: 90% + } + + p.copyright small { + font-size: small + } + + /* hide from IE3 */ + a[href]:hover { + background: #ffa + } + + pre { + margin-left: 2em + } + + /* + p { + margin-top: 0.6em; + margin-bottom: 0.6em; + } + */ + dt, dd { + margin-top: 0; + margin-bottom: 0 + } + + /* opera 3.50 */ + dt { + font-weight: bold + } + + pre, code { + font-family: monospace + } + + /* navigator 4 requires this */ + + ul.toc { + list-style: disc; /* Mac NS has problem with 'none' */ + list-style: none; + } +</style> +</head> +<body> + +<h3> +<a name="creating-attributes"></a>Creating Attributes with + <code>xsl:attribute</code> +</h3> + + +<p class="element-syntax"> +<a name="element-attribute"></a><code><!-- + Category: instruction --><br> + <xsl:attribute<br> + <b>name</b> = { <var>qname</var> }<br> + namespace = { <var>uri-reference</var> }><br> + <!-- Content: <var>template</var> --><br> + </xsl:attribute></code> +</p> + + +<p>The <code>xsl:attribute</code> element can be used to add attributes to + result elements whether created by literal result elements in the stylesheet + or by instructions such as <code>xsl:element</code>. The <a class="external" href="http://www.w3.org/TR/xpath#dt-expanded-name">expanded-name</a> of the + attribute to be created is specified by a required <code>name</code> + attribute and an optional <code>namespace</code> attribute. Instantiating an + <code>xsl:attribute</code> element adds an attribute node to the containing + result element node. The content of the <code>xsl:attribute</code> element is + a template for the value of the created attribute.</p> + + +<p>The <code>name</code> attribute is interpreted as an <a class="external" href="http://www.w3.org/TR/xslt#dt-attribute-value-template">attribute value template</a>. It is an + error if the string that results from instantiating the attribute value + template is not a <a class="external" href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> or is the string + <code>xmlns</code>. An XSLT processor may signal the error; if it does not + signal the error, it must recover by not adding the attribute to the result + tree. If the <code>namespace</code> attribute is not present, then the <a class="external" href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> is expanded into + an expanded-name using the namespace declarations in effect for the + <code>xsl:attribute</code> element, <i>not</i> including any default + namespace declaration.</p> + + +<p>If the <code>namespace</code> attribute is present, then it also is + interpreted as an <a class="external" href="http://www.w3.org/TR/xslt#dt-attribute-value-template">attribute value + template</a>. The string that results from instantiating it should be a URI + reference. It is not an error if the string is not a syntactically legal URI + reference. If the string is empty, then the expanded-name of the attribute + has a null namespace URI. Otherwise, the string is used as the namespace URI + of the expanded-name of the attribute to be created. The local part of the <a class="external" href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> specified by the + <code>name</code> attribute is used as the local part of the expanded-name of + the attribute to be created.</p> + + +<p>XSLT processors may make use of the prefix of the <a class="external" href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> specified in the + <code>name</code> attribute when selecting the prefix used for outputting the + created attribute as XML; however, they are not required to do so and, if the + prefix is <code>xmlns</code>, they must not do so. Thus, although it is not + an error to do:</p> + +<pre><xsl:attribute name="xmlns:xsl" namespace="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute></pre> + + +<p>it will not result in a namespace declaration being output.</p> + + +<p>Adding an attribute to an element replaces any existing attribute of that + element with the same expanded-name.</p> + + +<p>The following are all errors:</p> + +<ul> + +<li> +<p>Adding an attribute to an element after children have been added to + it; implementations may either signal the error or ignore the + attribute.</p> + +</li> + +<li> +<p>Adding an attribute to a node that is not an element; + implementations may either signal the error or ignore the attribute.</p> + +</li> + +<li> +<p>Creating nodes other than text nodes during the instantiation of the + content of the <code>xsl:attribute</code> element; implementations may + either signal the error or ignore the offending nodes.</p> + +</li> + +</ul> + + +<blockquote> + +<b>NOTE:</b>When an <code>xsl:attribute</code> contains a text node with a + newline, then the XML output must contain a character reference. For + example, + <pre><xsl:attribute name="a">x +y</xsl:attribute></pre> + will result in the output + <pre>a="x&#xA;y"</pre> + (or with any equivalent character reference). The XML output cannot be + <pre>a="x +y"</pre> + This is because XML 1.0 requires newline characters in attribute values to + be normalized into spaces but requires character references to newline + characters not to be normalized. The attribute values in the data model + represent the attribute value after normalization. If a newline occurring + in an attribute value in the tree were output as a newline character rather + than as character reference, then the attribute value in the tree created + by reparsing the XML would contain a space not a newline, which would mean + that the tree had not been output correctly.</blockquote> + +<p id="w3c-footer" class="copyright"> +<a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Copyright">Copyright</a> + © 1999 <a href="http://www.w3.org">W3C</a><sup>®</sup> + (<a href="http://www.lcs.mit.edu">MIT</a>, <a href="http://www.inria.fr/">INRIA</a>, + <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. + </p> +</body> +</html> diff --git a/xml/tests/testData/psi/testEmptyElementsInDtd.txt b/xml/tests/testData/psi/testEmptyElementsInDtd.txt index 98de113e9b09..5fc67a3373fa 100644 --- a/xml/tests/testData/psi/testEmptyElementsInDtd.txt +++ b/xml/tests/testData/psi/testEmptyElementsInDtd.txt @@ -4,7 +4,7 @@ XmlFile:test.dtd <empty list> PsiElement(XML_ELEMENT_DECL) XmlToken:XML_ELEMENT_DECL_START('<!ELEMENT') - PsiErrorElement:xml name expected + PsiErrorElement:XML name expected <empty list> PsiWhiteSpace(' ') XmlToken:XML_TAG_END('>') @@ -17,14 +17,14 @@ XmlFile:test.dtd PsiElement(XML_ELEMENT_CONTENT_SPEC) PsiElement(XML_ELEMENT_CONTENT_GROUP) XmlToken:XML_LEFT_PAREN('(') - PsiErrorElement:Xml name or entity ref expected + PsiErrorElement:XML name or entity ref expected <empty list> XmlToken:XML_COMMA(',') XmlToken:XML_RIGHT_PAREN(')') PsiWhiteSpace('\n') PsiElement(XML_ATTLIST_DECL) XmlToken:XML_ATTLIST_DECL_START('<!ATTLIST') - PsiErrorElement:xml name expected + PsiErrorElement:XML name expected <empty list> PsiWhiteSpace(' ') XmlToken:XML_TAG_END('>') @@ -57,7 +57,7 @@ XmlFile:test.dtd XmlToken:XML_LEFT_PAREN('(') XmlToken:XML_NAME('aaa') XmlToken:XML_COMMA(',') - PsiErrorElement:Xml name or entity ref expected + PsiErrorElement:XML name or entity ref expected <empty list> XmlToken:XML_RIGHT_PAREN(')') XmlToken:XML_TAG_END('>') diff --git a/xml/tests/testData/psi/testEntityDeclaration.txt b/xml/tests/testData/psi/testEntityDeclaration.txt index e8b81a6e4c48..e328434c7919 100644 --- a/xml/tests/testData/psi/testEntityDeclaration.txt +++ b/xml/tests/testData/psi/testEntityDeclaration.txt @@ -13,7 +13,7 @@ XmlFile:test.dtd PsiWhiteSpace(' ') PsiElement(XML_ENTITY_DECL) XmlToken:XML_ENTITY_DECL_START('<!ENTITY') - PsiErrorElement:xml name expected + PsiErrorElement:XML name expected <empty list> PsiWhiteSpace(' ') XmlToken:XML_TAG_END('>')
\ No newline at end of file diff --git a/xml/tests/testData/psi/testKeywordsAsName.txt b/xml/tests/testData/psi/testKeywordsAsName.txt new file mode 100644 index 000000000000..56cc129522cd --- /dev/null +++ b/xml/tests/testData/psi/testKeywordsAsName.txt @@ -0,0 +1,58 @@ +XmlFile:test.dtd + PsiElement(XML_DOCUMENT) + PsiElement(XML_PROLOG) + <empty list> + PsiElement(XML_ELEMENT_DECL) + XmlToken:XML_ELEMENT_DECL_START('<!ELEMENT') + PsiWhiteSpace(' ') + XmlToken:XML_NAME('FIELD') + PsiWhiteSpace(' ') + PsiElement(XML_ELEMENT_CONTENT_SPEC) + XmlToken:XML_CONTENT_ANY('ANY') + XmlToken:XML_TAG_END('>') + PsiWhiteSpace('\n') + PsiElement(XML_ELEMENT_DECL) + XmlToken:XML_ELEMENT_DECL_START('<!ELEMENT') + PsiWhiteSpace(' ') + XmlToken:XML_NAME('PUBLIC') + PsiWhiteSpace(' ') + PsiElement(XML_ELEMENT_CONTENT_SPEC) + XmlToken:XML_CONTENT_ANY('ANY') + XmlToken:XML_TAG_END('>') + PsiWhiteSpace('\n') + PsiElement(XML_ELEMENT_DECL) + XmlToken:XML_ELEMENT_DECL_START('<!ELEMENT') + PsiWhiteSpace(' ') + XmlToken:XML_NAME('EMPTY') + PsiWhiteSpace(' ') + PsiElement(XML_ELEMENT_CONTENT_SPEC) + XmlToken:XML_CONTENT_ANY('ANY') + XmlToken:XML_TAG_END('>') + PsiWhiteSpace('\n') + PsiElement(XML_ELEMENT_DECL) + XmlToken:XML_ELEMENT_DECL_START('<!ELEMENT') + PsiWhiteSpace(' ') + XmlToken:XML_NAME('ANY') + PsiWhiteSpace(' ') + PsiElement(XML_ELEMENT_CONTENT_SPEC) + XmlToken:XML_CONTENT_ANY('ANY') + XmlToken:XML_TAG_END('>') + PsiWhiteSpace('\n') + PsiElement(XML_ELEMENT_DECL) + XmlToken:XML_ELEMENT_DECL_START('<!ELEMENT') + PsiWhiteSpace(' ') + XmlToken:XML_NAME('AND') + PsiWhiteSpace(' ') + PsiElement(XML_ELEMENT_CONTENT_SPEC) + PsiElement(XML_ELEMENT_CONTENT_GROUP) + XmlToken:XML_LEFT_PAREN('(') + XmlToken:XML_NAME('FIELD') + XmlToken:XML_BAR('|') + XmlToken:XML_NAME('PUBLIC') + XmlToken:XML_BAR('|') + XmlToken:XML_CONTENT_EMPTY('EMPTY') + XmlToken:XML_BAR('|') + XmlToken:XML_CONTENT_ANY('ANY') + XmlToken:XML_RIGHT_PAREN(')') + XmlToken:XML_STAR('*') + XmlToken:XML_TAG_END('>')
\ No newline at end of file diff --git a/xml/tests/testData/unusedNs/spring-batch-2.1.xsd b/xml/tests/testData/unusedNs/spring-batch-2.1.xsd new file mode 100644 index 000000000000..a4cadf5108e9 --- /dev/null +++ b/xml/tests/testData/unusedNs/spring-batch-2.1.xsd @@ -0,0 +1,1291 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema xmlns="http://www.springframework.org/schema/batch" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" + xmlns:tool="http://www.springframework.org/schema/tool" targetNamespace="http://www.springframework.org/schema/batch" + elementFormDefault="qualified" attributeFormDefault="unqualified" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool-2.5.xsd" + version="2.1"> + + <xsd:import namespace="http://www.springframework.org/schema/beans" /> + <xsd:import namespace="http://www.springframework.org/schema/tool" /> + + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines the configuration elements for Spring Batch Core. + ]]></xsd:documentation> + </xsd:annotation> + + <xsd:element name="job"> + <xsd:annotation> + <xsd:documentation> + Defines a job composed of a set of steps and + transitions between steps. The job will be exposed in + the enclosing + bean factory as a component of type Job + that can be launched using a + JobLauncher. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="description" type="description" minOccurs="0" /> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:group ref="flowGroup" minOccurs="1" maxOccurs="unbounded" /> + <xsd:element name="listeners"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + List of all listeners for the job + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="listener" type="jobExecutionListenerType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="validator"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A JobParametersValidator as an inner bean definition. + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attribute name="ref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A reference to a JobParametersValidator. + ]]> + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attributeGroup ref="jobRepositoryAttribute" /> + <xsd:attribute name="incrementer" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A reference to a JobParametersIncrementer bean definition. This will be + used to provide new parameters to a Job instance that is starting in a + sequence. + ]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.batch.core.JobParametersIncrementer" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="restartable" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Whether the job should be retartable or not in case of failure. Set this to false + if the Job should not be restarted. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="parentAttribute" /> + <xsd:attributeGroup ref="abstractAttribute" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="step"> + <xsd:annotation> + <xsd:documentation> + Defines a stage in job processing backed by a + Step. The id attribute must be specified since this + step definition + will be referred to from other elements + to form a Job flow. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="stepType"> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attributeGroup ref="abstractAttribute" /> + <xsd:attributeGroup ref="jobRepositoryAttribute" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="flow"> + <xsd:annotation> + <xsd:documentation> + Defines a flow composed of a set of steps and + transitions between steps. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="description" type="description" minOccurs="0" /> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:group ref="flowGroup" /> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attribute name="abstract" type="xsd:boolean" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="job-listener"> + <xsd:annotation> + <xsd:documentation> + A reference to a JobExecutionListener (or a POJO + if using before-job-method / after-job-method or + source level + annotations). + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="jobExecutionListenerType"> + <xsd:attribute name="id" type="xsd:ID" use="optional" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="step-listener"> + <xsd:annotation> + <xsd:documentation> + A bean definition for a step listener (or POJO if + using *-method attributes or source level + annotations) + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="stepListenerType"> + <xsd:attribute name="id" type="xsd:ID" use="optional" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="job-repository"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Configures a JobRepository using a relational database. This is + needed by many other components (principally Job and Step implementations). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="beans:identifiedType"> + <xsd:attribute name="data-source" type="xsd:string" default="dataSource"> + <xsd:annotation> + <xsd:documentation source="java:javax.sql.DataSource"><![CDATA[ +ref" is not required, and only needs to be specified explicitly + if the bean name of the desired DataSource is not 'dataSource'. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="javax.sql.DataSource" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="transaction-manager" type="xsd:string" default="transactionManager"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.transaction.PlatformTransactionManager"><![CDATA[ + The bean name of the TransactionManager that is to be used. This attribute + is not required, and only needs to be specified explicitly + if the bean name of the desired TransactionManager is not 'transactionManager'. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.transaction.PlatformTransactionManager" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="isolation-level-for-create" default="SERIALIZABLE" type="isolationType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The isolation level to use for creation of job execution entities. + The default is SERIALIZABLE, which prevents accidental + concurrent execution of the same job (REPEATABLE_READ + would work as well). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="max-varchar-length" type="xsd:int"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The maximum length for a Java String that will fit in the long VARCHAR + columns in the database. Can be less than the declared length in the DDL + if the database supports multi-byte characters. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="table-prefix" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The the table prefix to use for all the batch meta-data tables. + Defaults to "BATCH_". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lob-handler" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A reference to the lob handler (optional). Only override if using Oracle and + the database type is not being detected for some reason. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.jdbc.support.lob.LobHandler" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:group name="flowGroup"> + <xsd:choice> + <xsd:element name="step"> + <xsd:annotation> + <xsd:documentation> + Defines a stage in job processing backed by a + Step. The id attribute must be specified. The + step + requires either + a chunk definition, + a tasklet reference, or a reference to a + (possibly abstract) parent step. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="stepType"> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attributeGroup ref="nextAttribute" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:element name="split"> + <xsd:annotation> + <xsd:documentation> + Declares job should split here into two or more + subflows. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="flow"> + <xsd:annotation> + <xsd:documentation> + A subflow within a job, having the same + format as a job, but without a separate identity. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="flowGroup" minOccurs="0" maxOccurs="unbounded" /> + <xsd:attribute name="parent" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.job.flow.Flow"><![CDATA[ + The flow that will execute at this point in the job. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.batch.core.job.flow.Flow" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:group ref="transitions" /> + </xsd:choice> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attribute name="task-executor" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.core.task.TaskExecutor"><![CDATA[ + The task executor responsible for executing the task. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="java:org.springframework.core.task.TaskExecutor" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="nextAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="flow"> + <xsd:annotation> + <xsd:documentation> + Declares job should include an externalized flow + here. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="transitions" minOccurs="0" maxOccurs="unbounded" /> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attribute name="parent" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.job.flow.Flow"><![CDATA[ + The flow that will execute at this point in the job specified as a + parent bean definition id. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.batch.core.job.flow.Flow" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="nextAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="decision"> + <xsd:annotation> + <xsd:documentation> + Declares job should query a decider to determine + where execution should go next. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="transitions" minOccurs="0" maxOccurs="unbounded" /> + <xsd:attribute name="id" type="xsd:ID" use="required" /> + <xsd:attribute name="decider" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + The decider is a reference to a + JobExecutionDecider that can produce a status to base + the next + transition on. + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.batch.core.job.flow.JobExecutionDecider" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:group> + + <xsd:complexType name="stepType"> + <xsd:sequence> + <xsd:element name="description" type="description" minOccurs="0" /> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:choice> + <xsd:element name="tasklet" type="taskletType" /> + <!-- custom namespace tasklet declaration --> + <xsd:any namespace="##other" minOccurs="1" maxOccurs="1" processContents="skip"/> + </xsd:choice> + <xsd:element name="partition" type="partitionType" /> + <xsd:element name="job"> + <xsd:complexType> + <xsd:attribute name="ref"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.Job"><![CDATA[ + The job that will execute in this step. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.batch.core.Job" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="job-launcher"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.launch.JobLauncher"><![CDATA[ + The job that will execute in this step. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="java:org.springframework.batch.core.launch.JobLauncher" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="job-parameters-extractor"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.step.job.JobParametersExtractor"><![CDATA[ + The job parameters extractor to convert step execution into job parameters. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="java:org.springframework.batch.core.step.job.JobParametersExtractor" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="flow"> + <xsd:complexType> + <xsd:attribute name="parent" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.job.flow.Flow"><![CDATA[ + The flow that will execute in this step. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="parent"> + <tool:expected-type type="org.springframework.batch.core.job.flow.Flow" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:choice> + <xsd:group ref="transitions" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="listeners" type="stepListenersType" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> + <xsd:attributeGroup ref="parentAttribute" /> + </xsd:complexType> + + <xsd:complexType name="partitionType"> + <xsd:all> + <xsd:element name="step" type="stepType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="handler" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Inline specification of a simple TaskExecutorPartitionHandler]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="task-executor"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Reference to a TaskExecutor]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.core.task.TaskExecutor" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="grid-size"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Grid size for the handler. Defaults to 6.]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="direct" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:all> + <xsd:attribute name="handler"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Reference to a PartitionHandler]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.core.partition.PartitionHandler" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="aggregator"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Reference to a StepExecutionAggregator that will be used to merge the partition results back into the master StepExecution]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.core.partition.support.StepExecutionAggregator" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="partitioner"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Reference to a Partitioner]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.core.partition.support.Partitioner" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="step"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Reference to a Step]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.core.Step" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="taskletType"> + <xsd:all> + <xsd:element name="chunk" type="chunkTaskletType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="transaction-attributes" type="transaction-attributesType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="no-rollback-exception-classes" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + List of exception classes that should not cause rollback if possible. This list + is only a hint and has to be interpreted by the step to make sense in context (e.g. + it might not be possible to honour the hint during a write operation, so consider moving + code that throws these exceptions to a processor or validator). + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="includeElementGroup" minOccurs="0" maxOccurs="unbounded" /> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="listeners" type="stepListenersType" minOccurs="0" maxOccurs="1" /> + <xsd:element ref="beans:bean" minOccurs="0" maxOccurs="1" /> + <xsd:element ref="beans:ref" minOccurs="0" maxOccurs="1" /> + </xsd:all> + <xsd:attribute name="ref" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation> + The tasklet is a reference to another bean + definition that implements + the Tasklet interface. + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="method" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation> + If the tasklet is specified as a bean definition, then a method can be specified and a POJO + will + be adapted to the Tasklet interface. The method suggested should have the same arguments + as Tasklet.execute (or a subset), and have a compatible return type (boolean, void or RepeatStatus). + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="start-limit" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The maximum number of times a Step may be started. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="allow-start-if-complete" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Set to true to allow a step to be started even if it is already complete. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="transaction-manager" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.transaction.PlatformTransactionManager"><![CDATA[ + The bean name of the TransactionManager that is to be used. This attribute + is not required, and only needs to be specified explicitly + if the bean name of the desired TransactionManager is not 'transactionManager'. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.transaction.PlatformTransactionManager" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="task-executor" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.core.task.TaskExecutor"><![CDATA[ + The task executor responsible for executing the task. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.core.task.TaskExecutor" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="throttle-limit" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + This limits the number of tasks queued for concurrent + processing to prevent thread pools from being overwhelmed. + Default is 4. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="transaction-attributesType"> + <xsd:attribute name="propagation"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.transaction.annotation.Propagation"><![CDATA[ + The transaction propagation behavior. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="REQUIRED" /> + <xsd:enumeration value="SUPPORTS" /> + <xsd:enumeration value="MANDATORY" /> + <xsd:enumeration value="REQUIRES_NEW" /> + <xsd:enumeration value="NOT_SUPPORTED" /> + <xsd:enumeration value="NEVER" /> + <xsd:enumeration value="NESTED" /> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="isolation" type="isolationType"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.transaction.annotation.Isolation"><![CDATA[ + The transaction isolation level. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="timeout" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The transaction timeout value (in seconds). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:simpleType name="isolationType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="DEFAULT" /> + <xsd:enumeration value="READ_UNCOMMITTED" /> + <xsd:enumeration value="READ_COMMITTED" /> + <xsd:enumeration value="REPEATABLE_READ" /> + <xsd:enumeration value="SERIALIZABLE" /> + </xsd:restriction> + </xsd:simpleType> + + <xsd:group name="beanElementGroup"> + <xsd:choice> + <xsd:element ref="beans:bean" /> + <xsd:element ref="beans:ref" /> + </xsd:choice> + </xsd:group> + + <xsd:complexType name="chunkTaskletType"> + <xsd:all> + <xsd:element name="reader" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The ItemReader used by the step. + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attributeGroup ref="adapterMethodAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="processor" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The ItemProcessor used by the step. + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attributeGroup ref="adapterMethodAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="writer" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The ItemWriter used by the step. + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attributeGroup ref="adapterMethodAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="skip-policy" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The SkipPolicy used by the step. If specified then the skip limit and skippable exceptions are ignored + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attributeGroup ref="adapterMethodAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="retry-policy" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The RetryPolicy used by the step. If specified then the retry limit and retryable exceptions are ignored + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attributeGroup ref="adapterMethodAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="retry-listeners" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + List of all listeners for the step definition + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="listener" type="listenerType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="streams" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + List of all streams to be included for the step definition + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="stream" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A reference to an ItemStream bean definition + ]]> + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.batch.item.ItemStream" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="skippable-exception-classes" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + List of exception classes that are skippable. Exceptions (and their subclasses) that + are declared as included take precedence over the same value if it is also excluded. + Exceptions that are already marked as no-rollback + are automatically skippable (but it doesn't hurt to add them again here). + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="includeExcludeElementGroup" minOccurs="0" maxOccurs="unbounded" /> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="retryable-exception-classes" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + List of exception classes that are retryable. Exceptions (and their subclasses) that + are declared as included take precedence over the same value if it is also excluded. + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="includeExcludeElementGroup" minOccurs="0" maxOccurs="unbounded" /> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="listeners" type="stepListenersType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + <xsd:attribute name="commit-interval" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The number of items that will be processed before commit is called for the transaction. + Either set this or the chunk-completion-policy but not both. Can be specified as an expression + that will be evaluated in the scope of the step (e.g. "#{jobParameters['commit.interval']}"). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="reader" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The bean name of the item reader that is to be used for the process. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.batch.item.ItemReader" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="processor" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The bean name of the item processor that is to be used for the process. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.batch.item.ItemProcessor" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="writer" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The bean name of the item writer that is to be used for the process. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.batch.item.ItemWriter" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="skip-limit" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The maximum number of items that will be allowed to be skipped. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="skip-policy" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The skip policy to use. If specified then the skip limit and skippable exceptions are ignored. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.core.step.skip.SkipPolicy" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="retry-policy" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The retry policy to use. If specified then the retry limit and retryable exceptions are ignored. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + <tool:expected-type type="org.springframework.batch.retry.RetryPolicy" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="retry-limit" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The maximum number of times the processing of an item will be retried. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="cache-capacity" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The capacity of the cache in the retry policy. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="reader-transactional-queue" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Whether the reader is a transactional queue. If it is then items read should not be cached + in the event of a rollback since they will be returned to the queue. Default is false. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="processor-transactional" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Whether the processor is transaction aware. If it is then processed items should not be + cached in between transactions in case of a rollback. N.B. if reader-transactional-queue + is true then so should this be. Default is true. If false then the processor is only called + once per item per chunk, even if there are rollbacks with retries and skips. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="chunk-completion-policy" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.repeat.CompletionPolicy"><![CDATA[ + A transaction will be committed when this policy decides to + complete. Defaults to a SimpleCompletionPolicy with chunk size + equal to the commit-interval attribute. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="java:org.springframework.batch.repeat.CompletionPolicy" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:attributeGroup name="nextAttribute"> + <xsd:attribute name="next" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A shortcut for specifying the next step to execute after this one, if there is only one choice. The next + attribute is a synonym for <next on="*"/> plus <fail on="FAILED"/> in a transition. + If this attribute is specified, then there should be no nested transition elements]]> + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:attributeGroup name="exceptionClassAttribute"> + <xsd:attribute name="class" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + An exception class name. + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="direct"> + <tool:expected-type type="java.lang.Class" /> + <tool:assignable-to type="java.lang.Throwable" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:group name="includeElementGroup"> + <xsd:choice> + <xsd:element name="include"> + <xsd:annotation> + <xsd:documentation> + Classify an exception as "included" in the set. Exceptions of this type or a subclass are + included. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attributeGroup ref="exceptionClassAttribute" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:group> + + <xsd:group name="includeExcludeElementGroup"> + <xsd:choice> + <xsd:group ref="includeElementGroup" /> + <xsd:element name="exclude"> + <xsd:annotation> + <xsd:documentation> + Classify an exception as "excluded" from the + set. Exceptions of this type or a subclass are + excluded + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attributeGroup ref="exceptionClassAttribute" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:group> + + <xsd:complexType name="listenerType"> + <xsd:group ref="beanElementGroup" minOccurs="0" maxOccurs="1" /> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + A reference to a listener, a POJO with a + listener-annotated method, or a POJO with + a method + referenced by a + *-method attribute. + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:complexType name="jobExecutionListenerType"> + <xsd:complexContent> + <xsd:extension base="listenerType"> + <xsd:attribute name="before-job-method" type="xsd:string" /> + <xsd:attribute name="after-job-method" type="xsd:string" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="stepListenerType"> + <xsd:complexContent> + <xsd:extension base="listenerType"> + <xsd:attribute name="before-step-method" type="xsd:string" /> + <xsd:attribute name="after-step-method" type="xsd:string" /> + <xsd:attribute name="before-chunk-method" type="xsd:string" /> + <xsd:attribute name="after-chunk-method" type="xsd:string" /> + <xsd:attribute name="before-read-method" type="xsd:string" /> + <xsd:attribute name="after-read-method" type="xsd:string" /> + <xsd:attribute name="on-read-error-method" type="xsd:string" /> + <xsd:attribute name="before-process-method" type="xsd:string" /> + <xsd:attribute name="after-process-method" type="xsd:string" /> + <xsd:attribute name="on-process-error-method" type="xsd:string" /> + <xsd:attribute name="before-write-method" type="xsd:string" /> + <xsd:attribute name="after-write-method" type="xsd:string" /> + <xsd:attribute name="on-write-error-method" type="xsd:string" /> + <xsd:attribute name="on-skip-in-read-method" type="xsd:string" /> + <xsd:attribute name="on-skip-in-process-method" type="xsd:string" /> + <xsd:attribute name="on-skip-in-write-method" type="xsd:string" /> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="stepListenersType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The listeners for a step definition of any type relevant for a step (extensions of StepListener), + ]]> + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="listener" type="stepListenerType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attributeGroup ref="mergeAttribute" /> + </xsd:complexType> + + <xsd:group name="transitions"> + <xsd:choice> + <xsd:element name="next"> + <xsd:annotation> + <xsd:documentation> + Defines a transition from this step to the + next + one depending on the value of the exit + status. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="on" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>A pattern to match against the exit status + code. Use * and ? as wildcard characters. When a + step finishes + the most + specific match will be chosen to select the next step. + Hint: + always include a default + transition with on="*". + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="to" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation> + The name of the step to go to next. Must + resolve to one of the other steps in this job. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="stop"> + <xsd:annotation> + <xsd:documentation> + Declares job should be stop at this point and + provides pointer where execution should continue + when + the job is + restarted. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="on" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>A pattern to match against the exit status + code. Use * and ? as wildcard characters. + When a step + finishes + the most specific match will be chosen to + select the next step. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="restart" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>The name of the step to start on when the + stopped job is restarted. + Must resolve to one of the + other steps + in this job. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="end"> + <xsd:annotation> + <xsd:documentation> + Declares job should end at this point, without + the possibility of restart. + BatchStatus will be + COMPLETED. + ExitStatus is configurable. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="on" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>A pattern to match against the exit status + code. Use * and ? as wildcard characters. + When a step + finishes + the most specific match will be chosen to + select the next step. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="exit-code" use="optional" type="xsd:string" default="COMPLETED"> + <xsd:annotation> + <xsd:documentation>The exit code value to end on, defaults to + COMPLETED.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + <xsd:element name="fail"> + <xsd:annotation> + <xsd:documentation> + Declares job should fail at this point. + BatchStatus will be FAILED. ExitStatus is configurable. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:attribute name="on" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation>A pattern to match against the exit status + code. Use * and ? as wildcard characters. + When a step + finishes + the most specific match will be chosen to + select the next step. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="exit-code" use="optional" type="xsd:string" default="FAILED"> + <xsd:annotation> + <xsd:documentation>The exit code value to end on, defaults to + FAILED.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:group> + + <xsd:attributeGroup name="jobRepositoryAttribute"> + <xsd:attribute name="job-repository" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.batch.core.repository.JobRepository"><![CDATA[ + The bean name of the JobRepository that is to be used. This attribute + is not required, and only needs to be specified explicitly + if the bean name of the desired JobRepository is not 'jobRepository'. + ]]></xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref"> + <tool:expected-type type="org.springframework.batch.core.repository.JobRepository" /> + </tool:annotation> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:attributeGroup name="parentAttribute"> + <xsd:attribute name="parent" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation> + The name of the parent bean from which the + configuration should inherit. + </xsd:documentation> + <xsd:appinfo> + <tool:annotation kind="ref" /> + </xsd:appinfo> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:attributeGroup name="abstractAttribute"> + <xsd:attribute name="abstract" type="xsd:boolean" use="optional"> + <xsd:annotation> + <xsd:documentation> + Is this bean "abstract", that is, not meant to be + instantiated itself + but rather just serving as + parent for concrete + child bean definitions? + The default is "false". Specify "true" to + tell the bean factory to not + try + to instantiate that particular bean + in any case. + + Note: This attribute will not be inherited by child + bean definitions. + Hence, it needs to be specified per abstract bean + definition. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:attributeGroup name="mergeAttribute"> + <xsd:attribute name="merge" type="xsd:boolean" use="optional"> + <xsd:annotation> + <xsd:documentation> + Should this list be merged with the corresponding + list provided + by the parent? If not, it will + overwrite the parent + list. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:attributeGroup name="adapterMethodAttribute"> + <xsd:attribute name="adapter-method" type="xsd:string" use="optional"> + <xsd:annotation> + <xsd:documentation> + This attribute indicates the method from the + class that should + be used to dynamically create a + proxy. + </xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + + <xsd:simpleType name="description"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains informative text describing the purpose of the enclosing element. + Used primarily for user documentation of XML bean definition documents. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:string" /> + </xsd:simpleType> + +</xsd:schema> diff --git a/xml/tests/testData/unusedNs/spring-beans-2.5.xsd b/xml/tests/testData/unusedNs/spring-beans-2.5.xsd new file mode 100644 index 000000000000..170660a6a46c --- /dev/null +++ b/xml/tests/testData/unusedNs/spring-beans-2.5.xsd @@ -0,0 +1,1164 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> + +<xsd:schema xmlns="http://www.springframework.org/schema/beans" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.springframework.org/schema/beans"> + + <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/> + + <xsd:annotation> + <xsd:documentation><![CDATA[ + Spring XML Beans Schema, version 2.5 + Authors: Rob Harrop, Juergen Hoeller, Mark Fisher + + This defines a simple and consistent way of creating a namespace + of JavaBeans objects, managed by a Spring BeanFactory, read by + XmlBeanDefinitionReader (with DefaultBeanDefinitionDocumentReader). + + This document type is used by most Spring functionality, including + web application contexts, which are based on bean factories. + + Each "bean" element in this document defines a JavaBean. + Typically the bean class is specified, along with JavaBean properties + and/or constructor arguments. + + A bean instance can be a "singleton" (shared instance) or a "prototype" + (independent instance). Further scopes can be provided by extended + bean factories, for example in a web environment. + + References among beans are supported, that is, setting a JavaBean property + or a constructor argument to refer to another bean in the same factory + (or an ancestor factory). + + As alternative to bean references, "inner bean definitions" can be used. + Singleton flags of such inner bean definitions are effectively ignored: + inner beans are typically anonymous prototypes. + + There is also support for lists, sets, maps, and java.util.Properties + as bean property types or constructor argument types. + ]]></xsd:documentation> + </xsd:annotation> + + <!-- base types --> + <xsd:complexType name="identifiedType" abstract="true"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The unique identifier for a bean. The scope of the identifier + is the enclosing bean factory. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:attribute name="id" type="xsd:ID"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The unique identifier for a bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Top-level <beans> tag --> + <xsd:element name="beans"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The top level (typically root) element. Allows the definition + of default values for all nested bean definitions. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="import"/> + <xsd:element ref="alias"/> + <xsd:element ref="bean"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="default-lazy-init" default="false" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'lazy-init' value; see the documentation for the + 'lazy-init' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-merge" default="false" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'merge' value; see the documentation for the + 'merge' attribute of the various collection elements. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-autowire" default="no"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'autowire' value; see the documentation for the + 'autowire' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="no"/> + <xsd:enumeration value="byName"/> + <xsd:enumeration value="byType"/> + <xsd:enumeration value="constructor"/> + <xsd:enumeration value="autodetect"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="default-dependency-check" default="none"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'dependency-check' value; see the documentation for the + 'dependency-check' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="none"/> + <xsd:enumeration value="simple"/> + <xsd:enumeration value="objects"/> + <xsd:enumeration value="all"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="default-autowire-candidates" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A default bean name pattern for identifying autowire candidates: + e.g. "*Service", "data*", "*Service*", "data*Service". + Also accepts a comma-separated list of patterns: e.g. "*Service,*Dao". + See the documentation for the 'autowire-candidate' attribute of the + '<bean/>' element for the semantic details of autowire candidate beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-init-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'init-method' value; see the documentation for the + 'init-method' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-destroy-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'destroy-method' value; see the documentation for the + 'destroy-method' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:anyAttribute namespace="##other" processContents="lax"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="description"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains informative text describing the purpose of the enclosing element. + Used primarily for user documentation of XML bean definition documents. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="import"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.core.io.Resource"><![CDATA[ + Specifies an XML bean definition resource to import. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="resource" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The relative resource location of the XML (bean definition) file to import, + for example "myImport.xml" or "includes/myImport.xml" or "../myImport.xml". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="alias"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines an alias for a bean (which can reside in a different definition + resource). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the bean to define an alias for. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="alias" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The alias name to define for the bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:group name="beanElements"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="meta"/> + <xsd:element ref="constructor-arg"/> + <xsd:element ref="property"/> + <xsd:element ref="qualifier"/> + <xsd:element ref="lookup-method"/> + <xsd:element ref="replaced-method"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + </xsd:group> + + <xsd:attributeGroup name="beanAttributes"> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Can be used to create one or more aliases illegal in an (XML) id. + Multiple aliases can be separated by any number of spaces, commas, + or semi-colons (or indeed any mixture of the three). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="class" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The fully qualified name of the bean's class, except if it serves only + as a parent definition for child bean definitions. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="parent" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the parent bean definition. + + Will use the bean class of the parent if none is specified, but can + also override it. In the latter case, the child bean class must be + compatible with the parent, i.e. accept the parent's property values + and constructor argument values, if any. + + A child bean definition will inherit constructor argument values, + property values and method overrides from the parent, with the option + to add new values. If init method, destroy method, factory bean and/or + factory method are specified, they will override the corresponding + parent settings. + + The remaining settings will always be taken from the child definition: + depends on, autowire mode, dependency check, scope, lazy init. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="scope" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The scope of this bean: typically "singleton" (one shared instance, + which will be returned by all calls to getBean with the given id), or + "prototype" (independent instance resulting from each call to getBean). + Default is "singleton". + + Singletons are most commonly used, and are ideal for multi-threaded + service objects. Further scopes, such as "request" or "session", might + be supported by extended bean factories (e.g. in a web environment). + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + + Inner bean definitions inherit the singleton status of their containing + bean definition, unless explicitly specified: The inner bean will be a + singleton if the containing bean is a singleton, and a prototype if + the containing bean has any other scope. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="abstract" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Is this bean "abstract", that is, not meant to be instantiated itself + but rather just serving as parent for concrete child bean definitions? + The default is "false". Specify "true" to tell the bean factory to not + try to instantiate that particular bean in any case. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per abstract bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lazy-init" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Indicates whether or not this bean is to be lazily initialized. + If false, it will be instantiated on startup by bean factories + that perform eager initialization of singletons. The default is + "false". + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="autowire" default="default"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Controls whether bean properties are "autowired". + This is an automagical process in which bean references don't need + to be coded explicitly in the XML bean definition file, but rather the + Spring container works out dependencies. + + There are 5 modes: + + 1. "no" + The traditional Spring default. No automagical wiring. Bean references + must be defined in the XML file via the <ref/> element (or "ref" + attribute). We recommend this in most cases as it makes documentation + more explicit. + + 2. "byName" + Autowiring by property name. If a bean of class Cat exposes a "dog" + property, Spring will try to set this to the value of the bean "dog" + in the current container. If there is no matching bean by name, nothing + special happens; use dependency-check="objects" to raise an error in + that case. + + 3. "byType" + Autowiring if there is exactly one bean of the property type in the + container. If there is more than one, a fatal error is raised, and + you cannot use byType autowiring for that bean. If there is none, + nothing special happens; use dependency-check="objects" to raise an + error in that case. + + 4. "constructor" + Analogous to "byType" for constructor arguments. If there is not exactly + one bean of the constructor argument type in the bean factory, a fatal + error is raised. + + 5. "autodetect" + Chooses "constructor" or "byType" through introspection of the bean + class. If a default constructor is found, "byType" gets applied. + + Note that explicit dependencies, i.e. "property" and "constructor-arg" + elements, always override autowiring. Autowire behavior can be combined + with dependency checking, which will be performed after all autowiring + has been completed. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="no"/> + <xsd:enumeration value="byName"/> + <xsd:enumeration value="byType"/> + <xsd:enumeration value="constructor"/> + <xsd:enumeration value="autodetect"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="dependency-check" default="default"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Controls whether or not to check whether all of this + bean's dependencies, expressed in its properties, are satisfied. + The default is to perform no dependency checking. + + "simple" type dependency checking includes primitives and String; + "objects" includes collaborators (other beans in the factory); + "all" includes both types of dependency checking. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="none"/> + <xsd:enumeration value="simple"/> + <xsd:enumeration value="objects"/> + <xsd:enumeration value="all"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="depends-on" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The names of the beans that this bean depends on being initialized. + The bean factory will guarantee that these beans get initialized + before this bean. + + Note that dependencies are normally expressed through bean properties + or constructor arguments. This property should just be necessary for + other kinds of dependencies like statics (*ugh*) or database preparation + on startup. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="autowire-candidate" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Indicates whether or not this bean should be considered when looking + for matching candidates to satisfy another bean's autowiring requirements. + Note that this does not affect explicit references by name, which will get + resolved even if the specified bean is not marked as an autowire candidate. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="primary" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Specifies that this bean should be given preference when multiple + candidates are qualified to autowire a single-valued dependency. + If exactly one 'primary' bean exists among the candidates, it + will be the autowired value. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="init-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the custom initialization method to invoke after setting + bean properties. The method must have no arguments, but may throw any + exception. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="destroy-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the custom destroy method to invoke on bean factory + shutdown. The method must have no arguments, but may throw any + exception. + + Note: Only invoked on beans whose lifecycle is under the full + control of the factory - which is always the case for singletons, + but not guaranteed for any other scope. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="factory-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of a factory method to use to create this object. Use + constructor-arg elements to specify arguments to the factory method, + if it takes arguments. Autowiring does not apply to factory methods. + + If the "class" attribute is present, the factory method will be a static + method on the class specified by the "class" attribute on this bean + definition. Often this will be the same class as that of the constructed + object - for example, when the factory method is used as an alternative + to a constructor. However, it may be on a different class. In that case, + the created object will *not* be of the class specified in the "class" + attribute. This is analogous to FactoryBean behavior. + + If the "factory-bean" attribute is present, the "class" attribute is not + used, and the factory method will be an instance method on the object + returned from a getBean call with the specified bean name. The factory + bean may be defined as a singleton or a prototype. + + The factory method can have any number of arguments. Autowiring is not + supported. Use indexed constructor-arg elements in conjunction with the + factory-method attribute. + + Setter Injection can be used in conjunction with a factory method. + Method Injection cannot, as the factory method returns an instance, + which will be used when the container creates the bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="factory-bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Alternative to class attribute for factory-method usage. + If this is specified, no class attribute should be used. + This must be set to the name of a bean in the current or + ancestor factories that contains the relevant factory method. + This allows the factory itself to be configured using Dependency + Injection, and an instance (rather than static) method to be used. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:anyAttribute namespace="##other" processContents="lax"/> + </xsd:attributeGroup> + + <xsd:element name="meta" type="metaType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Arbitrary metadata attached to a bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:complexType name="metaType"> + <xsd:attribute name="key" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The key name of the metadata attribute being defined. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The value of the metadata attribute being defined (as a simple String). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:element name="bean"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.config.BeanDefinition"><![CDATA[ + Defines a single (usually named) bean. + + A bean definition may contain nested tags for constructor arguments, + property values, lookup methods, and replaced methods. Mixing constructor + injection and setter injection on the same bean is explicitly supported. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="identifiedType"> + <xsd:group ref="beanElements"/> + <xsd:attributeGroup ref="beanAttributes"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="constructor-arg"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.config.ConstructorArgumentValues"> + <![CDATA[ + Bean definitions can specify zero or more constructor arguments. + This is an alternative to "autowire constructor". + Arguments correspond to either a specific index of the constructor + argument list or are supposed to be matched generically by type. + + Note: A single generic argument value will just be used once, rather + than potentially matched multiple times (as of Spring 1.1). + + constructor-arg elements are also used in conjunction with the + factory-method element to construct beans using static or instance + factory methods. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="index" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact index of the argument in the constructor argument list. + Only needed to avoid ambiguities, e.g. in case of 2 arguments of + the exact same type. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact type of the constructor argument. Only needed to avoid + ambiguities, e.g. in case of 2 single argument constructors + that can both be converted from a String. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...<value/>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="property" type="propertyType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Bean definitions can have zero or more properties. + Property elements correspond to JavaBean setter methods exposed + by the bean classes. Spring supports primitives, references to other + beans in the same or related factories, lists, maps and properties. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="qualifier"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Bean definitions can provide qualifiers to match against annotations + on a field or parameter for fine-grained autowire candidate resolution. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="attribute" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="type" type="xsd:string" default="org.springframework.beans.factory.annotation.Qualifier"/> + <xsd:attribute name="value" type="xsd:string"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="attribute" type="metaType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A qualifier element may contain attribute child elements as key-value + pairs. These will be available for matching against attributes of a + qualifier annotation on an autowired field or parameter if present. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="lookup-method"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A lookup method causes the IoC container to override the given method + and return the bean with the name given in the bean attribute. This is + a form of Method Injection. It is particularly useful as an alternative + to implementing the BeanFactoryAware interface, in order to be able to + make getBean() calls for non-singleton instances at runtime. In this + case, Method Injection is a less invasive alternative. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the lookup method. This method must take no arguments. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the bean in the current or ancestor factories that + the lookup method should resolve to. Often this bean will be a + prototype, in which case the lookup method will return a distinct + instance on every invocation. This is useful for single-threaded objects. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="replaced-method"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Similar to the lookup method mechanism, the replaced-method element + is used to control IoC container method overriding: Method Injection. + This mechanism allows the overriding of a method with arbitrary code. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="arg-type"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the method whose implementation must be replaced by the + IoC container. If this method is not overloaded, there is no need + to use arg-type subelements. If this method is overloaded, arg-type + subelements must be used for all override definitions for the method. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="replacer" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.support.MethodReplacer"><![CDATA[ + Bean name of an implementation of the MethodReplacer interface in the + current or ancestor factories. This may be a singleton or prototype + bean. If it is a prototype, a new instance will be used for each + method replacement. Singleton usage is the norm. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="arg-type"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Identifies an argument for a replaced method in the event of + method overloading. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="match" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Specification of the type of an overloaded method argument as a String. + For convenience, this may be a substring of the FQN. E.g. all the + following would match "java.lang.String": + - java.lang.String + - String + - Str + + As the number of arguments will be checked also, this convenience + can often be used to save typing. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="ref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines a reference to another bean in this factory or an external + factory (parent or included factory). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="local" type="xsd:IDREF"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. The value must be a bean ID and thus can + be checked by the XML parser. This is therefore the preferred technique + for referencing beans within the same bean factory XML file. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="parent" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean in a parent factory. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="idref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The id of another bean in this factory or an external factory + (parent or included factory). + While a regular 'value' element could instead be used for the + same effect, using idref in this case allows validation of local + bean ids by the XML parser, and name completion by supporting tools. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="local" type="xsd:IDREF"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. The value must be a bean ID and thus can + be checked by the XML parser. This is therefore the preferred technique + for referencing beans within the same bean factory XML file. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="value"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains a string representation of a property value. + The property may be a string, or may be converted to the required + type using the JavaBeans PropertyEditor machinery. This makes it + possible for application developers to write custom PropertyEditor + implementations that can convert strings to arbitrary target objects. + + Note that this is recommended for simple objects only. Configure + more complex objects by populating JavaBean properties with + references to other beans. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact type that the value should be converted to. Only needed + if the type of the target property or constructor argument is + too generic: for example, in case of a collection element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="null"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Denotes a Java null value. Necessary because an empty "value" tag + will resolve to an empty String, which will not be resolved to a + null value unless a special PropertyEditor does so. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + </xsd:complexType> + </xsd:element> + + <!-- Collection Elements --> + <xsd:group name="collectionElements"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + </xsd:group> + + <xsd:element name="list"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A list can contain multiple inner bean, ref, collection, or value elements. + A list can also map to an array type; the necessary conversion is performed + automatically. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="listOrSetType"> + <xsd:attribute name="merge" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="set"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A set can contain multiple inner bean, ref, collection, or value elements. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="listOrSetType"> + <xsd:attribute name="merge" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="map"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A mapping from a key to an object. Maps may be empty. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="mapType"> + <xsd:attribute name="merge" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="entry" type="entryType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A map entry can be an inner bean, ref, value, or collection. + The key of the entry is given by the "key" attribute or child element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="props"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Props elements differ from map elements in that values must be strings. + Props may be empty. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="propsType"> + <xsd:attribute name="merge" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="key"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A key element can contain an inner bean, ref, value, or collection. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="collectionElements"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="prop"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The string value of the property. Note that whitespace is trimmed + off to avoid unwanted whitespace caused by typical XML formatting. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="key" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The key of the property entry. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="propertyType"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element ref="meta"/> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the property, following JavaBean naming conventions. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...</value>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Collection Types --> + + <!-- base type for collections that have (possibly) typed nested values --> + <xsd:complexType name="collectionType"> + <xsd:attribute name="value-type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The default Java type for nested values. Must be a fully qualified + class name. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- 'list' and 'set' collection type --> + <xsd:complexType name="listOrSetType"> + <xsd:complexContent> + <xsd:extension base="collectionType"> + <xsd:group ref="collectionElements"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'map' element type --> + <xsd:complexType name="mapType"> + <xsd:complexContent> + <xsd:extension base="collectionType"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="entry"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="key-type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The default Java type for nested entry keys. Must be a fully qualified + class name. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'entry' element type --> + <xsd:complexType name="entryType"> + <xsd:sequence> + <xsd:element ref="key" minOccurs="0"/> + <xsd:group ref="collectionElements"/> + </xsd:sequence> + <xsd:attribute name="key" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Each map element must specify its key as attribute or as child element. + A key attribute is always a String value. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="key-ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a to a "key" element with a nested + "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...</value>" + element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value-ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- 'props' collection type --> + <xsd:complexType name="propsType"> + <xsd:complexContent> + <xsd:extension base="collectionType"> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="prop"/> + </xsd:choice> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- simple internal types --> + <xsd:simpleType name="defaultable-boolean"> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="true"/> + <xsd:enumeration value="false"/> + </xsd:restriction> + </xsd:simpleType> + +</xsd:schema> diff --git a/xml/tests/testData/unusedNs/spring.xml b/xml/tests/testData/unusedNs/spring.xml new file mode 100644 index 000000000000..6579845e8244 --- /dev/null +++ b/xml/tests/testData/unusedNs/spring.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + <warning descr="Namespace declaration is never used">xmlns:batch="http://www.spring<caret>framework.org/schema/batch"</warning> + xsi:schemaLocation="http://www.springframework.org/schema/beans spring-beans-2.5.xsd + http://www.springframework.org/schema/batch spring-batch-2.1.xsd"> + + <step id="abstractStep" abstract="true" xmlns="http://www.springframework.org/schema/batch"/> +</beans> diff --git a/xml/tests/testData/unusedNs/spring_after.xml b/xml/tests/testData/unusedNs/spring_after.xml new file mode 100644 index 000000000000..f1262d937f4c --- /dev/null +++ b/xml/tests/testData/unusedNs/spring_after.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans spring-beans-2.5.xsd + http://www.springframework.org/schema/batch spring-batch-2.1.xsd"> + + <step id="abstractStep" abstract="true" xmlns="http://www.springframework.org/schema/batch"/> +</beans> diff --git a/xml/tests/testData/xml/anyAttribute.xml b/xml/tests/testData/xml/anyAttribute.xml new file mode 100644 index 000000000000..56835ab524bb --- /dev/null +++ b/xml/tests/testData/xml/anyAttribute.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" ?> +<container xmlns="http://symfony.com/schema/dic/services"> + + <services> + <service id="example.form.type" class="Acme\ExampleBundle\Form\Type\ExampleFormType"> + <tag name="form.type" alias="example_form"/> + </service> + </services> +</container>
\ No newline at end of file diff --git a/xml/tests/testData/xml/services-1.0.xsd b/xml/tests/testData/xml/services-1.0.xsd new file mode 100644 index 000000000000..f1c2003c6225 --- /dev/null +++ b/xml/tests/testData/xml/services-1.0.xsd @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<xsd:schema xmlns="http://symfony.com/schema/dic/services" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://symfony.com/schema/dic/services" + elementFormDefault="qualified"> + + <xsd:annotation> + <xsd:documentation><![CDATA[ + Symfony XML Services Schema, version 1.0 + Authors: Fabien Potencier + + This defines a way to describe PHP objects (services) and their + dependencies. + ]]></xsd:documentation> + </xsd:annotation> + + <xsd:element name="container" type="container" /> + + <xsd:complexType name="container"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The root element of a service file. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="imports" type="imports" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parameters" type="parameters" minOccurs="0" maxOccurs="1" /> + <xsd:element name="services" type="services" minOccurs="0" maxOccurs="1" /> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="services"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enclosing element for the definition of all services + ]]></xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="1" maxOccurs="unbounded"> + <xsd:element name="service" type="service" /> + </xsd:choice> + </xsd:complexType> + + <xsd:complexType name="imports"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enclosing element for the import elements + ]]></xsd:documentation> + </xsd:annotation> + <xsd:choice minOccurs="1" maxOccurs="unbounded"> + <xsd:element name="import" type="import" /> + </xsd:choice> + </xsd:complexType> + + <xsd:complexType name="import"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Import an external resource defining other services or parameters + ]]></xsd:documentation> + </xsd:annotation> + <xsd:attribute name="resource" type="xsd:string" use="required" /> + <xsd:attribute name="ignore-errors" type="boolean" /> + </xsd:complexType> + + <xsd:complexType name="configurator"> + <xsd:attribute name="id" type="xsd:string" /> + <xsd:attribute name="service" type="xsd:string" /> + <xsd:attribute name="class" type="xsd:string" /> + <xsd:attribute name="method" type="xsd:string" /> + <xsd:attribute name="function" type="xsd:string" /> + </xsd:complexType> + + <xsd:complexType name="service"> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="file" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <xsd:element name="argument" type="argument" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="configurator" type="configurator" minOccurs="0" maxOccurs="1" /> + <xsd:element name="call" type="call" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="tag" type="tag" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" /> + </xsd:choice> + <xsd:attribute name="id" type="xsd:string" /> + <xsd:attribute name="class" type="xsd:string" /> + <xsd:attribute name="scope" type="xsd:string" /> + <xsd:attribute name="public" type="boolean" /> + <xsd:attribute name="synthetic" type="boolean" /> + <xsd:attribute name="synchronized" type="boolean" /> + <xsd:attribute name="lazy" type="boolean" /> + <xsd:attribute name="abstract" type="boolean" /> + <xsd:attribute name="factory-class" type="xsd:string" /> + <xsd:attribute name="factory-method" type="xsd:string" /> + <xsd:attribute name="factory-service" type="xsd:string" /> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="parent" type="xsd:string" /> + </xsd:complexType> + + <xsd:complexType name="tag"> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:anyAttribute namespace="##any" processContents="lax" /> + </xsd:complexType> + + <xsd:complexType name="parameters"> + <xsd:choice minOccurs="1" maxOccurs="unbounded"> + <xsd:element name="parameter" type="parameter" /> + </xsd:choice> + <xsd:attribute name="type" type="parameter_type" /> + <xsd:attribute name="key" type="xsd:string" /> + </xsd:complexType> + + <xsd:complexType name="parameter" mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="parameter" type="parameter" /> + </xsd:choice> + <xsd:attribute name="type" type="parameter_type" /> + <xsd:attribute name="id" type="xsd:string" /> + <xsd:attribute name="key" type="xsd:string" /> + <xsd:attribute name="on-invalid" type="invalid_sequence" /> + </xsd:complexType> + + <xsd:complexType name="property" mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element name="service" type="service" /> + </xsd:choice> + <xsd:attribute name="type" type="argument_type" /> + <xsd:attribute name="id" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="on-invalid" type="xsd:string" /> + <xsd:attribute name="strict" type="boolean" /> + </xsd:complexType> + + <xsd:complexType name="argument" mixed="true"> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="argument" type="argument" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="service" type="service" /> + </xsd:choice> + <xsd:attribute name="type" type="argument_type" /> + <xsd:attribute name="id" type="xsd:string" /> + <xsd:attribute name="key" type="xsd:string" /> + <xsd:attribute name="index" type="xsd:integer" /> + <xsd:attribute name="on-invalid" type="xsd:string" /> + <xsd:attribute name="strict" type="boolean" /> + </xsd:complexType> + + <xsd:complexType name="call" mixed="true"> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="argument" type="argument" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="service" type="service" /> + </xsd:choice> + <xsd:attribute name="method" type="xsd:string" /> + </xsd:complexType> + + <xsd:simpleType name="parameter_type"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="collection" /> + <xsd:enumeration value="service" /> + <xsd:enumeration value="string" /> + <xsd:enumeration value="constant" /> + </xsd:restriction> + </xsd:simpleType> + + <xsd:simpleType name="argument_type"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="collection" /> + <xsd:enumeration value="service" /> + <xsd:enumeration value="string" /> + <xsd:enumeration value="constant" /> + </xsd:restriction> + </xsd:simpleType> + + <xsd:simpleType name="invalid_sequence"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="null" /> + <xsd:enumeration value="ignore" /> + <xsd:enumeration value="exception" /> + </xsd:restriction> + </xsd:simpleType> + + <xsd:simpleType name="boolean"> + <xsd:restriction base="xsd:string"> + <xsd:pattern value="(%.+%|true|false)" /> + </xsd:restriction> + </xsd:simpleType> +</xsd:schema> diff --git a/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java b/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java index 9975cebb8ca3..f6be5cdc5ae2 100644 --- a/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java +++ b/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java @@ -31,7 +31,7 @@ public abstract class XmlSuppressionProvider { public static boolean isSuppressed(@NotNull PsiElement element, @NotNull String inspectionId) { for (XmlSuppressionProvider provider : Extensions.getExtensions(EP_NAME)) { - if (provider.isSuppressedFor(element, inspectionId)) { + if (provider.isProviderAvailable(element.getContainingFile()) && provider.isSuppressedFor(element, inspectionId)) { return true; } } diff --git a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagChild.java b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagChild.java index d1a322e39cb4..7b61eb182d6c 100644 --- a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagChild.java +++ b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagChild.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.Nullable; public interface XmlTagChild extends XmlElement{ XmlTagChild[] EMPTY_ARRAY = new XmlTagChild[0]; + @Nullable XmlTag getParentTag(); @Nullable diff --git a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagValue.java b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagValue.java index aedef5bbb975..6183cf6f1fe7 100644 --- a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagValue.java +++ b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlTagValue.java @@ -37,5 +37,7 @@ public interface XmlTagValue { void setText(String value); + void setEscapedText(String value); + boolean hasCDATA(); } diff --git a/xml/xml-psi-impl/resources/messages/XmlErrorMessages.properties b/xml/xml-psi-impl/resources/messages/XmlErrorMessages.properties index 5dba19c82294..2f90357d2e09 100644 --- a/xml/xml-psi-impl/resources/messages/XmlErrorMessages.properties +++ b/xml/xml-psi-impl/resources/messages/XmlErrorMessages.properties @@ -79,15 +79,15 @@ xml.declaration.should.precede.all.document.content=Xml declaration should prece dtd.parser.message.whitespace.expected=Whitespace expected dtd.parser.message.left.paren.or.entityref.or.empty.or.any.expected=( or entity ref or EMPTY or ANY expected -dtd.parser.message.name.expected=xml name expected +dtd.parser.message.name.expected=XML name expected dtd.parser.message.literal.public.system.expected=Literal, PUBLIC or SYSTEM expected -dtd.parser.message.name.or.entity.ref.expected=Xml name or entity ref expected +dtd.parser.message.name.or.entity.ref.expected=XML name or entity ref expected dtd.parser.message.rbrace.expected=) expected -duplicate.declaration=Nonunique declaration name {0} +duplicate.declaration=Non-unique declaration name {0} xml.validate.external.resource.is.not.registered=External resource {0} is not registered xml.schema.validation.attr.not.allowed.with.ref=Attribute {0} is not allowed here when element reference is used xml.schema.validation.max.occurs.should.be.not.less.than.min.occurs=maxOccurs value should be greater than minOccurs value xml.schema.validation.name.or.ref.should.present=Either 'name' or 'ref' attribute should present -xml.schema.validation.default.or.fixed.should.be.specified.but.not.both='default' and 'fixed' attributes should not bepresent in the same time +xml.schema.validation.default.or.fixed.should.be.specified.but.not.both='default' and 'fixed' attributes should not be present in the same time diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java index a3c2e9ac703d..9341d99c8031 100644 --- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java @@ -35,7 +35,7 @@ import java.nio.charset.Charset; public class HtmlFileType extends XmlLikeFileType { @NonNls public static final String DOT_DEFAULT_EXTENSION = ".html"; - public final static HtmlFileType INSTANCE = new HtmlFileType(); + public static final HtmlFileType INSTANCE = new HtmlFileType(); private HtmlFileType() { super(HTMLLanguage.INSTANCE); @@ -45,25 +45,30 @@ public class HtmlFileType extends XmlLikeFileType { super(language); } + @Override @NotNull public String getName() { return "HTML"; } + @Override @NotNull public String getDescription() { return IdeBundle.message("filetype.description.html"); } + @Override @NotNull public String getDefaultExtension() { return "html"; } + @Override public Icon getIcon() { return AllIcons.FileTypes.Html; } + @Override public String getCharset(@NotNull final VirtualFile file, final byte[] content) { String charset = XmlCharsetDetector.extractXmlEncodingFromProlog(content); if (charset != null) return charset; @@ -78,6 +83,7 @@ public class HtmlFileType extends XmlLikeFileType { return c == null ? null : c.name(); } + @Override public Charset extractCharsetFromFileContent(@Nullable final Project project, @Nullable final VirtualFile file, @NotNull final String content) { String name = XmlCharsetDetector.extractXmlEncodingFromProlog(content); Charset charset = CharsetToolkit.forName(name); diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java index db8d1fa40b1e..be60b057adaf 100644 --- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java @@ -30,11 +30,13 @@ public abstract class XmlLikeFileType extends LanguageFileType { public XmlLikeFileType(Language language) { super(language); } + @Override public String getCharset(@NotNull VirtualFile file, final byte[] content) { String charset = XmlCharsetDetector.extractXmlEncodingFromProlog(content); return charset == null ? CharsetToolkit.UTF8 : charset; } + @Override public Charset extractCharsetFromFileContent(final Project project, @Nullable final VirtualFile file, @NotNull final String content) { String name = XmlCharsetDetector.extractXmlEncodingFromProlog(content); Charset charset = CharsetToolkit.forName(name); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/HtmlScriptContentProvider.java b/xml/xml-psi-impl/src/com/intellij/lang/HtmlScriptContentProvider.java index 92bf64473fdb..3c0b43cdb5e1 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/HtmlScriptContentProvider.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/HtmlScriptContentProvider.java @@ -30,4 +30,17 @@ public interface HtmlScriptContentProvider { */ @Nullable Lexer getHighlightingLexer(); + + class Empty implements HtmlScriptContentProvider{ + @Override + public IElementType getScriptElementType() { + return null; + } + + @Nullable + @Override + public Lexer getHighlightingLexer() { + return null; + } + } } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java index 27c63443723d..8819dc30da42 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java @@ -94,7 +94,7 @@ public class DtdParsing extends XmlParsing implements XmlElementType { parseGenericXml(); break; case ELEMENT_CONTENT_SPEC: - parseElementContentSpec(); + doParseContentSpec(true); break; case ATTLIST_SPEC: parseAttlistContent(); @@ -492,22 +492,28 @@ public class DtdParsing extends XmlParsing implements XmlElementType { } private boolean parseName() { - if (myBuilder.getTokenType() == XML_NAME) { + IElementType type = myBuilder.getTokenType(); + if (type == XML_NAME) { addToken(); return true; } - if (myBuilder.getTokenType() == XML_ENTITY_REF_TOKEN) { + if (type == XML_ENTITY_REF_TOKEN) { parseEntityRef(); return true; } - return false; + return consumeKeywordAsName(type); } - private void parseElementContentSpec() { - doParseContentSpec(true); + private boolean consumeKeywordAsName(IElementType type) { + if (type == XML_DOCTYPE_PUBLIC || type == XML_DOCTYPE_SYSTEM || type == XML_CONTENT_EMPTY || type == XML_CONTENT_ANY) { + myBuilder.remapCurrentToken(XML_NAME); + addToken(); + return true; + } + return false; } private void doParseContentSpec(boolean topLevel) { @@ -569,6 +575,9 @@ public class DtdParsing extends XmlParsing implements XmlElementType { addToken(); endedWithDelimiter = false; } + else if (consumeKeywordAsName(tokenType)) { + endedWithDelimiter = false; + } else { myBuilder.error(XmlErrorMessages.message("dtd.parser.message.name.or.entity.ref.expected")); return false; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameVariantCollector.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameVariantCollector.java index 73f0ee4eaf64..cb80e547c0e5 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameVariantCollector.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameVariantCollector.java @@ -16,6 +16,7 @@ package com.intellij.psi.impl.source.xml; import com.intellij.html.impl.RelaxedHtmlFromSchemaElementDescriptor; +import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.html.HtmlTag; @@ -23,9 +24,6 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlDocument; import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlTag; -import com.intellij.util.ArrayUtil; -import com.intellij.util.Function; -import com.intellij.util.NullableFunction; import com.intellij.util.containers.ContainerUtil; import com.intellij.xml.XmlElementDescriptor; import com.intellij.xml.XmlElementDescriptorAwareAboutChildren; @@ -40,23 +38,10 @@ import org.jetbrains.annotations.Nullable; import java.util.*; public class TagNameVariantCollector { - public static String[] getTagNameVariants(final XmlTag element, - final Collection<String> namespaces, - @Nullable List<String> nsInfo) { - final List<String> variants = getTagNameVariants(element, namespaces, nsInfo, new Function<XmlElementDescriptor, String>() { - @Override - public String fun(XmlElementDescriptor descriptor) { - return descriptor.getName(element); - } - }); - return ArrayUtil.toStringArray(variants); - } - - public static <T> List<T> getTagNameVariants(final XmlTag element, - final Collection<String> namespaces, - @Nullable List<String> nsInfo, - final Function<XmlElementDescriptor, T> f) { + public static List<XmlElementDescriptor> getTagDescriptors(final XmlTag element, + final Collection<String> namespaces, + @Nullable List<String> nsInfo) { XmlElementDescriptor elementDescriptor = null; String elementNamespace = null; @@ -103,17 +88,17 @@ public class TagNameVariantCollector { } final boolean hasPrefix = StringUtil.isNotEmpty(element.getNamespacePrefix()); - return ContainerUtil.mapNotNull(variants, new NullableFunction<XmlElementDescriptor, T>() { - public T fun(XmlElementDescriptor descriptor) { + return ContainerUtil.filter(variants, new Condition<XmlElementDescriptor>() { + @Override + public boolean value(XmlElementDescriptor descriptor) { if (descriptor instanceof AnyXmlElementDescriptor) { - return null; + return false; } else if (hasPrefix && descriptor instanceof XmlElementDescriptorImpl && !namespaces.contains(((XmlElementDescriptorImpl)descriptor).getNamespace())) { - return null; + return false; } - - return f.fun(descriptor); + return true; } }); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java index 887cce5eeaee..ddbd368cc1df 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java @@ -21,6 +21,7 @@ import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.XmlElementFactory; +import com.intellij.psi.impl.source.xml.behavior.DefaultXmlPsiPolicy; import com.intellij.psi.search.PsiElementProcessor; import com.intellij.psi.xml.*; import com.intellij.util.IncorrectOperationException; @@ -95,7 +96,17 @@ public class XmlTagValueImpl implements XmlTagValue{ return myTrimmedText = consolidatedText.toString().trim(); } + @Override public void setText(String value) { + setText(value, false); + } + + @Override + public void setEscapedText(String value) { + setText(value, true); + } + + private void setText(String value, boolean defaultPolicy) { try { XmlText text = null; if (value != null) { @@ -109,7 +120,11 @@ public class XmlTagValueImpl implements XmlTagValue{ text.delete(); } else { - text.setValue(value); + if (defaultPolicy && text instanceof XmlTextImpl) { + ((XmlTextImpl)text).doSetValue(value, new DefaultXmlPsiPolicy()); + } else { + text.setValue(value); + } } } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java index 8adb44070642..7db38dfc37a2 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java @@ -174,7 +174,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI doSetValue(s, getPolicy()); } - private void doSetValue(final String s, XmlPsiPolicy policy) throws IncorrectOperationException { + public void doSetValue(final String s, XmlPsiPolicy policy) throws IncorrectOperationException { final ASTNode firstEncodedElement = policy.encodeXmlTextContents(s, this); if (firstEncodedElement == null) { diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java index 52c6f4a3b78b..172afda55a69 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTokenImpl.java @@ -67,7 +67,7 @@ public class XmlTokenImpl extends LeafPsiElement implements XmlToken, Navigatabl if (elementType == XmlTokenType.XML_DATA_CHARACTERS || elementType == XmlTokenType.XML_CHAR_ENTITY_REF) { - return ReferenceProvidersRegistry.getReferencesFromProviders(this, XmlToken.class); + return ReferenceProvidersRegistry.getReferencesFromProviders(this); } else if (elementType == XmlTokenType.XML_NAME && getParent() instanceof PsiErrorElement) { final PsiElement element = getPrevSibling(); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java b/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java index f07c0aca206a..1759c8dccd99 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java @@ -16,8 +16,8 @@ package com.intellij.xml; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; +import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.impl.source.xml.SchemaPrefix; import com.intellij.psi.impl.source.xml.TagNameVariantCollector; @@ -28,6 +28,7 @@ import com.intellij.psi.xml.XmlTag; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; @@ -41,21 +42,28 @@ public class DefaultXmlExtension extends XmlExtension { } @NotNull - public List<Pair<String,String>> getAvailableTagNames(@NotNull final XmlFile file, @NotNull final XmlTag context) { + public List<TagInfo> getAvailableTagNames(@NotNull final XmlFile file, @NotNull final XmlTag context) { final Set<String> namespaces = new HashSet<String>(Arrays.asList(context.knownNamespaces())); final List<XmlSchemaProvider> providers = XmlSchemaProvider.getAvailableProviders(file); for (XmlSchemaProvider provider : providers) { namespaces.addAll(provider.getAvailableNamespaces(file, null)); } - final ArrayList<String> nsInfo = new ArrayList<String>(); - final String[] names = TagNameVariantCollector.getTagNameVariants(context, namespaces, nsInfo); - final List<Pair<String, String>> set = new ArrayList<Pair<String,String>>(names.length); - final Iterator<String> iterator = nsInfo.iterator(); - for (String name : names) { - final int pos = name.indexOf(':'); - final String s = pos >= 0 ? name.substring(pos + 1) : name; - set.add(Pair.create(s, iterator.next())); + List<String> nsInfo = new ArrayList<String>(); + List<XmlElementDescriptor> descriptors = TagNameVariantCollector.getTagDescriptors(context, namespaces, nsInfo); + final List<TagInfo> set = new ArrayList<TagInfo>(); + for (int i = 0; i < descriptors.size(); i++) { + final XmlElementDescriptor descriptor = descriptors.get(i); + String qualifiedName = descriptor.getName(context); + final int pos = qualifiedName.indexOf(':'); + final String name = pos >= 0 ? qualifiedName.substring(pos + 1) : qualifiedName; + set.add(new TagInfo(name, nsInfo.get(i)) { + @Nullable + @Override + public PsiElement getDeclaration() { + return descriptor.getDeclaration(); + } + }); } return set; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/NamespaceAwareXmlAttributeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/NamespaceAwareXmlAttributeDescriptor.java new file mode 100644 index 000000000000..6ef32524fe8b --- /dev/null +++ b/xml/xml-psi-impl/src/com/intellij/xml/NamespaceAwareXmlAttributeDescriptor.java @@ -0,0 +1,13 @@ +package com.intellij.xml; + +import com.intellij.psi.xml.XmlTag; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Eugene.Kudelevsky + */ +public interface NamespaceAwareXmlAttributeDescriptor extends XmlAttributeDescriptor { + @Nullable + String getNamespace(@NotNull XmlTag context); +} diff --git a/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java b/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java index afe90ae51924..f76f9b113982 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java @@ -19,7 +19,6 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfoType; import com.intellij.lang.ASTNode; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.util.Pair; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.impl.source.xml.SchemaPrefix; @@ -64,8 +63,24 @@ public abstract class XmlExtension { public abstract boolean isAvailable(PsiFile file); + public static class TagInfo { + + public final String name; + public final String namespace; + + public TagInfo(String name, String namespace) { + this.name = name; + this.namespace = namespace; + } + + @Nullable + public PsiElement getDeclaration() { + return null; + } + } + @NotNull - public abstract List<Pair<String,String>> getAvailableTagNames(@NotNull final XmlFile file, @NotNull final XmlTag context); + public abstract List<TagInfo> getAvailableTagNames(@NotNull final XmlFile file, @NotNull final XmlTag context); @Nullable public TagNameReference createTagNameReference(final ASTNode nameElement, final boolean startTagFlag) { diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java index 6d01ce8bc65f..5e144f7bdc4f 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java @@ -142,4 +142,9 @@ public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescript public final XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attr){ return getAttributeDescriptor(attr.getName(), attr.getParent()); } + + @Override + public String toString() { + return getQualifiedName(); + } } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java index d5b28514f97f..551856d7e326 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java @@ -30,6 +30,7 @@ import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; import com.intellij.util.IncorrectOperationException; +import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; import com.intellij.xml.XmlAttributeDescriptor; import com.intellij.xml.XmlElementDescriptor; @@ -53,19 +54,20 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple private String myName; private static final Class[] ourParentClassesToScanAttributes = new Class[] { XmlMarkupDecl.class, XmlDocument.class }; - private static final Key<CachedValue<XmlAttlistDecl[]>> ourCachedAttlistKeys = Key.create("cached_decls"); + private static final Key<CachedValue<XmlAttlistDecl[]>> ourCachedAttlistKeys = Key.create("cached_declarations"); public XmlElementDescriptorImpl(XmlElementDecl elementDecl) { init(elementDecl); } - public XmlElementDescriptorImpl() {} + public XmlElementDescriptorImpl() { + } private static final UserDataCache<CachedValue<XmlAttlistDecl[]>,XmlElement, Object> myAttlistDeclCache = new UserDataCache<CachedValue<XmlAttlistDecl[]>,XmlElement, Object>() { protected final CachedValue<XmlAttlistDecl[]> compute(final XmlElement owner, Object o) { return CachedValuesManager.getManager(owner.getProject()).createCachedValue(new CachedValueProvider<XmlAttlistDecl[]>() { public Result<XmlAttlistDecl[]> compute() { - return new Result<XmlAttlistDecl[]>(doCollectAttlistDecls(owner),owner); + return new Result<XmlAttlistDecl[]>(doCollectAttlistDeclarations(owner),owner); } }); } @@ -88,6 +90,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple myElementDecl = (XmlElementDecl) element; } + @SuppressWarnings("SpellCheckingInspection") public Object[] getDependences(){ return new Object[]{myElementDecl, ExternalResourceManager.getInstance()}; } @@ -99,11 +102,13 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple @Nullable private static XmlNSDescriptor getNsDescriptorFrom(final PsiElement elementDecl) { final XmlFile file = XmlUtil.getContainingFile(elementDecl); - if(file == null) return null; + if (file == null) { + return null; + } final XmlDocument document = file.getDocument(); - XmlNSDescriptor descriptor = (XmlNSDescriptor) document.getMetaData(); - if(descriptor == null) descriptor = document.getDefaultNSDescriptor(XmlUtil.EMPTY_URI, false); - return descriptor; + assert document != null; + XmlNSDescriptor descriptor = (XmlNSDescriptor)document.getMetaData(); + return descriptor == null ? document.getDefaultNSDescriptor(XmlUtil.EMPTY_URI, false) : descriptor; } // Read-only action @@ -168,19 +173,15 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple // Read-only calculation protected final XmlAttributeDescriptor[] collectAttributeDescriptors(final XmlTag context) { - final XmlAttributeDescriptor[] attrDescrs; - final List<XmlAttributeDescriptor> result = new ArrayList<XmlAttributeDescriptor>(); - - for (XmlAttlistDecl attlistDecl : findAttlistDecls(getName())) { + final List<XmlAttributeDescriptor> result = new SmartList<XmlAttributeDescriptor>(); + for (XmlAttlistDecl attlistDecl : findAttlistDeclarations(getName())) { for (XmlAttributeDecl attributeDecl : attlistDecl.getAttributeDecls()) { final PsiMetaData psiMetaData = attributeDecl.getMetaData(); assert psiMetaData instanceof XmlAttributeDescriptor; result.add((XmlAttributeDescriptor)psiMetaData); } } - - attrDescrs = result.toArray(new XmlAttributeDescriptor[result.size()]); - return attrDescrs; + return result.toArray(new XmlAttributeDescriptor[result.size()]); } // Read-only calculation @@ -195,37 +196,31 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple return localADM; } - private XmlAttlistDecl[] findAttlistDecls(String elementName) { + private XmlAttlistDecl[] findAttlistDeclarations(String elementName) { final List<XmlAttlistDecl> result = new ArrayList<XmlAttlistDecl>(); - - final XmlAttlistDecl[] decls = getAttlistDecls(); - - for (final XmlAttlistDecl decl : decls) { - final String name = decl.getName(); + for (final XmlAttlistDecl declaration : getAttlistDeclarations()) { + final String name = declaration.getName(); if (name != null && name.equals(elementName)) { - result.add(decl); + result.add(declaration); } } - return result.toArray(new XmlAttlistDecl[result.size()]); } - private XmlAttlistDecl[] getAttlistDecls() { - return getCachedAttDecls((XmlElement)getDeclaration()); + private XmlAttlistDecl[] getAttlistDeclarations() { + return getCachedAttributeDeclarations((XmlElement)getDeclaration()); } - public static @NotNull XmlAttlistDecl[] getCachedAttDecls(@Nullable XmlElement owner) { + public static @NotNull XmlAttlistDecl[] getCachedAttributeDeclarations(@Nullable XmlElement owner) { if (owner == null) return XmlAttlistDecl.EMPTY_ARRAY; owner = (XmlElement)PsiTreeUtil.getParentOfType(owner, ourParentClassesToScanAttributes); if (owner == null) return XmlAttlistDecl.EMPTY_ARRAY; return myAttlistDeclCache.get(ourCachedAttlistKeys, owner, null).getValue(); } - private static final XmlAttlistDecl[] doCollectAttlistDecls(XmlElement xmlElement) { + private static XmlAttlistDecl[] doCollectAttlistDeclarations(XmlElement xmlElement) { final List<XmlAttlistDecl> result = new ArrayList<XmlAttlistDecl>(); - XmlUtil.processXmlElements(xmlElement, new FilterElementProcessor(new ClassFilter(XmlAttlistDecl.class), result), false, false, XmlUtil.getContainingFile(xmlElement)); - return result.toArray(new XmlAttlistDecl[result.size()]); } @@ -276,4 +271,4 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple // IDEADEV-11439 myName = null; } -} +}
\ No newline at end of file diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java index 6068f42006bd..c2005fa4ba41 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java @@ -269,7 +269,7 @@ public class ComplexTypeDescriptor extends TypeDescriptor { public boolean canContainTag(String localName, String namespace, XmlElement context) { return _canContainTag(localName, namespace, myTag, context, new HashSet<XmlTag>(5), - new CurrentContextInfo(myDocumentDescriptor, myDocumentDescriptor.getDefaultNamespace())); + new CurrentContextInfo(myDocumentDescriptor, myDocumentDescriptor.getDefaultNamespace()), false); } static class CurrentContextInfo { @@ -298,12 +298,14 @@ public class ComplexTypeDescriptor extends TypeDescriptor { } private boolean _canContainTag(String localName, String namespace, XmlTag tag, XmlElement context, Set<XmlTag> visited, - CurrentContextInfo info) { + CurrentContextInfo info, boolean restriction) { if (visited.contains(tag)) return false; visited.add(tag); if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "any")) { - myHasAnyInContentModel = true; + if (!restriction) { + myHasAnyInContentModel = true; + } if (OTHER_NAMESPACE_ATTR_VALUE.equals(tag.getAttributeValue("namespace"))) { return namespace == null || !namespace.equals(info.expectedDefaultNs); } @@ -315,7 +317,7 @@ public class ComplexTypeDescriptor extends TypeDescriptor { if (ref != null) { XmlTag groupTag = info.documentDescriptor.findGroup(ref); if (groupTag != null) { - if (_canContainTag(localName, namespace, groupTag, context, visited, getContextInfo(info, ref))) return true; + if (_canContainTag(localName, namespace, groupTag, context, visited, getContextInfo(info, ref), restriction)) return true; } } } @@ -329,7 +331,8 @@ public class ComplexTypeDescriptor extends TypeDescriptor { if (descriptor instanceof ComplexTypeDescriptor) { ComplexTypeDescriptor complexTypeDescriptor = (ComplexTypeDescriptor)descriptor; if (complexTypeDescriptor._canContainTag(localName, namespace, complexTypeDescriptor.myTag, context, visited, - getContextInfo(info, base))) { + getContextInfo(info, base), restriction || XmlNSDescriptorImpl.equalsToSchemaName(tag, + RESTRICTION_TAG_NAME))) { myHasAnyInContentModel |= complexTypeDescriptor.myHasAnyInContentModel; return true; } @@ -365,7 +368,7 @@ public class ComplexTypeDescriptor extends TypeDescriptor { } for (XmlTag subTag : tag.getSubTags()) { - if (_canContainTag(localName, namespace, subTag, context, visited, info)) return true; + if (_canContainTag(localName, namespace, subTag, context, visited, info, restriction)) return true; } return false; @@ -379,7 +382,7 @@ public class ComplexTypeDescriptor extends TypeDescriptor { } enum CanContainAttributeType { - CanContainButSkip, CanContainButDoNotSkip, CanNotContain + CanContainButSkip, CanContainButDoNotSkip, CanContainAny, CanNotContain } private CanContainAttributeType _canContainAttribute(String namespace, @@ -398,6 +401,9 @@ public class ComplexTypeDescriptor extends TypeDescriptor { if (OTHER_NAMESPACE_ATTR_VALUE.equals(ns)) { return !namespace.equals(myDocumentDescriptor.getDefaultNamespace()) ? canContainAttributeType : CanContainAttributeType.CanNotContain; } + else if ("##any".equals(ns)) { + return CanContainAttributeType.CanContainAny; + } return canContainAttributeType; } else if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "attributeGroup")) { diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java index ac00589000d2..91b8f60009a4 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java @@ -306,19 +306,21 @@ public class XmlElementDescriptorImpl implements XmlElementDescriptor, PsiWritab XmlAttributeDescriptor attribute = getAttribute(localName, namespace, context, attributeName); - if (attribute instanceof AnyXmlAttributeDescriptor && namespace.length() > 0) { - final XmlNSDescriptor candidateNSDescriptor = context.getNSDescriptor(namespace, true); - - if (candidateNSDescriptor instanceof XmlNSDescriptorImpl) { - final XmlNSDescriptorImpl nsDescriptor = (XmlNSDescriptorImpl)candidateNSDescriptor; - - final XmlAttributeDescriptor xmlAttributeDescriptor = nsDescriptor.getAttribute(localName, namespace, context); - if (xmlAttributeDescriptor != null) return xmlAttributeDescriptor; - else { - final ComplexTypeDescriptor.CanContainAttributeType containAttributeType = - ((AnyXmlAttributeDescriptor)attribute).getCanContainAttributeType(); - if (containAttributeType == ComplexTypeDescriptor.CanContainAttributeType.CanContainButDoNotSkip) { - attribute = null; + if (attribute instanceof AnyXmlAttributeDescriptor) { + final ComplexTypeDescriptor.CanContainAttributeType containAttributeType = + ((AnyXmlAttributeDescriptor)attribute).getCanContainAttributeType(); + if (containAttributeType != ComplexTypeDescriptor.CanContainAttributeType.CanContainAny && !namespace.isEmpty()) { + final XmlNSDescriptor candidateNSDescriptor = context.getNSDescriptor(namespace, true); + + if (candidateNSDescriptor instanceof XmlNSDescriptorImpl) { + final XmlNSDescriptorImpl nsDescriptor = (XmlNSDescriptorImpl)candidateNSDescriptor; + + final XmlAttributeDescriptor xmlAttributeDescriptor = nsDescriptor.getAttribute(localName, namespace, context); + if (xmlAttributeDescriptor != null) return xmlAttributeDescriptor; + else { + if (containAttributeType == ComplexTypeDescriptor.CanContainAttributeType.CanContainButDoNotSkip) { + attribute = null; + } } } } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java index d72f932d3f92..a25f60550e1f 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java @@ -521,7 +521,7 @@ public class HtmlUtil { url.startsWith("ftp://"); } - public static boolean isHtmlFile(PsiElement element) { + public static boolean isHtmlFile(@NotNull PsiElement element) { Language language = element.getLanguage(); return language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE; } diff --git a/xml/xml-psi-impl/xml-psi-impl.iml b/xml/xml-psi-impl/xml-psi-impl.iml index ea9932aed511..913c0972b07a 100644 --- a/xml/xml-psi-impl/xml-psi-impl.iml +++ b/xml/xml-psi-impl/xml-psi-impl.iml @@ -9,7 +9,7 @@ <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="module" module-name="core-api" /> - <orderEntry type="module" module-name="xml-psi-api" /> + <orderEntry type="module" module-name="xml-psi-api" exported="" /> <orderEntry type="module" module-name="core-impl" /> <orderEntry type="module" module-name="analysis-impl" /> <orderEntry type="module" module-name="projectModel-impl" /> |