递归xml结构

递归xml结构,xml,xsd,Xml,Xsd,我想创建一个*.xsd文档(对于一个简单的游戏;)),它具有以下规范: 有混合元素,它有子元素i和b。它们与description元素具有相同的类型,因此它们可以具有相同的i和b元素 所以我想我必须创建一个递归结构?我的问题是如何创建这样一个结构?有一些令人困惑的说法;当您说“description包含混合元素和[…]”时,您的意思是说其他元素,如and,或mixed,因为它也允许文本(请考虑此处的html标记)?当您提到i和b内容时,是每个内容都只有相同的i和b元素,并且相同的i和b元素,还是

我想创建一个*.xsd文档(对于一个简单的游戏;)),它具有以下规范:

有混合元素,它有子元素i和b。它们与description元素具有相同的类型,因此它们可以具有相同的i和b元素


所以我想我必须创建一个递归结构?我的问题是如何创建这样一个结构?

有一些令人困惑的说法;当您说“
description
包含混合元素和[…]”时,您的意思是说其他元素,如and,或
mixed
,因为它也允许文本(请考虑此处的html标记)?当您提到i和b内容时,是每个内容都只有相同的i和b元素,并且
相同的i和b元素
,还是上述混合元素

要为您的案例实现递归内容模型,我建议使用类型作为基础,而不是使用组;前者正在使用我所知道的大多数工具。下面是一个简单的XSD示例,它支持文本(mixed=“true”),您可以从中开始探索:

<?xml version="1.0" encoding="utf-8"?>
<!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="description" type="descriptionType"/>
    <xsd:complexType name="descriptionType" mixed="true">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="b" type="descriptionType"/>
            <xsd:element name="i" type="descriptionType"/>
        </xsd:choice>
    </xsd:complexType>
</xsd:schema>

我将同时可视化一致的XML,并开始调整:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">text<b>text<b>text<b>text</b>
            <i>text</i>
        </b>
        <i>text<b>text</b>
            <i>text</i>
        </i>
    </b>
    <i>text<b>text<b>text</b>
            <i>text</i>
        </b>
        <i>text<b>text</b>
            <i>text</i>
        </i>
    </i>
</description>

文本文本文本文本
文本
文本
文本
文本文本文本
文本
文本
文本

有一些令人困惑的说法;当您说“
description
包含混合元素和[…]”时,您的意思是说其他元素,如and,或
mixed
,因为它也允许文本(请考虑此处的html标记)?当您提到i和b内容时,是每个内容都只有相同的i和b元素,并且
相同的i和b元素
,还是上述混合元素

要为您的案例实现递归内容模型,我建议使用类型作为基础,而不是使用组;前者正在使用我所知道的大多数工具。下面是一个简单的XSD示例,它支持文本(mixed=“true”),您可以从中开始探索:

<?xml version="1.0" encoding="utf-8"?>
<!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="description" type="descriptionType"/>
    <xsd:complexType name="descriptionType" mixed="true">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="b" type="descriptionType"/>
            <xsd:element name="i" type="descriptionType"/>
        </xsd:choice>
    </xsd:complexType>
</xsd:schema>

我将同时可视化一致的XML,并开始调整:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">text<b>text<b>text<b>text</b>
            <i>text</i>
        </b>
        <i>text<b>text</b>
            <i>text</i>
        </i>
    </b>
    <i>text<b>text<b>text</b>
            <i>text</i>
        </b>
        <i>text<b>text</b>
            <i>text</i>
        </i>
    </i>
</description>

文本文本文本文本
文本
文本
文本
文本文本文本
文本
文本
文本