Jump to content

How to creat a mapping schema in this case?


Crazyfrog2005

Recommended Posts

Hi everyoneI am having a problem with creating a mapping shema to bulk load a xml data file to sql server 2000 enterprise manager. I am new to xml schema. I have read some online examples, however, can't solve it. My case is a bit more complicated. After 2 hours debugging, not yet finished. My xml file is like that below:<details> <manager> <id>0</id> <sign_id>104</sign_id> <staff_no>532257</staff_no> <sign_name>Carolyn Ng</sign_name> <sign_title>Director Relationships</sign_title> <sign_phone>empty</sign_phone> <sign_fax>empty</sign_fax> <email_addr>carolyn_ng@westpac.co.nz</email_addr> <signature> <image file="I:\Analytics\Campaigns\Signatures\104.tif"> </image> </signature> </manager> ...</details>And there is a table 'tblSignature' in sql server database, which is to be filled in with the data in xml file.I feel the hardest part is the elements <signature> and <image>, and the attribute "file". What i am thinking now is I may have to create 3 tables in order to load this xml file to database. One for element <manager>, one for element <signature>, and one for <image>. And there is a relationship among those 3. But since every table should have a primary key, whereas <signature> obiviously has only a link to <image>, it makes me screwed up here. In addition, all i want is to load all the data in xml file into 1 table rather than 3. Can anyone help me with this please? Many thanks.

Link to comment
Share on other sites

Hi,For each signature, does it only have one image file? Or a signature can have many images? If it only has one image, I think you can create just one table manager. Then id, sign_id, ... signature are the columns. In signature, just put in the image file name.(Btw I'm also new to XSchema)

Link to comment
Share on other sites

Hi,For each signature, does it only have one image file? Or a signature can have many images? If it only has one image, I think you can create just one table manager. Then id, sign_id, ... signature are the columns. In signature, just put in the image file name.(Btw I'm also new to XSchema)

:) Hi budThere is only one image file for each signature. Yes, actually I am going to design one table to put all of the data in, which is exactly the same as your design idea. However, my problem here is how to create a mapping schema to do so. I tried many times and encountered some error messages. I solved some, but still debugging and don't know how far i need to go to have it done. What i am doing now is i download a software called 'ms xml viewer', which looks pretty good. However, i am not familiar with it and play with it at the moment. But it seems only help you to create a schema based on either a database table, or a xml data file. In order to create a well-matched mapping schema to both of my database table and xml file, i still have no idea to do. :) I am really a newbie, amn't I? Hopefully, you or someone xml pro can give me advice. Many thanks. Btw, glad to see your reply. Cheers
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...