Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSXML 4.0 problem 1

Status
Not open for further replies.

sergeiY

Programmer
Feb 13, 2003
132
AU
Hi

I am an XML newbe and I have this MSXML 4.0 compatibility problem... My code runs on MSXML 2.5 and 3.0 OK but when I use MSXML 4.0 it stop working (no ASP errors!)

OK what I am doing I am comparaing 2 XML files that represent directory and file structure on 2 boxes and reporting any problems

This is my ASP code:
****************************************************
Code:
Set objRootElement = objXMLFrom.documentElement
			
For i = 0 To objRootElement.childNodes.length - 1
	
	'get current dir details
	strDirName = Replace(objRootElement.childNodes.item(i).getAttribute("name"), "\", "\\")
	
	'find it in other XML document
	Set currentDir = objXMLTo.documentElement.selectSingleNode("//dir[@name='" & strDirName & "']")
	
	If(currentDir Is Nothing) Then
		strErrorsList = AddComparisonError(CONST_MISSING_DIR)
	End if
	
	'go over files in current direcotry
	For j = 0 To objRootElement.childNodes.item(i).childNodes.length - 1
		
		'get current file details
		strFileName = Replace(objRootElement.childNodes.item(i).childNodes.item(j).getAttribute("name"), "\","\\")
		strFileSize = objRootElement.childNodes.item(i).childNodes.item(j).getAttribute("size")
		strSccInfo = objRootElement.childNodes.item(i).childNodes.item(j).getAttribute("scc")
		
		'find it in other XML document
		Set currnetFile =objXMLTo.documentElement.selectSingleNode("//dir[@name='" & strDirName & "']" & "/file[@name='" & strFileName & "']")
		
		If(currnetFile Is Nothing) Then
			strErrorsList = AddComparisonError(CONST_MISSING_FILE)
		Else
			 if(CDbl(currnetFile.attributes(1).nodeValue) <> CDbl(strFileSize) OR currnetFile.attributes(2).nodeValue <> strSccInfo) Then
			 	strErrorsList = AddComparisonError(CONST_WRONG_SCC_INFO)
			 End If
		End If
	Next
Next
****************************************************

and this is my fromXML:
****************************************************
Code:
- <sourceCode machine=&quot;W000802ACBBE3&quot; path=&quot;c:\sites\anzgold\[URL unfurl="true"]wwwroot\reader\&quot;[/URL] date=&quot;30/06/2003 10:37&quot;>
- <dir name=&quot;order&quot;>
  <file name=&quot;order\index.cfm&quot; size=&quot;3297&quot; scc=&quot;$Modtime: 6/05/03 3:43p $&quot; /> 
  <file name=&quot;order\orderAgreementAdditional.cfm&quot; size=&quot;3219&quot; scc=&quot;$Modtime: 11/02/03 4:48p $&quot; /> 
  <file name=&quot;order\orderConfirmation.cfm&quot; size=&quot;2542&quot; scc=&quot;$Modtime: 11/02/03 4:49p $&quot; /> 
  <file name=&quot;order\orderConfirmationAdditional.cfm&quot; size=&quot;4232&quot; scc=&quot;$Modtime: 11/02/03 4:49p $&quot; /> 
  <file name=&quot;order\printPopupAdditional.cfm&quot; size=&quot;3318&quot; scc=&quot;$Modtime: 11/02/03 4:49p $&quot; /> 
  <file name=&quot;order\readerPopup.cfm&quot; size=&quot;689&quot; scc=&quot;$Modtime: 6/05/03 3:43p $&quot; /> 
  <file name=&quot;order\termsAndConditionsPopup.cfm&quot; size=&quot;847&quot; scc=&quot;$Modtime: 31/03/03 10:10a $&quot; /> 
  </dir>
- <dir name=&quot;&quot;>
  <file name=&quot;index.cfm&quot; size=&quot;3253&quot; scc=&quot;$Modtime: 6/05/03 3:42p $&quot; /> 
  <file name=&quot;install.cfm&quot; size=&quot;2925&quot; scc=&quot;$Modtime: 21/03/03 12:27p $&quot; /> 
  <file name=&quot;installPopup.cfm&quot; size=&quot;10558&quot; scc=&quot;$Modtime: 18/03/03 8:56a $&quot; /> 
  <file name=&quot;types.cfm&quot; size=&quot;692&quot; scc=&quot;$Modtime: 21/03/03 3:23p $&quot; /> 
  <file name=&quot;use.cfm&quot; size=&quot;3586&quot; scc=&quot;$Modtime: 13/03/03 3:26p $&quot; /> 
  </dir>
  </sourceCode>
********************************************************
and this is my ToXml:

Code:
- <sourceCode machine=&quot;W000802ACBBE3&quot; path=&quot;c:\sites\anzfirst\[URL unfurl="true"]wwwroot\reader\&quot;[/URL] date=&quot;30/06/2003 10:37&quot;>
- <dir name=&quot;order&quot;>
  <file name=&quot;order\index.cfm&quot; size=&quot;3298&quot; scc=&quot;$Modtime: 6/05/03 12:03p $&quot; /> 
  <file name=&quot;order\orderAgreementAdditional.cfm&quot; size=&quot;3222&quot; scc=&quot;$Modtime: 11/02/03 2:25p $&quot; /> 
  <file name=&quot;order\orderConfirmation.cfm&quot; size=&quot;2537&quot; scc=&quot;$Modtime: 11/02/03 2:25p $&quot; /> 
  <file name=&quot;order\orderConfirmationAdditional.cfm&quot; size=&quot;4204&quot; scc=&quot;$Modtime: 11/02/03 2:26p $&quot; /> 
  <file name=&quot;order\printPopupAdditional.cfm&quot; size=&quot;3319&quot; scc=&quot;$Modtime: 11/02/03 2:26p $&quot; /> 
  <file name=&quot;order\readerPopup.cfm&quot; size=&quot;690&quot; scc=&quot;$Modtime: 6/05/03 12:03p $&quot; /> 
  <file name=&quot;order\termsAndConditionsPopup.cfm&quot; size=&quot;847&quot; scc=&quot;$Modtime: 31/03/03 10:10a $&quot; /> 
  </dir>
- <dir name=&quot;&quot;>
  <file name=&quot;index.cfm&quot; size=&quot;3150&quot; scc=&quot;$Modtime: 6/05/03 12:02p $&quot; /> 
  <file name=&quot;install.cfm&quot; size=&quot;2925&quot; scc=&quot;$Modtime: 21/03/03 12:27p $&quot; /> 
  <file name=&quot;installPopup.cfm&quot; size=&quot;10558&quot; scc=&quot;$Modtime: 18/03/03 8:51a $&quot; /> 
  <file name=&quot;types.cfm&quot; size=&quot;693&quot; scc=&quot;$Modtime: 21/03/03 3:03p $&quot; /> 
  <file name=&quot;use.cfm&quot; size=&quot;3587&quot; scc=&quot;$Modtime: 13/03/03 3:26p $&quot; /> 
  </dir>
  </sourceCode>
***************************************************

when I run it with 4.0 it can't find any matches in first directory <dir name=&quot;order&quot;> and all child elemnts in this element but works fine for other dir: <dir name=&quot;&quot;> and all child elements

I know this is big chunk of code and it must be hard to see what's wrong here but I really need to get this code working on 4.0... Any help will be greatly appreciated.

Thank you

Sergei
 
I can't see anything wrong off the top of my head. Could you add a litte info on &quot;Stops working&quot;.

Blank screen?

Try scattering some Response.Write's throughtout it. I would concentrate on making sure it is actually matching the directories for the first directory, then if it is, you'll have another clue on why it isn't matching files.

-Tarwn

[sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Do you know how hot your computer is running at home? I do
 
Tarwn

When I said stoped working I meant it stop matching elements ... and what I found that it will not match all elements but only top level directory and it children...

I'll try to debug it one more time today... I thought I might be using some depreciated method that is no longer supported in MSXML 4.0...

Sergei
 
Thats what I had suspected, but I copied it over to my text editor and started looking through it and couldn't find anything that would suddenly be unsupported. The main functions you have are:
childNodes
selectSingleNode
getAttribute
nodeValue

I'll take a closer look and see if maybe there is something that could've gotten more strict or maybe an object who's default method has changed.

-Tarwn

[sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Do you know how hot your computer is running at home? I do
 
Found it :)

Take out the replace that doubles up the slashes in your filename. Believe it or not thats actually what is causing the problem. Took me a little time to find it. Basically it's not finding anyfile with double slashes in it, take out the replace and suddenly it will find them all and report on the scc info on everything but termsAndConditions and the install file.

I deal with to many languages, so I can't remember now if earlier versions required these double slashes or allowed you to put them in where other languages required them. Sorry i didn't catch this earlier,

-Tarwn

[sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Do you know how hot your computer is running at home? I do
 
Excellent! Thank you Tarwn. You deserved a star for this one.

Sergei
 
Eh, I'm not sure on that. I still don't really understand the cause of the problem here. I can't believe they would take out functionality like that and not mention it more obviously in the documentation. Maybe I'll add a list of undocumented features to my website after the fifty other things I don't have time to add :p

Glad to have helped you, was a difficult little problem to find. Let me know if you run into anything else that has changed like that, maybe we could put up a FAQ of the major under-documented changes between older versions and version 4.

-Tarwn

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
minilogo.gif alt=tiernok.com
The never-completed website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top