MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / parseXML

Function parseXML

tests/DCPS/QoS_XML/dumpXMLString/qos_dumpXMLString.cpp:10–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <sstream>
9
10int parseXML(
11 const char* fileName,
12 const ACE_TCHAR* profileName,
13 const ACE_TCHAR* topicName,
14 OpenDDS::DCPS::QOS_XML_String_Handler& xml_membuf)
15{
16 int retval = 0;
17
18 try
19 {
20
21 // read file and create string
22 std::ifstream ifs(fileName);
23 std::stringstream buffer;
24 buffer << ifs.rdbuf();
25
26 // Add env variable and path to search schemas
27 xml_membuf.add_search_path(ACE_TEXT("DDS_ROOT"),ACE_TEXT("/docs/schema/"));
28 // initialize and parse XML
29 DDS::ReturnCode_t const retcode = xml_membuf.init(ACE_TEXT_CHAR_TO_TCHAR (buffer.str().c_str()));
30
31 if (retcode == DDS::RETCODE_OK)
32 {
33 DDS::ReturnCode_t retcode_qos;
34 ::DDS::DataWriterQos dw_qos;
35 retcode_qos = xml_membuf.get_datawriter_qos (
36 dw_qos,
37 profileName,
38 topicName);
39 if (retcode_qos != DDS::RETCODE_OK)
40 {
41 ACE_ERROR ((LM_ERROR, "PARSEXML - "
42 "%s : get_datawriter_qos return an error. Retcode <%d>\n",
43 fileName, retcode_qos));
44 ++retval;
45 }
46
47 if (dw_qos.history.kind != ::DDS::KEEP_ALL_HISTORY_QOS)
48 {
49 ACE_ERROR ((LM_ERROR, "PARSEXML - "
50 "%s : get_datawriter_qos return an invalid history kind.\n",
51 fileName));
52 ++retval;
53 }
54 if (dw_qos.history.depth != 5)
55 {
56 ACE_ERROR ((LM_ERROR, "PARSEXML - "
57 "%s : get_datawriter_qos return an invalid history depth.\n",
58 fileName));
59 ++retval;
60 }
61
62 ::DDS::DataReaderQos dr_qos;
63 retcode_qos = xml_membuf.get_datareader_qos (
64 dr_qos,
65 profileName,
66 topicName);
67 if (retcode_qos != DDS::RETCODE_OK)

Callers 1

ACE_TMAINFunction · 0.85

Calls 10

_tao_print_exceptionMethod · 0.80
add_search_pathMethod · 0.45
initMethod · 0.45
strMethod · 0.45
get_datawriter_qosMethod · 0.45
get_datareader_qosMethod · 0.45
get_topic_qosMethod · 0.45
get_publisher_qosMethod · 0.45
get_subscriber_qosMethod · 0.45
get_participant_qosMethod · 0.45

Tested by

no test coverage detected