CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_reader_settings.h
1
2
3#pragma once
4
5#include <xml/validation_type.h>
6#include <xml/schema/xml_schema_validation_flags.h>
7#include <xml/schema/validation_event_handler.h>
8#include <xml/dtd_processing.h>
9#include <xml/conformance_level.h>
10#include <system/object.h>
11#include <system/enum_helpers.h>
12#include <cstdint>
13
14
16namespace System
17{
18namespace IO
19{
20class Stream;
21class TextReader;
22} // namespace IO
23class String;
24class Uri;
25namespace Xml
26{
27namespace Schema
28{
29class XmlSchemaSet;
30} // namespace Schema
31class XmlCharCheckingReader;
32class XmlNameTable;
33class XmlParserContext;
34class XmlReader;
35class XmlResolver;
36class XmlSqlBinaryReader;
37class XmlTextReaderImpl;
38class XmlValidatingReaderImpl;
39namespace XPath
40{
41class XPathNavigatorReader;
42} // namespace XPath
43class XsdValidatingReader;
44} // namespace Xml
45} // namespace System
47
48namespace System {
49
50namespace Xml {
51
56class ASPOSECPP_SHARED_CLASS XmlReaderSettings final : public System::Object
57{
60
61 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
62 ASPOSECPP_SHARED_RTTI_INFO_DECL();
63
64public:
65
68
69private:
71 friend class XmlSqlBinaryReader;
72 friend class XmlReader;
73 friend class XmlCharCheckingReader;
74 friend class XmlTextReaderImpl;
75 friend class XmlValidatingReaderImpl;
76 friend class XsdValidatingReader;
77 friend class Schema::XmlSchemaSet;
78 friend class XPath::XPathNavigatorReader;
80
81public:
82
88 ASPOSECPP_SHARED_API SharedPtr<XmlNameTable> get_NameTable();
91 ASPOSECPP_SHARED_API void set_NameTable(const SharedPtr<XmlNameTable>& value);
94 ASPOSECPP_SHARED_API void set_XmlResolver(const SharedPtr<System::Xml::XmlResolver>& value);
97 ASPOSECPP_SHARED_API int32_t get_LineNumberOffset();
100 ASPOSECPP_SHARED_API void set_LineNumberOffset(int32_t value);
103 ASPOSECPP_SHARED_API int32_t get_LinePositionOffset();
106 ASPOSECPP_SHARED_API void set_LinePositionOffset(int32_t value);
113 ASPOSECPP_SHARED_API void set_ConformanceLevel(System::Xml::ConformanceLevel value);
116 ASPOSECPP_SHARED_API bool get_CheckCharacters();
119 ASPOSECPP_SHARED_API void set_CheckCharacters(bool value);
124 ASPOSECPP_SHARED_API int64_t get_MaxCharactersInDocument();
129 ASPOSECPP_SHARED_API void set_MaxCharactersInDocument(int64_t value);
132 ASPOSECPP_SHARED_API int64_t get_MaxCharactersFromEntities();
135 ASPOSECPP_SHARED_API void set_MaxCharactersFromEntities(int64_t value);
138 ASPOSECPP_SHARED_API bool get_IgnoreWhitespace();
141 ASPOSECPP_SHARED_API void set_IgnoreWhitespace(bool value);
144 ASPOSECPP_SHARED_API bool get_IgnoreProcessingInstructions();
147 ASPOSECPP_SHARED_API void set_IgnoreProcessingInstructions(bool value);
150 ASPOSECPP_SHARED_API bool get_IgnoreComments();
153 ASPOSECPP_SHARED_API void set_IgnoreComments(bool value);
157 ASPOSECPP_SHARED_API bool get_ProhibitDtd();
161 ASPOSECPP_SHARED_API void set_ProhibitDtd(bool value);
168 ASPOSECPP_SHARED_API void set_DtdProcessing(System::Xml::DtdProcessing value);
172 ASPOSECPP_SHARED_API bool get_CloseInput();
175 ASPOSECPP_SHARED_API void set_CloseInput(bool value);
183 ASPOSECPP_SHARED_API void set_ValidationType(System::Xml::ValidationType value);
203 ASPOSECPP_SHARED_API void set_Schemas(const SharedPtr<Schema::XmlSchemaSet>& value);
204
206 ASPOSECPP_SHARED_API XmlReaderSettings();
207
210 template<class... Args> void ValidationEventHandler_add(Args... value)
211 {
212 CheckReadOnly(u"ValidationEventHandler");
213 _valEventHandler.connect(value...);
214 }
217 template<class... Args> void ValidationEventHandler_remove(Args... value)
218 {
219 CheckReadOnly(u"ValidationEventHandler");
220 _valEventHandler.disconnect(value...);
221 }
222
224 ASPOSECPP_SHARED_API void Reset();
227 ASPOSECPP_SHARED_API SharedPtr<XmlReaderSettings> Clone();
228 // For internal purposes
229 ASPOSECPP_SHARED_API void CheckReadOnly(const String& propertyName);
230
231protected:
232
234 bool get_IsXmlResolverSet();
235 void set_IsXmlResolverSet(bool value);
236 bool get_ReadOnly();
237 void set_ReadOnly(bool value);
238
240 SharedPtr<System::Xml::XmlResolver> GetXmlResolver_CheckConfig();
242 SharedPtr<XmlReader> CreateReader(const String& inputUri, const SharedPtr<XmlParserContext>& inputContext);
243 SharedPtr<XmlReader> CreateReader(const SharedPtr<IO::Stream>& input, const SharedPtr<Uri>& baseUri, String baseUriString, const SharedPtr<XmlParserContext>& inputContext);
244 SharedPtr<XmlReader> CreateReader(const SharedPtr<IO::TextReader>& input, String baseUriString, const SharedPtr<XmlParserContext>& inputContext);
245 SharedPtr<XmlReader> CreateReader(const SharedPtr<XmlReader>& reader);
246 SharedPtr<XmlReader> AddValidation(SharedPtr<XmlReader> reader);
247 SharedPtr<XmlReader> AddConformanceWrapper(const SharedPtr<XmlReader>& baseReader);
249
250 virtual ASPOSECPP_SHARED_API ~XmlReaderSettings();
251
253 #ifdef ASPOSE_GET_SHARED_MEMBERS
254 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
255 #endif
257
258private:
259
260 SharedPtr<XmlNameTable> _nameTable;
262 int32_t _lineNumberOffset;
263 int32_t _linePositionOffset;
264 System::Xml::ConformanceLevel _conformanceLevel;
265 bool _checkCharacters;
266 int64_t _maxCharactersInDocument;
267 int64_t _maxCharactersFromEntities;
268 bool _ignoreWhitespace;
269 bool _ignorePIs;
270 bool _ignoreComments;
271 System::Xml::DtdProcessing _dtdProcessing;
272 System::Xml::ValidationType _validationType;
273 Schema::XmlSchemaValidationFlags _validationFlags;
276 bool _closeInput;
277 bool _isReadOnly;
278 bool pr_IsXmlResolverSet;
279
280 void Initialize();
281 void Initialize(const SharedPtr<System::Xml::XmlResolver>& resolver);
282 static SharedPtr<System::Xml::XmlResolver> CreateDefaultResolver();
283 SharedPtr<XmlReader> AddValidationAndConformanceWrapper(SharedPtr<XmlReader> reader);
284 SharedPtr<XmlValidatingReaderImpl> CreateDtdValidatingReader(const SharedPtr<XmlReader>& baseReader);
285
286};
287
288} // namespace Xml
289} // namespace System
290
291
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Contains a cache of XML Schema definition language (XSD) schemas.
Definition: xml_schema_set.h:66
Represents a reader that provides fast, noncached, forward-only access to XML data.
Definition: xml_reader.h:73
Specifies a set of features to support on the XmlReader object created by the XmlReader::Create metho...
Definition: xml_reader_settings.h:57
void set_CheckCharacters(bool value)
Sets a value indicating whether to do character checking.
void set_MaxCharactersFromEntities(int64_t value)
Sets a value indicating the maximum allowable number of characters in a document that result from exp...
int64_t get_MaxCharactersFromEntities()
Returns a value indicating the maximum allowable number of characters in a document that result from ...
void set_ValidationType(System::Xml::ValidationType value)
Sets a value indicating whether the XmlReader will perform validation or type assignment when reading...
System::Xml::ConformanceLevel get_ConformanceLevel()
Returns the level of conformance which the XmlReader will comply.
void set_LineNumberOffset(int32_t value)
Sets line number offset of the XmlReader object.
bool get_CheckCharacters()
Returns a value indicating whether to do character checking.
void set_XmlResolver(const SharedPtr< System::Xml::XmlResolver > &value)
Sets the XmlResolver used to access external documents.
bool get_CloseInput()
Returns a value indicating whether the underlying stream or TextReader should be closed when the read...
void set_IgnoreComments(bool value)
Sets a value indicating whether to ignore comments.
int64_t get_MaxCharactersInDocument()
Returns a value indicating the maximum allowable number of characters in an XML document....
void set_CloseInput(bool value)
Sets a value indicating whether the underlying stream or TextReader should be closed when the reader ...
Schema::XmlSchemaValidationFlags get_ValidationFlags()
Returns a value indicating the schema validation settings. This setting applies to XmlReader objects ...
int32_t get_LineNumberOffset()
Returns line number offset of the XmlReader object.
bool get_IgnoreProcessingInstructions()
Returns a value indicating whether to ignore processing instructions.
void set_MaxCharactersInDocument(int64_t value)
Sets a value indicating the maximum allowable number of characters in an XML document....
void set_IgnoreProcessingInstructions(bool value)
Sets a value indicating whether to ignore processing instructions.
void ValidationEventHandler_add(Args... value)
Adds an event handler that occurs when the reader encounters validation errors.
Definition: xml_reader_settings.h:210
bool get_IgnoreWhitespace()
Returns a value indicating whether to ignore insignificant white space.
void set_Schemas(const SharedPtr< Schema::XmlSchemaSet > &value)
Sets the XmlSchemaSet to use when performing schema validation.
void set_NameTable(const SharedPtr< XmlNameTable > &value)
Sets the XmlNameTable used for atomized string comparisons.
int32_t get_LinePositionOffset()
Returns line position offset of the XmlReader object.
System::Xml::DtdProcessing get_DtdProcessing()
Returns a value that determines the processing of DTDs.
void set_ProhibitDtd(bool value)
Sets a value indicating whether to prohibit document type definition (DTD) processing.
void set_IgnoreWhitespace(bool value)
Sets a value indicating whether to ignore insignificant white space.
void CheckReadOnly(const String &propertyName)
SharedPtr< XmlNameTable > get_NameTable()
Returns the XmlNameTable used for atomized string comparisons.
void set_ConformanceLevel(System::Xml::ConformanceLevel value)
Sets the level of conformance which the XmlReader will comply.
void Reset()
Resets the members of the settings class to their default values.
void set_ValidationFlags(Schema::XmlSchemaValidationFlags value)
Sets a value indicating the schema validation settings. This setting applies to XmlReader objects tha...
void set_LinePositionOffset(int32_t value)
Sets line position offset of the XmlReader object.
XmlReaderSettings()
Initializes a new instance of the XmlReaderSettings class.
void set_DtdProcessing(System::Xml::DtdProcessing value)
Sets a value that determines the processing of DTDs.
SharedPtr< Schema::XmlSchemaSet > get_Schemas()
Returns the XmlSchemaSet to use when performing schema validation.
bool get_IgnoreComments()
Returns a value indicating whether to ignore comments.
void ValidationEventHandler_remove(Args... value)
Removes an event handler that occurs when the reader encounters validation errors.
Definition: xml_reader_settings.h:217
SharedPtr< XmlReaderSettings > Clone()
Creates a copy of the XmlReaderSettings instance.
bool get_ProhibitDtd()
Returns a value indicating whether to prohibit document type definition (DTD) processing.
System::Xml::ValidationType get_ValidationType()
Returns a value indicating whether the XmlReader will perform validation or type assignment when read...
@ Stream
The type that supports reliable, two-way, connection-based byte streams without duplication of data a...
System::MulticastDelegate< void(SharedPtr< Object >, SharedPtr< ValidationEventArgs >)> ValidationEventHandler
Represents the callback method that will handle XML schema validation events and the ValidationEventA...
Definition: validation_event_handler.h:33
XmlSchemaValidationFlags
Specifies schema validation options used by the XmlSchemaValidator and XmlReader classes.
Definition: xml_schema_validation_flags.h:18
ConformanceLevel
Specifies the amount of input or output checking that XmlReader and XmlWriter objects perform.
Definition: conformance_level.h:15
ValidationType
Specifies the type of validation to perform.
Definition: validation_type.h:15
@ Schema
Validate according to XML Schema definition language (XSD) schemas, including inline XML Schemas....
@ Xml
Serialize according to the XML 1.0 rules.
DtdProcessing
Specifies the options for processing DTDs. The DtdProcessing enumeration is used by the XmlReaderSett...
Definition: dtd_processing.h:15
Definition: db_command.h:9