Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   How do I create this XML document from ms sql server 2005 (http://www.go4expert.com/forums/i-create-xml-document-ms-sql-server-2005-t5735/)

rhaazy 7Aug2007 19:55

How do I create this XML document from ms sql server 2005
 
I need to create this XML document:

Code:

  <?xml version="1.0" encoding="utf-8" ?>
- <ScanConfiguration>
- <Configurations>
  <Configuration ID="4" PID="1" Name="Basic Overview"
UOM="IsScanned">TRUE</Configuration>
  <Configuration ID="5" PID="1" Name="Drives" UOM="IsScanned">FALSE</
Configuration>
  <Configuration ID="6" PID="1" Name="ErrorLog" UOM="IsScanned">FALSE</
Configuration>
  <Configuration ID="7" PID="1" Name="MSI Installed"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="8" PID="1" Name="Normal Installed"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="9" PID="1" Name="Active Setup"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="10" PID="1" Name="Software Usage"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="11" PID="1" Name="Memory" UOM="IsScanned">FALSE</
Configuration>
  <Configuration ID="12" PID="1" Name="OS" UOM="IsScanned">FALSE</
Configuration>
  <Configuration ID="13" PID="1" Name="PhysicalDisks"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="14" PID="1" Name="Basic Processor Info"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="15" PID="1" Name="Detailed Return Info"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="16" PID="1" Name="Processor Cache Info"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="17" PID="1" Name="Running Programs"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="18" PID="1" Name="Security Info"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="19" PID="1" Name="Port Information"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="20" PID="1" Name="Security Settings"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="21" PID="1" Name="System Restore"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="22" PID="1" Name="Windows Firewall"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="23" PID="1" Name="Windows Update"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="24" PID="1" Name="Driver Services"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="25" PID="1" Name="Process Services"
UOM="IsScanned">FALSE</Configuration>
  <Configuration ID="26" PID="1" Name="StartUp" UOM="IsScanned">FALSE</
Configuration>
  <Configuration ID="27" PID="1" Name="TCPIP" UOM="IsScanned">FALSE</
Configuration>
  <Configuration ID="28" PID="1" Name="InternetCache"
UOM="IsScanned">FALSE</Configuration>
  </Configurations>
  </ScanConfiguration>

the columns in the database are from tblScanProfileDetail:
Section(ID), ScanProfileHeaderID(PID), Type(Name), and Value(TRUE/FALSE)

shabbir 7Aug2007 23:09

Re: How do I create this XML document from ms sql server 2005
 
Just paste the content into a file and save it as somename.xml

rhaazy 7Aug2007 23:13

Re: How do I create this XML document from ms sql server 2005
 
Let me rephrase the question, i am having trouble serializing the dataset into the xml document. I have tried using FORXML EXPLICIT and tried using column mapping properties built into .NET, however I am unable to get the desired output.

rhaazy 8Aug2007 00:36

Re: How do I create this XML document from ms sql server 2005
 
I was able to create a serialization class to do this, thanks anyway.


All times are GMT +5.5. The time now is 09:20.