开发者

Mixing XML namespaces with XHTML

开发者 https://www.devze.com 2023-02-01 10:02 出处:网络
How would I go about writing an XML schema, where the elements would be permitted for use mixed with elements from another namespace?

How would I go about writing an XML schema, where the elements would be permitted for use mixed with elements from another namespace?

Specifically, if I want to use some elements for templating in an XHTML document as such:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tmp="http://www.example.com/~/template">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

    <div id="idName">

        <tmp:region name="regionName">

            <div class="className">

                <h1>
                    <tmp:data name="dataName1">
                        <tmp:format type="formatType">
                            <tmp:param name="paramName" value="paramValue" />
                            <tmp:param name="paramName" value="paramValue" />
                        </tmp:format>
                    </tmp:data>
                </h1>

                <div>
                    <tmp:data name="dataName2" />
                </div>

            </div>

        </tmp:region>

    </div>

</body>

</html>

I don't want anyone to write the schema, I'm in the midst of doing that (I think correctly) but as mentioned, how could ensure that elements开发者_StackOverflow社区 from the tmp namespace can be used as shown in the example? What would I need to include or omit from the XSD, or elsewhere?


If you want anything somewhere, you can use xs:any :

<xs:any processContent="skip" namespace="http://www.foo.com/hello/world"/>

... to allow any element from the provided namespace, for instance.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号