September 08 2010 07:56:27
Navigation
· Home
· Online Store
· Course Outlines (PDF Files)
· Sample Videos
· Contact Info
· Web Links
· Articles (Sample Code)

Other Videos
· WordPress (CMS)
· Joomla (CMS)
· Sharepoint

Other
· FAQ
· Search
Contribute to This Site
· Submit Link
· Get Benefitted Sites
No Competition
One of our so-called competitors offers under 6 hours of video training for a whopping $219 (choke, gasp, spew - you could hire a private tutor for that price). Did I mention that they ship their training on VHS tapes (remember those?). Check out our 'Course Outlines' link above. We offer a 2-days of training (15 hours) for $54 (2 CDs at $29 each). You watch our videos from a CD/ROM on your computer. We also include real-world lab/assignments in each course.
Articles: XML Parse
XML Parse
'===========================================================
' NAME: XmlParseError.vbs 
' AUTHOR: Neal Walters 
' DATE  : 3/19/2006
' http://VBScript-Training.com 
'===========================================================

  Dim xmlDoc, xmlFileName 
  
  'allow drag/drop of filename onto this VB/Script 
  If WScript.Arguments.Count > 0 Then 
     xmlFileName = WScript.Arguments(0)
  Else 
     xmlFileName = "c:\Camtasia Studio\VBScript-Training2\books.xml" 
  end If 

  'DOM = Document Object Model 
  'set xmlDoc = CreateObject("MSXML2.DOMDocument") 
  Set xmlDoc = CreateObject("MSXML2.DOMDocument.4.0") 
  
  WScript.Echo "Filename=" & xmlFileName 

   ' Validate the document using the MSXML parser.
  xmlDoc.load (xmlFileName)
  
  If xmlDoc.parseError.errorCode Then
' Do something with the error.
      Wscript.Echo "Parse Error: " & vbcrlf & _ 
                   " Reason = "  & xmlDoc.parseError.reason & vbcrlf & _ 
                   " Line = "    & xmlDoc.parseError.line & vbcrlf & _ 
                   " linePos = " & xmlDoc.parseError.linePos & vbcrlf & _ 
                   " srcText = " & xmlDoc.parseError.srcText & vbcrlf & _ 
                   " ErrorCode = " & xmlDoc.parseError.ErrorCode & vbcrlf 

      WScript.quit 
      
  'else 
  '    WScript.Echo xmlDoc.xml 
  End If
  
  WScript.Echo xmlDoc.xml 
  

  WScript.Echo "The end" 


'===========================================================
' NAME: XmlParseError.vbs 
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/19/2006
' http://VBScript-Training.com 
'===========================================================

  Dim xmlDoc, strMyXml  
  

  'DOM = Document Object Model 
  'set xmlDoc = CreateObject("MSXML2.DOMDocument") 
  Set xmlDoc = CreateObject("MSXML2.DOMDocument.4.0") 
  
  
   ' Validate the document using the MSXML parser.
   
 strMyXml =  _  
"" & _  
"   " & _ 
"     MacBeth" & _ 
"	  William Shakespeare" & _
"	  1750" & _
"   " & _
"   " & _ 
"      A Tale of Two Cities" & _ 
"	  Charles Dicks" & _
"	  1875" & _ 
"   " & _
""   
   
  xmlDoc.loadXML (strMyXml) 

	  
  
  If xmlDoc.parseError.errorCode Then
' Do something with the error.
      Wscript.Echo "Parse Error: " & vbcrlf & _ 
                   " Reason = "  & xmlDoc.parseError.reason & vbcrlf & _ 
                   " Line = "    & xmlDoc.parseError.line & vbcrlf & _ 
                   " linePos = " & xmlDoc.parseError.linePos & vbcrlf & _ 
                   " srcText = " & xmlDoc.parseError.srcText & vbcrlf & _ 
                   " ErrorCode = " & xmlDoc.parseError.ErrorCode & vbcrlf 

      WScript.quit 
      
  'else 
  '    WScript.Echo xmlDoc.xml 
  End If
  
  WScript.Echo xmlDoc.xml 
  

  WScript.Echo "The end" 


'===========================================================
' NAME: XmlParseError3.vbs 
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/19/2006
' http://VBScript-Training.com 
'===========================================================

  Dim xmlDoc, xmlFileName 
  
  'allow drag/drop of filename onto this VB/Script 
  If WScript.Arguments.Count > 0 Then 
     xmlFileName = WScript.Arguments(0)
  Else 
     xmlFileName = "c:\Camtasia Studio\VBScript-Training2\books.xml" 
  end If 

  'DOM = Document Object Model 
  'set xmlDoc = CreateObject("MSXML2.DOMDocument") 
  Set xmlDoc = CreateObject("MSXML2.DOMDocument.4.0") 
  
  WScript.Echo "Filename=" & xmlFileName 

   ' Validate the document using the MSXML parser.
  xmlDoc.load (xmlFileName)
  
  If xmlDoc.parseError.errorCode Then
' Do something with the error.
      Wscript.Echo "Parse Error: " & vbcrlf & _ 
                   " Reason = "  & xmlDoc.parseError.reason & vbcrlf & _ 
                   " Line = "    & xmlDoc.parseError.line & vbcrlf & _ 
                   " linePos = " & xmlDoc.parseError.linePos & vbcrlf & _ 
                   " srcText = " & xmlDoc.parseError.srcText & vbcrlf & _ 
                   " ErrorCode = " & xmlDoc.parseError.ErrorCode & vbcrlf 

      WScript.quit 
      
  'else 
  '    WScript.Echo xmlDoc.xml 
  End If
  
  ' Everything the same 

 ' SelectNodes expects a valid "Xpath" parameter   
   set nodes = xmlDoc.selectNodes("//book[@type='computer']")
'  set nodes = xmlDoc.selectNodes("//book[year='2001']")
' set nodes = xmlDoc.selectNodes("//bookyear'2001']")  ' bad illegal Xpath expression 
  
  For Each node In nodes 
      WScript.Echo node.xml 
  Next 
  
  

  WScript.Echo "The end" 


Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Order Now - View Products


Default Shipping:
Phone: 214-403-6006
Our Sites
Software Training
XML-Online-Training.com
Biztalk-Training.com
SharePoint-Training.com
DotNet-AddOns-Training.com
CMSTrainingVideos.com

Language
LanguageLovers.com
Render time: 0.12 seconds 432,183 unique visits