SDK

Functions

int SPI_XML_open_xml_file (const std::string &dir, const std::string &name)
 Opens an xml file for reading.
 
void SPI_XML_close_xml_file ()
 Closes xml file.
 
int SPI_XML_find_node (const std::string &nodeName)
 Finds and selects a node from the XML file
The node must be unique in the file.
 
int SPI_XML_select_node (const std::string &nodeName)
 Selects a node from the XML file (relative mode)
 
int SPI_XML_select_next_node ()
 Selects next node with same name.
 
int SPI_XML_select_parent_node ()
 Selects the parent node of the current node.
 
int SPI_XML_select_root_node ()
 Selects root node.
 
int SPI_XML_select_node_loop (const std::string &nodeName)
 Selects a node (relative mode) to loop.
 
int SPI_XML_select_next_node_loop ()
 Selects next node of same name in the loop.
 
int SPI_XML_get_current_string_attrib (const std::string &attribName, std::string &value)
 Reads the string value of the attribute.
 
int SPI_XML_get_current_real_attrib (const std::string &attribName, double *value)
 Reads the real value of the attribute.
 
int SPI_XML_get_current_integer_attrib (const std::string &attribName, int *value)
 Reads the integer value of the attribute.
 
int SPI_XML_get_current_child (std::string &value)
 Reads the value contained in the node.
 
int SPI_XML_read_node_string (const std::string &nodeName, std::string &value)
 Reads the string value of a node.
 
int SPI_XML_read_node_real (const std::string &nodeName, double *value)
 Reads the real value of a node.
 
int SPI_XML_read_node_integer (const std::string &nodeName, int *value)
 Reads the integer value of a node.
 

Detailed Description

Reading XML files

Function Documentation

◆ SPI_XML_close_xml_file()

void SPI_XML_close_xml_file ( )

Closes xml file.

Version
5.13.206
void SPI_XML_close_xml_file()
Closes xml file.
Definition sp_xml01.c:132

◆ SPI_XML_find_node()

int SPI_XML_find_node ( const std::string & nodeName)

Finds and selects a node from the XML file
The node must be unique in the file.

Version
5.13.206
Parameters
[in]nodeNamenode name
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_find_node,'MyNode');
int SPI_XML_find_node(const std::string &nodeName)
Finds and selects a node from the XML file The node must be unique in the file.
Definition sp_xml01.c:153

◆ SPI_XML_get_current_child()

int SPI_XML_get_current_child ( std::string & value)

Reads the value contained in the node.

Version
5.13.206
Parameters
[out]valuevalue contained in the node
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_get_current_child,sVal);
int SPI_XML_get_current_child(std::string &value)
Reads the value contained in the node.
Definition sp_xml01.c:497

◆ SPI_XML_get_current_integer_attrib()

int SPI_XML_get_current_integer_attrib ( const std::string & attribName,
int * value )

Reads the integer value of the attribute.

Version
5.13.206
Parameters
[in]attribNameattrib name
[out]valueinteger attrib value
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_get_current_integer_attrib,'MyString',iVal);
int SPI_XML_get_current_integer_attrib(const std::string &attribName, int *value)
Reads the integer value of the attribute.
Definition sp_xml01.c:459

◆ SPI_XML_get_current_real_attrib()

int SPI_XML_get_current_real_attrib ( const std::string & attribName,
double * value )

Reads the real value of the attribute.

Version
5.13.206
Parameters
[in]attribNameattrib name
[out]valuereal attrib value
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_get_current_real_attrib,'MyString',rVal);
int SPI_XML_get_current_real_attrib(const std::string &attribName, double *value)
Reads the real value of the attribute.
Definition sp_xml01.c:421

◆ SPI_XML_get_current_string_attrib()

int SPI_XML_get_current_string_attrib ( const std::string & attribName,
std::string & value )

Reads the string value of the attribute.

Version
5.13.206
Parameters
[in]attribNameattrib name
[out]valuestring attrib value
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_get_current_string_attrib,'MyString',sVal);
int SPI_XML_get_current_string_attrib(const std::string &attribName, std::string &value)
Reads the string value of the attribute.
Definition sp_xml01.c:383

◆ SPI_XML_open_xml_file()

int SPI_XML_open_xml_file ( const std::string & dir,
const std::string & name )

Opens an xml file for reading.

Version
5.13.206
Parameters
[in]dirfolder name
[in]namefile name
Returns
SPI_YES if Ok | SPI_NO if error
ifile := ICALL(SPI_XML_open_xml_file,'c:\tmp','file');
int SPI_XML_open_xml_file(const std::string &dir, const std::string &name)
Opens an xml file for reading.
Definition sp_xml01.c:59
Sub main()
NomFic = "fic_xml_courbes.xml"
RepFic = "v:\"
If (Go2cam.SPI_XML_open_xml_file(RepFic, NomFic) = SPI_YES) Then
If (Go2cam.SPI_XML_select_root_node() = SPI_YES) Then
If (Go2cam.SPI_XML_select_node("CadCurves") = SPI_YES) Then
If (Go2cam.SPI_XML_select_node("CurvesList") = SPI_YES) Then
If (Go2cam.SPI_XML_select_node_loop("Curve") = SPI_YES) Then
Do
If (Go2cam.SPI_XML_select_node("PointList") = SPI_YES) Then
If (Go2cam.SPI_XML_select_node_loop("Point") = SPI_YES) Then
Do
ier = Go2cam.SPI_XML_get_current_real_attrib("x", pt(0))
ier = Go2cam.SPI_XML_get_current_real_attrib("y", pt(1))
ier = Go2cam.SPI_XML_get_current_real_attrib("z", pt(2))
'do what you want with point coordinate
Loop While (Go2cam.SPI_XML_select_next_node_loop() = SPI_YES)
Call Go2cam.SPI_XML_select_parent_node 'Point
End If
Call Go2cam.SPI_XML_select_parent_node 'PointList
End If
Loop While (Go2cam.SPI_XML_select_next_node_loop() = SPI_YES)
Call Go2cam.SPI_XML_select_parent_node 'Curve
End If
Call Go2cam.SPI_XML_select_parent_node 'CurvesList
End If
Call Go2cam.SPI_XML_select_parent_node 'CadCurves
End If
End If
End If
End sub
int SPI_XML_select_node_loop(const std::string &nodeName)
Selects a node (relative mode) to loop.
Definition sp_xml01.c:307
int SPI_XML_select_parent_node()
Selects the parent node of the current node.
Definition sp_xml01.c:251
int SPI_XML_select_next_node_loop()
Selects next node of same name in the loop.
Definition sp_xml01.c:355
int SPI_XML_select_root_node()
Selects root node.
Definition sp_xml01.c:279
int SPI_XML_select_node(const std::string &nodeName)
Selects a node from the XML file (relative mode)
Definition sp_xml01.c:189

◆ SPI_XML_read_node_integer()

int SPI_XML_read_node_integer ( const std::string & nodeName,
int * value )

Reads the integer value of a node.

Version
5.13.206
Attention
This function does not select the node
Parameters
[in]nodeNamenode name
[out]valueinteger value of node
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_read_node_integer,'MyNode',rVal);
int SPI_XML_read_node_integer(const std::string &nodeName, int *value)
Reads the integer value of a node.
Definition sp_xml01.c:615

◆ SPI_XML_read_node_real()

int SPI_XML_read_node_real ( const std::string & nodeName,
double * value )

Reads the real value of a node.

Version
5.13.206
Attention
This function does not select the node
Parameters
[in]nodeNamenode name
[out]valuereal value of node
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_read_node_real,'MyNode',rVal);
int SPI_XML_read_node_real(const std::string &nodeName, double *value)
Reads the real value of a node.
Definition sp_xml01.c:573

◆ SPI_XML_read_node_string()

int SPI_XML_read_node_string ( const std::string & nodeName,
std::string & value )

Reads the string value of a node.

Version
5.13.206
Attention
This function does not select the node
Parameters
[in]nodeNamenode name
[out]valuestring value of node
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_read_node_string,'MyNode',sVal);
int SPI_XML_read_node_string(const std::string &nodeName, std::string &value)
Reads the string value of a node.
Definition sp_xml01.c:531

◆ SPI_XML_select_next_node()

int SPI_XML_select_next_node ( )

Selects next node with same name.

Version
5.13.206
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_select_next_node);
int SPI_XML_select_next_node()
Selects next node with same name.
Definition sp_xml01.c:223

◆ SPI_XML_select_next_node_loop()

int SPI_XML_select_next_node_loop ( )

Selects next node of same name in the loop.

Version
5.13.206
Returns
SPI_YES if Ok | SPI_NO if error

◆ SPI_XML_select_node()

int SPI_XML_select_node ( const std::string & nodeName)

Selects a node from the XML file (relative mode)

Version
5.13.206
Parameters
[in]nodeNamenode name
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_select_node,'MyNode');

◆ SPI_XML_select_node_loop()

int SPI_XML_select_node_loop ( const std::string & nodeName)

Selects a node (relative mode) to loop.

Version
5.13.206
Parameters
[in]nodeNamenode name
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_select_node_loop,'MyNodeLoop');
VB6 example of a loop
If (Go2cam.SPI_XML_select_node("PointList") = SPI_YES) Then
If (Go2cam.SPI_XML_select_node_loop("Point") = SPI_YES) Then
Do
ier = Go2cam.SPI_XML_get_current_real_attrib("x", pt(0))
ier = Go2cam.SPI_XML_get_current_real_attrib("y", pt(1))
ier = Go2cam.SPI_XML_get_current_real_attrib("z", pt(2))
'do what you want with point coordinate
Loop While (Go2cam.SPI_XML_select_next_node_loop() = SPI_YES)
Call Go2cam.SPI_XML_select_parent_node 'Point
End If
Call Go2cam.SPI_XML_select_parent_node 'PointList
End If

◆ SPI_XML_select_parent_node()

int SPI_XML_select_parent_node ( )

Selects the parent node of the current node.

Version
5.13.206
Returns
SPI_YES if Ok | SPI_NO if error

◆ SPI_XML_select_root_node()

int SPI_XML_select_root_node ( )

Selects root node.

Version
5.13.206
Returns
SPI_YES if Ok | SPI_NO if error
ival := ICALL(SPI_XML_select_root_node);