ctrlXML xmlNodeValue()

Discussion about recent product features & solutions!
2 posts • Page 1 of 1
nglazov
Posts:3
Joined: Fri Feb 21, 2014 7:19 am

ctrlXML xmlNodeValue()

Post by nglazov »

I try to read value from xml node.
xml:

Code: Select all

test
WinCC OA:

Code: Select all

void readInstanceFromXML()
{
  uint docID;
  string fileName;
  string errMsg; 
  int errLine, errColumn; 
  fileName = PVSS_PATH+"/test.xml"; 
  
  docID = xmlDocumentFromFile(fileName, errMsg, errLine, errColumn); 
  DebugN("Errors:", errMsg, errLine, errColumn); 
  uint ui = xmlFirstChild(docID);

  DebugTN(xmlNodeValue(docID, ui));
}
In log i see:
WCCOAui1:["Errors:"][""][-1][-1]
WCCOAui1:2014.10.06 19:23:24.432[""]
instead "test"

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: ctrlXML xmlNodeValue()

Post by mkoller »

Add the following after xmlFirstChild():
ui = xmlFirstChild(docID, ui);

The text is a separate node below the "tag" element

2 posts • Page 1 of 1