Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Can't figure out this error

  Asked By: Bhagavati    Date: Mar 15    Category: Sharepoint    Views: 809

Does anyone know what this error means?

XML Load Error: Invalid at the top level of the document.

Its strange I have this VBscript running just fine in one web part
and when I try and use it in another, it throws this error. This is
the script as it looks when it works ok:

function getContent(xmlpart)
Dim sContent

Dim boolIsCoordinator
boolIsCoordinator = TestRights(ReadParameterFromGetOrPost("DataUrl"),
4)

If boolIsCoordinator Then

sContent = "i AM A COORDINATOR"

Else

sContent = "I AM NOT A COORDINATOR"

End If

getContent = sContent
End Function

THIS IS THE SCRIPT WHEN IT DOESN'T WORK:

Function getContent( xmlPart )
Dim xmldom
Dim strXML
Dim nodeTemp
Dim blnReducedFunctionalityMode
Dim strUserName
Dim Group
Dim Member
Dim strServer



Set xmldom = Factory.CreateObject("Microsoft.XMLDOM")
strXML = xmlPart.selectSingleNode
("/WebPart/PartStorage").firstChild.text


If Len(strXML) > 0 Then
xmldom.loadXML(strXML)
Else
xmldom.load( "<?xml version='1.0'?><favorites/>" )
End If

Dim boolIsCoordinator
boolIsCoordinator = TestRights
(ReadParameterFromGetOrPost("DataUrl"), 4)

If boolIsCoordinator Then

blnReducedFunctionalityMode = false

Else

blnReducedFunctionalityMode = true

End If


If blnReducedFunctionalityMode = true Then
Set nodeTemp = xmldom.createElement
( "ReducedFunctionality" )
xmldom.selectSingleNode( "/favorites" ).appendChild
(nodeTemp)
End If


getContent = xmldom.xml

End Function

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jose Scott     Answered On: Mar 15

Just a thought can you trim the strXML, could there be a control char
and len is not really zero therefore you are trying to load  a blank
string?



Set xmldom = Factory.CreateObject("Microsoft.XMLDOM")
strXML = xmlPart.selectSingleNode
("/WebPart/PartStorage").firstChild.text


If Len(strXML) > 0 Then

 
Answer #2    Answered By: Taylor Clark     Answered On: Mar 15

I figured it out. A warning to anyone using XP Developer, everytime I
work on a .vbs or .xsl file on the actual sharepoint server via XP
Developer, the file gets corrupted and either I can no longer open
the file in xp developer or what just happened occurs. When I copy
the file from sharepoint > my desktop > back to sharepoint, the file
is ok.

 
Didn't find what you were looking for? Find more on Can't figure out this error Or get search suggestion and latest updates.




Tagged: