Citect - Reading data from *.xml file

electro89

Member
Join Date
Mar 2012
Location
Canada
Posts
106
The task I need to ultimately accomplish is deriving specific data from an XML file using Cicode. The data I would need to get would be in this structure:
<text left="851" top="338" width="111" height="47" font-face="Arial" font-style="bold" font-size="10">DATA I WANT</text>

I thought that a File Function would be able to skip to this line, and write it to a string variable, but (using FileSeek), I can only jump to a line by character number, which will not work because the length of each line will vary (the number of lines will not).

Next, I created an ASCII Device, and used some Device Functions, but ended up with the same results. Also, changing the file extension to a .dbf or .xls and using a dBASE Device did not give me any output at all.

Any help on how I can accomplish this would be very helpful. I'm surprised I cannot find anything online.

I'm also open to using other resources, such as batch.

Thanks,
Martino
 
FileReadLn, from what I know, only shows you the text up to the end of the line. Are you saying that if I put, for example, 5 in a row, I will get to line 5? I'm not near my pc right now but I will try in the morning
 
Yup, that's exactly what I'm saying. When you open a file, the file pointer points to the beginning of the file. As you read the file, the pointer moves.

The function FileSeek places the pointer in a specific position and is typically useful for binary files.(Not usefull for you in this case)
 
for anyone else wondering, I've completed this code and the "string" functions were very helpful for narrowing down the value I needed.
More specifically, I used
StrLength //to find length of whole line
StrSearch //searched number of characters up to first > and second <
StrRight
StrLeft //trimmed right and left xml code
 

Similar Topics

Hi guys, I want to read some data which are defined in Trend Tags in Citect 7.1. In fact, I want to specify an exact time and date to find the...
Replies
1
Views
2,214
hi how can i read string type data from registers by citect? i have defined a variable tag in form of strip type and assigned it to an object in...
Replies
0
Views
1,693
I need help with vijeo citect 7.4 as I use Modbus TCPIP to get the data, it turns out the address is having error.. For example, when I write...
Replies
2
Views
861
Dear All, I have a little problem in reading data from Power Meter to Vijeo Citect v6.0 I'm using Schneider PM810MG for Energy reading from...
Replies
0
Views
3,277
Hy, I configured a Citect application that reads data from an energy meter...now i need to add to the application a time limitting reading...
Replies
15
Views
9,079
Back
Top Bottom