How to Upload an XML and validate it to a schema?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Steerman
    New Member
    • Mar 2008
    • 3

    #1

    How to Upload an XML and validate it to a schema?

    My Index.asp looks like this:

    <%
    'Load XML
    set xml = Server.CreateOb ject("Microsoft .XMLDOM")
    xml.async = false
    xml.load(Server .MapPath("test. xml"))

    'Load XSL
    set xsl = Server.CreateOb ject("Microsoft .XMLDOM")
    xsl.async = false
    xsl.load(Server .MapPath("style sheet.xsl"))

    'Transform file
    Response.Write( xml.transformNo de(xsl))
    %>

    It works fine, but now i want my users to be able to upload their own files, and get them validated with my stylesheet. Can anyone please help me?
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Do you already have a widget to upload a file? Not sure what language you're using, but suggest you seek an answer in that particular forum.

    Assuming you do, I would simply copy the file uploaded to stylesheet.xsl, and then run the transformation. Of course, this would not make it threadsafe. You could also store the file name in a variable, say uploadFile and then load the xsl from there.

    xsl.load(Server .MapPath(upload File))

    Comment

    • Steerman
      New Member
      • Mar 2008
      • 3

      #3
      Hey....

      Can you please help me? I will pay you for it.

      Here is my index.asp

      <html>
      <body>
      <form action="Index2. asp" method="post" ENCTYPE="multip art/form-data">
      Filen: <input type="file" name="uploadfil e.xml" />
      <input type="submit" value="submit" />
      </form>
      </body>
      </html>

      Here is my index2.asp

      <%
      'Load XML
      set xml = Server.CreateOb ject("Microsoft .XMLDOM")
      xml.async = false
      xml.load(Server .MapPath("uploa dfile.xml"))

      'Load XSL
      set xsl = Server.CreateOb ject("Microsoft .XMLDOM")
      xsl.async = false
      xsl.load(Server .MapPath("style sheet.xsl"))

      'Transform file
      Response.Write( xml.transformNo de(xsl))
      %>

      Please tell me what to do

      Comment

      Working...