Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.NET read XSD from embedded resource

VB.NET read XSD from embedded resource

Scheduled Pinned Locked Moved Visual Basic
xmldatabasecsharpsql-server
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mpalmer78
    wrote on last edited by
    #1

    I'm reading xml from SQL server with VB.net using an XSD schema file. I have the code working fine, but I'd now like to change the code from reading a file on disk to reading the schema from the file as an embedded resource. Here's my code, what do I need to change?? Dim conString As String = "MyConnectionString" Dim strm As Stream Dim strmReader As StreamReader Dim cmd As New SqlXmlCommand(conString) Dim xmlDoc As New XmlDocument Dim strXML As String With cmd    .CommandText = "MyXPath"    .CommandType = SqlXmlCommandType.XPath    .SchemaPath = "C:\MySchemaFile.xsd" '**I want this to be embedded!!**    strm = .ExecuteStream End With strmReader = New StreamReader(strm) strXML = strmReader.ReadToEnd xmlDoc.LoadXml(strXML) Like I said, the above code works fine, but I don't want a physical file location. Thanks!!! -Michael

    M 1 Reply Last reply
    0
    • M mpalmer78

      I'm reading xml from SQL server with VB.net using an XSD schema file. I have the code working fine, but I'd now like to change the code from reading a file on disk to reading the schema from the file as an embedded resource. Here's my code, what do I need to change?? Dim conString As String = "MyConnectionString" Dim strm As Stream Dim strmReader As StreamReader Dim cmd As New SqlXmlCommand(conString) Dim xmlDoc As New XmlDocument Dim strXML As String With cmd    .CommandText = "MyXPath"    .CommandType = SqlXmlCommandType.XPath    .SchemaPath = "C:\MySchemaFile.xsd" '**I want this to be embedded!!**    strm = .ExecuteStream End With strmReader = New StreamReader(strm) strXML = strmReader.ReadToEnd xmlDoc.LoadXml(strXML) Like I said, the above code works fine, but I don't want a physical file location. Thanks!!! -Michael

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Michael. There are several articles on CodeProject that could help you. Do an article search on "embedded resource". Here's a link to one article[^] that may be useful.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups