2011-09-21 60 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來做到這一點。這裏的問題是關於使用模式。 –