Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applying XSD to an XML file

Status
Not open for further replies.

Torp23

Programmer
Jun 13, 2002
32
0
0
US
I have an XML file that is generated from SQL2000 that works just fine, but I need the output of that file to show each item as an element instead of as an attribute of the main element which is the default. I have been trying to apply an XSD schema that I have developed (based off a text book example) but can't figure out how to apply the schema to the XML file. The textbook seems to imply that it has something to do with an XPath language call, but I have been searching for a way to define this and I just can't find any good examples of doing this. Does anyone know how to relate an XSD file to an XML output file to change the format of the output?

Scott
 
Hi Torp23,
as far as I know, XSD is used to only validate and not to transform XML files structures. I use it to validate XML files, and nothing I read was about transforming existing XML files with XSD.
 
The example that I am working through is in the new MS press book called "XML" and it says that it recommends it as a way to transform the data as an alternative to using EXPLICIT mode. All I am trying to do is return data from SQL2000 as XML so that all the attributes are elements. The query that I have works, it just returns all the record items as attributes which messes up how it is read in other parts of the application. Any thoughts would be appreciated.

Scott
 
Hi Scott

Would XSL not help you to transform your document better? I've never tried using SQL to transform data like an XSD.

Hope you come right

Craftor

:cool:
 
I have decided to give up on using XSD for this and reposted this with a different question regarding the new methodology. Please read my new posting "DOM and SQL2000". If I can't get that method to work I am going to look into stripping out the unwanted text of what SQL2000 returns using XSL and seeing if that works for my application. I do not know off-hand how to do that though.

Thanks for your suggestion!

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top