CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_schema_set.h
1
2
3#pragma once
4
5#include <xml/schema/validation_event_handler.h>
6#include <system/exceptions.h>
7#include <system/array.h>
8#include <cstdint>
9
10
12namespace System
13{
14namespace Collections
15{
16namespace Generic
17{
18template <typename, typename> class Dictionary;
19template <typename> class IList;
20template <typename, typename> class KeyValuePair;
21template <typename> class List;
22template <typename, typename> class SortedList;
23} // namespace Generic
24} // namespace Collections
25class Uri;
26namespace Xml
27{
28namespace Schema
29{
30class ChameleonKey;
31class Compiler;
32class ContentValidator;
33class SchemaInfo;
34class SchemaNames;
35class ValidationEventArgs;
36class XmlSchema;
37class XmlSchemaCompilationSettings;
38class Details_XmlSchemaException; using XmlSchemaException = System::ExceptionWrapper<Details_XmlSchemaException>;
39class XmlSchemaObject;
40class XmlSchemaObjectTable;
41class XmlSchemaSubstitutionGroup;
42class XmlSchemaValidator;
43enum class XmlSeverityType;
44} // namespace Schema
45class XmlNameTable;
46class XmlQualifiedName;
47class XmlReader;
48class XmlReaderSettings;
49class XmlResolver;
50class XsdValidatingReader;
51} // namespace Xml
52} // namespace System
54
55namespace System {
56
57namespace Xml {
58
59namespace Schema {
60
65class ASPOSECPP_SHARED_CLASS XmlSchemaSet : public System::Object
66{
67 typedef XmlSchemaSet ThisType;
69
70 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
71 ASPOSECPP_SHARED_RTTI_INFO_DECL();
72
73public:
74
77
78private:
80 friend class System::Xml::XsdValidatingReader;
81 friend class ContentValidator;
82 friend class Compiler;
83 friend class XmlSchemaValidator;
85
86public:
87
90 ASPOSECPP_SHARED_API SharedPtr<XmlNameTable> get_NameTable();
94 ASPOSECPP_SHARED_API bool get_IsCompiled();
97 ASPOSECPP_SHARED_API void set_XmlResolver(const SharedPtr<System::Xml::XmlResolver>& value);
108 ASPOSECPP_SHARED_API int32_t get_Count();
118
120 ASPOSECPP_SHARED_API XmlSchemaSet();
124 ASPOSECPP_SHARED_API XmlSchemaSet(const SharedPtr<XmlNameTable>& nameTable);
125
128 template<class... Args> void ValidationEventHandler_add(Args... value)
129 {
130 _eventHandler.disconnect(_internalEventHandler);
131 _eventHandler.connect(value...);
132 if (_eventHandler == nullptr)
133 {
134 _eventHandler = _internalEventHandler;
135 }
136 }
139 template<class... Args> void ValidationEventHandler_remove(Args... value)
140 {
141 _eventHandler.disconnect(value...);
142 if (_eventHandler == nullptr)
143 {
144 _eventHandler = _internalEventHandler;
145 }
146 }
147
158 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(String targetNamespace, const String& schemaUri);
169 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(String targetNamespace, const SharedPtr<XmlReader>& schemaDocument);
174 ASPOSECPP_SHARED_API void Add(const SharedPtr<XmlSchemaSet>& schemas);
183 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Add(const SharedPtr<XmlSchema>& schema);
190 ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Remove(const SharedPtr<XmlSchema>& schema);
197 ASPOSECPP_SHARED_API bool RemoveRecursive(const SharedPtr<XmlSchema>& schemaToRemove);
203 ASPOSECPP_SHARED_API bool Contains(String targetNamespace);
208 ASPOSECPP_SHARED_API bool Contains(const SharedPtr<XmlSchema>& schema);
211 ASPOSECPP_SHARED_API void Compile();
225 ASPOSECPP_SHARED_API void CopyTo(const ArrayPtr<SharedPtr<XmlSchema>>& schemas, int32_t index);
237
238protected:
239
244 SharedPtr<XmlSchemaObjectTable> substitutionGroups;
245
246 SharedPtr<Object> get_InternalSyncObject();
247 SharedPtr<XmlSchemaObjectTable> get_SubstitutionGroups();
249 SharedPtr<XmlSchemaObjectTable> get_TypeExtensions();
250 SharedPtr<SchemaInfo> get_CompiledInfo();
251 SharedPtr<XmlReaderSettings> get_ReaderSettings();
253
254 void Add(String targetNamespace, const SharedPtr<XmlReader>& reader, const SharedPtr<Collections::Generic::Dictionary<String, String>>& validatedNamespaces);
255 SharedPtr<XmlSchema> FindSchemaByNSAndUrl(const SharedPtr<Uri>& schemaUri, const String& ns, const ArrayPtr<Collections::Generic::KeyValuePair<SharedPtr<Uri>, SharedPtr<XmlSchema>>>& locationsTable);
256 SharedPtr<XmlSchema> Remove(const SharedPtr<XmlSchema>& schema, bool forceCompile);
257 bool PreprocessSchema(SharedPtr<XmlSchema>& schema, const String& targetNamespace);
258 SharedPtr<XmlSchema> ParseSchema(const String& targetNamespace, const SharedPtr<XmlReader>& reader);
259 void CopyFromCompiledSet(const SharedPtr<XmlSchemaSet>& otherSet);
262 SharedPtr<SchemaNames> GetSchemaNames(const SharedPtr<XmlNameTable>& nt);
263 bool IsSchemaLoaded(const SharedPtr<Uri>& schemaUri, String targetNamespace, SharedPtr<XmlSchema>& schema);
264 bool GetSchemaByUri(const SharedPtr<Uri>& schemaUri, SharedPtr<XmlSchema>& schema);
265 String GetTargetNamespace(const SharedPtr<XmlSchema>& schema);
267
268 virtual ASPOSECPP_SHARED_API ~XmlSchemaSet();
269
271 #ifdef ASPOSE_GET_SHARED_MEMBERS
272 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
273 #endif
275
276private:
277
278 SharedPtr<XmlNameTable> _nameTable;
279 SharedPtr<SchemaNames> _schemaNames;
283 bool _isCompiled;
287 bool _compileAll;
288 SharedPtr<SchemaInfo> _cachedCompiledInfo;
289 SharedPtr<XmlReaderSettings> _readerSettings;
290 SharedPtr<XmlSchema> _schemaForSchema;
291 SharedPtr<XmlSchemaCompilationSettings> _compilationSettings;
292 SharedPtr<XmlSchemaObjectTable> _typeExtensions;
293 SharedPtr<Object> _internalSyncObject;
294
295 SharedPtr<XmlSchema> Add(const String& targetNamespace, SharedPtr<XmlSchema> schema);
296 void SetDtdProcessing(const SharedPtr<XmlReader>& reader);
297 void AddSchemaToSet(const SharedPtr<XmlSchema>& schema);
298 void ProcessNewSubstitutionGroups(const SharedPtr<XmlSchemaObjectTable>& substitutionGroupsTable, bool resolve);
299 void ResolveSubstitutionGroup(const SharedPtr<XmlSchemaSubstitutionGroup>& substitutionGroup, const SharedPtr<XmlSchemaObjectTable>& substTable);
300 void ClearTables();
301 void RemoveSchemaFromCaches(const SharedPtr<XmlSchema>& schema);
302 void RemoveSchemaFromGlobalTables(const SharedPtr<XmlSchema>& schema);
303 bool AddToTable(const SharedPtr<XmlSchemaObjectTable>& table, const SharedPtr<XmlQualifiedName>& qname, const SharedPtr<XmlSchemaObject>& item);
304 void VerifyTables();
305 void InternalValidationCallback(const SharedPtr<Object>& sender, const SharedPtr<ValidationEventArgs>& e);
306 void SendValidationEvent(XmlSchemaException e, XmlSeverityType severity);
307
308};
309
310} // namespace Schema
311} // namespace Xml
312} // namespace System
313
314
Pair of key and value. This type should be allocated on stack and passed to functions by value or by ...
Definition: keyvalue_pair.h:20
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
SharedPtr< XmlSchema > Add(const SharedPtr< XmlSchema > &schema)
Adds the given XmlSchema to the XmlSchemaSet.
void ValidationEventHandler_remove(Args... value)
Removes an event handler for receiving information about XML Schema definition language (XSD) schema ...
Definition: xml_schema_set.h:139
void CopyTo(const ArrayPtr< SharedPtr< XmlSchema > > &schemas, int32_t index)
Copies all the XmlSchema objects from the XmlSchemaSet to the given array, starting at the given inde...
XmlSchemaSet()
Initializes a new instance of the XmlSchemaSet class.
bool Contains(const SharedPtr< XmlSchema > &schema)
Indicates whether the specified XML Schema definition language (XSD) XmlSchema object is in the XmlSc...
XmlSchemaSet(const SharedPtr< XmlNameTable > &nameTable)
Initializes a new instance of the XmlSchemaSet class with the specified XmlNameTable.
SharedPtr< Collections::Generic::IList< SharedPtr< XmlSchema > > > Schemas()
Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet.
bool RemoveRecursive(const SharedPtr< XmlSchema > &schemaToRemove)
Removes the specified XML Schema definition language (XSD) schema and all the schemas it imports from...
void Compile()
Compiles the XML Schema definition language (XSD) schemas added to the XmlSchemaSet into one logical ...
SharedPtr< XmlSchema > Reprocess(SharedPtr< XmlSchema > schema)
Reprocesses an XML Schema definition language (XSD) schema that already exists in the XmlSchemaSet.
SharedPtr< Collections::Generic::List< SharedPtr< XmlSchema > > > Schemas(String targetNamespace)
Returns a collection of all the XML Schema definition language (XSD) schemas in the XmlSchemaSet that...
SharedPtr< XmlSchemaObjectTable > get_GlobalTypes()
Returns all of the global simple and complex types in all the XML Schema definition language (XSD) sc...
SharedPtr< XmlSchema > Add(String targetNamespace, const String &schemaUri)
Adds the XML Schema definition language (XSD) schema at the URL specified to the XmlSchemaSet.
SharedPtr< XmlSchema > Add(String targetNamespace, const SharedPtr< XmlReader > &schemaDocument)
Adds the XML Schema definition language (XSD) schema contained in the XmlReader to the XmlSchemaSet.
SharedPtr< XmlSchemaObjectTable > get_GlobalAttributes()
Returns all the global attributes in all the XML Schema definition language (XSD) schemas in the XmlS...
SharedPtr< XmlNameTable > get_NameTable()
Returns the default XmlNameTable used by the XmlSchemaSet when loading new XML Schema definition lang...
void set_CompilationSettings(const SharedPtr< XmlSchemaCompilationSettings > &value)
Sets the XmlSchemaCompilationSettings for the XmlSchemaSet.
SharedPtr< XmlSchema > Remove(const SharedPtr< XmlSchema > &schema)
Removes the specified XML Schema definition language (XSD) schema from the XmlSchemaSet.
bool get_IsCompiled()
Returns a value that indicates whether the XML Schema definition language (XSD) schemas in the XmlSch...
void Add(const SharedPtr< XmlSchemaSet > &schemas)
Adds all the XML Schema definition language (XSD) schemas in the given XmlSchemaSet to the XmlSchemaS...
SharedPtr< XmlSchemaObjectTable > get_GlobalElements()
Returns all the global elements in all the XML Schema definition language (XSD) schemas in the XmlSch...
void set_XmlResolver(const SharedPtr< System::Xml::XmlResolver > &value)
Sets the XmlResolver used to resolve namespaces or locations referenced in include and import element...
bool Contains(String targetNamespace)
Indicates whether an XML Schema definition language (XSD) schema with the specified target namespace ...
void ValidationEventHandler_add(Args... value)
Adds an event handler for receiving information about XML Schema definition language (XSD) schema val...
Definition: xml_schema_set.h:128
int32_t get_Count()
Returns the number of logical XML Schema definition language (XSD) schemas in the XmlSchemaSet.
SharedPtr< XmlSchemaCompilationSettings > get_CompilationSettings()
Returns the XmlSchemaCompilationSettings for the XmlSchemaSet.
Represents an XML Schema Definition Language (XSD) Schema validation engine. The XmlSchemaValidator c...
Definition: xml_schema_validator.h:93
class ASPOSECPP_SHARED_CLASS List
Definition: ienumerable.h:18
System::ExceptionWrapper< Details_XmlSchemaException > XmlSchemaException
Definition: xml_schema_exception.h:76
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
XmlSeverityType
Represents the severity of the validation event.
Definition: xml_severity_type.h:17
@ Schema
Validate according to XML Schema definition language (XSD) schemas, including inline XML Schemas....
@ Xml
Serialize according to the XML 1.0 rules.
@ Remove
A node is being removed from the tree.
Definition: db_command.h:9