C# 使用XSD验证XML文件时出错

C# 使用XSD验证XML文件时出错,c#,xml,xsd,xsd-validation,C#,Xml,Xsd,Xsd Validation,我试图用XSD验证一个XML文件,但我得到了每个元素和属性的“找不到元素‘xxx’的模式信息” 我的C#代码是: 我的XML文件: <?xml version="1.0" encoding="utf-16"?> <keyem description="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSch

我试图用XSD验证一个XML文件,但我得到了每个元素和属性的“找不到元素‘xxx’的模式信息”

我的C#代码是:

我的XML文件:

<?xml version="1.0" encoding="utf-16"?>
<keyem description="test"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xsi:noNamespaceSchemaLocation="http://tempuri.org/KeyEmFileSchema.xsd"
>
  <layout type="keyboard" height="300" width="300">
    <groupp text="rad 1">
      <key color="Black" macro="{ESC}10{ESC}43{MOUSERESET}" text="Ordi-\nnarie"/>
      <key color="Gray"  macro="{ESC}10{ESC}B0{MOUSERESET}" text="Släck\nskärm"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2" icon="dfkhfkjsdhfkjdsf">
        <shift color="Blue"  macro="{ESC}1C{ESC}81{MOUSERESET}" text="Annan Skärm"/>
      </key>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
      <empty/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n4"/>
    </groupp>
    <group text="rad 2">
      <key color="Black" macro="{ESC}10{ESC}43{MOUSERESET}" text="Ordi-\nnarie"/>
      <key color="Gray"  macro="{ESC}10{ESC}B0{MOUSERESET}" text="Släck\nskärm"/>
      <group color ="Blue" text="test">
        <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
        <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2"/>
        <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
      </group>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
      <empty/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n4"/>
    </group>
  </layout>
</keyem>

我的XSD文件

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FileSchema"
    targetNamespace="http://tempuri.org/KeyEmFileSchema.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/KeyEmFileSchema.xsd"
    xmlns:mstns="http://tempuri.org/KeyEmFileSchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:annotation>
    <xs:documentation xml:lang="sv-se">Definition av layout</xs:documentation>
  </xs:annotation>

  <!--Definition av attribut-->
  <xs:attribute name="description" type="xs:string"/>
  <xs:attribute name="text"        type="xs:string"/>
  <xs:attribute name="height"      type="xs:positiveInteger"/>
  <xs:attribute name="width"       type="xs:positiveInteger"/>
  <xs:attribute name="type"        type="LayoutTypeSet" default="keyboard"/>
  <xs:attribute name="macro"       type="xs:string"/>
  <xs:attribute name="icon"        type="xs:base64Binary"/>
  <xs:attribute name="color"       type="ColorType"/>

  <!--Definition av attributgrupp-->
  <xs:attributeGroup name="ShiftKeyAttributeGroup">
    <xs:attribute ref="color" use="optional"/>
    <xs:attribute ref="macro" use="optional"/>
    <xs:attribute ref="text"  use="required"/>
    <xs:attribute ref="icon"  use="optional"/>
  </xs:attributeGroup>

  <!--Definition av root-->
  <xs:element name="keyem">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="layout" type="LayoutType" minOccurs="0" maxOccurs="1"/>
      </xs:sequence>
      <xs:attribute ref="description" use="optional"/>
    </xs:complexType>
  </xs:element>

  <!--Definition av komplexa typer-->
  <xs:complexType name="GroupKeyType">
    <xs:choice maxOccurs="unbounded">
      <xs:element name="group" type="GroupType" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="key"   type="KeyType"   minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="LayoutType">
    <xs:choice maxOccurs="unbounded">
      <xs:element name="group" type="GroupType" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="key"   type="KeyType"   minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attribute ref="type"   use="required"/>
    <xs:attribute ref="height" use="optional"/>
    <xs:attribute ref="width"  use="optional"/>
  </xs:complexType>

  <xs:complexType name="GroupType">
    <xs:choice maxOccurs="unbounded">
      <xs:element name="group" type="GroupType" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="key"   type="KeyType"   minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="empty" type="EmptyType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attribute ref="text"  use="required"/>
    <xs:attribute ref="color" use="optional"/>
  </xs:complexType>

  <xs:complexType name="EmptyType">
    <xs:sequence>
      <xs:element name="empty"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ShiftType">
    <xs:attributeGroup ref="ShiftKeyAttributeGroup"/>
  </xs:complexType>

  <xs:complexType name="KeyType">
    <xs:sequence>
      <xs:element name="shift" type="ShiftType" minOccurs ="0" maxOccurs="1"/>
    </xs:sequence>
    <xs:attributeGroup ref="ShiftKeyAttributeGroup"/>
  </xs:complexType>


  <!--Definition av enkla typer-->
  <xs:simpleType      name="ColorType">
    <xs:restriction   base="xs:string">
      <!--Regex för att antingen matcha färg angivet på formen #rrggbb eller som är skriven i klarspråk, t.ex. "Green"-->
      <xs:pattern     value="\#[0-9a-fA-F]{6}|[a-zA-Z]+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType      name="LayoutTypeSet">
    <xs:restriction   base="xs:string">
      <xs:enumeration value="keyboard"/>
      <xs:enumeration value="list"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

定义av布局

根据您的模式,您的xml中有一个错误的节点:

<groupp text="rad 1">

只能在该级别插入组或关键元素

关于您的特定问题,请尝试使用架构文件中的下一个根节点:

<xs:schema id="FileSchema"
    elementFormDefault="qualified"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
...
</xs:schema>

...

如果在
KeyEmFileSchema.xsd
文件中定义了架构,则可以使用
schemaLocation
而不是
noNamespaceSchemaLocation

<keyem description="test"
      xmlns="http://tempuri.org/KeyEmFileSchema.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xsi:schemaLocation="http://tempuri.org/KeyEmFileSchema.xsd KeyEmFileSchema.xsd"
>
如果需要,还可以使用
ValidationEventHandler
。如果没有处理程序,您将收到包含验证错误信息的异常

更新了:顺便说一下,在包含
xmlns=”之后http://tempuri.org/KeyEmFileSchema.xsd“
xsi:schemaLocation=”http://tempuri.org/KeyEmFileSchema.xsd KeyEmFileSchema.xsd“
在xml文件的根元素中,您将在Visual Studio文本编辑器中看到xml文件中的错误:

<?xml version="1.0" encoding="utf-16"?>
<keyem description="test"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xsi:noNamespaceSchemaLocation="http://tempuri.org/KeyEmFileSchema.xsd"
>
  <layout type="keyboard" height="300" width="300">
    <groupp text="rad 1">
      <key color="Black" macro="{ESC}10{ESC}43{MOUSERESET}" text="Ordi-\nnarie"/>
      <key color="Gray"  macro="{ESC}10{ESC}B0{MOUSERESET}" text="Släck\nskärm"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2" icon="dfkhfkjsdhfkjdsf">
        <shift color="Blue"  macro="{ESC}1C{ESC}81{MOUSERESET}" text="Annan Skärm"/>
      </key>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
      <empty/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n4"/>
    </groupp>
    <group text="rad 2">
      <key color="Black" macro="{ESC}10{ESC}43{MOUSERESET}" text="Ordi-\nnarie"/>
      <key color="Gray"  macro="{ESC}10{ESC}B0{MOUSERESET}" text="Släck\nskärm"/>
      <group color ="Blue" text="test">
        <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
        <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2"/>
        <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
      </group>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2"/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
      <empty/>
      <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n4"/>
    </group>
  </layout>
</keyem>
  • keyem
    元素中使用未声明的属性
    description
  • 使用
    布局
    元素中未声明的所有属性
  • 使用
    groupp
    元素代替
    group
  • 更新2:第3项要求:将
    groupp
    替换为
    groupp
    是明确的。因为没有人评论我的答案,我想有人会问“XML文件的属性有什么问题?”。好的,我还要多加评论

    XSD文件中的问题是,您将属性声明为而不是某些简单类型、属性组或某些元素的属性的一部分。您只需声明一些“独立”属性,然后在每个“ref”引用中使用它们。通常是可能的,但这种方式需要使用限定属性。因此,如果在模式中不做任何更改,那么XML文件的固定版本将如下所示

    <?xml version="1.0" encoding="utf-16"?>
    <keyem xmlns="http://tempuri.org/KeyEmFileSchema.xsd"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xsi:schemaLocation="http://tempuri.org/KeyEmFileSchema.xsd KeyEmFileSchema.xsd"
           a:description="test" xmlns:a="http://tempuri.org/KeyEmFileSchema.xsd"
    >
        <layout a:type="keyboard" a:height="300" a:width="300">
            <group a:text="rad 1">
                <key a:color="Black" a:macro="{ESC}10{ESC}43{MOUSERESET}" a:text="Ordi-\nnarie"/>
                <key a:color="Gray"  a:macro="{ESC}10{ESC}B0{MOUSERESET}" a:text="Släck\nskärm"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n1"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n2" a:icon="dfkhfkjsdhfkjdsf">
                    <shift a:color="Blue"  a:macro="{ESC}1C{ESC}81{MOUSERESET}" a:text="Annan Skärm"/>
                </key>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n3"/>
                <empty><empty/></empty>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n4"/>
            </group>
            <group a:text="rad 2">
                <key a:color="Black" a:macro="{ESC}10{ESC}43{MOUSERESET}" a:text="Ordi-\nnarie"/>
                <key a:color="Gray"  a:macro="{ESC}10{ESC}B0{MOUSERESET}" a:text="Släck\nskärm"/>
                <group a:color ="Blue" a:text="test">
                    <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n1"/>
                    <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n2"/>
                    <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n3"/>
                </group>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n1"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n2"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n3"/>
                <empty><empty/></empty>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n4"/>
            </group>
    
    </layout>
    </keyem>
    

    谢谢你的详细回答。我知道groupp拼错了,这是我故意犯的错误,我只是想看看验证是否有效(但在我发布这篇文章时忘了更正)。我以前发现我对这件事很粗心。在设计XSD文件时,我遵循了中的建议。当我纠正了明显的错误时,我可以验证我的xml文件。我不理解“合格属性”的问题。@magol:我建议你从另一个角度看待这个问题。我从您的代码中看到,您使用C#和Visual Studio。有一天我发现了
    xsi:schemaLocation
    属性的强大功能之后,我总是使用
    xsi:schemaLocation
    编写schema和XML。我马上就能看到我的环境是否理解我写的东西。如果您试图在VisualStudio中使用您的模式,则只有在存在“限定属性”时,它才能理解您定义的属性。如果是Microsoft错误,则无法更改它。因此,从实用的角度来看,由于您使用的是MS.NET,您应该为其编写。@magol:中定义的XML模式非常复杂,一个规范分为两部分,另一个部分是0(不是官方标准),因为它非常复杂。因此,更好的做法是编写,以便XSD的不同解释能够正确理解您的模式。简单点@magol:根据我的回答,在模式的修改版本中,我使用了我认为实用的属性组。如果您定义一些简单的类型,如
    ColorType
    LayoutTypeSet
    ,我发现这也是非常实用的,但我看不到定义单独属性(如
    macro
    )并对其使用
    ref
    的任何真正优势。因此,在我看来,我建议修改的模式主要是以您的风格编写的(只是没有取消绑定属性)。为什么不这样做呢?所有人(包括.NET)都会理解它。你觉得哪里有缺点?@magol:对不起,我写了这么多,但是。。。你写的,你用它作为模板。这个例子实际上是定义一个没有名称空间或没有名称空间的模式,因为这里没有使用
    targetNamespace
    。这是非常重要的!正是在这种情况下引入了
    xsi:noNamespaceSchemaLocation
    (对于没有名称空间的模式)。在您的模式使用中,请定义模式目标名称空间,因此您必须使用完全针对该案例定义的
    xsi:schemaLocation
    (请参阅)。
    <?xml version="1.0" encoding="utf-16"?>
    <keyem xmlns="http://tempuri.org/KeyEmFileSchema.xsd"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xsi:schemaLocation="http://tempuri.org/KeyEmFileSchema.xsd KeyEmFileSchema.xsd"
           a:description="test" xmlns:a="http://tempuri.org/KeyEmFileSchema.xsd"
    >
        <layout a:type="keyboard" a:height="300" a:width="300">
            <group a:text="rad 1">
                <key a:color="Black" a:macro="{ESC}10{ESC}43{MOUSERESET}" a:text="Ordi-\nnarie"/>
                <key a:color="Gray"  a:macro="{ESC}10{ESC}B0{MOUSERESET}" a:text="Släck\nskärm"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n1"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n2" a:icon="dfkhfkjsdhfkjdsf">
                    <shift a:color="Blue"  a:macro="{ESC}1C{ESC}81{MOUSERESET}" a:text="Annan Skärm"/>
                </key>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n3"/>
                <empty><empty/></empty>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n4"/>
            </group>
            <group a:text="rad 2">
                <key a:color="Black" a:macro="{ESC}10{ESC}43{MOUSERESET}" a:text="Ordi-\nnarie"/>
                <key a:color="Gray"  a:macro="{ESC}10{ESC}B0{MOUSERESET}" a:text="Släck\nskärm"/>
                <group a:color ="Blue" a:text="test">
                    <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n1"/>
                    <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n2"/>
                    <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n3"/>
                </group>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n1"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n2"/>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n3"/>
                <empty><empty/></empty>
                <key a:color="Gray"  a:macro="{ESC}1B{ESC}81{MOUSERESET}" a:text="Skärm\n4"/>
            </group>
    
    </layout>
    </keyem>
    
    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema id="FileSchema"
        targetNamespace="http://tempuri.org/KeyEmFileSchema.xsd"
        elementFormDefault="qualified"
        xmlns="http://tempuri.org/KeyEmFileSchema.xsd"
        xmlns:mstns="http://tempuri.org/KeyEmFileSchema.xsd"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
    >
      <xs:annotation>
        <xs:documentation xml:lang="sv-se">Definition av layout</xs:documentation>
      </xs:annotation>
    
      <!--Definition av attributgrupp-->
      <xs:attributeGroup name="ShiftKeyAttributeGroup">
        <xs:attribute name="color" type="ColorType"/>
        <xs:attribute name="macro" type="xs:string"/>
        <xs:attribute name="text"  type="xs:string" use="required"/>
        <xs:attribute name="icon"  type="xs:base64Binary"/>
      </xs:attributeGroup>
    
      <!--Definition av root-->
      <xs:element name="keyem">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="layout" type="LayoutType" minOccurs="0" maxOccurs="1"/>
          </xs:sequence>
          <xs:attribute name="description" type="xs:string"/>
        </xs:complexType>
      </xs:element>
    
      <!--Definition av komplexa typer-->
      <xs:complexType name="GroupKeyType">
        <xs:choice maxOccurs="unbounded">
          <xs:element name="group" type="GroupType" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="key"   type="KeyType"   minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
      </xs:complexType>
    
      <xs:complexType name="LayoutType">
        <xs:choice maxOccurs="unbounded">
          <xs:element name="group" type="GroupType" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="key"   type="KeyType"   minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="type"   type="LayoutTypeSet" use="required"/>
        <xs:attribute name="height" type="xs:positiveInteger"/>
        <xs:attribute name="width"  type="xs:positiveInteger"/>
      </xs:complexType>
    
      <xs:complexType name="GroupType">
        <xs:choice maxOccurs="unbounded">
          <xs:element name="group" type="GroupType" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="key"   type="KeyType"   minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="empty" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="text" type="xs:string" use="required" />
        <xs:attribute name="color" type="ColorType"/>
      </xs:complexType>
    
      <xs:complexType name="ShiftType">
        <xs:attributeGroup ref="ShiftKeyAttributeGroup"/>
      </xs:complexType>
    
      <xs:complexType name="KeyType">
        <xs:sequence>
          <xs:element name="shift" type="ShiftType" minOccurs ="0" maxOccurs="1"/>
        </xs:sequence>
        <xs:attributeGroup ref="ShiftKeyAttributeGroup"/>
      </xs:complexType>
    
      <!--Definition av enkla typer-->
      <xs:simpleType      name="ColorType">
        <xs:restriction   base="xs:string">
          <!--Regex för att antingen matcha färg angivet på formen #rrggbb eller som är skriven i klarspråk, t.ex. "Green"-->
          <xs:pattern     value="\#[0-9a-fA-F]{6}|[a-zA-Z]+"/>
        </xs:restriction>
      </xs:simpleType>
    
      <xs:simpleType      name="LayoutTypeSet">
        <xs:restriction   base="xs:string">
          <xs:enumeration value="keyboard"/>
          <xs:enumeration value="list"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>
    
    <?xml version="1.0" encoding="utf-16"?>
    <keyem xmlns="http://tempuri.org/KeyEmFileSchema.xsd"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xsi:schemaLocation="http://tempuri.org/KeyEmFileSchema.xsd KeyEmFileSchema1.xsd"
           description="test"
    >
        <layout type="keyboard" height="300" width="300">
            <group text="rad 1">
                <key color="Black" macro="{ESC}10{ESC}43{MOUSERESET}" text="Ordi-\nnarie"/>
                <key color="Gray"  macro="{ESC}10{ESC}B0{MOUSERESET}" text="Släck\nskärm"/>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2" icon="dfkhfkjsdhfkjdsf">
                    <shift color="Blue"  macro="{ESC}1C{ESC}81{MOUSERESET}" text="Annan Skärm"/>
                </key>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
                <empty/>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n4"/>
            </group>
            <group text="rad 2">
                <key color="Black" macro="{ESC}10{ESC}43{MOUSERESET}" text="Ordi-\nnarie"/>
                <key color="Gray"  macro="{ESC}10{ESC}B0{MOUSERESET}" text="Släck\nskärm"/>
                <group color ="Blue" text="test">
                    <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
                    <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2"/>
                    <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
                </group>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n1"/>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n2"/>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n3"/>
                <empty/>
                <key color="Gray"  macro="{ESC}1B{ESC}81{MOUSERESET}" text="Skärm\n4"/>
            </group>
    
    </layout>
    </keyem>