XML Read
Jaaahhh
✭
Hello,
I am sure it must be easy but......
I am trying to read an XML file with RAB builder in vb.Net, the problem is that when I set the instruction ' m_xmlr.Read()' the program jumps to the catch instruction and I get the following error.
This is my program code!
Imports System.Xml
Dim m_xmlr As XmlTextReader
Sub Read_XML()
Try
' Create the XML Reader
m_xmlr = New XmlTextReader(xmlFile)
' Read the XML file
m_xmlr.Read()
' The rest of the code is not implemented.......
..................
'
Catch ex As Exception
GTPUMessageBox.Show(Nothing, Nothing, ex.ToString, "Debug", System.Windows.Forms.MessageBoxIcon.Exclamation, System.Windows.Forms.MessageBoxButtons.OK)
End Try
Endsub
Best Regards,
Edwin,
0
Comments
-
Hi,I found this sample on MSDN, which shows how to configure the XmlReader to be able to access a file on the web (which I know is not what you are doing) ;" Create the reader.
Dim reader as XmlTextReader = new XmlTextReader("http://myServer/data/books.xml")
' Supply the credentials necessary to access the Web server.
Dim resolver as XmlUrlResolver = new XmlUrlResolver()
resolver.Credentials = CredentialCache.DefaultCredentials
reader.XmlResolver = resolver
"From what I could understand the reader also tries to resolve references to Schemas, specified in the XML file over the web.Its a long shot, but try to set the XmlTextReader.Resolver to Nothing/Null, and make sure your file path is valid so its not mistaken for a resource on the web for some strange reason.0 -
Hello,I am still having the problem. On the VC I can set the path as =>
objMessages = New clsMessages("D:CsiProjects empTest_PM_IzhoraHOMEError_Log_Ru.xml")
My appl. works perfectly!Now the problem, what must it be on a real controller? I tried =>'objMessages = New clsMessages("Error_Log_Ru.xml") ' Does not work!!!!!
'objMessages = New clsMessages("home:/Error_Log_Ru.xml") ' Werkt niet!!!!!
'objMessages = New clsMessages("Error_Log_Ru.xml") ' Does not work!!!!!
'objMessages = New clsMessages("/hd0a/66Z-51925/HOME/Error_Log_Ru.xml") ' Does not work!!!!!
'objMessages = New clsMessages("/hd0a/66Z-51925/home/Error_Log_Ru.xml") Does not work!!!!!What is the correct path name??Best Regards,0 -
Hi Jaaahh,the FlexPendant device itself is a separate computer compared to the IRC5 controller.So when you write code like "new FileStream(path, FileMode.Open);" the path specified can not be a path on the controller file system.Basically you have to get the file from the controller to the FlexPendant using the Controller.FileSystem class which provides FTP-like functionality.Then you can open the file on the FlexPendant.Example:[CODE]FileStream fs = null;
if (this._Controller.IsVirtual)
{
fs = new FileStream(this._HomeDir + "/mpLocation.mod", FileMode.Open);
}
else
{
// on the real controller, get the file first
FileSystem fsys = this._Controller.FileSystem;
fsys.RemoteDirectory = this._HomeDir;
fsys.GetFile("mpLocation.mod", "/Temp/" + "mpLocation.mod");
fs = new FileStream("/Temp/" + "mpLocation.mod", FileMode.Open);
}[/CODE]There may be a better way to handle the VC/RC issue than the one in my example. I'll check that and come back.0 -
Hi guys,I want to log the error in to the "Event log".I know the list of errors in my applications.I would like to create a XML file to list out my all the application errors.While running my applications any error occurs, I would like to log in to the event log.Which will be helpful for me to trace what happened in the process.Guide me. Thank you.Lingaa0
-
Hi,do you want your software to create event log entries, or save all entries (or some of them) to an XML file?0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings