SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast RSBomber's Avatar
    Join Date
    Oct 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    doctype in xml file causing problems (asp)

    I am loading real estate data through an XML file and transforming it with XSL. The problem is... the real estate listing company recently added a doctype declaration to their XML file and it no longer loads. If I manually remove the doctype from the XML file and re-upload it... everything works great. I'm at a loss as to how to get around this issue. Any help/advice would be greatly appreciated. Here's some of the code I am using (the important stuff anyway):

    ASP Page
    Code:
    <%
    
    'Create an instance of the Microsoft XML parser (XMLDOM).
    Set MyXMMML = Server.CreateObject("Microsoft.XMLDOM")
    MyXMMML.async = false
    
    'Load the XML file into memory.
    MyXMMML.load(Server.MapPath("PATH/TO/XML/FILE.XML"))
    
    'Create yet another instance of the Microsoft XML parser.
    Set MyXSSSL = Server.CreateObject("Microsoft.XMLDOM")
    MyXSSSL.async = false
    
    'Load the XSL file into memory.
    MyXSSSL.load(Server.MapPath("PATH/TO/XSL/FILE.XSL"))
    
    %>
    
    ... The ASP page uses the following declarations ...
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    ... Later on in the page I am calling this ...
    
    <%
    Response.Write(MyXMMML.transformNode(MyXSSSL))
    %>
    XML FILE
    Code:
    <?xml version="1.0" ?>
    <!DOCTYPE RETS SYSTEM "http://cornerstone.mris.com:6103/platinum/rets/dtd/RETS-20021015.dtd">
    
    ... The <!DOCTYPE above is the culprit ...
    Everything works great if the doctype is removed... but since they recently added it... nothing works
    XSL FILE
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    ... Not sure this even matters ...
    Is there a way to remove the doctype tag from the XML file with either ASP or through XSL? Any other work a rounds are welcome as well. I've spent way too much time on this already and am at a complete loss.

    Thanks

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,239
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    The doctype is important if you need to validate the document structure. I'm not sure if simply removing it is a good idea. Does the XML file meet this definition?
    Code XML:
    <!-- <!DOCTYPE RETS SYSTEM "RETS-20021015.dtd"> -->
    <!-- <!DOCTYPE RETS [ -->
    <!--   Real Estate Transaction Specification (RETS) DTD  -->
    <!--   Real Estate Transaction Markup Language (RETML)  -->
    <!--
    	submitted by:
    	Leendert Bijnagte
    	Fidelity National Information Solutions, Inc.
    	Version 1.x  11/20/2001
     
    	Revision 1.5: Leendert Bijnagte, Michael Del Gaudio
    	                      Edited by Bruce Toback
    -->
    <!-- BASIC ELEMENTS -->
    <!--DATE/TIME ELEMENTS -->
    <!--see ISO 8601 for acceptable values for Format -->
    <!ENTITY  % REData SYSTEM "REData-20021015.dtd">
    %REData;
    <!ATTLIST RETS
    	ReplyCode CDATA #REQUIRED
    	ReplyText CDATA #REQUIRED
    >
    <!ELEMENT COUNT EMPTY>
    <!ATTLIST COUNT
    	Records CDATA #REQUIRED
    >
    <!ELEMENT MAXROWS EMPTY>
    <!ATTLIST MAXROWS
    	value CDATA #IMPLIED
    >
    <!ELEMENT RETS-STATUS EMPTY>
    <!ATTLIST RETS-STATUS
    	ReplyCode CDATA #IMPLIED
    	ReplyText CDATA #IMPLIED
    >
    <!-- COMPOUND ELEMENTS -->
    <!-- PACKAGING ELEMENTS -->
    <!ELEMENT RETS (COUNT?,  REData?,MAXROWS?, RETS-STATUS?)>
    <!-- ]> -->

  3. #3
    SitePoint Enthusiast RSBomber's Avatar
    Join Date
    Oct 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply. I'm still not sure why the recent addition of a doctype to the XML file is breaking things. Nothing else has changed. Any ideas of what might be causing this given the code example I provided? Am I missing something obvious here? Is there a way to parse out the doctype of the XML file prior to displaying it on the page using XSS or even ASP? Removing the doctype fro the XML file definitely fixes everything.

    Thanks again for your help.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,239
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    I see that RETS-20021015.dtd references another DTD file, REData-20021015.dtd, which is fairly lengthy and complex. Fortunately MSXML provides a way to find parser errors. Try
    HTML Code:
    <html>
    <head><title>XML Parser Error Check</title>
    </head>
    <body>
    <script type="text/javascript">
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
    xmlDoc.async="false"
    xmlDoc.load("http://[path to XML file here].xml")
    
    document.write("<br />Error Code: ")
    document.write(xmlDoc.parseError.errorCode)
    document.write("<br />Error Reason: ")
    document.write(xmlDoc.parseError.reason)
    document.write("<br />Error Line: ")
    document.write(xmlDoc.parseError.line)
    </script>
    
    </body>
    </html>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •