bulk transfer/copy data from SQL dB to XML using XSD validation


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: bulk transfer/copy data from SQL dB to XML using XSD validation

Hybrid View

  1. #1
    Join Date
    Jul 2008
    Posts
    32

    bulk transfer/copy data from SQL dB to XML using XSD validation

    bulk transfer/copy data from SQL dB to XML using XSD validation .
    , when the data is written frm SQL to XML i need it to get validated using a given XSD file currently i am just able to write frm SQL to XML with no validation but i need to use the given XSD file

    msxml6.dll: The filename, directory name,
    or volume label syntax is incorrect.

    when i use the validation given in the script

    'Validate the data file prior to bulkload
    Dim sOutput

    sOutput = ValidateFile("c:\test\SampleXMLData.xml", "", "c:\test\SampleSchema.xml")

    WScript.Echo sOutput

    'If FileValid Then
    ' Check constraints and initiate transaction (if needed)
    ' objBL.CheckConstraints = True
    ' objBL.Transaction=True
    'Execute XML bulkload using file.

    objBL.Execute "c:\test\SampleSchema.xml", "c:\test\SampleXMLData.xml"
    set objBL=Nothing
    'End If




    Function ValidateFile(strXmlFile,strUrn,strXsdFile)

    ' Create a schema cache and add SampleSchema.xml to it.
    Dim xs, fso, sAppPath
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set xs = CreateObject("MSXML2.XMLSchemaCache.6.0")
    sAppPath = fso.GetFolder(".")
    xs.Add strUrn, sAppPath & "\" & strXsdFile

    ' Create an XML DOMDocument object.
    Dim xd
    Set xd = CreateObject("MSXML2.DOMDocument.6.0")

    ' Assign the schema cache to the DOM document.
    ' schemas collection.
    Set xd.schemas = xs

    ' Load XML document as DOM document.
    xd.async = False
    xd.Load sAppPath & "\" & strXmlFile

    ' Return validation results in message to the user.
    If xd.parseError.errorCode <> 0 Then
    ValidateFile = "Validation failed on " & _
    strXmlFile & vbCrLf & _
    "=====================" & vbCrLf & _
    "Reason: " & xd.parseError.reason & _
    vbCrLf & "Source: " & _
    xd.parseError.srcText & _
    vbCrLf & "Line: " & _
    xd.parseError.Line & vbCrLf
    FileValid = False
    Else
    ValidateFile = "Validation succeeded for " & _
    strXmlFile & vbCrLf & _
    "======================" & _
    vbCrLf & "Contents to be bulkloaded" & vbCrLf
    FileValid = True
    End If
    End Function





    i get the above error , morover i need to transfer data from SQL to XML with the tag elements specified in the schema file ie XSD file
    Last edited by svibuk; 10-19-2010 at 09:04 AM.

  2. #2
    Join Date
    Oct 2008
    Posts
    142
    hi there,

    look at this page please --> http://www.computerperformance.co.uk...e_8007007B.htm

    so, it seems to be a vbscript error, like you are missing a parameter somewhere. it is related to your paths, so i guess it happens in the lines of code where you have a path, which in your case is not unc. which line of code does this error happen? what i am trying to say is that this error is not sql or xml.

    please, also look at this --> http://www.google.com/#hl=en&sa=X&ei...ec0a8ac5f5a7a2

    best regards,

    tonci korsano

Similar Threads

  1. XML files vs Database
    By Mansoor in forum XML
    Replies: 8
    Last Post: 08-23-2002, 05:35 PM
  2. Replies: 7
    Last Post: 01-13-2001, 03:15 PM
  3. SQL server administrative knowledge
    By Becky in forum Database
    Replies: 1
    Last Post: 07-11-2000, 04:27 PM
  4. Re: ODBC error
    By Devaraj in forum Enterprise
    Replies: 0
    Last Post: 05-11-2000, 01:48 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center