Introduction to the XSD Editor(XML Schema Editor)

By Trung Ha
August 30, 2006

 

This tutorial will use the catalog.xsd from the "Editing and validating XML files" Examples. To create it, select New -> Examples... to launch the wizard. Follow the instructions described in the wizard, then click Finish to create the example project.

 

Once created, under the PublicationCatalogue folder, locate the Catalogue.xsd file and double click the file to open it in the XML Schema Editor. As shown below, an Outline and Properties view is provided in addition to the editor pane. At the bottom of the editor area you'll see that there is a 'Source' and a 'Design' tab at the bottom of the editor area. The 'Source' tab is used for basic XML source editing. The 'Design' tab is used for higher level graphical editing. Select the 'Design' tab so that you're looking at the Graph view. As shown below you should see a 'top-level' view of the XML Schema that summarizes all of the components (e.g. elements and types) that are defined in the schema. 



 

 

In order to see these components in detail you can 'drill down' on a component of interest by double clicking on it. For example, if we double click on the 'BookType' component, the editor will display the structure of the 'BookType' type as shown below. To return to the 'top-level' view, press the back button 

 at the top left of the editor, or right clicking within the editor and selecting 'Back to Schema' from the context menu.



  

 

Editing the schema is achieved by invoking context menu actions on selected objects in the Graph view and using the properties view to modify the properties of the selected object. Go back to the top-level view and follow the steps below to create a new element declaration and define its content.

  1. right click on the header of the 'Elements' section of the top level schema and choose 'Add Element'
  2. use the properties view to change the name of the element to 'Paper' 

     


  3. right click on Paper and select 'Set Type'->'New..." to create a new type for the element.


      


  4. select 'Complex Type' and check 'Create as anonymous type'. Click 'OK'.


      


  5. Double click on 'Paper' to explore this element, note that 'PaperType' is surrounded by parenthesis to indicate anonymity of this type. Click on this type to invoke the properties sheet for its.

  6. On the Properties sheet, select the 'Inherit From:' combo and then select 'Browse...' as shown below. 

     


  7. The Set Type dialog will appear. Select 'PublicationType', and click OK.


      


  8. Double click on Paper's type to edit its structure as shown below. Then right click on the '(PaperType)' and select 'Add Element'


      


  9. Name the newly added element 'URL' because, say, the paper is found on the web.


      


  10. The type of URL can be changed in the main editor panel by clicking on its current type 'string'. A combo box will be shown as below (For now we don't change the the type of URL yet) 


     


  11. Right click on '(PaperType)', select 'Add Element Ref' to create element reference. Initally, the editor will pick a random element to be referred. In this case, it's 'Book' as shown below. 


     


  12. We can change the element to be referred to in the main editor panel by click on 'Book'. A Combo will be shown as below. 


     


  13. Now that we've finished editing the XML Schema you can save the file.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值