Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Programming
»
XML
»
How to add attribute from Parent element to...
How to add attribute from Parent element to child element's attribute using visual studio designer
Rate Topic
Display Mode
Topic Options
Author
Message
Balaji L
Balaji L
Posted Wednesday, June 10, 2009 7:23 AM
SSC Eights!
Group: General Forum Members
Last Login: 2 days ago @ 2:53 AM
Points: 853,
Visits: 264
Hi,
Can you please take a look on the attached XSD.
The requirement here is how to add the root element attribute to all its child element.
Consider the root Element : DB and its attribute : MAC,INM and DBNM. (Shown in the attached doc)
Need to refer these attribute to all its child element.
How to achieve this using visual studio designer (Any other workaround also fine for me).
I tried to add attribute by right click on the child element select " New attribute ". But this doesn't helped me. I am not sure how to reference the attribute from the parent to child elements.
Any help would be really appreciated.
Thanks,
Balaji L
Post Attachments
SampleXml.zip
(
4 views,
1.04 KB
)
XSD_ScreenShot.doc
(
19 views,
123.50 KB
)
Post #732251
LutzM
LutzM
Posted Wednesday, June 10, 2009 12:57 PM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 12:04 PM
Points: 6,739,
Visits: 12,167
Hi Balaji,
I'm wondering how the xsd shows up all of a sudden... since it looks almost like the issue we discussed just the other day within the following thread
http://www.sqlservercentral.com/Forums/FindPost729749.aspx
...
The question you're asking is not clear to me at all...
Wherein do you need to refer the root element? Are you looking for a table structure in SQL Server, another xml statement, a modified xsd, a PowerPoint document or anything else?
What is the final goal you're trying to achieve with both of your posts (this one and the one I mentioned above)?
Would you please post your required result including some description what you're really looking for in total? It would make much more sense than starting various posts with frictions of the problem you're struggling with...
Btw: The element "MAC" is not a child element of "DB" and as per the structure of the xsd all ther other elements already are child elements of "DB".
Edit: typo fixed
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question
How to post performance related questions
Links for
Tally Table
,
Cross Tabs
and
Dynamic Cross Tabs
,
Delimited Split Function
Post #732565
Balaji L
Balaji L
Posted Wednesday, June 10, 2009 11:11 PM
SSC Eights!
Group: General Forum Members
Last Login: 2 days ago @ 2:53 AM
Points: 853,
Visits: 264
Lutz,
Element "DB" has attributes 'MNM','INM' and 'DBNM'. How do you make these as global attributes.
And "DB" element has its child element 'SOB,TBL,VW,CNST,etc..' I need all the child element should have the global attributes. How do you refer this.
So the child element SOB has additional 3 attributes like this 'OB,CNT,MNM,INM and DBNM'.
Likewise TBL has addtional 3 attributes along with TBL_Id,NM,OID,OWN,CDT,DB_Id.
I can easily import all the TBL attribute to table called 'xml_tbl'.
Please let me know if you have any question.
Thanks,
Balaji L
Post Attachments
Result.zip
(
3 views,
61.47 KB
)
Post #732752
LutzM
LutzM
Posted Thursday, June 11, 2009 4:00 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 12:04 PM
Points: 6,739,
Visits: 12,167
Your example shows the final result after importing the xml structure.
You don't really need the xsd for that...
So, the result set does not really have to do with the question you've asked. This expected result would have been much appreciated in the discussion earlier (see link above)...
If you'd need to include the DB name you just have to include in the select clause I posted in the link mentioned above.
But please be aware that the upload time will increase as already said in the post.
Another option would be to modify your xsd schemas so it already includes all the target tables and target column definition.
Then you could use the xsd for loading the xml file. For details on how to use xml data including usage of xml schema (if you have the option to do that) please read the XML workshop series by J. Sebastian (search for XML workshop on this site).
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question
How to post performance related questions
Links for
Tally Table
,
Cross Tabs
and
Dynamic Cross Tabs
,
Delimited Split Function
Post #732872
Balaji L
Balaji L
Posted Thursday, June 11, 2009 4:16 AM
SSC Eights!
Group: General Forum Members
Last Login: 2 days ago @ 2:53 AM
Points: 853,
Visits: 264
Lutz,
The result is achieved joining tables MAC,INST,DB,TBL. To avoid that I am looking to change the XSD. Declaring DB element attribute as global attribute. In that case I will get all the required column in a single attribute.
Seems to be its verys simple but not sure how to achieve this. ( how to declare one element attribute global and how to refer the global attribute in the child element)
Still I am searching answer for this. As suggested by you am going thru' online xml books.
Thanks,
Balaji L
Post #732882
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.