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

Discussion in 'SQL Server' started by rhaazy, Aug 7, 2007.

  1. rhaazy

    rhaazy New Member

    Joined:
    Jul 6, 2007
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    0
    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)
     
    Last edited by a moderator: Aug 7, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
    Just paste the content into a file and save it as somename.xml
     
  3. rhaazy

    rhaazy New Member

    Joined:
    Jul 6, 2007
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  4. rhaazy

    rhaazy New Member

    Joined:
    Jul 6, 2007
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    0
    I was able to create a serialization class to do this, thanks anyway.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice