Skip to content

Commit

Permalink
Added additional XSD and DTD demos
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Chen authored and angelozerr committed Jun 9, 2021
1 parent b62f9e0 commit dd99f92
Show file tree
Hide file tree
Showing 36 changed files with 227 additions and 36 deletions.
40 changes: 4 additions & 36 deletions docs/Features.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,7 @@
# Features

## XML Tag Auto Close
[vscode-xml](https:/redhat-developer/vscode-xml) has a number of notable features available for XML, XSD and DTD support.

[vscode-xml](https:/redhat-developer/vscode-xml) provides an `auto close` feature for XML tags:

Using `/` in an opening tag will auto close the tag.

![Auto Close Tag Slash](images/Features/AutoCloseTagSlash.gif)

Using a `>` at the end of an opening tag generates the corresponding closing tag.

![Auto Close Tag End](images/Features/AutoCloseTagEnd.gif)

## Jump to Start/End Tag

For quick navigation, you can use `Ctrl + Click` on a closing tag to jump to the corresponding opening tag.

![Jump To Opening Tag](images/Features/JumpToOpeningTag.gif)

The same applies to jumping from an opening tag to the respective closing tag.

![Jump To Closing Tag](images/Features/JumpToClosingTag.gif)

## Rename Tag

To rename a single tag and it's corresponding opening/closing, highlight the tag and press `F2` or use the dropdown to select `Rename Symbol`.

![Rename Tag](images/Features/RenameTag.gif)

## Selection Range

You can use `Alt + Shift + Right Arrow` to expand your selection range according to the structure of the XML document.

For instance, if you expand the selection range in an element with text content, it will first select all the text content, then the element.

This also works for other portions of an XML document, such as attributes and the DTD subset.

![Selection Range](images/Features/SelectionRange.gif)
- [XML Features](Features/XMLFeatures.md#xml-features)
- [XSD Features](Features/XSDFeatures.md#xsd-features)
- [DTD Features](Features/DTDFeatures.md#dtd-features)
31 changes: 31 additions & 0 deletions docs/Features/DTDFeatures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# DTD Features

## CodeLens Support

CodeLens is supported for `.dtd` files, which can show where an element declaration is referenced.

![CodeLens DTD](../images/Features/CodeLensDTD.gif)

This feature also supports listing and highlighting the number of references to an element declaration and the line(s) referenced on.

![CodeLens References DTD ](../images/Features/CodeLensReferencesDTD.gif)

### Read more

See [CodeLens](../CodeLens.md#code-lens) for more details.

## Category Accessibility

After defining an `!ELEMENT` tag in the `.dtd` file, there are features available for categories.

### Jump to element declaration

For an `!ELEMENT` tag that contains a category/element-content attribute, there is support for navigating to its definition element.

![Jump To Element Declaration DTD](../images/Features/JumpToElementDeclarationDTD.gif)

## Syntax Validation

DTD syntax validation is enabled for any `.dtd` file.

![Validation DTD](../images/Features/ValidationDTD.gif)
139 changes: 139 additions & 0 deletions docs/Features/XMLFeatures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# XML Features

[vscode-xml](https:/redhat-developer/vscode-xml) provides a number of notable features, with demos below.

## XML Tag Auto Close

XML tag `auto-close` is supported:

Using `/` in an opening tag will auto close the tag.

![Auto Close Tag Slash](../images/Features/AutoCloseTagSlashXML.gif)

## Linked Editing

Linked editing is supported, allowing for simultaneous changes an opening and closing tag pair.

To enable this feature, the setting `editor.linkedEditing` must be set to `true` in the `settings.json.

![Linked Editing](../images/Features/LinkedEditingXML.gif)

## Jump to Start/End Tag

For quick navigation, you can use `Ctrl + Click` on a closing tag to jump to the corresponding opening tag.

![Jump To Opening Tag](../images/Features/JumpToOpeningTagXML.gif)

The same applies to jumping from an opening tag to the respective closing tag.

![Jump To Closing Tag](../images/Features/JumpToClosingTagXML.gif)

## Rename Tag

To rename a single tag and its corresponding opening/closing, highlight the tag and press `F2` or use the dropdown to select `Rename Symbol`.

![Rename Tag](../images/Features/RenameTagXML.gif)

## Tag Name Highlighting

When placing the cursor on a XML tag, the corresponding opening/closing tag will be highlighted.

![Highlight Corresponding XML](../images/Features/HighlightCorrespondingXML.gif)

## Symbols from Outline and Breadcrumbs

The `OUTLINE` dropdown under `EXPLORER` details the XML tags in the document and their children. The `Breadcrumbs` bar also shows the hierarchy of the tag that the cursor is on. Both features permit jumping to the tag(s) displayed.

![Symbol Outline XML](../images/Features/SymbolOutlineXML.gif)

## Completion Support

### Basic completion

If an XML file is not associated to a bound grammar file, you can utilize XML completion which uses existing XML tag elements.

### Completion based on grammar

#### Completion based on XSD

When a XML file is associated with a XSD file, there is support for completion based on the tags, attribute names and values defined in the XML Schema/XSD file.

![Completion Based On XSD](../images/Features/CompletionBasedOnXSD.gif)

#### Completion based on DTD

When XML file is associated with a DTD file, completion based on tags, attributes name and value defined in the DTD file are supported.

![Completion Based On DTD](../images/Features/CompletionBasedOnDTD.gif)

## Jump to Grammar Definition

If an XML file is associated with an XSD file, there is support for jumping from the XML tag to the schema definition.

![Jump to XSD Def From XML](../images/Features/JumpToXSDDefFromXML.gif)

## Hover Support

### Hover based on grammar

#### Hover based on XSD

When XML file is associated with a XSD file, hover documentation based on tags, attributes name and value defined in the XML Schema/XSD file are supported.

![Hover Based On XSD](../images/Features/HoverBasedOnXSD.gif)

#### Hover based on DTD

When XML file is associated with a DTD file, hover documentation based on tags, attributes name and value defined in the DTD file are supported.

![Hover Based On DTD](../images/Features/HoverBasedOnDTD.gif)

## Validation Support

### Syntax validation

LemMinX will show syntax errors in your XML documentation, and will provide quick fixes to resolve these errors.

![Validate XML](../images/Features/ValidationXML.gif)

There is also validation based on grammar when a XSD or DTD file is associated with the XML document.

### Read more

See [XML Validation](../Validation.md#xml-validation) for more details.

## Generate Grammar from XML

### Generate XSD from XML

Using an XML file, an XML Schema/XSD file can be generated from the opening tag in the XML file. With the cursor on the first opening tag, use `Ctrl + .` or `Quick Fix...` and select `Generate foo.xsd and bind with *` to create the file in the the same directory.

![GenerateXSDFromXML](../images/Features/GenerateXSDFromXML.gif)

#### Read more

See [Validation with XSD Grammar](../Validation.md#validation-with-xsd-grammar) for more.

### Generate DTD from XML

Using an XML file, a Document Type Definition/DTD file can be generated from the opening tag in the XML file. With the cursor on the first opening tag, use `Ctrl + .` or `Quick Fix...` and select `Generate foo.dtd and bind with *` to create the file in the the same directory.

![GenerateDTDFromXML](../images/Features/GenerateDTDFromXML.gif)

#### Read more

See [Validation with DTD Grammar](../Validation.md#validation-with-dtd-grammar) for more.

## Selection Range

You can use `Alt + Shift + Right Arrow` to expand your selection range according to the structure of the XML document.

For instance, if you expand the selection range in an element with text content, it will first select all the text content, then the element.

This also works for other portions of an XML document, such as attributes and the DTD subset.

![Selection Range](../images/Features/SelectionRange.gif)

## Custom Feature Implementation

You can implement your own feature with a [Java extension](../Extensions.md).
53 changes: 53 additions & 0 deletions docs/Features/XSDFeatures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# XSD Features

## CodeLens Support

CodeLens is supported for `.xsd` files, which can show where a type is referenced.

![CodeLens XSD](../images/Features/CodeLensXSD.gif)

This feature also supports listing the number of references to a type and the line(s) referenced on.

![CodeLens References XSD](../images/Features/CodeLensReferencesXSD.gif)

### Read more

See [CodeLens](../CodeLens.md#code-lens) for more details.

## XSD Tag Support

After defining a `Type` or `element` tag in the `.xsd` file, there are a number of features supported in relation to types/elements.

### Type completion

There is autocompletion support for assigning these types to element tags.

![Type Autocompletion XSD](../images/Features/TypeAutocompleteXSD.gif)

### Jump to type definition

For an `element` tag that is assigned a type, there is support for navigating to its definition from any type assignment.

![Jump To Type Definition XSD](../images/Features/JumpToTypeDefinitionXSD.gif)

### Highlight type instances

After defining a `Type` or `element`, selecting the `name` attribute will highlight all occurrences.

![Highlight Occurrences XSD](../images/Features/HighlightOccurrenceXSD.gif)

## Syntax Validation

XSD syntax validation is enabled for any `.xsd` file.

### Validate element name with same type

Validation of `.xsd` files enforces all `element` tags that share a type to have different names.

![Validate XSD Same Name](../images/Features/ValidateXSDSameName.gif)

### Validate type definition exists

Validation of `.xsd` files enforces all `element` tags to be assigned a type that has already been defined.

![Validate XSD Type](../images/Features/ValidateXSDType.gif)
File renamed without changes
Binary file added docs/images/Features/AutoCloseTagEndXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added docs/images/Features/AutoCloseTagSlashXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/CodeLensDTD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/CodeLensReferencesDTD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/CodeLensReferencesXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/CodeLensXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/CompletionBasedOnDTD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/CompletionBasedOnXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/GenerateDTDFromXML.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/GenerateXSDFromXML.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/HighlightOccurrenceXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/HoverBasedOnDTD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/HoverBasedOnXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added docs/images/Features/JumpToClosingTagXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added docs/images/Features/JumpToOpeningTagXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/JumpToTypeDefinitionXSD.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/JumpToXSDDefFromXML.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Features/LinkedEditingXML.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added docs/images/Features/RenameTagXSD.gif
Binary file added docs/images/Features/SymbolOutlineXML.gif
Binary file added docs/images/Features/TypeAutocompleteXSD.gif
Binary file added docs/images/Features/ValidateXSDSameName.gif
Binary file added docs/images/Features/ValidateXSDType.gif
Binary file added docs/images/Features/ValidationDTD.gif
Binary file added docs/images/Features/ValidationXML.gif

0 comments on commit dd99f92

Please sign in to comment.