Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_xml thread: I figured it out. but I still need help.


Message #1 by Pucky Loucks <PLoucks@a...> on Mon, 26 Mar 2001 15:20:50 -0800
What I'm trying to do is take many xml source documents and transform them

into 1 xml doc.

I am getting the xml files from SQL 2000 so ofcourse they come out like

<ROOT>

	<dbo.tablename SOMETHING="BLAH" etc....../>

</ROOT>



So for every xml doc I have a XSL file that transforms it into the format I

want.  

After that I use the following code to create my single xml doc.  



It works perfect, except if I reference it from another page.  First Here is

the code:

'***************************************************************************

**************************

'                             MY CODE STARTS HERE intranetxml.asp

'***************************************************************************

**************************

<%@ Language="vbscript"%>

<%



Dim source, style, OutPut

Response.ContentType = "text/xml"



'This File is to Merge the XML Source Documents into the main TREE Document

'TreeDoc is the main document that the intranet will use

set IntranetXML = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")



'******************************************************************

'                   START NAVIGATION 

'******************************************************************



'Loading and transforming the Navigation system.

set xmlNav = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")

xmlNav.async = false

xmlNav.load("http://ploucks/intranetxml/data/navs.xml")



set xslNavStyle = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")

xslNavStyle.async = false

xslNavStyle.load("http://ploucks/intranetxml/data/FlashNav.xsl")





xmlNav.transformNodeToObject xslNavStyle,IntranetXML



'******************************************************************

'                   END NAVIGATION 

'******************************************************************





'******************************************************************

'                   START HEADER

'******************************************************************

'Loading and transforming the The Header.

set xmlHeader = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")

xmlHeader.async = false

xmlHeader.load("http://ploucks/intranetxml/data/header.xml")



set xslHeader = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")

xslHeader.async = false

xslHeader.load("http://ploucks/intranetxml/data/header.xsl")



set NewXMLHeader = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")



xmlHeader.transformNodeToObject xslHeader, NewXMLHeader



IntranetXML.documentElement.appendChild(NewXMLHeader.documentElement)



'******************************************************************

'                   END HEADER

'******************************************************************



'******************************************************************

'                   START BIO

'******************************************************************

Set NewXMLDeptBio 

server.createObject("MSXML2.FreeThreadedDOMDocument.3.0")

set xmlDeptBio = server.createObject("MSXML2.FreeThreadedDOMDocument.3.0")

xmlDeptBio.async = false

xmlDeptBio.load("http://ploucks/intranetxml/data/deptbio.xml")



set xslDeptBio = server.createObject("MSXML2.FreeThreadedDOMDocument.3.0")

xslDeptBio.async = false

xslDeptBio.load("http://ploucks/intranetxml/data/deptbio.xsl")



xmlDeptBio.transformNodeToObject xslDeptBio, NewXMLDeptBio



IntranetXML.documentElement.appendChild(NewXMLDeptBio.documentElement)



'******************************************************************

'                   END BIO

'******************************************************************





Response.Write IntranetXML.xml



%>



'***************************************************************************

**************************

'                             MY CODE ENDS HERE

'***************************************************************************

**************************



OK.....so I get this page and it works great.  except if I have another page

that says this:



<%@ Language=VBScript %>

<%

PageID = request("PageID")

Response.ContentType = "text/xml"



set XMLfromASP = server.CreateObject("MSXML2.DOMDocument.3.0")

XMLfromASP.async = false

XMLfromASP.load("http://ploucks/intranet/XMLMenu.asp")



response.write XMLfromASP.xml



%>



The error I get is this:



The XML page cannot be displayed Cannot view XML input using style sheet.

Please correct the error and then click the refresh button, or try again

later.   XML document must have a top level element. 	

If I browse to the intranetxml.asp page and view source. I see my perfect

xml doc. 

How come I can't reference it?

Sorry for putting alot of information in with this post but I'd like to find

an answer.



Thanks,

Pucky Loucks




  Return to Index