Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2014-07-18 10:39:51 +0400
committerMike Krüger <mkrueger@xamarin.com>2014-07-18 10:39:51 +0400
commitc8a0ba1624d9c02bd97d2b2b273e1d2d46e7fe21 (patch)
tree7aaa19a7bca95bbb083cc9326b71472770c4e180 /main/src/addins/Xml/Tests
parent81348b16c07d08c8fe449c510b1c4fd592b811e3 (diff)
parent22dfba593abd8c17ee5b7bbb390214e01362c76f (diff)
Merge branch 'xs6-editor' into retina-roslyn
Conflicts: .gitmodules main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Parser/DocumentReferenceManager.cs main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.addin.xml main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj main/src/addins/AspNet/Razor/IRazorCompletionBuilder.cs main/src/addins/AspNet/Razor/RazorCSharpEditorExtension.cs main/src/addins/AspNet/Tests/Razor/RazorCompletionTesting.cs main/src/addins/AspNet/WebForms/ILanguageCompletionBuilder.cs main/src/addins/AspNet/WebForms/WebFormsEditorExtension.cs main/src/addins/CBinding/Gui/CTextEditorExtension.cs main/src/addins/CBinding/Gui/DataProvider.cs main/src/addins/CSharpBinding/AspNet/AspLanguageBuilder.cs main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj main/src/addins/CSharpBinding/AspNet/RazorCSharpCompletionBuilder.cs main/src/addins/CSharpBinding/CSharpBinding.addin.xml main/src/addins/CSharpBinding/CSharpBinding.csproj main/src/addins/CSharpBinding/MonoDevelop.CSharp.ClassOutline/CSharpOutlineTextEditorExtension.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/AbstractGenerateAction.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationOptions.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/ExportCodeGenerator.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/WriteLineGenerator.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/AbstractParameterDataProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/ArrayTypeParameterDataProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/DelegateDataProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/IndexerParameterDataProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/MemberCompletionData.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/MethodParameterDataProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/HighlightUsagesExtension.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/ContextActionExtensions.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringContext.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeActionProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/BaseNRefactoryIssueProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NRefactoryCodeIssueSource.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeIssues/NRefactoryIssueProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpReferenceFinder.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp.UnitTests/UnitTestTextEditorExtension.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/Commands.cs main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocFoodTextEditorExtension.cs main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood/DocGenerator.cs main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/FixableResult.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Fixes/GenericFix.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Fixes/RenameMemberFix.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultMarker.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Result.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Rules/Adaptors.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/AnalysisCodeAction.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeAction.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionProvider.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeAnalysisRunner.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssue.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssueAddinNode.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssueProvider.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/Pad/BatchFixer.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/Pad/CodeAnalysisBatchRunner.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameItemDialog.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ExtensionMethods.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedClassesHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindDerivedSymbolsHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindExtensionMethodHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindMemberOverloadsHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/FindReferencesHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ImportSymbolHandler.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ResolveCommandHandler.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/AbstractUsagesExtension.cs main/src/addins/NUnit/Gui/AbstractUnitTestEditorExtension.cs main/src/addins/Xml/MonoDevelop.Xml.csproj main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingData.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ITextEditorResolver.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerationService.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerator.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ParsedDocument.cs main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs main/tests/UnitTests/MonoDevelop.CSharpBinding.Refactoring/ResolveNamespaceTests.cs main/tests/UnitTests/UnitTests.csproj
Diffstat (limited to 'main/src/addins/Xml/Tests')
-rw-r--r--main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataImageTestFixture.cs23
-rw-r--r--main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataStringTestFixture.cs37
-rw-r--r--main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj159
-rw-r--r--main/src/addins/Xml/Tests/Parser/ActiveElementStartPathTestFixture.cs95
-rw-r--r--main/src/addins/Xml/Tests/Parser/ActiveElementUnderCursorTests.cs157
-rw-r--r--main/src/addins/Xml/Tests/Parser/AttributeNameTestFixture.cs98
-rw-r--r--main/src/addins/Xml/Tests/Parser/AttributeNameUnderCursorTests.cs56
-rw-r--r--main/src/addins/Xml/Tests/Parser/AttributeValueUnderCursorTests.cs68
-rw-r--r--main/src/addins/Xml/Tests/Parser/InsideAttributeValueTestFixture.cs109
-rw-r--r--main/src/addins/Xml/Tests/Parser/NamespaceDeclarationTestFixture.cs109
-rw-r--r--main/src/addins/Xml/Tests/Parser/ParentElementPathTestFixture.cs57
-rw-r--r--main/src/addins/Xml/Tests/Parser/ParsingTests.cs309
-rw-r--r--main/src/addins/Xml/Tests/Parser/QualifiedNameTestFixture.cs68
-rw-r--r--main/src/addins/Xml/Tests/Parser/TestXmlParser.cs237
-rw-r--r--main/src/addins/Xml/Tests/Paths/NoElementPathTestFixture.cs49
-rw-r--r--main/src/addins/Xml/Tests/Paths/SingleElementPathTestFixture.cs52
-rw-r--r--main/src/addins/Xml/Tests/Paths/TwoElementPathTestFixture.cs62
-rw-r--r--main/src/addins/Xml/Tests/Resources/XMLSchema.xsd2534
-rw-r--r--main/src/addins/Xml/Tests/Resources/xhtml1-strict-modified.xsd2210
-rw-r--r--main/src/addins/Xml/Tests/Schema/AbstractElementTestFixture.cs128
-rw-r--r--main/src/addins/Xml/Tests/Schema/AllElementTestFixture.cs71
-rw-r--r--main/src/addins/Xml/Tests/Schema/AttributeAnnotationTestFixture.cs66
-rw-r--r--main/src/addins/Xml/Tests/Schema/AttributeGroupRefTestFixture.cs73
-rw-r--r--main/src/addins/Xml/Tests/Schema/AttributeRefTestFixture.cs98
-rw-r--r--main/src/addins/Xml/Tests/Schema/AttributeValueAnnotationTestFixture.cs63
-rw-r--r--main/src/addins/Xml/Tests/Schema/ChildElementAttributesTestFixture.cs70
-rw-r--r--main/src/addins/Xml/Tests/Schema/ChoiceTestFixture.cs79
-rw-r--r--main/src/addins/Xml/Tests/Schema/ComplexContentExtensionTestFixture.cs103
-rw-r--r--main/src/addins/Xml/Tests/Schema/DuplicateElementTestFixture.cs69
-rw-r--r--main/src/addins/Xml/Tests/Schema/ElementAnnotationTestFixture.cs65
-rw-r--r--main/src/addins/Xml/Tests/Schema/ElementRefAnnotationTestFixture.cs53
-rw-r--r--main/src/addins/Xml/Tests/Schema/ElementWithAttributeSchemaTestFixture.cs58
-rw-r--r--main/src/addins/Xml/Tests/Schema/EnumAttributeValueTestFixture.cs60
-rw-r--r--main/src/addins/Xml/Tests/Schema/ExtensionElementTestFixture.cs255
-rw-r--r--main/src/addins/Xml/Tests/Schema/FindAttributeFromComplexTypeTestFixture.cs49
-rw-r--r--main/src/addins/Xml/Tests/Schema/GroupRefCompositorTestFixture.cs81
-rw-r--r--main/src/addins/Xml/Tests/Schema/GroupRefTestFixture.cs122
-rw-r--r--main/src/addins/Xml/Tests/Schema/Includes/AttributeGroupRefSchemaIncludeTestFixture.cs37
-rw-r--r--main/src/addins/Xml/Tests/Schema/Includes/TwoElementSchemaIncludeTestFixture.cs37
-rw-r--r--main/src/addins/Xml/Tests/Schema/MissingSchemaElementTestFixture.cs47
-rw-r--r--main/src/addins/Xml/Tests/Schema/NamespaceCompletionTestFixture.cs65
-rw-r--r--main/src/addins/Xml/Tests/Schema/NestedAttributeGroupRefTestFixture.cs100
-rw-r--r--main/src/addins/Xml/Tests/Schema/NestedChoiceTestFixture.cs90
-rw-r--r--main/src/addins/Xml/Tests/Schema/NestedElementSchemaTestFixture.cs47
-rw-r--r--main/src/addins/Xml/Tests/Schema/NestedSequenceTestFixture.cs82
-rw-r--r--main/src/addins/Xml/Tests/Schema/ReferencedElementsTestFixture.cs128
-rw-r--r--main/src/addins/Xml/Tests/Schema/RestrictionElementTestFixture.cs144
-rw-r--r--main/src/addins/Xml/Tests/Schema/SchemaAssociationTests.cs63
-rw-r--r--main/src/addins/Xml/Tests/Schema/SchemaTestFixtureBase.cs121
-rw-r--r--main/src/addins/Xml/Tests/Schema/SequencedChoiceTestFixture.cs83
-rw-r--r--main/src/addins/Xml/Tests/Schema/SimpleContentWithAttributeTestFixture.cs59
-rw-r--r--main/src/addins/Xml/Tests/Schema/SingleElementSchemaTestFixture.cs63
-rw-r--r--main/src/addins/Xml/Tests/Schema/TwoElementSchemaTestFixture.cs102
-rw-r--r--main/src/addins/Xml/Tests/Schema/Uri/GetUriTestFixture.cs34
-rw-r--r--main/src/addins/Xml/Tests/Schema/XhtmlStrictSchemaTestFixture.cs42
-rw-r--r--main/src/addins/Xml/Tests/Schema/XmlSchemaNamespaceTests.cs31
-rw-r--r--main/src/addins/Xml/Tests/Schema/XsdSchemaTestFixture.cs249
-rw-r--r--main/src/addins/Xml/Tests/Utils/ResourceManager.cs54
-rw-r--r--main/src/addins/Xml/Tests/Utils/SchemaIncludeTestFixtureHelper.cs83
59 files changed, 9813 insertions, 0 deletions
diff --git a/main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataImageTestFixture.cs b/main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataImageTestFixture.cs
new file mode 100644
index 0000000000..4af206082f
--- /dev/null
+++ b/main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataImageTestFixture.cs
@@ -0,0 +1,23 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.CompletionData
+{
+ [TestFixture]
+ public class XmlCompletionDataIconTestFixture
+ {
+ [Test]
+ public void IconNotNull ()
+ {
+ XmlCompletionData data = new XmlCompletionData ("foo");
+ Assert.IsFalse (data.Icon.IsNull);
+ }
+
+ [Test]
+ public void IconNotEmptyString ()
+ {
+ XmlCompletionData data = new XmlCompletionData ("foo");
+ Assert.IsTrue (data.Icon.Name.Length > 0);
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataStringTestFixture.cs b/main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataStringTestFixture.cs
new file mode 100644
index 0000000000..83787fa469
--- /dev/null
+++ b/main/src/addins/Xml/Tests/CompletionData/XmlCompletionDataStringTestFixture.cs
@@ -0,0 +1,37 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.CompletionData
+{
+ [TestFixture]
+ public class XmlCompletionDataStringTestFixture
+ {
+ [Test]
+ public void XmlElementCompletionString()
+ {
+ XmlCompletionData data = new XmlCompletionData("foo", XmlCompletionData.DataType.XmlElement);
+ Assert.AreEqual("foo", data.CompletionText);
+ }
+
+ [Test]
+ public void NamespaceUriCompletionString()
+ {
+ XmlCompletionData data = new XmlCompletionData("foo", XmlCompletionData.DataType.NamespaceUri);
+ Assert.AreEqual("foo", data.CompletionText);
+ }
+
+ [Test]
+ public void AttributeCompletionString()
+ {
+ XmlCompletionData data = new XmlCompletionData("foo", XmlCompletionData.DataType.XmlAttribute);
+ Assert.AreEqual("foo", data.CompletionText);
+ }
+
+ [Test]
+ public void AttributeValueCompletionString()
+ {
+ XmlCompletionData data = new XmlCompletionData("foo", XmlCompletionData.DataType.XmlAttributeValue);
+ Assert.AreEqual("foo", data.CompletionText);
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj b/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj
new file mode 100644
index 0000000000..906220688a
--- /dev/null
+++ b/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8E47B77A-A649-494C-9BF2-B845E39CADE9}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AssemblyName>MonoDevelop.Xml.Tests</AssemblyName>
+ <RootNamespace>MonoDevelop.Xml.Tests</RootNamespace>
+ <TestRunnerCommand>..\..\..\..\build\bin\mdtool.exe</TestRunnerCommand>
+ <TestRunnerArgs>run-md-tests</TestRunnerArgs>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>True</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\tests</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <Execution>
+ <Execution clr-version="Net_2_0" />
+ </Execution>
+ <NoWarn>1591;1573</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>True</Optimize>
+ <OutputPath>..\..\..\..\build\tests</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>False</ConsolePause>
+ <Execution>
+ <Execution clr-version="Net_2_0" />
+ </Execution>
+ <DebugSymbols>true</DebugSymbols>
+ <NoWarn>1591;1573</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
+ <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
+ <Name>MonoDevelop.Core</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
+ <Name>MonoDevelop.Ide</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\external\nrefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
+ <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
+ <Name>ICSharpCode.NRefactory</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
+ <Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
+ <Name>GuiUnit_NET_4_5</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\MonoDevelop.Xml.csproj">
+ <Project>{86DFC74A-B0B6-4C73-9E05-9098DA8FA5F1}</Project>
+ <Name>MonoDevelop.Xml</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj">
+ <Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
+ <Name>ICSharpCode.NRefactory6.CSharp</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Parser\ActiveElementStartPathTestFixture.cs" />
+ <Compile Include="Parser\AttributeNameTestFixture.cs" />
+ <Compile Include="Parser\NamespaceDeclarationTestFixture.cs" />
+ <Compile Include="Parser\ParentElementPathTestFixture.cs" />
+ <Compile Include="Parser\QualifiedNameTestFixture.cs" />
+ <Compile Include="Paths\NoElementPathTestFixture.cs" />
+ <Compile Include="Paths\SingleElementPathTestFixture.cs" />
+ <Compile Include="Paths\TwoElementPathTestFixture.cs" />
+ <Compile Include="Schema\AbstractElementTestFixture.cs" />
+ <Compile Include="Schema\AttributeAnnotationTestFixture.cs" />
+ <Compile Include="Schema\AttributeGroupRefTestFixture.cs" />
+ <Compile Include="Schema\AttributeRefTestFixture.cs" />
+ <Compile Include="Schema\AttributeValueAnnotationTestFixture.cs" />
+ <Compile Include="Schema\ChildElementAttributesTestFixture.cs" />
+ <Compile Include="Schema\ChoiceTestFixture.cs" />
+ <Compile Include="Schema\ComplexContentExtensionTestFixture.cs" />
+ <Compile Include="Schema\DuplicateElementTestFixture.cs" />
+ <Compile Include="Schema\ElementAnnotationTestFixture.cs" />
+ <Compile Include="Schema\ElementRefAnnotationTestFixture.cs" />
+ <Compile Include="Schema\ElementWithAttributeSchemaTestFixture.cs" />
+ <Compile Include="Schema\EnumAttributeValueTestFixture.cs" />
+ <Compile Include="Schema\ExtensionElementTestFixture.cs" />
+ <Compile Include="Schema\GroupRefCompositorTestFixture.cs" />
+ <Compile Include="Schema\GroupRefTestFixture.cs" />
+ <Compile Include="Schema\NamespaceCompletionTestFixture.cs" />
+ <Compile Include="Schema\NestedAttributeGroupRefTestFixture.cs" />
+ <Compile Include="Schema\NestedChoiceTestFixture.cs" />
+ <Compile Include="Schema\NestedElementSchemaTestFixture.cs" />
+ <Compile Include="Schema\NestedSequenceTestFixture.cs" />
+ <Compile Include="Schema\ReferencedElementsTestFixture.cs" />
+ <Compile Include="Schema\RestrictionElementTestFixture.cs" />
+ <Compile Include="Schema\SchemaTestFixtureBase.cs" />
+ <Compile Include="Schema\SequencedChoiceTestFixture.cs" />
+ <Compile Include="Schema\SimpleContentWithAttributeTestFixture.cs" />
+ <Compile Include="Schema\SingleElementSchemaTestFixture.cs" />
+ <Compile Include="Schema\TwoElementSchemaTestFixture.cs" />
+ <Compile Include="Schema\XhtmlStrictSchemaTestFixture.cs" />
+ <Compile Include="Schema\XsdSchemaTestFixture.cs" />
+ <Compile Include="Utils\ResourceManager.cs" />
+ <Compile Include="Utils\SchemaIncludeTestFixtureHelper.cs" />
+ <Compile Include="CompletionData\XmlCompletionDataImageTestFixture.cs" />
+ <Compile Include="CompletionData\XmlCompletionDataStringTestFixture.cs" />
+ <Compile Include="Schema\MissingSchemaElementTestFixture.cs" />
+ <Compile Include="Schema\AllElementTestFixture.cs" />
+ <Compile Include="Parser\InsideAttributeValueTestFixture.cs" />
+ <Compile Include="Schema\XmlSchemaNamespaceTests.cs" />
+ <Compile Include="Schema\FindAttributeFromComplexTypeTestFixture.cs" />
+ <Compile Include="Parser\ActiveElementUnderCursorTests.cs" />
+ <Compile Include="Parser\AttributeNameUnderCursorTests.cs" />
+ <Compile Include="Parser\AttributeValueUnderCursorTests.cs" />
+ <Compile Include="Schema\SchemaAssociationTests.cs" />
+ <Compile Include="Parser\TestXmlParser.cs" />
+ <Compile Include="Parser\ParsingTests.cs" />
+ <Compile Include="Schema\Uri\GetUriTestFixture.cs" />
+ <Compile Include="Schema\Includes\AttributeGroupRefSchemaIncludeTestFixture.cs" />
+ <Compile Include="Schema\Includes\TwoElementSchemaIncludeTestFixture.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Parser\" />
+ <Folder Include="Paths\" />
+ <Folder Include="Schema\" />
+ <Folder Include="Utils\" />
+ <Folder Include="CompletionData\" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Resources\xhtml1-strict-modified.xsd">
+ <LogicalName>xhtml1-strict-modified.xsd</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Resources\XMLSchema.xsd">
+ <LogicalName>XMLSchema.xsd</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <Policies>
+ <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="FileName" />
+ </Policies>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project>
diff --git a/main/src/addins/Xml/Tests/Parser/ActiveElementStartPathTestFixture.cs b/main/src/addins/Xml/Tests/Parser/ActiveElementStartPathTestFixture.cs
new file mode 100644
index 0000000000..9a9b299c5b
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/ActiveElementStartPathTestFixture.cs
@@ -0,0 +1,95 @@
+using System;
+using MonoDevelop.Xml.Completion;
+using MonoDevelop.Xml.Parser;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ [TestFixture]
+ public class ActiveElementStartPathTestFixture
+ {
+ const string namespaceURI = "http://foo.com/foo.xsd";
+
+ [Test]
+ public void PathTest1()
+ {
+ AssertElementPath (
+ "<foo xmlns='" + namespaceURI + "' $",
+ new QualifiedName("foo", namespaceURI)
+ );
+ }
+
+ [Test]
+ public void PathTest2()
+ {
+ AssertElementPath (
+ "<foo xmlns='" + namespaceURI + "' ><bar $",
+ new QualifiedName("foo", namespaceURI),
+ new QualifiedName("bar", namespaceURI)
+ );
+ }
+
+ [Test]
+ public void PathTest3()
+ {
+ AssertElementPath (
+ "<f:foo xmlns:f='" + namespaceURI + "' ><f:bar $",
+ new QualifiedName ("foo", namespaceURI, "f"),
+ new QualifiedName ("bar", namespaceURI, "f")
+ );
+ }
+
+ [Test]
+ public void PathTest4()
+ {
+ AssertElementPath (
+ "<x:foo xmlns:x='" + namespaceURI + "' $",
+ new QualifiedName("foo", namespaceURI, "x")
+ );
+ }
+
+ [Test]
+ public void PathTest5()
+ {
+ AssertElementPath (
+ "<foo xmlns='" + namespaceURI + "'>\r\n<y\r\n" + "Id = 'foo' $",
+ new QualifiedName ("foo", namespaceURI),
+ new QualifiedName ("y", namespaceURI)
+ );
+ }
+
+ [Test]
+ public void PathTest6()
+ {
+ AssertElementPath (
+ "<bar xmlns='http://bar'/>\r\n<foo xmlns='" + namespaceURI + "' $",
+ new QualifiedName ("foo", namespaceURI)
+ );
+ }
+
+ /// <summary>
+ /// Tests that we get no path back if we are outside the start
+ /// tag.
+ /// </summary>
+ [Test]
+ public void OutOfStartTagPathTest1()
+ {
+ TestXmlParser.AssertState (
+ "<foo xmlns='" + namespaceURI + "'> $",
+ p => p.AssertStateIs<XmlRootState> ()
+ );
+ }
+
+ static void AssertElementPath (string text, params QualifiedName[] qualifiedNames)
+ {
+ TestXmlParser.AssertState (text, p => {
+ var arr = p.Nodes.ToArray ();
+ Array.Reverse (arr);
+ Assert.AreEqual (
+ new XmlElementPath (qualifiedNames),
+ XmlElementPath.Resolve (arr)
+ );
+ });
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/ActiveElementUnderCursorTests.cs b/main/src/addins/Xml/Tests/Parser/ActiveElementUnderCursorTests.cs
new file mode 100644
index 0000000000..916e2873e0
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/ActiveElementUnderCursorTests.cs
@@ -0,0 +1,157 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ /// <summary>
+ /// Tests the XmlParser.GetActiveElementStartPathAtIndex which finds the element
+ /// path where the index is at. The index may be in the middle or start of the element
+ /// tag.
+ /// </summary>
+ [TestFixture]
+ public class ActiveElementUnderCursorTests
+ {
+ const string namespaceURI = "http://foo.com/foo.xsd";
+
+ [Test]
+ public void PathTest1()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'$><bar>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName("foo", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest2()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><$bar>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName("foo", namespaceURI),
+ new QualifiedName("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest3()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><b$ar>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName("foo", namespaceURI),
+ new QualifiedName("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest4()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar$>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName ("foo", namespaceURI),
+ new QualifiedName ("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest5()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar a$='a'>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName ("foo", namespaceURI),
+ new QualifiedName ("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest6()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar a='a$'>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName ("foo", namespaceURI),
+ new QualifiedName ("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest7()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar a='a' $>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName("foo", namespaceURI),
+ new QualifiedName("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest8()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar>$",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName("foo", namespaceURI),
+ new QualifiedName("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest9()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar \n\n hi='$'>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName ("foo", namespaceURI),
+ new QualifiedName ("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest10()
+ {
+ TestXmlParser.AssertTree (
+ "<foo xmlns='" + namespaceURI + "'><bar $Id=\r\n</foo>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName ("foo", namespaceURI),
+ new QualifiedName ("bar", namespaceURI)
+ )
+ );
+ }
+
+ [Test]
+ public void PathTest11()
+ {
+ TestXmlParser.AssertTree (
+ "<fo$o xmlns='" + namespaceURI + "'>",
+ n => TestXmlParser.AssertPath (
+ n,
+ new QualifiedName ("foo", namespaceURI)
+ )
+ );
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/AttributeNameTestFixture.cs b/main/src/addins/Xml/Tests/Parser/AttributeNameTestFixture.cs
new file mode 100644
index 0000000000..d63b3f630f
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/AttributeNameTestFixture.cs
@@ -0,0 +1,98 @@
+using System.Linq;
+using MonoDevelop.Xml.Dom;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ /// <summary>
+ /// Tests that we can detect the attribute's name.
+ /// </summary>
+ [TestFixture]
+ public class AttributeNameTestFixture
+ {
+ [Test]
+ public void SuccessTest1()
+ {
+ AssertAttributeName ("<a foo='a$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest2()
+ {
+ AssertAttributeName ("<a foo='$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest3()
+ {
+ AssertAttributeName ("<a foo=$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest4()
+ {
+ AssertAttributeName ("<a foo=\"$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest5()
+ {
+ AssertAttributeName ("<a foo = \"$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest6()
+ {
+ AssertAttributeName ("<a foo = '#$", "foo");
+ }
+
+ [Test]
+ public void FailureTest1()
+ {
+ NotAttribute ("foo=$");
+ }
+
+ [Test]
+ public void FailureTest2()
+ {
+ NotAttribute ("foo=<$");
+ }
+
+ [Test]
+ public void FailureTest3()
+ {
+ NotAttribute ("a$");
+ }
+
+ [Test]
+ public void FailureTest4()
+ {
+ NotAttribute ("< a$");
+ }
+
+ [Test]
+ public void EmptyString()
+ {
+ NotAttribute ("$");
+ }
+
+ static void AssertAttributeName (string doc, string name)
+ {
+ TestXmlParser.AssertState (doc, p => {
+ var att = p.Nodes.FirstOrDefault () as XAttribute;
+ Assert.NotNull (att);
+ Assert.NotNull (att.Name);
+ Assert.IsNull (att.Name.Prefix);
+ Assert.AreEqual (att.Name.Name, name);
+ });
+ }
+
+ static void NotAttribute (string doc)
+ {
+ TestXmlParser.AssertState (doc, p => {
+ var att = p.Nodes.FirstOrDefault () as XAttribute;
+ Assert.IsNull (att);
+ });
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/AttributeNameUnderCursorTests.cs b/main/src/addins/Xml/Tests/Parser/AttributeNameUnderCursorTests.cs
new file mode 100644
index 0000000000..f50cf21330
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/AttributeNameUnderCursorTests.cs
@@ -0,0 +1,56 @@
+using System.Linq;
+using MonoDevelop.Xml.Dom;
+using MonoDevelop.Xml.Parser;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ [TestFixture]
+ public class AttributeNameUnderCursorTests
+ {
+ [Test]
+ public void SuccessTest1()
+ {
+ AssertAttributeName ("<a foo$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest2()
+ {
+ AssertAttributeName ("<a foo=$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest3()
+ {
+ AssertAttributeName ("<a foo='$", "foo");
+ }
+
+ [Test]
+ public void SuccessTest4()
+ {
+ AssertAttributeName ("<a type='a$", "type");
+ }
+
+ public void AssertAttributeName (string doc, string name)
+ {
+ TestXmlParser.AssertState (doc, p => {
+ var att = p.Nodes.First () as XAttribute;
+ Assert.NotNull (att);
+ Assert.AreEqual (name, GetName (p));
+ });
+ }
+
+ static string GetName (XmlParser parser)
+ {
+ var namedObject = parser.Nodes.First () as INamedXObject;
+ Assert.NotNull (namedObject);
+ if (namedObject.IsNamed)
+ return namedObject.Name.ToString ();
+
+ var state = parser.CurrentState as XmlNameState;
+ Assert.NotNull (state);
+ return ((IXmlParserContext)parser).KeywordBuilder.ToString ();
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/AttributeValueUnderCursorTests.cs b/main/src/addins/Xml/Tests/Parser/AttributeValueUnderCursorTests.cs
new file mode 100644
index 0000000000..07e6c01f41
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/AttributeValueUnderCursorTests.cs
@@ -0,0 +1,68 @@
+
+using System.Linq;
+using MonoDevelop.Xml.Dom;
+using MonoDevelop.Xml.Parser;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ [TestFixture]
+ public class AttributeValueUnderCursorTests
+ {
+ [Test]
+ public void SuccessTest1()
+ {
+ AssertAttributeValue ("<a foo='abc$'", "abc");
+ }
+
+ [Test]
+ public void SuccessTest2()
+ {
+ AssertAttributeValue ("<a foo=\"abc$\"", "abc");
+ }
+
+ [Test]
+ public void SuccessTest3()
+ {
+ AssertAttributeValue ("<a foo='abc$'", "abc");
+ }
+
+ [Test]
+ public void SuccessTest4()
+ {
+ AssertAttributeValue ("<a foo='$abc'", "");
+ }
+
+ [Test]
+ public void SuccessTest5()
+ {
+ AssertAttributeValue ("<a foo='$a", "");
+ }
+
+ [Test]
+ public void SuccessTest6()
+ {
+ AssertAttributeValue ("<a foo='a$'", "a");
+ }
+
+ [Test]
+ public void SuccessTest7()
+ {
+ AssertAttributeValue ("<a foo='a\"b\"c$'", "a\"b\"c");
+ }
+
+ [Test]
+ public void FailureTest1()
+ {
+ TestXmlParser.AssertState ("<a foo=''$", p => Assert.IsNull (p.Nodes.LastOrDefault () as XAttribute));
+ }
+
+ public void AssertAttributeValue (string doc, string val)
+ {
+ TestXmlParser.AssertState (doc, p => {
+ p.AssertStateIs<XmlAttributeValueState> ();
+ Assert.AreEqual (val, ((IXmlParserContext)p).KeywordBuilder.ToString ());
+ });
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/InsideAttributeValueTestFixture.cs b/main/src/addins/Xml/Tests/Parser/InsideAttributeValueTestFixture.cs
new file mode 100644
index 0000000000..ae659f2d91
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/InsideAttributeValueTestFixture.cs
@@ -0,0 +1,109 @@
+using NUnit.Framework;
+using MonoDevelop.Xml.Parser;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ [TestFixture]
+ public class InsideAttributeValueTestFixture
+ {
+ [Test]
+ public void InvalidString()
+ {
+ AssertNotInsideAttributeValue ("$");
+ }
+
+ [Test]
+ public void DoubleQuotesTest1()
+ {
+ string xml = "<foo a=\"$";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void DoubleQuotesTest2()
+ {
+ string xml = "<foo a=\"\" $";
+ AssertNotInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void DoubleQuotesTest3()
+ {
+ string xml = "<foo a=\"\"$";
+ AssertNotInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void DoubleQuotesTest4()
+ {
+ string xml = "<foo a=\" $";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void NoXmlElementStart()
+ {
+ string xml = "foo a=\"$";
+ AssertNotInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void DoubleQuotesTest5()
+ {
+ string xml = "<foo a=\"$\"";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void EqualsSignTest()
+ {
+ string xml = "<foo a=$";
+ AssertNotInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void SingleQuoteTest1()
+ {
+ string xml = "<foo a='$";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void MixedQuotesTest1()
+ {
+ string xml = "<foo a='\"$";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void MixedQuotesTest2()
+ {
+ string xml = "<foo a=\"'$";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void MixedQuotesTest3()
+ {
+ string xml = "<foo a=\"''$";
+ AssertInsideAttributeValue (xml);
+ }
+
+ [Test]
+ public void MixedQuotesTest4()
+ {
+ string xml = "<foo a=\"''\"$";
+ AssertNotInsideAttributeValue (xml);
+ }
+
+ public void AssertInsideAttributeValue (string doc)
+ {
+ TestXmlParser.AssertState (doc, p => p.AssertStateIs<XmlAttributeValueState> ());
+ }
+
+ public void AssertNotInsideAttributeValue (string doc)
+ {
+ TestXmlParser.AssertState (doc, p => p.AssertStateIsNot<XmlAttributeValueState> ());
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/NamespaceDeclarationTestFixture.cs b/main/src/addins/Xml/Tests/Parser/NamespaceDeclarationTestFixture.cs
new file mode 100644
index 0000000000..49549fe583
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/NamespaceDeclarationTestFixture.cs
@@ -0,0 +1,109 @@
+
+using System.Linq;
+using MonoDevelop.Xml.Dom;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ /// <summary>
+ /// When the user hits the '=' key we need to produce intellisense
+ /// if the attribute is of the form 'xmlns' or 'xmlns:foo'. This
+ /// tests the parsing of the text before the cursor to see if the
+ /// attribute is a namespace declaration.
+ /// </summary>
+ [TestFixture]
+ public class NamespaceDeclarationTestFixture
+ {
+ [Test]
+ public void SuccessTest1()
+ {
+ AssertIsNamespaceDeclaration("<foo xmlns=$");
+ }
+
+ [Test]
+ public void SuccessTest2()
+ {
+ AssertIsNamespaceDeclaration("<foo xmlns =$");
+ }
+
+ [Test]
+ public void SuccessTest3()
+ {
+ AssertIsNamespaceDeclaration("<foo \r\nxmlns\r\n=$");
+ }
+
+ [Test]
+ public void SuccessTest4()
+ {
+ AssertIsNamespaceDeclaration("<foo xmlns:nant=$");
+ }
+
+ [Test]
+ public void FailureTest1()
+ {
+ AssertNotNamespaceDeclaration("<foo xmlns$");
+ }
+
+ [Test]
+ public void FailureTest2()
+ {
+ AssertNotNamespaceDeclaration("<foo xmlns:nant$");
+ }
+
+ [Test]
+ public void FailureTest3()
+ {
+ AssertNotNamespaceDeclaration(" xmlns=$");
+ }
+
+ [Test]
+ public void FailureTest4()
+ {
+ AssertNotNamespaceDeclaration(" xmlns$");
+ }
+
+ [Test]
+ public void FailureTest5()
+ {
+ AssertNotNamespaceDeclaration(" xmlns:f$");
+ }
+
+ [Test]
+ public void FailureTest6()
+ {
+ AssertNotNamespaceDeclaration("<foo bar=$");
+ }
+
+ [Test]
+ public void FailureTest7()
+ {
+ AssertNotNamespaceDeclaration("$");
+ }
+
+ public void AssertIsNamespaceDeclaration (string doc)
+ {
+ TestXmlParser.AssertState (doc, p => {
+ var node = p.Nodes.FirstOrDefault () as XAttribute;
+ Assert.NotNull (node);
+ Assert.IsTrue (node.IsNamed);
+ if (node.Name.HasPrefix)
+ Assert.AreEqual ("xmlns", node.Name.Prefix);
+ else
+ Assert.AreEqual ("xmlns", node.Name.Name);
+ });
+ }
+
+ public void AssertNotNamespaceDeclaration (string doc)
+ {
+ TestXmlParser.AssertState (doc, p => {
+ var node = p.Nodes.FirstOrDefault () as XAttribute;
+ if (node != null && node.IsNamed) {
+ if (node.Name.HasPrefix)
+ Assert.AreNotEqual ("xmlns", node.Name.Prefix);
+ else
+ Assert.AreNotEqual ("xmlns", node.Name.Name);
+ }
+ });
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/ParentElementPathTestFixture.cs b/main/src/addins/Xml/Tests/Parser/ParentElementPathTestFixture.cs
new file mode 100644
index 0000000000..7f73762161
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/ParentElementPathTestFixture.cs
@@ -0,0 +1,57 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ [TestFixture]
+ public class ParentElementPathTestFixture
+ {
+ const string namespaceURI = "http://foo/foo.xsd";
+
+ [Test]
+ public void SuccessTest1()
+ {
+ AssertParentPath (
+ "<foo xmlns='" + namespaceURI + "' >$<",
+ new QualifiedName ("foo", namespaceURI)
+ );
+ }
+
+ [Test]
+ public void SuccessTest2()
+ {
+ AssertParentPath (
+ "<foo xmlns='" + namespaceURI + "' ><bar></bar><$",
+ new QualifiedName ("foo", namespaceURI)
+ );
+ }
+
+ [Test]
+ public void SuccessTest3()
+ {
+ AssertParentPath (
+ "<foo xmlns='" + namespaceURI + "' ><bar/><$",
+ new QualifiedName ("foo", namespaceURI)
+ );
+ }
+
+ [Test]
+ public void SuccessTest4()
+ {
+ AssertParentPath (
+ "<bar xmlns='http://test.com'/><foo xmlns='" + namespaceURI + "' ><$",
+ new QualifiedName ("foo", namespaceURI)
+ );
+ }
+
+ public void AssertParentPath (string doc, params QualifiedName[] qualifiedNames)
+ {
+ TestXmlParser.AssertState (doc, p =>
+ Assert.AreEqual (
+ new XmlElementPath (qualifiedNames),
+ XmlElementPath.Resolve (p.Nodes.ToArray ())
+ )
+ );;
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/ParsingTests.cs b/main/src/addins/Xml/Tests/Parser/ParsingTests.cs
new file mode 100644
index 0000000000..ad84140b7a
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/ParsingTests.cs
@@ -0,0 +1,309 @@
+//
+// ParsingTests.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Linq;
+
+using ICSharpCode.NRefactory.TypeSystem;
+using MonoDevelop.Xml.Dom;
+using MonoDevelop.Xml.Parser;
+using NUnit.Framework;
+
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+
+ [TestFixture]
+ public class ParsingTests
+ {
+ public virtual XmlRootState CreateRootState ()
+ {
+ return new XmlRootState ();
+ }
+
+ [Test]
+ public void AttributeName ()
+ {
+ var parser = new TestXmlParser (CreateRootState ());
+ parser.Parse (@"
+<doc>
+ <tag.a>
+ <tag.b id=""$foo"" />
+ </tag.a>
+</doc>
+",
+ delegate {
+ parser.AssertStateIs<XmlAttributeValueState> ();
+ parser.AssertPath ("//doc/tag.a/tag.b/@id");
+ }
+ );
+ parser.AssertEmpty ();
+ parser.AssertErrorCount (0);
+ }
+
+ [Test]
+ public void Attributes ()
+ {
+ var parser = new TestXmlParser (CreateRootState ());
+ parser.Parse (@"
+<doc>
+ <tag.a name=""foo"" arg=5 wibble = 6 bar.baz = 'y.ff7]' $ />
+</doc>
+",
+ delegate {
+ parser.AssertStateIs<XmlTagState> ();
+ parser.AssertAttributes ("name", "foo", "arg", "5", "wibble", "6", "bar.baz", "y.ff7]");
+ }
+ );
+ parser.AssertEmpty ();
+ parser.AssertErrorCount (0);
+ }
+
+ [Test]
+ public void AttributeRecovery ()
+ {
+ var parser = new TestXmlParser (CreateRootState ());
+ parser.Parse (@"
+<doc>
+ <tag.a>
+ <tag.b arg='fff' sdd = sdsds= 'foo' ff = 5 $ />
+ </tag.a>
+<a><b valid/></a>
+</doc>
+",
+ delegate {
+ parser.AssertStateIs<XmlTagState> ();
+ parser.AssertAttributes ("arg", "fff", "sdd", "sdsds", "ff", "5");
+ parser.AssertErrorCount (3);
+ }
+ );
+ parser.AssertEmpty ();
+ parser.AssertErrorCount (4);
+ }
+
+ [Test]
+ public void IncompleteTags ()
+ {
+ var parser = new TestXmlParser (CreateRootState ());
+ parser.Parse (@"
+<doc>
+ <tag.a att1 >
+ <tag.b att2="" >
+ <tag.c att3 = '
+ <tag.d att4 = >
+ <tag.e att5='' att6=' att7 = >
+ <tag.f id='$foo' />
+ </tag.e>
+ </tag.d>
+ </tag.c>
+ </tag.b>
+ </tag.a>
+</doc>
+",
+ delegate {
+ parser.AssertStateIs<XmlAttributeValueState> ();
+ parser.AssertNodeDepth (9);
+ parser.AssertPath ("//doc/tag.a/tag.b/tag.c/tag.d/tag.e/tag.f/@id");
+ }
+ );
+ parser.AssertEmpty ();
+ parser.AssertErrorCount (5, x => x.ErrorType == ErrorType.Error);
+ }
+
+ [Test]
+ public void Unclosed ()
+ {
+ var parser = new TestXmlParser (CreateRootState ());
+ parser.Parse (@"
+<doc>
+ <tag.a>
+ <tag.b><tag.b>$
+ </tag.a>$
+</doc>
+",
+ delegate {
+ parser.AssertStateIs<XmlRootState> ();
+ parser.AssertNodeDepth (5);
+ parser.AssertPath ("//doc/tag.a/tag.b/tag.b");
+ },
+ delegate {
+ parser.AssertStateIs<XmlRootState> ();
+ parser.AssertNodeDepth (2);
+ parser.AssertPath ("//doc");
+ }
+ );
+ parser.AssertEmpty ();
+ parser.AssertErrorCount (2);
+ }
+
+ [Test]
+ public void Misc ()
+ {
+ var parser = new TestXmlParser (CreateRootState ());
+ parser.Parse (@"
+<doc>
+ <!DOCTYPE $ >
+ <![CDATA[ ] $ ] ]]>
+ <!-- <foo> <bar arg=""> $ -->
+</doc>
+",
+ delegate {
+ parser.AssertStateIs<XmlDocTypeState> ();
+ parser.AssertNodeDepth (3);
+ parser.AssertPath ("//doc/<!DOCTYPE>");
+ },
+ delegate {
+ parser.AssertStateIs<XmlCDataState> ();
+ parser.AssertNodeDepth (3);
+ parser.AssertPath ("//doc/<![CDATA[ ]]>");
+ },
+ delegate {
+ parser.AssertStateIs<XmlCommentState> ();
+ parser.AssertNodeDepth (3);
+ parser.AssertPath ("//doc/<!-- -->");
+ }
+ );
+ parser.AssertEmpty ();
+ parser.AssertErrorCount (0);
+ }
+
+ [Test]
+ public void DocTypeCapture ()
+ {
+ var parser = new TestXmlParser (CreateRootState (), true);
+ parser.Parse (@"
+ <!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN""
+""DTD/xhtml1-strict.dtd""
+[
+<!-- foo -->
+<!bar #baz>
+]>
+<doc><foo/></doc>");
+ parser.AssertEmpty ();
+ XDocument doc = (XDocument)parser.Nodes.Peek ();
+ Assert.IsTrue (doc.FirstChild is XDocType);
+ XDocType dt = (XDocType) doc.FirstChild;
+ Assert.AreEqual ("html", dt.RootElement.FullName);
+ Assert.AreEqual ("-//W3C//DTD XHTML 1.0 Strict//EN", dt.PublicFpi);
+ Assert.AreEqual ("DTD/xhtml1-strict.dtd", dt.Uri);
+ Assert.AreEqual (dt.InternalDeclarationRegion.Begin.Line, 4);
+ Assert.AreEqual (dt.InternalDeclarationRegion.End.Line, 7);
+ parser.AssertNoErrors ();
+ }
+
+ [Test]
+ public void NamespacedAttributes ()
+ {
+ var parser = new TestXmlParser (CreateRootState (), true);
+ parser.Parse (@"<tag foo:bar='1' foo:bar:baz='2' foo='3' />");
+ parser.AssertEmpty ();
+ var doc = (XDocument) parser.Nodes.Peek ();
+ var el = (XElement) doc.FirstChild;
+ Assert.AreEqual (3, el.Attributes.Count ());
+ Assert.AreEqual ("foo", el.Attributes.ElementAt (0).Name.Prefix);
+ Assert.AreEqual ("bar", el.Attributes.ElementAt (0).Name.Name);
+ Assert.AreEqual ("foo", el.Attributes.ElementAt (1).Name.Prefix);
+ Assert.AreEqual ("bar:baz", el.Attributes.ElementAt (1).Name.Name);
+ Assert.IsNull (el.Attributes.ElementAt (2).Name.Prefix);
+ Assert.AreEqual ("foo", el.Attributes.ElementAt (2).Name.Name);
+ Assert.AreEqual (3, el.Attributes.Count ());
+ parser.AssertErrorCount (1);
+ Assert.AreEqual (1, parser.Errors [0].Region.BeginLine);
+ Assert.AreEqual (26, parser.Errors [0].Region.BeginColumn);
+ }
+
+ [Test]
+ public void SimpleTree ()
+ {
+ var parser = new TestXmlParser (CreateRootState (), true);
+ parser.Parse (@"
+<doc>
+ <a>
+ <b>
+ <c/>
+ <d>
+ <e/>
+ </d>
+ <f>
+ <g/>
+ </f>
+ </b>
+ </a>
+</doc>");
+ parser.AssertErrorCount (0);
+
+ var doc = ((XDocument)parser.Nodes.Peek ()).RootElement;
+ Assert.NotNull (doc);
+ Assert.AreEqual ("doc", doc.Name.Name);
+ Assert.True (doc.IsEnded);
+
+ var a = (XElement)doc.FirstChild;
+ Assert.NotNull (a);
+ Assert.AreEqual ("a", a.Name.Name);
+ Assert.True (a.IsEnded);
+ Assert.False (a.IsSelfClosing);
+ Assert.IsNull (a.NextSibling);
+
+ var b = (XElement)a.FirstChild;
+ Assert.NotNull (b);
+ Assert.AreEqual ("b", b.Name.Name);
+ Assert.True (b.IsEnded);
+ Assert.False (b.IsSelfClosing);
+ Assert.IsNull (b.NextSibling);
+
+ var c = (XElement) b.FirstChild;
+ Assert.NotNull (c);
+ Assert.AreEqual ("c", c.Name.Name);
+ Assert.True (c.IsEnded);
+ Assert.True (c.IsSelfClosing);
+ Assert.IsNull (c.FirstChild);
+
+ var d = (XElement) c.NextSibling;
+ Assert.True (d.IsEnded);
+ Assert.False (d.IsSelfClosing);
+ Assert.AreEqual ("d", d.Name.Name);
+
+ var e = (XElement) d.FirstChild;
+ Assert.NotNull (e);
+ Assert.True (e.IsEnded);
+ Assert.True (e.IsSelfClosing);
+ Assert.AreEqual ("e", e.Name.Name);
+
+ var f = (XElement) d.NextSibling;
+ Assert.AreEqual (f, b.LastChild);
+ Assert.True (f.IsEnded);
+ Assert.False (f.IsSelfClosing);
+ Assert.AreEqual ("f", f.Name.Name);
+
+ var g = (XElement) f.FirstChild;
+ Assert.NotNull (g);
+ Assert.True (g.IsEnded);
+ Assert.True (g.IsSelfClosing);
+ Assert.AreEqual ("g", g.Name.Name);
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/QualifiedNameTestFixture.cs b/main/src/addins/Xml/Tests/Parser/QualifiedNameTestFixture.cs
new file mode 100644
index 0000000000..4960bc7ee8
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/QualifiedNameTestFixture.cs
@@ -0,0 +1,68 @@
+
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using System.Xml;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ /// <summary>
+ /// Tests the comparison of <see cref="QualifiedName"/> items.
+ /// </summary>
+ [TestFixture]
+ public class QualifiedNameTestFixture
+ {
+ [Test]
+ public void EqualsTest1()
+ {
+ QualifiedName name1 = new QualifiedName("foo", "http://foo.com");
+ QualifiedName name2 = new QualifiedName("foo", "http://foo.com");
+
+ Assert.AreEqual(name1, name2, "Should be the same.");
+ }
+
+ [Test]
+ public void EqualsTest2()
+ {
+ QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
+ QualifiedName name2 = new QualifiedName("foo", "http://foo.com", "f");
+
+ Assert.AreEqual(name1, name2, "Should be the same.");
+ }
+
+ [Test]
+ public void EqualsTest3()
+ {
+ QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
+ QualifiedName name2 = new QualifiedName("foo", "http://foo.com", "ggg");
+
+ Assert.IsTrue(name1 == name2, "Should be the same.");
+ }
+
+ [Test]
+ public void NotEqualsTest1()
+ {
+ QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
+ QualifiedName name2 = new QualifiedName("foo", "http://bar.com", "f");
+
+ Assert.IsFalse(name1 == name2, "Should not be the same.");
+ }
+
+ [Test]
+ public void NotEqualsTest2()
+ {
+ QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
+ QualifiedName name2 = null;
+
+ Assert.IsFalse(name1 == name2, "Should not be the same.");
+ }
+
+ [Test]
+ public void HashCodeTest()
+ {
+ QualifiedName name1 = new QualifiedName("foo", "http://foo.com", "f");
+ XmlQualifiedName xmlQualifiedName = new XmlQualifiedName("foo", "http://foo.com");
+
+ Assert.AreEqual(name1.GetHashCode(), xmlQualifiedName.GetHashCode());
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Parser/TestXmlParser.cs b/main/src/addins/Xml/Tests/Parser/TestXmlParser.cs
new file mode 100644
index 0000000000..74afe274ff
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Parser/TestXmlParser.cs
@@ -0,0 +1,237 @@
+//
+// TestParser.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using ICSharpCode.NRefactory;
+using ICSharpCode.NRefactory.TypeSystem;
+using MonoDevelop.Xml.Completion;
+using MonoDevelop.Xml.Dom;
+using MonoDevelop.Xml.Parser;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Parser
+{
+ public class TestXmlParser : XmlParser
+ {
+ readonly List<Error> errors = new List<Error> ();
+
+ public TestXmlParser (XmlRootState rootState) : this (rootState, false)
+ {
+ }
+
+ public TestXmlParser (XmlRootState rootState, bool buildTree) : base (rootState, buildTree)
+ {
+ ErrorLogged += errors.Add;
+ }
+
+ public new List<Error> Errors { get { return errors; } }
+
+ public static void AssertState (string doc, params Action<TestXmlParser>[] asserts)
+ {
+ var p = new TestXmlParser (new XmlRootState ());
+ p.Parse (doc, Array.ConvertAll (asserts, a => (Action)(() => a (p))));
+ }
+
+ public static void AssertTree (string txt, params Action<XNode>[] asserts)
+ {
+ var p = new TestXmlParser (new XmlRootState (), true);
+
+ //parse and capture line/col info
+ var list = new List<TextLocation> ();
+ p.Parse (txt, Array.ConvertAll (asserts, a => (Action)(() => list.Add (p.Location))));
+
+ var doc = (XDocument) p.Nodes.Last ();
+
+ for (int i = 0; i < asserts.Length; i++) {
+ asserts [i] (doc.AllDescendentNodes.FirstOrDefault (n => n.Region.IsInside (list[i])));
+ }
+ }
+
+ public void Parse (string doc, params Action[] asserts)
+ {
+ Parse (doc, '$', asserts);
+ }
+
+ public void Parse (string doc, char trigger, params Action[] asserts)
+ {
+ Assert.AreEqual (Position, 0);
+ int assertNo = 0;
+ for (int i = 0; i < doc.Length; i++) {
+ char c = doc[i];
+ if (c == trigger) {
+ if (i + 1 < doc.Length && doc [i + 1] == trigger) {
+ Push (c);
+ i++;
+ continue;
+ }
+ asserts[assertNo] ();
+ assertNo++;
+ } else {
+ Push (c);
+ }
+ }
+ Assert.AreEqual (asserts.Length, assertNo);
+ }
+
+ public string GetPath ()
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+ foreach (XObject obj in Nodes) {
+ if (obj is XDocument) {
+ sb.Insert (0, '/');
+ break;
+ }
+ sb.Insert (0, obj.FriendlyPathRepresentation);
+ sb.Insert (0, '/');
+ }
+ return sb.ToString ();
+ }
+
+ public void AssertPath (string path)
+ {
+ Assert.AreEqual (path, GetPath ());
+ }
+
+ public Action PathAssertion (string path)
+ {
+ return delegate {
+ Assert.AreEqual (path, GetPath ());
+ };
+ }
+
+ public void AssertStateIs<T> () where T : XmlParserState
+ {
+ Assert.IsTrue (CurrentState is T, "Current state is {0} not {1}", CurrentState.GetType ().Name, typeof (T).Name);
+ }
+
+ public void AssertStateIsNot<T> () where T : XmlParserState
+ {
+ Assert.IsFalse (CurrentState is T, "Current state is {0}", typeof (T).Name);
+ }
+
+ public void AssertNodeDepth (int depth)
+ {
+ Assert.AreEqual (depth, Nodes.Count, "Node depth is {0} not {1}", Nodes.Count, depth);
+ }
+
+ public void AssertNodeIs<T> (int down)
+ {
+ XObject n = Nodes.Peek (down);
+ AssertNodeDepth (down);
+ Assert.IsTrue (n is T, "Node down {0} is {1}, not {2}", down, n.GetType ().Name, typeof (T).Name);
+ }
+
+ public void AssertNodeIs<T> ()
+ {
+ XObject n = Nodes.Peek ();
+ Assert.IsTrue (n is T, "Node is {0}, not {1}", n.GetType ().Name, typeof (T).Name);
+ }
+
+ public void AssertErrorCount (int count)
+ {
+ AssertErrorCount (count, x => true);
+ }
+
+ public void AssertErrorCount (int count, Func<Error,bool> filter)
+ {
+ string msg = null;
+ int actualCount = errors.Count (filter);
+ if (actualCount != count) {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+ foreach (Error err in errors)
+ if (filter (err))
+ sb.AppendFormat ("{0}@{1}: {2}\n", err.ErrorType, err.Region, err.Message);
+ msg = sb.ToString ();
+ }
+ Assert.AreEqual (count, actualCount, msg);
+ }
+
+ public void AssertAttributes (params string[] nameValuePairs)
+ {
+ AssertNodeIs<IAttributedXObject> ();
+ IAttributedXObject obj = (IAttributedXObject) Nodes.Peek ();
+ AssertAttributes (obj, nameValuePairs);
+ }
+
+ public void AssertAttributes (IAttributedXObject obj, params string[] nameValuePairs)
+ {
+ if ((nameValuePairs.Length % 2) != 0)
+ throw new ArgumentException ("nameValuePairs");
+
+ int i = 0;
+ foreach (XAttribute att in obj.Attributes) {
+ Assert.IsTrue (i < nameValuePairs.Length);
+ Assert.AreEqual (nameValuePairs[i], att.Name.FullName);
+ Assert.AreEqual (nameValuePairs[i + 1], att.Value);
+ i += 2;
+ }
+ Assert.AreEqual (nameValuePairs.Length, i);
+ }
+
+ public void AssertNoErrors ()
+ {
+ AssertErrorCount (0);
+ }
+
+ public void AssertEmpty ()
+ {
+ AssertNodeDepth (1);
+ AssertNodeIs<XDocument> ();
+ }
+
+ public void AssertName (string name)
+ {
+ AssertName (0, name);
+ }
+
+ public void AssertName (int down, string name)
+ {
+ XObject node = Nodes.Peek (down);
+ Assert.IsTrue (node is INamedXObject);
+ Assert.AreEqual (name, ((INamedXObject)node).Name.FullName);
+ }
+
+ public static void AssertPath (XNode node, params QualifiedName[] qualifiedNames)
+ {
+ var path = new List<XNode> ();
+ while (node != null) {
+ path.Add (node);
+ node = node.Parent as XNode;
+ }
+ path.Reverse ();
+
+ Assert.AreEqual (
+ new XmlElementPath (qualifiedNames),
+ XmlElementPath.Resolve (path.ToArray ())
+ );
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Paths/NoElementPathTestFixture.cs b/main/src/addins/Xml/Tests/Paths/NoElementPathTestFixture.cs
new file mode 100644
index 0000000000..ff95d40e0c
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Paths/NoElementPathTestFixture.cs
@@ -0,0 +1,49 @@
+
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Paths
+{
+ [TestFixture]
+ public class NoElementPathTestFixture
+ {
+ XmlElementPath path;
+
+ [TestFixtureSetUp]
+ public void FixtureSetUp()
+ {
+ path = new XmlElementPath();
+ }
+
+ [Test]
+ public void HasNoItems()
+ {
+ Assert.AreEqual(0, path.Elements.Count,
+ "Should not be any elements.");
+ }
+
+ [Test]
+ public void Equality()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+
+ Assert.IsTrue(newPath.Equals(path), "Should be equal.");
+ }
+
+ [Test]
+ public void NotEqual()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+ newPath.Elements.Add(new QualifiedName("Foo", "bar"));
+
+ Assert.IsFalse(newPath.Equals(path), "Should not be equal.");
+ }
+
+ [Test]
+ public void Compact()
+ {
+ path.Compact();
+ Equality();
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Paths/SingleElementPathTestFixture.cs b/main/src/addins/Xml/Tests/Paths/SingleElementPathTestFixture.cs
new file mode 100644
index 0000000000..6087294c90
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Paths/SingleElementPathTestFixture.cs
@@ -0,0 +1,52 @@
+
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Paths
+{
+ [TestFixture]
+ public class SingleElementPathTestFixture
+ {
+ XmlElementPath path;
+ QualifiedName qualifiedName;
+
+ [SetUp]
+ public void Init()
+ {
+ path = new XmlElementPath();
+ qualifiedName = new QualifiedName("foo", "http://foo");
+ path.Elements.Add(qualifiedName);
+ }
+
+ [Test]
+ public void HasOneItem()
+ {
+ Assert.AreEqual(1, path.Elements.Count, "Should have 1 element.");
+ }
+
+ [Test]
+ public void Equality()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+ newPath.Elements.Add(new QualifiedName("foo", "http://foo"));
+
+ Assert.IsTrue(newPath.Equals(path), "Should be equal.");
+ }
+
+ [Test]
+ public void NotEqual()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+ newPath.Elements.Add(new QualifiedName("Foo", "bar"));
+
+ Assert.IsFalse(newPath.Equals(path), "Should not be equal.");
+ }
+
+ [Test]
+ public void Compact()
+ {
+ path.Compact();
+ Equality();
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Paths/TwoElementPathTestFixture.cs b/main/src/addins/Xml/Tests/Paths/TwoElementPathTestFixture.cs
new file mode 100644
index 0000000000..95c936f410
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Paths/TwoElementPathTestFixture.cs
@@ -0,0 +1,62 @@
+
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Paths
+{
+ [TestFixture]
+ public class TwoElementPathTestFixture
+ {
+ XmlElementPath path;
+ QualifiedName firstQualifiedName;
+ QualifiedName secondQualifiedName;
+
+ [SetUp]
+ public void Init()
+ {
+ path = new XmlElementPath();
+ firstQualifiedName = new QualifiedName("foo", "http://foo", "f");
+ path.Elements.Add(firstQualifiedName);
+
+ secondQualifiedName = new QualifiedName("bar", "http://bar", "b");
+ path.Elements.Add(secondQualifiedName);
+ }
+
+ [Test]
+ public void Equality()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+ newPath.Elements.Add(new QualifiedName("foo", "http://foo", "f"));
+ newPath.Elements.Add(new QualifiedName("bar", "http://bar", "b"));
+
+ Assert.IsTrue(newPath.Equals(path), "Should be equal.");
+ }
+
+ [Test]
+ public void NotEqual()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+ newPath.Elements.Add(new QualifiedName("aaa", "a", "a"));
+ newPath.Elements.Add(new QualifiedName("bbb", "b", "b"));
+
+ Assert.IsFalse(newPath.Equals(path), "Should not be equal.");
+ }
+
+ [Test]
+ public void CompactedPathItemCount()
+ {
+ path.Compact();
+ Assert.AreEqual(1, path.Elements.Count, "Should only be one item.");
+ }
+
+ [Test]
+ public void CompactPathItem()
+ {
+ XmlElementPath newPath = new XmlElementPath();
+ newPath.Elements.Add(new QualifiedName("bar", "http://bar", "b"));
+
+ path.Compact();
+ Assert.IsTrue(newPath.Equals(path), "Should be equal.");
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Resources/XMLSchema.xsd b/main/src/addins/Xml/Tests/Resources/XMLSchema.xsd
new file mode 100644
index 0000000000..5acc282d5e
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Resources/XMLSchema.xsd
@@ -0,0 +1,2534 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+<!-- The prose copy in the structures REC is the normative -->
+<!-- version (which shouldn't differ from this one except for -->
+<!-- this comment and entity expansions, but just in case -->
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" [
+
+<!-- provide ID type information even for parsers which only read the
+ internal subset -->
+<!ATTLIST xs:schema id ID #IMPLIED>
+<!ATTLIST xs:complexType id ID #IMPLIED>
+<!ATTLIST xs:complexContent id ID #IMPLIED>
+<!ATTLIST xs:simpleContent id ID #IMPLIED>
+<!ATTLIST xs:extension id ID #IMPLIED>
+<!ATTLIST xs:element id ID #IMPLIED>
+<!ATTLIST xs:group id ID #IMPLIED>
+<!ATTLIST xs:all id ID #IMPLIED>
+<!ATTLIST xs:choice id ID #IMPLIED>
+<!ATTLIST xs:sequence id ID #IMPLIED>
+<!ATTLIST xs:any id ID #IMPLIED>
+<!ATTLIST xs:anyAttribute id ID #IMPLIED>
+<!ATTLIST xs:attribute id ID #IMPLIED>
+<!ATTLIST xs:attributeGroup id ID #IMPLIED>
+<!ATTLIST xs:unique id ID #IMPLIED>
+<!ATTLIST xs:key id ID #IMPLIED>
+<!ATTLIST xs:keyref id ID #IMPLIED>
+<!ATTLIST xs:selector id ID #IMPLIED>
+<!ATTLIST xs:field id ID #IMPLIED>
+<!ATTLIST xs:include id ID #IMPLIED>
+<!ATTLIST xs:import id ID #IMPLIED>
+<!ATTLIST xs:redefine id ID #IMPLIED>
+<!ATTLIST xs:notation id ID #IMPLIED>
+<!--
+ keep this schema XML1.0 DTD valid
+ -->
+ <!ENTITY % schemaAttrs 'xmlns:hfp CDATA #IMPLIED'>
+
+ <!ELEMENT hfp:hasFacet EMPTY>
+ <!ATTLIST hfp:hasFacet
+ name NMTOKEN #REQUIRED>
+
+ <!ELEMENT hfp:hasProperty EMPTY>
+ <!ATTLIST hfp:hasProperty
+ name NMTOKEN #REQUIRED
+ value CDATA #REQUIRED>
+<!--
+ Make sure that processors that do not read the external
+ subset will know about the various IDs we declare
+ -->
+ <!ATTLIST xs:simpleType id ID #IMPLIED>
+ <!ATTLIST xs:maxExclusive id ID #IMPLIED>
+ <!ATTLIST xs:minExclusive id ID #IMPLIED>
+ <!ATTLIST xs:maxInclusive id ID #IMPLIED>
+ <!ATTLIST xs:minInclusive id ID #IMPLIED>
+ <!ATTLIST xs:totalDigits id ID #IMPLIED>
+ <!ATTLIST xs:fractionDigits id ID #IMPLIED>
+ <!ATTLIST xs:length id ID #IMPLIED>
+ <!ATTLIST xs:minLength id ID #IMPLIED>
+ <!ATTLIST xs:maxLength id ID #IMPLIED>
+ <!ATTLIST xs:enumeration id ID #IMPLIED>
+ <!ATTLIST xs:pattern id ID #IMPLIED>
+ <!ATTLIST xs:appinfo id ID #IMPLIED>
+ <!ATTLIST xs:documentation id ID #IMPLIED>
+ <!ATTLIST xs:list id ID #IMPLIED>
+ <!ATTLIST xs:union id ID #IMPLIED>
+ ]>
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+ <xs:documentation>
+ Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within &lt;documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ The simpleType element and all of its members are defined
+ towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+ <xs:annotation>
+ <xs:documentation>
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+ </xs:documentation>
+ </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by all types which allow annotation
+ other than &lt;schema&gt; itself
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:group ref="xs:redefinable"/>
+ <xs:element ref="xs:element"/>
+ <xs:element ref="xs:attribute"/>
+ <xs:element ref="xs:notation"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="redefinable">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which can self-redefine (see &lt;redefine> below).</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:simpleType"/>
+ <xs:element ref="xs:complexType"/>
+ <xs:element ref="xs:group"/>
+ <xs:element ref="xs:attributeGroup"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="qualified"/>
+ <xs:enumeration value="unqualified"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:reducedDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="typeDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="fullDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:typeDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:include"/>
+ <xs:element ref="xs:import"/>
+ <xs:element ref="xs:redefine"/>
+ <xs:element ref="xs:annotation"/>
+ </xs:choice>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="xs:schemaTop"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="version" type="xs:token"/>
+ <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
+ <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+ <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:key name="element">
+ <xs:selector xpath="xs:element"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attribute">
+ <xs:selector xpath="xs:attribute"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="type">
+ <xs:selector xpath="xs:complexType|xs:simpleType"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="group">
+ <xs:selector xpath="xs:group"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attributeGroup">
+ <xs:selector xpath="xs:attributeGroup"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="notation">
+ <xs:selector xpath="xs:notation"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="identityConstraint">
+ <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+ <xs:annotation><xs:documentation>
+ for maxOccurs</xs:documentation></xs:annotation>
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+ <xs:annotation><xs:documentation>
+ for all particles</xs:documentation></xs:annotation>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+ <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+ <xs:annotation><xs:documentation>
+ for element, group and attributeGroup,
+ which both define and reference</xs:documentation></xs:annotation>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+ <xs:annotation>
+ <xs:documentation>
+ 'complexType' uses this</xs:documentation></xs:annotation>
+ <xs:choice>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:group>
+
+
+
+ <xs:group name="nestedParticle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="particle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="attribute">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="use" use="optional" default="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="prohibited"/>
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelAttribute">
+ <xs:complexContent>
+ <xs:restriction base="xs:attribute">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="use" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="attribute" type="xs:attribute"/>
+ <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ </xs:choice>
+ <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+ <xs:choice>
+ <xs:element ref="xs:simpleContent"/>
+ <xs:element ref="xs:complexContent"/>
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ This branch is short for
+ &lt;complexContent>
+ &lt;restriction base="xs:anyType">
+ ...
+ &lt;/restriction>
+ &lt;/complexContent></xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:complexTypeModel"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Will be restricted to required or forbidden</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:derivationSet"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="block" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="restrictionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:group ref="xs:typeDefParticle"/>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:complexRestrictionType"/>
+ <xs:element name="extension" type="xs:extensionType"/>
+ </xs:choice>
+ <xs:attribute name="mixed" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Overrides any setting on complexType parent.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:extensionType">
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ No typeDefParticle group reference</xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+ <xs:element name="extension" type="xs:simpleExtensionType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+ </xs:annotation>
+ </xs:element>
+
+
+ <xs:simpleType name="blockSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="substitution"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.</xs:documentation>
+ </xs:annotation>
+
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="substitutionGroup" type="xs:QName"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:blockSet"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="substitutionGroup" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ group type for explicit groups, named top-level groups and
+ group references</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="realGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="all">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:all">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+ <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+ <xs:annotation>
+ <xs:documentation>
+ group type for the three kinds of group</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExplicitGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="allModel">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint</xs:documentation>
+ </xs:annotation>
+ <xs:element name="element" type="xs:narrowMaxMin"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+
+ <xs:complexType name="narrowMaxMin">
+ <xs:annotation>
+ <xs:documentation>restricted max/min</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:localElement">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="all">
+ <xs:annotation>
+ <xs:documentation>
+ Only elements allowed inside</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+ <xs:attribute name="processContents" use="optional" default="strict">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="lax"/>
+ <xs:enumeration value="strict"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'</xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively</xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ <xs:enumeration value="##other"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:attrDecls"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedAttributeGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:annotation"/>
+ <xs:group ref="xs:redefinable"/>
+ </xs:choice>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:anyURI"/>
+ <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+ </xs:documentation>
+ </xs:annotation>
+ <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element ref="xs:selector"/>
+ <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+ <xs:annotation>
+ <xs:documentation>The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:unique"/>
+ <xs:element ref="xs:key"/>
+ <xs:element ref="xs:keyref"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:keybase">
+ <xs:attribute name="refer" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="public" type="xs:public"/>
+ <xs:attribute name="system" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ A public identifier, per ISO 8879</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:appinfo"/>
+ <xs:element ref="xs:documentation"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+
+ <xs:complexType name="anyType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+ </xs:documentation>
+
+ <xs:documentation>
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="string" id="string">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#string"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="preserve" id="string.preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="boolean" id="boolean">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="boolean.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="float" id="float">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#float"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="float.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="double" id="double">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#double"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="double.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="decimal" id="decimal">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="totalDigits"/>
+ <hfp:hasFacet name="fractionDigits"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="decimal.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="duration" id="duration">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="duration.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="dateTime.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="time" id="time">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#time"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="time.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="date" id="date">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#date"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="date.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYearMonth" id="gYearMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYearMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYear" id="gYear">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYear.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonthDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gDay" id="gDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="hexBinary" id="hexBinary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="hexBinary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="base64Binary" id="base64Binary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="base64Binary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="anyURI" id="anyURI">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="anyURI.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="QName" id="QName">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="QName.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NOTATION" id="NOTATION">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+ <xs:documentation>
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="NOTATION.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ Now the derived primitive types
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="normalizedString" id="normalizedString">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:whiteSpace value="replace"
+ id="normalizedString.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="token" id="token">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#token"/>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="language" id="language">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#language"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern
+ value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
+ id="language.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.ietf.org/rfc/rfc3066.txt">
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREFS" id="IDREFS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:IDREF"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="IDREFS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITIES" id="ENTITIES">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:ENTITY"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="ENTITIES.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\c+" id="NMTOKEN.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+ pattern matches production 7 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:NMTOKEN"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="NMTOKENS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Name" id="Name">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\i\c*" id="Name.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Name">
+ pattern matches production 5 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NCName" id="NCName">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:Name">
+ <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+ pattern matches production 4 from the Namespaces in XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ID" id="ID">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREF" id="IDREF">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITY" id="ENTITY">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="integer" id="integer">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+ </xs:annotation>
+ <xs:restriction base="xs:decimal">
+ <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+ <xs:pattern value="[\-+]?[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="negativeInteger" id="negativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonPositiveInteger">
+ <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="long" id="long">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#long"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+ <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="int" id="int">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#int"/>
+ </xs:annotation>
+ <xs:restriction base="xs:long">
+ <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+ <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="short" id="short">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#short"/>
+ </xs:annotation>
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="-32768" id="short.minInclusive"/>
+ <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="byte" id="byte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="-128" id="byte.minInclusive"/>
+ <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedLong" id="unsignedLong">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:maxInclusive value="18446744073709551615"
+ id="unsignedLong.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedInt" id="unsignedInt">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedLong">
+ <xs:maxInclusive value="4294967295"
+ id="unsignedInt.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedShort" id="unsignedShort">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedInt">
+ <xs:maxInclusive value="65535"
+ id="unsignedShort.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedByte" id="unsignedByte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger" id="positiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="substitution"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+ <xs:choice>
+ <xs:element ref="xs:restriction"/>
+ <xs:element ref="xs:list"/>
+ <xs:element ref="xs:union"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {restriction, union, list}
+ </xs:documentation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="simpleType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleDerivation"/>
+ <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Can be restricted to required or forbidden
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required"
+ type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Required at the top level
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited">
+ <xs:annotation>
+ <xs:documentation>
+ Forbidden when nested
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="facets">
+ <xs:annotation>
+ <xs:documentation>
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:minExclusive"/>
+ <xs:element ref="xs:minInclusive"/>
+ <xs:element ref="xs:maxExclusive"/>
+ <xs:element ref="xs:maxInclusive"/>
+ <xs:element ref="xs:totalDigits"/>
+ <xs:element ref="xs:fractionDigits"/>
+ <xs:element ref="xs:length"/>
+ <xs:element ref="xs:minLength"/>
+ <xs:element ref="xs:maxLength"/>
+ <xs:element ref="xs:enumeration"/>
+ <xs:element ref="xs:whiteSpace"/>
+ <xs:element ref="xs:pattern"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="simpleRestrictionModel">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="restriction" id="restriction">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ <xs:attribute name="base" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="list" id="list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-list">
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="union" id="union">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-union">
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="memberTypes" use="optional">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="facet">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="value" use="required"/>
+ <xs:attribute name="fixed" type="xs:boolean" use="optional"
+ default="false"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="noFixedFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="fixed" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="numFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="totalDigits" id="totalDigits">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:numFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="length" id="length" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minLength" id="minLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="whiteSpace" id="whiteSpace">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="preserve"/>
+ <xs:enumeration value="replace"/>
+ <xs:enumeration value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="pattern" id="pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:noFixedFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/main/src/addins/Xml/Tests/Resources/xhtml1-strict-modified.xsd b/main/src/addins/Xml/Tests/Resources/xhtml1-strict-modified.xsd
new file mode 100644
index 0000000000..1d25a8e7ef
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Resources/xhtml1-strict-modified.xsd
@@ -0,0 +1,2210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema version="1.0" xml:lang="en"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ elementFormDefault="qualified">
+
+ <xs:annotation>
+ <xs:documentation>
+ XHTML 1.0 (Second Edition) Strict in XML Schema
+
+ This is the same as HTML 4 Strict except for
+ changes due to the differences between XML and SGML.
+
+ Namespace = http://www.w3.org/1999/xhtml
+
+ For further information, see: http://www.w3.org/TR/xhtml1
+
+ Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+ All Rights Reserved.
+
+ The DTD version is identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+
+ $Id: xhtml1-strict.xsd,v 1.2 2002/08/28 08:05:44 mimasa Exp $
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================ Character mnemonic entities =========================
+
+ XHTML entity sets are identified by the PUBLIC and SYSTEM identifiers:
+
+ PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"
+
+ PUBLIC "-//W3C//ENTITIES Special for XHTML//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"
+
+ PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN"
+ SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent"
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================== Imported Names ====================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="ContentType">
+ <xs:annotation>
+ <xs:documentation>
+ media type, as per [RFC2045]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ContentTypes">
+ <xs:annotation>
+ <xs:documentation>
+ comma-separated list of media types, as per [RFC2045]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Charset">
+ <xs:annotation>
+ <xs:documentation>
+ a character encoding, as per [RFC2045]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Charsets">
+ <xs:annotation>
+ <xs:documentation>
+ a space separated list of character encodings, as per [RFC2045]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="LanguageCode">
+ <xs:annotation>
+ <xs:documentation>
+ a language code, as per [RFC3066]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:language"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Character">
+ <xs:annotation>
+ <xs:documentation>
+ a single character, as per section 2.2 of [XML]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:length value="1" fixed="true"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Number">
+ <xs:annotation>
+ <xs:documentation>
+ one or more digits
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:pattern value="[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="tabindexNumber">
+ <xs:annotation>
+ <xs:documentation>
+ tabindex attribute specifies the position of the current element
+ in the tabbing order for the current document. This value must be
+ a number between 0 and 32767. User agents should ignore leading zeros.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="Number">
+ <xs:minInclusive value="0"/>
+ <xs:maxInclusive value="32767"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="LinkTypes">
+ <xs:annotation>
+ <xs:documentation>
+ space-separated list of link types
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKENS"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="MediaDesc">
+ <xs:annotation>
+ <xs:documentation>
+ single or comma-separated list of media descriptors
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[^,]+(,\s*[^,]+)*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="URI">
+ <xs:annotation>
+ <xs:documentation>
+ a Uniform Resource Identifier, see [RFC2396]
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:anyURI"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="UriList">
+ <xs:annotation>
+ <xs:documentation>
+ a space separated list of Uniform Resource Identifiers
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Datetime">
+ <xs:annotation>
+ <xs:documentation>
+ date and time information. ISO date format
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:dateTime"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Script">
+ <xs:annotation>
+ <xs:documentation>
+ script expression
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="StyleSheet">
+ <xs:annotation>
+ <xs:documentation>
+ style sheet data
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Text">
+ <xs:annotation>
+ <xs:documentation>
+ used for titles etc.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="Length">
+ <xs:annotation>
+ <xs:documentation>
+ nn for pixels or nn% for percentage length
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[-+]?(\d+|\d+(\.\d+)?%)"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="MultiLength">
+ <xs:annotation>
+ <xs:documentation>
+ pixel, percentage, or relative
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[-+]?(\d+|\d+(\.\d+)?%)|[1-9]?(\d+)?\*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Pixels">
+ <xs:annotation>
+ <xs:documentation>
+ integer representing length in pixels
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger"/>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ these are used for image maps
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="Shape">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="rect"/>
+ <xs:enumeration value="circle"/>
+ <xs:enumeration value="poly"/>
+ <xs:enumeration value="default"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Coords">
+ <xs:annotation>
+ <xs:documentation>
+ comma separated list of lengths
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[-+]?(\d+|\d+(\.\d+)?%)(,\s*[-+]?(\d+|\d+(\.\d+)?%))*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Generic Attributes ===============================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attributeGroup name="coreattrs">
+ <xs:annotation>
+ <xs:documentation>
+ core attributes common to most elements
+ id document-wide unique id
+ class space separated list of classes
+ style associated style info
+ title advisory title/amplification
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="class" type="xs:NMTOKENS"/>
+ <xs:attribute name="style" type="StyleSheet"/>
+ <xs:attribute name="title" type="Text"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="i18n">
+ <xs:annotation>
+ <xs:documentation>
+ internationalization attributes
+ lang language code (backwards compatible)
+ xml:lang language code (as per XML 1.0 spec)
+ dir direction for weak/neutral text
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="lang" type="LanguageCode"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="dir">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="ltr"/>
+ <xs:enumeration value="rtl"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="events">
+ <xs:annotation>
+ <xs:documentation>
+ attributes for common UI events
+ onclick a pointer button was clicked
+ ondblclick a pointer button was double clicked
+ onmousedown a pointer button was pressed down
+ onmouseup a pointer button was released
+ onmousemove a pointer was moved onto the element
+ onmouseout a pointer was moved away from the element
+ onkeypress a key was pressed and released
+ onkeydown a key was pressed down
+ onkeyup a key was released
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="onclick" type="Script"/>
+ <xs:attribute name="ondblclick" type="Script"/>
+ <xs:attribute name="onmousedown" type="Script"/>
+ <xs:attribute name="onmouseup" type="Script"/>
+ <xs:attribute name="onmouseover" type="Script"/>
+ <xs:attribute name="onmousemove" type="Script"/>
+ <xs:attribute name="onmouseout" type="Script"/>
+ <xs:attribute name="onkeypress" type="Script"/>
+ <xs:attribute name="onkeydown" type="Script"/>
+ <xs:attribute name="onkeyup" type="Script"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="focus">
+ <xs:annotation>
+ <xs:documentation>
+ attributes for elements that can get the focus
+ accesskey accessibility key character
+ tabindex position in tabbing order
+ onfocus the element got the focus
+ onblur the element lost the focus
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="accesskey" type="Character"/>
+ <xs:attribute name="tabindex" type="tabindexNumber"/>
+ <xs:attribute name="onfocus" type="Script"/>
+ <xs:attribute name="onblur" type="Script"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="attrs">
+ <xs:attributeGroup ref="coreattrs"/>
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attributeGroup ref="events"/>
+ </xs:attributeGroup>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Text Elements ====================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:group name="special.pre">
+ <xs:choice>
+ <xs:element ref="br"/>
+ <xs:element ref="span"/>
+ <xs:element ref="bdo"/>
+ <xs:element ref="map"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="special">
+ <xs:choice>
+ <xs:group ref="special.pre"/>
+ <xs:element ref="object"/>
+ <xs:element ref="img"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="fontstyle">
+ <xs:choice>
+ <xs:element ref="tt"/>
+ <xs:element ref="i"/>
+ <xs:element ref="b"/>
+ <xs:element ref="big"/>
+ <xs:element ref="small"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="phrase">
+ <xs:choice>
+ <xs:element ref="em"/>
+ <xs:element ref="strong"/>
+ <xs:element ref="dfn"/>
+ <xs:element ref="code"/>
+ <xs:element ref="q"/>
+ <xs:element ref="samp"/>
+ <xs:element ref="kbd"/>
+ <xs:element ref="var"/>
+ <xs:element ref="cite"/>
+ <xs:element ref="abbr"/>
+ <xs:element ref="acronym"/>
+ <xs:element ref="sub"/>
+ <xs:element ref="sup"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="inline.forms">
+ <xs:choice>
+ <xs:element ref="input"/>
+ <xs:element ref="select"/>
+ <xs:element ref="textarea"/>
+ <xs:element ref="label"/>
+ <xs:element ref="button"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="misc.inline">
+ <xs:choice>
+ <xs:element ref="ins"/>
+ <xs:element ref="del"/>
+ <xs:element ref="script"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="misc">
+ <xs:annotation>
+ <xs:documentation>
+ these can only occur at block level
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="noscript"/>
+ <xs:group ref="misc.inline"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="inline">
+ <xs:choice>
+ <xs:element ref="a"/>
+ <xs:group ref="special"/>
+ <xs:group ref="fontstyle"/>
+ <xs:group ref="phrase"/>
+ <xs:group ref="inline.forms"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="Inline" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ "Inline" covers inline or "text-level" elements
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="inline"/>
+ <xs:group ref="misc.inline"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================== Block level elements ==============================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:group name="heading">
+ <xs:choice>
+ <xs:element ref="h1"/>
+ <xs:element ref="h2"/>
+ <xs:element ref="h3"/>
+ <xs:element ref="h4"/>
+ <xs:element ref="h5"/>
+ <xs:element ref="h6"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="lists">
+ <xs:choice>
+ <xs:element ref="ul"/>
+ <xs:element ref="ol"/>
+ <xs:element ref="dl"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="blocktext">
+ <xs:choice>
+ <xs:element ref="pre"/>
+ <xs:element ref="hr"/>
+ <xs:element ref="blockquote"/>
+ <xs:element ref="address"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="block">
+ <xs:choice>
+ <xs:element ref="p"/>
+ <xs:group ref="heading"/>
+ <xs:element ref="div"/>
+ <xs:group ref="lists"/>
+ <xs:group ref="blocktext"/>
+ <xs:element ref="fieldset"/>
+ <xs:element ref="table"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="Block">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="block"/>
+ <xs:element ref="form"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="Flow" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ "Flow" mixes block and inline and is used for list items etc.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="block"/>
+ <xs:element ref="form"/>
+ <xs:group ref="inline"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================== Content models for exclusions =====================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:complexType name="a.content" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ a elements use "Inline" excluding a
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="special"/>
+ <xs:group ref="fontstyle"/>
+ <xs:group ref="phrase"/>
+ <xs:group ref="inline.forms"/>
+ <xs:group ref="misc.inline"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="pre.content" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ pre uses "Inline" excluding big, small, sup or sup
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="a"/>
+ <xs:group ref="fontstyle"/>
+ <xs:group ref="phrase"/>
+ <xs:group ref="special.pre"/>
+ <xs:group ref="misc.inline"/>
+ <xs:group ref="inline.forms"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="form.content">
+ <xs:annotation>
+ <xs:documentation>
+ form uses "Block" excluding form
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="block"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="button.content" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ button uses "Flow" but excludes a, form and form controls
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="p"/>
+ <xs:group ref="heading"/>
+ <xs:element ref="div"/>
+ <xs:group ref="lists"/>
+ <xs:group ref="blocktext"/>
+ <xs:element ref="table"/>
+ <xs:group ref="special"/>
+ <xs:group ref="fontstyle"/>
+ <xs:group ref="phrase"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================ Document Structure ==================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="html">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="head"/>
+ <xs:element ref="body"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================ Document Head =======================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:group name="head.misc">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="script"/>
+ <xs:element ref="style"/>
+ <xs:element ref="meta"/>
+ <xs:element ref="link"/>
+ <xs:element ref="object"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="head">
+ <xs:annotation>
+ <xs:documentation>
+ content model is "head.misc" combined with a single
+ title and an optional base element in any order
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:group ref="head.misc"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="title"/>
+ <xs:group ref="head.misc"/>
+ <xs:sequence minOccurs="0">
+ <xs:element ref="base"/>
+ <xs:group ref="head.misc"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="base"/>
+ <xs:group ref="head.misc"/>
+ <xs:element ref="title"/>
+ <xs:group ref="head.misc"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="profile" type="URI"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="title">
+ <xs:annotation>
+ <xs:documentation>
+ The title element is not considered part of the flow of text.
+ It should be displayed, for example as the page header or
+ window title. Exactly one title is required per document.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="base">
+ <xs:annotation>
+ <xs:documentation>
+ document base URI
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="href" use="required" type="URI"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="meta">
+ <xs:annotation>
+ <xs:documentation>
+ generic metainformation
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="http-equiv"/>
+ <xs:attribute name="name"/>
+ <xs:attribute name="content" use="required"/>
+ <xs:attribute name="scheme"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="link">
+ <xs:annotation>
+ <xs:documentation>
+ Relationship values can be used in principle:
+
+ a) for document specific toolbars/menus when used
+ with the link element in document head e.g.
+ start, contents, previous, next, index, end, help
+ b) to link to a separate style sheet (rel="stylesheet")
+ c) to make a link to a script (rel="script")
+ d) by stylesheets to control how collections of
+ html nodes are rendered into printed documents
+ e) to make a link to a printable version of this document
+ e.g. a PostScript or PDF version (rel="alternate" media="print")
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="charset" type="Charset"/>
+ <xs:attribute name="href" type="URI"/>
+ <xs:attribute name="hreflang" type="LanguageCode"/>
+ <xs:attribute name="type" type="ContentType"/>
+ <xs:attribute name="rel" type="LinkTypes"/>
+ <xs:attribute name="rev" type="LinkTypes"/>
+ <xs:attribute name="media" type="MediaDesc"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="style">
+ <xs:annotation>
+ <xs:documentation>
+ style info, which may include CDATA sections
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="type" use="required" type="ContentType"/>
+ <xs:attribute name="media" type="MediaDesc"/>
+ <xs:attribute name="title" type="Text"/>
+ <xs:attribute ref="xml:space" fixed="preserve"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="script">
+ <xs:annotation>
+ <xs:documentation>
+ script statements, which may include CDATA sections
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="charset" type="Charset"/>
+ <xs:attribute name="type" use="required" type="ContentType"/>
+ <xs:attribute name="src" type="URI"/>
+ <xs:attribute name="defer">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="defer"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute ref="xml:space" fixed="preserve"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="noscript">
+ <xs:annotation>
+ <xs:documentation>
+ alternate content container for non script-based rendering
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="Block">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Document Body ====================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="body">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="Block">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="onload" type="Script"/>
+ <xs:attribute name="onunload" type="Script"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="div">
+ <xs:annotation>
+ <xs:documentation>
+ generic language/style container
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Paragraphs =======================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="p">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Headings =========================================
+
+ There are six levels of headings from h1 (the most important)
+ to h6 (the least important).
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="h1">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="h2">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="h3">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="h4">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="h5">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="h6">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Lists ============================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="ul">
+ <xs:annotation>
+ <xs:documentation>
+ Unordered list
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="li"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="ol">
+ <xs:annotation>
+ <xs:documentation>
+ Ordered (numbered) list
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="li"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="li">
+ <xs:annotation>
+ <xs:documentation>
+ list item
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ definition lists - dt for term, dd for its definition
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="dl">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="dt"/>
+ <xs:element ref="dd"/>
+ </xs:choice>
+ <xs:attributeGroup ref="attrs"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="dt">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="dd">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Address ==========================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="address">
+ <xs:annotation>
+ <xs:documentation>
+ information on author
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Horizontal Rule ==================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="hr">
+ <xs:complexType>
+ <xs:attributeGroup ref="attrs"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Preformatted Text ================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="pre">
+ <xs:annotation>
+ <xs:documentation>
+ content is "Inline" excluding "img|object|big|small|sub|sup"
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="pre.content">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute ref="xml:space" fixed="preserve"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Block-like Quotes ================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="blockquote">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="Block">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="cite" type="URI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Inserted/Deleted Text ============================
+
+ ins/del are allowed in block and inline content, but its
+ inappropriate to include block content within an ins element
+ occurring in inline content.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="ins">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="cite" type="URI"/>
+ <xs:attribute name="datetime" type="Datetime"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="del">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="cite" type="URI"/>
+ <xs:attribute name="datetime" type="Datetime"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================== The Anchor Element ================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="a">
+ <xs:annotation>
+ <xs:documentation>
+ content is "Inline" except that anchors shouldn't be nested
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="a.content">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="focus"/>
+ <xs:attribute name="charset" type="Charset"/>
+ <xs:attribute name="type" type="ContentType"/>
+ <xs:attribute name="name" type="xs:NMTOKEN"/>
+ <xs:attribute name="href" type="URI"/>
+ <xs:attribute name="hreflang" type="LanguageCode"/>
+ <xs:attribute name="rel" type="LinkTypes"/>
+ <xs:attribute name="rev" type="LinkTypes"/>
+ <xs:attribute name="shape" default="rect" type="Shape"/>
+ <xs:attribute name="coords" type="Coords"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ===================== Inline Elements ================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="span">
+ <xs:annotation>
+ <xs:documentation>
+ generic language/style container
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="bdo">
+ <xs:annotation>
+ <xs:documentation>
+ I18N BiDi over-ride
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="coreattrs"/>
+ <xs:attributeGroup ref="events"/>
+ <xs:attribute name="lang" type="LanguageCode"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="dir" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="ltr"/>
+ <xs:enumeration value="rtl"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="br">
+ <xs:annotation>
+ <xs:documentation>
+ forced line break
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="coreattrs"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="em">
+ <xs:annotation>
+ <xs:documentation>
+ emphasis
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="strong">
+ <xs:annotation>
+ <xs:documentation>
+ strong emphasis
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="dfn">
+ <xs:annotation>
+ <xs:documentation>
+ definitional
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="code">
+ <xs:annotation>
+ <xs:documentation>
+ program code
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="samp">
+ <xs:annotation>
+ <xs:documentation>
+ sample
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="kbd">
+ <xs:annotation>
+ <xs:documentation>
+ something user would type
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="var">
+ <xs:annotation>
+ <xs:documentation>
+ variable
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="cite">
+ <xs:annotation>
+ <xs:documentation>
+ citation
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="abbr">
+ <xs:annotation>
+ <xs:documentation>
+ abbreviation
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="acronym">
+ <xs:annotation>
+ <xs:documentation>
+ acronym
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="q">
+ <xs:annotation>
+ <xs:documentation>
+ inlined quote
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="cite" type="URI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="sub">
+ <xs:annotation>
+ <xs:documentation>
+ subscript
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="sup">
+ <xs:annotation>
+ <xs:documentation>
+ superscript
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="tt">
+ <xs:annotation>
+ <xs:documentation>
+ fixed pitch font
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="i">
+ <xs:annotation>
+ <xs:documentation>
+ italic font
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="b">
+ <xs:annotation>
+ <xs:documentation>
+ bold font
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="big">
+ <xs:annotation>
+ <xs:documentation>
+ bigger font
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="small">
+ <xs:annotation>
+ <xs:documentation>
+ smaller font
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ==================== Object ======================================
+
+ object is used to embed objects as part of HTML pages.
+ param elements should precede other content. Parameters
+ can also be expressed as attribute/value pairs on the
+ object element itself when brevity is desired.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="object">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="param"/>
+ <xs:group ref="block"/>
+ <xs:element ref="form"/>
+ <xs:group ref="inline"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="declare">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="declare"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="classid" type="URI"/>
+ <xs:attribute name="codebase" type="URI"/>
+ <xs:attribute name="data" type="URI"/>
+ <xs:attribute name="type" type="ContentType"/>
+ <xs:attribute name="codetype" type="ContentType"/>
+ <xs:attribute name="archive" type="UriList"/>
+ <xs:attribute name="standby" type="Text"/>
+ <xs:attribute name="height" type="Length"/>
+ <xs:attribute name="width" type="Length"/>
+ <xs:attribute name="usemap" type="URI"/>
+ <xs:attribute name="name" type="xs:NMTOKEN"/>
+ <xs:attribute name="tabindex" type="tabindexNumber"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="param">
+ <xs:annotation>
+ <xs:documentation>
+ param is used to supply a named property value.
+ In XML it would seem natural to follow RDF and support an
+ abbreviated syntax where the param elements are replaced
+ by attribute value pairs on the object start tag.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="name"/>
+ <xs:attribute name="value"/>
+ <xs:attribute name="valuetype" default="data">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="data"/>
+ <xs:enumeration value="ref"/>
+ <xs:enumeration value="object"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="type" type="ContentType"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ =================== Images ===========================================
+
+ To avoid accessibility problems for people who aren't
+ able to see the image, you should provide a text
+ description using the alt and longdesc attributes.
+ In addition, avoid the use of server-side image maps.
+ Note that in this DTD there is no name attribute. That
+ is only available in the transitional and frameset DTD.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="img">
+ <xs:complexType>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="src" use="required" type="URI"/>
+ <xs:attribute name="alt" use="required" type="Text"/>
+ <xs:attribute name="longdesc" type="URI"/>
+ <xs:attribute name="height" type="Length"/>
+ <xs:attribute name="width" type="Length"/>
+ <xs:attribute name="usemap" type="URI">
+ <xs:annotation>
+ <xs:documentation>
+ usemap points to a map element which may be in this document
+ or an external document, although the latter is not widely supported
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="ismap">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="ismap"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================== Client-side image maps ============================
+
+ These can be placed in the same document or grouped in a
+ separate document although this isn't yet widely supported
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="map">
+ <xs:complexType>
+ <xs:choice>
+ <xs:choice maxOccurs="unbounded">
+ <xs:group ref="block"/>
+ <xs:element ref="form"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ <xs:element maxOccurs="unbounded" ref="area"/>
+ </xs:choice>
+ <xs:attributeGroup ref="i18n"/>
+ <xs:attributeGroup ref="events"/>
+ <xs:attribute name="id" use="required" type="xs:ID"/>
+ <xs:attribute name="class"/>
+ <xs:attribute name="style" type="StyleSheet"/>
+ <xs:attribute name="title" type="Text"/>
+ <xs:attribute name="name" type="xs:NMTOKEN"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="area">
+ <xs:complexType>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="focus"/>
+ <xs:attribute name="shape" default="rect" type="Shape"/>
+ <xs:attribute name="coords" type="Coords"/>
+ <xs:attribute name="href" type="URI"/>
+ <xs:attribute name="nohref">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="nohref"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="alt" use="required" type="Text"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ================ Forms ===============================================
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="form">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="form.content">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="action" use="required" type="URI"/>
+ <xs:attribute name="method" default="get">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="get"/>
+ <xs:enumeration value="post"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="enctype" type="ContentType"
+ default="application/x-www-form-urlencoded"/>
+ <xs:attribute name="onsubmit" type="Script"/>
+ <xs:attribute name="onreset" type="Script"/>
+ <xs:attribute name="accept" type="ContentTypes"/>
+ <xs:attribute name="accept-charset" type="Charsets"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="label">
+ <xs:annotation>
+ <xs:documentation>
+ Each label must not contain more than ONE field
+ Label elements shouldn't be nested.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="for" type="xs:IDREF"/>
+ <xs:attribute name="accesskey" type="Character"/>
+ <xs:attribute name="onfocus" type="Script"/>
+ <xs:attribute name="onblur" type="Script"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="InputType">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="text"/>
+ <xs:enumeration value="password"/>
+ <xs:enumeration value="checkbox"/>
+ <xs:enumeration value="radio"/>
+ <xs:enumeration value="submit"/>
+ <xs:enumeration value="reset"/>
+ <xs:enumeration value="file"/>
+ <xs:enumeration value="hidden"/>
+ <xs:enumeration value="image"/>
+ <xs:enumeration value="button"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="input">
+ <xs:annotation>
+ <xs:documentation>
+ form control
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="focus"/>
+ <xs:attribute name="type" default="text" type="InputType"/>
+ <xs:attribute name="name">
+ <xs:annotation>
+ <xs:documentation>
+ the name attribute is required for all but submit &amp; reset
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="value"/>
+ <xs:attribute name="checked">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="checked"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="disabled">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="disabled"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="readonly">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="readonly"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="size"/>
+ <xs:attribute name="maxlength" type="Number"/>
+ <xs:attribute name="src" type="URI"/>
+ <xs:attribute name="alt"/>
+ <xs:attribute name="usemap" type="URI"/>
+ <xs:attribute name="onselect" type="Script"/>
+ <xs:attribute name="onchange" type="Script"/>
+ <xs:attribute name="accept" type="ContentTypes"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="select">
+ <xs:annotation>
+ <xs:documentation>
+ option selector
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="optgroup"/>
+ <xs:element ref="option"/>
+ </xs:choice>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="name"/>
+ <xs:attribute name="size" type="Number"/>
+ <xs:attribute name="multiple">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="multiple"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="disabled">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="disabled"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="tabindex" type="tabindexNumber"/>
+ <xs:attribute name="onfocus" type="Script"/>
+ <xs:attribute name="onblur" type="Script"/>
+ <xs:attribute name="onchange" type="Script"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="optgroup">
+ <xs:annotation>
+ <xs:documentation>
+ option group
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="option"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="disabled">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="disabled"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="label" use="required" type="Text"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="option">
+ <xs:annotation>
+ <xs:documentation>
+ selectable choice
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="selected">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="selected"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="disabled">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="disabled"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="label" type="Text"/>
+ <xs:attribute name="value"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="textarea">
+ <xs:annotation>
+ <xs:documentation>
+ multi-line text field
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="focus"/>
+ <xs:attribute name="name"/>
+ <xs:attribute name="rows" use="required" type="Number"/>
+ <xs:attribute name="cols" use="required" type="Number"/>
+ <xs:attribute name="disabled">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="disabled"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="readonly">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="readonly"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="onselect" type="Script"/>
+ <xs:attribute name="onchange" type="Script"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="fieldset">
+ <xs:annotation>
+ <xs:documentation>
+ The fieldset element is used to group form fields.
+ Only one legend element should occur in the content
+ and if present should only be preceded by whitespace.
+
+ NOTE: this content model is different from the XHTML 1.0 DTD,
+ closer to the intended content model in HTML4 DTD
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="legend"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="block"/>
+ <xs:element ref="form"/>
+ <xs:group ref="inline"/>
+ <xs:group ref="misc"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="legend">
+ <xs:annotation>
+ <xs:documentation>
+ fieldset label
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="accesskey" type="Character"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="button">
+ <xs:annotation>
+ <xs:documentation>
+ Content is "Flow" excluding a, form and form controls
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="button.content">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="focus"/>
+ <xs:attribute name="name"/>
+ <xs:attribute name="value"/>
+ <xs:attribute name="type" default="submit">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="button"/>
+ <xs:enumeration value="submit"/>
+ <xs:enumeration value="reset"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="disabled">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="disabled"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ ======================= Tables =======================================
+
+ Derived from IETF HTML table standard, see [RFC1942]
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="TFrame">
+ <xs:annotation>
+ <xs:documentation>
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="void"/>
+ <xs:enumeration value="above"/>
+ <xs:enumeration value="below"/>
+ <xs:enumeration value="hsides"/>
+ <xs:enumeration value="lhs"/>
+ <xs:enumeration value="rhs"/>
+ <xs:enumeration value="vsides"/>
+ <xs:enumeration value="box"/>
+ <xs:enumeration value="border"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="TRules">
+ <xs:annotation>
+ <xs:documentation>
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+ "none" if border is absent or border="0" otherwise "all"
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="none"/>
+ <xs:enumeration value="groups"/>
+ <xs:enumeration value="rows"/>
+ <xs:enumeration value="cols"/>
+ <xs:enumeration value="all"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="cellhalign">
+ <xs:annotation>
+ <xs:documentation>
+ horizontal alignment attributes for cell contents
+
+ char alignment char, e.g. char=':'
+ charoff offset for alignment char
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="align">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="left"/>
+ <xs:enumeration value="center"/>
+ <xs:enumeration value="right"/>
+ <xs:enumeration value="justify"/>
+ <xs:enumeration value="char"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="char" type="Character"/>
+ <xs:attribute name="charoff" type="Length"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="cellvalign">
+ <xs:annotation>
+ <xs:documentation>
+ vertical alignment attributes for cell contents
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="valign">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="top"/>
+ <xs:enumeration value="middle"/>
+ <xs:enumeration value="bottom"/>
+ <xs:enumeration value="baseline"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+
+ <xs:element name="table">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="caption"/>
+ <xs:choice>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="col"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="colgroup"/>
+ </xs:choice>
+ <xs:element minOccurs="0" ref="thead"/>
+ <xs:element minOccurs="0" ref="tfoot"/>
+ <xs:choice>
+ <xs:element maxOccurs="unbounded" ref="tbody"/>
+ <xs:element maxOccurs="unbounded" ref="tr"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="summary" type="Text"/>
+ <xs:attribute name="width" type="Length"/>
+ <xs:attribute name="border" type="Pixels"/>
+ <xs:attribute name="frame" type="TFrame"/>
+ <xs:attribute name="rules" type="TRules"/>
+ <xs:attribute name="cellspacing" type="Length"/>
+ <xs:attribute name="cellpadding" type="Length"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="caption">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Inline">
+ <xs:attributeGroup ref="attrs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ Use thead to duplicate headers when breaking table
+ across page boundaries, or for static headers when
+ tbody sections are rendered in scrolling panel.
+
+ Use tfoot to duplicate footers when breaking table
+ across page boundaries, or for static footers when
+ tbody sections are rendered in scrolling panel.
+
+ Use multiple tbody sections when rules are needed
+ between groups of table rows.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="thead">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="tr"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="tfoot">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="tr"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="tbody">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="tr"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="colgroup">
+ <xs:annotation>
+ <xs:documentation>
+ colgroup groups a set of col elements. It allows you to group
+ several semantically related columns together.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="col"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="span" default="1" type="Number"/>
+ <xs:attribute name="width" type="MultiLength"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="col">
+ <xs:annotation>
+ <xs:documentation>
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+ width=64 width in screen pixels
+ width=0.5* relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="span" default="1" type="Number"/>
+ <xs:attribute name="width" type="MultiLength"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="tr">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="th"/>
+ <xs:element ref="td"/>
+ </xs:choice>
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="Scope">
+ <xs:annotation>
+ <xs:documentation>
+ Scope is simpler than headers attribute for common tables
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="row"/>
+ <xs:enumeration value="col"/>
+ <xs:enumeration value="rowgroup"/>
+ <xs:enumeration value="colgroup"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ th is for headers, td for data and for cells acting as both
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="th">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="abbr" type="Text"/>
+ <xs:attribute name="axis"/>
+ <xs:attribute name="headers" type="xs:IDREFS"/>
+ <xs:attribute name="scope" type="Scope"/>
+ <xs:attribute name="rowspan" default="1" type="Number"/>
+ <xs:attribute name="colspan" default="1" type="Number"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="td">
+ <xs:complexType mixed="true">
+ <xs:complexContent>
+ <xs:extension base="Flow">
+ <xs:attributeGroup ref="attrs"/>
+ <xs:attribute name="abbr" type="Text"/>
+ <xs:attribute name="axis"/>
+ <xs:attribute name="headers" type="xs:IDREFS"/>
+ <xs:attribute name="scope" type="Scope"/>
+ <xs:attribute name="rowspan" default="1" type="Number"/>
+ <xs:attribute name="colspan" default="1" type="Number"/>
+ <xs:attributeGroup ref="cellhalign"/>
+ <xs:attributeGroup ref="cellvalign"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/main/src/addins/Xml/Tests/Schema/AbstractElementTestFixture.cs b/main/src/addins/Xml/Tests/Schema/AbstractElementTestFixture.cs
new file mode 100644
index 0000000000..62dd1300db
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/AbstractElementTestFixture.cs
@@ -0,0 +1,128 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests elements that are abstract and require substitution groups.
+ /// </summary>
+ [TestFixture]
+ public class AbstractElementTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList itemsElementChildren;
+ CompletionDataList fileElementAttributes;
+ CompletionDataList fileElementChildren;
+
+ public override void FixtureInit()
+ {
+ var path = new XmlElementPath();
+
+ path.Elements.Add(new QualifiedName("project", "http://foo"));
+ path.Elements.Add(new QualifiedName("items", "http://foo"));
+
+ itemsElementChildren = SchemaCompletionData.GetChildElementCompletionData(path);
+
+ path.Elements.Add(new QualifiedName("file", "http://foo"));
+
+ fileElementAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ fileElementChildren = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void ItemsElementHasTwoChildElements()
+ {
+ Assert.AreEqual(2, itemsElementChildren.Count,
+ "Should be 2 child elements.");
+ }
+
+ [Test]
+ public void ReferenceElementIsChildOfItemsElement()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(itemsElementChildren, "reference"));
+ }
+
+ [Test]
+ public void FileElementIsChildOfItemsElement()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(itemsElementChildren, "file"));
+ }
+
+ [Test]
+ public void FileElementHasAttributeNamedType()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(fileElementAttributes, "type"));
+ }
+
+ [Test]
+ public void FileElementHasTwoChildElements()
+ {
+ Assert.AreEqual(2, fileElementChildren.Count, "Should be 2 child elements.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema targetNamespace=\"http://foo\" xmlns:foo=\"http://foo\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\">\r\n" +
+ " <xs:element name=\"project\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:group ref=\"foo:projectItems\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:group name=\"projectItems\">\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:element name=\"items\" type=\"foo:itemGroupType\"/>\r\n" +
+ " <xs:element name=\"message\" type=\"xs:string\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:group>\r\n" +
+ "\r\n" +
+ " <xs:complexType name=\"itemGroupType\">\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:element ref=\"foo:item\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"name\" type=\"xs:string\" use=\"optional\"/> \r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"item\" type=\"foo:itemType\" abstract=\"true\"/>\r\n" +
+ "\r\n" +
+ "<xs:complexType name=\"itemType\">\r\n" +
+ " <xs:attribute name=\"name\" type=\"xs:string\" use=\"optional\"/> \r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"reference\" substitutionGroup=\"foo:item\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:extension base=\"foo:itemType\">\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:element name=\"name\"/>\r\n" +
+ " <xs:element name=\"location\"/> \r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"description\" type=\"xs:string\"/>\r\n" +
+ " </xs:extension>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"file\" substitutionGroup=\"foo:item\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:extension base=\"foo:itemType\">\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:element name=\"name\"/>\r\n" +
+ " <xs:element name=\"attributes\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"type\" type=\"xs:string\"/>\r\n" +
+ " </xs:extension>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/AllElementTestFixture.cs b/main/src/addins/Xml/Tests/Schema/AllElementTestFixture.cs
new file mode 100644
index 0000000000..a9a7a3265d
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/AllElementTestFixture.cs
@@ -0,0 +1,71 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that element completion works for any child elements
+ /// inside an xs:all schema element.
+ /// </summary>
+ [TestFixture]
+ public class AllElementTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList personElementChildren;
+ CompletionDataList firstNameAttributes;
+ CompletionDataList firstNameElementChildren;
+
+ public override void FixtureInit()
+ {
+ var path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("person", "http://foo"));
+ personElementChildren = SchemaCompletionData.GetChildElementCompletionData(path);
+
+ path.Elements.Add(new QualifiedName("firstname", "http://foo"));
+ firstNameAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ firstNameElementChildren = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void PersonElementHasTwoChildElements()
+ {
+ Assert.AreEqual(2, personElementChildren.Count,
+ "Should be 2 child elements.");
+ }
+
+ [Test]
+ public void FirstNameElementHasAttribute()
+ {
+ Assert.AreEqual(1, firstNameAttributes.Count, "Should have one attribute.");
+ }
+
+ [Test]
+ public void FirstNameElementHasChildren()
+ {
+ Assert.AreEqual(2, firstNameElementChildren.Count,
+ "Should be 2 child elements.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" targetNamespace=\"http://foo\">\r\n" +
+ " <xs:element name=\"person\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:all>\r\n" +
+ " <xs:element name=\"firstname\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element name=\"short\" type=\"xs:string\"/>\r\n" +
+ " <xs:element name=\"title\" type=\"xs:string\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"id\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ " <xs:element name=\"lastname\" type=\"xs:string\"/>\r\n" +
+ " </xs:all>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/AttributeAnnotationTestFixture.cs b/main/src/addins/Xml/Tests/Schema/AttributeAnnotationTestFixture.cs
new file mode 100644
index 0000000000..098e18098f
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/AttributeAnnotationTestFixture.cs
@@ -0,0 +1,66 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that the completion data retrieves the annotation documentation
+ /// that an attribute may have.
+ /// </summary>
+ [TestFixture]
+ public class AttributeAnnotationTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList fooAttributeCompletionData;
+ CompletionDataList barAttributeCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
+
+ fooAttributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ path.Elements.Add(new QualifiedName("bar", "http://foo.com"));
+ barAttributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void FooAttributeDocumentation()
+ {
+ Assert.AreEqual("Documentation for foo attribute.", ((MonoDevelop.Ide.CodeCompletion.CompletionData)fooAttributeCompletionData[0]).Description);
+ }
+
+ [Test]
+ public void BarAttributeDocumentation()
+ {
+ Assert.AreEqual("Documentation for bar attribute.", ((MonoDevelop.Ide.CodeCompletion.CompletionData)barAttributeCompletionData[0]).Description);
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo.com\" xmlns=\"http://foo.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"foo\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:sequence>\t\r\n" +
+ "\t\t\t\t<xs:element name=\"bar\" type=\"bar\">\r\n" +
+ "\t\t\t</xs:element>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t\t<xs:attribute name=\"id\">\r\n" +
+ "\t\t\t\t\t<xs:annotation>\r\n" +
+ "\t\t\t\t\t\t<xs:documentation>Documentation for foo attribute.</xs:documentation>\r\n" +
+ "\t\t\t\t</xs:annotation>\t\r\n" +
+ "\t\t\t</xs:attribute>\t\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "\t<xs:complexType name=\"bar\">\r\n" +
+ "\t\t<xs:attribute name=\"name\">\r\n" +
+ "\t\t\t<xs:annotation>\r\n" +
+ "\t\t\t\t<xs:documentation>Documentation for bar attribute.</xs:documentation>\r\n" +
+ "\t\t\t</xs:annotation>\t\r\n" +
+ "\t\t</xs:attribute>\t\r\n" +
+ "\t</xs:complexType>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/AttributeGroupRefTestFixture.cs b/main/src/addins/Xml/Tests/Schema/AttributeGroupRefTestFixture.cs
new file mode 100644
index 0000000000..94b397c1bc
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/AttributeGroupRefTestFixture.cs
@@ -0,0 +1,73 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Element that uses an attribute group ref.
+ /// </summary>
+ [TestFixture]
+ public class AttributeGroupRefTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributeCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ attributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void AttributeCount()
+ {
+ Assert.AreEqual(4, attributeCompletionData.Count, "Should be 4 attributes.");
+ }
+
+ [Test]
+ public void NameAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "name"),
+ "Attribute name does not exist.");
+ }
+
+ [Test]
+ public void IdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "id"),
+ "Attribute id does not exist.");
+ }
+
+ [Test]
+ public void StyleAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "style"),
+ "Attribute style does not exist.");
+ }
+
+ [Test]
+ public void TitleAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "title"),
+ "Attribute title does not exist.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "<xs:attributeGroup name=\"coreattrs\">" +
+ "\t<xs:attribute name=\"id\" type=\"xs:string\"/>" +
+ "\t<xs:attribute name=\"style\" type=\"xs:string\"/>" +
+ "\t<xs:attribute name=\"title\" type=\"xs:string\"/>" +
+ "</xs:attributeGroup>" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:attributeGroup ref=\"coreattrs\"/>" +
+ "\t\t\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/AttributeRefTestFixture.cs b/main/src/addins/Xml/Tests/Schema/AttributeRefTestFixture.cs
new file mode 100644
index 0000000000..4cf58808ed
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/AttributeRefTestFixture.cs
@@ -0,0 +1,98 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests attribute refs
+ /// </summary>
+ [TestFixture]
+ public class AttributeRefTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("html", "http://foo/xhtml"));
+ attributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void HtmlAttributeCount()
+ {
+ Assert.AreEqual(4, attributes.Count,
+ "Should be 4 attributes.");
+ }
+
+ [Test]
+ public void HtmlLangAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "lang"), "Attribute lang not found.");
+ }
+
+ [Test]
+ public void HtmlIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "id"), "Attribute id not found.");
+ }
+
+ [Test]
+ public void HtmlDirAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "dir"), "Attribute dir not found.");
+ }
+
+ [Test]
+ public void HtmlXmlLangAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "xml:lang"), "Attribute xml:lang not found.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
+ " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ " targetNamespace=\"http://foo/xhtml\"\r\n" +
+ " xmlns=\"http://foo/xhtml\"\r\n" +
+ " elementFormDefault=\"qualified\">\r\n" +
+ " <xs:element name=\"html\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element ref=\"head\"/>\r\n" +
+ " <xs:element ref=\"body\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attributeGroup ref=\"i18n\"/>\r\n" +
+ " <xs:attribute name=\"id\" type=\"xs:ID\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
+ " <xs:element name=\"body\" type=\"xs:string\"/>\r\n" +
+ "\r\n" +
+ " <xs:attributeGroup name=\"i18n\">\r\n" +
+ " <xs:annotation>\r\n" +
+ " <xs:documentation>\r\n" +
+ " internationalization attributes\r\n" +
+ " lang language code (backwards compatible)\r\n" +
+ " xml:lang language code (as per XML 1.0 spec)\r\n" +
+ " dir direction for weak/neutral text\r\n" +
+ " </xs:documentation>\r\n" +
+ " </xs:annotation>\r\n" +
+ " <xs:attribute name=\"lang\" type=\"LanguageCode\"/>\r\n" +
+ " <xs:attribute ref=\"xml:lang\"/>\r\n" +
+ "\r\n" +
+ " <xs:attribute name=\"dir\">\r\n" +
+ " <xs:simpleType>\r\n" +
+ " <xs:restriction base=\"xs:token\">\r\n" +
+ " <xs:enumeration value=\"ltr\"/>\r\n" +
+ " <xs:enumeration value=\"rtl\"/>\r\n" +
+ " </xs:restriction>\r\n" +
+ " </xs:simpleType>\r\n" +
+ " </xs:attribute>\r\n" +
+ " </xs:attributeGroup>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/AttributeValueAnnotationTestFixture.cs b/main/src/addins/Xml/Tests/Schema/AttributeValueAnnotationTestFixture.cs
new file mode 100644
index 0000000000..85860aeed5
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/AttributeValueAnnotationTestFixture.cs
@@ -0,0 +1,63 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that the completion data retrieves the annotation documentation
+ /// that an attribute value may have.
+ /// </summary>
+ [TestFixture]
+ public class AttributeValueAnnotationTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList barAttributeValuesCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
+ barAttributeValuesCompletionData = SchemaCompletionData.GetAttributeValueCompletionData(path, "bar");
+ }
+
+ [Test]
+ public void BarAttributeValueDefaultDocumentation()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.ContainsDescription(barAttributeValuesCompletionData, "default", "Default attribute value info."),
+ "Description for attribute value 'default' is incorrect.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ "\ttargetNamespace=\"http://foo.com\"\r\n" +
+ "\txmlns=\"http://foo.com\">\r\n" +
+ "\t<xs:element name=\"foo\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:attribute name=\"bar\">\r\n" +
+ "\t\t\t\t<xs:simpleType>\r\n" +
+ "\t\t\t\t\t<xs:restriction base=\"xs:NMTOKEN\">\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"default\">\r\n" +
+ "\t\t\t\t\t\t\t<xs:annotation><xs:documentation>Default attribute value info.</xs:documentation></xs:annotation>\r\n" +
+ "\t\t\t\t\t\t</xs:enumeration>\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"enable\">\r\n" +
+ "\t\t\t\t\t\t\t<xs:annotation><xs:documentation>Enable attribute value info.</xs:documentation></xs:annotation>\r\n" +
+ "\t\t\t\t\t\t</xs:enumeration>\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"disable\">\r\n" +
+ "\t\t\t\t\t\t\t<xs:annotation><xs:documentation>Disable attribute value info.</xs:documentation></xs:annotation>\r\n" +
+ "\t\t\t\t\t\t</xs:enumeration>\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"hide\">\r\n" +
+ "\t\t\t\t\t\t\t<xs:annotation><xs:documentation>Hide attribute value info.</xs:documentation></xs:annotation>\r\n" +
+ "\t\t\t\t\t\t</xs:enumeration>\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"show\">\r\n" +
+ "\t\t\t\t\t\t\t<xs:annotation><xs:documentation>Show attribute value info.</xs:documentation></xs:annotation>\r\n" +
+ "\t\t\t\t\t\t</xs:enumeration>\r\n" +
+ "\t\t\t\t\t</xs:restriction>\r\n" +
+ "\t\t\t\t</xs:simpleType>\r\n" +
+ "\t\t\t</xs:attribute>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ChildElementAttributesTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ChildElementAttributesTestFixture.cs
new file mode 100644
index 0000000000..4154ee41d4
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ChildElementAttributesTestFixture.cs
@@ -0,0 +1,70 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Child element attributes.
+ /// </summary>
+ [TestFixture]
+ public class ChildElementAttributesTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("project", "http://nant.sf.net//nant-0.84.xsd"));
+ path.Elements.Add(new QualifiedName("attrib", "http://nant.sf.net//nant-0.84.xsd"));
+
+ attributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void AttributeCount()
+ {
+ Assert.AreEqual(10, attributes.Count, "Should be one attribute.");
+ }
+
+ [Test]
+ public void FileAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "file"),
+ "Attribute file does not exist.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:vs=\"urn:schemas-microsoft-com:HTML-Intellisense\" xmlns:nant=\"http://nant.sf.net//nant-0.84.xsd\" targetNamespace=\"http://nant.sf.net//nant-0.84.xsd\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\r\n" +
+ " <xs:element name=\"project\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:element name=\"attrib\" type=\"nant:attrib\" />\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"name\" use=\"required\" />\r\n" +
+ " <xs:attribute name=\"default\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"basedir\" use=\"optional\" />\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:complexType id=\"NAnt.Core.Tasks.AttribTask\" name=\"attrib\">\r\n" +
+ " <xs:attribute name=\"file\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"archive\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"hidden\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"normal\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"readonly\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"system\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"failonerror\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"verbose\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"if\" use=\"optional\" />\r\n" +
+ " <xs:attribute name=\"unless\" use=\"optional\" />\r\n" +
+ " </xs:complexType>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ChoiceTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ChoiceTestFixture.cs
new file mode 100644
index 0000000000..6eff3b644c
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ChoiceTestFixture.cs
@@ -0,0 +1,79 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that nested schema choice elements are handled.
+ /// This happens in the NAnt schema 0.85.
+ /// </summary>
+ [TestFixture]
+ public class ChoiceTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList noteChildElements;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ noteChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void TitleHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void TextHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("text", "http://www.w3schools.com"));
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void NoteHasTwoChildElements()
+ {
+ Assert.AreEqual(2, noteChildElements.Count,
+ "Should be two child elements.");
+ }
+
+ [Test]
+ public void NoteChildElementIsText()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "text"),
+ "Should have a child element called text.");
+ }
+
+ [Test]
+ public void NoteChildElementIsTitle()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "title"),
+ "Should have a child element called title.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:choice>\r\n" +
+ "\t\t\t\t<xs:element name=\"title\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t<xs:element name=\"text\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t</xs:choice>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ComplexContentExtensionTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ComplexContentExtensionTestFixture.cs
new file mode 100644
index 0000000000..10c8aebc3d
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ComplexContentExtensionTestFixture.cs
@@ -0,0 +1,103 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests complex content extension elements.
+ /// </summary>
+ [TestFixture]
+ public class ComplexContentExtensionTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList bodyChildElements;
+ CompletionDataList bodyAttributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("body", "http://www.w3schools.com"));
+
+ bodyChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ bodyAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void TitleHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("body", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
+
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void TextHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("body", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("text", "http://www.w3schools.com"));
+
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void BodyHasTwoChildElements()
+ {
+ Assert.AreEqual(2, bodyChildElements.Count,
+ "Should be two child elements.");
+ }
+
+ [Test]
+ public void BodyChildElementIsText()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(bodyChildElements, "text"),
+ "Should have a child element called text.");
+ }
+
+ [Test]
+ public void BodyChildElementIsTitle()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(bodyChildElements, "title"),
+ "Should have a child element called title.");
+ }
+
+ [Test]
+ public void BodyAttributeCount()
+ {
+ Assert.AreEqual(1, bodyAttributes.Count,
+ "Should be one attribute.");
+ }
+
+ [Test]
+ public void BodyAttributeName()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(bodyAttributes, "id"), "Attribute id not found.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:complexType name=\"Block\">\r\n" +
+ "\t\t<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ "\t\t\t<xs:element name=\"title\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t<xs:element name=\"text\" type=\"xs:string\"/>\r\n" +
+ "\t\t</xs:choice>\r\n" +
+ "\t</xs:complexType>\r\n" +
+ "\r\n" +
+ "\t<xs:element name=\"body\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:complexContent>\r\n" +
+ "\t\t\t\t<xs:extension base=\"Block\">\r\n" +
+ "\t\t\t\t\t<xs:attribute name=\"id\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t</xs:extension>\r\n" +
+ "\t\t\t</xs:complexContent>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/DuplicateElementTestFixture.cs b/main/src/addins/Xml/Tests/Schema/DuplicateElementTestFixture.cs
new file mode 100644
index 0000000000..07ccb2afb0
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/DuplicateElementTestFixture.cs
@@ -0,0 +1,69 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests duplicate elements in the schema.
+ /// </summary>
+ [TestFixture]
+ public class DuplicateElementTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList htmlChildElements;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("html", "http://foo/xhtml"));
+
+ htmlChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void HtmlHasTwoChildElements()
+ {
+ Assert.AreEqual(2, htmlChildElements.Count,
+ "Should be 2 child elements.");
+ }
+
+ [Test]
+ public void HtmlChildElementHead()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(htmlChildElements, "head"),
+ "Should have a child element called head.");
+ }
+
+ [Test]
+ public void HtmlChildElementBody()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(htmlChildElements, "body"),
+ "Should have a child element called body.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
+ " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ " targetNamespace=\"http://foo/xhtml\"\r\n" +
+ " xmlns=\"http://foo/xhtml\"\r\n" +
+ " elementFormDefault=\"qualified\">\r\n" +
+ "\r\n" +
+ " <xs:element name=\"html\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element name=\"head\"/>\r\n" +
+ " <xs:element name=\"body\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element name=\"body\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ElementAnnotationTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ElementAnnotationTestFixture.cs
new file mode 100644
index 0000000000..0799de7aec
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ElementAnnotationTestFixture.cs
@@ -0,0 +1,65 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that the completion data retrieves the annotation documentation
+ /// that an element may have.
+ /// </summary>
+ [TestFixture]
+ public class ElementAnnotationTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList fooChildElementCompletionData;
+ CompletionDataList rootElementCompletionData;
+
+ public override void FixtureInit()
+ {
+ rootElementCompletionData = SchemaCompletionData.GetElementCompletionData();
+
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
+
+ fooChildElementCompletionData = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void RootElementDocumentation()
+ {
+ Assert.AreEqual("Documentation for foo element.", ((MonoDevelop.Ide.CodeCompletion.CompletionData)rootElementCompletionData[0]).Description);
+ }
+
+ [Test]
+ public void FooChildElementDocumentation()
+ {
+ Assert.AreEqual("Documentation for bar element.", ((MonoDevelop.Ide.CodeCompletion.CompletionData)fooChildElementCompletionData[0]).Description);
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo.com\" xmlns=\"http://foo.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"foo\">\r\n" +
+ "\t\t<xs:annotation>\r\n" +
+ "\t\t\t<xs:documentation>Documentation for foo element.</xs:documentation>\r\n" +
+ "\t\t</xs:annotation>\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:sequence>\t\r\n" +
+ "\t\t\t\t<xs:element name=\"bar\" type=\"bar\">\r\n" +
+ "\t\t\t\t\t<xs:annotation>\r\n" +
+ "\t\t\t\t\t\t<xs:documentation>Documentation for bar element.</xs:documentation>\r\n" +
+ "\t\t\t\t</xs:annotation>\t\r\n" +
+ "\t\t\t</xs:element>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "\t<xs:complexType name=\"bar\">\r\n" +
+ "\t\t<xs:annotation>\r\n" +
+ "\t\t\t<xs:documentation>Documentation for bar element.</xs:documentation>\r\n" +
+ "\t\t</xs:annotation>\t\r\n" +
+ "\t\t<xs:attribute name=\"id\"/>\r\n" +
+ "\t</xs:complexType>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ElementRefAnnotationTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ElementRefAnnotationTestFixture.cs
new file mode 100644
index 0000000000..f102adc70e
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ElementRefAnnotationTestFixture.cs
@@ -0,0 +1,53 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that the completion data retrieves the annotation documentation
+ /// that an element ref may have.
+ /// </summary>
+ [TestFixture]
+ public class ElementRefAnnotationTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList fooChildElementCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
+
+ fooChildElementCompletionData = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void BarElementDocumentation()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.ContainsDescription(fooChildElementCompletionData, "bar", "Documentation for bar element."),
+ "Missing documentation for bar element");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo.com\" xmlns=\"http://foo.com\">\r\n" +
+ "\t<xs:element name=\"foo\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t<xs:element ref=\"bar\"/>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "\r\n" +
+ "\t<xs:element name=\"bar\">\r\n" +
+ "\t\t<xs:annotation>\r\n" +
+ "\t\t\t<xs:documentation>Documentation for bar element.</xs:documentation>\r\n" +
+ "\t\t</xs:annotation>\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:attribute name=\"id\"/>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ElementWithAttributeSchemaTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ElementWithAttributeSchemaTestFixture.cs
new file mode 100644
index 0000000000..5929d39082
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ElementWithAttributeSchemaTestFixture.cs
@@ -0,0 +1,58 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Element that has a single attribute.
+ /// </summary>
+ [TestFixture]
+ public class ElementWithAttributeSchemaTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributeCompletionData;
+ string attributeName;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ attributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
+ attributeName = attributeCompletionData[0].DisplayText;
+ }
+
+ [Test]
+ public void AttributeCount()
+ {
+ Assert.AreEqual(1, attributeCompletionData.Count, "Should be one attribute.");
+ }
+
+ [Test]
+ public void AttributeName()
+ {
+ Assert.AreEqual("name", attributeName, "Attribute name is incorrect.");
+ }
+
+ [Test]
+ public void NoAttributesForUnknownElement()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foobar", "http://www.w3schools.com"));
+ CompletionDataList attributes = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ Assert.AreEqual(0, attributes.Count, "Should not find attributes for unknown element.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ " <xs:element name=\"note\">\r\n" +
+ " <xs:complexType>\r\n" +
+ "\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/EnumAttributeValueTestFixture.cs b/main/src/addins/Xml/Tests/Schema/EnumAttributeValueTestFixture.cs
new file mode 100644
index 0000000000..7a56e0a84b
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/EnumAttributeValueTestFixture.cs
@@ -0,0 +1,60 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests attribute refs
+ /// </summary>
+ [TestFixture]
+ public class EnumAttributeValueTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributeValues;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
+ attributeValues = SchemaCompletionData.GetAttributeValueCompletionData(path, "id");
+ }
+
+ [Test]
+ public void IdAttributeHasValueOne()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeValues, "one"),
+ "Missing attribute value 'one'");
+ }
+
+ [Test]
+ public void IdAttributeHasValueTwo()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeValues, "two"),
+ "Missing attribute value 'two'");
+ }
+
+ [Test]
+ public void IdAttributeValueCount()
+ {
+ Assert.AreEqual(2, attributeValues.Count, "Expecting 2 attribute values.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://foo.com\" targetNamespace=\"http://foo.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"foo\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:attribute name=\"id\">\r\n" +
+ "\t\t\t\t<xs:simpleType>\r\n" +
+ "\t\t\t\t\t<xs:restriction base=\"xs:string\">\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"one\"/>\r\n" +
+ "\t\t\t\t\t\t<xs:enumeration value=\"two\"/>\r\n" +
+ "\t\t\t\t\t</xs:restriction>\r\n" +
+ "\t\t\t\t</xs:simpleType>\r\n" +
+ "\t\t\t</xs:attribute>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ExtensionElementTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ExtensionElementTestFixture.cs
new file mode 100644
index 0000000000..f6ee5ba782
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ExtensionElementTestFixture.cs
@@ -0,0 +1,255 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests complex content extension elements.
+ /// </summary>
+ [TestFixture]
+ public class ExtensionElementTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList schemaChildElements;
+ CompletionDataList annotationChildElements;
+ CompletionDataList annotationAttributes;
+ CompletionDataList includeAttributes;
+ CompletionDataList appInfoAttributes;
+ //CompletionDataList schemaAttributes;
+ CompletionDataList fooAttributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("schema", "http://www.w3.org/2001/XMLSchema"));
+
+ schemaChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ //schemaAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ // Get include elements attributes.
+ path.Elements.Add(new QualifiedName("include", "http://www.w3.org/2001/XMLSchema"));
+ includeAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ // Get annotation element info.
+ path.Elements.RemoveAt(path.Elements.Count - 1);
+ path.Elements.Add(new QualifiedName("annotation", "http://www.w3.org/2001/XMLSchema"));
+
+ annotationChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ annotationAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ // Get app info attributes.
+ path.Elements.Add(new QualifiedName("appinfo", "http://www.w3.org/2001/XMLSchema"));
+ appInfoAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ // Get foo attributes.
+ path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://www.w3.org/2001/XMLSchema"));
+ fooAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void SchemaHasSevenChildElements()
+ {
+ Assert.AreEqual(7, schemaChildElements.Count,
+ "Should be 7 child elements.");
+ }
+
+ [Test]
+ public void SchemaChildElementIsInclude()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(schemaChildElements, "include"),
+ "Should have a child element called include.");
+ }
+
+ [Test]
+ public void SchemaChildElementIsImport()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(schemaChildElements, "import"),
+ "Should have a child element called import.");
+ }
+
+ [Test]
+ public void SchemaChildElementIsNotation()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(schemaChildElements, "notation"),
+ "Should have a child element called notation.");
+ }
+
+ /// <summary>
+ /// Tests that the extended element has the base type's attributes.
+ /// </summary>
+ [Test]
+ public void FooHasClassAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(fooAttributes, "class"),
+ "Should have an attribute called class.");
+ }
+
+ [Test]
+ public void AnnotationElementHasOneAttribute()
+ {
+ Assert.AreEqual(1, annotationAttributes.Count, "Should be one attribute.");
+ }
+
+ [Test]
+ public void AnnotationHasIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(annotationAttributes, "id"),
+ "Should have an attribute called id.");
+ }
+
+ [Test]
+ public void AnnotationHasTwoChildElements()
+ {
+ Assert.AreEqual(2, annotationChildElements.Count,
+ "Should be 2 child elements.");
+ }
+
+ [Test]
+ public void AnnotationChildElementIsAppInfo()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(annotationChildElements, "appinfo"),
+ "Should have a child element called appinfo.");
+ }
+
+ [Test]
+ public void AnnotationChildElementIsDocumentation()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(annotationChildElements, "documentation"),
+ "Should have a child element called documentation.");
+ }
+
+ [Test]
+ public void IncludeElementHasOneAttribute()
+ {
+ Assert.AreEqual(1, includeAttributes.Count, "Should be one attribute.");
+ }
+
+ [Test]
+ public void IncludeHasSchemaLocationAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(includeAttributes, "schemaLocation"),
+ "Should have an attribute called schemaLocation.");
+ }
+
+ [Test]
+ public void AppInfoElementHasOneAttribute()
+ {
+ Assert.AreEqual(1, appInfoAttributes.Count, "Should be one attribute.");
+ }
+
+ [Test]
+ public void AppInfoHasIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(appInfoAttributes, "id"),
+ "Should have an attribute called id.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema targetNamespace=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" version=\"1.0\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xml:lang=\"EN\">\r\n" +
+ "\r\n" +
+ " <xs:element name=\"schema\" id=\"schema\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:extension base=\"xs:openAttrs\">\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:element ref=\"xs:include\"/>\r\n" +
+ " <xs:element name=\"import\"/>\r\n" +
+ " <xs:element name=\"redefine\"/>\r\n" +
+ " <xs:element ref=\"xs:annotation\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " <xs:sequence minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:group ref=\"xs:schemaTop\"/>\r\n" +
+ " <xs:element ref=\"xs:annotation\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"targetNamespace\" type=\"xs:anyURI\"/>\r\n" +
+ " <xs:attribute name=\"version\" type=\"xs:token\"/>\r\n" +
+ " <xs:attribute name=\"finalDefault\" type=\"xs:fullDerivationSet\" use=\"optional\" default=\"\"/>\r\n" +
+ " <xs:attribute name=\"blockDefault\" type=\"xs:blockSet\" use=\"optional\" default=\"\"/>\r\n" +
+ " <xs:attribute name=\"attributeFormDefault\" type=\"xs:formChoice\" use=\"optional\" default=\"unqualified\"/>\r\n" +
+ " <xs:attribute name=\"elementFormDefault\" type=\"xs:formChoice\" use=\"optional\" default=\"unqualified\"/>\r\n" +
+ " <xs:attribute name=\"id\" type=\"xs:ID\"/>\r\n" +
+ " <xs:attribute ref=\"xml:lang\"/>\r\n" +
+ " </xs:extension>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ "\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "<xs:complexType name=\"openAttrs\">\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:restriction base=\"xs:anyType\">\r\n" +
+ " <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\r\n" +
+ " </xs:restriction>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ "<xs:complexType name=\"anyType\" mixed=\"true\">\r\n" +
+ " <xs:annotation>\r\n" +
+ " <xs:documentation>\r\n" +
+ " Not the real urType, but as close an approximation as we can\r\n" +
+ " get in the XML representation</xs:documentation>\r\n" +
+ " </xs:annotation>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"lax\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:anyAttribute processContents=\"lax\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ "<xs:element name=\"include\" id=\"include\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:attribute name=\"schemaLocation\" type=\"xs:anyURI\" use=\"required\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "<xs:element name=\"annotation\" id=\"annotation\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:extension base=\"xs:openAttrs\">\r\n" +
+ " <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:element ref=\"xs:appinfo\"/>\r\n" +
+ " <xs:element name=\"documentation\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " <xs:attribute name=\"id\" type=\"xs:ID\"/>\r\n" +
+ " </xs:extension>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:group name=\"schemaTop\">\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:element name=\"element\"/>\r\n" +
+ " <xs:element name=\"attribute\"/>\r\n" +
+ " <xs:element name=\"notation\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:group>\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "<xs:element name=\"appinfo\" id=\"appinfo\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:attribute name=\"id\" type=\"xs:anyURI\" use=\"required\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "\r\n" +
+ " <xs:element name=\"foo\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:extension base=\"xs:fooBase\">\r\n" +
+ " <xs:attribute name=\"id\" type=\"xs:ID\"/>\r\n" +
+ " </xs:extension>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "<xs:complexType name=\"fooBase\">\r\n" +
+ " <xs:attribute name=\"class\" type=\"xs:string\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/FindAttributeFromComplexTypeTestFixture.cs b/main/src/addins/Xml/Tests/Schema/FindAttributeFromComplexTypeTestFixture.cs
new file mode 100644
index 0000000000..1a4dc4bf83
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/FindAttributeFromComplexTypeTestFixture.cs
@@ -0,0 +1,49 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using System.Xml.Schema;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Element that has a single attribute.
+ /// </summary>
+ [TestFixture]
+ public class FindAttributeFromComplexTypeFixture : SchemaTestFixtureBase
+ {
+ XmlSchemaAttribute attribute;
+ XmlSchemaAttribute missingAttribute;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ XmlSchemaElement element = SchemaCompletionData.FindElement(path);
+ attribute = SchemaCompletionData.FindAttribute(element, "name");
+ missingAttribute = SchemaCompletionData.FindAttribute(element, "missing");
+ }
+
+ [Test]
+ public void AttributeFound()
+ {
+ Assert.IsNotNull(attribute);
+ }
+
+ [Test]
+ public void CannotFindUnknownAttribute()
+ {
+ Assert.IsNull(missingAttribute);
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ " <xs:element name=\"note\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/GroupRefCompositorTestFixture.cs b/main/src/addins/Xml/Tests/Schema/GroupRefCompositorTestFixture.cs
new file mode 100644
index 0000000000..6e6cb086f6
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/GroupRefCompositorTestFixture.cs
@@ -0,0 +1,81 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that autocompletion data is correct for an xml schema containing:
+ /// <![CDATA[ <xs:element name="foo">
+ /// <xs:group ref="myGroup"/>
+ /// </xs:element>
+ /// </]]>
+ /// </summary>
+ [TestFixture]
+ public class GroupRefAsCompositorTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList rootChildElements;
+ CompletionDataList fooAttributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("root", "http://foo"));
+
+ rootChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+
+ path.Elements.Add(new QualifiedName("foo", "http://foo"));
+
+ fooAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void RootHasTwoChildElements()
+ {
+ Assert.AreEqual(2, rootChildElements.Count,
+ "Should be two child elements.");
+ }
+
+ [Test]
+ public void RootChildElementIsFoo()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(rootChildElements, "foo"),
+ "Should have a child element called foo.");
+ }
+
+ [Test]
+ public void RootChildElementIsBar()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(rootChildElements, "bar"),
+ "Should have a child element called bar.");
+ }
+
+ [Test]
+ public void FooElementHasIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(fooAttributes, "id"),
+ "Should have an attribute called id.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://foo\" xmlns=\"http://foo\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"root\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:group ref=\"fooGroup\"/>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "\t<xs:group name=\"fooGroup\">\r\n" +
+ "\t\t<xs:choice>\r\n" +
+ "\t\t\t<xs:element name=\"foo\">\r\n" +
+ "\t\t\t\t<xs:complexType>\r\n" +
+ "\t\t\t\t\t<xs:attribute name=\"id\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t</xs:complexType>\r\n" +
+ "\t\t\t</xs:element>\r\n" +
+ "\t\t\t<xs:element name=\"bar\" type=\"xs:string\"/>\r\n" +
+ "\t\t</xs:choice>\r\n" +
+ "\t</xs:group>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/GroupRefTestFixture.cs b/main/src/addins/Xml/Tests/Schema/GroupRefTestFixture.cs
new file mode 100644
index 0000000000..25d87736df
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/GroupRefTestFixture.cs
@@ -0,0 +1,122 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests element group refs
+ /// </summary>
+ [TestFixture]
+ public class GroupRefTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList childElements;
+ CompletionDataList paraAttributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+
+ path.Elements.Add(new QualifiedName("html", "http://foo/xhtml"));
+ path.Elements.Add(new QualifiedName("body", "http://foo/xhtml"));
+
+ childElements = SchemaCompletionData.GetChildElementCompletionData(path);
+
+ path.Elements.Add(new QualifiedName("p", "http://foo/xhtml"));
+ paraAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void BodyHasFourChildElements()
+ {
+ Assert.AreEqual(4, childElements.Count,
+ "Should be 4 child elements.");
+ }
+
+ [Test]
+ public void BodyChildElementForm()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "form"),
+ "Should have a child element called form.");
+ }
+
+ [Test]
+ public void BodyChildElementPara()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "p"),
+ "Should have a child element called p.");
+ }
+
+ [Test]
+ public void BodyChildElementTest()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "test"),
+ "Should have a child element called test.");
+ }
+
+ [Test]
+ public void BodyChildElementId()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "id"),
+ "Should have a child element called id.");
+ }
+
+ [Test]
+ public void ParaElementHasIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(paraAttributes, "id"),
+ "Should have an attribute called id.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema version=\"1.0\" xml:lang=\"en\"\r\n" +
+ " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ " targetNamespace=\"http://foo/xhtml\"\r\n" +
+ " xmlns=\"http://foo/xhtml\"\r\n" +
+ " elementFormDefault=\"qualified\">\r\n" +
+ "\r\n" +
+ " <xs:element name=\"html\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element ref=\"head\"/>\r\n" +
+ " <xs:element ref=\"body\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"head\" type=\"xs:string\"/>\r\n" +
+ " <xs:element name=\"body\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:group ref=\"block\"/>\r\n" +
+ " <xs:element name=\"form\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "\r\n" +
+ " <xs:group name=\"block\">\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:element ref=\"p\"/>\r\n" +
+ " <xs:group ref=\"heading\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:group>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"p\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:attribute name=\"id\"/>" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:group name=\"heading\">\r\n" +
+ " <xs:choice>\r\n" +
+ " <xs:element name=\"test\"/>\r\n" +
+ " <xs:element name=\"id\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:group>\r\n" +
+ "\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/Includes/AttributeGroupRefSchemaIncludeTestFixture.cs b/main/src/addins/Xml/Tests/Schema/Includes/AttributeGroupRefSchemaIncludeTestFixture.cs
new file mode 100644
index 0000000000..e368466589
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/Includes/AttributeGroupRefSchemaIncludeTestFixture.cs
@@ -0,0 +1,37 @@
+using NUnit.Framework;
+using MonoDevelop.Xml.Completion;
+using MonoDevelop.Xml.Tests.Utils;
+using MonoDevelop.Xml.Tests.Schema;
+
+namespace MonoDevelop.Xml.Tests.Schema.Includes
+{
+ /// <summary>
+ /// Tests that schemas referenced via xs:include elements are used when
+ /// generating completion data.
+ /// </summary>
+ [TestFixture]
+ [Ignore]
+ public class AttributeGroupRefSchemaIncludeTestFixture : AttributeGroupRefTestFixture
+ {
+ [TestFixtureTearDown]
+ public void FixtureTearDown()
+ {
+ SchemaIncludeTestFixtureHelper.FixtureTearDown();
+ }
+
+ protected override XmlSchemaCompletionData CreateSchemaCompletionDataObject()
+ {
+ return SchemaIncludeTestFixtureHelper.CreateSchemaCompletionDataObject(GetMainSchema(), GetSchema());
+ }
+
+ string GetMainSchema()
+ {
+ return "<xs:schema \r\n" +
+ "targetNamespace=\"http://www.w3schools.com\" \r\n" +
+ "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" \r\n" +
+ "elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:include schemaLocation=\"include.xsd\"/>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/Includes/TwoElementSchemaIncludeTestFixture.cs b/main/src/addins/Xml/Tests/Schema/Includes/TwoElementSchemaIncludeTestFixture.cs
new file mode 100644
index 0000000000..197230c76e
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/Includes/TwoElementSchemaIncludeTestFixture.cs
@@ -0,0 +1,37 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using MonoDevelop.Xml.Tests.Utils;
+using MonoDevelop.Xml.Tests.Schema;
+
+namespace MonoDevelop.Xml.Tests.Schema.Includes
+{
+ /// <summary>
+ /// Tests that schemas referenced via xs:include elements are used when
+ /// generating completion data.
+ /// </summary>
+ [TestFixture]
+ [Ignore]
+ public class TwoElementSchemaIncludeTestFixture : TwoElementSchemaTestFixture
+ {
+ [TestFixtureTearDown]
+ public void FixtureTearDown()
+ {
+ SchemaIncludeTestFixtureHelper.FixtureTearDown();
+ }
+
+ protected override XmlSchemaCompletionData CreateSchemaCompletionDataObject()
+ {
+ return SchemaIncludeTestFixtureHelper.CreateSchemaCompletionDataObject(GetMainSchema(), GetSchema());
+ }
+
+ string GetMainSchema()
+ {
+ return "<xs:schema \r\n" +
+ "targetNamespace=\"http://www.w3schools.com\" \r\n" +
+ "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" \r\n" +
+ "elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:include schemaLocation=\"include.xsd\"/>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/MissingSchemaElementTestFixture.cs b/main/src/addins/Xml/Tests/Schema/MissingSchemaElementTestFixture.cs
new file mode 100644
index 0000000000..0736cbe62b
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/MissingSchemaElementTestFixture.cs
@@ -0,0 +1,47 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ [TestFixture]
+ public class MissingSchemaElementTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList barElementAttributes;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("root", "http://foo"));
+ path.Elements.Add(new QualifiedName("bar", "http://foo"));
+ barElementAttributes = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void BarHasOneAttribute()
+ {
+ Assert.AreEqual(1, barElementAttributes.Count, "Should have 1 attribute.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ " targetNamespace=\"http://foo\"\r\n" +
+ " xmlns=\"http://foo\"\r\n" +
+ " elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:complexType name=\"root\">\r\n" +
+ "\t\t<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ "\t\t\t<xs:element ref=\"foo\"/>\r\n" +
+ "\t\t\t<xs:element ref=\"bar\"/>\r\n" +
+ "\t\t</xs:choice>\r\n" +
+ "\t\t<xs:attribute name=\"id\" type=\"xs:string\" use=\"required\"/>\r\n" +
+ "\t</xs:complexType>\r\n" +
+ "\t<xs:element name=\"root\" type=\"root\"/>\r\n" +
+ "\t<xs:complexType name=\"bar\">\r\n" +
+ "\t\t<xs:attribute name=\"id\" type=\"xs:string\" use=\"required\"/>\r\n" +
+ "\t</xs:complexType>\r\n" +
+ "\t<xs:element name=\"bar\" type=\"bar\"/>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/NamespaceCompletionTestFixture.cs b/main/src/addins/Xml/Tests/Schema/NamespaceCompletionTestFixture.cs
new file mode 100644
index 0000000000..0cf108baec
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/NamespaceCompletionTestFixture.cs
@@ -0,0 +1,65 @@
+using MonoDevelop.Xml.Completion;
+using MonoDevelop.Ide.CodeCompletion;
+using NUnit.Framework;
+using System.IO;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// The collection of schemas should provide completion data for the
+ /// namespaces it holds.
+ /// </summary>
+ [TestFixture]
+ public class NamespaceCompletionTestFixture
+ {
+ CompletionDataList namespaceCompletionData;
+ string firstNamespace = "http://foo.com/foo.xsd";
+ string secondNamespace = "http://bar.com/bar.xsd";
+
+ [TestFixtureSetUp]
+ public void FixtureInit()
+ {
+ XmlSchemaCompletionDataCollection items = new XmlSchemaCompletionDataCollection();
+
+ StringReader reader = new StringReader(GetSchema(firstNamespace));
+ XmlSchemaCompletionData schema = new XmlSchemaCompletionData(reader);
+ items.Add(schema);
+
+ reader = new StringReader(GetSchema(secondNamespace));
+ schema = new XmlSchemaCompletionData(reader);
+ items.Add(schema);
+ namespaceCompletionData = new CompletionDataList(items.GetNamespaceCompletionData());
+ }
+
+ [Test]
+ public void NamespaceCount()
+ {
+ Assert.AreEqual(2, namespaceCompletionData.Count,
+ "Should be 2 namespaces.");
+ }
+
+ [Test]
+ public void ContainsFirstNamespace()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(namespaceCompletionData, firstNamespace));
+ }
+
+ [Test]
+ public void ContainsSecondNamespace()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(namespaceCompletionData, secondNamespace));
+ }
+
+ string GetSchema(string namespaceURI)
+ {
+ return "<?xml version=\"1.0\"?>\r\n" +
+ "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ "targetNamespace=\"" + namespaceURI + "\"\r\n" +
+ "xmlns=\"" + namespaceURI + "\"\r\n" +
+ "elementFormDefault=\"qualified\">\r\n" +
+ "<xs:element name=\"note\">\r\n" +
+ "</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/NestedAttributeGroupRefTestFixture.cs b/main/src/addins/Xml/Tests/Schema/NestedAttributeGroupRefTestFixture.cs
new file mode 100644
index 0000000000..fcb65fb900
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/NestedAttributeGroupRefTestFixture.cs
@@ -0,0 +1,100 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Element that uses an attribute group ref.
+ /// </summary>
+ [TestFixture]
+ public class NestedAttributeGroupRefTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributeCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ attributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void AttributeCount()
+ {
+ Assert.AreEqual(7, attributeCompletionData.Count, "Should be 7 attributes.");
+ }
+
+ [Test]
+ public void NameAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "name"),
+ "Attribute name does not exist.");
+ }
+
+ [Test]
+ public void IdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "id"),
+ "Attribute id does not exist.");
+ }
+
+ [Test]
+ public void StyleAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "style"),
+ "Attribute style does not exist.");
+ }
+
+ [Test]
+ public void TitleAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "title"),
+ "Attribute title does not exist.");
+ }
+
+ [Test]
+ public void BaseIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "baseid"),
+ "Attribute baseid does not exist.");
+ }
+
+ [Test]
+ public void BaseStyleAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "basestyle"),
+ "Attribute basestyle does not exist.");
+ }
+
+ [Test]
+ public void BaseTitleAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "basetitle"),
+ "Attribute basetitle does not exist.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "<xs:attributeGroup name=\"coreattrs\">" +
+ "\t<xs:attribute name=\"id\" type=\"xs:string\"/>" +
+ "\t<xs:attribute name=\"style\" type=\"xs:string\"/>" +
+ "\t<xs:attribute name=\"title\" type=\"xs:string\"/>" +
+ "\t<xs:attributeGroup ref=\"baseattrs\"/>" +
+ "</xs:attributeGroup>" +
+ "<xs:attributeGroup name=\"baseattrs\">" +
+ "\t<xs:attribute name=\"baseid\" type=\"xs:string\"/>" +
+ "\t<xs:attribute name=\"basestyle\" type=\"xs:string\"/>" +
+ "\t<xs:attribute name=\"basetitle\" type=\"xs:string\"/>" +
+ "</xs:attributeGroup>" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:attributeGroup ref=\"coreattrs\"/>" +
+ "\t\t\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/NestedChoiceTestFixture.cs b/main/src/addins/Xml/Tests/Schema/NestedChoiceTestFixture.cs
new file mode 100644
index 0000000000..3323065312
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/NestedChoiceTestFixture.cs
@@ -0,0 +1,90 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that nested schema choice elements are handled.
+ /// This happens in the NAnt schema 0.85.
+ /// </summary>
+ [TestFixture]
+ public class NestedChoiceTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList noteChildElements;
+ CompletionDataList titleChildElements;
+
+ public override void FixtureInit()
+ {
+ // Get note child elements.
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ noteChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+
+ // Get title child elements.
+ path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
+ titleChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void TitleHasTwoChildElements()
+ {
+ Assert.AreEqual(2, titleChildElements.Count,
+ "Should be 2 child elements.");
+ }
+
+ [Test]
+ public void TextHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("text", "http://www.w3schools.com"));
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void NoteHasTwoChildElements()
+ {
+ Assert.AreEqual(2, noteChildElements.Count,
+ "Should be two child elements.");
+ }
+
+ [Test]
+ public void NoteChildElementIsText()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "text"),
+ "Should have a child element called text.");
+ }
+
+ [Test]
+ public void NoteChildElementIsTitle()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "title"),
+ "Should have a child element called title.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:choice>\r\n" +
+ "\t\t\t\t<xs:element ref=\"title\"/>\r\n" +
+ "\t\t\t\t<xs:element name=\"text\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t</xs:choice>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "\t<xs:element name=\"title\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:choice>\r\n" +
+ "\t\t\t\t<xs:element name=\"foo\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t<xs:element name=\"bar\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t</xs:choice>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/NestedElementSchemaTestFixture.cs b/main/src/addins/Xml/Tests/Schema/NestedElementSchemaTestFixture.cs
new file mode 100644
index 0000000000..20e01b0c72
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/NestedElementSchemaTestFixture.cs
@@ -0,0 +1,47 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ [TestFixture]
+ public class NestedElementSchemaTestFixture : SchemaTestFixtureBase
+ {
+ XmlElementPath noteElementPath;
+ CompletionDataList elementData;
+
+ public override void FixtureInit()
+ {
+ noteElementPath = new XmlElementPath();
+ noteElementPath.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ elementData = SchemaCompletionData.GetChildElementCompletionData(noteElementPath);
+ }
+
+ [Test]
+ public void NoteHasOneChildElementCompletionDataItem()
+ {
+ Assert.AreEqual(1, elementData.Count, "Should be one child element completion data item.");
+ }
+
+ [Test]
+ public void NoteChildElementCompletionDataText()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(elementData, "text"),
+ "Should be one child element called text.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t<xs:element name=\"text\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/NestedSequenceTestFixture.cs b/main/src/addins/Xml/Tests/Schema/NestedSequenceTestFixture.cs
new file mode 100644
index 0000000000..c4b24ce395
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/NestedSequenceTestFixture.cs
@@ -0,0 +1,82 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that nested schema sequence elements are handled. This
+ /// happens in the NAnt schema 0.84.
+ /// </summary>
+ [TestFixture]
+ public class NestedSequenceSchemaTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList noteChildElements;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ noteChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void TitleHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void TextHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("text", "http://www.w3schools.com"));
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void NoteHasTwoChildElements()
+ {
+ Assert.AreEqual(2, noteChildElements.Count,
+ "Should be two child elements.");
+ }
+
+ [Test]
+ public void NoteChildElementIsText()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "text"),
+ "Should have a child element called text.");
+ }
+
+ [Test]
+ public void NoteChildElementIsTitle()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "title"),
+ "Should have a child element called title.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t\t\t<xs:element name=\"title\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t\t\t<xs:element name=\"text\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t\t</xs:sequence>\r\n" +
+ "\t\t\t\t</xs:sequence>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/ReferencedElementsTestFixture.cs b/main/src/addins/Xml/Tests/Schema/ReferencedElementsTestFixture.cs
new file mode 100644
index 0000000000..125925b3c5
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/ReferencedElementsTestFixture.cs
@@ -0,0 +1,128 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ [TestFixture]
+ public class ReferencedElementsTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList shipOrderAttributes;
+ CompletionDataList shipToAttributes;
+ XmlElementPath shipToPath;
+ XmlElementPath shipOrderPath;
+
+ public override void FixtureInit()
+ {
+ // Get shipto attributes.
+ shipToPath = new XmlElementPath();
+ QualifiedName shipOrderName = new QualifiedName("shiporder", "http://www.w3schools.com");
+ shipToPath.Elements.Add(shipOrderName);
+ shipToPath.Elements.Add(new QualifiedName("shipto", "http://www.w3schools.com"));
+
+ shipToAttributes = SchemaCompletionData.GetAttributeCompletionData(shipToPath);
+
+ // Get shiporder attributes.
+ shipOrderPath = new XmlElementPath();
+ shipOrderPath.Elements.Add(shipOrderName);
+
+ shipOrderAttributes = SchemaCompletionData.GetAttributeCompletionData(shipOrderPath);
+
+ }
+
+ [Test]
+ public void OneShipOrderAttribute()
+ {
+ Assert.AreEqual(1, shipOrderAttributes.Count, "Should only have one shiporder attribute.");
+ }
+
+ [Test]
+ public void ShipOrderAttributeName()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(shipOrderAttributes,"id"),
+ "Incorrect shiporder attribute name.");
+ }
+
+ [Test]
+ public void OneShipToAttribute()
+ {
+ Assert.AreEqual(1, shipToAttributes.Count, "Should only have one shipto attribute.");
+ }
+
+ [Test]
+ public void ShipToAttributeName()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(shipToAttributes, "address"),
+ "Incorrect shipto attribute name.");
+ }
+
+ [Test]
+ public void ShipOrderChildElementsCount()
+ {
+ Assert.AreEqual(1, SchemaCompletionData.GetChildElementCompletionData(shipOrderPath).Count,
+ "Should be one child element.");
+ }
+
+ [Test]
+ public void ShipOrderHasShipToChildElement()
+ {
+ CompletionDataList data = SchemaCompletionData.GetChildElementCompletionData(shipOrderPath);
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(data, "shipto"),
+ "Incorrect child element name.");
+ }
+
+ [Test]
+ public void ShipToChildElementsCount()
+ {
+ Assert.AreEqual(2, SchemaCompletionData.GetChildElementCompletionData(shipToPath).Count,
+ "Should be 2 child elements.");
+ }
+
+ [Test]
+ public void ShipToHasNameChildElement()
+ {
+ CompletionDataList data = SchemaCompletionData.GetChildElementCompletionData(shipToPath);
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(data, "name"),
+ "Incorrect child element name.");
+ }
+
+ [Test]
+ public void ShipToHasAddressChildElement()
+ {
+ CompletionDataList data = SchemaCompletionData.GetChildElementCompletionData(shipToPath);
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(data, "address"),
+ "Incorrect child element name.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\">\r\n" +
+ "\r\n" +
+ "<!-- definition of simple elements -->\r\n" +
+ "<xs:element name=\"name\" type=\"xs:string\"/>\r\n" +
+ "<xs:element name=\"address\" type=\"xs:string\"/>\r\n" +
+ "\r\n" +
+ "<!-- definition of complex elements -->\r\n" +
+ "<xs:element name=\"shipto\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element ref=\"name\"/>\r\n" +
+ " <xs:element ref=\"address\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"address\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ "</xs:element>\r\n" +
+ "\r\n" +
+ "<xs:element name=\"shiporder\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element ref=\"shipto\"/>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"id\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ "</xs:element>\r\n" +
+ "\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/RestrictionElementTestFixture.cs b/main/src/addins/Xml/Tests/Schema/RestrictionElementTestFixture.cs
new file mode 100644
index 0000000000..44e3075cee
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/RestrictionElementTestFixture.cs
@@ -0,0 +1,144 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests complex content restriction elements.
+ /// </summary>
+ [TestFixture]
+ public class RestrictionElementTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList childElements;
+ CompletionDataList attributes;
+ CompletionDataList annotationChildElements;
+ CompletionDataList choiceChildElements;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("group", "http://www.w3.org/2001/XMLSchema"));
+ childElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ attributes = SchemaCompletionData.GetAttributeCompletionData(path);
+
+ // Get annotation child elements.
+ path.Elements.Add(new QualifiedName("annotation", "http://www.w3.org/2001/XMLSchema"));
+ annotationChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+
+ // Get choice child elements.
+ path.Elements.RemoveAt (path.Elements.Count - 1);
+ path.Elements.Add(new QualifiedName("choice", "http://www.w3.org/2001/XMLSchema"));
+ choiceChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void GroupChildElementIsAnnotation()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "annotation"),
+ "Should have a child element called annotation.");
+ }
+
+ [Test]
+ public void GroupChildElementIsChoice()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "choice"),
+ "Should have a child element called choice.");
+ }
+
+ [Test]
+ public void GroupChildElementIsSequence()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(childElements, "sequence"),
+ "Should have a child element called sequence.");
+ }
+
+ [Test]
+ public void GroupAttributeIsName()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributes, "name"),
+ "Should have an attribute called name.");
+ }
+
+ [Test]
+ public void AnnotationChildElementIsAppInfo()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(annotationChildElements, "appinfo"),
+ "Should have a child element called appinfo.");
+ }
+
+ [Test]
+ public void AnnotationChildElementIsDocumentation()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(annotationChildElements, "documentation"),
+ "Should have a child element called appinfo.");
+ }
+
+ [Test]
+ public void ChoiceChildElementIsSequence()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(choiceChildElements, "element"),
+ "Should have a child element called element.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema targetNamespace=\"http://www.w3.org/2001/XMLSchema\" blockDefault=\"#all\" elementFormDefault=\"qualified\" version=\"1.0\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xml:lang=\"EN\" xmlns:hfp=\"http://www.w3.org/2001/XMLSchema-hasFacetAndProperty\">\r\n" +
+ "\r\n" +
+ " <xs:element name=\"group\" type=\"xs:namedGroup\" id=\"group\">\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"annotation\" id=\"annotation\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n" +
+ " <xs:element name=\"appinfo\"/>\r\n" +
+ " <xs:element name=\"documentation\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " <xs:attribute name=\"id\" type=\"xs:ID\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "\r\n" +
+ "\r\n" +
+ " <xs:complexType name=\"namedGroup\">\r\n" +
+ " <xs:complexContent>\r\n" +
+ " <xs:restriction base=\"xs:realGroup\">\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element ref=\"xs:annotation\" minOccurs=\"0\"/>\r\n" +
+ " <xs:choice minOccurs=\"1\" maxOccurs=\"1\">\r\n" +
+ " <xs:element ref=\"xs:choice\"/>\r\n" +
+ " <xs:element name=\"sequence\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:attribute name=\"name\" use=\"required\" type=\"xs:NCName\"/>\r\n" +
+ " <xs:attribute name=\"ref\" use=\"prohibited\"/>\r\n" +
+ " <xs:attribute name=\"minOccurs\" use=\"prohibited\"/>\r\n" +
+ " <xs:attribute name=\"maxOccurs\" use=\"prohibited\"/>\r\n" +
+ " <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\r\n" +
+ " </xs:restriction>\r\n" +
+ " </xs:complexContent>\r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ " <xs:complexType name=\"realGroup\">\r\n" +
+ " <xs:sequence>\r\n" +
+ " <xs:element ref=\"xs:annotation\" minOccurs=\"0\"/>\r\n" +
+ " <xs:choice minOccurs=\"0\" maxOccurs=\"1\">\r\n" +
+ " <xs:element name=\"all\"/>\r\n" +
+ " <xs:element ref=\"xs:choice\"/>\r\n" +
+ " <xs:element name=\"sequence\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:sequence>\r\n" +
+ " <xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\r\n" +
+ " </xs:complexType>\r\n" +
+ "\r\n" +
+ " <xs:element name=\"choice\" id=\"choice\">\r\n" +
+ " <xs:complexType>\r\n" +
+ " <xs:choice minOccurs=\"0\" maxOccurs=\"1\">\r\n" +
+ " <xs:element name=\"element\"/>\r\n" +
+ " <xs:element name=\"sequence\"/>\r\n" +
+ " </xs:choice>\r\n" +
+ " </xs:complexType>\r\n" +
+ " </xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/SchemaAssociationTests.cs b/main/src/addins/Xml/Tests/Schema/SchemaAssociationTests.cs
new file mode 100644
index 0000000000..c9603ff192
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/SchemaAssociationTests.cs
@@ -0,0 +1,63 @@
+using NUnit.Framework;
+using System.IO;
+using System.Text;
+using System.Xml;
+using MonoDevelop.Xml.Editor;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ [TestFixture]
+ public class SchemaAssociationTests
+ {
+ StringBuilder xml;
+ XmlWriter writer;
+
+ [SetUp]
+ public void Init ()
+ {
+ xml = new StringBuilder ();
+ XmlWriterSettings settings = new XmlWriterSettings ();
+ settings.Indent = true;
+ settings.OmitXmlDeclaration = true;
+ settings.IndentChars = "\t";
+ writer = XmlWriter.Create (xml, settings);
+ }
+
+ [Test]
+ [Platform (Exclude = "Win")]
+ public void ToXml()
+ {
+ XmlFileAssociation schema = new XmlFileAssociation (".xml", "http://mono-project.com", null);
+ schema.WriteTo(writer);
+
+ string expectedXml = "<SchemaAssociation extension=\".xml\" namespace=\"http://mono-project.com\" prefix=\"\" />";
+ Assert.AreEqual(expectedXml, xml.ToString());
+ }
+
+ [Test]
+ [Platform (Exclude = "Win")]
+ public void FromXml()
+ {
+ XmlFileAssociation expectedSchema = new XmlFileAssociation (".xml", "http://mono-project.com", null);
+ expectedSchema.WriteTo(writer);
+
+ string propertiesXml = "<SerializedNode>" + xml.ToString() + "</SerializedNode>";
+ XmlTextReader reader = new XmlTextReader (new StringReader(propertiesXml));
+ XmlFileAssociation schema = new XmlFileAssociation ();
+ schema = (XmlFileAssociation)schema.ReadFrom (reader);
+
+ Assert.AreEqual(expectedSchema.Extension, schema.Extension);
+ Assert.AreEqual(expectedSchema.NamespacePrefix, schema.NamespacePrefix);
+ Assert.AreEqual(expectedSchema.NamespaceUri, schema.NamespaceUri);
+ }
+
+ [Test]
+ public void FromXmlMissingSchemaAssociation()
+ {
+ string propertiesXml = "<SerializedNode/>";
+ XmlTextReader reader = new XmlTextReader(new StringReader(propertiesXml));
+ XmlFileAssociation schema = new XmlFileAssociation();
+ Assert.IsNull(schema.ReadFrom (reader));
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/SchemaTestFixtureBase.cs b/main/src/addins/Xml/Tests/Schema/SchemaTestFixtureBase.cs
new file mode 100644
index 0000000000..5997a316bd
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/SchemaTestFixtureBase.cs
@@ -0,0 +1,121 @@
+using ICSharpCode.NRefactory.Completion;
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ [TestFixture]
+ public abstract class SchemaTestFixtureBase
+ {
+ XmlSchemaCompletionData schemaCompletionData;
+
+ /// <summary>
+ /// Gets the <see cref="XmlSchemaCompletionData"/> object generated
+ /// by this class.
+ /// </summary>
+ /// <remarks>This object will be null until the <see cref="FixtureInitBase"/>
+ /// has been run.</remarks>
+ public XmlSchemaCompletionData SchemaCompletionData {
+ get {
+ return schemaCompletionData;
+ }
+ }
+
+ /// <summary>
+ /// Creates the <see cref="XmlSchemaCompletionData"/> object from
+ /// the derived class's schema.
+ /// </summary>
+ /// <remarks>Calls <see cref="FixtureInit"/> at the end of the method.
+ /// </remarks>
+ [TestFixtureSetUp]
+ public void FixtureInitBase()
+ {
+ schemaCompletionData = CreateSchemaCompletionDataObject();
+ FixtureInit();
+ }
+
+ /// <summary>
+ /// Method overridden by derived class so it can execute its own
+ /// fixture initialisation.
+ /// </summary>
+ public virtual void FixtureInit()
+ {
+ }
+
+ /// <summary>
+ /// Checks whether the specified name exists in the completion data.
+ /// </summary>
+ public static bool Contains(CompletionDataList items, string name)
+ {
+ bool Contains = false;
+
+ foreach (ICompletionData data in items) {
+ if (data.DisplayText == name) {
+ Contains = true;
+ break;
+ }
+ }
+
+ return Contains;
+ }
+
+ /// <summary>
+ /// Checks whether the completion data specified by name has
+ /// the correct description.
+ /// </summary>
+ public static bool ContainsDescription(CompletionDataList items, string name, string description)
+ {
+ bool Contains = false;
+
+ foreach (ICompletionData data in items) {
+ if (data.DisplayText == name) {
+ if (data.Description == description) {
+ Contains = true;
+ break;
+ }
+ }
+ }
+
+ return Contains;
+ }
+
+ /// <summary>
+ /// Gets a count of the number of occurrences of a particular name
+ /// in the completion data.
+ /// </summary>
+ public static int GetItemCount(CompletionDataList items, string name)
+ {
+ int count = 0;
+
+ foreach (ICompletionData data in items) {
+ if (data.DisplayText == name) {
+ ++count;
+ }
+ }
+
+ return count;
+ }
+
+ /// <summary>
+ /// Returns the schema that will be used in this test fixture.
+ /// </summary>
+ /// <returns></returns>
+ protected virtual string GetSchema()
+ {
+ return String.Empty;
+ }
+
+ /// <summary>
+ /// Creates an <see cref="XmlSchemaCompletionData"/> object that
+ /// will be used in the test fixture.
+ /// </summary>
+ protected virtual XmlSchemaCompletionData CreateSchemaCompletionDataObject()
+ {
+ StringReader reader = new StringReader(GetSchema());
+ return new XmlSchemaCompletionData(reader);
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/SequencedChoiceTestFixture.cs b/main/src/addins/Xml/Tests/Schema/SequencedChoiceTestFixture.cs
new file mode 100644
index 0000000000..1d043b61c9
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/SequencedChoiceTestFixture.cs
@@ -0,0 +1,83 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that nested schema choice elements inside a sequence are handled.
+ /// This happens in the NAnt schema 0.85.
+ /// </summary>
+ [TestFixture]
+ public class SequencedChoiceTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList noteChildElements;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ noteChildElements = SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void TitleHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
+
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void TextHasNoChildElements()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+ path.Elements.Add(new QualifiedName("title", "http://www.w3schools.com"));
+
+ Assert.AreEqual(0, SchemaCompletionData.GetChildElementCompletionData(path).Count,
+ "Should be no child elements.");
+ }
+
+ [Test]
+ public void NoteHasTwoChildElements()
+ {
+ Assert.AreEqual(2, noteChildElements.Count,
+ "Should be two child elements.");
+ }
+
+ [Test]
+ public void NoteChildElementIsText()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "text"),
+ "Should have a child element called text.");
+ }
+
+ [Test]
+ public void NoteChildElementIsTitle()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(noteChildElements, "title"),
+ "Should have a child element called title.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t<xs:choice>\r\n" +
+ "\t\t\t\t\t<xs:element name=\"title\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t\t<xs:element name=\"text\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t</xs:choice>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/SimpleContentWithAttributeTestFixture.cs b/main/src/addins/Xml/Tests/Schema/SimpleContentWithAttributeTestFixture.cs
new file mode 100644
index 0000000000..b83fc5e7e2
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/SimpleContentWithAttributeTestFixture.cs
@@ -0,0 +1,59 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Element that is a simple content type.
+ /// </summary>
+ [TestFixture]
+ public class SimpleContentWithAttributeSchemaTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList attributeCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
+
+ attributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
+ }
+
+ [Test]
+ public void BarAttributeExists()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "bar"),
+ "Attribute bar does not exist.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ "\ttargetNamespace=\"http://foo.com\"\r\n" +
+ "\txmlns=\"http://foo.com\">\r\n" +
+ "\t<xs:element name=\"foo\">\r\n" +
+ "\t\t<xs:complexType>\r\n" +
+ "\t\t\t<xs:simpleContent>\r\n" +
+ "\t\t\t\t<xs:extension base=\"xs:string\">\r\n" +
+ "\t\t\t\t\t<xs:attribute name=\"bar\">\r\n" +
+ "\t\t\t\t\t\t<xs:simpleType>\r\n" +
+ "\t\t\t\t\t\t\t<xs:restriction base=\"xs:NMTOKEN\">\r\n" +
+ "\t\t\t\t\t\t\t\t<xs:enumeration value=\"default\"/>\r\n" +
+ "\t\t\t\t\t\t\t\t<xs:enumeration value=\"enable\"/>\r\n" +
+ "\t\t\t\t\t\t\t\t<xs:enumeration value=\"disable\"/>\r\n" +
+ "\t\t\t\t\t\t\t\t<xs:enumeration value=\"hide\"/>\r\n" +
+ "\t\t\t\t\t\t\t\t<xs:enumeration value=\"show\"/>\r\n" +
+ "\t\t\t\t\t\t\t</xs:restriction>\r\n" +
+ "\t\t\t\t\t\t</xs:simpleType>\r\n" +
+ "\t\t\t\t\t</xs:attribute>\r\n" +
+ "\t\t\t\t\t<xs:attribute name=\"id\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t\t<xs:attribute name=\"msg\" type=\"xs:string\"/>\r\n" +
+ "\t\t\t\t</xs:extension>\r\n" +
+ "\t\t\t</xs:simpleContent>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/SingleElementSchemaTestFixture.cs b/main/src/addins/Xml/Tests/Schema/SingleElementSchemaTestFixture.cs
new file mode 100644
index 0000000000..46cf1e2c70
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/SingleElementSchemaTestFixture.cs
@@ -0,0 +1,63 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Retrieve completion data for an xml schema that specifies only one
+ /// element.
+ /// </summary>
+ [TestFixture]
+ public class SingleElementSchemaTestFixture : SchemaTestFixtureBase
+ {
+ CompletionDataList childElementCompletionData;
+ CompletionDataList attributeCompletionData;
+
+ public override void FixtureInit()
+ {
+ XmlElementPath path = new XmlElementPath();
+ path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
+
+ attributeCompletionData =
+ SchemaCompletionData.GetAttributeCompletionData(path);
+
+ childElementCompletionData =
+ SchemaCompletionData.GetChildElementCompletionData(path);
+ }
+
+ [Test]
+ public void NamespaceUri()
+ {
+ Assert.AreEqual("http://www.w3schools.com",
+ SchemaCompletionData.NamespaceUri,
+ "Unexpected namespace.");
+ }
+
+ [Test]
+ public void NoteElementHasNoAttributes()
+ {
+ Assert.AreEqual(0, attributeCompletionData.Count,
+ "Not expecting any attributes.");
+ }
+
+ [Test]
+ public void NoteElementHasNoChildElements()
+ {
+ Assert.AreEqual(0, childElementCompletionData.Count, "" +
+ "Not expecting any child elements.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<?xml version=\"1.0\"?>\r\n" +
+ "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\r\n" +
+ "targetNamespace=\"http://www.w3schools.com\"\r\n" +
+ "xmlns=\"http://www.w3schools.com\"\r\n" +
+ "elementFormDefault=\"qualified\">\r\n" +
+ "<xs:element name=\"note\">\r\n" +
+ "</xs:element>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/TwoElementSchemaTestFixture.cs b/main/src/addins/Xml/Tests/Schema/TwoElementSchemaTestFixture.cs
new file mode 100644
index 0000000000..3d101f7e23
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/TwoElementSchemaTestFixture.cs
@@ -0,0 +1,102 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Two elements defined in a schema, one uses the 'type' attribute to
+ /// link to the complex type definition.
+ /// </summary>
+ [TestFixture]
+ public class TwoElementSchemaTestFixture : SchemaTestFixtureBase
+ {
+ XmlElementPath noteElementPath;
+ XmlElementPath textElementPath;
+
+ public override void FixtureInit()
+ {
+ // Note element path.
+ noteElementPath = new XmlElementPath();
+ QualifiedName noteQualifiedName = new QualifiedName("note", "http://www.w3schools.com");
+ noteElementPath.Elements.Add(noteQualifiedName);
+
+ // Text element path.
+ textElementPath = new XmlElementPath();
+ textElementPath.Elements.Add(noteQualifiedName);
+ textElementPath.Elements.Add(new QualifiedName("text", "http://www.w3schools.com"));
+ }
+
+ [Test]
+ public void TextElementHasOneAttribute()
+ {
+ CompletionDataList attributesCompletionData = SchemaCompletionData.GetAttributeCompletionData(textElementPath);
+
+ Assert.AreEqual(1, attributesCompletionData.Count,
+ "Should have 1 text attribute.");
+ }
+
+ [Test]
+ public void TextElementAttributeName()
+ {
+ CompletionDataList attributesCompletionData = SchemaCompletionData.GetAttributeCompletionData(textElementPath);
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(attributesCompletionData, "foo"),
+ "Unexpected text attribute name.");
+ }
+
+ [Test]
+ public void NoteElementHasChildElement()
+ {
+ CompletionDataList childElementCompletionData
+ = SchemaCompletionData.GetChildElementCompletionData(noteElementPath);
+
+ Assert.AreEqual(1, childElementCompletionData.Count,
+ "Should be one child.");
+ }
+
+ [Test]
+ public void NoteElementHasNoAttributes()
+ {
+ CompletionDataList attributeCompletionData
+ = SchemaCompletionData.GetAttributeCompletionData(noteElementPath);
+
+ Assert.AreEqual(0, attributeCompletionData.Count,
+ "Should no attributes.");
+ }
+
+ [Test]
+ public void OneRootElement()
+ {
+ CompletionDataList elementCompletionData
+ = SchemaCompletionData.GetElementCompletionData();
+
+ Assert.AreEqual(1, elementCompletionData.Count, "Should be 1 root element.");
+ }
+
+ [Test]
+ public void RootElementIsNote()
+ {
+ CompletionDataList elementCompletionData
+ = SchemaCompletionData.GetElementCompletionData();
+
+ Assert.IsTrue(Contains(elementCompletionData, "note"),
+ "Should be called note.");
+ }
+
+ protected override string GetSchema()
+ {
+ return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
+ "\t<xs:element name=\"note\">\r\n" +
+ "\t\t<xs:complexType> \r\n" +
+ "\t\t\t<xs:sequence>\r\n" +
+ "\t\t\t\t<xs:element name=\"text\" type=\"text-type\"/>\r\n" +
+ "\t\t\t</xs:sequence>\r\n" +
+ "\t\t</xs:complexType>\r\n" +
+ "\t</xs:element>\r\n" +
+ "\t<xs:complexType name=\"text-type\">\r\n" +
+ "\t\t<xs:attribute name=\"foo\"/>\r\n" +
+ "\t</xs:complexType>\r\n" +
+ "</xs:schema>";
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/Uri/GetUriTestFixture.cs b/main/src/addins/Xml/Tests/Schema/Uri/GetUriTestFixture.cs
new file mode 100644
index 0000000000..09b261034a
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/Uri/GetUriTestFixture.cs
@@ -0,0 +1,34 @@
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using System;
+
+namespace MonoDevelop.Xml.Tests.Schema.Uri
+{
+ /// <summary>
+ /// Tests the <see cref="XmlSchemaCompletionData.GetUri"/> method.
+ /// </summary>
+ [TestFixture]
+ public class GetUriTestFixture
+ {
+ [Test]
+ public void SimpleFileName()
+ {
+ string fileName = @"C:\temp\foo.xml";
+ string expectedUri = "file:///C:/temp/foo.xml";
+
+ Assert.AreEqual(expectedUri, XmlSchemaCompletionData.GetUri(fileName));
+ }
+
+ [Test]
+ public void NullFileName()
+ {
+ Assert.AreEqual(String.Empty, XmlSchemaCompletionData.GetUri(null));
+ }
+
+ [Test]
+ public void EmptyString()
+ {
+ Assert.AreEqual(String.Empty, XmlSchemaCompletionData.GetUri(String.Empty));
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/XhtmlStrictSchemaTestFixture.cs b/main/src/addins/Xml/Tests/Schema/XhtmlStrictSchemaTestFixture.cs
new file mode 100644
index 0000000000..1082b73df2
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/XhtmlStrictSchemaTestFixture.cs
@@ -0,0 +1,42 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using System.Xml;
+using MonoDevelop.Xml.Tests.Utils;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests the xhtml1-strict schema.
+ /// </summary>
+ [TestFixture]
+ public class XhtmlStrictSchemaTestFixture
+ {
+ XmlSchemaCompletionData schemaCompletionData;
+ XmlElementPath h1Path;
+ CompletionDataList h1Attributes;
+ string namespaceURI = "http://www.w3.org/1999/xhtml";
+
+ [TestFixtureSetUp]
+ public void FixtureInit()
+ {
+ XmlTextReader reader = ResourceManager.GetXhtmlStrictSchema();
+ schemaCompletionData = new XmlSchemaCompletionData(reader);
+
+ // Set up h1 element's path.
+ h1Path = new XmlElementPath();
+ h1Path.Elements.Add(new QualifiedName("html", namespaceURI));
+ h1Path.Elements.Add(new QualifiedName("body", namespaceURI));
+ h1Path.Elements.Add(new QualifiedName("h1", namespaceURI));
+
+ // Get h1 element info.
+ h1Attributes = schemaCompletionData.GetAttributeCompletionData(h1Path);
+ }
+
+ [Test]
+ public void H1HasAttributes()
+ {
+ Assert.IsTrue(h1Attributes.Count > 0, "Should have at least one attribute.");
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/XmlSchemaNamespaceTests.cs b/main/src/addins/Xml/Tests/Schema/XmlSchemaNamespaceTests.cs
new file mode 100644
index 0000000000..e1954c8c64
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/XmlSchemaNamespaceTests.cs
@@ -0,0 +1,31 @@
+using MonoDevelop.Xml.Editor;
+using NUnit.Framework;
+using System;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests that the standard W3C namespace for XSD files is recognised.
+ /// </summary>
+ [TestFixture]
+ public class XmlSchemaNamespaceTests
+ {
+ [Test]
+ public void IsXmlSchemaNamespace()
+ {
+ Assert.IsTrue(XmlSchemaManager.IsXmlSchemaNamespace("http://www.w3.org/2001/XMLSchema"));
+ }
+
+ [Test]
+ public void IsNotXmlSchemaNamespace()
+ {
+ Assert.IsFalse(XmlSchemaManager.IsXmlSchemaNamespace("http://foo.com"));
+ }
+
+ [Test]
+ public void EmptyString()
+ {
+ Assert.IsFalse(XmlSchemaManager.IsXmlSchemaNamespace(String.Empty));
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Schema/XsdSchemaTestFixture.cs b/main/src/addins/Xml/Tests/Schema/XsdSchemaTestFixture.cs
new file mode 100644
index 0000000000..2a436d7e41
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Schema/XsdSchemaTestFixture.cs
@@ -0,0 +1,249 @@
+using MonoDevelop.Ide.CodeCompletion;
+using MonoDevelop.Xml.Completion;
+using NUnit.Framework;
+using System.Xml;
+using MonoDevelop.Xml.Tests.Utils;
+
+namespace MonoDevelop.Xml.Tests.Schema
+{
+ /// <summary>
+ /// Tests the xsd schema.
+ /// </summary>
+ [TestFixture]
+ public class XsdSchemaTestFixture
+ {
+ XmlSchemaCompletionData schemaCompletionData;
+ XmlElementPath choicePath;
+ XmlElementPath elementPath;
+ XmlElementPath simpleEnumPath;
+ XmlElementPath enumPath;
+ XmlElementPath allElementPath;
+ XmlElementPath allElementAnnotationPath;
+ CompletionDataList choiceAttributes;
+ CompletionDataList elementAttributes;
+ CompletionDataList simpleEnumElements;
+ CompletionDataList enumAttributes;
+ CompletionDataList elementFormDefaultAttributeValues;
+ CompletionDataList blockDefaultAttributeValues;
+ CompletionDataList finalDefaultAttributeValues;
+ CompletionDataList mixedAttributeValues;
+ CompletionDataList maxOccursAttributeValues;
+ CompletionDataList allElementChildElements;
+ CompletionDataList allElementAnnotationChildElements;
+
+ string namespaceURI = "http://www.w3.org/2001/XMLSchema";
+ string prefix = "xs";
+
+ [TestFixtureSetUp]
+ public void FixtureInit()
+ {
+ XmlTextReader reader = ResourceManager.GetXsdSchema();
+ schemaCompletionData = new XmlSchemaCompletionData(reader);
+
+ // Set up choice element's path.
+ choicePath = new XmlElementPath();
+ choicePath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));
+ choicePath.Elements.Add(new QualifiedName("element", namespaceURI, prefix));
+ choicePath.Elements.Add(new QualifiedName("complexType", namespaceURI, prefix));
+
+ mixedAttributeValues = schemaCompletionData.GetAttributeValueCompletionData(choicePath, "mixed");
+
+ choicePath.Elements.Add(new QualifiedName("choice", namespaceURI, prefix));
+
+ // Get choice element info.
+ choiceAttributes = schemaCompletionData.GetAttributeCompletionData(choicePath);
+ maxOccursAttributeValues = schemaCompletionData.GetAttributeValueCompletionData(choicePath, "maxOccurs");
+
+ // Set up element path.
+ elementPath = new XmlElementPath();
+ elementPath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));
+
+ elementFormDefaultAttributeValues = schemaCompletionData.GetAttributeValueCompletionData(elementPath, "elementFormDefault");
+ blockDefaultAttributeValues = schemaCompletionData.GetAttributeValueCompletionData(elementPath, "blockDefault");
+ finalDefaultAttributeValues = schemaCompletionData.GetAttributeValueCompletionData(elementPath, "finalDefault");
+
+ elementPath.Elements.Add(new QualifiedName("element", namespaceURI, prefix));
+
+ // Get element attribute info.
+ elementAttributes = schemaCompletionData.GetAttributeCompletionData(elementPath);
+
+ // Set up simple enum type path.
+ simpleEnumPath = new XmlElementPath();
+ simpleEnumPath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));
+ simpleEnumPath.Elements.Add(new QualifiedName("simpleType", namespaceURI, prefix));
+ simpleEnumPath.Elements.Add(new QualifiedName("restriction", namespaceURI, prefix));
+
+ // Get child elements.
+ simpleEnumElements = schemaCompletionData.GetChildElementCompletionData(simpleEnumPath);
+
+ // Set up enum path.
+ enumPath = new XmlElementPath();
+ enumPath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));
+ enumPath.Elements.Add(new QualifiedName("simpleType", namespaceURI, prefix));
+ enumPath.Elements.Add(new QualifiedName("restriction", namespaceURI, prefix));
+ enumPath.Elements.Add(new QualifiedName("enumeration", namespaceURI, prefix));
+
+ // Get attributes.
+ enumAttributes = schemaCompletionData.GetAttributeCompletionData(enumPath);
+
+ // Set up xs:all path.
+ allElementPath = new XmlElementPath();
+ allElementPath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));
+ allElementPath.Elements.Add(new QualifiedName("element", namespaceURI, prefix));
+ allElementPath.Elements.Add(new QualifiedName("complexType", namespaceURI, prefix));
+ allElementPath.Elements.Add(new QualifiedName("all", namespaceURI, prefix));
+
+ // Get child elements of the xs:all element.
+ allElementChildElements = schemaCompletionData.GetChildElementCompletionData(allElementPath);
+
+ // Set up the path to the annotation element that is a child of xs:all.
+ allElementAnnotationPath = new XmlElementPath();
+ allElementAnnotationPath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));
+ allElementAnnotationPath.Elements.Add(new QualifiedName("element", namespaceURI, prefix));
+ allElementAnnotationPath.Elements.Add(new QualifiedName("complexType", namespaceURI, prefix));
+ allElementAnnotationPath.Elements.Add(new QualifiedName("all", namespaceURI, prefix));
+ allElementAnnotationPath.Elements.Add(new QualifiedName("annotation", namespaceURI, prefix));
+
+ // Get the xs:all annotation child element.
+ allElementAnnotationChildElements = schemaCompletionData.GetChildElementCompletionData(allElementAnnotationPath);
+ }
+
+ [Test]
+ public void ChoiceHasAttributes()
+ {
+ Assert.IsTrue(choiceAttributes.Count > 0, "Should have at least one attribute.");
+ }
+
+ [Test]
+ public void ChoiceHasMinOccursAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(choiceAttributes, "minOccurs"),
+ "Attribute minOccurs missing.");
+ }
+
+ [Test]
+ public void ChoiceHasMaxOccursAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(choiceAttributes, "maxOccurs"),
+ "Attribute maxOccurs missing.");
+ }
+
+ /// <summary>
+ /// Tests that prohibited attributes are not added to the completion data.
+ /// </summary>
+ [Test]
+ public void ChoiceDoesNotHaveNameAttribute()
+ {
+ Assert.IsFalse(SchemaTestFixtureBase.Contains(choiceAttributes, "name"),
+ "Attribute name should not exist.");
+ }
+
+ /// <summary>
+ /// Tests that prohibited attributes are not added to the completion data.
+ /// </summary>
+ [Test]
+ public void ChoiceDoesNotHaveRefAttribute()
+ {
+ Assert.IsFalse(SchemaTestFixtureBase.Contains(choiceAttributes, "ref"),
+ "Attribute ref should not exist.");
+ }
+
+ /// <summary>
+ /// Duplicate attribute test.
+ /// </summary>
+ [Test]
+ public void ElementNameAttributeAppearsOnce()
+ {
+ int nameAttributeCount = SchemaTestFixtureBase.GetItemCount(elementAttributes, "name");
+ Assert.AreEqual(1, nameAttributeCount, "Should be only one name attribute.");
+ }
+
+ [Test]
+ public void ElementHasIdAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(elementAttributes, "id"),
+ "id attribute missing.");
+ }
+
+ [Test]
+ public void SimpleRestrictionTypeHasEnumChildElement()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(simpleEnumElements, "xs:enumeration"),
+ "enumeration element missing.");
+ }
+
+ [Test]
+ public void EnumHasValueAttribute()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(enumAttributes, "value"),
+ "Attribute value missing.");
+ }
+
+ [Test]
+ public void ElementFormDefaultAttributeHasValueQualified()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(elementFormDefaultAttributeValues, "qualified"),
+ "Attribute value 'qualified' missing.");
+ }
+
+ [Test]
+ public void BlockDefaultAttributeHasValueAll()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(blockDefaultAttributeValues, "#all"),
+ "Attribute value '#all' missing.");
+ }
+
+ [Test]
+ public void BlockDefaultAttributeHasValueExtension()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(blockDefaultAttributeValues, "extension"),
+ "Attribute value 'extension' missing.");
+ }
+
+ [Test]
+ public void FinalDefaultAttributeHasValueList()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(finalDefaultAttributeValues, "list"),
+ "Attribute value 'list' missing.");
+ }
+
+ /// <summary>
+ /// xs:boolean tests.
+ /// </summary>
+ [Test]
+ [Ignore]
+ public void MixedAttributeHasValueTrue()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(mixedAttributeValues, "true"),
+ "Attribute value 'true' missing.");
+ }
+
+ [Test]
+ public void MaxOccursAttributeHasValueUnbounded()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(maxOccursAttributeValues, "unbounded"),
+ "Attribute value 'unbounded' missing.");
+ }
+
+ [Test]
+ public void AllElementHasAnnotationChildElement()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(allElementChildElements, "xs:annotation"),
+ "Should have an annotation child element.");
+ }
+
+ [Test]
+ public void AllElementHasElementChildElement()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(allElementChildElements, "xs:element"),
+ "Should have an child element called 'element'.");
+ }
+
+ [Test]
+ public void AllElementAnnotationHasDocumentationChildElement()
+ {
+ Assert.IsTrue(SchemaTestFixtureBase.Contains(allElementAnnotationChildElements, "xs:documentation"),
+ "Should have documentation child element.");
+ }
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Utils/ResourceManager.cs b/main/src/addins/Xml/Tests/Utils/ResourceManager.cs
new file mode 100644
index 0000000000..5d3203b743
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Utils/ResourceManager.cs
@@ -0,0 +1,54 @@
+using System.IO;
+using System.Reflection;
+using System.Xml;
+
+namespace MonoDevelop.Xml.Tests.Utils
+{
+ /// <summary>
+ /// Returns strings from the embedded test resources.
+ /// </summary>
+ public class ResourceManager
+ {
+ static ResourceManager manager;
+
+ static ResourceManager()
+ {
+ manager = new ResourceManager();
+ }
+
+ /// <summary>
+ /// Returns the xhtml strict schema xml.
+ /// </summary>
+ public static XmlTextReader GetXhtmlStrictSchema()
+ {
+ return manager.GetXml("xhtml1-strict-modified.xsd");
+ }
+
+ /// <summary>
+ /// Returns the xsd schema.
+ /// </summary>
+ public static XmlTextReader GetXsdSchema()
+ {
+ return manager.GetXml("XMLSchema.xsd");
+ }
+
+ /// <summary>
+ /// Returns the xml read from the specified file which is embedded
+ /// in this assembly as a resource.
+ /// </summary>
+ public XmlTextReader GetXml(string fileName)
+ {
+ XmlTextReader reader = null;
+
+ Assembly assembly = Assembly.GetAssembly(this.GetType());
+
+ Stream resourceStream = assembly.GetManifestResourceStream(fileName);
+ if (resourceStream != null) {
+ reader = new XmlTextReader(resourceStream);
+ }
+
+ return reader;
+ }
+
+ }
+}
diff --git a/main/src/addins/Xml/Tests/Utils/SchemaIncludeTestFixtureHelper.cs b/main/src/addins/Xml/Tests/Utils/SchemaIncludeTestFixtureHelper.cs
new file mode 100644
index 0000000000..d707dd0104
--- /dev/null
+++ b/main/src/addins/Xml/Tests/Utils/SchemaIncludeTestFixtureHelper.cs
@@ -0,0 +1,83 @@
+using MonoDevelop.Xml.Completion;
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace MonoDevelop.Xml.Tests.Utils
+{
+ /// <summary>
+ /// Helper class when testing a schema which includes
+ /// another schema.
+ /// </summary>
+ public class SchemaIncludeTestFixtureHelper
+ {
+ static string mainSchemaFileName = "main.xsd";
+ static string includedSchemaFileName = "include.xsd";
+ static readonly string schemaPath;
+
+ SchemaIncludeTestFixtureHelper()
+ {
+ }
+
+ static SchemaIncludeTestFixtureHelper()
+ {
+ schemaPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "XmlEditorTests");
+ }
+
+ /// <summary>
+ /// Creates a schema with the given filename
+ /// </summary>
+ /// <param name="fileName">Filename of the schema that will be
+ /// generated.</param>
+ /// <param name="xml">The schema xml</param>
+ public static void CreateSchema(string fileName, string xml)
+ {
+ XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.UTF8);
+ writer.WriteRaw(xml);
+ writer.Close();
+ }
+
+ /// <summary>
+ /// Creates two schemas, one which references the other via an
+ /// xs:include. Both schemas will exist in the same folder.
+ /// </summary>
+ /// <param name="mainSchema">The main schema's xml.</param>
+ /// <param name="includedSchema">The included schema's xml.</param>
+ public static XmlSchemaCompletionData CreateSchemaCompletionDataObject(string mainSchema, string includedSchema)
+ {
+ if (!Directory.Exists(schemaPath)) {
+ Directory.CreateDirectory(schemaPath);
+ }
+
+ CreateSchema(Path.Combine(schemaPath, mainSchemaFileName), mainSchema);
+ CreateSchema(Path.Combine(schemaPath, includedSchemaFileName), includedSchema);
+
+ // Parse schema.
+ string schemaFileName = Path.Combine(schemaPath, mainSchemaFileName);
+ string baseUri = XmlSchemaCompletionData.GetUri(schemaFileName);
+ return new XmlSchemaCompletionData(baseUri, schemaFileName);
+ }
+
+ /// <summary>
+ /// Removes any files generated for the test fixture.
+ /// </summary>
+ public static void FixtureTearDown()
+ {
+ // Delete the created schemas.
+ string fileName = Path.Combine(schemaPath, mainSchemaFileName);
+ if (File.Exists(fileName)) {
+ File.Delete(fileName);
+ }
+
+ fileName = Path.Combine(schemaPath, includedSchemaFileName);
+ if (File.Exists(fileName)) {
+ File.Delete(fileName);
+ }
+
+ if (Directory.Exists(schemaPath)) {
+ Directory.Delete(schemaPath);
+ }
+ }
+ }
+}