2.2. Using namespaces

All namespaces refered from the data objects must be declared in the header of X-definition. (Note that the "default" namespace without prefix may be also used. However, it's not recommended - you should rather specify all namespaces with a prefix.)

<xd:def xmlns:xd = "http://www.xdef.org/xdef/3.2"
        xmlns:bk = "http://www.book.com"
        xd:name = "Books" xd:root = "bk:Inventory" >

     <bk:book xd:xcript = "occurs *"
              isbn      = "num(10);" >
        <bk:publisher> <xd:text> string(); </xd:text> </bk:publisher>
        <bk:year>      <xd:text> gYear(); </xd:text> </bk:year>
        <bk:price>     <xd:text> decimal(); </xd:text> </bk:price>
        <bk:author xd:script="occurs *"> <xd:text> string(); </xd:text> </bk:author>
        <bk:title>     <xd:text> string(); </xd:text> </bk:title>

You can try it HERE
Prev  Content   Next