Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


MSXML2.DOMDocument.6.0 can't handle xsi:nil="true"?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61815
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MSXML2.DOMDocument.6.0 can't handle xsi:nil="true"?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 MSXML2.DOMDocument.6.0 can't handle xsi:nil="true&... - 6/24/2008 8:07:25 PM   
  Trojka

 

Posts: 7
Score: 0
Joined: 2/9/2005
From:
Status: offline
I'm trying to load a xmls using the MSSXML2.DOMDocument.6.0 object. All files load fine, except the ones with xsi:nil="true" values (the xml property is empty in these cases). I've tried all versions of MSSXML2.DOMDocument, but nothing seems to work.

Here's a little sample code to show what I mean:






Set objXMLDom = CreateObject("MSXML2.DOMDocument.6.0") 

'this works
'strXML = "<data><test>test</test></data>"

'this doesn't
strXML = "<data><test xsi:nil='true'/></data>"

objXMLDom.loadxml strXML

WScript.Echo objXMLDom.xml


< Message edited by Trojka -- 6/24/2008 8:08:35 PM >
 
 
Post #: 1
 
 RE: MSXML2.DOMDocument.6.0 can't handle xsi:nil="t... - 6/24/2008 9:09:32 PM   
  ehvbs

 

Posts: 2106
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Trojka,

if you look at the  objXMLDom.ParseError.Reason - "Reference to undeclared namespace prefix: 'xsi'.",
you'll realize that objXMLDom can't know anything about xsi, because your fragment doesn't contain
anything about it.

Regards

ehvbs

(in reply to Trojka)
 
 
Post #: 2
 
 RE: MSXML2.DOMDocument.6.0 can't handle xsi:nil="t... - 6/24/2008 11:45:34 PM   
  Trojka

 

Posts: 7
Score: 0
Joined: 2/9/2005
From:
Status: offline
I didn't know yet about ParseError.Reason. Nice. Makes sense too. Adding the following attributes to the data element:

xmlns:xsi="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:nil" xmlns="urn:nil"

has solved my problem.

Thanks ehvbs!

(in reply to ehvbs)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MSXML2.DOMDocument.6.0 can't handle xsi:nil="true"? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts