1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

nxml-mode: Add schemas for Mono/.NET related files

* etc/schema/dotnet-appconfig.rnc:
* etc/schema/dotnet-packages-config.rnc:
* etc/schema/dotnet-packages-props.rnc:
* etc/schema/dotnet-resx.rnc:
* etc/schema/msbuild.rnc:
* etc/schema/nuget.rnc:
* etc/schema/nuspec.rnc: New files.
* etc/schema/README: Document copyright status of above new files.
* etc/schema/schemas.xml: Use above new files to support Mono/.NET
development related XML files.

This change was discussed in:
https://lists.gnu.org/r/emacs-devel/2024-02/msg00638.html
This commit is contained in:
Jostein Kjønigsen 2024-02-15 21:54:14 +01:00 committed by Stefan Kangas
parent bffa00bcbc
commit e74eedaa2e
9 changed files with 1714 additions and 0 deletions

View File

@ -113,3 +113,23 @@ Software License:
specific, written prior permission. Title to copyright in this
software and any associated documentation will at all times remain
with copyright holders.
The following files are related to .NET development:
dotnet-appconfig.rnc dotnet-packages-config.rnc
dotnet-packages.props dotnet-resx.rnc msbuild.rnc nuget.rnc
nuspec.rnc
These files are derived/inferred from files from numerous .NET projects,
whose contents have been created based on public documentation provided
by Microsoft, or created using the documentation as is.
Links to various related resources:
- app.config: https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/
- Directory.Packages.Props: https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management
- MSBuild: https://learn.microsoft.com/en-us/visualstudio/msbuild
- Nuspec: https://learn.microsoft.com/en-us/nuget/reference/nuspec
- Nuget.config: https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file
- Packages.config: https://learn.microsoft.com/en-us/nuget/reference/packages-config
- Resx: Xsd-schema as included in default Resx-files generated by Resxen.exe

View File

@ -0,0 +1,411 @@
default namespace = ""
namespace ns1 = "http://schemas.microsoft.com/.NetConfiguration/v2.0"
namespace ns2 = "urn:schemas-microsoft-com:asm.v1"
namespace xdt = "http://schemas.microsoft.com/XML-Document-Transform"
start =
element configuration {
element configSections { (section | sectionGroup)* }?,
element system.web.webPages.razor {
element host {
attribute factoryType { text }
},
pages
}?,
(system.web
| system.webServer
| element location {
attribute inheritInChildApplications { xsd:boolean }?,
attribute path { text }?,
system.web?,
system.webServer?
}
| element runtime {
element loadFromRemoteSources {
attribute enabled { xsd:boolean }
}?,
element ns2:assemblyBinding {
attribute appliesTo { xsd:NCName }?,
element ns2:dependentAssembly {
element ns2:Paket { xsd:NCName }?,
element ns2:assemblyIdentity {
attribute culture { xsd:NCName }?,
attribute name { xsd:NCName },
attribute publicKeyToken { xsd:NMTOKEN }
},
element ns2:bindingRedirect {
attribute newVersion { xsd:NMTOKEN },
attribute oldVersion { xsd:NMTOKEN }
}
}+
}+
}
| element startup {
attribute useLegacyV2RuntimeActivationPolicy { xsd:boolean }?,
element supportedRuntime {
attribute sku { text },
attribute version { xsd:NCName }
}
}
| element system.codedom {
element compilers {
element compiler {
attribute compilerOptions { text }?,
attribute extension { xsd:NMTOKEN },
attribute language { text },
attribute type { text },
attribute warningLevel { xsd:integer },
element providerOption {
attribute name { xsd:NCName },
attribute value { xsd:NCName }
}*
}+
}
}
| element system.diagnostics {
element sources {
element source {
attribute name { xsd:NCName },
element listeners { add }?
}+
}?,
(element switches { empty },
element sharedListeners { empty },
element trace {
attribute autoflush { xsd:boolean }
})?
}
| element system.serviceModel {
element diagnostics {
element messageLogging {
attribute logEntireMessage { xsd:boolean },
attribute logMalformedMessages { xsd:boolean },
attribute logMessagesAtServiceLevel { xsd:boolean },
attribute logMessagesAtTransportLevel { xsd:boolean },
attribute maxMessagesToLog { xsd:integer },
attribute maxSizeOfMessageToLog { xsd:integer }
}
}?,
(element behaviors {
element serviceBehaviors {
element behavior {
attribute name { text }?,
element serviceMetadata {
attribute httpGetEnabled { xsd:boolean },
attribute httpsGetEnabled { xsd:boolean }?
},
element serviceDebug {
attribute httpHelpPageEnabled { xsd:boolean }?,
attribute includeExceptionDetailInFaults {
xsd:boolean
}
},
element dataContractSerializer {
attribute maxItemsInObjectGraph { xsd:integer }
}?,
(element serviceTelemetry { empty }
| element serviceThrottling {
attribute maxConcurrentCalls { xsd:integer },
attribute maxConcurrentInstances { xsd:integer },
attribute maxConcurrentSessions { xsd:integer }
})?
}
}
}
| element bindings {
element basicHttpBinding {
element binding {
attribute closeTimeout { xsd:time }?,
attribute maxBufferSize { xsd:integer }?,
attribute maxReceivedMessageSize { xsd:integer }?,
attribute name { xsd:NCName }?,
attribute openTimeout { xsd:time }?,
attribute receiveTimeout { xsd:time }?,
attribute sendTimeout { xsd:time }?,
element readerQuotas {
attribute maxArrayLength { xsd:integer },
attribute maxBytesPerRead { xsd:integer }?,
attribute maxDepth { xsd:integer }?,
attribute maxNameTableCharCount { xsd:integer }?,
attribute maxStringContentLength { xsd:integer }
}?,
security?
}+
}?
}
| element client { empty }
| element extensions {
element behaviorExtensions { add+ },
(element bindingElementExtensions { add+ },
element bindingExtensions { add+ })?
}
| element protocolMapping { add+ }
| element serviceHostingEnvironment {
attribute aspNetCompatibilityEnabled { xsd:boolean }?,
attribute multipleSiteBindingsEnabled { xsd:boolean }?
})*,
element services {
element service {
attribute behaviorConfiguration { xsd:NCName }?,
attribute name { text },
element endpoint {
attribute address { xsd:NCName }?,
attribute binding { xsd:NCName },
attribute bindingConfiguration { xsd:NCName }?,
attribute contract { xsd:NCName }
}+
}+
}?
})*
}
| element ns1:configuration {
element ns1:configSections {
element ns1:section {
attribute name { xsd:NCName },
attribute requirePermission { xsd:boolean },
attribute type { text }
}
},
element ns1:appSettings { empty },
element ns1:connectionStrings { empty },
element ns1:system.web {
element ns1:compilation {
attribute debug { xsd:boolean },
attribute defaultLanguage { text },
attribute targetFramework { xsd:decimal }
},
element ns1:authentication {
attribute mode { xsd:NCName }
},
element ns1:httpModules { ns1.add },
element ns1:pages {
attribute clientIDMode { xsd:NCName },
attribute controlRenderingCompatibilityVersion { xsd:decimal }
}
},
element ns1:system.webServer {
element ns1:modules {
attribute runAllManagedModulesForAllRequests { xsd:boolean },
ns1.add
}
},
element ns1:rewriter {
element ns1:rewrite {
attribute to { text },
attribute url { text }
}+
}
}
section =
element section {
attribute allowExeDefinition { xsd:NCName }?,
attribute name { xsd:NCName },
attribute requirePermission { xsd:boolean }?,
attribute restartOnExternalChanges { xsd:boolean }?,
attribute type { text }
}
sectionGroup =
element sectionGroup {
attribute name { xsd:NCName },
attribute type { text }?,
(section | sectionGroup)+
}
pages =
element pages {
attribute clientIDMode { xsd:NCName }?,
attribute controlRenderingCompatibilityVersion { xsd:decimal }?,
attribute enableEventValidation { xsd:boolean }?,
attribute pageBaseType { xsd:NCName }?,
attribute theme { text }?,
attribute validateRequest { xsd:boolean }?,
attribute viewStateEncryptionMode { xsd:NCName }?,
element namespaces { add+ }?
}
add =
element add {
attribute assembly { text }?,
attribute binding { xsd:NCName }?,
attribute bindingConfiguration { text }?,
attribute connectionString { xsd:anyURI }?,
attribute initializationPage { text }?,
attribute initializeData { text }?,
attribute input { text }?,
attribute key { xsd:anyURI }?,
attribute matchType { xsd:NCName }?,
attribute modules { xsd:NCName }?,
attribute name { xsd:NCName }?,
attribute namespace { xsd:NCName }?,
attribute negate { xsd:boolean }?,
attribute path { text }?,
attribute preCondition { text }?,
attribute providerName { xsd:NCName }?,
attribute resourceType { xsd:NCName }?,
attribute responseBufferLimit { xsd:integer }?,
attribute scheme { xsd:NCName }?,
attribute scriptProcessor { text }?,
attribute type { text }?,
attribute validate { xsd:boolean }?,
attribute value { text }?,
attribute verb { text }?,
attribute xdt:Locator { text }?,
attribute xdt:Transform { xsd:NCName }?
}
security =
element security {
attribute mode { xsd:NCName }?,
attribute xdt:Transform { xsd:NCName }?,
(element requestFiltering {
attribute removeServerHeader { xsd:boolean },
element requestLimits {
attribute maxAllowedContentLength { xsd:integer }
}?
}
| element transport {
attribute clientCredentialType { xsd:NCName }
})?
}
system.webServer =
element system.webServer {
(element httpErrors {
attribute errorMode { xsd:NCName }?,
attribute existingResponse { xsd:NCName },
(remove+,
element error {
attribute path { text },
attribute prefixLanguageFilePath { text },
attribute responseMode { xsd:NCName },
attribute statusCode { xsd:integer }
}+)?
}
| element staticContent {
element mimeMap {
attribute fileExtension { xsd:NMTOKEN },
attribute mimeType { text }
}+
})?,
(element applicationInitialization {
attribute xdt:Transform { xsd:NCName },
add
}
| element rewrite {
element rules {
clear
| element rule {
attribute name { text },
attribute stopProcessing { xsd:boolean },
element match {
attribute url { text }
},
element conditions {
attribute logicalGrouping { xsd:NCName },
add+
}?,
element action {
attribute redirectType { xsd:NCName }?,
attribute type { xsd:NCName },
attribute url { text }
}
}
}
})?,
(security
| element aspNetCore {
attribute arguments { text }?,
attribute hostingModel { xsd:NCName }?,
attribute processPath { text }?,
attribute requestTimeout { xsd:time }?,
attribute stdoutLogEnabled { xsd:boolean }?,
attribute stdoutLogFile { text }?,
attribute xdt:Transform { text }?
}
| element handlers { (add | remove)+ }
| element httpProtocol {
attribute xdt:Transform { xsd:NCName }?,
element customHeaders { clear?, remove+ }
}
| element modules {
attribute runAllManagedModulesForAllRequests { xsd:boolean }?,
(add | remove)*
}
| element validation {
attribute validateIntegratedModeConfiguration { xsd:boolean }
})*,
element directoryBrowse {
attribute enabled { xsd:boolean }
}?
}
system.web =
element system.web {
element authorization {
element allow {
attribute users { text }
}
}
| (pages
| element authentication {
attribute mode { xsd:NCName }
}
| element compilation {
attribute debug { xsd:boolean }?,
attribute targetFramework { xsd:NMTOKEN }?,
attribute tempDirectory { text }?,
attribute xdt:Transform { text }?,
element assemblies { add+ }?
}
| element customErrors {
attribute defaultRedirect { text }?,
attribute mode { xsd:NCName },
attribute redirectMode { xsd:NCName }?
}
| element globalization {
attribute requestEncoding { xsd:NCName },
attribute responseEncoding { xsd:NCName }
}
| element httpHandlers { add+ }
| element httpModules { add* }
| element httpRuntime {
attribute appRequestQueueLimit { xsd:integer }?,
attribute enableVersionHeader { xsd:boolean }?,
attribute executionTimeout { xsd:integer }?,
attribute maxRequestLength { xsd:integer }?,
attribute minFreeThreads { xsd:integer }?,
attribute minLocalRequestFreeThreads { xsd:integer }?,
attribute requestPathInvalidCharacters { text }?,
attribute requestValidationMode { xsd:decimal }?,
attribute targetFramework { xsd:NMTOKEN }?,
attribute useFullyQualifiedRedirectUrl { xsd:boolean }?
}
| element identity {
attribute impersonate { xsd:boolean }
}
| element machineKey {
attribute validation { xsd:NCName }
}
| element sessionState {
attribute cookieSameSite { xsd:NCName }?,
attribute cookieless { xsd:boolean },
attribute mode { xsd:NCName },
attribute stateConnectionString { text }?,
attribute timeout { xsd:integer }
}
| element xhtmlConformance {
attribute mode { xsd:NCName }
})*
}
Globalization =
element Globalization {
element ResourceProviders { empty }
| add+
}
ns1.add =
element ns1:add {
attribute name { xsd:NCName },
attribute type { text }
}
remove =
element remove {
attribute name { xsd:NCName }?,
attribute statusCode { xsd:integer }?,
attribute subStatusCode { xsd:integer }?
}
clear = element clear { empty }

View File

@ -0,0 +1,11 @@
default namespace = ""
start =
element packages {
element package {
attribute id { xsd:NCName },
attribute targetFramework { xsd:NCName }?,
attribute allowedVersions { xsd:NCName }?,
attribute version { xsd:NMTOKEN }
}+
}

View File

@ -0,0 +1,22 @@
default namespace = ""
start =
element Project {
element PropertyGroup {
element ManagePackageVersionsCentrally { xsd:boolean },
element CentralPackageTransitivePinningEnabled { xsd:boolean },
element CentralPackageVersionOverrideEnabled { xsd:boolean }
}?,
element ItemGroup {
attribute Condition { text }?,
(element GlobalPackageReference {
attribute Condition { text }?,
attribute Include { xsd:NCName },
attribute Version { xsd:NMTOKEN }
}+
| element PackageVersion {
attribute Include { xsd:NCName },
attribute Version { text }
}+)
}+
}

View File

@ -0,0 +1,57 @@
default namespace = ""
namespace msdata = "urn:schemas-microsoft-com:xml-msdata"
namespace xsd = "http://www.w3.org/2001/XMLSchema"
start =
element root {
element xsd:schema {
attribute id { xsd:NCName },
element xsd:import {
attribute namespace { xsd:anyURI }
}?,
xsd.element
},
element resheader {
attribute name { xsd:NCName },
value
}+,
(element assembly {
attribute alias { xsd:NCName },
attribute name { text }
}
| element data {
attribute mimetype { text }?,
attribute name { text },
attribute type { text }?,
attribute xml:space { xsd:NCName }?,
value
}
| element metadata {
attribute name { xsd:NCName },
attribute type { text },
value
})*
}
xsd.element =
element xsd:element {
attribute minOccurs { xsd:integer }?,
attribute name { xsd:NCName },
attribute type { xsd:NMTOKEN }?,
attribute msdata:IsDataSet { xsd:boolean }?,
attribute msdata:Ordinal { xsd:integer }?,
element xsd:complexType {
element xsd:choice {
attribute maxOccurs { xsd:NCName },
xsd.element+
}?,
element xsd:sequence { xsd.element+ }?,
element xsd:attribute {
attribute name { xsd:NCName }?,
attribute ref { xsd:NMTOKEN }?,
attribute type { xsd:NMTOKEN }?,
attribute use { xsd:NCName }?,
attribute msdata:Ordinal { xsd:integer }?
}*
}*
}
value = element value { text }

1041
etc/schema/msbuild.rnc Normal file

File diff suppressed because it is too large Load Diff

25
etc/schema/nuget.rnc Normal file
View File

@ -0,0 +1,25 @@
default namespace = ""
start =
element configuration {
element packageRestore { add+ }?,
(element config { add }
| element packageSourceMapping {
element packageSource {
attribute key { xsd:NCName },
element package {
attribute pattern { text }
}
}+
}
| element packageSources {
element clear { empty },
add+
})+
}
add =
element add {
attribute key { xsd:NCName },
attribute protocolVersion { xsd:integer }?,
attribute value { xsd:anyURI }
}

100
etc/schema/nuspec.rnc Normal file
View File

@ -0,0 +1,100 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
default namespace mstns = "http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"
namespace rng = "http://relaxng.org/ns/structure/1.0"
dependency =
attribute id { xsd:string },
attribute version { xsd:string }?,
attribute include { xsd:string }?,
attribute exclude { xsd:string }?
dependencyGroup =
element dependency { dependency }*,
attribute targetFramework { xsd:string }?
reference = attribute file { xsd:string }
contentFileEntries =
attribute include { xsd:string },
attribute exclude { xsd:string }?,
attribute buildAction { xsd:string }?,
attribute copyToOutput { xsd:boolean }?,
attribute flatten { xsd:boolean }?
referenceGroup =
element reference { reference }+,
attribute targetFramework { xsd:string }?
frameworkReference = attribute name { xsd:string }
frameworkReferenceGroup =
element frameworkReference { frameworkReference }*,
attribute targetFramework { xsd:string }
start |= starting_package
starting_package =
element package {
element metadata {
(element id { xsd:string }
& element version { xsd:string }
& element title { xsd:string }?
& element authors { xsd:string }
& element owners { xsd:string }?
& element licenseUrl { xsd:anyURI }?
& element projectUrl { xsd:anyURI }?
& element iconUrl { xsd:anyURI }?
& element requireLicenseAcceptance { xsd:boolean }?
& element developmentDependency { xsd:boolean }?
& element description { xsd:string }
& element summary { xsd:string }?
& element releaseNotes { xsd:string }?
& (element copyright { xsd:string }?)
>> a:documentation [
"\x{a}" ~
" default value is : en-US"
]
& element language { xsd:string }?
& element tags { xsd:string }?
& element serviceable { xsd:boolean }?
& element icon { xsd:string }?
& element readme { xsd:string }?
& element repository {
attribute type { xsd:string }?,
attribute url { xsd:anyURI }?,
attribute branch { xsd:string }?,
attribute commit { xsd:string }?
}?
& element license {
xsd:string,
attribute type { xsd:string },
attribute version { xsd:string }?
}?
& element packageTypes {
element packageType {
attribute name { xsd:string },
attribute version { xsd:string }?
}*
}?
& element dependencies {
(element dependency { dependency }
| element group { dependencyGroup })*
}?
& element frameworkAssemblies {
element frameworkAssembly {
attribute assemblyName { xsd:string },
attribute targetFramework { xsd:string }?
}*
}?
& element frameworkReferences {
element group { frameworkReferenceGroup }*
}?
& element references {
(element reference { reference }
| element group { referenceGroup })*
}?
& element contentFiles {
(element files { contentFileEntries })*
}?),
attribute minClientVersion { xsd:string }?
},
element files {
element file {
attribute src { xsd:string },
attribute target { xsd:string }?,
attribute exclude { xsd:string }?
}*
}?
}

View File

@ -66,4 +66,31 @@
<typeId id="LibreOffice" uri="OpenDocument-schema-v1.3+libreoffice.rnc"/>
<typeId id="OpenDocument Manifest" uri="od-manifest-schema-v1.2-os.rnc"/>
<!-- .net development related schemas -->
<uri pattern="nuget.config" typeId="Nuget Config" />
<typeId id="Nuget Config" uri="nuget.rnc" />
<uri pattern="*.nuspec" typeId="Nuget Spec" />
<namespace ns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd" typeId="Nuget Spec" />
<typeId id="Nuget Spec" uri="nuspec.rnc" />
<uri pattern="web.config" typeId="Dotnet App Config" />
<uri pattern="app.config" typeId="Dotnet App Config" />
<namespace ns="http://schemas.microsoft.com/.NetConfiguration/v2.0" typeId="Dotnet App Config" />
<typeId id="Dotnet App Config" uri="dotnet-appconfig.rnc" />
<uri pattern="Directory.Packages.props" typeId="Dotnet Packages Props" />
<typeId id="Dotnet Packages Props" uri="dotnet-packages-props.rnc" />
<uri pattern="packages.config" typeId="Dotnet Packages Config" />
<typeId id="Dotnet Packages Config" uri="dotnet-packages-config.rnc" />
<uri pattern="*.resx" typeId="Dotnet Resx" />
<typeId id="Dotnet Resx" uri="dotnet-resx.rnc" />
<uri pattern="*.*proj" typeId="MSBuild" />
<uri pattern="Directory.Build.props" typeId="MSBuild" />
<documentElement localName="Project" typeId="MSBuild"/>
<typeId id="MSBuild" uri="msbuild.rnc" />
</locatingRules>