Одинаковый тип, но разные атрибуты в xsd C# - PullRequest
0 голосов
/ 13 июля 2020

Это часть моего xsd-кода. Мне нужно проверить действительность xml, но сначала мне нужно проверить этот xsd, где ConnectionType может иметь атрибуты, которые присутствуют в xsd: sourceattachment, bendpoint, targetattachment, source, target. Мне нужен второй xsd, где я могу добавить новый атрибут для ConnectionType. Итак, сначала нужно проверить эти атрибуты, но также он может иметь другой атрибут: category

 <xs:complexType name="ConnectionType" abstract="true">
    <xs:annotation>
        <xs:documentation>
            Graphical connection type.

            If the 'relationshipRef' attribute is present, the connection should reference an existing ArchiMate relationship.

            If the connection is an ArchiMate relationship type, the connection's label, documentation and properties may be determined
            (i.e inherited) from those in the referenced ArchiMate relationship. Otherwise the connection's label, documentation and properties
             can be provided and will be additional to (or over-ride) those contained in the referenced ArchiMate relationship.
        </xs:documentation>
    </xs:annotation>

    <xs:complexContent>
        <xs:extension base="ViewConceptType">

            <xs:sequence>
             <xs:element name="sourceAttachment" type="LocationType" minOccurs="0" maxOccurs="1" />
             <xs:element name="bendpoint" type="LocationType" minOccurs="0" maxOccurs="unbounded" />
             <xs:element name="targetAttachment" type="LocationType" minOccurs="0" maxOccurs="1" />   
             
            </xs:sequence>

            <xs:attribute name="source" type="xs:IDREF" use="optional" />
            <xs:attribute name="target" type="xs:IDREF" use="optional" />
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

Я пробовал что-то вроде этого:

   <xs:complexType name="ConnectionType"  abstract="true">
    <xs:annotation>           
    </xs:annotation>
    <xs:complexContent>
        <xs:extension base="archimate:ViewNodeType" >

            <xs:sequence>                
             <xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="1" /> <!-- category is the name between two shapes lines-->
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

, но он говорит, что этот тип уже существует. Не могли бы вы посоветовать, как мне добавить во второй xsd для существующего элемента другой атрибут, свойство?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...