2011-09-21 109 views

回答

2

你必须做一些狩猎从标准中将它拼凑在一起。这是您需要的魔法酱,以便在您的XML元素上允许xml:lang属性。

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <!-- Import xml: namespace --> 
    <xs:import namespace="http://www.w3.org/XML/1998/namespace" 
     schemaLocation="http://www.w3.org/2001/xml.xsd" /> 

    <!-- ... ---> 

    <xs:complexType name="myLanguagedElement"> 
    <!-- ... --> 

    <!-- use ref="" instead of name="", here in your attribute --> 
    <xs:attribute ref="xml:lang" use="optional" /><!-- or "required" if you like --> 
    </xs:complexType> 
</xs:schema> 
+0

它应该如何出现在DTD中才能通过转换获得此结果? – MrGadget

+0

@MrGadget我不知道如何用DTD来做到这一点。这里的问题是关于使用模式。 –