Exemple #1
0
        async Task Init()
        {
            if (schemaCompletionData != null)
            {
                return;
            }

            using (var reader = new StreamReader(ResourceManager.GetXhtmlStrictSchema(), true)) {
                schemaCompletionData = new XmlSchemaCompletionProvider(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 = await schemaCompletionData.GetAttributeCompletionDataAsync(DummyCompletionSource.Instance, h1Path, CancellationToken.None);
        }
Exemple #2
0
        async Task Init()
        {
            if (schemaCompletionData != null)
            {
                return;
            }

            using (var reader = new StreamReader(ResourceManager.GetXsdSchema(), true)) {
                schemaCompletionData = new XmlSchemaCompletionProvider(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));

            IAsyncCompletionSource source = DummyCompletionSource.Instance;

            mixedAttributeValues = await schemaCompletionData.GetAttributeValueCompletionDataAsync(source, choicePath, "mixed", CancellationToken.None);

            choicePath.Elements.Add(new QualifiedName("choice", namespaceURI, prefix));

            // Get choice element info.
            choiceAttributes = await schemaCompletionData.GetAttributeCompletionDataAsync(source, choicePath, CancellationToken.None);

            maxOccursAttributeValues = await schemaCompletionData.GetAttributeValueCompletionDataAsync(source, choicePath, "maxOccurs", CancellationToken.None);

            // Set up element path.
            elementPath = new XmlElementPath();
            elementPath.Elements.Add(new QualifiedName("schema", namespaceURI, prefix));

            elementFormDefaultAttributeValues = await schemaCompletionData.GetAttributeValueCompletionDataAsync(source, elementPath, "elementFormDefault", CancellationToken.None);

            blockDefaultAttributeValues = await schemaCompletionData.GetAttributeValueCompletionDataAsync(source, elementPath, "blockDefault", CancellationToken.None);

            finalDefaultAttributeValues = await schemaCompletionData.GetAttributeValueCompletionDataAsync(source, elementPath, "finalDefault", CancellationToken.None);

            elementPath.Elements.Add(new QualifiedName("element", namespaceURI, prefix));

            // Get element attribute info.
            elementAttributes = await schemaCompletionData.GetAttributeCompletionDataAsync(source, elementPath, CancellationToken.None);

            // 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 = await schemaCompletionData.GetChildElementCompletionDataAsync(source, simpleEnumPath, CancellationToken.None);

            // 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 = await schemaCompletionData.GetAttributeCompletionDataAsync(source, enumPath, CancellationToken.None);

            // 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 = await schemaCompletionData.GetChildElementCompletionDataAsync(source, allElementPath, CancellationToken.None);

            // 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 = await schemaCompletionData.GetChildElementCompletionDataAsync(source, allElementAnnotationPath, CancellationToken.None);
        }