CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
xml_schema.h
1
2
3#pragma once
4
5#include <xml/schema/xml_schema_object.h>
6#include <xml/schema/xml_schema_form.h>
7#include <xml/schema/xml_schema_derivation_method.h>
8#include <xml/schema/validation_event_handler.h>
9#include <system/enum_helpers.h>
10#include <system/array.h>
11#include <cstdint>
12
13
15namespace System
16{
17namespace Collections
18{
19namespace Generic
20{
21template <typename, typename> class Dictionary;
22template <typename> class IList;
23template <typename> class List;
24} // namespace Generic
25} // namespace Collections
26namespace IO
27{
28class Stream;
29class TextReader;
30class TextWriter;
31} // namespace IO
32class Uri;
33namespace Xml
34{
35namespace Schema
36{
37class ChameleonKey;
38class Compiler;
39class Parser;
40class Preprocessor;
41class SchemaCollectionCompiler;
42class SchemaCollectionPreprocessor;
43class SchemaInfo;
44class XmlSchemaAnnotation;
45class XmlSchemaCollection;
46class XmlSchemaCompilationSettings;
47class XmlSchemaObjectCollection;
48class XmlSchemaObjectTable;
49class XmlSchemaSet;
50class XmlSchemaValidator;
51class XsdBuilder;
52class XsdValidator;
53} // namespace Schema
54class XmlAttribute;
55class XmlDocument;
56class XmlNamespaceManager;
57class XmlNameTable;
58class XmlReader;
59class XmlResolver;
60class XmlWriter;
61} // namespace Xml
62} // namespace System
64
65namespace System {
66
67namespace Xml {
68
69namespace Schema {
70
77class ASPOSECPP_SHARED_CLASS XmlSchema : public XmlSchemaObject
78{
79 typedef XmlSchema ThisType;
81
82 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
83 ASPOSECPP_SHARED_RTTI_INFO_DECL();
84
85public:
86
89
90private:
92 friend class ChameleonKey;
93 friend class Parser;
94 friend class Preprocessor;
95 friend class SchemaCollectionCompiler;
96 friend class SchemaCollectionPreprocessor;
97 friend class Compiler;
98 friend class XmlSchemaCollection;
99 friend class XmlSchemaSet;
100 friend class XmlSchemaValidator;
101 friend class XsdBuilder;
102 friend class XsdValidator;
104
105public:
106
108 static const ASPOSECPP_SHARED_API String Namespace;
110 static const ASPOSECPP_SHARED_API String InstanceNamespace;
111
119 ASPOSECPP_SHARED_API void set_AttributeFormDefault(XmlSchemaForm value);
128 ASPOSECPP_SHARED_API void set_BlockDefault(XmlSchemaDerivationMethod value);
137 ASPOSECPP_SHARED_API void set_FinalDefault(XmlSchemaDerivationMethod value);
142 ASPOSECPP_SHARED_API XmlSchemaForm get_ElementFormDefault();
145 ASPOSECPP_SHARED_API void set_ElementFormDefault(XmlSchemaForm value);
148 ASPOSECPP_SHARED_API String get_TargetNamespace();
151 ASPOSECPP_SHARED_API void set_TargetNamespace(const String& value);
154 ASPOSECPP_SHARED_API String get_Version();
157 ASPOSECPP_SHARED_API void set_Version(const String& value);
168 ASPOSECPP_SHARED_API bool get_IsCompiled();
183 ASPOSECPP_SHARED_API String get_Id();
186 ASPOSECPP_SHARED_API void set_Id(const String& value);
192 ASPOSECPP_SHARED_API void set_UnhandledAttributes(const ArrayPtr<SharedPtr<XmlAttribute>>& value);
199
201 ASPOSECPP_SHARED_API XmlSchema();
202
208 static ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Read(const SharedPtr<IO::TextReader>& reader, ValidationEventHandler validationEventHandler);
214 static ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Read(const SharedPtr<IO::Stream>& stream, ValidationEventHandler validationEventHandler);
220 static ASPOSECPP_SHARED_API SharedPtr<XmlSchema> Read(const SharedPtr<XmlReader>& reader, ValidationEventHandler validationEventHandler);
223 ASPOSECPP_SHARED_API void Write(const SharedPtr<IO::Stream>& stream);
227 ASPOSECPP_SHARED_API void Write(const SharedPtr<IO::Stream>& stream, const SharedPtr<XmlNamespaceManager>& namespaceManager);
230 ASPOSECPP_SHARED_API void Write(const SharedPtr<IO::TextWriter>& writer);
234 ASPOSECPP_SHARED_API void Write(const SharedPtr<IO::TextWriter>& writer, const SharedPtr<XmlNamespaceManager>& namespaceManager);
238 ASPOSECPP_SHARED_API void Write(const SharedPtr<XmlWriter>& writer);
242 ASPOSECPP_SHARED_API void Write(const SharedPtr<XmlWriter>& writer, const SharedPtr<XmlNamespaceManager>& namespaceManager);
247 ASPOSECPP_SHARED_API void Compile(ValidationEventHandler validationEventHandler);
253 ASPOSECPP_SHARED_API void Compile(ValidationEventHandler validationEventHandler, const SharedPtr<XmlResolver>& resolver);
254
255protected:
256
258 bool get_IsCompiledBySet();
259 void set_IsCompiledBySet(bool value);
260 bool get_IsPreprocessed();
261 void set_IsPreprocessed(bool value);
262 bool get_IsRedefined();
263 void set_IsRedefined(bool value);
264 SharedPtr<XmlSchemaObjectTable> get_IdentityConstraints();
265 SharedPtr<Uri> get_BaseUri();
266 void set_BaseUri(const SharedPtr<Uri>& value);
267 int32_t get_SchemaId();
268 bool get_IsChameleon();
269 void set_IsChameleon(bool value);
271 SharedPtr<XmlDocument> get_Document();
272 int32_t get_ErrorCount();
273 void set_ErrorCount(int32_t value);
274 ASPOSECPP_SHARED_API String get_IdAttribute() override;
275 ASPOSECPP_SHARED_API void set_IdAttribute(String value) override;
276 SharedPtr<XmlNameTable> get_NameTable();
278 SharedPtr<Collections::Generic::List<String>> get_ImportedNamespaces();
279
280 bool CompileSchema(const SharedPtr<XmlSchemaCollection>& xsc, const SharedPtr<XmlResolver>& resolver, const SharedPtr<SchemaInfo>& schemaInfo, const String& ns, ValidationEventHandler validationEventHandler, const SharedPtr<XmlNameTable>& nameTable, bool CompileContentModel);
281 void CompileSchemaInSet(const SharedPtr<XmlNameTable>& nameTable, ValidationEventHandler eventHandler, const SharedPtr<XmlSchemaCompilationSettings>& compilationSettings);
282 ASPOSECPP_SHARED_API SharedPtr<XmlSchemaObject> Clone() override;
283 SharedPtr<XmlSchema> DeepClone();
284 void SetIsCompiled(bool isCompiled);
285 ASPOSECPP_SHARED_API void SetUnhandledAttributes(ArrayPtr<SharedPtr<XmlAttribute>> moreAttributes) override;
286 ASPOSECPP_SHARED_API void AddAnnotation(SharedPtr<XmlSchemaAnnotation> annotation) override;
287 void GetExternalSchemasList(const SharedPtr<Collections::Generic::IList<SharedPtr<XmlSchema>>>& extList, const SharedPtr<XmlSchema>& schema);
289
290 virtual ASPOSECPP_SHARED_API ~XmlSchema();
291
293 #ifdef ASPOSE_GET_SHARED_MEMBERS
294 ASPOSECPP_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
295 #endif
297
298private:
299
300 XmlSchemaForm _attributeFormDefault;
301 XmlSchemaForm _elementFormDefault;
302 XmlSchemaDerivationMethod _blockDefault;
303 XmlSchemaDerivationMethod _finalDefault;
304 String _targetNs;
305 String _version;
308 String _id;
309 ArrayPtr<SharedPtr<XmlAttribute>> _moreAttributes;
310 bool _isCompiled;
311 bool _isCompiledBySet;
312 bool _isPreprocessed;
313 bool _isRedefined;
314 int32_t _errorCount;
316 SharedPtr<XmlSchemaObjectTable> _attributeGroups;
321 SharedPtr<XmlSchemaObjectTable> _identityConstraints;
322 static int32_t s_globalIdCounter;
325 int32_t _schemaId;
326 SharedPtr<Uri> _baseUri;
327 bool _isChameleon;
329 SharedPtr<XmlDocument> _document;
330 SharedPtr<XmlNameTable> _nameTable;
331
332 ThisType* CppMemberwiseClone() const override { return new ThisType(*this); }
333
334};
335
336} // namespace Schema
337} // namespace Xml
338} // namespace System
339
340
Interface of indexed container of elements. Objects of this class should only be allocated using Syst...
Definition: ilist.h:19
Smart pointer class which tracks pointer modes of template arguments of stored object and updates the...
Definition: dynamic_weak_ptr.h:48
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) and XML-Data Reduced (XDR) schemas.
Definition: xml_schema_collection.h:58
An in-memory representation of an XML Schema, as specified in the World Wide Web Consortium (W3C) XML...
Definition: xml_schema.h:78
static const String Namespace
The XML schema namespace. This field is constant.
Definition: xml_schema.h:108
void Write(const SharedPtr< IO::Stream > &stream, const SharedPtr< XmlNamespaceManager > &namespaceManager)
Writes the XML Schema to the supplied Stream using the XmlNamespaceManager specified.
void set_ElementFormDefault(XmlSchemaForm value)
Sets the form for elements declared in the target namespace of the schema.
ArrayPtr< SharedPtr< XmlAttribute > > get_UnhandledAttributes()
Returns the qualified attributes which do not belong to the schema target namespace.
void set_TargetNamespace(const String &value)
Sets the Uniform Resource Identifier (URI) of the schema target namespace.
void set_AttributeFormDefault(XmlSchemaForm value)
Sets the form for attributes declared in the target namespace of the schema.
void set_UnhandledAttributes(const ArrayPtr< SharedPtr< XmlAttribute > > &value)
Sets the qualified attributes which do not belong to the schema target namespace.
static SharedPtr< XmlSchema > Read(const SharedPtr< IO::Stream > &stream, ValidationEventHandler validationEventHandler)
Reads an XML Schema from the supplied stream.
static SharedPtr< XmlSchema > Read(const SharedPtr< XmlReader > &reader, ValidationEventHandler validationEventHandler)
Reads an XML Schema from the supplied XmlReader.
void Compile(ValidationEventHandler validationEventHandler, const SharedPtr< XmlResolver > &resolver)
Compiles the XML Schema Object Model (SOM) into schema information for validation....
bool get_IsCompiled()
Indicates if the schema has been compiled.
static const String InstanceNamespace
The XML schema instance namespace. This field is constant.
Definition: xml_schema.h:110
void set_FinalDefault(XmlSchemaDerivationMethod value)
Sets the finalDefault attribute which sets the default value of the final attribute on elements and c...
static SharedPtr< XmlSchema > Read(const SharedPtr< IO::TextReader > &reader, ValidationEventHandler validationEventHandler)
Reads an XML Schema from the supplied IO::TextReader.
void Write(const SharedPtr< IO::TextWriter > &writer)
Writes the XML Schema to the supplied IO::TextWriter.
void Write(const SharedPtr< XmlWriter > &writer)
Writes the XML Schema to the supplied XmlWriter.
XmlSchemaForm get_ElementFormDefault()
Returns the form for elements declared in the target namespace of the schema.
XmlSchema()
Initializes a new instance of the XmlSchema class.
void Compile(ValidationEventHandler validationEventHandler)
Compiles the XML Schema Object Model (SOM) into schema information for validation....
SharedPtr< XmlSchemaObjectTable > get_Notations()
Returns the post-schema-compilation value for all notations in the schema.
void Write(const SharedPtr< XmlWriter > &writer, const SharedPtr< XmlNamespaceManager > &namespaceManager)
Writes the XML Schema to the supplied XmlWriter.
SharedPtr< XmlSchemaObjectTable > get_AttributeGroups()
Returns the post-schema-compilation value of all the global attribute groups in the schema.
String get_Version()
Returns the version of the schema.
void Write(const SharedPtr< IO::Stream > &stream)
Writes the XML Schema to the supplied data stream.
SharedPtr< XmlSchemaObjectCollection > get_Items()
Returns the collection of schema elements in the schema and is used to add new element types at the s...
SharedPtr< XmlSchemaObjectTable > get_Groups()
Returns the post-schema-compilation value of all the groups in the schema.
SharedPtr< XmlSchemaObjectTable > get_Elements()
Returns the post-schema-compilation value for all the elements in the schema.
SharedPtr< XmlSchemaObjectCollection > get_Includes()
Returns the collection of included and imported schemas.
String get_Id()
Returns the string ID.
void set_Version(const String &value)
Sets the version of the schema.
XmlSchemaForm get_AttributeFormDefault()
Returns the form for attributes declared in the target namespace of the schema.
String get_TargetNamespace()
Returns the Uniform Resource Identifier (URI) of the schema target namespace.
XmlSchemaDerivationMethod get_FinalDefault()
Returns the finalDefault attribute which sets the default value of the final attribute on elements an...
void Write(const SharedPtr< IO::TextWriter > &writer, const SharedPtr< XmlNamespaceManager > &namespaceManager)
Writes the XML Schema to the supplied TextWriter.
XmlSchemaDerivationMethod get_BlockDefault()
Returns the blockDefault attribute which sets the default value of the block attribute on element and...
SharedPtr< XmlSchemaObjectTable > get_SchemaTypes()
Returns the post-schema-compilation value of all schema types in the schema.
SharedPtr< XmlSchemaObjectTable > get_Attributes()
Returns the post-schema-compilation value for all the attributes in the schema.
void set_Id(const String &value)
Sets the string ID.
void set_BlockDefault(XmlSchemaDerivationMethod value)
Sets the blockDefault attribute which sets the default value of the block attribute on element and co...
Represents the root class for the Xml schema object model hierarchy and serves as a base class for cl...
Definition: xml_schema_object.h:47
Contains a cache of XML Schema definition language (XSD) schemas.
Definition: xml_schema_set.h:66
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
@ 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
XmlSchemaForm
Indicates if attributes or elements need to be qualified with a namespace prefix.
Definition: xml_schema_form.h:17
XmlSchemaDerivationMethod
Provides different methods for preventing derivation.
Definition: xml_schema_derivation_method.h:18
@ Schema
Validate according to XML Schema definition language (XSD) schemas, including inline XML Schemas....
@ Xml
Serialize according to the XML 1.0 rules.
Definition: db_command.h:9
@ Shared
Shared mode: pointer participates in reference counting.