コード例 #1
0
 public static void Output(XS__schema schema_in)
 {
     Console.WriteLine(
         "<xs:schema targetNamespace=\"{0}\" elementFormDefault=\"{1}\">",
         schema_in.TargetNamespace,
         schema_in.ElementFormDefault
         );
     for (int i = 0; i < schema_in.SimpleTypeCollection.Count; i++)
     {
         Console.WriteLine(
             "\t<xs:simpleType name=\"{0}\" />",
             schema_in.SimpleTypeCollection[i].Name
             );
     }
     for (int i = 0; i < schema_in.ComplexTypeCollection.Count; i++)
     {
         Console.WriteLine(
             "\t<xs:complexType name=\"{0}\" />",
             schema_in.ComplexTypeCollection[i].Name
             );
     }
     Console.WriteLine(
         "\t<xs:element name=\"{0}\" type=\"{1}\" />",
         schema_in.Element.Name,
         schema_in.Element.Type
         );
     Console.WriteLine("</xs:schema>");
 }
コード例 #2
0
        public static XS__schema[] Load_fromURI(
            XS__RootMetadata root_ref_in,
            params Uri[] filePath_in
            )
        {
            XS__schema[] _output
                = new XS__schema[filePath_in.Length];

            for (int i = 0; i < filePath_in.Length; i++)
            {
                if (filePath_in[i].IsFile)
                {
                    _output[i] = XS__schema.Load_fromFile(
                        filePath_in[i].LocalPath
                        )[0];
                    // no need! everything's been taken care at: XS__schema.Load_fromFile(...)
                    //_output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]";
                    //_output[i].parent_ref = root_ref_in; // ToDos: now!
                    //if (root_ref_in != null) _output[i].root_ref = root_ref_in;
                }
                else
                {
                    try {
                        _output[i] = (XS__schema) new XmlSerializer(typeof(XS__schema)).Deserialize(
                            OGen.Libraries.PresentationLayer.WebForms.Utilities.ReadURL(
                                filePath_in[i].ToString()
                                )
                            );
                    } catch (Exception _ex) {
                        throw new Exception(string.Format(
                                                System.Globalization.CultureInfo.CurrentCulture,
                                                "\n---\n{0}.{1}.Load_fromURI():\nERROR READING XML:\n{2}\n---\n{3}",
                                                typeof(XS__schema).Namespace,
                                                typeof(XS__schema).Name,
                                                //(filePath_in[i].IsFile)
                                                //	? filePath_in[i].LocalPath
                                                //	:
                                                filePath_in[i].ToString(),
                                                _ex.Message
                                                ));
                    }
                    _output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]";
                    _output[i].parent_ref   = root_ref_in;                   // ToDos: now!
                    if (root_ref_in != null)
                    {
                        _output[i].root_ref = root_ref_in;
                    }
                }
            }

            return(_output);
        }
コード例 #3
0
        public bool isCollection(
            string schemaName_in,
            out ComplexTypeItem[] complexTypeCollection_out
            )
        {
            complexTypeCollection_out = null;

            OGen.XSD.Libraries.Metadata.Metadata.XS_complexTypeType _complextype
                = this.root_ref.MetadataCollection[0].ComplexTypeCollection[
                      this.Type
                  ];

            if (_complextype != null)
            {
                XS__schema _schema = this.root_ref_.SchemaCollection[schemaName_in];

                for (int c = 0; c < _schema.ComplexTypeCollection.Count; c++)
                {
                    if (
                        _schema.ComplexTypeCollection[c].Name
                        ==
                        _complextype.Name
                        )
                    {
                        complexTypeCollection_out = new ComplexTypeItem[_complextype.ComplexTypeKeyCollection.Count];
                        for (int k = 0; k < _complextype.ComplexTypeKeyCollection.Count; k++)
                        {
                            for (int a = 0; a < _schema.ComplexTypeCollection[c].AttributeCollection.Count; a++)
                            {
                                if (
                                    _schema.ComplexTypeCollection[c].AttributeCollection[a].Name
                                    ==
                                    _complextype.ComplexTypeKeyCollection[k].Name
                                    )
                                {
                                    complexTypeCollection_out[k] = new ComplexTypeItem(
                                        _schema.ComplexTypeCollection[c].AttributeCollection[a].Name,
                                        _schema.ComplexTypeCollection[c].AttributeCollection[a].NType(schemaName_in),
                                        _complextype.ComplexTypeKeyCollection[k].caseSensitive
                                        );
                                    break;
                                }
                            }
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #4
0
        public static XS__schema[] Load_fromFile(
            XS__RootMetadata root_ref_in,
            params string[] filePath_in
            )
        {
            FileStream _stream;

            XS__schema[] _output
                = new XS__schema[filePath_in.Length];

            for (int i = 0; i < filePath_in.Length; i++)
            {
                _stream = new FileStream(
                    filePath_in[i],
                    FileMode.Open,
                    FileAccess.Read,
                    FileShare.Read
                    );

                try {
                    _output[i] = (XS__schema) new XmlSerializer(typeof(XS__schema)).Deserialize(
                        _stream
                        );
                    _stream.Close();
#if !NET_1_1
                    _stream.Dispose();
#endif
                } catch (Exception _ex) {
                    throw new Exception(string.Format(
                                            System.Globalization.CultureInfo.CurrentCulture,
                                            "\n---\n{0}.{1}.Load_fromFile():\nERROR READING XML:\n{2}\n---\n{3}\n---\n{4}\n---\n",
                                            typeof(XS__schema).Namespace,
                                            typeof(XS__schema).Name,
                                            filePath_in[i],
                                            _ex.Message,
                                            _ex.InnerException
                                            ));
                }
                _output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]";

                _output[i].parent_ref = root_ref_in;                 // ToDos: now!
                if (root_ref_in != null)
                {
                    _output[i].root_ref = root_ref_in;
                }
            }
            return(_output);
        }
コード例 #5
0
ファイル: XS0__schema.cs プロジェクト: katshann/ogen
		public static XS__schema[] Load_fromFile(
			XS__RootMetadata root_ref_in, 
			params string[] filePath_in
		) {
			FileStream _stream;
			XS__schema[] _output 
				= new XS__schema[filePath_in.Length];

			for (int i = 0; i < filePath_in.Length; i++) {
				_stream = new FileStream(
					filePath_in[i],
					FileMode.Open,
					FileAccess.Read,
					FileShare.Read
				);

				try {
					_output[i] = (XS__schema)new XmlSerializer(typeof(XS__schema)).Deserialize(
						_stream
					);
					_stream.Close();
#if !NET_1_1
					_stream.Dispose();
#endif
				} catch (Exception _ex) {
					throw new Exception(string.Format(
						System.Globalization.CultureInfo.CurrentCulture,
						"\n---\n{0}.{1}.Load_fromFile():\nERROR READING XML:\n{2}\n---\n{3}\n---\n{4}\n---\n",
						typeof(XS__schema).Namespace, 
						typeof(XS__schema).Name, 
						filePath_in[i],
						_ex.Message,
						_ex.InnerException
					));
				}
				_output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]";

				_output[i].parent_ref = root_ref_in; // ToDos: now!
				if (root_ref_in != null) _output[i].root_ref = root_ref_in;
			}
			return _output;
		}
コード例 #6
0
        public XS__RootMetadata(
                #endif
            string metadataFilePath_in
            )
        {
            string _metadataPath = System.IO.Path.GetDirectoryName(metadataFilePath_in);

            this.metadatafiles_ = Metadatas.Load_fromFile(metadataFilePath_in);

            #region int _total_xxx = ...;
            int _total_metadata = 0;
            int _total_schema   = 0;
            for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (this.metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__metadata.METADATA:
                    _total_metadata++;
                    break;

                case XS__schema.SCHEMA:
                    _total_schema++;
                    break;
                }
            }
            #endregion
            #region string[] _xxxFilePath = new string[_total_xxx];
            string[] _metadataFilePath = new string[
                _total_metadata
                                         ];
            string[] _schemaFilePath = new string[
                _total_schema
                                       ];
            #endregion

            _total_metadata = 0;
            _total_schema   = 0;
            for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (this.metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__metadata.METADATA:
                    _metadataFilePath[_total_metadata] = System.IO.Path.Combine(
                        _metadataPath,
                        this.metadatafiles_.MetadataFiles[f].XMLFileName
                        );
                    _total_metadata++;
                    break;

                case XS__schema.SCHEMA:
                    _schemaFilePath[_total_schema] = System.IO.Path.Combine(
                        _metadataPath,
                        this.metadatafiles_.MetadataFiles[f].XMLFileName
                        );
                    _total_schema++;
                    break;
                }
            }

            this.metadatacollection_ = new XS__metadataCollection(
                XS__metadata.Load_fromFile(
                    (XS__RootMetadata)this,
                    _metadataFilePath
                    )
                );
            this.schemacollection_ = new XS__schemaCollection(
                XS__schema.Load_fromFile(
                    (XS__RootMetadata)this,
                    _schemaFilePath
                    )
                );
        }
コード例 #7
0
		public XS__schemaCollection(
		#endif
			XS__schema[] schemacollection_in
		) {
			schemacollection_ = schemacollection_in;
		}
コード例 #8
0
ファイル: Program.cs プロジェクト: katshann/ogen
		public static void Main(string[] args) {
			XS__RootMetadata _root = new XS__RootMetadata(
				System.IO.Path.Combine(
					#if !NET_1_1
					System.Configuration.ConfigurationManager.AppSettings
					#else
					System.Configuration.ConfigurationSettings.AppSettings
					#endif
						["ogenPath"],

					@"..\..\OGen-NTier\NTier_metadata\OGenXSD-metadatas\MD_NTier_metadata.OGenXSD-metadata.xml"
				)
			);
			string ntype = string.Empty;
			string name = string.Empty;
			bool must = false;

			OGen.XSD.Libraries.Metadata.Schema.ComplexTypeItem[] _complex = null;
			for (int c = 0; c < _root.SchemaCollection[0].ComplexTypeCollection.Count; c++) {
				must = _root.SchemaCollection[0].ComplexTypeCollection[c].mustImplementCollection(
					"metadataExtended",
					out _complex
				);
				Console.WriteLine(
					"{0}:{1}",
					_root.SchemaCollection[0].ComplexTypeCollection[c].Name, 
					must
				);
				if (_complex != null) {
					for (int k = 0; k < _complex.Length; k++)
						Console.WriteLine(
							"\t{0}:{1}:{2}",
							_complex[k].Name,
							_complex[k].NType,
							_complex[k].CaseSensitive
						);
				}
			}
			PressAnyKey();
			return;

			#region //XmlSchema...
//			string _filepath = @"c:\test.xml";
//
//			FileStream _file = new FileStream(
//				_filepath,
//				FileMode.Create,
//				FileAccess.Write,
//				FileShare.ReadWrite
//			);
//
//			//ValidationEventHandler _eventHandler 
//			//	= new ValidationEventHandler(Program.ShowCompileErrors);
//
//			XmlSerializerNamespaces _xmlserializernamespaces 
//				= new XmlSerializerNamespaces();
//			_xmlserializernamespaces.Add("PREFIX1", "NAMESPACE111");
//			//_xmlserializernamespaces.Add("PREFIX2", "NAMESPACE222");
//
//			XmlSchema _xmlschema = new XmlSchema();
//			//XmlSchema.Read(
//			//	_file2, 
//			//	_eventHandler
//			//);
//			_xmlschema.ElementFormDefault = XmlSchemaForm.Qualified;
//			_xmlschema.Namespaces = _xmlserializernamespaces;
//			//_xmlschema.Elements;
//
//			_xmlschema.Write(_file);
//			_file.Flush();
//			_file.Close();
			#endregion


			XS__schema _schema = new XS__schema();
//			_schema.xmlNS_xs = "http://www.w3.org/2001/XMLSchema";
			_schema.TargetNamespace = "http://ogen.berlios.de";
			_schema.xmlNS = "http://ogen.berlios.de";
			_schema.ElementFormDefault = "qualified";
			
			XS_simpleTypeType _simpletype = new XS_simpleTypeType();
			_simpletype.Name = "someEnum";
			_simpletype.Restriction.Base = "xs:string";
			_simpletype.Restriction.EnumerationCollection.Add(
				new XS_enumerationType("someenum1"), 
				new XS_enumerationType("someenum2"), 
				new XS_enumerationType("someenum3")
			);
			_schema.SimpleTypeCollection.Add(
				_simpletype
			);

			XS_attributeType _attrib1 = new XS_attributeType();
			_attrib1.Name = "someAttrib1";
			_attrib1.Type = "xs:string";
			OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType _someType1 = new OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType();
			_someType1.Name = "someType1";
			_someType1.AttributeCollection.Add(
				_attrib1
			);

			XS_attributeType _attrib2 = new XS_attributeType();
			_attrib2.Name = "someAttrib2";
			_attrib2.Type = "xs:string";
			XS_attributeType _attrib3 = new XS_attributeType();
			_attrib3.Name = "someAttrib3";
			_attrib3.Type = "xs:string";
			OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType _someType2 = new OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType();
			_someType2.Name = "someType2";
			_someType2.AttributeCollection.Add(
				_attrib2, 
				_attrib3
			);

			XS_elementType _element1 = new XS_elementType();
			_element1.Name = "someCollection";
			_element1.Type = "someType1";
			_element1.MaxOccurs 
				//= MaxOccursEnum.unbounded;
				= XS_MaxOccursType.unbounded;
			XS_elementType _element2 = new XS_elementType();
			_element2.Name = "someItem";
			_element2.Type = "someType1";
			_someType2.Sequence.ElementCollection.Add(
				_element1, 
				_element2
			);

			_schema.ComplexTypeCollection.Add(
				_someType1, 
				_someType2
			);
			
			//XS_Element _someElement = new XS_Element();
			//_someElement.Name = "someElement";
			//_someElement.Type = "someType2";
			//_schema.Element = _someElement;
			_schema.Element.Name = "someElement";
			_schema.Element.Type = "someType2";

Console.WriteLine(
	"'{0}' == '{1}'", 
	_schema.SimpleTypeCollection[0].Restriction.EnumerationCollection[2].Value, 
	_schema.Read_fromRoot("ROOT.simpleType[0].restriction.enumeration[2].value")
);
PressAnyKey();
//Console.WriteLine(
//	"'{0}' == '{1}'", 
//	_schema.SimpleType[0].Restriction.Enumeration[2].XXX, 
//	_schema.Read_fromRoot("ROOT.simpleType[0].restriction.enumeration[2].XXX")
//);
//Console.Write("Press any key to continue . . . ");
//Console.ReadKey(true); Console.WriteLine();
//_schema.IterateThrough_fromRoot(
//	"ROOT.simpleType[n].restriction.enumeration[n]", 
//	notifyme//cClaSSe.dIteration_found
//);
//PressAnyKey();

			string _filepath = @"c:\test.xml";
			_schema.SaveState_toFile(_filepath);
			Output(_schema);
			PressAnyKey();
			_schema = XS__schema.Load_fromFile(_filepath)[0];
			Output(_schema);
			PressAnyKey();
		}
コード例 #9
0
ファイル: Program.cs プロジェクト: katshann/ogen
		public static void Output(XS__schema schema_in) {
			Console.WriteLine(
				"<xs:schema targetNamespace=\"{0}\" elementFormDefault=\"{1}\">", 
				schema_in.TargetNamespace, 
				schema_in.ElementFormDefault
			);
			for (int i = 0; i < schema_in.SimpleTypeCollection.Count; i++) {
				Console.WriteLine(
					"\t<xs:simpleType name=\"{0}\" />", 
					schema_in.SimpleTypeCollection[i].Name
				);
			}
			for (int i = 0; i < schema_in.ComplexTypeCollection.Count; i++) {
				Console.WriteLine(
					"\t<xs:complexType name=\"{0}\" />", 
					schema_in.ComplexTypeCollection[i].Name
				);
			}
			Console.WriteLine(
				"\t<xs:element name=\"{0}\" type=\"{1}\" />", 
				schema_in.Element.Name, 
				schema_in.Element.Type
			);
			Console.WriteLine("</xs:schema>");
		}
コード例 #10
0
        public bool mustImplementCollection(
            string schemaName_in,
            out ComplexTypeItem[] complexTypeCollection_out
            )
        {
            complexTypeCollection_out = null;
            int _index = -1;

            OGen.XSD.Libraries.Metadata.Metadata.XS_complexTypeType _complextype;

            XS__schema _schema = this.root_ref_.SchemaCollection[schemaName_in];

            for (int c = 0; c < _schema.ComplexTypeCollection.Count; c++)
            {
                for (int e = 0; e < _schema.ComplexTypeCollection[c].Sequence.ElementCollection.Count; e++)
                {
                    if (
                        // if there's an Element pointing this ComplexType
                        (_schema.ComplexTypeCollection[c].Sequence.ElementCollection[e].Type == this.Name)
                        &&
                        // and if this Element occurance is unbounded
                        (_schema.ComplexTypeCollection[c].Sequence.ElementCollection[e].MaxOccurs
                         == XS_MaxOccursType.unbounded)
                        )
                    {
                        // then this ComplexType must implement a Collection

                        #region _complextype = ...;
                        #region _index = ...;
                        if (!string.IsNullOrEmpty(schemaName_in))
                        {
                            _index = this.root_ref_.MetadataCollection[0].MetadataIndexCollection.Search(schemaName_in);
                        }
                        else
                        {
                            _index = -1;
                        }
                        #endregion
                        if (_index != -1)
                        {
                            // note: if not found null will be returned!
                            // so don't glue this if block with the next
                            // or have this in consideration when you do it
                            _complextype
                                = this.root_ref_.MetadataCollection[0].MetadataIndexCollection[_index].ComplexTypeCollection[
                                      this.Name
                                  ];
                        }
                        else
                        {
                            _complextype = null;
                        }

                        if (_complextype == null)
                        {
                            _complextype
                                = this.root_ref_.MetadataCollection[0].ComplexTypeCollection[
                                      this.Name
                                  ];
                        }
                        #endregion
                        if (_complextype != null)
                        {
                            complexTypeCollection_out = new ComplexTypeItem[_complextype.ComplexTypeKeyCollection.Count];
                            for (int k = 0; k < _complextype.ComplexTypeKeyCollection.Count; k++)
                            {
                                for (int a = 0; a < this.AttributeCollection.Count; a++)
                                {
                                    if (
                                        this.AttributeCollection[a].Name
                                        ==
                                        _complextype.ComplexTypeKeyCollection[k].Name
                                        )
                                    {
                                        complexTypeCollection_out[k] = new ComplexTypeItem(
                                            this.AttributeCollection[a].Name,
                                            this.AttributeCollection[a].NType(schemaName_in),
                                            _complextype.ComplexTypeKeyCollection[k].caseSensitive
                                            );
                                        break;
                                    }
                                }
                            }
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #11
0
ファイル: XS0__schema.cs プロジェクト: katshann/ogen
		public static XS__schema[] Load_fromURI(
			XS__RootMetadata root_ref_in, 
			params Uri[] filePath_in
		) {
			XS__schema[] _output 
				= new XS__schema[filePath_in.Length];

			for (int i = 0; i < filePath_in.Length; i++) {
				if (filePath_in[i].IsFile) {
					_output[i] = XS__schema.Load_fromFile(
						filePath_in[i].LocalPath
					)[0];
					// no need! everything's been taken care at: XS__schema.Load_fromFile(...)
					//_output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]";
					//_output[i].parent_ref = root_ref_in; // ToDos: now!
					//if (root_ref_in != null) _output[i].root_ref = root_ref_in;
				} else {
					try {
						_output[i] = (XS__schema)new XmlSerializer(typeof(XS__schema)).Deserialize(
							OGen.lib.presentationlayer.webforms.utils.ReadURL(
								filePath_in[i].ToString()
							)
						);
					} catch (Exception _ex) {
						throw new Exception(string.Format(
							"\n---\n{0}.{1}.Load_fromURI():\nERROR READING XML:\n{2}\n---\n{3}",
							typeof(XS__schema).Namespace, 
							typeof(XS__schema).Name, 
							//(filePath_in[i].IsFile)
							//	? filePath_in[i].LocalPath
							//	: 
							filePath_in[i].ToString(),
							_ex.Message
						));
					}
					_output[i].root_schema_ = ROOT + "." + SCHEMA + "[" + i + "]";
					_output[i].parent_ref = root_ref_in; // ToDos: now!
					if (root_ref_in != null) _output[i].root_ref = root_ref_in;
				}
			}

			return _output;
		}
コード例 #12
0
        public static void Main(string[] args)
        {
            XS__RootMetadata _root = new XS__RootMetadata(
                System.IO.Path.Combine(
                                        #if !NET_1_1
                    System.Configuration.ConfigurationManager.AppSettings
                                        #else
                    System.Configuration.ConfigurationSettings.AppSettings
                                        #endif
                    ["ogenPath"],

                    @"..\..\OGen-NTier\NTier_metadata\OGenXSD-metadatas\MD_NTier_metadata.OGenXSD-metadata.xml"
                    )
                );
            string ntype = string.Empty;
            string name  = string.Empty;
            bool   must  = false;

            OGen.XSD.Libraries.Metadata.Schema.ComplexTypeItem[] _complex = null;
            for (int c = 0; c < _root.SchemaCollection[0].ComplexTypeCollection.Count; c++)
            {
                must = _root.SchemaCollection[0].ComplexTypeCollection[c].mustImplementCollection(
                    "metadataExtended",
                    out _complex
                    );
                Console.WriteLine(
                    "{0}:{1}",
                    _root.SchemaCollection[0].ComplexTypeCollection[c].Name,
                    must
                    );
                if (_complex != null)
                {
                    for (int k = 0; k < _complex.Length; k++)
                    {
                        Console.WriteLine(
                            "\t{0}:{1}:{2}",
                            _complex[k].Name,
                            _complex[k].NType,
                            _complex[k].CaseSensitive
                            );
                    }
                }
            }
            PressAnyKey();
            return;

            #region             //XmlSchema...
//			string _filepath = @"c:\test.xml";
//
//			FileStream _file = new FileStream(
//				_filepath,
//				FileMode.Create,
//				FileAccess.Write,
//				FileShare.ReadWrite
//			);
//
//			//ValidationEventHandler _eventHandler
//			//	= new ValidationEventHandler(Program.ShowCompileErrors);
//
//			XmlSerializerNamespaces _xmlserializernamespaces
//				= new XmlSerializerNamespaces();
//			_xmlserializernamespaces.Add("PREFIX1", "NAMESPACE111");
//			//_xmlserializernamespaces.Add("PREFIX2", "NAMESPACE222");
//
//			XmlSchema _xmlschema = new XmlSchema();
//			//XmlSchema.Read(
//			//	_file2,
//			//	_eventHandler
//			//);
//			_xmlschema.ElementFormDefault = XmlSchemaForm.Qualified;
//			_xmlschema.Namespaces = _xmlserializernamespaces;
//			//_xmlschema.Elements;
//
//			_xmlschema.Write(_file);
//			_file.Flush();
//			_file.Close();
            #endregion


            XS__schema _schema = new XS__schema();
//			_schema.xmlNS_xs = "http://www.w3.org/2001/XMLSchema";
            _schema.TargetNamespace    = "http://ogen.berlios.de";
            _schema.xmlNS              = "http://ogen.berlios.de";
            _schema.ElementFormDefault = "qualified";

            XS_simpleTypeType _simpletype = new XS_simpleTypeType();
            _simpletype.Name             = "someEnum";
            _simpletype.Restriction.Base = "xs:string";
            _simpletype.Restriction.EnumerationCollection.Add(
                new XS_enumerationType("someenum1"),
                new XS_enumerationType("someenum2"),
                new XS_enumerationType("someenum3")
                );
            _schema.SimpleTypeCollection.Add(
                _simpletype
                );

            XS_attributeType _attrib1 = new XS_attributeType();
            _attrib1.Name = "someAttrib1";
            _attrib1.Type = "xs:string";
            OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType _someType1 = new OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType();
            _someType1.Name = "someType1";
            _someType1.AttributeCollection.Add(
                _attrib1
                );

            XS_attributeType _attrib2 = new XS_attributeType();
            _attrib2.Name = "someAttrib2";
            _attrib2.Type = "xs:string";
            XS_attributeType _attrib3 = new XS_attributeType();
            _attrib3.Name = "someAttrib3";
            _attrib3.Type = "xs:string";
            OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType _someType2 = new OGen.XSD.Libraries.Metadata.Schema.XS_complexTypeType();
            _someType2.Name = "someType2";
            _someType2.AttributeCollection.Add(
                _attrib2,
                _attrib3
                );

            XS_elementType _element1 = new XS_elementType();
            _element1.Name = "someCollection";
            _element1.Type = "someType1";
            _element1.MaxOccurs
            //= MaxOccursEnum.unbounded;
                = XS_MaxOccursType.unbounded;
            XS_elementType _element2 = new XS_elementType();
            _element2.Name = "someItem";
            _element2.Type = "someType1";
            _someType2.Sequence.ElementCollection.Add(
                _element1,
                _element2
                );

            _schema.ComplexTypeCollection.Add(
                _someType1,
                _someType2
                );

            //XS_Element _someElement = new XS_Element();
            //_someElement.Name = "someElement";
            //_someElement.Type = "someType2";
            //_schema.Element = _someElement;
            _schema.Element.Name = "someElement";
            _schema.Element.Type = "someType2";

            Console.WriteLine(
                "'{0}' == '{1}'",
                _schema.SimpleTypeCollection[0].Restriction.EnumerationCollection[2].Value,
                _schema.Read_fromRoot("ROOT.simpleType[0].restriction.enumeration[2].value")
                );
            PressAnyKey();
//Console.WriteLine(
//	"'{0}' == '{1}'",
//	_schema.SimpleType[0].Restriction.Enumeration[2].XXX,
//	_schema.Read_fromRoot("ROOT.simpleType[0].restriction.enumeration[2].XXX")
//);
//Console.Write("Press any key to continue . . . ");
//Console.ReadKey(true); Console.WriteLine();
//_schema.IterateThrough_fromRoot(
//	"ROOT.simpleType[n].restriction.enumeration[n]",
//	notifyme//cClaSSe.dIteration_found
//);
//PressAnyKey();

            string _filepath = @"c:\test.xml";
            _schema.SaveState_toFile(_filepath);
            Output(_schema);
            PressAnyKey();
            _schema = XS__schema.Load_fromFile(_filepath)[0];
            Output(_schema);
            PressAnyKey();
        }
コード例 #13
0
ファイル: XS__schemaCollection.cs プロジェクト: katshann/ogen
		public XS__schemaCollection(
			XS__schema[] schemacollection_in
		) : base (
			schemacollection_in
		) {
		}