|
-
Nov 14th, 2004, 02:52 PM
#1
Thread Starter
Fanatic Member
XML Newbie question
I have a simple XML format
<Block>
<Block_Title></Block_Title>
<BlockCode></BlockCode>
<PreProcess></PreProcess>
</Block>
<Config></Config>
Which I have had to wrap with <root></root> but other than that it's basic and does the job
Now here is the code that will deal with the contents.
Module_Name and Block_Name are used to build the file and path relative to the function (that's the job of another bit of code).
[vbscript]
<%
Function DoBlockPut(Module_Name, Block_Name)
Dim mydoc, objLst
Set mydoc=Server.CreateObject("Microsoft.XMLDOM")
Set objLst = Server.CreateObject("Microsoft.XMLDOM")
mydoc.async=false
mydoc.load(Server.MapPath(Module_Name & "\Blocks\" & Block_Name & ".block"))
'Debugging
Response.Write Server.MapPath(Module_Name & "\Blocks\" & Block_Name & ".block") & "<br />"
if mydoc.parseError.errorcode<>0 then
Response.write "Error with Block_XML (" & mydoc.parseError.errorcode & ") with " & Module_name & " - " & Block_Name & "<br />"
else
' proceed
Set objLst = mydoc.getElementsByTagName("Block")
dim title, code, btype
Set title = mydoc.getNamedItem("Block_Title")
Set code = mydoc.getNamedItem("BlockCode")
Set btype = mydoc.getNamedItem("PreProcess")
'Call StartBox(title)
if btype = 0 then
server.execute(code)
Else
response.write(code)
end if
'Call EndBox
end if
end function
%>
[/vbscript]
however it seems I can do no right with this section
Set objLst = mydoc.getElementsByTagName("Block")
dim title, code, btype
Set title = mydoc.getNamedItem("Block_Title")
Set code = mydoc.getNamedItem("BlockCode")
Set btype = mydoc.getNamedItem("PreProcess")
which has now come to look a little silly as it has not worked no matter what I have done.
I have to admit I have no idea what I am doing. with this XML stuff for the main part and when it comes to MSXML ...foobar bar bar foo ...I have no idea.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|