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

Method init

dds/DCPS/QOS_XML_Handler/XML_String_Intf.cpp:69–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 }
68
69 DDS::ReturnCode_t
70 QOS_XML_String_Handler::init(const ACE_TCHAR * membuf)
71 {
72 DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
73 try
74 {
75 // Create a InputSource to be used in parser with XML string
76 XMLCh * conv = XMLString::transcode(ACE_TEXT_ALWAYS_CHAR (membuf));
77 TranscodeToStr xmlTranscoded(conv,"utf-8");
78 XMLString::release(&conv);
79 MemBufInputSource xmlBuf(xmlTranscoded.str(), xmlTranscoded.length() ,"xml (in memory)");
80
81 ///////////////////
82 // Configure Parser
83 //
84 // Perform Namespace processing.
85 parser_->setDoNamespaces (true);
86 // Discard comment nodes in the document
87 parser_->setCreateCommentNodes (false);
88 // Disable datatype normalization. The XML 1.0 attribute value
89 // normalization always occurs though.
90 // parser_->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
91
92 // Do not create EntityReference nodes in the DOM tree. No
93 // EntityReference nodes will be created, only the nodes
94 // corresponding to their fully expanded sustitution text will be
95 // created.
96 parser_->setCreateEntityReferenceNodes (false);
97 // Perform Validation
98 parser_->setValidationScheme (xercesc::AbstractDOMParser::Val_Always);
99 // Do not include ignorable whitespace in the DOM tree.
100 parser_->setIncludeIgnorableWhitespace (false);
101 // Enable the parser_'s schema support.
102 parser_->setDoSchema (true);
103 // Enable full schema constraint checking, including checking which
104 // may be time-consuming or memory intensive. Currently, particle
105 // unique attribution constraint checking and particle derivation
106 // restriction checking are controlled by this option.
107 parser_->setValidationSchemaFullChecking (true);
108 // The parser_ will treat validation error as fatal and will exit.
109 parser_->setValidationConstraintFatal (true);
110
111 // Set resolver using auxiliary XML_Schema_Resolver
112 parser_->setEntityResolver(res_);
113
114 // Set XML Error handler
115 parser_->setErrorHandler(eh_);
116
117 // Parsing buffer
118 try {
119 parser_->parse(xmlBuf);
120 }
121 catch (const SAXParseException& toCatch) {
122 char* message = XMLString::transcode(toCatch.getMessage());
123 ACE_ERROR ((LM_ERROR,
124 ACE_TEXT ("QOS_XML_String_Handler::init - ")
125 ACE_TEXT ("Exception message is: <%C>\n"),
126 message));

Callers

nothing calls this directly

Calls 10

releaseFunction · 0.85
instanceFunction · 0.85
ddsFunction · 0.85
getLengthMethod · 0.80
itemMethod · 0.80
_infoMethod · 0.80
strMethod · 0.45
lengthMethod · 0.45
parseMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected