How to reuse elements from another Schema / Namespace (i.e. XHTML) with XML Schema?

前端 未结 1 1690
情歌与酒
情歌与酒 2021-01-23 19:10

I\'m trying to define a Schema which allows the use of specific (X)HTML elements in certain places. The problem that I\'m facing is that the Schema fails compiling.

Here

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-23 19:52

    It seems that the "blockquote" element is not defined as global element, thus you can not refer to it directly. If you have a look in the sub part of the xhtml schema http://www.w3.org/MarkUp/SCHEMA/xhtml11-model-1.xsd, you can notice that its type is xhtml.blockquote.type.

    So a workaround would be to declare your blockquote like so :

    
        
            
            
                
                    
                
            
        
    
    

    along with this valid XML instance:

    
    
        
    quick brown fox jumped over the lazy dog.

    You will notice that the blockquote element is not bound to the html namespace. Since you import other namespace's elements, I think also it would be a better practice to set a default target namespace to your own elements.

    0 讨论(0)
提交回复
热议问题