Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ The following settings are supported:
* [`xml.codeLens.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/CodeLens.md): Enable/disable XML CodeLens. Default is `false`.
* [`xml.preferences.showSchemaDocumentationType`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#documentation-type): Specifies the source of the XML schema documentation displayed on hover and completion. Default is `all`.
* [`xml.validation.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md): Enable/disable all validation. Default is `true`.
* [`xml.validation.namespaces.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md#xmlvalidationsnamespacesenabled): Enable/disable namespaces validation. Default is `always`. Ignored if [`xml.validation.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md) is set to `false`.
* [`xml.validation.schema.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md#xmlvalidationschemaenabled): Enable/disable schema based validation. Default is `always`. Ignored if [`xml.validation.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md) is set to `false`.
* [`xml.validation.disallowDocTypeDecl`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md#disallow-doc-type-declarations): Enable/disable if a fatal error is thrown if the incoming document contains a DOCTYPE declaration. Default is `false`.
* [`xml.validation.resolveExternalEntities`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Validation.md#resolve-external-entities): Enable/disable resolve of external entities. Default is `false`.
Expand Down
30 changes: 30 additions & 0 deletions docs/Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,36 @@ Demonstration of the different behaviour:

![When using the default settings, an external entity that has an XML element as its content will not produce a validation error when nested in an element that expects character content. If `xml.validation.resolveExternalEntities` is enabled, then an error will be produced](./images/Validation/ExternalEntityResolvingDemonstration.gif)

## xml.validation.namespaces.enabled

The `xml.validation.namespaces.enabled` gives the capability to enable / disable the namespaces (prefix) validation. It can be configured with 3 values:

* `always`: enable schema based validation.
* `never`: disable schema based validation.
* `onNamespaceEncountered`: enable namespaces validation only when the root element declares an xmlns namespace.

To understand the `onNamespaceEncountered` settings value, lets go through an example:

Create the XML `foo.xml` file:

```xml
<foo>
<p:bar />
</foo>
```

In `always` you will have error, in `onNamespaceEncountered` you will have none error.

Declares a namespaces in the foo root element:

```xml
<foo xmlns="http:foo" >
<p:bar />
</foo>
```

In `onNamespaceEncountered` you will see a prefix error.

## xml.validation.schema.enabled

The `xml.validation.schema.enabled` gives the capability to enable / disable the validation based on XSD. It can be configured with 3 values:
Expand Down
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,22 @@
"markdownDescription": "Enable/disable all validation. Default is `true`.",
"scope": "window"
},
"xml.validation.namespaces.enabled": {
"type": "string",
"default": "always",
"enum": [
"always",
"never",
"onNamespaceEncountered"
],
"markdownEnumDescriptions": [
"Enable namespaces validation.",
"Disable namespaces validation.",
"Enable namespaces validation only when the root element declares an xmlns namespace."
],
"markdownDescription": "Enable/disable namespaces validation. Default is `always`. Ignored if `#xml.validation.enabled#` is set to `false`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22Validation%22%2C%22section%22%3A%22xmlnamespaceschemaenabled%22%7D%5D) for more information.",
"scope": "window"
},
"xml.validation.schema.enabled": {
"type": "string",
"default": "always",
Expand Down