diff --git a/AboutForm.Designer.cs b/AboutForm.Designer.cs index 0df0cf0..c396d01 100644 --- a/AboutForm.Designer.cs +++ b/AboutForm.Designer.cs @@ -28,62 +28,64 @@ namespace XSDDiagram /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm)); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.richTextBox = new System.Windows.Forms.RichTextBox(); - this.buttonOk = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.Image = global::XSDDiagram.Properties.Resources.XSDDiagram; - this.pictureBox1.Location = new System.Drawing.Point(12, 12); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(32, 32); - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; - // - // richTextBox - // - this.richTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.richTextBox.BackColor = System.Drawing.SystemColors.ControlLight; - this.richTextBox.Location = new System.Drawing.Point(50, 12); - this.richTextBox.Name = "richTextBox"; - this.richTextBox.ReadOnly = true; - this.richTextBox.Size = new System.Drawing.Size(464, 218); - this.richTextBox.TabIndex = 1; - this.richTextBox.TabStop = false; - this.richTextBox.Text = ""; - // - // buttonOk - // - this.buttonOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOk.Location = new System.Drawing.Point(226, 236); - this.buttonOk.Name = "buttonOk"; - this.buttonOk.Size = new System.Drawing.Size(75, 23); - this.buttonOk.TabIndex = 0; - this.buttonOk.Text = "OK"; - this.buttonOk.UseVisualStyleBackColor = true; - // - // AboutForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(526, 271); - this.Controls.Add(this.buttonOk); - this.Controls.Add(this.richTextBox); - this.Controls.Add(this.pictureBox1); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimizeBox = false; - this.Name = "AboutForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "About..."; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm)); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.richTextBox = new System.Windows.Forms.RichTextBox(); + this.buttonOk = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox1 + // + this.pictureBox1.Image = global::XSDDiagram.Properties.Resources.XSDDiagram; + this.pictureBox1.Location = new System.Drawing.Point(12, 12); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(32, 32); + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // richTextBox + // + this.richTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.richTextBox.BackColor = System.Drawing.SystemColors.ControlLight; + this.richTextBox.Location = new System.Drawing.Point(50, 12); + this.richTextBox.Name = "richTextBox"; + this.richTextBox.ReadOnly = true; + this.richTextBox.Size = new System.Drawing.Size(464, 218); + this.richTextBox.TabIndex = 1; + this.richTextBox.TabStop = false; + this.richTextBox.Text = ""; + // + // buttonOk + // + this.buttonOk.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOk.Location = new System.Drawing.Point(226, 236); + this.buttonOk.Name = "buttonOk"; + this.buttonOk.Size = new System.Drawing.Size(75, 23); + this.buttonOk.TabIndex = 0; + this.buttonOk.Text = "OK"; + this.buttonOk.UseVisualStyleBackColor = true; + // + // AboutForm + // + this.AcceptButton = this.buttonOk; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonOk; + this.ClientSize = new System.Drawing.Size(526, 271); + this.Controls.Add(this.buttonOk); + this.Controls.Add(this.richTextBox); + this.Controls.Add(this.pictureBox1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MinimizeBox = false; + this.Name = "AboutForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "About..."; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); } diff --git a/ErrorReportForm.Designer.cs b/ErrorReportForm.Designer.cs index 6139a3a..0ebc70e 100644 --- a/ErrorReportForm.Designer.cs +++ b/ErrorReportForm.Designer.cs @@ -28,51 +28,52 @@ namespace XSDDiagram /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ErrorReportForm)); - this.textBoxReport = new System.Windows.Forms.TextBox(); - this.buttonOK = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // textBoxReport - // - this.textBoxReport.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxReport.Location = new System.Drawing.Point(12, 12); - this.textBoxReport.Multiline = true; - this.textBoxReport.Name = "textBoxReport"; - this.textBoxReport.ReadOnly = true; - this.textBoxReport.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBoxReport.Size = new System.Drawing.Size(495, 332); - this.textBoxReport.TabIndex = 0; - // - // buttonOK - // - this.buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOK.Location = new System.Drawing.Point(222, 350); - this.buttonOK.Name = "buttonOK"; - this.buttonOK.Size = new System.Drawing.Size(75, 23); - this.buttonOK.TabIndex = 1; - this.buttonOK.Text = "OK"; - this.buttonOK.UseVisualStyleBackColor = true; - // - // ErrorReportForm - // - this.AcceptButton = this.buttonOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(519, 385); - this.Controls.Add(this.buttonOK); - this.Controls.Add(this.textBoxReport); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimizeBox = false; - this.Name = "ErrorReportForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Error Report"; - this.Load += new System.EventHandler(this.ErrorReportForm_Load); - this.ResumeLayout(false); - this.PerformLayout(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ErrorReportForm)); + this.textBoxReport = new System.Windows.Forms.TextBox(); + this.buttonOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBoxReport + // + this.textBoxReport.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxReport.Location = new System.Drawing.Point(12, 12); + this.textBoxReport.Multiline = true; + this.textBoxReport.Name = "textBoxReport"; + this.textBoxReport.ReadOnly = true; + this.textBoxReport.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBoxReport.Size = new System.Drawing.Size(495, 332); + this.textBoxReport.TabIndex = 0; + // + // buttonOK + // + this.buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOK.Location = new System.Drawing.Point(222, 350); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 1; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + // + // ErrorReportForm + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonOK; + this.ClientSize = new System.Drawing.Size(519, 385); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.textBoxReport); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MinimizeBox = false; + this.Name = "ErrorReportForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Error Report"; + this.Load += new System.EventHandler(this.ErrorReportForm_Load); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/LICENSE-LGPL.txt b/LICENSE-LGPL.txt index 65c5ca8..b14ca0a 100644 --- a/LICENSE-LGPL.txt +++ b/LICENSE-LGPL.txt @@ -1,165 +1,165 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LoginPromptForm.Designer.cs b/LoginPromptForm.Designer.cs index f743784..8361c05 100644 --- a/LoginPromptForm.Designer.cs +++ b/LoginPromptForm.Designer.cs @@ -45,8 +45,8 @@ this.buttonOK.Location = new System.Drawing.Point(64, 152); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); - this.buttonOK.TabIndex = 0; - this.buttonOK.Text = "OK"; + this.buttonOK.TabIndex = 4; + this.buttonOK.Text = "&OK"; this.buttonOK.UseVisualStyleBackColor = true; // // buttonCancel @@ -56,8 +56,8 @@ this.buttonCancel.Location = new System.Drawing.Point(145, 152); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 1; - this.buttonCancel.Text = "Cancel"; + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "&Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; // // textBoxUsername @@ -65,7 +65,7 @@ this.textBoxUsername.Location = new System.Drawing.Point(98, 90); this.textBoxUsername.Name = "textBoxUsername"; this.textBoxUsername.Size = new System.Drawing.Size(174, 20); - this.textBoxUsername.TabIndex = 2; + this.textBoxUsername.TabIndex = 1; // // textBoxPassword // @@ -81,8 +81,8 @@ this.labelUsername.Location = new System.Drawing.Point(12, 93); this.labelUsername.Name = "labelUsername"; this.labelUsername.Size = new System.Drawing.Size(55, 13); - this.labelUsername.TabIndex = 4; - this.labelUsername.Text = "Username"; + this.labelUsername.TabIndex = 0; + this.labelUsername.Text = "&Username"; // // labelPassword // @@ -90,8 +90,8 @@ this.labelPassword.Location = new System.Drawing.Point(12, 119); this.labelPassword.Name = "labelPassword"; this.labelPassword.Size = new System.Drawing.Size(53, 13); - this.labelPassword.TabIndex = 5; - this.labelPassword.Text = "Password"; + this.labelPassword.TabIndex = 2; + this.labelPassword.Text = "&Password"; // // textBoxLabel // @@ -102,11 +102,14 @@ this.textBoxLabel.ReadOnly = true; this.textBoxLabel.Size = new System.Drawing.Size(257, 71); this.textBoxLabel.TabIndex = 6; + this.textBoxLabel.TabStop = false; // // LoginPromptForm // + this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; this.ClientSize = new System.Drawing.Size(284, 187); this.Controls.Add(this.textBoxLabel); this.Controls.Add(this.labelPassword); diff --git a/MainForm.cs b/MainForm.cs index db2fc3f..c1433bc 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -1,97 +1,97 @@ -// XSDDiagram - A XML Schema Definition file viewer -// Copyright (C) 2006-2011 Regis COSNIER -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using System.Xml; -using System.Xml.Serialization; - -// To generate the XMLSchema.cs file: -// > xsd.exe XMLSchema.xsd /classes /l:cs /n:XMLSchema /order - -using XSDDiagram.Rendering; -using System.Xml.Schema; -using System.Diagnostics; - -namespace XSDDiagram -{ - public partial class MainForm : Form - { - private DiagramPrinter _diagramPrinter; - - private Diagram diagram = new Diagram(); - private Schema schema = new Schema(); - private Dictionary hashtableTabPageByFilename = new Dictionary(); - private string originalTitle = ""; - private DiagramItem contextualMenuPointedElement = null; - //private string currentLoadedSchemaFilename = ""; - - private TextBox textBoxAnnotation; - private WebBrowser webBrowserDocumentation; - private bool webBrowserSupported = true; - - public MainForm() - { - InitializeComponent(); - - this.toolsToolStripMenuItem.Visible = !Options.IsRunningOnMono; - - this.originalTitle = Text; - - this.toolStripComboBoxSchemaElement.Sorted = true; - this.toolStripComboBoxSchemaElement.Items.Add(""); - - this.diagram.RequestAnyElement += new Diagram.RequestAnyElementEventHandler(diagram_RequestAnyElement); - this.panelDiagram.DiagramControl.ContextMenuStrip = this.contextMenuStripDiagram; - this.panelDiagram.DiagramControl.MouseWheel += new MouseEventHandler(DiagramControl_MouseWheel); - this.panelDiagram.DiagramControl.MouseClick += new MouseEventHandler(DiagramControl_MouseClick); - this.panelDiagram.DiagramControl.MouseHover += new EventHandler(DiagramControl_MouseHover); - this.panelDiagram.DiagramControl.MouseMove += new MouseEventHandler(DiagramControl_MouseMove); - this.panelDiagram.VirtualSize = new Size(0, 0); +// XSDDiagram - A XML Schema Definition file viewer +// Copyright (C) 2006-2011 Regis COSNIER +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using System.Xml; +using System.Xml.Serialization; + +// To generate the XMLSchema.cs file: +// > xsd.exe XMLSchema.xsd /classes /l:cs /n:XMLSchema /order + +using XSDDiagram.Rendering; +using System.Xml.Schema; +using System.Diagnostics; + +namespace XSDDiagram +{ + public partial class MainForm : Form + { + private DiagramPrinter _diagramPrinter; + + private Diagram diagram = new Diagram(); + private Schema schema = new Schema(); + private Dictionary hashtableTabPageByFilename = new Dictionary(); + private string originalTitle = ""; + private DiagramItem contextualMenuPointedElement = null; + //private string currentLoadedSchemaFilename = ""; + + private TextBox textBoxAnnotation; + private WebBrowser webBrowserDocumentation; + private bool webBrowserSupported = true; + private string backupUsername = "", backupPassword = ""; + + public MainForm() + { + InitializeComponent(); + + this.toolsToolStripMenuItem.Visible = !Options.IsRunningOnMono; + + this.originalTitle = Text; + + this.toolStripComboBoxSchemaElement.Sorted = true; + this.toolStripComboBoxSchemaElement.Items.Add(""); + + this.diagram.RequestAnyElement += new Diagram.RequestAnyElementEventHandler(diagram_RequestAnyElement); + this.panelDiagram.DiagramControl.ContextMenuStrip = this.contextMenuStripDiagram; + this.panelDiagram.DiagramControl.MouseWheel += new MouseEventHandler(DiagramControl_MouseWheel); + this.panelDiagram.DiagramControl.MouseClick += new MouseEventHandler(DiagramControl_MouseClick); + this.panelDiagram.DiagramControl.MouseHover += new EventHandler(DiagramControl_MouseHover); + this.panelDiagram.DiagramControl.MouseMove += new MouseEventHandler(DiagramControl_MouseMove); + this.panelDiagram.VirtualSize = new Size(0, 0); this.panelDiagram.DiagramControl.Paint += new PaintEventHandler(DiagramControl_Paint); - this.schema.RequestCredential += schema_RequestCredential; - - if (Options.IsRunningOnMono) - { - try - { - new WebBrowser().Navigate("about:blank"); - } - catch - { - webBrowserSupported = false; - } - } + this.schema.RequestCredential += schema_RequestCredential; + this.backupUsername = Options.Username; + this.backupPassword = Options.Password; + if (Options.IsRunningOnMono) + { + try + { + new WebBrowser().Navigate("about:blank"); + } + catch + { + webBrowserSupported = false; + } + } } - string backupUsername = "", backupPassword = ""; - - bool schema_RequestCredential(string url, string realm, out string username, out string password) + bool schema_RequestCredential(string url, string realm, int attemptCount, out string username, out string password) { string label = "The file '" + url + "' requires a username and password."; LoginPromptForm dlg = new LoginPromptForm(label); @@ -105,1563 +105,1582 @@ namespace XSDDiagram } username = password = ""; return false; - } - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (components != null) - { - components.Dispose(); - components = null; - } - - if (_diagramPrinter != null) - { - _diagramPrinter.Dispose(); - _diagramPrinter = null; - } - } - - base.Dispose(disposing); - } - - private void MainForm_Load(object sender, EventArgs e) - { - this.toolStripComboBoxZoom.SelectedIndex = 8; - this.toolStripComboBoxAlignement.SelectedIndex = 1; - - if (!string.IsNullOrEmpty(Options.InputFile)) - { - LoadSchema(Options.InputFile); - foreach (var rootElement in Options.RootElements) - { - foreach (var element in schema.Elements) - { - if (element.Name == rootElement) - { - diagram.Add(element.Tag, element.NameSpace); - } - } - } - for (int i = 0; i < Options.ExpandLevel; i++) - { - diagram.ExpandOneLevel(); - } - UpdateDiagram(); - } - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - OpenFileDialog openFileDialog = new OpenFileDialog(); - openFileDialog.Filter = "xsd files (*.xsd)|*.xsd|All files (*.*)|*.*"; - openFileDialog.FilterIndex = 1; - openFileDialog.RestoreDirectory = true; - if (openFileDialog.ShowDialog() == DialogResult.OK) - LoadSchema(openFileDialog.FileName); - } - - private void MainForm_DragDrop(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - { - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - LoadSchema(files[0]); - } - } - - private void MainForm_DragEnter(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.Move; - else - e.Effect = DragDropEffects.None; - } - - private void saveDiagramToolStripMenuItem_Click(object sender, EventArgs e) - { - SaveFileDialog saveFileDialog = new SaveFileDialog(); - saveFileDialog.Filter = "SVG files (*.svg)|*.svg" + (Options.IsRunningOnMono ? "" : "|EMF files (*.emf)|*.emf") + "|PNG files (*.png)|*.png|JPG files (*.jpg)|*.jpg|All files (*.*)|*.*"; - saveFileDialog.FilterIndex = 1; - saveFileDialog.RestoreDirectory = true; - if (saveFileDialog.ShowDialog() == DialogResult.OK) - { - string outputFilename = saveFileDialog.FileName; - try - { - DiagramExporter exporter = new DiagramExporter(diagram); - Graphics g1 = this.panelDiagram.DiagramControl.CreateGraphics(); - exporter.Export(outputFilename, g1, new DiagramAlertHandler(SaveAlert)); - g1.Dispose(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - System.Diagnostics.Trace.WriteLine(ex.ToString()); - } - } - } - - bool SaveAlert(string title, string message) - { - return MessageBox.Show(this, message, title, MessageBoxButtons.YesNo) == DialogResult.Yes; - } - - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void aboutToolStripMenuItem_Click(object sender, EventArgs e) - { - AboutForm aboutForm = new AboutForm(); - aboutForm.ShowDialog(this); - } - - private void toolStripComboBoxSchemaElement_SelectedIndexChanged(object sender, EventArgs e) - { - if (this.toolStripComboBoxSchemaElement.SelectedItem != null) - { - XSDObject xsdObject = this.toolStripComboBoxSchemaElement.SelectedItem as XSDObject; - if (xsdObject != null) - SelectSchemaElement(xsdObject); - } - } - - private void toolStripButtonAddToDiagram_Click(object sender, EventArgs e) - { - if (this.toolStripComboBoxSchemaElement.SelectedItem != null) - { - XSDObject xsdObject = this.toolStripComboBoxSchemaElement.SelectedItem as XSDObject; - if (xsdObject != null) - this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace); - UpdateDiagram(); - } - } - - private void toolStripButtonAddAllToDiagram_Click(object sender, EventArgs e) - { - foreach (XSDObject xsdObject in this.schema.ElementsByName.Values) - if (xsdObject != null) - this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace); - UpdateDiagram(); - } - - void DiagramControl_Paint(object sender, PaintEventArgs e) - { - Point virtualPoint = this.panelDiagram.VirtualPoint; - e.Graphics.TranslateTransform(-(float)virtualPoint.X, -(float)virtualPoint.Y); - e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; - - DiagramGdiRenderer.Draw(diagram, e.Graphics, - new Rectangle(virtualPoint, this.panelDiagram.DiagramControl.ClientRectangle.Size)); - } - - private void UpdateDiagram() - { - if (this.diagram.RootElements.Count != 0) - { - Graphics g = this.panelDiagram.DiagramControl.CreateGraphics(); - this.diagram.Layout(g); - g.Dispose(); - Size bbSize = this.diagram.BoundingBox.Size + this.diagram.Padding + this.diagram.Padding; - this.panelDiagram.VirtualSize = new Size((int)(bbSize.Width * this.diagram.Scale), (int)(bbSize.Height * this.diagram.Scale)); - } - else - this.panelDiagram.VirtualSize = new Size(0, 0); - } - - private void UpdateTitle(string filename) - { - if (filename.Length > 0) - Text = this.originalTitle + " - " + filename; - else - Text = this.originalTitle; - } - - private void LoadSchema(string schemaFilename) - { - Cursor = Cursors.WaitCursor; - - UpdateTitle(schemaFilename); - - this.diagram.Clear(); - this.panelDiagram.VirtualSize = new Size(0, 0); - this.panelDiagram.VirtualPoint = new Point(0, 0); - this.panelDiagram.Clear(); - this.hashtableTabPageByFilename.Clear(); - this.listViewElements.Items.Clear(); - this.toolStripComboBoxSchemaElement.Items.Clear(); - this.toolStripComboBoxSchemaElement.Items.Add(""); - this.propertyGridSchemaObject.SelectedObject = null; - - while (this.tabControlView.TabCount > 1) - this.tabControlView.TabPages.RemoveAt(1); - - - schema.LoadSchema(schemaFilename); - - foreach (XSDObject xsdObject in schema.Elements) - { - this.listViewElements.Items.Add(new ListViewItem(new string[] { xsdObject.Name, xsdObject.Type, xsdObject.NameSpace })).Tag = xsdObject; - this.toolStripComboBoxSchemaElement.Items.Add(xsdObject); - } - - Cursor = Cursors.Default; - - if (this.schema.LoadError.Count > 0) - { - ErrorReportForm errorReportForm = new ErrorReportForm(); - errorReportForm.Errors = this.schema.LoadError; - errorReportForm.ShowDialog(this); - } - - this.diagram.ElementsByName = this.schema.ElementsByName; - if (this.schema.FirstElement != null) - this.toolStripComboBoxSchemaElement.SelectedItem = this.schema.FirstElement; - else - this.toolStripComboBoxSchemaElement.SelectedIndex = 0; - - tabControlView_Selected(null, null); - - this.tabControlView.SuspendLayout(); - foreach (string filename in this.schema.XsdFilenames) - { - string fullPath = filename; - Control browser = null; - if(webBrowserSupported) - browser = new WebBrowser(); - else - browser = new System.Windows.Forms.TextBox() { Multiline = true, ReadOnly = true, ScrollBars = ScrollBars.Both }; - browser.Dock = DockStyle.Fill; - browser.TabIndex = 0; - try - { - new Uri(filename); - } - catch - { - fullPath = Path.GetFullPath(filename); - } - TabPage tabPage = new TabPage(Path.GetFileNameWithoutExtension(filename)); - tabPage.Tag = fullPath; - tabPage.ToolTipText = fullPath; - tabPage.Controls.Add(browser); - tabPage.UseVisualStyleBackColor = true; - - this.tabControlView.TabPages.Add(tabPage); - this.hashtableTabPageByFilename[filename] = tabPage; - - } - this.tabControlView.ResumeLayout(); - - //currentLoadedSchemaFilename = schemaFilename; - } - - void DiagramControl_MouseClick(object sender, MouseEventArgs e) - { - Point location = e.Location; - location.Offset(this.panelDiagram.VirtualPoint); - - DiagramItem resultElement; - DiagramHitTestRegion resultRegion; - this.diagram.HitTest(location, out resultElement, out resultRegion); - if (resultRegion != DiagramHitTestRegion.None) - { - if (resultRegion == DiagramHitTestRegion.ChildExpandButton) - { - if (resultElement.HasChildElements) - { - if (resultElement.ChildElements.Count == 0) - { - this.diagram.ExpandChildren(resultElement); - resultElement.ShowChildElements = true; - } - else - resultElement.ShowChildElements ^= true; - - UpdateDiagram(); - this.panelDiagram.ScrollTo(this.diagram.ScalePoint(resultElement.Location), true); - } - } - else if (resultRegion == DiagramHitTestRegion.Element) - { - if ((ModifierKeys & (Keys.Control | Keys.Shift)) == (Keys.Control | Keys.Shift)) // For Debug - { - this.toolStripComboBoxSchemaElement.SelectedItem = ""; - this.propertyGridSchemaObject.SelectedObject = resultElement; - } - else - SelectDiagramElement(resultElement); - } - else - SelectDiagramElement(null); - } - } - - private void SelectDiagramElement(DiagramItem element) - { - this.textBoxElementPath.Text = ""; - if (element == null) - { - this.toolStripComboBoxSchemaElement.SelectedItem = ""; - this.propertyGridSchemaObject.SelectedObject = null; - this.listViewAttributes.Items.Clear(); - return; - } - - if (element is DiagramItem) - { - //if (this.schema.ElementsByName[element.FullName] != null) - // this.toolStripComboBoxSchemaElement.SelectedItem = this.schema.ElementsByName[element.FullName]; - XSDObject xsdObject; - if (this.schema.ElementsByName.TryGetValue(element.FullName, out xsdObject) && xsdObject != null) - this.toolStripComboBoxSchemaElement.SelectedItem = xsdObject; - else - this.toolStripComboBoxSchemaElement.SelectedItem = null; - - SelectSchemaElement(element); - - string path = '/' + element.Name; - DiagramItem parentElement = element.Parent; - while (parentElement != null) - { - if (parentElement.ItemType == DiagramItemType.element && !string.IsNullOrEmpty(parentElement.Name)) - path = '/' + parentElement.Name + path; - parentElement = parentElement.Parent; - } - this.textBoxElementPath.Text = path; - } - else - { - this.toolStripComboBoxSchemaElement.SelectedItem = ""; - SelectSchemaElement(element); - } - } - - private void SelectSchemaElement(XSDObject xsdObject) - { - SelectSchemaElement(xsdObject.Tag, xsdObject.NameSpace); - } - - private void SelectSchemaElement(DiagramItem diagramBase) - { - SelectSchemaElement(diagramBase.TabSchema, diagramBase.NameSpace); - } - - private void SelectSchemaElement(XMLSchema.openAttrs openAttrs, string nameSpace) - { - this.propertyGridSchemaObject.SelectedObject = openAttrs; - ShowDocumentation(null); - - XMLSchema.annotated annotated = openAttrs as XMLSchema.annotated; - if (annotated != null) - { - // Element documentation - if (annotated.annotation != null) - ShowDocumentation(annotated.annotation); - - // Show the enumeration - ShowEnumerate(annotated); - - // Attributes enumeration - List listAttributes = new List(); - if (annotated is XMLSchema.element) - { - XMLSchema.element element = annotated as XMLSchema.element; - - if (element.Item is XMLSchema.complexType) - { - XMLSchema.complexType complexType = element.Item as XMLSchema.complexType; - listAttributes.AddRange(ShowAttributes(complexType, nameSpace)); - } - else if (element.type != null) - { - //XSDObject xsdObject = this.schema.ElementsByName[QualifiedNameToFullName("type", element.type)] as XSDObject; - //if (xsdObject != null) - XSDObject xsdObject; - if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", element.type), out xsdObject) && xsdObject != null) - { - XMLSchema.annotated annotatedElement = xsdObject.Tag as XMLSchema.annotated; - if (annotatedElement is XMLSchema.complexType) - { - XMLSchema.complexType complexType = annotatedElement as XMLSchema.complexType; - listAttributes.AddRange(ShowAttributes(complexType, nameSpace)); - } - else - { - } - } - else - { - } - } - else - { - } - } - else if (annotated is XMLSchema.complexType) - { - XMLSchema.complexType complexType = annotated as XMLSchema.complexType; - listAttributes.AddRange(ShowAttributes(complexType, nameSpace)); - } - //RC++ Original code - //else - //{ - //} - - //this.listViewAttributes.Items.Clear(); - //foreach (XSDAttribute attribute in listAttributes) - // this.listViewAttributes.Items.Add(new ListViewItem(new string[] { attribute.Name, attribute.Type, attribute.Use, attribute.DefaultValue })).Tag = attribute; - //RC-- - - //Adrian++ - //This part i modify - else if (annotated is XMLSchema.simpleType) - { - XMLSchema.attribute attr = new XMLSchema.attribute(); - XMLSchema.localSimpleType def = new XMLSchema.localSimpleType(); - def.Item = (annotated as XMLSchema.simpleType).Item; - attr.simpleType = def; - string type = ""; - if (def.Item is XMLSchema.restriction) type = (def.Item as XMLSchema.restriction).@base.Name; - XSDAttribute XSDattr = new XSDAttribute("filename", (annotated as XMLSchema.simpleType).name, "namespace", type, false, "", "", attr); - listAttributes.Add(XSDattr); - - } - //This part i modify - this.listViewAttributes.Items.Clear(); - listAttributes.Reverse(); - foreach (XSDAttribute attribute in listAttributes) - { + } + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + components = null; + } + + if (_diagramPrinter != null) + { + _diagramPrinter.Dispose(); + _diagramPrinter = null; + } + } + + base.Dispose(disposing); + } + + private void MainForm_Load(object sender, EventArgs e) + { + this.toolStripComboBoxZoom.SelectedIndex = 8; + this.toolStripComboBoxAlignement.SelectedIndex = 1; + + if (!string.IsNullOrEmpty(Options.InputFile)) + { + LoadSchema(Options.InputFile); + foreach (var rootElement in Options.RootElements) + { + foreach (var element in schema.Elements) + { + if (element.Name == rootElement) + { + diagram.Add(element.Tag, element.NameSpace); + } + } + } + for (int i = 0; i < Options.ExpandLevel; i++) + { + diagram.ExpandOneLevel(); + } + UpdateDiagram(); + } + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "xsd files (*.xsd)|*.xsd|All files (*.*)|*.*"; + openFileDialog.FilterIndex = 1; + openFileDialog.RestoreDirectory = true; + if (openFileDialog.ShowDialog() == DialogResult.OK) + LoadSchema(openFileDialog.FileName); + } + + private void MainForm_DragDrop(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent("UniformResourceLocator")) + { + string url = e.Data.GetData(DataFormats.Text, true) as string; + if (!string.IsNullOrEmpty(url)) + LoadSchema(url.Trim()); + } + else if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + if(files != null && files.Length > 0) + LoadSchema(files[0]); + } + } + + private void MainForm_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop) + || e.Data.GetDataPresent("UniformResourceLocator") + ) + e.Effect = DragDropEffects.Move; + else + e.Effect = DragDropEffects.None; + } + + private void saveDiagramToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.Filter = "SVG files (*.svg)|*.svg" + (Options.IsRunningOnMono ? "" : "|EMF files (*.emf)|*.emf") + "|PNG files (*.png)|*.png|JPG files (*.jpg)|*.jpg|All files (*.*)|*.*"; + saveFileDialog.FilterIndex = 1; + saveFileDialog.RestoreDirectory = true; + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + string outputFilename = saveFileDialog.FileName; + try + { + DiagramExporter exporter = new DiagramExporter(diagram); + Graphics g1 = this.panelDiagram.DiagramControl.CreateGraphics(); + exporter.Export(outputFilename, g1, new DiagramAlertHandler(SaveAlert)); + g1.Dispose(); + } + catch (System.ArgumentException ex) + { + MessageBox.Show("You have reach the system limit.\r\nPlease remove some element from the diagram to make it smaller."); + System.Diagnostics.Trace.WriteLine(ex.ToString()); + } + catch (System.Runtime.InteropServices.ExternalException ex) + { + MessageBox.Show("You have reach the system limit.\r\nPlease remove some element from the diagram to make it smaller."); + System.Diagnostics.Trace.WriteLine(ex.ToString()); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + System.Diagnostics.Trace.WriteLine(ex.ToString()); + } + } + } + + bool SaveAlert(string title, string message) + { + return MessageBox.Show(this, message, title, MessageBoxButtons.YesNo) == DialogResult.Yes; + } + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { + Close(); + } + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + AboutForm aboutForm = new AboutForm(); + aboutForm.ShowDialog(this); + } + + private void toolStripComboBoxSchemaElement_SelectedIndexChanged(object sender, EventArgs e) + { + if (this.toolStripComboBoxSchemaElement.SelectedItem != null) + { + XSDObject xsdObject = this.toolStripComboBoxSchemaElement.SelectedItem as XSDObject; + if (xsdObject != null) + SelectSchemaElement(xsdObject); + } + } + + private void toolStripButtonAddToDiagram_Click(object sender, EventArgs e) + { + if (this.toolStripComboBoxSchemaElement.SelectedItem != null) + { + XSDObject xsdObject = this.toolStripComboBoxSchemaElement.SelectedItem as XSDObject; + if (xsdObject != null) + this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace); + UpdateDiagram(); + } + } + + private void toolStripButtonAddAllToDiagram_Click(object sender, EventArgs e) + { + foreach (XSDObject xsdObject in this.schema.ElementsByName.Values) + if (xsdObject != null) + this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace); + UpdateDiagram(); + } + + void DiagramControl_Paint(object sender, PaintEventArgs e) + { + Point virtualPoint = this.panelDiagram.VirtualPoint; + e.Graphics.TranslateTransform(-(float)virtualPoint.X, -(float)virtualPoint.Y); + e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; + + DiagramGdiRenderer.Draw(diagram, e.Graphics, + new Rectangle(virtualPoint, this.panelDiagram.DiagramControl.ClientRectangle.Size)); + } + + private void UpdateDiagram() + { + if (this.diagram.RootElements.Count != 0) + { + Graphics g = this.panelDiagram.DiagramControl.CreateGraphics(); + this.diagram.Layout(g); + g.Dispose(); + Size bbSize = this.diagram.BoundingBox.Size + this.diagram.Padding + this.diagram.Padding; + this.panelDiagram.VirtualSize = new Size((int)(bbSize.Width * this.diagram.Scale), (int)(bbSize.Height * this.diagram.Scale)); + } + else + this.panelDiagram.VirtualSize = new Size(0, 0); + } + + private void UpdateTitle(string filename) + { + if (filename.Length > 0) + Text = this.originalTitle + " - " + filename; + else + Text = this.originalTitle; + } + + private void LoadSchema(string schemaFilename) + { + Cursor = Cursors.WaitCursor; + + UpdateTitle(schemaFilename); + + this.diagram.Clear(); + this.panelDiagram.VirtualSize = new Size(0, 0); + this.panelDiagram.VirtualPoint = new Point(0, 0); + this.panelDiagram.Clear(); + this.hashtableTabPageByFilename.Clear(); + this.listViewElements.Items.Clear(); + this.toolStripComboBoxSchemaElement.Items.Clear(); + this.toolStripComboBoxSchemaElement.Items.Add(""); + this.propertyGridSchemaObject.SelectedObject = null; + + while (this.tabControlView.TabCount > 1) + this.tabControlView.TabPages.RemoveAt(1); + + + schema.LoadSchema(schemaFilename); + + foreach (XSDObject xsdObject in schema.Elements) + { + this.listViewElements.Items.Add(new ListViewItem(new string[] { xsdObject.Name, xsdObject.Type, xsdObject.NameSpace })).Tag = xsdObject; + this.toolStripComboBoxSchemaElement.Items.Add(xsdObject); + } + + Cursor = Cursors.Default; + + if (this.schema.LoadError.Count > 0) + { + ErrorReportForm errorReportForm = new ErrorReportForm(); + errorReportForm.Errors = this.schema.LoadError; + errorReportForm.ShowDialog(this); + } + + this.diagram.ElementsByName = this.schema.ElementsByName; + if (this.schema.FirstElement != null) + this.toolStripComboBoxSchemaElement.SelectedItem = this.schema.FirstElement; + else + this.toolStripComboBoxSchemaElement.SelectedIndex = 0; + + tabControlView_Selected(null, null); + + this.tabControlView.SuspendLayout(); + foreach (string filename in this.schema.XsdFilenames) + { + string fullPath = filename; + Control browser = null; + if(webBrowserSupported) + browser = new WebBrowser(); + else + browser = new System.Windows.Forms.TextBox() { Multiline = true, ReadOnly = true, ScrollBars = ScrollBars.Both }; + browser.Dock = DockStyle.Fill; + browser.TabIndex = 0; + try + { + new Uri(filename); + } + catch + { + fullPath = Path.GetFullPath(filename); + } + TabPage tabPage = new TabPage(Path.GetFileNameWithoutExtension(filename)); + tabPage.Tag = fullPath; + tabPage.ToolTipText = fullPath; + tabPage.Controls.Add(browser); + tabPage.UseVisualStyleBackColor = true; + + this.tabControlView.TabPages.Add(tabPage); + this.hashtableTabPageByFilename[filename] = tabPage; + + } + this.tabControlView.ResumeLayout(); + + //currentLoadedSchemaFilename = schemaFilename; + } + + void DiagramControl_MouseClick(object sender, MouseEventArgs e) + { + Point location = e.Location; + location.Offset(this.panelDiagram.VirtualPoint); + + DiagramItem resultElement; + DiagramHitTestRegion resultRegion; + this.diagram.HitTest(location, out resultElement, out resultRegion); + if (resultRegion != DiagramHitTestRegion.None) + { + if (resultRegion == DiagramHitTestRegion.ChildExpandButton) + { + if (resultElement.HasChildElements) + { + if (resultElement.ChildElements.Count == 0) + { + this.diagram.ExpandChildren(resultElement); + resultElement.ShowChildElements = true; + } + else + resultElement.ShowChildElements ^= true; + + UpdateDiagram(); + this.panelDiagram.ScrollTo(this.diagram.ScalePoint(resultElement.Location), true); + } + } + else if (resultRegion == DiagramHitTestRegion.Element) + { + if ((ModifierKeys & (Keys.Control | Keys.Shift)) == (Keys.Control | Keys.Shift)) // For Debug + { + this.toolStripComboBoxSchemaElement.SelectedItem = ""; + this.propertyGridSchemaObject.SelectedObject = resultElement; + } + else + SelectDiagramElement(resultElement); + } + else + SelectDiagramElement(null); + } + } + + private void SelectDiagramElement(DiagramItem element) + { + this.textBoxElementPath.Text = ""; + if (element == null) + { + this.toolStripComboBoxSchemaElement.SelectedItem = ""; + this.propertyGridSchemaObject.SelectedObject = null; + this.listViewAttributes.Items.Clear(); + return; + } + + if (element is DiagramItem) + { + //if (this.schema.ElementsByName[element.FullName] != null) + // this.toolStripComboBoxSchemaElement.SelectedItem = this.schema.ElementsByName[element.FullName]; + XSDObject xsdObject; + if (this.schema.ElementsByName.TryGetValue(element.FullName, out xsdObject) && xsdObject != null) + this.toolStripComboBoxSchemaElement.SelectedItem = xsdObject; + else + this.toolStripComboBoxSchemaElement.SelectedItem = null; + + SelectSchemaElement(element); + + string path = '/' + element.Name; + DiagramItem parentElement = element.Parent; + while (parentElement != null) + { + if (parentElement.ItemType == DiagramItemType.element && !string.IsNullOrEmpty(parentElement.Name)) + path = '/' + parentElement.Name + path; + parentElement = parentElement.Parent; + } + this.textBoxElementPath.Text = path; + } + else + { + this.toolStripComboBoxSchemaElement.SelectedItem = ""; + SelectSchemaElement(element); + } + } + + private void SelectSchemaElement(XSDObject xsdObject) + { + SelectSchemaElement(xsdObject.Tag, xsdObject.NameSpace); + } + + private void SelectSchemaElement(DiagramItem diagramBase) + { + SelectSchemaElement(diagramBase.TabSchema, diagramBase.NameSpace); + } + + private void SelectSchemaElement(XMLSchema.openAttrs openAttrs, string nameSpace) + { + this.propertyGridSchemaObject.SelectedObject = openAttrs; + ShowDocumentation(null); + + XMLSchema.annotated annotated = openAttrs as XMLSchema.annotated; + if (annotated != null) + { + // Element documentation + if (annotated.annotation != null) + ShowDocumentation(annotated.annotation); + + // Show the enumeration + ShowEnumerate(annotated); + + // Attributes enumeration + List listAttributes = new List(); + if (annotated is XMLSchema.element) + { + XMLSchema.element element = annotated as XMLSchema.element; + + if (element.Item is XMLSchema.complexType) + { + XMLSchema.complexType complexType = element.Item as XMLSchema.complexType; + listAttributes.AddRange(ShowAttributes(complexType, nameSpace)); + } + else if (element.type != null) + { + //XSDObject xsdObject = this.schema.ElementsByName[QualifiedNameToFullName("type", element.type)] as XSDObject; + //if (xsdObject != null) + XSDObject xsdObject; + if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", element.type), out xsdObject) && xsdObject != null) + { + XMLSchema.annotated annotatedElement = xsdObject.Tag as XMLSchema.annotated; + if (annotatedElement is XMLSchema.complexType) + { + XMLSchema.complexType complexType = annotatedElement as XMLSchema.complexType; + listAttributes.AddRange(ShowAttributes(complexType, nameSpace)); + } + else + { + } + } + else + { + } + } + else + { + } + } + else if (annotated is XMLSchema.complexType) + { + XMLSchema.complexType complexType = annotated as XMLSchema.complexType; + listAttributes.AddRange(ShowAttributes(complexType, nameSpace)); + } + //RC++ Original code + //else + //{ + //} + + //this.listViewAttributes.Items.Clear(); + //foreach (XSDAttribute attribute in listAttributes) + // this.listViewAttributes.Items.Add(new ListViewItem(new string[] { attribute.Name, attribute.Type, attribute.Use, attribute.DefaultValue })).Tag = attribute; + //RC-- + + //Adrian++ + //This part i modify + else if (annotated is XMLSchema.simpleType) + { + XMLSchema.attribute attr = new XMLSchema.attribute(); + XMLSchema.localSimpleType def = new XMLSchema.localSimpleType(); + def.Item = (annotated as XMLSchema.simpleType).Item; + attr.simpleType = def; + string type = ""; + if (def.Item is XMLSchema.restriction) type = (def.Item as XMLSchema.restriction).@base.Name; + XSDAttribute XSDattr = new XSDAttribute("filename", (annotated as XMLSchema.simpleType).name, "namespace", type, false, "", "", attr); + listAttributes.Add(XSDattr); + + } + //This part i modify + this.listViewAttributes.Items.Clear(); + listAttributes.Reverse(); + foreach (XSDAttribute attribute in listAttributes) + { string s = ""; //dgis fix github issue 2 (attribute.Tag == null ???) - if (attribute.Tag != null && attribute.Tag.simpleType != null && attribute.Tag.simpleType.Item is XMLSchema.restriction) - { - XMLSchema.restriction r = attribute.Tag.simpleType.Item as XMLSchema.restriction; - if (r.Items != null) - { - for (int i = 0; i < r.Items.Length; i++) - { - s += r.ItemsElementName[i].ToString() + "(" + r.Items[i].id + " " + r.Items[i].value + ");"; - } - } - } - - this.listViewAttributes.Items.Add(new ListViewItem(new string[] { attribute.Name, attribute.Type, attribute.Use, attribute.DefaultValue, s })).Tag = attribute; - } - //Adrian-- - } - } - - private List ShowAttributes(XMLSchema.complexType complexType, string nameSpace) - { - List listAttributes = new List(); - ParseComplexTypeAttributes(nameSpace, listAttributes, complexType, false); - return listAttributes; - } - - private void ParseComplexTypeAttributes(string nameSpace, List listAttributes, XMLSchema.complexType complexType, bool isRestriction) - { - if (complexType.ItemsElementName != null) - { - for (int i = 0; i < complexType.ItemsElementName.Length; i++) - { - switch (complexType.ItemsElementName[i]) - { - case XMLSchema.ItemsChoiceType4.attribute: - { - XMLSchema.attribute attribute = complexType.Items[i] as XMLSchema.attribute; - ParseAttribute(nameSpace, listAttributes, attribute, false); - } - break; - case XMLSchema.ItemsChoiceType4.attributeGroup: - { - XMLSchema.attributeGroup attributeGroup = complexType.Items[i] as XMLSchema.attributeGroup; - ParseAttributeGroup(nameSpace, listAttributes, attributeGroup, false); - } - break; - case XMLSchema.ItemsChoiceType4.anyAttribute: - XMLSchema.wildcard wildcard = complexType.Items[i] as XMLSchema.wildcard; - XSDAttribute xsdAttribute = new XSDAttribute("", "*", wildcard.@namespace, "", false, null, null, null); - listAttributes.Add(xsdAttribute); - break; - case XMLSchema.ItemsChoiceType4.simpleContent: - case XMLSchema.ItemsChoiceType4.complexContent: - XMLSchema.annotated annotatedContent = null; - if (complexType.Items[i] is XMLSchema.complexContent) - { - XMLSchema.complexContent complexContent = complexType.Items[i] as XMLSchema.complexContent; - annotatedContent = complexContent.Item; - } - else if (complexType.Items[i] is XMLSchema.simpleContent) - { - XMLSchema.simpleContent simpleContent = complexType.Items[i] as XMLSchema.simpleContent; - annotatedContent = simpleContent.Item; - } - if (annotatedContent is XMLSchema.extensionType) - { - XMLSchema.extensionType extensionType = annotatedContent as XMLSchema.extensionType; - //XSDObject xsdExtensionType = this.schema.ElementsByName[QualifiedNameToFullName("type", extensionType.@base)] as XSDObject; - //if (xsdExtensionType != null) - XSDObject xsdExtensionType; - if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", extensionType.@base), out xsdExtensionType) && xsdExtensionType != null) - { - XMLSchema.annotated annotatedExtension = xsdExtensionType.Tag as XMLSchema.annotated; - if (annotatedExtension != null) - { - if (annotatedExtension is XMLSchema.complexType) - ParseComplexTypeAttributes(extensionType.@base.Namespace, listAttributes, annotatedExtension as XMLSchema.complexType, false); - } - } - if (extensionType.Items != null) - { - foreach (XMLSchema.annotated annotated in extensionType.Items) - { - if (annotated is XMLSchema.attribute) - { - ParseAttribute(nameSpace, listAttributes, annotated as XMLSchema.attribute, false); - } - else if (annotated is XMLSchema.attributeGroup) - { - ParseAttributeGroup(nameSpace, listAttributes, annotated as XMLSchema.attributeGroup, false); - } - } - } - } - else if (annotatedContent is XMLSchema.restrictionType) - { - XMLSchema.restrictionType restrictionType = annotatedContent as XMLSchema.restrictionType; - //XSDObject xsdRestrictionType = this.schema.ElementsByName[QualifiedNameToFullName("type", restrictionType.@base)] as XSDObject; - //if (xsdRestrictionType != null) - XSDObject xsdRestrictionType; - if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", restrictionType.@base), out xsdRestrictionType) && xsdRestrictionType != null) - { - XMLSchema.annotated annotatedRestriction = xsdRestrictionType.Tag as XMLSchema.annotated; - if (annotatedRestriction != null) - { - if (annotatedRestriction is XMLSchema.complexType) - ParseComplexTypeAttributes(restrictionType.@base.Namespace, listAttributes, annotatedRestriction as XMLSchema.complexType, false); - } - } - if (restrictionType.Items1 != null) - { - foreach (XMLSchema.annotated annotated in restrictionType.Items1) - { - if (annotated is XMLSchema.attribute) - { - ParseAttribute(nameSpace, listAttributes, annotated as XMLSchema.attribute, true); - } - else if (annotated is XMLSchema.attributeGroup) - { - ParseAttributeGroup(nameSpace, listAttributes, annotated as XMLSchema.attributeGroup, true); - } - } - } - } - break; - } - } - } - else - { - } - } - - private void ParseAttribute(string nameSpace, List listAttributes, XMLSchema.attribute attribute, bool isRestriction) - { - bool isReference = false; - string filename = ""; - string name = attribute.name; - string type = ""; - if (attribute.@ref != null) + if (attribute.Tag != null && attribute.Tag.simpleType != null && attribute.Tag.simpleType.Item is XMLSchema.restriction) + { + XMLSchema.restriction r = attribute.Tag.simpleType.Item as XMLSchema.restriction; + if (r.Items != null) + { + for (int i = 0; i < r.Items.Length; i++) + { + s += r.ItemsElementName[i].ToString() + "(" + r.Items[i].id + " " + r.Items[i].value + ");"; + } + } + } + + this.listViewAttributes.Items.Add(new ListViewItem(new string[] { attribute.Name, attribute.Type, attribute.Use, attribute.DefaultValue, s })).Tag = attribute; + } + //Adrian-- + } + } + + private List ShowAttributes(XMLSchema.complexType complexType, string nameSpace) + { + List listAttributes = new List(); + ParseComplexTypeAttributes(nameSpace, listAttributes, complexType, false); + return listAttributes; + } + + private void ParseComplexTypeAttributes(string nameSpace, List listAttributes, XMLSchema.complexType complexType, bool isRestriction) + { + if (complexType.ItemsElementName != null) + { + for (int i = 0; i < complexType.ItemsElementName.Length; i++) + { + switch (complexType.ItemsElementName[i]) + { + case XMLSchema.ItemsChoiceType4.attribute: + { + XMLSchema.attribute attribute = complexType.Items[i] as XMLSchema.attribute; + ParseAttribute(nameSpace, listAttributes, attribute, false); + } + break; + case XMLSchema.ItemsChoiceType4.attributeGroup: + { + XMLSchema.attributeGroup attributeGroup = complexType.Items[i] as XMLSchema.attributeGroup; + ParseAttributeGroup(nameSpace, listAttributes, attributeGroup, false); + } + break; + case XMLSchema.ItemsChoiceType4.anyAttribute: + XMLSchema.wildcard wildcard = complexType.Items[i] as XMLSchema.wildcard; + XSDAttribute xsdAttribute = new XSDAttribute("", "*", wildcard.@namespace, "", false, null, null, null); + listAttributes.Add(xsdAttribute); + break; + case XMLSchema.ItemsChoiceType4.simpleContent: + case XMLSchema.ItemsChoiceType4.complexContent: + XMLSchema.annotated annotatedContent = null; + if (complexType.Items[i] is XMLSchema.complexContent) + { + XMLSchema.complexContent complexContent = complexType.Items[i] as XMLSchema.complexContent; + annotatedContent = complexContent.Item; + } + else if (complexType.Items[i] is XMLSchema.simpleContent) + { + XMLSchema.simpleContent simpleContent = complexType.Items[i] as XMLSchema.simpleContent; + annotatedContent = simpleContent.Item; + } + if (annotatedContent is XMLSchema.extensionType) + { + XMLSchema.extensionType extensionType = annotatedContent as XMLSchema.extensionType; + //XSDObject xsdExtensionType = this.schema.ElementsByName[QualifiedNameToFullName("type", extensionType.@base)] as XSDObject; + //if (xsdExtensionType != null) + XSDObject xsdExtensionType; + if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", extensionType.@base), out xsdExtensionType) && xsdExtensionType != null) + { + XMLSchema.annotated annotatedExtension = xsdExtensionType.Tag as XMLSchema.annotated; + if (annotatedExtension != null) + { + if (annotatedExtension is XMLSchema.complexType) + ParseComplexTypeAttributes(extensionType.@base.Namespace, listAttributes, annotatedExtension as XMLSchema.complexType, false); + } + } + if (extensionType.Items != null) + { + foreach (XMLSchema.annotated annotated in extensionType.Items) + { + if (annotated is XMLSchema.attribute) + { + ParseAttribute(nameSpace, listAttributes, annotated as XMLSchema.attribute, false); + } + else if (annotated is XMLSchema.attributeGroup) + { + ParseAttributeGroup(nameSpace, listAttributes, annotated as XMLSchema.attributeGroup, false); + } + } + } + } + else if (annotatedContent is XMLSchema.restrictionType) + { + XMLSchema.restrictionType restrictionType = annotatedContent as XMLSchema.restrictionType; + //XSDObject xsdRestrictionType = this.schema.ElementsByName[QualifiedNameToFullName("type", restrictionType.@base)] as XSDObject; + //if (xsdRestrictionType != null) + XSDObject xsdRestrictionType; + if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", restrictionType.@base), out xsdRestrictionType) && xsdRestrictionType != null) + { + XMLSchema.annotated annotatedRestriction = xsdRestrictionType.Tag as XMLSchema.annotated; + if (annotatedRestriction != null) + { + if (annotatedRestriction is XMLSchema.complexType) + ParseComplexTypeAttributes(restrictionType.@base.Namespace, listAttributes, annotatedRestriction as XMLSchema.complexType, false); + } + } + if (restrictionType.Items1 != null) + { + foreach (XMLSchema.annotated annotated in restrictionType.Items1) + { + if (annotated is XMLSchema.attribute) + { + ParseAttribute(nameSpace, listAttributes, annotated as XMLSchema.attribute, true); + } + else if (annotated is XMLSchema.attributeGroup) + { + ParseAttributeGroup(nameSpace, listAttributes, annotated as XMLSchema.attributeGroup, true); + } + } + } + } + break; + } + } + } + else + { + } + } + + private void ParseAttribute(string nameSpace, List listAttributes, XMLSchema.attribute attribute, bool isRestriction) + { + bool isReference = false; + string filename = ""; + string name = attribute.name; + string type = ""; + if (attribute.@ref != null) { object o = null; this.schema.AttributesByName.TryGetValue(QualifiedNameToFullName("attribute", attribute.@ref), out o); - if (o is XSDAttribute) - { - XSDAttribute xsdAttributeInstance = o as XSDAttribute; - ParseAttribute(nameSpace, listAttributes, xsdAttributeInstance.Tag, isRestriction); - return; - } - else // Reference not found! - { - type = QualifiedNameToAttributeTypeName(attribute.@ref); - name = attribute.@ref.Name; - nameSpace = attribute.@ref.Namespace; - isReference = true; - } - } - else if (attribute.type != null) - { - type = QualifiedNameToAttributeTypeName(attribute.type); - nameSpace = attribute.type.Namespace; - } - else if (attribute.simpleType != null) - { - XMLSchema.simpleType simpleType = attribute.simpleType as XMLSchema.simpleType; - if (simpleType.Item is XMLSchema.restriction) - { - XMLSchema.restriction restriction = simpleType.Item as XMLSchema.restriction; - type = QualifiedNameToAttributeTypeName(restriction.@base); - nameSpace = restriction.@base.Namespace; - } - else if (simpleType.Item is XMLSchema.list) - { - XMLSchema.list list = simpleType.Item as XMLSchema.list; - type = QualifiedNameToAttributeTypeName(list.itemType); - nameSpace = list.itemType.Namespace; - } - else - { - } - } - else - { - - } - if (string.IsNullOrEmpty(attribute.name) && string.IsNullOrEmpty(name)) - { - } - if (isRestriction) - { - if (attribute.use == XMLSchema.attributeUse.prohibited) - { - foreach (XSDAttribute xsdAttribute in listAttributes) - { - if (xsdAttribute.Name == name) - { - //listAttributes.Remove(xsdAttribute); - xsdAttribute.Use = attribute.use.ToString(); - break; - } - } - } - } - else - { - XSDAttribute xsdAttribute = new XSDAttribute(filename, name, nameSpace, type, isReference, attribute.@default, attribute.use.ToString(), attribute); - listAttributes.Insert(0, xsdAttribute); - } - } - - private void ParseAttributeGroup(string nameSpace, List listAttributes, XMLSchema.attributeGroup attributeGroup, bool isRestriction) - { - if (attributeGroup is XMLSchema.attributeGroupRef && attributeGroup.@ref != null) + if (o is XSDAttribute) + { + XSDAttribute xsdAttributeInstance = o as XSDAttribute; + ParseAttribute(nameSpace, listAttributes, xsdAttributeInstance.Tag, isRestriction); + return; + } + else // Reference not found! + { + type = QualifiedNameToAttributeTypeName(attribute.@ref); + name = attribute.@ref.Name; + nameSpace = attribute.@ref.Namespace; + isReference = true; + } + } + else if (attribute.type != null) + { + type = QualifiedNameToAttributeTypeName(attribute.type); + nameSpace = attribute.type.Namespace; + } + else if (attribute.simpleType != null) + { + XMLSchema.simpleType simpleType = attribute.simpleType as XMLSchema.simpleType; + if (simpleType.Item is XMLSchema.restriction) + { + XMLSchema.restriction restriction = simpleType.Item as XMLSchema.restriction; + type = QualifiedNameToAttributeTypeName(restriction.@base); + nameSpace = restriction.@base.Namespace; + } + else if (simpleType.Item is XMLSchema.list) + { + XMLSchema.list list = simpleType.Item as XMLSchema.list; + type = QualifiedNameToAttributeTypeName(list.itemType); + nameSpace = list.itemType.Namespace; + } + else + { + } + } + else + { + + } + if (string.IsNullOrEmpty(attribute.name) && string.IsNullOrEmpty(name)) + { + } + if (isRestriction) + { + if (attribute.use == XMLSchema.attributeUse.prohibited) + { + foreach (XSDAttribute xsdAttribute in listAttributes) + { + if (xsdAttribute.Name == name) + { + //listAttributes.Remove(xsdAttribute); + xsdAttribute.Use = attribute.use.ToString(); + break; + } + } + } + } + else + { + XSDAttribute xsdAttribute = new XSDAttribute(filename, name, nameSpace, type, isReference, attribute.@default, attribute.use.ToString(), attribute); + listAttributes.Insert(0, xsdAttribute); + } + } + + private void ParseAttributeGroup(string nameSpace, List listAttributes, XMLSchema.attributeGroup attributeGroup, bool isRestriction) + { + if (attributeGroup is XMLSchema.attributeGroupRef && attributeGroup.@ref != null) { object o = null; this.schema.AttributesByName.TryGetValue(QualifiedNameToFullName("attributeGroup", attributeGroup.@ref), out o); - if (o is XSDAttributeGroup) - { - XSDAttributeGroup xsdAttributeGroup = o as XSDAttributeGroup; - XMLSchema.attributeGroup attributeGroupInstance = xsdAttributeGroup.Tag; - - foreach (XMLSchema.annotated annotated in attributeGroupInstance.Items) - { - if (annotated is XMLSchema.attribute) - { - ParseAttribute(nameSpace, listAttributes, annotated as XMLSchema.attribute, isRestriction); - } - else if (annotated is XMLSchema.attributeGroup) - { - ParseAttributeGroup(nameSpace, listAttributes, annotated as XMLSchema.attributeGroup, isRestriction); - } - } - } - } - else - { - - } - } - - private static string QualifiedNameToFullName(string type, System.Xml.XmlQualifiedName xmlQualifiedName) - { - return xmlQualifiedName.Namespace + ':' + type + ':' + xmlQualifiedName.Name; - } - - private static string QualifiedNameToAttributeTypeName(System.Xml.XmlQualifiedName xmlQualifiedName) - { - return xmlQualifiedName.Name + " : " + xmlQualifiedName.Namespace; - } - - private void ShowEnumerate(XMLSchema.attribute attribute) - { - this.listViewEnumerate.Items.Clear(); - if (attribute != null) - { - if (attribute.type != null) - { - //XSDObject xsdObject = this.schema.ElementsByName[QualifiedNameToFullName("type", attribute.type)] as XSDObject; - //if (xsdObject != null) - XSDObject xsdObject; - if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", attribute.type), out xsdObject) && xsdObject != null) - { - XMLSchema.annotated annotatedElement = xsdObject.Tag as XMLSchema.annotated; - if (annotatedElement is XMLSchema.simpleType) - ShowEnumerate(annotatedElement as XMLSchema.simpleType); - } - } - else if (attribute.simpleType != null) - { - ShowEnumerate(attribute.simpleType); - } - } - } - - private void ShowEnumerate(XMLSchema.annotated annotated) - { - this.listViewEnumerate.Items.Clear(); - - if (annotated != null) - { - XMLSchema.element element = annotated as XMLSchema.element; - if (element != null && element.type != null) - { - //XSDObject xsdObject = this.schema.ElementsByName[QualifiedNameToFullName("type", element.type)] as XSDObject; - //if (xsdObject != null) - XSDObject xsdObject; - if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", element.type), out xsdObject) && xsdObject != null) - { - XMLSchema.annotated annotatedElement = xsdObject.Tag as XMLSchema.annotated; - if (annotatedElement is XMLSchema.simpleType) - ShowEnumerate(annotatedElement as XMLSchema.simpleType); - } - } - } - } - - private void ShowEnumerate(XMLSchema.simpleType simpleType) - { - if (simpleType != null) - { - if (simpleType.Item != null) - { - XMLSchema.restriction restriction = simpleType.Item as XMLSchema.restriction; - if (restriction != null && restriction.ItemsElementName != null) - { - for (int i = 0; i < restriction.ItemsElementName.Length; i++) - { - if (restriction.ItemsElementName[i] == XMLSchema.ItemsChoiceType.enumeration) - { - XMLSchema.facet facet = restriction.Items[i] as XMLSchema.facet; - if (facet != null) - this.listViewEnumerate.Items.Add(facet.value); - } - } - - if (this.listViewEnumerate.Items.Count != 0) - this.listViewEnumerate.Columns[0].Width = -1; - } - } - } - } - - - private void ShowDocumentation(XMLSchema.annotation annotation) - { - if (this.textBoxAnnotation == null) - { - // - // webBrowserDocumentation - // - if(webBrowserSupported) - { - this.webBrowserDocumentation = new System.Windows.Forms.WebBrowser(); - this.webBrowserDocumentation.Dock = System.Windows.Forms.DockStyle.Fill; - this.webBrowserDocumentation.Location = new System.Drawing.Point(0, 0); - this.webBrowserDocumentation.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowserDocumentation.Name = "webBrowserDocumentation"; - this.webBrowserDocumentation.Size = new System.Drawing.Size(214, 117); - this.webBrowserDocumentation.TabIndex = 1; - this.splitContainerDiagramElement.Panel2.Controls.Add(this.webBrowserDocumentation); - } - else - this.webBrowserDocumentation = null; - // - // textBoxAnnotation - // - this.textBoxAnnotation = new System.Windows.Forms.TextBox(); - this.textBoxAnnotation.Dock = System.Windows.Forms.DockStyle.Fill; - this.textBoxAnnotation.Location = new System.Drawing.Point(0, 0); - this.textBoxAnnotation.Multiline = true; - this.textBoxAnnotation.Name = "textBoxAnnotation"; - this.textBoxAnnotation.ReadOnly = true; - this.textBoxAnnotation.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBoxAnnotation.Size = new System.Drawing.Size(214, 117); - this.textBoxAnnotation.TabIndex = 0; - this.splitContainerDiagramElement.Panel2.Controls.Add(this.textBoxAnnotation); - } - if (annotation == null) - { - this.textBoxAnnotation.Text = ""; - this.textBoxAnnotation.Visible = true; - if (this.webBrowserDocumentation != null) - this.webBrowserDocumentation.Visible = false; - - return; - } - - foreach (object o in annotation.Items) - { - if (o is XMLSchema.documentation) - { - XMLSchema.documentation documentation = o as XMLSchema.documentation; - if (documentation.Any != null && documentation.Any.Length > 0) - { - string text = documentation.Any[0].Value; - text = text.Replace("\n", " "); - text = text.Replace("\t", " "); - text = text.Replace("\r", ""); - text = Regex.Replace(text, " +", " "); - text = text.Trim(); - - //text = text.Replace(, " "); - - //text = text.Trim('\n', '\t', '\r', ' '); - //string[] textLines = text.Split(new char[] { '\n' }); - //for (int i = 0; i < textLines.Length; i++) - // textLines[i] = textLines[i].Trim('\n', '\t', '\r', ' '); - //text = string.Join("\r\n", textLines); - this.textBoxAnnotation.Text = text; - this.textBoxAnnotation.Visible = true; - if (this.webBrowserDocumentation != null) - this.webBrowserDocumentation.Visible = false; - } - else if (documentation.source != null) - { - if (this.webBrowserDocumentation != null) - { - this.textBoxAnnotation.Visible = false; - this.webBrowserDocumentation.Visible = true; - this.webBrowserDocumentation.Navigate(documentation.source); - } - else - { - this.textBoxAnnotation.Text = documentation.source; - this.textBoxAnnotation.Visible = true; - } - } - break; - } - } - } - - private void listViewAttributes_SelectedIndexChanged(object sender, EventArgs e) - { - if (this.listViewAttributes.SelectedItems.Count > 0) - { - XSDAttribute xsdAttribute = this.listViewAttributes.SelectedItems[0].Tag as XSDAttribute; - XMLSchema.attribute attribute = xsdAttribute.Tag; - if (attribute != null && attribute.annotation != null) - ShowDocumentation(attribute.annotation); - else - ShowDocumentation(null); - ShowEnumerate(attribute); - } - } - - private void toolStripComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e) - { - try - { - string zoomString = this.toolStripComboBoxZoom.SelectedItem as string; - zoomString = zoomString.Replace("%", ""); - - float zoom = (float)int.Parse(zoomString) / 100.0f; - if (zoom >= 0.10 && zoom <= 10) - { - //Point virtualCenter = this.panelDiagram.VirtualPoint; - //virtualCenter.Offset(this.panelDiagram.DiagramControl.Width / 2, this.panelDiagram.DiagramControl.Height / 2); - //Size oldSize = this.panelDiagram.VirtualSize; - //this.diagram.Scale = zoom; - //UpdateDiagram(); - //Size newSize = this.panelDiagram.VirtualSize; - //virtualCenter.X = (int)((float)newSize.Width / (float)oldSize.Width * (float)virtualCenter.X); - //virtualCenter.Y = (int)((float)newSize.Height / (float)oldSize.Height * (float)virtualCenter.Y); - //if (virtualCenter.X > this.diagram.BoundingBox.Right) - // virtualCenter.X = this.diagram.BoundingBox.Right; - //if (virtualCenter.Y > this.diagram.BoundingBox.Bottom) - // virtualCenter.Y = this.diagram.BoundingBox.Bottom; - //this.panelDiagram.ScrollTo(virtualCenter, true); - - Point virtualCenter = this.panelDiagram.VirtualPoint; - virtualCenter.Offset(this.panelDiagram.DiagramControl.Width / 2, this.panelDiagram.DiagramControl.Height / 2); - Size oldSize = this.panelDiagram.VirtualSize; - this.diagram.Scale = zoom; - UpdateDiagram(); - Size newSize = this.panelDiagram.VirtualSize; - Point newVirtualCenter = new Point(); - newVirtualCenter.X = (int)((float)newSize.Width / (float)oldSize.Width * (float)virtualCenter.X); - newVirtualCenter.Y = (int)((float)newSize.Height / (float)oldSize.Height * (float)virtualCenter.Y); - if (newVirtualCenter.X > this.diagram.BoundingBox.Right) - newVirtualCenter.X = this.diagram.BoundingBox.Right; - if (newVirtualCenter.Y > this.diagram.BoundingBox.Bottom) - newVirtualCenter.Y = this.diagram.BoundingBox.Bottom; - this.panelDiagram.ScrollTo(newVirtualCenter, true); - } - } - catch { } - } - - private void toolStripComboBoxZoom_TextChanged(object sender, EventArgs e) - { - //try - //{ - // string zoomString = this.toolStripComboBoxZoom.SelectedItem as string; - // zoomString = zoomString.Replace("%", ""); - - // float zoom = (float)int.Parse(zoomString) / 100.0f; - // if (zoom >= 0.10 && zoom <= 10) - // { - // this.diagram.Scale = zoom; - // UpdateDiagram(); - // } - //} - //catch { } - } - - void DiagramControl_MouseWheel(object sender, MouseEventArgs e) - { - if ((ModifierKeys & Keys.Control) == Keys.Control) - { - if (e.Delta > 0) - { - if (this.toolStripComboBoxZoom.SelectedIndex < this.toolStripComboBoxZoom.Items.Count - 1) - this.toolStripComboBoxZoom.SelectedIndex++; - } - else - { - if (this.toolStripComboBoxZoom.SelectedIndex > 0) - this.toolStripComboBoxZoom.SelectedIndex--; - } - } - } - - private void pageToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - if (_diagramPrinter == null) - { - _diagramPrinter = new DiagramPrinter(); - } - _diagramPrinter.Diagram = diagram; - - _diagramPrinter.PageSetup(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - if (_diagramPrinter == null) - { - _diagramPrinter = new DiagramPrinter(); - } - _diagramPrinter.Diagram = diagram; - - _diagramPrinter.PrintPreview(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - private void printToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - if (_diagramPrinter == null) - { - _diagramPrinter = new DiagramPrinter(); - } - _diagramPrinter.Diagram = diagram; - - _diagramPrinter.Print(true, Options.IsRunningOnMono); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } - - private void toolStripButtonTogglePanel_Click(object sender, EventArgs e) - { - this.splitContainerMain.Panel2Collapsed = !this.toolStripButtonTogglePanel.Checked; - } - - private void contextMenuStripDiagram_Opened(object sender, EventArgs e) - { - this.gotoXSDFileToolStripMenuItem.Enabled = false; - this.removeFromDiagramToolStripMenuItem.Enabled = false; - - Point contextualMenuMousePosition = this.panelDiagram.DiagramControl.PointToClient(MousePosition); - contextualMenuMousePosition.Offset(this.panelDiagram.VirtualPoint); - DiagramItem resultElement; - DiagramHitTestRegion resultRegion; - this.diagram.HitTest(contextualMenuMousePosition, out resultElement, out resultRegion); - if (resultRegion != DiagramHitTestRegion.None) - { - if (resultRegion == DiagramHitTestRegion.Element) // && resultElement.Parent == null) - { - this.contextualMenuPointedElement = resultElement; - this.gotoXSDFileToolStripMenuItem.Enabled = this.schema.ElementsByName.ContainsKey(this.contextualMenuPointedElement.FullName); - this.removeFromDiagramToolStripMenuItem.Enabled = true; - } - } - } - - private void gotoXSDFileToolStripMenuItem_Click(object sender, EventArgs e) - { - if (this.contextualMenuPointedElement != null) - { - //XSDObject xsdObject = this.schema.ElementsByName[this.contextualMenuPointedElement.FullName] as XSDObject; - //if (xsdObject != null) - XSDObject xsdObject; - if (this.schema.ElementsByName.TryGetValue(this.contextualMenuPointedElement.FullName, out xsdObject) && xsdObject != null) + if (o is XSDAttributeGroup) + { + XSDAttributeGroup xsdAttributeGroup = o as XSDAttributeGroup; + XMLSchema.attributeGroup attributeGroupInstance = xsdAttributeGroup.Tag; + + foreach (XMLSchema.annotated annotated in attributeGroupInstance.Items) + { + if (annotated is XMLSchema.attribute) + { + ParseAttribute(nameSpace, listAttributes, annotated as XMLSchema.attribute, isRestriction); + } + else if (annotated is XMLSchema.attributeGroup) + { + ParseAttributeGroup(nameSpace, listAttributes, annotated as XMLSchema.attributeGroup, isRestriction); + } + } + } + } + else + { + + } + } + + private static string QualifiedNameToFullName(string type, System.Xml.XmlQualifiedName xmlQualifiedName) + { + return xmlQualifiedName.Namespace + ':' + type + ':' + xmlQualifiedName.Name; + } + + private static string QualifiedNameToAttributeTypeName(System.Xml.XmlQualifiedName xmlQualifiedName) + { + return xmlQualifiedName.Name + " : " + xmlQualifiedName.Namespace; + } + + private void ShowEnumerate(XMLSchema.attribute attribute) + { + this.listViewEnumerate.Items.Clear(); + if (attribute != null) + { + if (attribute.type != null) + { + //XSDObject xsdObject = this.schema.ElementsByName[QualifiedNameToFullName("type", attribute.type)] as XSDObject; + //if (xsdObject != null) + XSDObject xsdObject; + if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", attribute.type), out xsdObject) && xsdObject != null) + { + XMLSchema.annotated annotatedElement = xsdObject.Tag as XMLSchema.annotated; + if (annotatedElement is XMLSchema.simpleType) + ShowEnumerate(annotatedElement as XMLSchema.simpleType); + } + } + else if (attribute.simpleType != null) + { + ShowEnumerate(attribute.simpleType); + } + } + } + + private void ShowEnumerate(XMLSchema.annotated annotated) + { + this.listViewEnumerate.Items.Clear(); + + if (annotated != null) + { + XMLSchema.element element = annotated as XMLSchema.element; + if (element != null && element.type != null) + { + //XSDObject xsdObject = this.schema.ElementsByName[QualifiedNameToFullName("type", element.type)] as XSDObject; + //if (xsdObject != null) + XSDObject xsdObject; + if (this.schema.ElementsByName.TryGetValue(QualifiedNameToFullName("type", element.type), out xsdObject) && xsdObject != null) + { + XMLSchema.annotated annotatedElement = xsdObject.Tag as XMLSchema.annotated; + if (annotatedElement is XMLSchema.simpleType) + ShowEnumerate(annotatedElement as XMLSchema.simpleType); + } + } + } + } + + private void ShowEnumerate(XMLSchema.simpleType simpleType) + { + if (simpleType != null) + { + if (simpleType.Item != null) + { + XMLSchema.restriction restriction = simpleType.Item as XMLSchema.restriction; + if (restriction != null && restriction.ItemsElementName != null) + { + for (int i = 0; i < restriction.ItemsElementName.Length; i++) + { + if (restriction.ItemsElementName[i] == XMLSchema.ItemsChoiceType.enumeration) + { + XMLSchema.facet facet = restriction.Items[i] as XMLSchema.facet; + if (facet != null) + this.listViewEnumerate.Items.Add(facet.value); + } + } + + if (this.listViewEnumerate.Items.Count != 0) + this.listViewEnumerate.Columns[0].Width = -1; + } + } + } + } + + + private void ShowDocumentation(XMLSchema.annotation annotation) + { + if (this.textBoxAnnotation == null) + { + // + // webBrowserDocumentation + // + if(webBrowserSupported) + { + this.webBrowserDocumentation = new System.Windows.Forms.WebBrowser(); + this.webBrowserDocumentation.Dock = System.Windows.Forms.DockStyle.Fill; + this.webBrowserDocumentation.Location = new System.Drawing.Point(0, 0); + this.webBrowserDocumentation.MinimumSize = new System.Drawing.Size(20, 20); + this.webBrowserDocumentation.Name = "webBrowserDocumentation"; + this.webBrowserDocumentation.Size = new System.Drawing.Size(214, 117); + this.webBrowserDocumentation.TabIndex = 1; + this.splitContainerDiagramElement.Panel2.Controls.Add(this.webBrowserDocumentation); + } + else + this.webBrowserDocumentation = null; + // + // textBoxAnnotation + // + this.textBoxAnnotation = new System.Windows.Forms.TextBox(); + this.textBoxAnnotation.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxAnnotation.Location = new System.Drawing.Point(0, 0); + this.textBoxAnnotation.Multiline = true; + this.textBoxAnnotation.Name = "textBoxAnnotation"; + this.textBoxAnnotation.ReadOnly = true; + this.textBoxAnnotation.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBoxAnnotation.Size = new System.Drawing.Size(214, 117); + this.textBoxAnnotation.TabIndex = 0; + this.splitContainerDiagramElement.Panel2.Controls.Add(this.textBoxAnnotation); + } + if (annotation == null) + { + this.textBoxAnnotation.Text = ""; + this.textBoxAnnotation.Visible = true; + if (this.webBrowserDocumentation != null) + this.webBrowserDocumentation.Visible = false; + + return; + } + + foreach (object o in annotation.Items) + { + if (o is XMLSchema.documentation) + { + XMLSchema.documentation documentation = o as XMLSchema.documentation; + if (documentation.Any != null && documentation.Any.Length > 0) + { + string text = documentation.Any[0].Value; + text = text.Replace("\n", " "); + text = text.Replace("\t", " "); + text = text.Replace("\r", ""); + text = Regex.Replace(text, " +", " "); + text = text.Trim(); + + //text = text.Replace(, " "); + + //text = text.Trim('\n', '\t', '\r', ' '); + //string[] textLines = text.Split(new char[] { '\n' }); + //for (int i = 0; i < textLines.Length; i++) + // textLines[i] = textLines[i].Trim('\n', '\t', '\r', ' '); + //text = string.Join("\r\n", textLines); + this.textBoxAnnotation.Text = text; + this.textBoxAnnotation.Visible = true; + if (this.webBrowserDocumentation != null) + this.webBrowserDocumentation.Visible = false; + } + else if (documentation.source != null) + { + if (this.webBrowserDocumentation != null) + { + this.textBoxAnnotation.Visible = false; + this.webBrowserDocumentation.Visible = true; + this.webBrowserDocumentation.Navigate(documentation.source); + } + else + { + this.textBoxAnnotation.Text = documentation.source; + this.textBoxAnnotation.Visible = true; + } + } + break; + } + } + } + + private void listViewAttributes_SelectedIndexChanged(object sender, EventArgs e) + { + if (this.listViewAttributes.SelectedItems.Count > 0) + { + XSDAttribute xsdAttribute = this.listViewAttributes.SelectedItems[0].Tag as XSDAttribute; + XMLSchema.attribute attribute = xsdAttribute.Tag; + if (attribute != null && attribute.annotation != null) + ShowDocumentation(attribute.annotation); + else + ShowDocumentation(null); + ShowEnumerate(attribute); + } + } + + private void toolStripComboBoxZoom_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + string zoomString = this.toolStripComboBoxZoom.SelectedItem as string; + zoomString = zoomString.Replace("%", ""); + + float zoom = (float)int.Parse(zoomString) / 100.0f; + if (zoom >= 0.10 && zoom <= 10) + { + //Point virtualCenter = this.panelDiagram.VirtualPoint; + //virtualCenter.Offset(this.panelDiagram.DiagramControl.Width / 2, this.panelDiagram.DiagramControl.Height / 2); + //Size oldSize = this.panelDiagram.VirtualSize; + //this.diagram.Scale = zoom; + //UpdateDiagram(); + //Size newSize = this.panelDiagram.VirtualSize; + //virtualCenter.X = (int)((float)newSize.Width / (float)oldSize.Width * (float)virtualCenter.X); + //virtualCenter.Y = (int)((float)newSize.Height / (float)oldSize.Height * (float)virtualCenter.Y); + //if (virtualCenter.X > this.diagram.BoundingBox.Right) + // virtualCenter.X = this.diagram.BoundingBox.Right; + //if (virtualCenter.Y > this.diagram.BoundingBox.Bottom) + // virtualCenter.Y = this.diagram.BoundingBox.Bottom; + //this.panelDiagram.ScrollTo(virtualCenter, true); + + Point virtualCenter = this.panelDiagram.VirtualPoint; + virtualCenter.Offset(this.panelDiagram.DiagramControl.Width / 2, this.panelDiagram.DiagramControl.Height / 2); + Size oldSize = this.panelDiagram.VirtualSize; + this.diagram.Scale = zoom; + UpdateDiagram(); + Size newSize = this.panelDiagram.VirtualSize; + Point newVirtualCenter = new Point(); + newVirtualCenter.X = (int)((float)newSize.Width / (float)oldSize.Width * (float)virtualCenter.X); + newVirtualCenter.Y = (int)((float)newSize.Height / (float)oldSize.Height * (float)virtualCenter.Y); + if (newVirtualCenter.X > this.diagram.BoundingBox.Right) + newVirtualCenter.X = this.diagram.BoundingBox.Right; + if (newVirtualCenter.Y > this.diagram.BoundingBox.Bottom) + newVirtualCenter.Y = this.diagram.BoundingBox.Bottom; + this.panelDiagram.ScrollTo(newVirtualCenter, true); + } + } + catch { } + } + + private void toolStripComboBoxZoom_TextChanged(object sender, EventArgs e) + { + //try + //{ + // string zoomString = this.toolStripComboBoxZoom.SelectedItem as string; + // zoomString = zoomString.Replace("%", ""); + + // float zoom = (float)int.Parse(zoomString) / 100.0f; + // if (zoom >= 0.10 && zoom <= 10) + // { + // this.diagram.Scale = zoom; + // UpdateDiagram(); + // } + //} + //catch { } + } + + void DiagramControl_MouseWheel(object sender, MouseEventArgs e) + { + if ((ModifierKeys & Keys.Control) == Keys.Control) + { + if (e.Delta > 0) + { + if (this.toolStripComboBoxZoom.SelectedIndex < this.toolStripComboBoxZoom.Items.Count - 1) + this.toolStripComboBoxZoom.SelectedIndex++; + } + else + { + if (this.toolStripComboBoxZoom.SelectedIndex > 0) + this.toolStripComboBoxZoom.SelectedIndex--; + } + } + } + + private void pageToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (_diagramPrinter == null) + { + _diagramPrinter = new DiagramPrinter(); + } + _diagramPrinter.Diagram = diagram; + + _diagramPrinter.PageSetup(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (_diagramPrinter == null) + { + _diagramPrinter = new DiagramPrinter(); + } + _diagramPrinter.Diagram = diagram; + + _diagramPrinter.PrintPreview(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + private void printToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (_diagramPrinter == null) + { + _diagramPrinter = new DiagramPrinter(); + } + _diagramPrinter.Diagram = diagram; + + _diagramPrinter.Print(true, Options.IsRunningOnMono); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + private void toolStripButtonTogglePanel_Click(object sender, EventArgs e) + { + this.splitContainerMain.Panel2Collapsed = !this.toolStripButtonTogglePanel.Checked; + } + + private void contextMenuStripDiagram_Opened(object sender, EventArgs e) + { + this.gotoXSDFileToolStripMenuItem.Enabled = false; + this.removeFromDiagramToolStripMenuItem.Enabled = false; + + Point contextualMenuMousePosition = this.panelDiagram.DiagramControl.PointToClient(MousePosition); + contextualMenuMousePosition.Offset(this.panelDiagram.VirtualPoint); + DiagramItem resultElement; + DiagramHitTestRegion resultRegion; + this.diagram.HitTest(contextualMenuMousePosition, out resultElement, out resultRegion); + if (resultRegion != DiagramHitTestRegion.None) + { + if (resultRegion == DiagramHitTestRegion.Element) // && resultElement.Parent == null) + { + this.contextualMenuPointedElement = resultElement; + this.gotoXSDFileToolStripMenuItem.Enabled = this.schema.ElementsByName.ContainsKey(this.contextualMenuPointedElement.FullName); + this.removeFromDiagramToolStripMenuItem.Enabled = true; + } + } + } + + private void gotoXSDFileToolStripMenuItem_Click(object sender, EventArgs e) + { + if (this.contextualMenuPointedElement != null) + { + //XSDObject xsdObject = this.schema.ElementsByName[this.contextualMenuPointedElement.FullName] as XSDObject; + //if (xsdObject != null) + XSDObject xsdObject; + if (this.schema.ElementsByName.TryGetValue(this.contextualMenuPointedElement.FullName, out xsdObject) && xsdObject != null) { TabPage tabPage = null; - if (this.hashtableTabPageByFilename.TryGetValue(xsdObject.Filename, out tabPage) && tabPage != null) - this.tabControlView.SelectedTab = tabPage; - } - } - this.contextualMenuPointedElement = null; - } - - private void removeFromDiagramToolStripMenuItem_Click(object sender, EventArgs e) - { - if (this.contextualMenuPointedElement != null) - { - DiagramItem parentDiagram = this.contextualMenuPointedElement.Parent; - this.diagram.Remove(this.contextualMenuPointedElement); - UpdateDiagram(); - if (parentDiagram != null) - this.panelDiagram.ScrollTo(this.diagram.ScalePoint(parentDiagram.Location), true); - else - this.panelDiagram.ScrollTo(new Point(0, 0)); - } - this.contextualMenuPointedElement = null; - } - - private void tabControlView_Selected(object sender, TabControlEventArgs e) - { - if (tabControlView.SelectedTab.Tag != null) - { - WebBrowser webBrowser = tabControlView.SelectedTab.Controls[0] as WebBrowser; - if (webBrowser != null) - { - string url = tabControlView.SelectedTab.Tag as string; - //if (webBrowser.Url == null || webBrowser.Url != new Uri(url)) - if (webBrowser.Document == null) - webBrowser.Navigate(url); - webBrowser.Select(); - } - else - { - TextBox textBrowser = tabControlView.SelectedTab.Controls[0] as TextBox; - if (textBrowser != null) - { - string url = tabControlView.SelectedTab.Tag as string; - if (string.IsNullOrEmpty(textBrowser.Text)) - { - try - { - //HttpWebRequest webRequestObject = (HttpWebRequest)WebRequest.Create(url); - ////WebRequestObject.UserAgent = ".NET Framework/2.0"; - ////WebRequestObject.Referer = "http://www.example.com/"; - //WebResponse response = webRequestObject.GetResponse(); - //Stream webStream = response.GetResponseStream(); - //StreamReader reader = new StreamReader(webStream); - //textBrowser.Text = reader.ReadToEnd(); - //reader.Close(); - //webStream.Close(); - //response.Close(); - - WebClient client = new WebClient(); - client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); - Stream data = client.OpenRead(url); - StreamReader reader = new StreamReader(data); - textBrowser.Text = reader.ReadToEnd().Replace("\r\n", "\n").Replace("\n", "\r\n"); - data.Close(); - reader.Close(); - } - catch (Exception ex) - { - textBrowser.Text = ex.Message; - } - } - textBrowser.Select(); - } - } - } - } - - private void tabControlView_Click(object sender, EventArgs e) - { - if (tabControlView.SelectedTab.Tag != null) - { - Control webBrowser = tabControlView.SelectedTab.Controls[0] as Control; - if (webBrowser != null) - webBrowser.Select(); - } - } - - private void tabControlView_Enter(object sender, EventArgs e) - { - if (tabControlView.SelectedTab != null && tabControlView.SelectedTab.Tag != null) - { - Control webBrowser = tabControlView.SelectedTab.Controls[0] as Control; - if (webBrowser != null) - webBrowser.Focus(); - } - else - this.panelDiagram.Focus(); - } - - private void registerToolStripMenuItem_Click(object sender, EventArgs e) - { - FileShellExtension.Register(Microsoft.Win32.Registry.GetValue("HKEY_CLASSES_ROOT\\.xsd", null, "xsdfile") as string, "XSDDiagram", "XSD Diagram", string.Format("\"{0}\" \"%L\"", Application.ExecutablePath)); - } - - private void unregisterToolStripMenuItem_Click(object sender, EventArgs e) - { - FileShellExtension.Unregister(Microsoft.Win32.Registry.GetValue("HKEY_CLASSES_ROOT\\.xsd", null, "xsdfile") as string, "XSDDiagram"); - } - - private void toolStripButtonShowReferenceBoundingBox_Click(object sender, EventArgs e) - { - this.diagram.ShowBoundingBox = this.toolStripButtonShowReferenceBoundingBox.Checked; - UpdateDiagram(); - } - - private void toolStripComboBoxAlignement_SelectedIndexChanged(object sender, EventArgs e) - { - switch (this.toolStripComboBoxAlignement.SelectedItem as string) - { - case "Top": this.diagram.Alignement = DiagramAlignement.Near; break; - case "Center": this.diagram.Alignement = DiagramAlignement.Center; break; - case "Bottom": this.diagram.Alignement = DiagramAlignement.Far; break; - } - UpdateDiagram(); - } - - void diagram_RequestAnyElement(DiagramItem diagramElement, out XMLSchema.element element, out string nameSpace) - { - element = null; - nameSpace = ""; - - //ElementsForm elementsForm = new ElementsForm(); - //elementsForm.Location = MousePosition; //diagramElement.Location //MousePosition; - //elementsForm.ListBoxElements.Items.Clear(); - //elementsForm.ListBoxElements.Items.Insert(0, "(Cancel)"); - //foreach (XSDObject xsdObject in this.schema.ElementsByName.Values) - // if (xsdObject != null && xsdObject.Type == "element") - // elementsForm.ListBoxElements.Items.Add(xsdObject); - //if (elementsForm.ShowDialog(this.diagramControl) == DialogResult.OK && (elementsForm.ListBoxElements.SelectedItem as XSDObject) != null) - //{ - // XSDObject xsdObject = elementsForm.ListBoxElements.SelectedItem as XSDObject; - // element = xsdObject.Tag as XMLSchema.element; - // nameSpace = xsdObject.NameSpace; - //} - } - - private void listViewElement_Click(object sender, EventArgs e) - { - if (this.listViewElements.SelectedItems.Count > 0) - SelectSchemaElement(this.listViewElements.SelectedItems[0].Tag as XSDObject); - } - - private void listViewElement_DoubleClick(object sender, EventArgs e) - { - if (this.listViewElements.SelectedItems.Count > 0) - { - foreach (ListViewItem lvi in this.listViewElements.SelectedItems) - { - XSDObject xsdObject = lvi.Tag as XSDObject; - this.diagram.Add(xsdObject.Tag as XMLSchema.openAttrs, xsdObject.NameSpace); - //switch (xsdObject.Type) - //{ - // case "element": - // this.diagram.AddElement(xsdObject.Tag as XMLSchema.element, xsdObject.NameSpace); - // break; - // case "group": - // this.diagram.AddCompositors(xsdObject.Tag as XMLSchema.group, xsdObject.NameSpace); - // break; - // case "complexType": - // this.diagram.AddComplexType(xsdObject.Tag as XMLSchema.complexType, xsdObject.NameSpace); - // break; - // case "simpleType": - // this.diagram.Add(xsdObject.Tag as XMLSchema.simpleType, xsdObject.NameSpace); - // break; - //} - } - UpdateDiagram(); - } - } - - private void expandOneLevelToolStripMenuItem_Click(object sender, EventArgs e) - { - this.diagram.ExpandOneLevel(); - UpdateDiagram(); - } - - // Implements the manual sorting of items by columns. - class ListViewItemComparer : IComparer - { - private int column; - private ListView listView; - public ListViewItemComparer(int column, ListView listView) - { - this.column = column; - this.listView = listView; - - switch (this.listView.Sorting) - { - case SortOrder.None: this.listView.Sorting = SortOrder.Ascending; break; - case SortOrder.Ascending: this.listView.Sorting = SortOrder.Descending; break; - case SortOrder.Descending: this.listView.Sorting = SortOrder.Ascending; break; - } - } - public int Compare(object x, object y) - { - int result = 0; - if (this.listView.Sorting == SortOrder.Ascending) - result = String.Compare(((ListViewItem)x).SubItems[this.column].Text, ((ListViewItem)y).SubItems[column].Text); - if (this.listView.Sorting == SortOrder.Descending) - result = -String.Compare(((ListViewItem)x).SubItems[this.column].Text, ((ListViewItem)y).SubItems[column].Text); - - return result; - } - } - - private void listViewElement_ColumnClick(object sender, ColumnClickEventArgs e) - { - this.listViewElements.ListViewItemSorter = new ListViewItemComparer(e.Column, this.listViewElements); - } - - private void listViewAttributes_ColumnClick(object sender, ColumnClickEventArgs e) - { - this.listViewAttributes.ListViewItemSorter = new ListViewItemComparer(e.Column, this.listViewAttributes); - } - - private void toolStripButtonRemoveAllFromDiagram_Click(object sender, EventArgs e) - { - this.diagram.RemoveAll(); - UpdateDiagram(); - this.panelDiagram.VirtualPoint = new Point(0, 0); - this.panelDiagram.Clear(); - } - - private void listView_AfterLabelEdit(object sender, LabelEditEventArgs e) - { - e.CancelEdit = true; - } - - private void nextTabToolStripMenuItem_Click(object sender, EventArgs e) - { - int index = this.tabControlView.SelectedIndex; - ++index; - this.tabControlView.SelectedIndex = index % this.tabControlView.TabCount; - } - - private void previousTabToolStripMenuItem_Click(object sender, EventArgs e) - { - int index = this.tabControlView.SelectedIndex; - --index; - if (index < 0) index = this.tabControlView.TabCount - 1; - this.tabControlView.SelectedIndex = index; - } - - private void ListViewToString(ListView listView, bool selectedLineOnly) - { - string result = ""; - if (selectedLineOnly) - { - if (listView.SelectedItems.Count > 0) - { - foreach (ColumnHeader columnHeader in listView.Columns) - { - if (columnHeader.Index > 0) result += "\t"; - result += listView.SelectedItems[0].SubItems[columnHeader.Index].Text; - } - } - } - else - { - foreach (ListViewItem lvi in listView.Items) - { - foreach (ColumnHeader columnHeader in listView.Columns) - { - if (columnHeader.Index > 0) result += "\t"; - result += lvi.SubItems[columnHeader.Index].Text; - } - result += "\r\n"; - } - } - if (result.Length > 0) - Clipboard.SetText(result); - } - - private void toolStripMenuItemAttributesCopyLine_Click(object sender, EventArgs e) - { - ListViewToString(this.listViewAttributes, true); - } - - private void toolStripMenuItemAttributesCopyList_Click(object sender, EventArgs e) - { - ListViewToString(this.listViewAttributes, false); - } - - private void contextMenuStripAttributes_Opening(object sender, CancelEventArgs e) - { - this.toolStripMenuItemAttributesCopyLine.Enabled = (this.listViewAttributes.SelectedItems.Count == 1); - this.toolStripMenuItemAttributesCopyList.Enabled = (this.listViewAttributes.Items.Count > 0); - } - - private void toolStripMenuItemEnumerateCopyLine_Click(object sender, EventArgs e) - { - ListViewToString(this.listViewEnumerate, true); - } - - private void toolStripMenuItemEnumerateCopyList_Click(object sender, EventArgs e) - { - ListViewToString(this.listViewEnumerate, false); - } - - private void contextMenuStripEnumerate_Opening(object sender, CancelEventArgs e) - { - this.toolStripMenuItemEnumerateCopyLine.Enabled = (this.listViewEnumerate.SelectedItems.Count == 1); - this.toolStripMenuItemEnumerateCopyList.Enabled = (this.listViewEnumerate.Items.Count > 0); - } - - private void toolStripMenuItemElementsCopyLine_Click(object sender, EventArgs e) - { - ListViewToString(this.listViewElements, true); - } - - private void toolStripMenuItemElementsCopyList_Click(object sender, EventArgs e) - { - ListViewToString(this.listViewElements, false); - } - - private void contextMenuStripElements_Opening(object sender, CancelEventArgs e) - { - this.toolStripMenuItemElementsCopyLine.Enabled = (this.listViewElements.SelectedItems.Count == 1); - this.toolStripMenuItemElementsCopyList.Enabled = (this.listViewElements.Items.Count > 0); - } - - private void listViewElements_ItemDrag(object sender, ItemDragEventArgs e) - { - listViewElements.DoDragDrop(e.Item, DragDropEffects.Copy); - } - - private void panelDiagram_DragEnter(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(typeof(ListViewItem))) - { - ListViewItem lvi = e.Data.GetData(typeof(ListViewItem)) as ListViewItem; - if (lvi != null) - { - XSDObject xsdObject = lvi.Tag as XSDObject; - switch (xsdObject.Type) - { - case "element": - case "group": - case "complexType": - e.Effect = DragDropEffects.Copy; - break; - } - } - } - else if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.Move; - } - - private void panelDiagram_DragDrop(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(typeof(ListViewItem))) - { - ListViewItem lvi = e.Data.GetData(typeof(ListViewItem)) as ListViewItem; - if (lvi != null) - { - listViewElement_DoubleClick(sender, e); - } - } - else if (e.Data.GetDataPresent(DataFormats.FileDrop)) - MainForm_DragDrop(sender, e); - } - - void DiagramControl_MouseMove(object sender, MouseEventArgs e) - { - //toolTip.Show("Coucou", panelDiagram.DiagramControl, 200); - } - - void DiagramControl_MouseHover(object sender, EventArgs e) - { - } - - //private void toolTip_Popup(object sender, PopupEventArgs e) - //{ - // //toolTip.SetToolTip(e.AssociatedControl, "AAAAAAAAAA"); - //} - - private void toolTip_Draw(object sender, DrawToolTipEventArgs e) - { - Point diagramMousePosition = e.AssociatedControl.PointToClient(MousePosition); - string text = string.Format("AAAA {0} {1}\nA Que\n\nCoucou", diagramMousePosition.X, diagramMousePosition.Y); - - Size textSize = TextRenderer.MeasureText(text, e.Font); - Rectangle newBound = new Rectangle(e.Bounds.X + 20, e.Bounds.Y - 20, textSize.Width + 10, textSize.Height + 10); - - DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, - e.AssociatedWindow, e.AssociatedControl, newBound, text, - this.BackColor, this.ForeColor, e.Font); - newArgs.DrawBackground(); - newArgs.DrawBorder(); - newArgs.DrawText(TextFormatFlags.TextBoxControl); - - //e.DrawBackground(); - //e.DrawBorder(); - //using (StringFormat sf = new StringFormat()) - //{ - // sf.Alignment = StringAlignment.Center; - // sf.LineAlignment = StringAlignment.Center; - // sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; - // sf.FormatFlags = StringFormatFlags.NoWrap; - // using (Font f = new Font("Tahoma", 9)) - // { - // e.Graphics.DrawString(text, f, - // SystemBrushes.ActiveCaptionText, e.Bounds, sf); - // } - //} - //e.DrawText(); - } - - private void validateXMLFileToolStripMenuItem_Click(object sender, EventArgs e) - { - OpenFileDialog openFileDialog = new OpenFileDialog(); - openFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; - openFileDialog.FilterIndex = 2; - openFileDialog.RestoreDirectory = true; - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - try - { - Cursor = Cursors.WaitCursor; - - validationErrorMessages.Clear(); - - StreamReader streamReader = new StreamReader(openFileDialog.FileName); - string xmlSource = streamReader.ReadToEnd(); - streamReader.Close(); - - //XmlDocument x = new XmlDocument(); - //x.LoadXml(xmlSource); - - XmlReaderSettings settings = new XmlReaderSettings(); - settings.CloseInput = true; - settings.ValidationType = ValidationType.Schema; - settings.ProhibitDtd = false; - settings.XmlResolver = null; - settings.ValidationEventHandler += new ValidationEventHandler(ValidationHandler); - settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings | - XmlSchemaValidationFlags.ProcessIdentityConstraints | - XmlSchemaValidationFlags.ProcessInlineSchema | - XmlSchemaValidationFlags.ProcessSchemaLocation - ; //| XmlSchemaValidationFlags.AllowXmlAttributes; - //settings.Schemas.Add("http://www.collada.org/2005/11/COLLADASchema", currentLoadedSchemaFilename); - //settings.Schemas.Add(null, currentLoadedSchemaFilename); // = sc; - List schemas = new List(schema.XsdFilenames); - schemas.Reverse(); - foreach (string schemaFilename in schemas) - { - try - { - settings.Schemas.Add(null, schemaFilename); - } - catch (Exception ex) - { - validationErrorMessages.Add(string.Format("Error while parsing {0}, Message: {1}", - schemaFilename, ex.Message)); - } - } - - StringReader r = new StringReader(xmlSource); - using (XmlReader validatingReader = XmlReader.Create(r, settings)) - { - while (validatingReader.Read()) { /* just loop through document */ } - } - - Cursor = Cursors.Default; - - ErrorReportForm errorReportForm = new ErrorReportForm(); - errorReportForm.Errors = validationErrorMessages; - errorReportForm.ShowDialog(this); - } - catch (Exception ex) - { - Cursor = Cursors.Default; - - validationErrorMessages.Add(string.Format("Error while validating {0}, Message: {1}", - openFileDialog.FileName, ex.Message)); - //MessageBox.Show("Cannot validate: " + ex.Message); - ErrorReportForm errorReportForm = new ErrorReportForm(); - errorReportForm.Errors = validationErrorMessages; - errorReportForm.ShowDialog(this); - } - Cursor = Cursors.Default; - - if (validationErrorMessages.Count == 0) - MessageBox.Show("No issue found"); - } - } - - static List validationErrorMessages = new List(); - - public static void ValidationHandler(object sender, ValidationEventArgs e) - { - //if (e.Severity == XmlSeverityType.Error || e.Severity == XmlSeverityType.Warning) - validationErrorMessages.Add(string.Format("{4}: [{3}] Line: {0}, Position: {1} \"{2}\"", - e.Exception.LineNumber, e.Exception.LinePosition, e.Exception.Message, validationErrorMessages.Count, e.Severity)); - } - - private void toolsToolStripMenuItem_DropDownOpening(object sender, EventArgs e) - { - validateXMLFileToolStripMenuItem.Enabled = (schema != null && schema.XsdFilenames.Count != 0); - } - - //void DiagramControl_MouseMove(object sender, MouseEventArgs e) - //{ - //System.Diagnostics.Trace.WriteLine("toolTipDiagramElement_Popup"); - //Point contextualMenuMousePosition = this.panelDiagram.DiagramControl.PointToClient(MousePosition); - //contextualMenuMousePosition.Offset(this.panelDiagram.VirtualPoint); - //DiagramBase resultElement; - //DiagramBase.HitTestRegion resultRegion; - //this.diagram.HitTest(contextualMenuMousePosition, out resultElement, out resultRegion); - //if (resultRegion != DiagramBase.HitTestRegion.None) - //{ - // if (resultRegion == DiagramBase.HitTestRegion.Element) // && resultElement.Parent == null) - // { - // //this.contextualMenuPointedElement = resultElement; - // //toolTipDiagramElement.SetToolTip(this.panelDiagram.DiagramControl, "coucou"); - // e.Cancel = true; - // toolTipElement.Show("Coucou", this); - // } - //} - //} - } + if (this.hashtableTabPageByFilename.TryGetValue(xsdObject.Filename, out tabPage) && tabPage != null) + this.tabControlView.SelectedTab = tabPage; + } + } + this.contextualMenuPointedElement = null; + } + + private void removeFromDiagramToolStripMenuItem_Click(object sender, EventArgs e) + { + if (this.contextualMenuPointedElement != null) + { + DiagramItem parentDiagram = this.contextualMenuPointedElement.Parent; + this.diagram.Remove(this.contextualMenuPointedElement); + UpdateDiagram(); + if (parentDiagram != null) + this.panelDiagram.ScrollTo(this.diagram.ScalePoint(parentDiagram.Location), true); + else + this.panelDiagram.ScrollTo(new Point(0, 0)); + } + this.contextualMenuPointedElement = null; + } + + private void tabControlView_Selected(object sender, TabControlEventArgs e) + { + if (tabControlView.SelectedTab.Tag != null) + { + WebBrowser webBrowser = tabControlView.SelectedTab.Controls[0] as WebBrowser; + if (webBrowser != null) + { + string url = tabControlView.SelectedTab.Tag as string; + //if (webBrowser.Url == null || webBrowser.Url != new Uri(url)) + if (webBrowser.Document == null) + webBrowser.Navigate(url); + webBrowser.Select(); + } + else + { + TextBox textBrowser = tabControlView.SelectedTab.Controls[0] as TextBox; + if (textBrowser != null) + { + string url = tabControlView.SelectedTab.Tag as string; + if (string.IsNullOrEmpty(textBrowser.Text)) + { + try + { + //HttpWebRequest webRequestObject = (HttpWebRequest)WebRequest.Create(url); + ////WebRequestObject.UserAgent = ".NET Framework/2.0"; + ////WebRequestObject.Referer = "http://www.example.com/"; + //WebResponse response = webRequestObject.GetResponse(); + //Stream webStream = response.GetResponseStream(); + //StreamReader reader = new StreamReader(webStream); + //textBrowser.Text = reader.ReadToEnd(); + //reader.Close(); + //webStream.Close(); + //response.Close(); + + WebClient client = new WebClient(); + client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); + Stream data = client.OpenRead(url); + StreamReader reader = new StreamReader(data); + textBrowser.Text = reader.ReadToEnd().Replace("\r\n", "\n").Replace("\n", "\r\n"); + data.Close(); + reader.Close(); + } + catch (Exception ex) + { + textBrowser.Text = ex.Message; + } + } + textBrowser.Select(); + } + } + } + } + + private void tabControlView_Click(object sender, EventArgs e) + { + if (tabControlView.SelectedTab.Tag != null) + { + Control webBrowser = tabControlView.SelectedTab.Controls[0] as Control; + if (webBrowser != null) + webBrowser.Select(); + } + } + + private void tabControlView_Enter(object sender, EventArgs e) + { + if (tabControlView.SelectedTab != null && tabControlView.SelectedTab.Tag != null) + { + Control webBrowser = tabControlView.SelectedTab.Controls[0] as Control; + if (webBrowser != null) + webBrowser.Focus(); + } + else + this.panelDiagram.Focus(); + } + + private void registerToolStripMenuItem_Click(object sender, EventArgs e) + { + FileShellExtension.Register(Microsoft.Win32.Registry.GetValue("HKEY_CLASSES_ROOT\\.xsd", null, "xsdfile") as string, "XSDDiagram", "XSD Diagram", string.Format("\"{0}\" \"%L\"", Application.ExecutablePath)); + } + + private void unregisterToolStripMenuItem_Click(object sender, EventArgs e) + { + FileShellExtension.Unregister(Microsoft.Win32.Registry.GetValue("HKEY_CLASSES_ROOT\\.xsd", null, "xsdfile") as string, "XSDDiagram"); + } + + private void toolStripButtonShowReferenceBoundingBox_Click(object sender, EventArgs e) + { + this.diagram.ShowBoundingBox = this.toolStripButtonShowReferenceBoundingBox.Checked; + UpdateDiagram(); + } + + private void toolStripComboBoxAlignement_SelectedIndexChanged(object sender, EventArgs e) + { + switch (this.toolStripComboBoxAlignement.SelectedItem as string) + { + case "Top": this.diagram.Alignement = DiagramAlignement.Near; break; + case "Center": this.diagram.Alignement = DiagramAlignement.Center; break; + case "Bottom": this.diagram.Alignement = DiagramAlignement.Far; break; + } + UpdateDiagram(); + } + + void diagram_RequestAnyElement(DiagramItem diagramElement, out XMLSchema.element element, out string nameSpace) + { + element = null; + nameSpace = ""; + + //ElementsForm elementsForm = new ElementsForm(); + //elementsForm.Location = MousePosition; //diagramElement.Location //MousePosition; + //elementsForm.ListBoxElements.Items.Clear(); + //elementsForm.ListBoxElements.Items.Insert(0, "(Cancel)"); + //foreach (XSDObject xsdObject in this.schema.ElementsByName.Values) + // if (xsdObject != null && xsdObject.Type == "element") + // elementsForm.ListBoxElements.Items.Add(xsdObject); + //if (elementsForm.ShowDialog(this.diagramControl) == DialogResult.OK && (elementsForm.ListBoxElements.SelectedItem as XSDObject) != null) + //{ + // XSDObject xsdObject = elementsForm.ListBoxElements.SelectedItem as XSDObject; + // element = xsdObject.Tag as XMLSchema.element; + // nameSpace = xsdObject.NameSpace; + //} + } + + private void listViewElement_Click(object sender, EventArgs e) + { + if (this.listViewElements.SelectedItems.Count > 0) + SelectSchemaElement(this.listViewElements.SelectedItems[0].Tag as XSDObject); + } + + private void listViewElement_DoubleClick(object sender, EventArgs e) + { + if (this.listViewElements.SelectedItems.Count > 0) + { + foreach (ListViewItem lvi in this.listViewElements.SelectedItems) + { + XSDObject xsdObject = lvi.Tag as XSDObject; + this.diagram.Add(xsdObject.Tag as XMLSchema.openAttrs, xsdObject.NameSpace); + //switch (xsdObject.Type) + //{ + // case "element": + // this.diagram.AddElement(xsdObject.Tag as XMLSchema.element, xsdObject.NameSpace); + // break; + // case "group": + // this.diagram.AddCompositors(xsdObject.Tag as XMLSchema.group, xsdObject.NameSpace); + // break; + // case "complexType": + // this.diagram.AddComplexType(xsdObject.Tag as XMLSchema.complexType, xsdObject.NameSpace); + // break; + // case "simpleType": + // this.diagram.Add(xsdObject.Tag as XMLSchema.simpleType, xsdObject.NameSpace); + // break; + //} + } + UpdateDiagram(); + } + } + + private void expandOneLevelToolStripMenuItem_Click(object sender, EventArgs e) + { + this.diagram.ExpandOneLevel(); + UpdateDiagram(); + } + + // Implements the manual sorting of items by columns. + class ListViewItemComparer : IComparer + { + private int column; + private ListView listView; + public ListViewItemComparer(int column, ListView listView) + { + this.column = column; + this.listView = listView; + + switch (this.listView.Sorting) + { + case SortOrder.None: this.listView.Sorting = SortOrder.Ascending; break; + case SortOrder.Ascending: this.listView.Sorting = SortOrder.Descending; break; + case SortOrder.Descending: this.listView.Sorting = SortOrder.Ascending; break; + } + } + public int Compare(object x, object y) + { + int result = 0; + if (this.listView.Sorting == SortOrder.Ascending) + result = String.Compare(((ListViewItem)x).SubItems[this.column].Text, ((ListViewItem)y).SubItems[column].Text); + if (this.listView.Sorting == SortOrder.Descending) + result = -String.Compare(((ListViewItem)x).SubItems[this.column].Text, ((ListViewItem)y).SubItems[column].Text); + + return result; + } + } + + private void listViewElement_ColumnClick(object sender, ColumnClickEventArgs e) + { + this.listViewElements.ListViewItemSorter = new ListViewItemComparer(e.Column, this.listViewElements); + } + + private void listViewAttributes_ColumnClick(object sender, ColumnClickEventArgs e) + { + this.listViewAttributes.ListViewItemSorter = new ListViewItemComparer(e.Column, this.listViewAttributes); + } + + private void toolStripButtonRemoveAllFromDiagram_Click(object sender, EventArgs e) + { + this.diagram.RemoveAll(); + UpdateDiagram(); + this.panelDiagram.VirtualPoint = new Point(0, 0); + this.panelDiagram.Clear(); + } + + private void listView_AfterLabelEdit(object sender, LabelEditEventArgs e) + { + e.CancelEdit = true; + } + + private void nextTabToolStripMenuItem_Click(object sender, EventArgs e) + { + int index = this.tabControlView.SelectedIndex; + ++index; + this.tabControlView.SelectedIndex = index % this.tabControlView.TabCount; + } + + private void previousTabToolStripMenuItem_Click(object sender, EventArgs e) + { + int index = this.tabControlView.SelectedIndex; + --index; + if (index < 0) index = this.tabControlView.TabCount - 1; + this.tabControlView.SelectedIndex = index; + } + + private void ListViewToString(ListView listView, bool selectedLineOnly) + { + string result = ""; + if (selectedLineOnly) + { + if (listView.SelectedItems.Count > 0) + { + foreach (ColumnHeader columnHeader in listView.Columns) + { + if (columnHeader.Index > 0) result += "\t"; + result += listView.SelectedItems[0].SubItems[columnHeader.Index].Text; + } + } + } + else + { + foreach (ListViewItem lvi in listView.Items) + { + foreach (ColumnHeader columnHeader in listView.Columns) + { + if (columnHeader.Index > 0) result += "\t"; + result += lvi.SubItems[columnHeader.Index].Text; + } + result += "\r\n"; + } + } + if (result.Length > 0) + Clipboard.SetText(result); + } + + private void toolStripMenuItemAttributesCopyLine_Click(object sender, EventArgs e) + { + ListViewToString(this.listViewAttributes, true); + } + + private void toolStripMenuItemAttributesCopyList_Click(object sender, EventArgs e) + { + ListViewToString(this.listViewAttributes, false); + } + + private void contextMenuStripAttributes_Opening(object sender, CancelEventArgs e) + { + this.toolStripMenuItemAttributesCopyLine.Enabled = (this.listViewAttributes.SelectedItems.Count == 1); + this.toolStripMenuItemAttributesCopyList.Enabled = (this.listViewAttributes.Items.Count > 0); + } + + private void toolStripMenuItemEnumerateCopyLine_Click(object sender, EventArgs e) + { + ListViewToString(this.listViewEnumerate, true); + } + + private void toolStripMenuItemEnumerateCopyList_Click(object sender, EventArgs e) + { + ListViewToString(this.listViewEnumerate, false); + } + + private void contextMenuStripEnumerate_Opening(object sender, CancelEventArgs e) + { + this.toolStripMenuItemEnumerateCopyLine.Enabled = (this.listViewEnumerate.SelectedItems.Count == 1); + this.toolStripMenuItemEnumerateCopyList.Enabled = (this.listViewEnumerate.Items.Count > 0); + } + + private void toolStripMenuItemElementsCopyLine_Click(object sender, EventArgs e) + { + ListViewToString(this.listViewElements, true); + } + + private void toolStripMenuItemElementsCopyList_Click(object sender, EventArgs e) + { + ListViewToString(this.listViewElements, false); + } + + private void contextMenuStripElements_Opening(object sender, CancelEventArgs e) + { + this.toolStripMenuItemElementsCopyLine.Enabled = (this.listViewElements.SelectedItems.Count == 1); + this.toolStripMenuItemElementsCopyList.Enabled = (this.listViewElements.Items.Count > 0); + } + + private void listViewElements_ItemDrag(object sender, ItemDragEventArgs e) + { + listViewElements.DoDragDrop(e.Item, DragDropEffects.Copy); + } + + private void panelDiagram_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(typeof(ListViewItem))) + { + ListViewItem lvi = e.Data.GetData(typeof(ListViewItem)) as ListViewItem; + if (lvi != null) + { + XSDObject xsdObject = lvi.Tag as XSDObject; + switch (xsdObject.Type) + { + case "element": + case "group": + case "complexType": + e.Effect = DragDropEffects.Copy; + break; + } + } + } + else if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Move; + } + + private void panelDiagram_DragDrop(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(typeof(ListViewItem))) + { + ListViewItem lvi = e.Data.GetData(typeof(ListViewItem)) as ListViewItem; + if (lvi != null) + { + listViewElement_DoubleClick(sender, e); + } + } + else if (e.Data.GetDataPresent(DataFormats.FileDrop)) + MainForm_DragDrop(sender, e); + } + + void DiagramControl_MouseMove(object sender, MouseEventArgs e) + { + //toolTip.Show("Coucou", panelDiagram.DiagramControl, 200); + } + + void DiagramControl_MouseHover(object sender, EventArgs e) + { + } + + //private void toolTip_Popup(object sender, PopupEventArgs e) + //{ + // //toolTip.SetToolTip(e.AssociatedControl, "AAAAAAAAAA"); + //} + + private void toolTip_Draw(object sender, DrawToolTipEventArgs e) + { + Point diagramMousePosition = e.AssociatedControl.PointToClient(MousePosition); + string text = string.Format("AAAA {0} {1}\nA Que\n\nCoucou", diagramMousePosition.X, diagramMousePosition.Y); + + Size textSize = TextRenderer.MeasureText(text, e.Font); + Rectangle newBound = new Rectangle(e.Bounds.X + 20, e.Bounds.Y - 20, textSize.Width + 10, textSize.Height + 10); + + DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, + e.AssociatedWindow, e.AssociatedControl, newBound, text, + this.BackColor, this.ForeColor, e.Font); + newArgs.DrawBackground(); + newArgs.DrawBorder(); + newArgs.DrawText(TextFormatFlags.TextBoxControl); + + //e.DrawBackground(); + //e.DrawBorder(); + //using (StringFormat sf = new StringFormat()) + //{ + // sf.Alignment = StringAlignment.Center; + // sf.LineAlignment = StringAlignment.Center; + // sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; + // sf.FormatFlags = StringFormatFlags.NoWrap; + // using (Font f = new Font("Tahoma", 9)) + // { + // e.Graphics.DrawString(text, f, + // SystemBrushes.ActiveCaptionText, e.Bounds, sf); + // } + //} + //e.DrawText(); + } + + private void validateXMLFileToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; + openFileDialog.FilterIndex = 2; + openFileDialog.RestoreDirectory = true; + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + try + { + Cursor = Cursors.WaitCursor; + + validationErrorMessages.Clear(); + + StreamReader streamReader = new StreamReader(openFileDialog.FileName); + string xmlSource = streamReader.ReadToEnd(); + streamReader.Close(); + + //XmlDocument x = new XmlDocument(); + //x.LoadXml(xmlSource); + + XmlReaderSettings settings = new XmlReaderSettings(); + settings.CloseInput = true; + settings.ValidationType = ValidationType.Schema; + settings.ProhibitDtd = false; + settings.XmlResolver = null; + settings.ValidationEventHandler += new ValidationEventHandler(ValidationHandler); + settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings | + XmlSchemaValidationFlags.ProcessIdentityConstraints | + XmlSchemaValidationFlags.ProcessInlineSchema | + XmlSchemaValidationFlags.ProcessSchemaLocation + ; //| XmlSchemaValidationFlags.AllowXmlAttributes; + //settings.Schemas.Add("http://www.collada.org/2005/11/COLLADASchema", currentLoadedSchemaFilename); + //settings.Schemas.Add(null, currentLoadedSchemaFilename); // = sc; + List schemas = new List(schema.XsdFilenames); + schemas.Reverse(); + foreach (string schemaFilename in schemas) + { + try + { + settings.Schemas.Add(null, schemaFilename); + } + catch (Exception ex) + { + validationErrorMessages.Add(string.Format("Error while parsing {0}, Message: {1}", + schemaFilename, ex.Message)); + } + } + + StringReader r = new StringReader(xmlSource); + using (XmlReader validatingReader = XmlReader.Create(r, settings)) + { + while (validatingReader.Read()) { /* just loop through document */ } + } + + Cursor = Cursors.Default; + + ErrorReportForm errorReportForm = new ErrorReportForm(); + errorReportForm.Errors = validationErrorMessages; + errorReportForm.ShowDialog(this); + } + catch (Exception ex) + { + Cursor = Cursors.Default; + + validationErrorMessages.Add(string.Format("Error while validating {0}, Message: {1}", + openFileDialog.FileName, ex.Message)); + //MessageBox.Show("Cannot validate: " + ex.Message); + ErrorReportForm errorReportForm = new ErrorReportForm(); + errorReportForm.Errors = validationErrorMessages; + errorReportForm.ShowDialog(this); + } + Cursor = Cursors.Default; + + if (validationErrorMessages.Count == 0) + MessageBox.Show("No issue found"); + } + } + + static List validationErrorMessages = new List(); + + public static void ValidationHandler(object sender, ValidationEventArgs e) + { + //if (e.Severity == XmlSeverityType.Error || e.Severity == XmlSeverityType.Warning) + validationErrorMessages.Add(string.Format("{4}: [{3}] Line: {0}, Position: {1} \"{2}\"", + e.Exception.LineNumber, e.Exception.LinePosition, e.Exception.Message, validationErrorMessages.Count, e.Severity)); + } + + private void toolsToolStripMenuItem_DropDownOpening(object sender, EventArgs e) + { + validateXMLFileToolStripMenuItem.Enabled = (schema != null && schema.XsdFilenames.Count != 0); + } + + //void DiagramControl_MouseMove(object sender, MouseEventArgs e) + //{ + //System.Diagnostics.Trace.WriteLine("toolTipDiagramElement_Popup"); + //Point contextualMenuMousePosition = this.panelDiagram.DiagramControl.PointToClient(MousePosition); + //contextualMenuMousePosition.Offset(this.panelDiagram.VirtualPoint); + //DiagramBase resultElement; + //DiagramBase.HitTestRegion resultRegion; + //this.diagram.HitTest(contextualMenuMousePosition, out resultElement, out resultRegion); + //if (resultRegion != DiagramBase.HitTestRegion.None) + //{ + // if (resultRegion == DiagramBase.HitTestRegion.Element) // && resultElement.Parent == null) + // { + // //this.contextualMenuPointedElement = resultElement; + // //toolTipDiagramElement.SetToolTip(this.panelDiagram.DiagramControl, "coucou"); + // e.Cancel = true; + // toolTipElement.Show("Coucou", this); + // } + //} + //} + } } \ No newline at end of file diff --git a/Options.cs b/Options.cs index 915187b..ee191c6 100644 --- a/Options.cs +++ b/Options.cs @@ -33,6 +33,8 @@ namespace XSDDiagram public static bool ForceHugeImageGeneration { get; private set; } public static bool RequestHelp { get; private set; } public static bool IsRunningOnMono { get; private set; } + public static string Username { get; private set; } + public static string Password { get; private set; } static Options() { @@ -125,6 +127,16 @@ namespace XSDDiagram { ForceHugeImageGeneration = true; } + else if (string.Compare("-u", argument, true) == 0) + { + if (currentArgument < arguments.Count) + Username = args[currentArgument++]; + } + else if (string.Compare("-p", argument, true) == 0) + { + if (currentArgument < arguments.Count) + Password = args[currentArgument++]; + } else InputFile = argument; } diff --git a/Program.cs b/Program.cs index f436bf4..02dc91c 100644 --- a/Program.cs +++ b/Program.cs @@ -33,14 +33,14 @@ namespace XSDDiagram //static extern bool AllocConsole(); static string usage = @"XSD Diagram, version {0} -Usage: {1} [-o output.svg] [-so EXTENSION] [-r RootElement]* [-e N] [-z N] [file.xsd] +Usage: {1} [-o output.svg] [-os EXTENSION] [-r RootElement]* [-e N] [-z N] [-y] [-u USERNAME] [-p PASSWORD] [file.xsd] -o FILE - specifies the output image. Only '.svg' or '.png' are allowed. + specifies the output image. '.png','.jpg', '.svg' ('.emf' on Windows) are allowed. If not present, the GUI is shown. --so EXTENSION +-os EXTENSION specifies the output image is streamed through the standard - output. EXTENSION can be: png, jpg, svg or emf (emf on Windows only). + output. EXTENSION can be: png, jpg, svg. If not present, the GUI is shown. -r ELEMENT specifies the root element of the tree. @@ -51,14 +51,23 @@ Usage: {1} [-o output.svg] [-so EXTENSION] [-r RootElement]* [-e N] [-z N] [file -z N specifies the zoom percentage from 10% to 1000% (only for .png image). Work only with the '-o', '-os png' or '-os jpg' option. +-y + force huge image generation without user prompt. +-u USERNAME + specifies a username to authenticate when a xsd dependency + (import or include) is a secured url. +-p PASSWORD + specifies a password to authenticate when a xsd dependency + (import or include) is a secured url. + Example 1: -> XSDDiagram.exe -o file.png -r TotoRoot -e 3 -z 200 ./folder1/toto.xsd +> XSDDiagramConsole.exe -o file.png -r TotoRoot -e 3 -z 200 ./folder1/toto.xsd will generate a PNG image from a diagram with a root element 'TotoRoot' and expanding the tree from the root until the 3rd level. Example 2: -> XSDDiagramConsole.exe ./folder1/toto.xsd +> XSDDiagram.exe ./folder1/toto.xsd will load the xsd file in the GUI window. Example 3: @@ -67,7 +76,7 @@ Example 3: 'TotoRoot' and expanding the tree from the root until the 2nd level. Example 4: -> XSDDiagram.exe -os svg -r TotoRoot -e 3 ./folder1/toto.xsd +> XSDDiagramConsole.exe -os svg -r TotoRoot -e 3 ./folder1/toto.xsd will write a SVG image in the standard output from a diagram with a root element 'TotoRoot' and expanding the tree from the root until the 3rd level. "; @@ -99,6 +108,20 @@ Example 4: Log("Loading the file: {0}\n", Options.InputFile); Schema schema = new Schema(); + schema.RequestCredential += delegate(string url, string realm, int attemptCount, out string username, out string password) + { + username = password = ""; + if(!string.IsNullOrEmpty(Options.Username)) + { + if (attemptCount > 1) + return false; + username = Options.Username; + password = Options.Password; + return true; + } + return false; + }; + schema.LoadSchema(Options.InputFile); if (schema.LoadError.Count > 0) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 09f3ba1..31de84d 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.11.0.0")] -[assembly: AssemblyFileVersion("0.11.0.0")] +[assembly: AssemblyVersion("0.12.0.0")] +[assembly: AssemblyFileVersion("0.12.0.0")] diff --git a/ReadMe.txt b/ReadMe.txt index ec61d7d..b7adc75 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,182 +1,197 @@ -XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr). - -Version 0.12 Copyright (c) 2006-2012 Regis Cosnier, All Rights Reserved. - -This program is free software and may be distributed -according to the terms of the GNU General Public License (GPL). - - -FEATURES: - -- GPL (Part of the source code are dual licensed with LGPL and MS-PL) -- Need of the Microsoft Framework.NET 2.0 (if not already install) or Mono -- Display the elements, the groups and the attributes -- Show the text/HTML documentation of element and attribute when available -- Print the diagram -- Export the diagram to SVG, PNG, JPG and EMF (EMF only with Windows) -- Zoom the diagram with the mouse wheel while holding the control key -- XML validation based on the loaded XSD file -- Registration in the Windows Explorer contextual menu -- Drag'n drop a file from explorer -- Command line image generation - - -QUICK START: - -- Open an xsd file. -- The xsd file and all its dependencies files are loaded in tab pages. -- Either: - - Select a toplevel element in the toolbar (The first one is already selected). - - Push the add button to put the element on the diagram -- Or double click in the right panel list. -- Then, on the diagram element, click on the + box. - - -COMMAND LINE USAGE: - -> XSDDiagram.exe [-o output.svg] [-so EXTENSION] [-r RootElement]* [-e N] [-z N] [file.xsd] - -or on Windows use 'XSDDiagramConsole.exe' instead of 'XSDDiagram.exe' if you need the console: - -> XSDDiagramConsole.exe [-o output.svg] [-so EXTENSION] [-r RootElement]* [-e N] [-z N] [file.xsd] - -Options: - --o FILE - specifies the output image. Only '.svg' or '.png' are allowed. - If not present, the GUI is shown. --so EXTENSION - specifies the output image is streamed through the standard - output. EXTENSION can be: png, jpg or svg. - If not present, the GUI is shown. --r ELEMENT - specifies the root element of the tree. - You can put several -r options = several root elements in the tree. --e N - specifies the expand level (from 0 to what you want). - Be carefull, the result image can be huge. --z N - specifies the zoom percentage from 10% to 1000% (only for .png image). - Work only with the '-o', '-os png' or '-os jpg' option. --y - Force huge image generation without user prompt. - -Example 1: -> XSDDiagramConsole.exe -o file.png -r TotoRoot -e 3 -z 200 ./folder1/toto.xsd - will generate a PNG image from a diagram with a root element - 'TotoRoot' and expanding the tree from the root until the 3rd level. - -Example 2: -> XSDDiagram.exe ./folder1/toto.xsd - will load the xsd file in the GUI window. - -Example 3: -> XSDDiagram.exe -r TotoRoot -e 2 ./folder1/toto.xsd - will load the xsd file in the GUI window with a root element - 'TotoRoot' and expanding the tree from the root until the 2nd level. - -Example 4: -> XSDDiagramConsole.exe -os svg -r TotoRoot -e 3 ./folder1/toto.xsd - will write a SVG image in the standard output from a diagram with a root element - 'TotoRoot' and expanding the tree from the root until the 3rd level. - - - -TODO LIST: - -- Tooltips above the diagram element with a summary (xpath/attributes/doc) (display 200ms after the mouse move -> avoid 100 %CPU) - o The optional display of attributes inside the diagram -- Columns in the element/attributes tabs for restrictions (length/pattern/enumerations) -- Element selection in the diagram + move from one element to another with the arrow key -- Multi-selection (i.e.: to remove several element at once) -- Save the current UI state (open file/diagram/zoom/...) -- Download xsd by specifying an Url instead of loading it from the file system -- XML sample (skeleton) generation (the ability to generate random test XML files complying with the open schema) -- Download .dtd dependency file -- On Linux, the horizontal and vertical scrollbars don't appear correctly. - - -CHANGES: - -version 0.12 (2012-12-01) -- Accept all kind of https certificates when the xsd dependencies (import or include) point to a TLS/SSL url. -- Prompt the user to authenticate when the xsd dependencies (import or include) point toward a secured url. - -version 0.11 (2012-07-22) -- Remove the "Order" attributes in the source file XmlSchema.cs which are imcompatible with mono > 2.6! -- Add the option "-y" to force huge image generation without user prompt. -- Fix some hashtable to dictionary issues due to the previous refactoring. - -version 0.10 (2011-12-18) -- Refactor within a core library "XSDDiagrams.dll" under the LGPL/MS-PL license. -- Add the XSD Diagrams core library, thanks to Paul's refactoring ! -- Add the XML validation operation using the currently loaded XSD schema in the Tools menu. -- When the WebBrowser is not available, use a TextBox instead (For Mono without WebBrowser support). -- Mono version 2.10 does not work anymore with XML deserialization :-( - -version 0.9 (2011-05-17) -- Allow to expand restriction type (Thanks to Hermann). -- Fix an unicode issue with infinity character when building xsd diagram on linux. - -version 0.8 (2010-10-31) -- Add support for JPG. -- Add command line options to generate PNG, JPG or SVG image without the GUI window. - -version 0.7 (2010-07-14) -- Inversion of the mouse wheel direction to zoom -- Add the SVG diagram export -- Add the Tiago Daitx's code about the PNG diagram export -- Improve the diagram quality - -version 0.6 (2010-06-27) -- Fix the print function. -- Add as much as possible the support for Mono 2.6.3 on Linux. -- Fix the import/include opening on Linux. -- Fix the print font clipping bug on Linux. -- Fix the tab page selection corruption on Linux. -- On Linux, the export to EMF does not work because it seems the libgdiplus does not support this feature. - -version 0.5 (2008-11-11) -- The element panel has been added again. This is not very user friendly because this should not be editable. -- The contextual menu in element list has an entry: "Add to diagramm" + drag'n drop on the diagram. - -version 0.4 (2007-03-10) -- Add contextual menu in the panels to copy the list/selected line in the clipboard -- Displays enumerate type in a new panel -- The element panel has been removed -- The combobox must be wider or the same size as the widest element -- Fix an exception if no printer install when clicking on print setup/preview -- Fix an exception if selecting the attribute '*' in the XMLSchema.xsd schema file -- Fix a bug about bad simple content element displays -- Fix Ctrl+Tab that did not work in the browser view -- Fix some attributes not display -- Fix an exception on loading a dependent xml document -- Fix when selecting a browser view, the browser should have the focus -- Fix some zoom bound issues - -version 0.3 (2006-11-20) -- Allow to edit the attributes label in order to copy a label in the clipboard -- Put *.xsd as default load extension -- Put xpath (/) instead of chevrons in the path -- Add the abstract element support -- Zoom accuracy -- Fix some bugs (sequence/choice/group not always display in complexType) - -version 0.2 (2006-10-09) -- Automatic download of non local import -- Print per page -- Vast virtual scrolling diagram -- Top/Center/Bottom alignments -- Put chevrons in the path -- Fix some bugs (simple type and documentation space) - -version 0.1 (2006-09-14) -- First version - - -LICENSE: - -Copyright (c) 2006-2012 Regis COSNIER, All Rights Reserved. - -This program is free software and may be distributed -according to the terms of the GNU General Public License (GPL). +XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr). + +Version 0.14 Copyright (c) 2006-2012 Regis Cosnier, All Rights Reserved. + +This program is free software and may be distributed +according to the terms of the GNU General Public License (GPL). + + +FEATURES: + +- GPL (Part of the source code are dual licensed with LGPL and MS-PL) +- Need of the Microsoft Framework.NET 2.0 (if not already install) or Mono +- Display the elements, the groups and the attributes +- Show the text/HTML documentation of element and attribute when available +- Print the diagram +- Export the diagram to SVG, PNG, JPG and EMF (EMF only with Windows) +- Zoom the diagram with the mouse wheel while holding the control key +- XML validation based on the loaded XSD file +- Registration in the Windows Explorer contextual menu +- Drag'n drop a xsd file or url on the main window header +- Command line image generation + + +QUICK START: + +- Open an xsd file. +- The xsd file and all its dependencies files are loaded in tab pages. +- Either: + - Select a toplevel element in the toolbar (The first one is already selected). + - Push the add button to put the element on the diagram +- Or double click in the right panel list. +- Then, on the diagram element, click on the + box. + + +COMMAND LINE USAGE: + +> XSDDiagram.exe [-o output.svg] [-os EXTENSION] [-r RootElement]* [-e N] [-z N] [-y] [-u USERNAME] [-p PASSWORD] [file.xsd] + +or on Windows use 'XSDDiagramConsole.exe' instead of 'XSDDiagram.exe' if you need the console: + +> XSDDiagramConsole.exe [-o output.svg] [-os EXTENSION] [-r RootElement]* [-e N] [-z N] [-y] [-u USERNAME] [-p PASSWORD] [file.xsd] + +Options: + +-o FILE + specifies the output image. '.png','.jpg', '.svg' ('.emf' on Windows) are allowed. + If not present, the GUI is shown. +-os EXTENSION + specifies the output image is streamed through the standard + output. EXTENSION can be: png, jpg, svg. + If not present, the GUI is shown. +-r ELEMENT + specifies the root element of the tree. + You can put several -r options = several root elements in the tree. +-e N + specifies the expand level (from 0 to what you want). + Be carefull, the result image can be huge. +-z N + specifies the zoom percentage from 10% to 1000% (only for .png image). + Work only with the '-o', '-os png' or '-os jpg' option. +-y + force huge image generation without user prompt. +-u USERNAME + specifies a username to authenticate when a xsd dependency + (import or include) is a secured url. +-p PASSWORD + specifies a password to authenticate when a xsd dependency + (import or include) is a secured url. + + +Example 1: +> XSDDiagramConsole.exe -o file.png -r TotoRoot -e 3 -z 200 ./folder1/toto.xsd + will generate a PNG image from a diagram with a root element + 'TotoRoot' and expanding the tree from the root until the 3rd level. + +Example 2: +> XSDDiagram.exe ./folder1/toto.xsd + will load the xsd file in the GUI window. + +Example 3: +> XSDDiagram.exe -r TotoRoot -e 2 ./folder1/toto.xsd + will load the xsd file in the GUI window with a root element + 'TotoRoot' and expanding the tree from the root until the 2nd level. + +Example 4: +> XSDDiagramConsole.exe -os svg -r TotoRoot -e 3 ./folder1/toto.xsd + will write a SVG image in the standard output from a diagram with a root element + 'TotoRoot' and expanding the tree from the root until the 3rd level. + + +TODO LIST: + +- BUG: There is a bug when printing with margin! +- BUG: On Linux, the horizontal and vertical scrollbars don't appear correctly. +- Add the attributes to the element in the diagram (suggested by bob) +- Tooltips above the diagram element with a summary (xpath/attributes/doc) (display 200ms after the mouse move -> avoid 100 %CPU) + o The optional display of attributes inside the diagram +- Columns in the element/attributes tabs for restrictions (length/pattern/enumerations) +- Element selection in the diagram + move from one element to another with the arrow key +- Multi-selection (i.e.: to remove several element at once) +- Save the current UI state (open file/diagram/zoom/...) +- XML sample (skeleton) generation (the ability to generate random test XML files complying with the open schema) +- Download .dtd dependency file + + +CHANGES: + +version 0.14 (2012-12-01) +- Accept all kind of https certificates when the xsd dependencies (import or include) point to a TLS/SSL url. +- Prompt the user to authenticate when the xsd dependencies (import or include) point toward a secured url. +- Add the corresponding command line "-u USERNAME" and "-p PASSWORD" options to authenticate the url download. +- It is now possible to drag'n drop an url pointing to a xsd file on the main window. + +version 0.13 + +version 0.12 (2012-09-19) +- Improve the error message in case the image is too big to be generated. +- Some element (complex type derived from a restriction) could cause an exception. These element are now display but can not be expanded. + +version 0.11 (2012-07-22) +- Remove the "Order" attributes in the source file XmlSchema.cs which are imcompatible with mono > 2.6! +- Add the option "-y" to force huge image generation without user prompt. +- Fix some hashtable to dictionary issues due to the previous refactoring. + +version 0.10 (2011-12-18) +- Refactor within a core library "XSDDiagrams.dll" under the LGPL/MS-PL license. +- Add the XSD Diagrams core library, thanks to Paul's refactoring ! +- Add the XML validation operation using the currently loaded XSD schema in the Tools menu. +- When the WebBrowser is not available, use a TextBox instead (For Mono without WebBrowser support). +- Mono version 2.10 does not work anymore with XML deserialization :-( + +version 0.9 (2011-05-17) +- Allow to expand restriction type (Thanks to Hermann). +- Fix an unicode issue with infinity character when building xsd diagram on linux. + +version 0.8 (2010-10-31) +- Add support for JPG. +- Add command line options to generate PNG, JPG or SVG image without the GUI window. + +version 0.7 (2010-07-14) +- Inversion of the mouse wheel direction to zoom +- Add the SVG diagram export +- Add the Tiago Daitx's code about the PNG diagram export +- Improve the diagram quality + +version 0.6 (2010-06-27) +- Fix the print function. +- Add as much as possible the support for Mono 2.6.3 on Linux. +- Fix the import/include opening on Linux. +- Fix the print font clipping bug on Linux. +- Fix the tab page selection corruption on Linux. +- On Linux, the export to EMF does not work because it seems the libgdiplus does not support this feature. + +version 0.5 (2008-11-11) +- The element panel has been added again. This is not very user friendly because this should not be editable. +- The contextual menu in element list has an entry: "Add to diagramm" + drag'n drop on the diagram. + +version 0.4 (2007-03-10) +- Add contextual menu in the panels to copy the list/selected line in the clipboard +- Displays enumerate type in a new panel +- The element panel has been removed +- The combobox must be wider or the same size as the widest element +- Fix an exception if no printer install when clicking on print setup/preview +- Fix an exception if selecting the attribute '*' in the XMLSchema.xsd schema file +- Fix a bug about bad simple content element displays +- Fix Ctrl+Tab that did not work in the browser view +- Fix some attributes not display +- Fix an exception on loading a dependent xml document +- Fix when selecting a browser view, the browser should have the focus +- Fix some zoom bound issues + +version 0.3 (2006-11-20) +- Allow to edit the attributes label in order to copy a label in the clipboard +- Put *.xsd as default load extension +- Put xpath (/) instead of chevrons in the path +- Add the abstract element support +- Zoom accuracy +- Fix some bugs (sequence/choice/group not always display in complexType) + +version 0.2 (2006-10-09) +- Automatic download of non local import +- Print per page +- Vast virtual scrolling diagram +- Top/Center/Bottom alignments +- Put chevrons in the path +- Fix some bugs (simple type and documentation space) + +version 0.1 (2006-09-14) +- First version + + +LICENSE: + +Copyright (c) 2006-2012 Regis COSNIER, All Rights Reserved. + +This program is free software and may be distributed +according to the terms of the GNU General Public License (GPL). diff --git a/Tests/COLLADASchema_141.xsd b/Tests/COLLADASchema_141.xsd new file mode 100644 index 0000000..56e298c --- /dev/null +++ b/Tests/COLLADASchema_141.xsd @@ -0,0 +1,11046 @@ + + + + + + COLLADA Schema + Version 1.4.1 (June 23, 2006) + + Copyright (C) 2005, 2006 The Khronos Group Inc., Sony Computer Entertainment Inc. + All Rights Reserved. + + Khronos is a trademark of The Khronos Group Inc. + COLLADA is a trademark of Sony Computer Entertainment Inc. used by permission by Khronos. + + Note that this software document is distributed on an "AS IS" basis, with ALL EXPRESS AND + IMPLIED WARRANTIES AND CONDITIONS DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED + WARRANTIES AND CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR + PURPOSE, AND NON-INFRINGEMENT. + + + + + + + + enable-xmlns + + The COLLADA element declares the root of the document that comprises some of the content + in the COLLADA schema. + + + + + + + + The COLLADA element must contain an asset element. + + + + + + + + The COLLADA element may contain any number of library_animations elements. + + + + + + + The COLLADA element may contain any number of library_animation_clips elements. + + + + + + + The COLLADA element may contain any number of library_cameras elements. + + + + + + + The COLLADA element may contain any number of library_controllerss elements. + + + + + + + The COLLADA element may contain any number of library_geometriess elements. + + + + + + + The COLLADA element may contain any number of library_effects elements. + + + + + + + The COLLADA element may contain any number of library_force_fields elements. + + + + + + + The COLLADA element may contain any number of library_images elements. + + + + + + + The COLLADA element may contain any number of library_lights elements. + + + + + + + The COLLADA element may contain any number of library_materials elements. + + + + + + + The COLLADA element may contain any number of library_nodes elements. + + + + + + + The COLLADA element may contain any number of library_materials elements. + + + + + + + The COLLADA element may contain any number of library_physics_models elements. + + + + + + + The COLLADA element may contain any number of library_physics_scenes elements. + + + + + + + The COLLADA element may contain any number of library_visual_scenes elements. + + + + + + + + The scene embodies the entire set of information that can be visualized from the + contents of a COLLADA resource. The scene element declares the base of the scene + hierarchy or scene graph. The scene contains elements that comprise much of the + visual and transformational information content as created by the authoring tools. + + + + + + + + The instance_physics_scene element declares the instantiation of a COLLADA physics_scene resource. + The instance_physics_scene element may appear any number of times. + + + + + + + The instance_visual_scene element declares the instantiation of a COLLADA visual_scene resource. + The instance_visual_scene element may only appear once. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The version attribute is the COLLADA schema revision with which the instance document + conforms. Required Attribute. + + + + + + + The xml:base attribute allows you to define the base URI for this COLLADA document. See + http://www.w3.org/TR/xmlbase/ for more information. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An enumuerated type specifying the acceptable morph methods. + + + + + + + + + + + An enumerated type specifying the acceptable node types. + + + + + + + + + + + This type is used for URI reference which can only reference a resource declared within it's same document. + + + + + + + + + + An enumerated type specifying the acceptable up-axis values. + + + + + + + + + + + + An enumerated type specifying the acceptable document versions. + + + + + + + + + + + + The InputGlobal type is used to represent inputs that can reference external resources. + + + + + + The semantic attribute is the user-defined meaning of the input connection. Required attribute. + + + + + + + The source attribute indicates the location of the data source. Required attribute. + + + + + + + + The InputLocal type is used to represent inputs that can only reference resources declared in the same document. + + + + + + The semantic attribute is the user-defined meaning of the input connection. Required attribute. + + + + + + + The source attribute indicates the location of the data source. Required attribute. + + + + + + + + The InputLocalOffset type is used to represent indexed inputs that can only reference resources declared in the same document. + + + + + + The offset attribute represents the offset into the list of indices. If two input elements share + the same offset, they will be indexed the same. This works as a simple form of compression for the + list of indices as well as defining the order the inputs should be used in. Required attribute. + + + + + + + The semantic attribute is the user-defined meaning of the input connection. Required attribute. + + + + + + + The source attribute indicates the location of the data source. Required attribute. + + + + + + + The set attribute indicates which inputs should be grouped together as a single set. This is helpful + when multiple inputs share the same semantics. + + + + + + + + The InstanceWithExtra type is used for all generic instance elements. A generic instance element + is one which does not have any specific child elements declared. + + + + + + + The extra element may occur any number of times. + + + + + + + + The url attribute refers to resource to instantiate. This may refer to a local resource using a + relative URL fragment identifier that begins with the “#” character. The url attribute may refer + to an external resource using an absolute or relative URL. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + The TargetableFloat type is used to represent elements which contain a single float value which can + be targeted for animation. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + The TargetableFloat3 type is used to represent elements which contain a float3 value which can + be targeted for animation. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The IDREF_array element declares the storage for a homogenous array of ID reference values. + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of values in the array. Required attribute. + + + + + + + + + + + The Name_array element declares the storage for a homogenous array of Name string values. + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of values in the array. Required attribute. + + + + + + + + + + + The bool_array element declares the storage for a homogenous array of boolean values. + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of values in the array. Required attribute. + + + + + + + + + + + The float_array element declares the storage for a homogenous array of floating point values. + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of values in the array. Required attribute. + + + + + + + The digits attribute indicates the number of significant decimal digits of the float values that + can be contained in the array. The default value is 6. Optional attribute. + + + + + + + The magnitude attribute indicates the largest exponent of the float values that can be contained + in the array. The default value is 38. Optional attribute. + + + + + + + + + + + The int_array element declares the storage for a homogenous array of integer values. + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of values in the array. Required attribute. + + + + + + + The minInclusive attribute indicates the smallest integer value that can be contained in + the array. The default value is –2147483648. Optional attribute. + + + + + + + The maxInclusive attribute indicates the largest integer value that can be contained in + the array. The default value is 2147483647. Optional attribute. + + + + + + + + + + + + The accessor element declares an access pattern to one of the array elements: float_array, + int_array, Name_array, bool_array, and IDREF_array. The accessor element describes access + to arrays that are organized in either an interleaved or non-interleaved manner, depending + on the offset and stride attributes. + + + + + + + + The accessor element may have any number of param elements. + + + + + + + + The count attribute indicates the number of times the array is accessed. Required attribute. + + + + + + + The offset attribute indicates the index of the first value to be read from the array. + The default value is 0. Optional attribute. + + + + + + + The source attribute indicates the location of the array to access using a URL expression. Required attribute. + + + + + + + The stride attribute indicates number of values to be considered a unit during each access to + the array. The default value is 1, indicating that a single value is accessed. Optional attribute. + + + + + + + + + The param element declares parametric information regarding its parent element. + + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The semantic attribute is the user-defined meaning of the parameter. Optional attribute. + + + + + + + The type attribute indicates the type of the value data. This text string must be understood + by the application. Required attribute. + + + + + + + + + + + The source element declares a data repository that provides values according to the semantics of an + input element that refers to it. + + + + + + + + The source element may contain an asset element. + + + + + + + + The source element may contain an IDREF_array. + + + + + + + The source element may contain a Name_array. + + + + + + + The source element may contain a bool_array. + + + + + + + The source element may contain a float_array. + + + + + + + The source element may contain an int_array. + + + + + + + + The technique common specifies the common method for accessing this source element's data. + + + + + + + + The source's technique_common must have one and only one accessor. + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Required attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + Geometry describes the visual shape and appearance of an object in the scene. + The geometry element categorizes the declaration of geometric information. Geometry is a + branch of mathematics that deals with the measurement, properties, and relationships of + points, lines, angles, surfaces, and solids. + + + + + + + + The geometry element may contain an asset element. + + + + + + + + The geometry element may contain only one mesh or convex_mesh. + + + + + + + The geometry element may contain only one mesh or convex_mesh. + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The mesh element contains vertex and primitive information sufficient to describe basic geometric meshes. + + + + + + + + The mesh element must contain one or more source elements. + + + + + + + The mesh element must contain one vertices element. + + + + + + + + The mesh element may contain any number of lines elements. + + + + + + + The mesh element may contain any number of linestrips elements. + + + + + + + The mesh element may contain any number of polygons elements. + + + + + + + The mesh element may contain any number of polylist elements. + + + + + + + The mesh element may contain any number of triangles elements. + + + + + + + The mesh element may contain any number of trifans elements. + + + + + + + The mesh element may contain any number of tristrips elements. + + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The spline element contains control vertex information sufficient to describe basic splines. + + + + + + + + The mesh element must contain one or more source elements. + + + + + + The control vertices element must occur exactly one time. It is used to describe the CVs of the spline. + + + + + + + The input element must occur at least one time. These inputs are local inputs. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + + + + + The p element represents primitive data for the primitive types (lines, linestrips, polygons, + polylist, triangles, trifans, tristrips). The p element contains indices that reference into + the parent's source elements referenced by the input elements. + + + + + + + The lines element provides the information needed to bind vertex attributes together and then + organize those vertices into individual lines. Each line described by the mesh has two vertices. + The first line is formed from first and second vertices. The second line is formed from the + third and fourth vertices and so on. + + + + + + + + The input element may occur any number of times. This input is a local input with the offset + and set attributes. + + + + + + + The p element may occur once. + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of line primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material at + the time of instantiation. If the material attribute is not specified then the lighting and + shading results are application defined. Optional attribute. + + + + + + + + + The linestrips element provides the information needed to bind vertex attributes together and + then organize those vertices into connected line-strips. Each line-strip described by the mesh + has an arbitrary number of vertices. Each line segment within the line-strip is formed from the + current vertex and the preceding vertex. + + + + + + + + The input element may occur any number of times. This input is a local input with the offset + and set attributes. + + + + + + + The linestrips element may have any number of p elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of linestrip primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material + at the time of instantiation. If the material attribute is not specified then the lighting + and shading results are application defined. Optional attribute. + + + + + + + + + The polygons element provides the information needed to bind vertex attributes together and + then organize those vertices into individual polygons. The polygons described can contain + arbitrary numbers of vertices. These polygons may be self intersecting and may also contain holes. + + + + + + + + The input element may occur any number of times. This input is a local input with the + offset and set attributes. + + + + + + + + The p element may occur any number of times. + + + + + + + The ph element descripes a polygon with holes. + + + + + + + + Theere may only be one p element. + + + + + + + The h element represents a hole in the polygon specified. There must be at least one h element. + + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of polygon primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material + at the time of instantiation. If the material attribute is not specified then the lighting + and shading results are application defined. Optional attribute. + + + + + + + + + The polylist element provides the information needed to bind vertex attributes together and + then organize those vertices into individual polygons. The polygons described in polylist can + contain arbitrary numbers of vertices. Unlike the polygons element, the polylist element cannot + contain polygons with holes. + + + + + + + + The input element may occur any number of times. This input is a local input with the + offset and set attributes. + + + + + + + The vcount element contains a list of integers describing the number of sides for each polygon + described by the polylist element. The vcount element may occur once. + + + + + + + The p element may occur once. + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of polygon primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material at + the time of instantiation. If the material attribute is not specified then the lighting and + shading results are application defined. Optional attribute. + + + + + + + + + The triangles element provides the information needed to bind vertex attributes together and + then organize those vertices into individual triangles. Each triangle described by the mesh has + three vertices. The first triangle is formed from the first, second, and third vertices. The + second triangle is formed from the fourth, fifth, and sixth vertices, and so on. + + + + + + + + The input element may occur any number of times. This input is a local input with the + offset and set attributes. + + + + + + + The triangles element may have any number of p elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of triangle primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material at + the time of instantiation. Optional attribute. If the material attribute is not specified then + the lighting and shading results are application defined. + + + + + + + + + The trifans element provides the information needed to bind vertex attributes together and then + organize those vertices into connected triangles. Each triangle described by the mesh has three + vertices. The first triangle is formed from first, second, and third vertices. Each subsequent + triangle is formed from the current vertex, reusing the first and the previous vertices. + + + + + + + + The input element may occur any number of times. This input is a local input with the + offset and set attributes. + + + + + + + The trifans element may have any number of p elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of triangle fan primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material + at the time of instantiation. If the material attribute is not specified then the lighting + and shading results are application defined. Optional attribute. + + + + + + + + + The tristrips element provides the information needed to bind vertex attributes together and then + organize those vertices into connected triangles. Each triangle described by the mesh has three + vertices. The first triangle is formed from first, second, and third vertices. Each subsequent + triangle is formed from the current vertex, reusing the previous two vertices. + + + + + + + + The input element may occur any number of times. This input is a local input with the offset + and set attributes. + + + + + + + The tristrips element may have any number of p elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The count attribute indicates the number of triangle strip primitives. Required attribute. + + + + + + + The material attribute declares a symbol for a material. This symbol is bound to a material + at the time of instantiation. If the material attribute is not specified then the lighting + and shading results are application defined. Optional attribute. + + + + + + + + + The vertices element declares the attributes and identity of mesh-vertices. The vertices element + describes mesh-vertices in a mesh geometry. The mesh-vertices represent the position (identity) + of the vertices comprising the mesh and other vertex attributes that are invariant to tessellation. + + + + + + + + The input element must occur at least one time. These inputs are local inputs. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This + value must be unique within the instance document. Required attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + The lookat element contains a position and orientation transformation suitable for aiming a camera. + The lookat element contains three mathematical vectors within it that describe: + 1. The position of the object; + 2. The position of the interest point; + 3. The direction that points up. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + Matrix transformations embody mathematical changes to points within a coordinate systems or the + coordinate system itself. The matrix element contains a 4-by-4 matrix of floating-point values. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The rotate element contains an angle and a mathematical vector that represents the axis of rotation. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The scale element contains a mathematical vector that represents the relative proportions of the + X, Y and Z axes of a coordinated system. + + + + + + + The skew element contains an angle and two mathematical vectors that represent the axis of + rotation and the axis of translation. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The translate element contains a mathematical vector that represents the distance along the + X, Y and Z-axes. + + + + + + + + The image element declares the storage for the graphical representation of an object. + The image element best describes raster image data, but can conceivably handle other + forms of imagery. The image elements allows for specifying an external image file with + the init_from element or embed image data with the data element. + + + + + + + + The image element may contain an asset element. + + + + + + + + The data child element contains a sequence of hexadecimal encoded binary octets representing + the embedded image data. + + + + + + + The init_from element allows you to specify an external image file to use for the image element. + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The format attribute is a text string value that indicates the image format. Optional attribute. + + + + + + + The height attribute is an integer value that indicates the height of the image in pixel + units. Optional attribute. + + + + + + + The width attribute is an integer value that indicates the width of the image in pixel units. + Optional attribute. + + + + + + + The depth attribute is an integer value that indicates the depth of the image in pixel units. + A 2-D image has a depth of 1, which is also the default value. Optional attribute. + + + + + + + + + The light element declares a light source that illuminates the scene. + Light sources have many different properties and radiate light in many different patterns and + frequencies. + + + + + + + + The light element may contain an asset element. + + + + + + + The technique_common element specifies the light information for the common profile which all + COLLADA implementations need to support. + + + + + + + + The ambient element declares the parameters required to describe an ambient light source. + An ambient light is one that lights everything evenly, regardless of location or orientation. + + + + + + + + The color element contains three floating point numbers specifying the color of the light. + The color element must occur exactly once. + + + + + + + + + + The directional element declares the parameters required to describe a directional light source. + A directional light is one that lights everything from the same direction, regardless of location. + The light’s default direction vector in local coordinates is [0,0,-1], pointing down the -Z axis. + The actual direction of the light is defined by the transform of the node where the light is + instantiated. + + + + + + + + The color element contains three floating point numbers specifying the color of the light. + The color element must occur exactly once. + + + + + + + + + + The point element declares the parameters required to describe a point light source. A point light + source radiates light in all directions from a known location in space. The intensity of a point + light source is attenuated as the distance to the light source increases. The position of the light + is defined by the transform of the node in which it is instantiated. + + + + + + + + The color element contains three floating point numbers specifying the color of the light. + The color element must occur exactly once. + + + + + + + The constant_attenuation is used to calculate the total attenuation of this light given a distance. + The equation used is A = constant_attenuation + Dist*linear_attenuation + Dist^2*quadratic_attenuation. + + + + + + + The linear_attenuation is used to calculate the total attenuation of this light given a distance. + The equation used is A = constant_attenuation + Dist*linear_attenuation + Dist^2*quadratic_attenuation. + + + + + + + The quadratic_attenuation is used to calculate the total attenuation of this light given a distance. + The equation used is A = constant_attenuation + Dist*linear_attenuation + Dist^2*quadratic_attenuation. + + + + + + + + + + The spot element declares the parameters required to describe a spot light source. A spot light + source radiates light in one direction from a known location in space. The light radiates from + the spot light source in a cone shape. The intensity of the light is attenuated as the radiation + angle increases away from the direction of the light source. The intensity of a spot light source + is also attenuated as the distance to the light source increases. The position of the light is + defined by the transform of the node in which it is instantiated. The light’s default direction + vector in local coordinates is [0,0,-1], pointing down the -Z axis. The actual direction of the + light is defined by the transform of the node where the light is instantiated. + + + + + + + + The color element contains three floating point numbers specifying the color of the light. + The color element must occur exactly once. + + + + + + + The constant_attenuation is used to calculate the total attenuation of this light given a distance. + The equation used is A = constant_attenuation + Dist*linear_attenuation + Dist^2*quadratic_attenuation. + + + + + + + The linear_attenuation is used to calculate the total attenuation of this light given a distance. + The equation used is A = constant_attenuation + Dist*linear_attenuation + Dist^2*quadratic_attenuation. + + + + + + + The quadratic_attenuation is used to calculate the total attenuation of this light given a distance. + The equation used is A = constant_attenuation + Dist*linear_attenuation + Dist^2*quadratic_attenuation. + + + + + + + The falloff_angle is used to specify the amount of attenuation based on the direction of the light. + + + + + + + The falloff_exponent is used to specify the amount of attenuation based on the direction of the light. + + + + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + Materials describe the visual appearance of a geometric object. + + + + + + + + The material element may contain an asset element. + + + + + + + The material must instance an effect. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + The camera element declares a view into the scene hierarchy or scene graph. The camera contains + elements that describe the camera’s optics and imager. + + + + + + + + The camera element may contain an asset element. + + + + + + + Optics represents the apparatus on a camera that projects the image onto the image sensor. + + + + + + + + The technique_common element specifies the optics information for the common profile + which all COLLADA implementations need to support. + + + + + + + + The orthographic element describes the field of view of an orthographic camera. + + + + + + + + + + The xmag element contains a floating point number describing the horizontal + magnification of the view. + + + + + + + + The ymag element contains a floating point number describing the vertical + magnification of the view. It can also have a sid. + + + + + + + The aspect_ratio element contains a floating point number describing the aspect ratio of + the field of view. If the aspect_ratio element is not present the aspect ratio is to be + calculated from the xmag or ymag elements and the current viewport. + + + + + + + + + + + + + + The znear element contains a floating point number that describes the distance to the near + clipping plane. The znear element must occur exactly once. + + + + + + + The zfar element contains a floating point number that describes the distance to the far + clipping plane. The zfar element must occur exactly once. + + + + + + + + + + The perspective element describes the optics of a perspective camera. + + + + + + + + + + The xfov element contains a floating point number describing the horizontal field of view in degrees. + + + + + + + + The yfov element contains a floating point number describing the verticle field of view in degrees. + + + + + + + The aspect_ratio element contains a floating point number describing the aspect ratio of the field + of view. If the aspect_ratio element is not present the aspect ratio is to be calculated from the + xfov or yfov elements and the current viewport. + + + + + + + + + + + + + + The znear element contains a floating point number that describes the distance to the near + clipping plane. The znear element must occur exactly once. + + + + + + + The zfar element contains a floating point number that describes the distance to the far + clipping plane. The zfar element must occur exactly once. + + + + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + Imagers represent the image sensor of a camera (for example film or CCD). + + + + + + + + This element may contain any number of non-common profile techniques. + There is no common technique for imager. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + The animation element categorizes the declaration of animation information. The animation + hierarchy contains elements that describe the animation’s key-frame data and sampler functions, + ordered in such a way to group together animations that should be executed together. + + + + + + + + The animation element may contain an asset element. + + + + + + + + + The animation element may contain any number of source elements. + + + + + + + + + The animation element may contain any number of sampler elements. + + + + + + + The animation element may contain any number of channel elements. + + + + + + + The animation may be hierarchical and may contain any number of other animation elements. + + + + + + + + + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The animation_clip element defines a section of the animation curves to be used together as + an animation clip. + + + + + + + + The animation_clip element may contain an asset element. + + + + + + + The animation_clip must instance at least one animation element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The start attribute is the time in seconds of the beginning of the clip. This time is + the same as that used in the key-frame data and is used to determine which set of + key-frames will be included in the clip. The start time does not specify when the clip + will be played. If the time falls between two keyframes of a referenced animation, an + interpolated value should be used. The default value is 0.0. Optional attribute. + + + + + + + The end attribute is the time in seconds of the end of the clip. This is used in the + same way as the start time. If end is not specified, the value is taken to be the end + time of the longest animation. Optional attribute. + + + + + + + + + The channel element declares an output channel of an animation. + + + + + + + The source attribute indicates the location of the sampler using a URL expression. + The sampler must be declared within the same document. Required attribute. + + + + + + + The target attribute indicates the location of the element bound to the output of the sampler. + This text string is a path-name following a simple syntax described in Address Syntax. + Required attribute. + + + + + + + + + The sampler element declares an N-dimensional function used for animation. Animation function curves + are represented by 1-D sampler elements in COLLADA. The sampler defines sampling points and how to + interpolate between them. + + + + + + + + The input element must occur at least one time. These inputs are local inputs. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + + + + The controller element categorizes the declaration of generic control information. + A controller is a device or mechanism that manages and directs the operations of another object. + + + + + + + + The controller element may contain an asset element. + + + + + + + + The controller element may contain either a skin element or a morph element. + + + + + + + The controller element may contain either a skin element or a morph element. + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The skin element contains vertex and primitive information sufficient to describe blend-weight skinning. + + + + + + + + This provides extra information about the position and orientation of the base mesh before binding. + If bind_shape_matrix is not specified then an identity matrix may be used as the bind_shape_matrix. + The bind_shape_matrix element may occur zero or one times. + + + + + + + The skin element must contain at least three source elements. + + + + + + + The joints element associates joint, or skeleton, nodes with attribute data. + In COLLADA, this is specified by the inverse bind matrix of each joint (influence) in the skeleton. + + + + + + + + The input element must occur at least twice. These inputs are local inputs. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The vertex_weights element associates a set of joint-weight pairs with each vertex in the base mesh. + + + + + + + + The input element must occur at least twice. + + + + + + + The vcount element contains a list of integers describing the number of influences for each vertex. + The vcount element may occur once. + + + + + + + The v element describes which bones and attributes are associated with each vertex. An index + of –1 into the array of joints refers to the bind shape. Weights should be normalized before use. + The v element must occur zero or one times. + + + + + + + The extra element may appear any number of times. + + + + + + + + The count attribute describes the number of vertices in the base mesh. Required element. + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The source attribute contains a URI reference to the base mesh, (a static mesh or a morphed mesh). + This also provides the bind-shape of the skinned mesh. Required attribute. + + + + + + + + + The morph element describes the data required to blend between sets of static meshes. Each + possible mesh that can be blended (a morph target) must be specified. + + + + + + + + The morph element must contain at least two source elements. + + + + + + + The targets element declares the morph targets, their weights and any user defined attributes + associated with them. + + + + + + + + The input element must occur at least twice. These inputs are local inputs. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The method attribute specifies the which blending technique to use. The accepted values are + NORMALIZED, and RELATIVE. The default value if not specified is NORMALIZED. Optional attribute. + + + + + + + The source attribute indicates the base mesh. Required attribute. + + + + + + + + + + The asset element defines asset management information regarding its parent element. + + + + + + + + The contributor element defines authoring information for asset management + + + + + + + + The author element contains a string with the author's name. + There may be only one author element. + + + + + + + The authoring_tool element contains a string with the authoring tool's name. + There may be only one authoring_tool element. + + + + + + + The comments element contains a string with comments from this contributor. + There may be only one comments element. + + + + + + + The copyright element contains a string with copyright information. + There may be only one copyright element. + + + + + + + The source_data element contains a URI reference to the source data used for this asset. + There may be only one source_data element. + + + + + + + + + + The created element contains the date and time that the parent element was created and is + represented in an ISO 8601 format. The created element may appear zero or one time. + + + + + + + The keywords element contains a list of words used as search criteria for the parent element. + The keywords element may appear zero or more times. + + + + + + + The modified element contains the date and time that the parent element was last modified and + represented in an ISO 8601 format. The modified element may appear zero or one time. + + + + + + + The revision element contains the revision information for the parent element. The revision + element may appear zero or one time. + + + + + + + The subject element contains a description of the topical subject of the parent element. The + subject element may appear zero or one time. + + + + + + + The title element contains the title information for the parent element. The title element may + appear zero or one time. + + + + + + + The unit element contains descriptive information about unit of measure. It has attributes for + the name of the unit and the measurement with respect to the meter. The unit element may appear + zero or one time. + + + + + + + The meter attribute specifies the measurement with respect to the meter. The default + value for the meter attribute is “1.0”. + + + + + + + The name attribute specifies the name of the unit. The default value for the name + attribute is “meter”. + + + + + + + + + The up_axis element contains descriptive information about coordinate system of the geometric + data. All coordinates are right-handed by definition. This element specifies which axis is + considered up. The default is the Y-axis. The up_axis element may appear zero or one time. + + + + + + + + + + The extra element declares additional information regarding its parent element. + + + + + + + + The extra element may contain an asset element. + + + + + + + This element must contain at least one non-common profile technique. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The type attribute indicates the type of the value data. This text string must be understood by + the application. Optional attribute. + + + + + + + + enable-xmlns + + The technique element declares the information used to process some portion of the content. Each + technique conforms to an associated profile. Techniques generally act as a “switch”. If more than + one is present for a particular portion of content, on import, one or the other is picked, but + usually not both. Selection should be based on which profile the importing application can support. + Techniques contain application data and programs, making them assets that can be managed as a unit. + + + + + + + + + + The profile attribute indicates the type of profile. This is a vendor defined character + string that indicates the platform or capability target for the technique. Required attribute. + + + + + + + + + + Nodes embody the hierarchical relationship of elements in the scene. + + + + + + + + The node element may contain an asset element. + + + + + + + + The node element may contain any number of lookat elements. + + + + + + + The node element may contain any number of matrix elements. + + + + + + + The node element may contain any number of rotate elements. + + + + + + + The node element may contain any number of scale elements. + + + + + + + The node element may contain any number of skew elements. + + + + + + + The node element may contain any number of translate elements. + + + + + + + + The node element may instance any number of camera objects. + + + + + + + The node element may instance any number of controller objects. + + + + + + + The node element may instance any number of geometry objects. + + + + + + + The node element may instance any number of light objects. + + + + + + + The node element may instance any number of node elements or hierarchies objects. + + + + + + + The node element may be hierarchical and be the parent of any number of other node elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The type attribute indicates the type of the node element. The default value is “NODE”. + Optional attribute. + + + + + + + The layer attribute indicates the names of the layers to which this node belongs. For example, + a value of “foreground glowing” indicates that this node belongs to both the ‘foreground’ layer + and the ‘glowing’ layer. The default value is empty, indicating that the node doesn’t belong to + any layer. Optional attribute. + + + + + + + + + The visual_scene element declares the base of the visual_scene hierarchy or scene graph. The + scene contains elements that comprise much of the visual and transformational information + content as created by the authoring tools. + + + + + + + + The visual_scene element may contain an asset element. + + + + + + + The visual_scene element must have at least one node element. + + + + + + + The evaluate_scene element declares information specifying a specific way to evaluate this + visual_scene. There may be any number of evaluate_scene elements. + + + + + + + + The render element describes one effect pass to evaluate the scene. + There must be at least one render element. + + + + + + + + The layer element specifies which layer to render in this compositing step + while evaluating the scene. You may specify any number of layers. + + + + + + + The instance_effect element specifies which effect to render in this compositing step + while evaluating the scene. + + + + + + + + The camera_node attribute refers to a node that contains a camera describing the viewpoint to + render this compositing step from. + + + + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This + value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + Bind a specific material to a piece of geometry, binding varying and uniform parameters at the + same time. + + + + + + + + The bind_material element may contain any number of param elements. + + + + + + + The technique_common element specifies the bind_material information for the common + profile which all COLLADA implementations need to support. + + + + + + + + The instance_material element specifies the information needed to bind a geometry + to a material. This element must appear at least once. + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The instance_camera element declares the instantiation of a COLLADA camera resource. + + + + + + + The instance_controller element declares the instantiation of a COLLADA controller resource. + + + + + + + + The skeleton element is used to indicate where a skin controller is to start to search for + the joint nodes it needs. This element is meaningless for morph controllers. + + + + + + + Bind a specific material to a piece of geometry, binding varying and uniform parameters at the + same time. + + + + + + + The extra element may appear any number of times. + + + + + + + + The url attribute refers to resource. This may refer to a local resource using a relative + URL fragment identifier that begins with the “#” character. The url attribute may refer to an + external resource using an absolute or relative URL. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The instance_effect element declares the instantiation of a COLLADA effect resource. + + + + + + + + Add a hint for a platform of which technique to use in this effect. + + + + + + + A platform defines a string that specifies which platform this is hint is aimed for. + + + + + + + A profile defines a string that specifies which API profile this is hint is aimed for. + + + + + + + A reference to the technique to use for the specified platform. + + + + + + + + + Assigns a new value to a previously defined parameter + + + + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The url attribute refers to resource. This may refer to a local resource using a relative URL + fragment identifier that begins with the “#” character. The url attribute may refer to an external + resource using an absolute or relative URL. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The instance_force_field element declares the instantiation of a COLLADA force_field resource. + + + + + + + The instance_geometry element declares the instantiation of a COLLADA geometry resource. + + + + + + + + Bind a specific material to a piece of geometry, binding varying and uniform parameters at the + same time. + + + + + + + The extra element may appear any number of times. + + + + + + + + The url attribute refers to resource. This may refer to a local resource using a relative URL + fragment identifier that begins with the “#” character. The url attribute may refer to an external + resource using an absolute or relative URL. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The instance_light element declares the instantiation of a COLLADA light resource. + + + + + + + The instance_material element declares the instantiation of a COLLADA material resource. + + + + + + + + The bind element binds values to effect parameters upon instantiation. + + + + + + + The semantic attribute specifies which effect parameter to bind. + + + + + + + The target attribute specifies the location of the value to bind to the specified semantic. + This text string is a path-name following a simple syntax described in the “Addressing Syntax” + section. + + + + + + + + + The bind_vertex_input element binds vertex inputs to effect parameters upon instantiation. + + + + + + + The semantic attribute specifies which effect parameter to bind. + + + + + + + The input_semantic attribute specifies which input semantic to bind. + + + + + + + The input_set attribute specifies which input set to bind. + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The symbol attribute specifies which symbol defined from within the geometry this material binds to. + + + + + + + The target attribute specifies the URL of the location of the object to instantiate. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The instance_node element declares the instantiation of a COLLADA node resource. + + + + + + + The instance_physics_material element declares the instantiation of a COLLADA physics_material + resource. + + + + + + + This element allows instancing physics model within another physics model, or in a physics scene. + + + + + + + + The instance_physics_model element may instance any number of force_field elements. + + + + + + + The instance_physics_model element may instance any number of rigid_body elements. + + + + + + + The instance_physics_model element may instance any number of rigid_constraint elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The url attribute refers to resource. This may refer to a local resource using a relative URL + fragment identifier that begins with the “#” character. The url attribute may refer to an external + resource using an absolute or relative URL. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The parent attribute points to the id of a node in the visual scene. This allows a physics model + to be instantiated under a specific transform node, which will dictate the initial position and + orientation, and could be animated to influence kinematic rigid bodies. + + + + + + + + + This element allows instancing a rigid_body within an instance_physics_model. + + + + + + + + The technique_common element specifies the instance_rigid_body information for the common + profile which all COLLADA implementations need to support. + + + + + + + + Specifies the initial angular velocity of the rigid_body instance in degrees per second + around each axis, in the form of an X-Y-Z Euler rotation. + + + + + + + Specifies the initial linear velocity of the rigid_body instance. + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + The body attribute indicates which rigid_body to instantiate. Required attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + The target attribute indicates which node is influenced by this rigid_body instance. + Required attribute + + + + + + + + + This element allows instancing a rigid_constraint within an instance_physics_model. + + + + + + + + The extra element may appear any number of times. + + + + + + + + The constraint attribute indicates which rigid_constraing to instantiate. Required attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + The library_animations element declares a module of animation elements. + + + + + + + + The library_animations element may contain an asset element. + + + + + + + There must be at least one animation element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_animation_clips element declares a module of animation_clip elements. + + + + + + + + The library_animation_clips element may contain an asset element. + + + + + + + There must be at least one animation_clip element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_cameras element declares a module of camera elements. + + + + + + + + The library_cameras element may contain an asset element. + + + + + + + There must be at least one camera element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_controllers element declares a module of controller elements. + + + + + + + + The library_controllers element may contain an asset element. + + + + + + + There must be at least one controller element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_geometries element declares a module of geometry elements. + + + + + + + + The library_geometries element may contain an asset element. + + + + + + + There must be at least one geometry element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_effects element declares a module of effect elements. + + + + + + + + The library_effects element may contain an asset element. + + + + + + + There must be at least one effect element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_force_fields element declares a module of force_field elements. + + + + + + + + The library_force_fields element may contain an asset element. + + + + + + + There must be at least one force_field element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_images element declares a module of image elements. + + + + + + + + The library_images element may contain an asset element. + + + + + + + There must be at least one image element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_lights element declares a module of light elements. + + + + + + + + The library_lights element may contain an asset element. + + + + + + + There must be at least one light element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_materials element declares a module of material elements. + + + + + + + + The library_materials element may contain an asset element. + + + + + + + There must be at least one material element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_nodes element declares a module of node elements. + + + + + + + + The library_nodes element may contain an asset element. + + + + + + + There must be at least one node element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_physics_materials element declares a module of physics_material elements. + + + + + + + + The library_physics_materials element may contain an asset element. + + + + + + + There must be at least one physics_material element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_physics_models element declares a module of physics_model elements. + + + + + + + + The library_physics_models element may contain an asset element. + + + + + + + There must be at least one physics_model element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_physics_scenes element declares a module of physics_scene elements. + + + + + + + + The library_physics_scenes element may contain an asset element. + + + + + + + There must be at least one physics_scene element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + The library_visual_scenes element declares a module of visual_scene elements. + + + + + + + + The library_visual_scenes element may contain an asset element. + + + + + + + There must be at least one visual_scene element. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + + + + + + + + When a transparent opaque attribute is set to A_ONE, it means the transparency information will be taken from the alpha channel of the color, texture, or parameter supplying the value. The value of 1.0 is opaque in this mode. + + + + + + + When a transparent opaque attribute is set to RGB_ZERO, it means the transparency information will be taken from the red, green, and blue channels of the color, texture, or parameter supplying the value. Each channel is modulated independently. The value of 0.0 is opaque in this mode. + + + + + + + + + + + When a surface's type attribute is set to UNTYPED, its type is initially unknown and established later by the context in which it is used, such as by a texture sampler that references it. A surface of any other type may be changed into an UNTYPED surface at run-time, as if it were created by <newparam>, using <setparam>. If there is a type mismatch between a <setparam> operation and what the run-time decides the type should be, the result is profile- and platform-specific behavior. + + + + + + + + + + + + + + + + + + + + + + + + The per-texel layout of the format. The length of the string indicate how many channels there are and the letter respresents the name of the channel. There are typically 0 to 4 channels. + + + + + RGB color map + + + + + RGB color + Alpha map often used for color + transparency or other things packed into channel A like specular power + + + + + Luminance map often used for light mapping + + + + + Luminance+Alpha map often used for light mapping + + + + + Depth map often used for displacement, parellax, relief, or shadow mapping + + + + + Typically used for normal maps or 3component displacement maps. + + + + + Typically used for normal maps where W is the depth for relief or parrallax mapping + + + + + + + Each channel of the texel has a precision. Typically these are all linked together. An exact format lay lower the precision of an individual channel but applying a higher precision by linking the channels together may still convey the same information. + + + + + For integers this typically represents 8 bits. For floats typically 16 bits. + + + + + For integers this typically represents 8 to 24 bits. For floats typically 16 to 32 bits. + + + + + For integers this typically represents 16 to 32 bits. For floats typically 24 to 32 bits. + + + + + + + Each channel represents a range of values. Some example ranges are signed or unsigned integers, or between between a clamped range such as 0.0f to 1.0f, or high dynamic range via floating point + + + + + Format is representing a decimal value that remains within the -1 to 1 range. Implimentation could be integer-fixedpoint or floats. + + + + + Format is representing a decimal value that remains within the 0 to 1 range. Implimentation could be integer-fixedpoint or floats. + + + + + Format is representing signed integer numbers. (ex. 8bits = -128 to 127) + + + + + Format is representing unsigned integer numbers. (ex. 8bits = 0 to 255) + + + + + Format should support full floating point ranges. High precision is expected to be 32bit. Mid precision may be 16 to 32 bit. Low precision is expected to be 16 bit. + + + + + + + Additional hints about data relationships and other things to help the application pick the best format. + + + + + colors are stored with respect to the sRGB 2.2 gamma curve rather than linear + + + + + the texel's XYZ/RGB should be normalized such as in a normal map. + + + + + the texel's XYZW/RGBA should be normalized such as in a normal map. + + + + + The surface may use run-time compression. Considering the best compression based on desired, channel, range, precision, and options + + + + + + + If the exact format cannot be resolve via other methods then the format_hint will describe the important features of the format so that the application may select a compatable or close format + + + + + The per-texel layout of the format. The length of the string indicate how many channels there are and the letter respresents the name of the channel. There are typically 0 to 4 channels. + + + + + Each channel represents a range of values. Some example ranges are signed or unsigned integers, or between between a clamped range such as 0.0f to 1.0f, or high dynamic range via floating point + + + + + Each channel of the texel has a precision. Typically these are all linked together. An exact format lay lower the precision of an individual channel but applying a higher precision by linking the channels together may still convey the same information. + + + + + Additional hints about data relationships and other things to help the application pick the best format. + + + + + + + + For 1D, 2D, RECT surface types + + + + This choice exists for consistancy with other init types (volume and cube). When other initialization methods are needed. + + + + Init the entire surface with one compound image such as DDS + + + + + + + + + + + + Init the entire surface with one compound image such as DDS + + + + + + + + Init mip level 0 of the surface with one compound image such as DDS. Use of this element expects that the surface has element mip_levels=0 or mipmap_generate. + + + + + + + + + + + + Init the entire surface with one compound image such as DDS + + + + + + + + Init all primary mip level 0 subsurfaces with one compound image such as DDS. Use of this element expects that the surface has element mip_levels=0 or mipmap_generate. + + + + + This sequence exists to allow the order elements to be optional but require that if they exist there must be 6 of them. + + + + If the image dues not natively describe the face ordering then this series of order elements will describe which face the index belongs too + + + + + + + + + Init each face mipchain with one compound image such as DDS + + + + + + + + + + + This element is an IDREF which specifies the image to use to initialize a specific mip of a 1D or 2D surface, 3D slice, or Cube face. + + + + + + + + + + + + + The common set of initalization options for surfaces. Choose which is appropriate for your surface based on type and other characteristics. described by the annotation docs on the child elements. + + + + + This surface is intended to be initialized later externally by a "setparam" element. If it is used before being initialized there is profile and platform specific behavior. Most elements on the surface element containing this will be ignored including mip_levels, mipmap_generate, size, viewport_ratio, and format. + + + + + Init as a target for depth, stencil, or color. It does not need image data. Surface should not have mipmap_generate when using this. + + + + + Init a CUBE from a compound image such as DDS + + + + + Init a 3D from a compound image such as DDS + + + + + Init a 1D,2D,RECT,DEPTH from a compound image such as DDS + + + + + Initialize the surface one sub-surface at a time by specifying combinations of mip, face, and slice which make sense for a particular surface type. Each sub-surface is initialized by a common 2D image, not a complex compound image such as DDS. If not all subsurfaces are initialized, it is invalid and will result in profile and platform specific behavior unless mipmap_generate is responsible for initializing the remainder of the sub-surfaces + + + + + + + + The fx_surface_common type is used to declare a resource that can be used both as the source for texture samples and as the target of a rendering pass. + + + + + + The common set of initalization options for surfaces. Choose which is appropriate for your surface based on the type attribute and other characteristics described by the annotation docs on the choiced child elements of this type. + + + + + Contains a string representing the profile and platform specific texel format that the author would like this surface to use. If this element is not specified then the application will use a common format R8G8B8A8 with linear color gradient, not sRGB. + + + + + If the exact format cannot be resolved via the "format" element then the format_hint will describe the important features of the format so that the application may select a compatable or close format + + + + + + The surface should be sized to these exact dimensions + + + + + The surface should be sized to a dimension based on this ratio of the viewport's dimensions in pixels + + + + + + the surface should contain the following number of MIP levels. If this element is not present it is assumed that all miplevels exist until a dimension becomes 1 texel. To create a surface that has only one level of mip maps (mip=0) set this to 1. If the value is 0 the result is the same as if mip_levels was unspecified, all possible mip_levels will exist. + + + + + By default it is assumed that mipmaps are supplied by the author so, if not all subsurfaces are initialized, it is invalid and will result in profile and platform specific behavior unless mipmap_generate is responsible for initializing the remainder of the sub-surfaces + + + + + + + Specifying the type of a surface is mandatory though the type may be "UNTYPED". When a surface is typed as UNTYPED, it is said to be temporarily untyped and instead will be typed later by the context it is used in such as which samplers reference it in that are used in a particular technique or pass. If there is a type mismatch between what is set into it later and what the runtime decides the type should be the result in profile and platform specific behavior. + + + + + + + + + + + + + + + + + + + + + + + + + + + A one-dimensional texture sampler. + + + + + + + + + + + + + + + + + + A two-dimensional texture sampler. + + + + + + + + + + + + + + + + + + + A three-dimensional texture sampler. + + + + + + + + + + + + + + + + + + + + A texture sampler for cube maps. + + + + + + + + + + + + + + + + + + + + A two-dimensional texture sampler. + + + + + + + + + + + + + + + + + + + A texture sampler for depth maps. + + + + + + + + + + + + + + + A group that specifies the allowable types for an annotation. + + + + + + + + + + + + + + + + + + + + + + + + + A group that specifies the allowable types for effect scoped parameters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The include element is used to import source code or precompiled binary shaders into the FX Runtime by referencing an external resource. + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The url attribute refers to resource. This may refer to a local resource using a relative URL + fragment identifier that begins with the “#” character. The url attribute may refer to an external + resource using an absolute or relative URL. + + + + + + + + This element creates a new, named param object in the FX Runtime, assigns it a type, an initial value, and additional attributes at declaration time. + + + + + + + The annotate element allows you to specify an annotation for this new param. + + + + + + + The semantic element allows you to specify a semantic for this new param. + + + + + + + The modifier element allows you to specify a modifier for this new param. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The fx_code_profile type allows you to specify an inline block of source code. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + + + The fx_profile_abstract element is only used as a substitution group hook for COLLADA FX profiles. + + + + + + + A self contained description of a shader effect. + + + + + + + + The effect element may contain an asset element. + + + + + + + The annotate element allows you to specify an annotation on this effect. + + + + + + + The image element allows you to create image resources which can be shared by multipe profiles. + + + + + + + The newparam element allows you to create new effect parameters which can be shared by multipe profiles. + + + + + + + This is the substituion group hook which allows you to swap in other COLLADA FX profiles. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + A one-dimensional texture sampler for the GLSL profile. + + + + + + + + + + A two-dimensional texture sampler for the GLSL profile. + + + + + + + + + + A three-dimensional texture sampler for the GLSL profile. + + + + + + + + + + A cube map texture sampler for the GLSL profile. + + + + + + + + + + A two-dimensional texture sampler for the GLSL profile. + + + + + + + + + + A depth texture sampler for the GLSL profile. + + + + + + + + + + + value=0x0 + + + + + value=0x1 + + + + + value=0x0300 + + + + + value=0x0301 + + + + + value=0x0306 + + + + + value=0x0307 + + + + + value=0x0302 + + + + + value=0x0303 + + + + + value=0x0304 + + + + + value=0x0305 + + + + + value=0x8001 + + + + + value=0x8002 + + + + + value=0x8003 + + + + + value=0x8004 + + + + + value=0x0308 + + + + + + + + + value=0x0404 + + + + + value=0x0405 + + + + + value=0x0408 + + + + + + + + + value=0x8006 + + + + + value=0x800A + + + + + value=0x800B + + + + + value=0x8007 + + + + + value=0x8008 + + + + + + + + + value=0x0200 + + + + + value=0x0201 + + + + + value=0x0203 + + + + + value=0x0202 + + + + + value=0x0204 + + + + + value=0x0205 + + + + + value=0x0206 + + + + + value=0x0207 + + + + + + + + + value=0x1E00 + + + + + value=0x0 + + + + + value=0x1E01 + + + + + value=0x1E02 + + + + + value=0x1E03 + + + + + value=0x150A + + + + + value=0x8507 + + + + + value=0x8508 + + + + + + + + + value=0x1600 + + + + + value=0x1200 + + + + + value=0x1201 + + + + + value=0x1202 + + + + + value=0x1602 + + + + + + + + + value=0x2601 + + + + + value=0x0800 + + + + + value=0x0801 + + + + + + + + + value=0x8451 + + + + + value=0x8452 + + + + + + + + + value=0x0900 + + + + + value=0x0901 + + + + + + + + + value=0x81F9 + + + + + value=0x81FA + + + + + + + + + value=0x1500 + + + + + value=0x1501 + + + + + value=0x1502 + + + + + value=0x1503 + + + + + value=0x1504 + + + + + value=0x1505 + + + + + value=0x1506 + + + + + value=0x1507 + + + + + value=0x1508 + + + + + value=0x1509 + + + + + value=0x150A + + + + + value=0x150B + + + + + value=0x150C + + + + + value=0x150E + + + + + value=0x150F + + + + + + + + + value=0x1B00 + + + + + value=0x1B01 + + + + + value=0x1B02 + + + + + + + + + value=0x1D00 + + + + + value=0x1D01 + + + + + + + + + + + + + + + + + A group that defines all of the renderstates used for the CG and GLSL profiles. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The glsl_newarray_type is used to creates a parameter of a one-dimensional array type. + + + + + + + + You may recursively nest glsl_newarray elements to create multidimensional arrays. + + + + + + + + The length attribute specifies the length of the array. + + + + + + + + The glsl_newarray_type is used to creates a parameter of a one-dimensional array type. + + + + + + + + You may recursively nest glsl_newarray elements to create multidimensional arrays. + + + + + + + + The length attribute specifies the length of the array. + + + + + + + + A surface type for the GLSL profile. This surface inherits from the fx_surface_common type and adds the + ability to programmatically generate textures. + + + + + + + + + A procedural surface generator. + + + + + + + + The annotate element allows you to specify an annotation for this surface generator. + + + + + + + + The code element allows you to embed GLSL code to use for this surface generator. + + + + + + + The include element allows you to import GLSL code to use for this surface generator. + + + + + + + + The entry symbol for the shader function. + + + + + + + + + + + + + + The setparam element allows you to assign a new value to a previously defined parameter. + + + + + + + + + + + + + + A group that specifies the allowable types for GLSL profile parameters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Opens a block of GLSL platform-specific data types and technique declarations. + + + + + + + + + + + + + + + + + Holds a description of the textures, samplers, shaders, parameters, and passes necessary for rendering this effect using one method. + + + + + + + + + + + + + + + + + + A static declaration of all the render states, shaders, and settings for one rendering pipeline. + + + + + + + + + + + + + + + + + + Declare and prepare a shader for execution in the rendering pipeline of a pass. + + + + + + + + + + A string declaring which profile or platform the compiler is targeting this shader for. + + + + + + + + + + + + A string containing command-line operations for the shader compiler. + + + + + + + + The entry symbol for the shader function. + + + + + + + + + + + + + + Binds values to uniform inputs of a shader. + + + + + + + + + + + + + + + The identifier for a uniform input parameter to the shader (a formal function parameter or in-scope + global) that will be bound to an external resource. + + + + + + + + + + In which pipeline stage this programmable shader is designed to execute, for example, VERTEX, FRAGMENT, etc. + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + Opens a block of COMMON platform-specific data types and technique declarations. + + + + + + + + + + + + + Holds a description of the textures, samplers, shaders, parameters, and passes necessary for rendering this effect using one method. + + + + + + + + The technique element may contain an asset element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creates a symbolic connection between two previously defined parameters. + + + + + + + + Creates a parameter of a one-dimensional array type. + + + + + + + + Nested array elements allow you to create multidemensional arrays. + + + + + + + The usertype element allows you to create arrays of usertypes. + + + + + + + + + The length attribute specifies the length of the array. + + + + + + + + Creates a parameter of a one-dimensional array type. + + + + + + + + Nested array elements allow you to create multidemensional arrays. + + + + + + + The usertype element allows you to create arrays of usertypes. + + + + + + + + The length attribute specifies the length of the array. + + + + + + + + Creates an instance of a structured class. + + + + + Some usertypes do not have data. They may be used only to implement interface functions. + + + + Use a combination of these to initialize the usertype in an order-dependent manner. + + + + + + + + + Use a series of these to set the members by name. The ref attribute will be relative to the usertype you are in right now. + + + + + + + + Reference a code or include element which defines the usertype + + + + + + + + Declares a resource that can be used both as the source for texture samples and as the target of a rendering pass. + + + + + + + + + A procedural surface generator for the cg profile. + + + + + + + + The annotate element allows you to specify an annotation for this generator. + + + + + + + + The code element allows you to embed cg sourcecode for the surface generator. + + + + + + + The include element imports cg source code or precompiled binary shaders into the FX Runtime by referencing an external resource. + + + + + + + + The entry symbol for the shader function. + + + + + + + + + + + + + + Assigns a new value to a previously defined parameter. + + + + + + + + + + + + + + A group that specifies the allowable types for CG profile parameters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create a new, named param object in the CG Runtime, assign it a type, an initial value, and additional attributes at declaration time. + + + + + + + The annotate element allows you to specify an annotation for this new param. + + + + + + + The semantic element allows you to specify a semantic for this new param. + + + + + + + The modifier element allows you to specify a modifier for this new param. + + + + + + + + + + + + + + + + + + + + + + Assigns a new value to a previously defined parameter. + + + + + + + + + + + + + + + Opens a block of CG platform-specific data types and technique declarations. + + + + + + + + + + + + + + + + + Holds a description of the textures, samplers, shaders, parameters, and passes necessary for rendering this effect using one method. + + + + + + + + The technique element may contain an asset element. + + + + + + + + + + + + + + + + + A static declaration of all the render states, shaders, and settings for one rendering pipeline. + + + + + + + + + + + + + + + + + + Declare and prepare a shader for execution in the rendering pipeline of a pass. + + + + + + + + + + + + + + + + + A string containing command-line operations for the shader compiler. + + + + + + + + The entry symbol for the shader function. + + + + + + + + + + + + + + Binds values to uniform inputs of a shader. + + + + + + + + + References a predefined parameter in shader binding declarations. + + + + + + + + + + + The identifier for a uniform input parameter to the shader (a formal function parameter or in-scope + global) that will be bound to an external resource. + + + + + + + + + + In which pipeline stage this programmable shader is designed to execute, for example, VERTEX, FRAGMENT, etc. + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The type of platform. This is a vendor-defined character string that indicates the platform or capability target for the technique. Optional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + value=0x1E01 + + + + + value=0x2100 + + + + + value=0x2101 + + + + + value=0x0BE2 + + + + + value=0x0104 + + + + + + + + + + + + + + + + + + + + value=0x1E01 + + + + + value=0x2100 + + + + + value=0x0104 + + + + + value=0x8574 + + + + + value=0x8575 + + + + + value=0x84E7 + + + + + value=0x86AE + + + + + value=0x86AF + + + + + + + + + value=0x1E01 + + + + + value=0x2100 + + + + + value=0x0104 + + + + + value=0x8574 + + + + + value=0x8575 + + + + + value=0x84E7 + + + + + + + + + value=0x1702 + + + + + value=0x8576 + + + + + value=0x8577 + + + + + value=0x8578 + + + + + + + + + value=0x0300 + + + + + value=0x0301 + + + + + value=0x0302 + + + + + value=0x0303 + + + + + + + + + value=0x0302 + + + + + value=0x0303 + + + + + + + + + + + + + + + + + + + + + + + + Defines the RGB portion of a texture_pipeline command. This is a combiner-mode texturing operation. + + + + + + + + + + + + + + + + + + + + + + + + + + Defines a set of texturing commands that will be converted into multitexturing operations using glTexEnv in regular and combiner mode. + + + + + + + Defines a texture_pipeline command. This is a combiner-mode texturing operation. + + + + + + + Defines a texture_pipeline command. It is a simple noncombiner mode of texturing operations. + + + + + + + The extra element may appear any number of times. + OpenGL ES extensions may be used here. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + + + supported by GLES 1.1 only + + + + + + + + + Two-dimensional texture sampler state for profile_GLES. This is a bundle of sampler-specific states that will be referenced by one or more texture_units. + + + + + + + + + + + + + + + The extra element may appear any number of times. + OpenGL ES extensions may be used here. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + value=0x1E00 + + + + + value=0x0 + + + + + value=0x1E01 + + + + + value=0x1E02 + + + + + value=0x1E03 + + + + + value=0x150A + + + + + + + + + + + A group that contains the renderstates available for the GLES profile. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A group that defines the available variable types for GLES parameters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create a new, named param object in the GLES Runtime, assign it a type, an initial value, and additional attributes at declaration time. + + + + + + + The annotate element allows you to specify an annotation for this new param. + + + + + + + The semantic element allows you to specify a semantic for this new param. + + + + + + + The modifier element allows you to specify a modifier for this new param. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. + + + + + + + + + + + Opens a block of GLES platform-specific data types and technique declarations. + + + + + + + + + + + + + Holds a description of the textures, samplers, shaders, parameters, and passes necessary for rendering this effect using one method. + + + + + + + + + + + + + + + + + + + + + + + A static declaration of all the render states, shaders, and settings for one rendering pipeline. + + + + + + + + + + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. + + + + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The type of platform. This is a vendor-defined character string that indicates the platform or capability target for the technique. Optional + + + + + + + + + + + An axis-aligned, centered box primitive. + + + + + + + + 3 float values that represent the extents of the box + + + + + + + The extra element may appear any number of times. + + + + + + + + + + An infinite plane primitive. + + + + + + + + 4 float values that represent the coefficients for the plane’s equation: Ax + By + Cz + D = 0 + + + + + + + The extra element may appear any number of times. + + + + + + + + + + A centered sphere primitive. + + + + + + + + A float value that represents the radius of the sphere + + + + + + + The extra element may appear any number of times. + + + + + + + + + + + + + + + + + A cylinder primitive that is centered on, and aligned with. the local Y axis. + + + + + + + + A float value that represents the length of the cylinder along the Y axis. + + + + + + + float2 values that represent the radii of the cylinder. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + A tapered cylinder primitive that is centered on and aligned with the local Y axis. + + + + + + + + A float value that represents the length of the cylinder along the Y axis. + + + + + + + Two float values that represent the radii of the tapered cylinder at the positive (height/2) + Y value. Both ends of the tapered cylinder may be elliptical. + + + + + + + Two float values that represent the radii of the tapered cylinder at the negative (height/2) + Y value.Both ends of the tapered cylinder may be elliptical. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + A capsule primitive that is centered on and aligned with the local Y axis. + + + + + + + + A float value that represents the length of the line segment connecting the centers + of the capping hemispheres. + + + + + + + Two float values that represent the radii of the capsule (it may be elliptical) + + + + + + + The extra element may appear any number of times. + + + + + + + + + + A tapered capsule primitive that is centered on, and aligned with, the local Y axis. + + + + + + + + A float value that represents the length of the line segment connecting the centers of the + capping hemispheres. + + + + + + + Two float values that represent the radii of the tapered capsule at the positive (height/2) + Y value.Both ends of the tapered capsule may be elliptical. + + + + + + + Two float values that represent the radii of the tapered capsule at the negative (height/2) + Y value.Both ends of the tapered capsule may be elliptical. + + + + + + + The extra element may appear any number of times. + + + + + + + + + + The definition of the convex_mesh element is identical to the mesh element with the exception that + instead of a complete description (source, vertices, polygons etc.), it may simply point to another + geometry to derive its shape. The latter case means that the convex hull of that geometry should + be computed and is indicated by the optional “convex_hull_of” attribute. + + + + + + + + + + + + + + + + + + + The extra element may appear any number of times. + + + + + + + + The convex_hull_of attribute is a URI string of geometry to compute the convex hull of. + Optional attribute. + + + + + + + + + + A general container for force-fields. At the moment, it only has techniques and extra elements. + + + + + + + + The force_field element may contain an asset element. + + + + + + + This element must contain at least one non-common profile technique. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. This value + must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + This element defines the physical properties of an object. It contains a technique/profile with + parameters. The COMMON profile defines the built-in names, such as static_friction. + + + + + + + + The physics_material element may contain an asset element. + + + + + + + The technique_common element specifies the physics_material information for the common profile + which all COLLADA implementations need to support. + + + + + + + + Dynamic friction coefficient + + + + + + + The proportion of the kinetic energy preserved in the impact (typically ranges from 0.0 to 1.0) + + + + + + + Static friction coefficient + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + + + The physics_scene element may contain an asset element. + + + + + + + There may be any number of instance_force_field elements. + + + + + + + There may be any number of instance_physics_model elements. + + + + + + + The technique_common element specifies the physics_scene information for the common profile + which all COLLADA implementations need to support. + + + + + + + + The gravity vector to use for the physics_scene. + + + + + + + The time_step for the physics_scene. + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + + + + + + + This element allows for describing simulated bodies that do not deform. These bodies may or may + not be connected by constraints (hinge, ball-joint etc.). Rigid-bodies, constraints etc. are + encapsulated in physics_model elements to allow for instantiating complex models. + + + + + + + + The technique_common element specifies the rigid_body information for the common profile which all + COLLADA implementations need to support. + + + + + + + + If false, the rigid_body is not moveable + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The total mass of the rigid-body + + + + + + + Defines the center and orientation of mass of the rigid-body relative to the local origin of the + “root” shape.This makes the off-diagonal elements of the inertia tensor (products of inertia) all + 0 and allows us to just store the diagonal elements (moments of inertia). + + + + + + + + + + + + + float3 – The diagonal elements of the inertia tensor (moments of inertia), which is represented + in the local frame of the center of mass. See above. + + + + + + + + References a physics_material for the rigid_body. + + + + + + + Defines a physics_material for the rigid_body. + + + + + + + + This element allows for describing components of a rigid_body. + + + + + + + + If true, the mass is distributed along the surface of the shape + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The mass of the shape. + + + + + + + The density of the shape. + + + + + + + + References a physics_material for the shape. + + + + + + + Defines a physics_material for the shape. + + + + + + + + + Instances a geometry to use to define this shape. + + + + + + + Defines a plane to use for this shape. + + + + + + + Defines a box to use for this shape. + + + + + + + Defines a sphere to use for this shape. + + + + + + + Defines a cyliner to use for this shape. + + + + + + + Defines a tapered_cylinder to use for this shape. + + + + + + + Defines a capsule to use for this shape. + + + + + + + Defines a tapered_capsule to use for this shape. + + + + + + + + + Allows a tranformation for the shape. + + + + + + + Allows a tranformation for the shape. + + + + + + + + The extra element may appear any number of times. + + + + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. This + value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + This element allows for connecting components, such as rigid_body into complex physics models + with moveable parts. + + + + + + + + Defines the attachment (to a rigid_body or a node) to be used as the reference-frame. + + + + + + + + Allows you to "position" the attachment point. + + + + + + + Allows you to "position" the attachment point. + + + + + + + The extra element may appear any number of times. + + + + + + + + The “rigid_body” attribute is a relative reference to a rigid-body within the same + physics_model. + + + + + + + + + Defines an attachment to a rigid-body or a node. + + + + + + + + Allows you to "position" the attachment point. + + + + + + + Allows you to "position" the attachment point. + + + + + + + The extra element may appear any number of times. + + + + + + + + The “rigid_body” attribute is a relative reference to a rigid-body within the same physics_model. + + + + + + + + + The technique_common element specifies the rigid_constraint information for the common profile + which all COLLADA implementations need to support. + + + + + + + + If false, the constraint doesn’t exert any force or influence on the rigid bodies. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + Indicates whether the attached rigid bodies may inter-penetrate. + + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + + + + + The limits element provides a flexible way to specify the constraint limits (degrees of freedom + and ranges). + + + + + + + + The swing_cone_and_twist element describes the angular limits along each rotation axis in degrees. + The the X and Y limits describe a “swing cone” and the Z limits describe the “twist angle” range + + + + + + + + The minimum values for the limit. + + + + + + + The maximum values for the limit. + + + + + + + + + + The linear element describes linear (translational) limits along each axis. + + + + + + + + The minimum values for the limit. + + + + + + + The maximum values for the limit. + + + + + + + + + + + + + Spring, based on distance (“LINEAR”) or angle (“ANGULAR”). + + + + + + + + The angular spring properties. + + + + + + + + The stiffness (also called spring coefficient) has units of force/angle in degrees. + + + + + + + The spring damping coefficient. + + + + + + + The spring's target or resting distance. + + + + + + + + + + The linear spring properties. + + + + + + + + The stiffness (also called spring coefficient) has units of force/distance. + + + + + + + The spring damping coefficient. + + + + + + + The spring's target or resting distance. + + + + + + + + + + + + + + + + This element may contain any number of non-common profile techniques. + + + + + + + The extra element may appear any number of times. + + + + + + + + The sid attribute is a text string value containing the sub-identifier of this element. + This value must be unique within the scope of the parent element. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + This element allows for building complex combinations of rigid-bodies and constraints that + may be instantiated multiple times. + + + + + + + + The physics_model element may contain an asset element. + + + + + + + The physics_model may define any number of rigid_body elements. + + + + + + + The physics_model may define any number of rigid_constraint elements. + + + + + + + The physics_model may instance any number of other physics_model elements. + + + + + + + The extra element may appear any number of times. + + + + + + + + The id attribute is a text string containing the unique identifier of this element. + This value must be unique within the instance document. Optional attribute. + + + + + + + The name attribute is the text string name of this element. Optional attribute. + + + + + + + + + constant-strings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + constant-strings + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/issues/1/Issue 1.url b/Tests/issues/1/Issue 1.url new file mode 100644 index 0000000..73d43c9 --- /dev/null +++ b/Tests/issues/1/Issue 1.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://github.com/dgis/xsddiagram/issues/1 diff --git a/Tests/issues/1/javaee_6.xsd b/Tests/issues/1/javaee_6.xsd new file mode 100644 index 0000000..f165d18 --- /dev/null +++ b/Tests/issues/1/javaee_6.xsd @@ -0,0 +1,2422 @@ + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + The following definitions that appear in the common + shareable schema(s) of Java EE deployment descriptors should be + interpreted with respect to the context they are included: + + Deployment Component may indicate one of the following: + java ee application; + application client; + web application; + enterprise bean; + resource adapter; + + Deployment File may indicate one of the following: + ear file; + war file; + jar file; + rar file; + + + + + + + + + + + + + This group keeps the usage of the contained description related + elements consistent across Java EE deployment descriptors. + + All elements may occur multiple times with different languages, + to support localization of the content. + + + + + + + + + + + + + + + This group keeps the usage of the contained JNDI environment + reference elements consistent across Java EE deployment descriptors. + + + + + + + + + + + + + + + + + + + + + + + + This group collects elements that are common to most + JNDI resource elements. + + + + + + + + + + The JNDI name to be looked up to resolve a resource reference. + + + + + + + + + + + + This group collects elements that are common to all the + JNDI resource elements. It does not include the lookup-name + element, that is only applicable to some resource elements. + + + + + + + + + A product specific name that this resource should be + mapped to. The name of this resource, as defined by the + resource's name element or defaulted, is a name that is + local to the application component using the resource. + (It's a name in the JNDI java:comp/env namespace.) Many + application servers provide a way to map these local + names to names of resources known to the application + server. This mapped name is often a global JNDI name, + but may be a name of any form. + + Application servers are not required to support any + particular form or type of mapped name, nor the ability + to use mapped names. The mapped name is + product-dependent and often installation-dependent. No + use of a mapped name is portable. + + + + + + + + + + + + + + + + Configuration of a DataSource. + + + + + + + + + Description of this DataSource. + + + + + + + + + The name element specifies the JNDI name of the + data source being defined. + + + + + + + + + DataSource, XADataSource or ConnectionPoolDataSource + implementation class. + + + + + + + + + Database server name. + + + + + + + + + Port number where a server is listening for requests. + + + + + + + + + Name of a database on a server. + + + + + + + + url property is specified + along with other standard DataSource properties + such as serverName, databaseName + and portNumber, the more specific properties will + take precedence and url will be ignored. + + ]]> + + + + + + + + User name to use for connection authentication. + + + + + + + + + Password to use for connection authentication. + + + + + + + + + JDBC DataSource property. This may be a vendor-specific + property or a less commonly used DataSource property. + + + + + + + + + Sets the maximum time in seconds that this data source + will wait while attempting to connect to a database. + + + + + + + + + Set to false if connections should not participate in + transactions. + + + + + + + + + Isolation level for connections. + + + + + + + + + Number of connections that should be created when a + connection pool is initialized. + + + + + + + + + Maximum number of connections that should be concurrently + allocated for a connection pool. + + + + + + + + + Minimum number of connections that should be concurrently + allocated for a connection pool. + + + + + + + + + The number of seconds that a physical connection should + remain unused in the pool before the connection is + closed for a connection pool. + + + + + + + + + The total number of statements that a connection pool + should keep open. + + + + + + + + + + + + + + + + The description type is used by a description element to + provide text describing the parent element. The elements + that use this type should include any information that the + Deployment Component's Deployment File file producer wants + to provide to the consumer of the Deployment Component's + Deployment File (i.e., to the Deployer). Typically, the + tools used by such a Deployment File consumer will display + the description when processing the parent element that + contains the description. + + The lang attribute defines the language that the + description is provided in. The default value is "en" (English). + + + + + + + + + + + + + + + This type defines a dewey decimal that is used + to describe versions of documents. + + + + + + + + + + + + + + + + Employee Self Service + + + The value of the xml:lang attribute is "en" (English) by default. + + ]]> + + + + + + + + + + + + + + + + EmployeeRecord + + ../products/product.jar#ProductEJB + + ]]> + + + + + + + + + + + + + + + The ejb-local-refType is used by ejb-local-ref elements for + the declaration of a reference to an enterprise bean's local + home or to the local business interface of a 3.0 bean. + The declaration consists of: + + - an optional description + - the EJB reference name used in the code of the Deployment + Component that's referencing the enterprise bean. + - the optional expected type of the referenced enterprise bean + - the optional expected local interface of the referenced + enterprise bean or the local business interface of the + referenced enterprise bean. + - the optional expected local home interface of the referenced + enterprise bean. Not applicable if this ejb-local-ref refers + to the local business interface of a 3.0 bean. + - optional ejb-link information, used to specify the + referenced enterprise bean + - optional elements to define injection of the named enterprise + bean into a component field or property. + + + + + + + + + + + + + + + + + + + + + + ejb/Payroll + + ]]> + + + + + + + + + + + + + + + The ejb-refType is used by ejb-ref elements for the + declaration of a reference to an enterprise bean's home or + to the remote business interface of a 3.0 bean. + The declaration consists of: + + - an optional description + - the EJB reference name used in the code of + the Deployment Component that's referencing the enterprise + bean. + - the optional expected type of the referenced enterprise bean + - the optional remote interface of the referenced enterprise bean + or the remote business interface of the referenced enterprise + bean + - the optional expected home interface of the referenced + enterprise bean. Not applicable if this ejb-ref + refers to the remote business interface of a 3.0 bean. + - optional ejb-link information, used to specify the + referenced enterprise bean + - optional elements to define injection of the named enterprise + bean into a component field or property + + + + + + + + + + + + + + + + + + + + + + + The ejb-ref-typeType contains the expected type of the + referenced enterprise bean. + + The ejb-ref-type designates a value + that must be one of the following: + + Entity + Session + + + + + + + + + + + + + + + + + + + This type is used to designate an empty + element when used. + + + + + + + + + + + + + + The env-entryType is used to declare an application's + environment entry. The declaration consists of an optional + description, the name of the environment entry, a type + (optional if the value is injected, otherwise required), and + an optional value. + + It also includes optional elements to define injection of + the named resource into fields or JavaBeans properties. + + If a value is not specified and injection is requested, + no injection will occur and no entry of the specified name + will be created. This allows an initial value to be + specified in the source code without being incorrectly + changed when no override has been specified. + + If a value is not specified and no injection is requested, + a value must be supplied during deployment. + + This type is used by env-entry elements. + + + + + + + + + minAmount + + ]]> + + + + + + + java.lang.Integer + + ]]> + + + + + + + 100.00 + + ]]> + + + + + + + + + + + + + + + java.lang.Boolean + java.lang.Class + com.example.Color + + ]]> + + + + + + + + + + + + + + + The elements that use this type designate the name of a + Java class or interface. The name is in the form of a + "binary name", as defined in the JLS. This is the form + of name used in Class.forName(). Tools that need the + canonical name (the name used in source code) will need + to convert this binary name to the canonical name. + + + + + + + + + + + + + + + + This type defines four different values which can designate + boolean values. This includes values yes and no which are + not designated by xsd:boolean + + + + + + + + + + + + + + + + + + + + + The icon type contains small-icon and large-icon elements + that specify the file names for small and large GIF, JPEG, + or PNG icon images used to represent the parent element in a + GUI tool. + + The xml:lang attribute defines the language that the + icon file names are provided in. Its value is "en" (English) + by default. + + + + + + + + employee-service-icon16x16.jpg + + ]]> + + + + + + + employee-service-icon32x32.jpg + + ]]> + + + + + + + + + + + + + + + + An injection target specifies a class and a name within + that class into which a resource should be injected. + + The injection target class specifies the fully qualified + class name that is the target of the injection. The + Java EE specifications describe which classes can be an + injection target. + + The injection target name specifies the target within + the specified class. The target is first looked for as a + JavaBeans property name. If not found, the target is + looked for as a field name. + + The specified resource will be injected into the target + during initialization of the class by either calling the + set method for the target property or by setting a value + into the named field. + + + + + + + + + + + + + + The following transaction isolation levels are allowed + (see documentation for the java.sql.Connection interface): + TRANSACTION_READ_UNCOMMITTED + TRANSACTION_READ_COMMITTED + TRANSACTION_REPEATABLE_READ + TRANSACTION_SERIALIZABLE + + + + + + + + + + + + + + + + + + + The java-identifierType defines a Java identifier. + The users of this type should further verify that + the content does not contain Java reserved keywords. + + + + + + + + + + + + + + + + + + This is a generic type that designates a Java primitive + type or a fully qualified name of a Java interface/type, + or an array of such types. + + + + + + + + + + + + + + + + + : + + Example: + + jdbc:mysql://localhost:3307/testdb + + ]]> + + + + + + + + + + + + + + + + + The jndi-nameType type designates a JNDI name in the + Deployment Component's environment and is relative to the + java:comp/env context. A JNDI name must be unique within the + Deployment Component. + + + + + + + + + + + + + + + com.aardvark.payroll.PayrollHome + + ]]> + + + + + + + + + + + + + + + The lifecycle-callback type specifies a method on a + class to be called when a lifecycle event occurs. + Note that each class may have only one lifecycle callback + method for any given event and that the method may not + be overloaded. + + If the lifefycle-callback-class element is missing then + the class defining the callback is assumed to be the + component class in scope at the place in the descriptor + in which the callback definition appears. + + + + + + + + + + + + + + + + + The listenerType indicates the deployment properties for a web + application listener bean. + + + + + + + + + + The listener-class element declares a class in the + application must be registered as a web + application listener bean. The value is the fully + qualified classname of the listener class. + + + + + + + + + + + + + + + + The localType defines the fully-qualified name of an + enterprise bean's local interface. + + + + + + + + + + + + + + + + The local-homeType defines the fully-qualified + name of an enterprise bean's local home interface. + + + + + + + + + + + + + + + + This type is a general type that can be used to declare + parameter/value lists. + + + + + + + + + + The param-name element contains the name of a + parameter. + + + + + + + + + The param-value element contains the value of a + parameter. + + + + + + + + + + + + + + + + The elements that use this type designate either a relative + path or an absolute path starting with a "/". + + In elements that specify a pathname to a file within the + same Deployment File, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the Deployment File's namespace. Absolute filenames (i.e., + those starting with "/") also specify names in the root of + the Deployment File's namespace. In general, relative names + are preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + + + + + + + + + + + + + + + myPersistenceContext + + + + + myPersistenceContext + + PersistenceUnit1 + + Extended + + + ]]> + + + + + + + + + The persistence-context-ref-name element specifies + the name of a persistence context reference; its + value is the environment entry name used in + Deployment Component code. The name is a JNDI name + relative to the java:comp/env context. + + + + + + + + + The Application Assembler(or BeanProvider) may use the + following syntax to avoid the need to rename persistence + units to have unique names within a Java EE application. + + The Application Assembler specifies the pathname of the + root of the persistence.xml file for the referenced + persistence unit and appends the name of the persistence + unit separated from the pathname by #. The pathname is + relative to the referencing application component jar file. + In this manner, multiple persistence units with the same + persistence unit name may be uniquely identified when the + Application Assembler cannot change persistence unit names. + + + + + + + + + + Used to specify properties for the container or persistence + provider. Vendor-specific properties may be included in + the set of properties. Properties that are not recognized + by a vendor must be ignored. Entries that make use of the + namespace javax.persistence and its subnamespaces must not + be used for vendor-specific properties. The namespace + javax.persistence is reserved for use by the specification. + + + + + + + + + + + + + + + + + The persistence-context-typeType specifies the transactional + nature of a persistence context reference. + + The value of the persistence-context-type element must be + one of the following: + Transaction + Extended + + + + + + + + + + + + + + + + + + + Specifies a name/value pair. + + + + + + + + + + + + + + + + + + + + myPersistenceUnit + + + + + myPersistenceUnit + + PersistenceUnit1 + + + + ]]> + + + + + + + + + The persistence-unit-ref-name element specifies + the name of a persistence unit reference; its + value is the environment entry name used in + Deployment Component code. The name is a JNDI name + relative to the java:comp/env context. + + + + + + + + + The Application Assembler(or BeanProvider) may use the + following syntax to avoid the need to rename persistence + units to have unique names within a Java EE application. + + The Application Assembler specifies the pathname of the + root of the persistence.xml file for the referenced + persistence unit and appends the name of the persistence + unit separated from the pathname by #. The pathname is + relative to the referencing application component jar file. + In this manner, multiple persistence units with the same + persistence unit name may be uniquely identified when the + Application Assembler cannot change persistence unit names. + + + + + + + + + + + + + + + + com.wombat.empl.EmployeeService + + ]]> + + + + + + + + + + + + + + + jms/StockQueue + + javax.jms.Queue + + + + ]]> + + + + + + + + + The resource-env-ref-name element specifies the name + of a resource environment reference; its value is + the environment entry name used in + the Deployment Component code. The name is a JNDI + name relative to the java:comp/env context and must + be unique within a Deployment Component. + + + + + + + + + The resource-env-ref-type element specifies the type + of a resource environment reference. It is the + fully qualified name of a Java language class or + interface. + + + + + + + + + + + + + + + + + jdbc/EmployeeAppDB + javax.sql.DataSource + Container + Shareable + + + ]]> + + + + + + + + + The res-ref-name element specifies the name of a + resource manager connection factory reference. + The name is a JNDI name relative to the + java:comp/env context. + The name must be unique within a Deployment File. + + + + + + + + + The res-type element specifies the type of the data + source. The type is specified by the fully qualified + Java language class or interface + expected to be implemented by the data source. + + + + + + + + + + + + + + + + + + + The res-authType specifies whether the Deployment Component + code signs on programmatically to the resource manager, or + whether the Container will sign on to the resource manager + on behalf of the Deployment Component. In the latter case, + the Container uses information that is supplied by the + Deployer. + + The value must be one of the two following: + + Application + Container + + + + + + + + + + + + + + + + + + + The res-sharing-scope type specifies whether connections + obtained through the given resource manager connection + factory reference can be shared. The value, if specified, + must be one of the two following: + + Shareable + Unshareable + + The default value is Shareable. + + + + + + + + + + + + + + + + + + + The run-asType specifies the run-as identity to be + used for the execution of a component. It contains an + optional description, and the name of a security role. + + + + + + + + + + + + + + + + + + The role-nameType designates the name of a security role. + + The name must conform to the lexical rules for a token. + + + + + + + + + + + + + + + + + This role includes all employees who are authorized + to access the employee service application. + + employee + + + ]]> + + + + + + + + + + + + + + + + + The security-role-refType contains the declaration of a + security role reference in a component's or a + Deployment Component's code. The declaration consists of an + optional description, the security role name used in the + code, and an optional link to a security role. If the + security role is not specified, the Deployer must choose an + appropriate security role. + + + + + + + + + + The value of the role-name element must be the String used + as the parameter to the + EJBContext.isCallerInRole(String roleName) method or the + HttpServletRequest.isUserInRole(String role) method. + + + + + + + + + The role-link element is a reference to a defined + security role. The role-link element must contain + the name of one of the security roles defined in the + security-role elements. + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:QName. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:boolean. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:NMTOKEN. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:anyURI. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:integer. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:positiveInteger. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:nonNegativeInteger. + + + + + + + + + + + + + + + + + + This type adds an "id" attribute to xsd:string. + + + + + + + + + + + + + + + + + + This is a special string datatype that is defined by Java EE as + a base type for defining collapsed strings. When schemas + require trailing/leading space elimination as well as + collapsing the existing whitespace, this base type may be + used. + + + + + + + + + + + + + + + + + + This simple type designates a boolean with only two + permissible values + + - true + - false + + + + + + + + + + + + + + + + + + The url-patternType contains the url pattern of the mapping. + It must follow the rules specified in Section 11.2 of the + Servlet API Specification. This pattern is assumed to be in + URL-decoded form and must not contain CR(#xD) or LF(#xA). + If it contains those characters, the container must inform + the developer with a descriptive error message. + The container must preserve all characters including whitespaces. + + + + + + + + + + + + + + + + CorporateStocks + + + + ]]> + + + + + + + + + The message-destination-name element specifies a + name for a message destination. This name must be + unique among the names of message destinations + within the Deployment File. + + + + + + + + + A product specific name that this message destination + should be mapped to. Each message-destination-ref + element that references this message destination will + define a name in the namespace of the referencing + component or in one of the other predefined namespaces. + Many application servers provide a way to map these + local names to names of resources known to the + application server. This mapped name is often a global + JNDI name, but may be a name of any form. Each of the + local names should be mapped to this same global name. + + Application servers are not required to support any + particular form or type of mapped name, nor the ability + to use mapped names. The mapped name is + product-dependent and often installation-dependent. No + use of a mapped name is portable. + + + + + + + + + The JNDI name to be looked up to resolve the message destination. + + + + + + + + + + + + + + + + jms/StockQueue + + javax.jms.Queue + + Consumes + + CorporateStocks + + + + ]]> + + + + + + + + + The message-destination-ref-name element specifies + the name of a message destination reference; its + value is the environment entry name used in + Deployment Component code. + + + + + + + + + + + + + + + + + + + + The message-destination-usageType specifies the use of the + message destination indicated by the reference. The value + indicates whether messages are consumed from the message + destination, produced for the destination, or both. The + Assembler makes use of this information in linking producers + of a destination with its consumers. + + The value of the message-destination-usage element must be + one of the following: + Consumes + Produces + ConsumesProduces + + + + + + + + + + + + + + + + + + + javax.jms.Queue + + + ]]> + + + + + + + + + + + + + + + The message-destination-linkType is used to link a message + destination reference or message-driven bean to a message + destination. + + The Assembler sets the value to reflect the flow of messages + between producers and consumers in the application. + + The value must be the message-destination-name of a message + destination in the same Deployment File or in another + Deployment File in the same Java EE application unit. + + Alternatively, the value may be composed of a path name + specifying a Deployment File containing the referenced + message destination with the message-destination-name of the + destination appended and separated from the path name by + "#". The path name is relative to the Deployment File + containing Deployment Component that is referencing the + message destination. This allows multiple message + destinations with the same name to be uniquely identified. + + + + + + + + + diff --git a/Tests/issues/1/javaee_web_services_client_1_3.xsd b/Tests/issues/1/javaee_web_services_client_1_3.xsd new file mode 100644 index 0000000..5c673ae --- /dev/null +++ b/Tests/issues/1/javaee_web_services_client_1_3.xsd @@ -0,0 +1,737 @@ + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + (C) Copyright International Business Machines Corporation 2002 + + + + + + + + + + + + The service-ref element declares a reference to a Web + service. It contains optional description, display name and + icons, a declaration of the required Service interface, + an optional WSDL document location, an optional set + of JAX-RPC mappings, an optional QName for the service element, + an optional set of Service Endpoint Interfaces to be resolved + by the container to a WSDL port, and an optional set of handlers. + + + + + + + + + + The service-ref-name element declares logical name that the + components in the module use to look up the Web service. It + is recommended that all service reference names start with + "service/". + + + + + + + + + The service-interface element declares the fully qualified class + name of the JAX-RPC Service interface the client depends on. + In most cases the value will be javax.xml.rpc.Service. A JAX-RPC + generated Service Interface class may also be specified. + + + + + + + + + The service-ref-type element declares the type of the service-ref + element that is injected or returned when a JNDI lookup is done. + This must be either a fully qualified name of Service class or + the fully qualified name of service endpoint interface class. + This is only used with JAX-WS runtime where the corresponding + @WebServiceRef annotation can be used to denote both a Service + or a Port. + + If this is not specified, then the type of service-ref element + that is injected or returned when a JNDI lookup is done is + always a Service interface/class. + + + + + + + + + The wsdl-file element contains the URI location of a WSDL + file. The location is relative to the root of the module. + + + + + + + + + The jaxrpc-mapping-file element contains the name of a file that + describes the JAX-RPC mapping between the Java interaces used by + the application and the WSDL description in the wsdl-file. The + file name is a relative path within the module file. + + This is not required when JAX-WS based runtime is used. + + + + + + + + + The service-qname element declares the specific WSDL service + element that is being refered to. It is not specified if no + wsdl-file is declared. + + + + + + + + + The port-component-ref element declares a client dependency + on the container for resolving a Service Endpoint Interface + to a WSDL port. It optionally associates the Service Endpoint + Interface with a particular port-component. This is only used + by the container for a Service.getPort(Class) method call. + + + + + + + + + + Declares the handler for a port-component. Handlers can + access the init-param name/value pairs using the + HandlerInfo interface. If port-name is not specified, the + handler is assumed to be associated with all ports of the + service. + + To be used with JAX-RPC based runtime only. + + + + + + + + + To be used with JAX-WS based runtime only. + + + + + + + + + + + + + + + + + + The port-component-ref element declares a client dependency + on the container for resolving a Service Endpoint Interface + to a WSDL port. It optionally associates the Service Endpoint + Interface with a particular port-component. This is only used + by the container for a Service.getPort(Class) method call. + + + + + + + + + The service-endpoint-interface element defines a fully qualified + Java class that represents the Service Endpoint Interface of a + WSDL port. + + + + + + + + + Used to enable or disable SOAP MTOM/XOP mechanism on the client + side for a port-component. + + Not to be specified for JAX-RPC runtime + + + + + + + + + When MTOM is enabled, binary data above this size in bytes + should be XOP encoded or sent as attachment. Default value is 0. + + Not to be specified for JAX-RPC runtime + + + + + + + + + This specifies the WS-Addressing requirements for a JAX-WS + web service. It corresponds to javax.xml.ws.soap.Addressing + annotation or its feature javax.xml.ws.soap.AddressingFeature. + + See the addressingType for more information. + + Not to be specified for JAX-RPC runtime + + + + + + + + + Corresponds to the javax.xml.ws.RespectBinding annotation + or its corresponding javax.xml.ws.RespectBindingFeature web + service feature. This is used to control whether a JAX-WS + implementation must respect/honor the contents of the + wsdl:binding in the WSDL that is associated with the service. + + Not to be specified for JAX-RPC runtime + + + + + + + + + The port-component-link element links a port-component-ref + to a specific port-component required to be made available + by a service reference. + + The value of a port-component-link must be the + port-component-name of a port-component in the same module + or another module in the same application unit. The syntax + for specification follows the syntax defined for ejb-link + in the EJB 2.0 specification. + + + + + + + + + + + + + + + + The handler-chains element defines the handlerchains associated with this + service or service endpoint. + + + + + + + + + + + + + + + + + The handler-chain element defines the handlerchain. + Handlerchain can be defined such that the handlers in the + handlerchain operate,all ports of a service, on a specific + port or on a list of protocol-bindings. The choice of elements + service-name-pattern, port-name-pattern and protocol-bindings + are used to specify whether the handlers in handler-chain are + for a service, port or protocol binding. If none of these + choices are specified with the handler-chain element then the + handlers specified in the handler-chain will be applied on + everything. + + + + + + + + + + + + + + + + + + + Defines the type used for specifying a list of + protocol-bindingType(s). For e.g. + + ##SOAP11_HTTP ##SOAP12_HTTP ##XML_HTTP + + + + + + + + + + + Defines the type used for specifying the URI for the + protocol binding used by the port-component. For + portability one could use one of the following tokens that + alias the standard binding types: + + ##SOAP11_HTTP + ##SOAP11_HTTP_MTOM + ##SOAP12_HTTP + ##SOAP12_HTTP_MTOM + ##XML_HTTP + + Other specifications could define tokens that start with ## + to alias new standard binding URIs that are introduced. + + + + + + + + + + + Defines the type that is used for specifying tokens that + start with ## which are used to alias existing standard + protocol bindings and support aliases for new standard + binding URIs that are introduced in future specifications. + + The following tokens alias the standard protocol binding + URIs: + + ##SOAP11_HTTP = "http://schemas.xmlsoap.org/wsdl/soap/http" + ##SOAP11_HTTP_MTOM = + "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true" + ##SOAP12_HTTP = "http://www.w3.org/2003/05/soap/bindings/HTTP/" + ##SOAP12_HTTP_MTOM = + "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true" + ##XML_HTTP = "http://www.w3.org/2004/08/wsdl/http" + + + + + + + + + + + + + This is used to specify the QName pattern in the + attribute service-name-pattern and port-name-pattern in + the handler-chain element + + For example, the various forms acceptable here for + service-name-pattern attribute in handler-chain element + are : + + Exact Name: service-name-pattern="ns1:EchoService" + + In this case, handlers specified in this + handler-chain element will apply to all ports with + this exact service name. The namespace prefix must + have been declared in a namespace declaration + attribute in either the start-tag of the element + where the prefix is used or in an an ancestor + element (i.e. an element in whose content the + prefixed markup occurs) + + + Pattern : service-name-pattern="ns1:EchoService*" + + In this case, handlers specified in this + handler-chain element will apply to all ports whose + Service names are like EchoService1, EchoServiceFoo + etc. The namespace prefix must have been declared in + a namespace declaration attribute in either the + start-tag of the element where the prefix is used or + in an an ancestor element (i.e. an element in whose + content the prefixed markup occurs) + + Wild Card : service-name-pattern="*" + + In this case, handlers specified in this handler-chain + element will apply to ports of all service names. + + The same can be applied to port-name attribute in + handler-chain element. + + + + + + + + + + + + + + + + This specifies the WS-Addressing requirements for a JAX-WS web service. + It corresponds to javax.xml.ws.soap.Addressing annotation or its + feature javax.xml.ws.soap.AddressingFeature. + + If the "enabled" element is "true", WS-Addressing is enabled. + It means that the endpoint supports WS-Addressing but does not require + its use. The default value for "enabled" is "true". + + If the WS-Addressing is enabled and the "required" element is "true", + it means that the endpoint requires WS-Addressing. The default value + for "required" is "false". + + If WS-Addressing is enabled, the "responses" element determines + if an endpoint requires the use of only anonymous responses, + or only non-anonymous responses, or all. The value of the "responses" + element must be one of the following: + + ANONYMOUS + NON_ANONYMOUS + ALL + + The default value for the "responses" is ALL. + + + + + + + + + + + + + + + + + + If WS-Addressing is enabled, this type determines if an endpoint + requires the use of only anonymous responses, or only non-anonymous + responses, or all. + + + + + + + + + + + + + + + + + + + + Corresponds to the javax.xml.ws.RespectBinding annotation + or its corresponding javax.xml.ws.RespectBindingFeature web + service feature. This is used to control whether a JAX-WS + implementation must respect/honor the contents of the + wsdl:binding in the WSDL that is associated with the service. + + If the "enabled" element is "true", wsdl:binding in the + associated WSDL, if any, must be respected/honored. + + + + + + + + + + + + + + + + Declares the handler for a port-component, service-ref. Handlers can + access the init-param name/value pairs using the HandlerInfo interface. + + Used in: port-component, service-ref + + + + + + + + + + Defines the name of the handler. The name must be unique within the + module. + + + + + + + + + Defines a fully qualified class name for the handler implementation. + + + + + + + + + Not to be specified for JAX-WS runtime + + + + + + + + + Defines the QName of a SOAP header that will be processed by the + handler. + + Not to be specified for JAX-WS runtime + + + + + + + + + The soap-role element contains a SOAP actor definition that the + Handler will play as a role. + + + + + + + + + The port-name element defines the WSDL port-name that a + handler should be associated with. If port-name is not + specified, the handler is assumed to be associated with + all ports of the service. + + Not to be specified for JAX-WS runtime + + + + + + + + + + + + + + + + Defines the name of the handler. The name must be unique + within the module. + + + + + + + + + + + diff --git a/Tests/issues/1/jsp_2_2.xsd b/Tests/issues/1/jsp_2_2.xsd new file mode 100644 index 0000000..fa41e42 --- /dev/null +++ b/Tests/issues/1/jsp_2_2.xsd @@ -0,0 +1,389 @@ + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + This is the XML Schema for the JSP 2.2 deployment descriptor + types. The JSP 2.2 schema contains all the special + structures and datatypes that are necessary to use JSP files + from a web application. + + The contents of this schema is used by the web-common_3_0.xsd + file to define JSP specific content. + + + + + + + + The following conventions apply to all Java EE + deployment descriptor elements unless indicated otherwise. + + - In elements that specify a pathname to a file within the + same JAR file, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the JAR file's namespace. Absolute filenames (i.e., those + starting with "/") also specify names in the root of the + JAR file's namespace. In general, relative names are + preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + + + + + + + + + + + + + The jsp-configType is used to provide global configuration + information for the JSP files in a web application. It has + two subelements, taglib and jsp-property-group. + + + + + + + + + + + + + + + + + + The jsp-file element contains the full path to a JSP file + within the web application beginning with a `/'. + + + + + + + + + + + + + + + + The jsp-property-groupType is used to group a number of + files so they can be given global property information. + All files so described are deemed to be JSP files. The + following additional properties can be described: + + - Control whether EL is ignored. + - Control whether scripting elements are invalid. + - Indicate pageEncoding information. + - Indicate that a resource is a JSP document (XML). + - Prelude and Coda automatic includes. + - Control whether the character sequence #{ is allowed + when used as a String literal. + - Control whether template text containing only + whitespaces must be removed from the response output. + - Indicate the default contentType information. + - Indicate the default buffering model for JspWriter + - Control whether error should be raised for the use of + undeclared namespaces in a JSP page. + + + + + + + + + + + Can be used to easily set the isELIgnored + property of a group of JSP pages. By default, the + EL evaluation is enabled for Web Applications using + a Servlet 2.4 or greater web.xml, and disabled + otherwise. + + + + + + + + + The valid values of page-encoding are those of the + pageEncoding page directive. It is a + translation-time error to name different encodings + in the pageEncoding attribute of the page directive + of a JSP page and in a JSP configuration element + matching the page. It is also a translation-time + error to name different encodings in the prolog + or text declaration of a document in XML syntax and + in a JSP configuration element matching the document. + It is legal to name the same encoding through + mulitple mechanisms. + + + + + + + + + Can be used to easily disable scripting in a + group of JSP pages. By default, scripting is + enabled. + + + + + + + + + If true, denotes that the group of resources + that match the URL pattern are JSP documents, + and thus must be interpreted as XML documents. + If false, the resources are assumed to not + be JSP documents, unless there is another + property group that indicates otherwise. + + + + + + + + + The include-prelude element is a context-relative + path that must correspond to an element in the + Web Application. When the element is present, + the given path will be automatically included (as + in an include directive) at the beginning of each + JSP page in this jsp-property-group. + + + + + + + + + The include-coda element is a context-relative + path that must correspond to an element in the + Web Application. When the element is present, + the given path will be automatically included (as + in an include directive) at the end of each + JSP page in this jsp-property-group. + + + + + + + + + The character sequence #{ is reserved for EL expressions. + Consequently, a translation error occurs if the #{ + character sequence is used as a String literal, unless + this element is enabled (true). Disabled (false) by + default. + + + + + + + + + Indicates that template text containing only whitespaces + must be removed from the response output. It has no + effect on JSP documents (XML syntax). Disabled (false) + by default. + + + + + + + + + The valid values of default-content-type are those of the + contentType page directive. It specifies the default + response contentType if the page directive does not include + a contentType attribute. + + + + + + + + + The valid values of buffer are those of the + buffer page directive. It specifies if buffering should be + used for the output to response, and if so, the size of the + buffer to use. + + + + + + + + + The default behavior when a tag with unknown namespace is used + in a JSP page (regular syntax) is to silently ignore it. If + set to true, then an error must be raised during the translation + time when an undeclared tag is used in a JSP page. Disabled + (false) by default. + + + + + + + + + + + + + + + + The taglibType defines the syntax for declaring in + the deployment descriptor that a tag library is + available to the application. This can be done + to override implicit map entries from TLD files and + from the container. + + + + + + + + + A taglib-uri element describes a URI identifying a + tag library used in the web application. The body + of the taglib-uri element may be either an + absolute URI specification, or a relative URI. + There should be no entries in web.xml with the + same taglib-uri value. + + + + + + + + + the taglib-location element contains the location + (as a resource relative to the root of the web + application) where to find the Tag Library + Description file for the tag library. + + + + + + + + + diff --git a/Tests/issues/1/web-app_3_0.xsd b/Tests/issues/1/web-app_3_0.xsd new file mode 100644 index 0000000..bbcdf43 --- /dev/null +++ b/Tests/issues/1/web-app_3_0.xsd @@ -0,0 +1,272 @@ + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + ... + + + The instance documents may indicate the published version of + the schema using the xsi:schemaLocation attribute for Java EE + namespace with the following location: + + http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd + + ]]> + + + + + + + The following conventions apply to all Java EE + deployment descriptor elements unless indicated otherwise. + + - In elements that specify a pathname to a file within the + same JAR file, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the JAR file's namespace. Absolute filenames (i.e., those + starting with "/") also specify names in the root of the + JAR file's namespace. In general, relative names are + preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + + + + + + + + + + + + + The web-app element is the root of the deployment + descriptor for a web application. Note that the sub-elements + of this element can be in the arbitrary order. Because of + that, the multiplicity of the elements of distributable, + session-config, welcome-file-list, jsp-config, login-config, + and locale-encoding-mapping-list was changed from "?" to "*" + in this schema. However, the deployment descriptor instance + file must not contain multiple elements of session-config, + jsp-config, and login-config. When there are multiple elements of + welcome-file-list or locale-encoding-mapping-list, the container + must concatenate the element contents. The multiple occurence + of the element distributable is redundant and the container + treats that case exactly in the same way when there is only + one distributable. + + + + + + + + The servlet element contains the name of a servlet. + The name must be unique within the web application. + + + + + + + + + + + The filter element contains the name of a filter. + The name must be unique within the web application. + + + + + + + + + + + The ejb-local-ref-name element contains the name of an EJB + reference. The EJB reference is an entry in the web + application's environment and is relative to the + java:comp/env context. The name must be unique within + the web application. + + It is recommended that name is prefixed with "ejb/". + + + + + + + + + + + The ejb-ref-name element contains the name of an EJB + reference. The EJB reference is an entry in the web + application's environment and is relative to the + java:comp/env context. The name must be unique within + the web application. + + It is recommended that name is prefixed with "ejb/". + + + + + + + + + + + The resource-env-ref-name element specifies the name of + a resource environment reference; its value is the + environment entry name used in the web application code. + The name is a JNDI name relative to the java:comp/env + context and must be unique within a web application. + + + + + + + + + + + The message-destination-ref-name element specifies the name of + a message destination reference; its value is the + environment entry name used in the web application code. + The name is a JNDI name relative to the java:comp/env + context and must be unique within a web application. + + + + + + + + + + + The res-ref-name element specifies the name of a + resource manager connection factory reference. The name + is a JNDI name relative to the java:comp/env context. + The name must be unique within a web application. + + + + + + + + + + + The env-entry-name element contains the name of a web + application's environment entry. The name is a JNDI + name relative to the java:comp/env context. The name + must be unique within a web application. + + + + + + + + + + + A role-name-key is specified to allow the references + from the security-role-refs. + + + + + + + + + + + The keyref indicates the references from + security-role-ref to a specified role-name. + + + + + + + + + diff --git a/Tests/issues/1/web-common_3_0.xsd b/Tests/issues/1/web-common_3_0.xsd new file mode 100644 index 0000000..f994bc2 --- /dev/null +++ b/Tests/issues/1/web-common_3_0.xsd @@ -0,0 +1,1575 @@ + + + + + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved. + + The contents of this file are subject to the terms of either the + GNU General Public License Version 2 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with + the License. You can obtain a copy of the License at + https://glassfish.dev.java.net/public/CDDL+GPL.html or + glassfish/bootstrap/legal/LICENSE.txt. See the License for the + specific language governing permissions and limitations under the + License. + + When distributing the software, include this License Header + Notice in each file and include the License file at + glassfish/bootstrap/legal/LICENSE.txt. Sun designates this + particular file as subject to the "Classpath" exception as + provided by Sun in the GPL Version 2 section of the License file + that accompanied this code. If applicable, add the following + below the License Header, with the fields enclosed by brackets [] + replaced by your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + Contributor(s): + + If you wish your version of this file to be governed by only the + CDDL or only the GPL Version 2, indicate your decision by adding + "[Contributor] elects to include this software in this + distribution under the [CDDL or GPL Version 2] license." If you + don't indicate a single choice of license, a recipient has the + option to distribute your version of this file under either the + CDDL, the GPL Version 2 or to extend the choice of license to its + licensees as provided above. However, if you add GPL Version 2 + code and therefore, elected the GPL Version 2 license, then the + option applies only if the new code is made subject to such + option by the copyright holder. + + + + + + + + ... + + + The instance documents may indicate the published version of + the schema using the xsi:schemaLocation attribute for Java EE + namespace with the following location: + + http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd + + ]]> + + + + + + + The following conventions apply to all Java EE + deployment descriptor elements unless indicated otherwise. + + - In elements that specify a pathname to a file within the + same JAR file, relative filenames (i.e., those not + starting with "/") are considered relative to the root of + the JAR file's namespace. Absolute filenames (i.e., those + starting with "/") also specify names in the root of the + JAR file's namespace. In general, relative names are + preferred. The exception is .war files where absolute + names are preferred for consistency with the Servlet API. + + + + + + + + + + + + + + + + + The context-param element contains the declaration + of a web application's servlet context + initialization parameters. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The metadata-complete attribute defines whether this + deployment descriptor and other related deployment + descriptors for this module (e.g., web service + descriptors) are complete, or whether the class + files available to this module and packaged with + this application should be examined for annotations + that specify deployment information. + + If metadata-complete is set to "true", the deployment + tool must ignore any annotations that specify deployment + information, which might be present in the class files + of the application. + + If metadata-complete is not specified or is set to + "false", the deployment tool must examine the class + files of the application for annotations, as + specified by the specifications. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The auth-constraintType indicates the user roles that + should be permitted access to this resource + collection. The role-name used here must either correspond + to the role-name of one of the security-role elements + defined for this web application, or be the specially + reserved role-name "*" that is a compact syntax for + indicating all roles in the web application. If both "*" + and rolenames appear, the container interprets this as all + roles. If no roles are defined, no user is allowed access + to the portion of the web application described by the + containing security-constraint. The container matches + role names case sensitively when determining access. + + + + + + + + + + + + + + + + + + The auth-methodType is used to configure the authentication + mechanism for the web application. As a prerequisite to + gaining access to any web resources which are protected by + an authorization constraint, a user must have authenticated + using the configured mechanism. Legal values are "BASIC", + "DIGEST", "FORM", "CLIENT-CERT", or a vendor-specific + authentication scheme. + + Used in: login-config + + + + + + + + + + + + + + + + The dispatcher has five legal values: FORWARD, REQUEST, + INCLUDE, ASYNC, and ERROR. + + A value of FORWARD means the Filter will be applied under + RequestDispatcher.forward() calls. + A value of REQUEST means the Filter will be applied under + ordinary client calls to the path or servlet. + A value of INCLUDE means the Filter will be applied under + RequestDispatcher.include() calls. + A value of ASYNC means the Filter will be applied under + calls dispatched from an AsyncContext. + A value of ERROR means the Filter will be applied under the + error page mechanism. + + The absence of any dispatcher elements in a filter-mapping + indicates a default of applying filters only under ordinary + client calls to the path or servlet. + + + + + + + + + + + + + + + + + + + + + + The error-code contains an HTTP error code, ex: 404 + + Used in: error-page + + + + + + + + + + + + + + + + + + + The error-pageType contains a mapping between an error code + or exception type to the path of a resource in the web + application. + + Error-page declarations using the exception-type element in + the deployment descriptor must be unique up to the class name of + the exception-type. Similarly, error-page declarations using the + status-code element must be unique in the deployment descriptor + up to the status code. + + Used in: web-app + + + + + + + + + + + The exception-type contains a fully qualified class + name of a Java exception type. + + + + + + + + + + The location element contains the location of the + resource in the web application relative to the root of + the web application. The value of the location must have + a leading `/'. + + + + + + + + + + + + + + + + The filterType is used to declare a filter in the web + application. The filter is mapped to either a servlet or a + URL pattern in the filter-mapping element, using the + filter-name value to reference. Filters can access the + initialization parameters declared in the deployment + descriptor at runtime via the FilterConfig interface. + + Used in: web-app + + + + + + + + + + + The fully qualified classname of the filter. + + + + + + + + + + The init-param element contains a name/value pair as + an initialization param of a servlet filter + + + + + + + + + + + + + + + + Declaration of the filter mappings in this web + application is done by using filter-mappingType. + The container uses the filter-mapping + declarations to decide which filters to apply to a request, + and in what order. The container matches the request URI to + a Servlet in the normal way. To determine which filters to + apply it matches filter-mapping declarations either on + servlet-name, or on url-pattern for each filter-mapping + element, depending on which style is used. The order in + which filters are invoked is the order in which + filter-mapping declarations that match a request URI for a + servlet appear in the list of filter-mapping elements.The + filter-name value must be the value of the filter-name + sub-elements of one of the filter declarations in the + deployment descriptor. + + + + + + + + + + + + + + + + + + + + + + This type defines a string which contains at least one + character. + + + + + + + + + + + + + + + + + + The logical name of the filter is declare + by using filter-nameType. This name is used to map the + filter. Each filter name is unique within the web + application. + + Used in: filter, filter-mapping + + + + + + + + + + + + + + + + The form-login-configType specifies the login and error + pages that should be used in form based login. If form based + authentication is not used, these elements are ignored. + + Used in: login-config + + + + + + + + + The form-login-page element defines the location in the web + app where the page that can be used for login can be + found. The path begins with a leading / and is interpreted + relative to the root of the WAR. + + + + + + + + + The form-error-page element defines the location in + the web app where the error page that is displayed + when login is not successful can be found. + The path begins with a leading / and is interpreted + relative to the root of the WAR. + + + + + + + + + + + + + A HTTP method type as defined in HTTP 1.1 section 2.2. + + + + + + + + + + + + + + + + + + + + + + + + + + The login-configType is used to configure the authentication + method that should be used, the realm name that should be + used for this application, and the attributes that are + needed by the form login mechanism. + + Used in: web-app + + + + + + + + + + The realm name element specifies the realm name to + use in HTTP Basic authorization. + + + + + + + + + + + + + + + + + The mime-mappingType defines a mapping between an extension + and a mime type. + + Used in: web-app + + + + + + + + The extension element contains a string describing an + extension. example: "txt" + + + + + + + + + + + + + + + + + The mime-typeType is used to indicate a defined mime type. + + Example: + "text/plain" + + Used in: mime-mapping + + + + + + + + + + + + + + + + + + The security-constraintType is used to associate + security constraints with one or more web resource + collections + + Used in: web-app + + + + + + + + + + + + + + + + + + + + The servletType is used to declare a servlet. + It contains the declarative data of a + servlet. If a jsp-file is specified and the load-on-startup + element is present, then the JSP should be precompiled and + loaded. + + Used in: web-app + + + + + + + + + + + + The servlet-class element contains the fully + qualified class name of the servlet. + + + + + + + + + + + + The load-on-startup element indicates that this + servlet should be loaded (instantiated and have + its init() called) on the startup of the web + application. The optional contents of these + element must be an integer indicating the order in + which the servlet should be loaded. If the value + is a negative integer, or the element is not + present, the container is free to load the servlet + whenever it chooses. If the value is a positive + integer or 0, the container must load and + initialize the servlet as the application is + deployed. The container must guarantee that + servlets marked with lower integers are loaded + before servlets marked with higher integers. The + container may choose the order of loading of + servlets with the same load-on-start-up value. + + + + + + + + + + + + + + + + + + + + + The servlet-mappingType defines a mapping between a + servlet and a url pattern. + + Used in: web-app + + + + + + + + + + + + + + + + + + The servlet-name element contains the canonical name of the + servlet. Each servlet name is unique within the web + application. + + + + + + + + + + + + + + + + The session-configType defines the session parameters + for this web application. + + Used in: web-app + + + + + + + + + The session-timeout element defines the default + session timeout interval for all sessions created + in this web application. The specified timeout + must be expressed in a whole number of minutes. + If the timeout is 0 or less, the container ensures + the default behaviour of sessions is never to time + out. If this element is not specified, the container + must set its default timeout period. + + + + + + + + + The cookie-config element defines the configuration of the + session tracking cookies created by this web application. + + + + + + + + + The tracking-mode element defines the tracking modes + for sessions created by this web application + + + + + + + + + + + + + + + + The cookie-configType defines the configuration for the + session tracking cookies of this web application. + + Used in: session-config + + + + + + + + + The name that will be assigned to any session tracking + cookies created by this web application. + The default is JSESSIONID + + + + + + + + + The domain name that will be assigned to any session tracking + cookies created by this web application. + + + + + + + + + The path that will be assigned to any session tracking + cookies created by this web application. + + + + + + + + + The comment that will be assigned to any session tracking + cookies created by this web application. + + + + + + + + + Specifies whether any session tracking cookies created + by this web application will be marked as HttpOnly + + + + + + + + + Specifies whether any session tracking cookies created + by this web application will be marked as secure + even if the request that initiated the corresponding session + is using plain HTTP instead of HTTPS + + + + + + + + + The lifetime (in seconds) that will be assigned to any + session tracking cookies created by this web application. + Default is -1 + + + + + + + + + + + + + + + + The name that will be assigned to any session tracking + cookies created by this web application. + The default is JSESSIONID + + Used in: cookie-config + + + + + + + + + + + + + + + + The domain name that will be assigned to any session tracking + cookies created by this web application. + + Used in: cookie-config + + + + + + + + + + + + + + + + The path that will be assigned to any session tracking + cookies created by this web application. + + Used in: cookie-config + + + + + + + + + + + + + + + + The comment that will be assigned to any session tracking + cookies created by this web application. + + Used in: cookie-config + + + + + + + + + + + + + + + + The tracking modes for sessions created by this web + application + + Used in: session-config + + + + + + + + + + + + + + + + + + + + The transport-guaranteeType specifies that the communication + between client and server should be NONE, INTEGRAL, or + CONFIDENTIAL. NONE means that the application does not + require any transport guarantees. A value of INTEGRAL means + that the application requires that the data sent between the + client and server be sent in such a way that it can't be + changed in transit. CONFIDENTIAL means that the application + requires that the data be transmitted in a fashion that + prevents other entities from observing the contents of the + transmission. In most cases, the presence of the INTEGRAL or + CONFIDENTIAL flag will indicate that the use of SSL is + required. + + Used in: user-data-constraint + + + + + + + + + + + + + + + + + + + + The user-data-constraintType is used to indicate how + data communicated between the client and container should be + protected. + + Used in: security-constraint + + + + + + + + + + + + + + + + + + The elements that use this type designate a path starting + with a "/" and interpreted relative to the root of a WAR + file. + + + + + + + + + + + + + + + This type contains the recognized versions of + web-application supported. It is used to designate the + version of the web application. + + + + + + + + + + + + + + + + The web-resource-collectionType is used to identify the + resources and HTTP methods on those resources to which a + security constraint applies. If no HTTP methods are specified, + then the security constraint applies to all HTTP methods. + If HTTP methods are specified by http-method-omission + elements, the security constraint applies to all methods + except those identified in the collection. + http-method-omission and http-method elements are never + mixed in the same collection. + + Used in: security-constraint + + + + + + + + + The web-resource-name contains the name of this web + resource collection. + + + + + + + + + + + + Each http-method names an HTTP method to which the + constraint applies. + + + + + + + + + Each http-method-omission names an HTTP method to + which the constraint does not apply. + + + + + + + + + + + + + + + + + The welcome-file-list contains an ordered list of welcome + files elements. + + Used in: web-app + + + + + + + + + The welcome-file element contains file name to use + as a default welcome file, such as index.html + + + + + + + + + + + + + The localeType defines valid locale defined by ISO-639-1 + and ISO-3166. + + + + + + + + + + + + + The encodingType defines IANA character sets. + + + + + + + + + + + + + + + + The locale-encoding-mapping-list contains one or more + locale-encoding-mapping(s). + + + + + + + + + + + + + + + + + The locale-encoding-mapping contains locale name and + encoding name. The locale name must be either "Language-code", + such as "ja", defined by ISO-639 or "Language-code_Country-code", + such as "ja_JP". "Country code" is defined by ISO-3166. + + + + + + + + + + + + + + + + + + This element indicates that the ordering sub-element in which + it was placed should take special action regarding the ordering + of this application resource relative to other application + configuration resources. + See section 8.2.2 of the specification for details. + + + + + + + + + + + + + + Please see section 8.2.2 of the specification for details. + + + + + + + + + + + + + + + + + Please see section 8.2.2 of the specification for details. + + + + + + + + + + + + + + + + + This element contains a sequence of "name" elements, each of + which + refers to an application configuration resource by the "name" + declared on its web.xml fragment. This element can also contain + a single "others" element which specifies that this document + comes + before or after other documents within the application. + See section 8.2.2 of the specification for details. + + + + + + + + + + + + + + + + + This element specifies configuration information related to the + handling of multipart/form-data requests. + + + + + + + + + The directory location where uploaded files will be stored + + + + + + + + + The maximum size limit of uploaded files + + + + + + + + + The maximum size limit of multipart/form-data requests + + + + + + + + + The size threshold after which an uploaded file will be + written to disk + + + + + + + + diff --git a/Tests/issues/1/xml.xsd b/Tests/issues/1/xml.xsd new file mode 100644 index 0000000..aea7d0d --- /dev/null +++ b/Tests/issues/1/xml.xsd @@ -0,0 +1,287 @@ + + + + + + +
+

About the XML namespace

+ +
+

+ This schema document describes the XML namespace, in a form + suitable for import by other schema documents. +

+

+ See + http://www.w3.org/XML/1998/namespace.html and + + http://www.w3.org/TR/REC-xml for information + about this namespace. +

+

+ Note that local names in this namespace are intended to be + defined only by the World Wide Web Consortium or its subgroups. + The names currently defined in this namespace are listed below. + They should not be used with conflicting semantics by any Working + Group, specification, or document instance. +

+

+ See further below in this document for more information about how to refer to this schema document from your own + XSD schema documents and about the + namespace-versioning policy governing this schema document. +

+
+
+
+
+ + + + +
+ +

lang (as an attribute name)

+

+ denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification.

+ +
+
+

Notes

+

+ Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. +

+

+ See BCP 47 at + http://www.rfc-editor.org/rfc/bcp/bcp47.txt + and the IANA language subtag registry at + + http://www.iana.org/assignments/language-subtag-registry + for further information. +

+

+ The union allows for the 'un-declaration' of xml:lang with + the empty string. +

+
+
+
+ + + + + + + + + +
+ + + + +
+ +

space (as an attribute name)

+

+ denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification.

+ +
+
+
+ + + + + + +
+ + + +
+ +

base (as an attribute name)

+

+ denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification.

+ +

+ See http://www.w3.org/TR/xmlbase/ + for information about this attribute. +

+
+
+
+
+ + + + +
+ +

id (as an attribute name)

+

+ denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification.

+ +

+ See http://www.w3.org/TR/xml-id/ + for information about this attribute. +

+
+
+
+
+ + + + + + + + + + +
+ +

Father (in any context at all)

+ +
+

+ denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: +

+
+

+ In appreciation for his vision, leadership and + dedication the W3C XML Plenary on this 10th day of + February, 2000, reserves for Jon Bosak in perpetuity + the XML name "xml:Father". +

+
+
+
+
+
+ + + +
+

About this schema document

+ +
+

+ This schema defines attributes and an attribute group suitable + for use by schemas wishing to allow xml:base, + xml:lang, xml:space or + xml:id attributes on elements they define. +

+

+ To enable this, such a schema must import this schema for + the XML namespace, e.g. as follows: +

+
+          <schema . . .>
+           . . .
+           <import namespace="http://www.w3.org/XML/1998/namespace"
+                      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+     
+

+ or +

+
+           <import namespace="http://www.w3.org/XML/1998/namespace"
+                      schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+     
+

+ Subsequently, qualified reference to any of the attributes or the + group defined below will have the desired effect, e.g. +

+
+          <type . . .>
+           . . .
+           <attributeGroup ref="xml:specialAttrs"/>
+     
+

+ will define a type which will schema-validate an instance element + with any of those attributes. +

+
+
+
+
+ + + +
+

Versioning policy for this schema document

+
+

+ In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + + http://www.w3.org/2009/01/xml.xsd. +

+

+ At the date of issue it can also be found at + + http://www.w3.org/2001/xml.xsd. +

+

+ The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML + Schema itself, or with the XML namespace itself. In other words, + if the XML Schema or XML namespaces change, the version of this + document at + http://www.w3.org/2001/xml.xsd + + will change accordingly; the version at + + http://www.w3.org/2009/01/xml.xsd + + will not change. +

+

+ Previous dated (and unchanging) versions of this schema + document are at: +

+ +
+
+
+
+ +
+ diff --git a/Tests/issues/2/Issue 2.url b/Tests/issues/2/Issue 2.url new file mode 100644 index 0000000..c43da47 --- /dev/null +++ b/Tests/issues/2/Issue 2.url @@ -0,0 +1,2 @@ +[InternetShortcut] +URL=https://github.com/dgis/xsddiagram/issues/2 diff --git a/Tests/issues/2/spring-beans-3.0.xsd b/Tests/issues/2/spring-beans-3.0.xsd new file mode 100644 index 0000000..dce67a3 --- /dev/null +++ b/Tests/issues/2/spring-beans-3.0.xsd @@ -0,0 +1,1152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ' element. + ]]> + + + + + + + + + + ' element. + ]]> + + + + + + + + + + + + + ' element for the semantic details of autowire candidate beans. + ]]> + + + + + ' element. + ]]> + + + + + ' element. + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + element (or "ref" + attribute). We recommend this in most cases as it makes documentation + more explicit. + + Note that this default mode also allows for annotation-driven autowiring, + if activated. "no" refers to externally driven autowiring only, not + affecting any autowiring demands that the bean class itself expresses. + + 2. "byName" + Autowiring by property name. If a bean of class Cat exposes a "dog" + property, Spring will try to set this to the value of the bean "dog" + in the current container. If there is no matching bean by name, nothing + special happens. + + 3. "byType" + Autowiring if there is exactly one bean of the property type in the + container. If there is more than one, a fatal error is raised, and + you cannot use byType autowiring for that bean. If there is none, + nothing special happens. + + 4. "constructor" + Analogous to "byType" for constructor arguments. If there is not exactly + one bean of the constructor argument type in the bean factory, a fatal + error is raised. + + Note that explicit dependencies, i.e. "property" and "constructor-arg" + elements, always override autowiring. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " element. + ]]> + + + + + ..." element. + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ". + ]]> + + + + + ..." element. + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ". + ]]> + + + + + ..." + element. + ]]> + + + + + ". + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XSDDiagram.exe b/XSDDiagram.exe index ed696a4..1f801d0 100644 Binary files a/XSDDiagram.exe and b/XSDDiagram.exe differ diff --git a/XSDDiagram2008.csproj b/XSDDiagram2008.csproj index 43dfbab..adced49 100644 --- a/XSDDiagram2008.csproj +++ b/XSDDiagram2008.csproj @@ -113,6 +113,12 @@ ErrorReportForm.cs + + Form + + + LoginPromptForm.cs + Form @@ -141,6 +147,9 @@ Designer ErrorReportForm.cs + + LoginPromptForm.cs + Designer MainForm.cs diff --git a/XSDDiagram2010.csproj b/XSDDiagram2010.csproj index f6dd693..bd174d1 100644 --- a/XSDDiagram2010.csproj +++ b/XSDDiagram2010.csproj @@ -20,7 +20,6 @@ true GlobalSuppressions.cs prompt - -r COLLADA -e 3 -z 200 /home/dgis/Downloads/collada_schema_1_4.xsd 4 false @@ -65,7 +64,6 @@ DEBUG;TRACE prompt 4 - -r COLLADA -e 3 -z 200 -y /home/dgis/Downloads/collada_schema_1_4.xsd pdbonly diff --git a/XSDDiagramConsole.exe b/XSDDiagramConsole.exe index 6afb564..9acdc8c 100644 Binary files a/XSDDiagramConsole.exe and b/XSDDiagramConsole.exe differ diff --git a/XSDDiagrams/Parsing/Schema.cs b/XSDDiagrams/Parsing/Schema.cs index ab9997b..fbfdad9 100644 --- a/XSDDiagrams/Parsing/Schema.cs +++ b/XSDDiagrams/Parsing/Schema.cs @@ -51,7 +51,7 @@ namespace XSDDiagram public IList LoadError { get { return loadError; } } public IList XsdFilenames { get { return listOfXsdFilename; } } - public delegate bool RequestCredentialEventHandler(string url, string realm, out string username, out string password); + public delegate bool RequestCredentialEventHandler(string url, string realm, int attemptCount, out string username, out string password); public event RequestCredentialEventHandler RequestCredential; public void LoadSchema(string fileName) @@ -65,7 +65,16 @@ namespace XSDDiagram this.loadError.Clear(); this.listOfXsdFilename.Clear(); - ImportSchema(fileName); + string url = fileName.Trim(); + if (url.IndexOf("http://") == 0 || url.IndexOf("https://") == 0) + { + string basePath = Path.GetTempPath(); //Environment.CurrentDirectory; + string f = LoadSchemaFromUrl(basePath, url); + if (f != null) + fileName = f; + } + + ImportSchema(fileName); } private void ImportSchema(string fileName) @@ -130,60 +139,9 @@ namespace XSDDiagram string url = schemaLocation.Trim(); if (url.IndexOf("http://") == 0 || url.IndexOf("https://") == 0) { - Uri uri = new Uri(url); - if (uri.Segments.Length > 0) - { - string fileNameToImport = uri.Segments[uri.Segments.Length - 1]; - loadedFileName = basePath + Path.DirectorySeparatorChar + fileNameToImport; - if (!File.Exists(loadedFileName)) - { - WebClient webClient = new WebClient(); - bool tryAgain = false; - do - { - try - { - //webClient.DownloadFile(uri, loadedFileName); - tryAgain = false; - string importedXsdFile = webClient.DownloadString(uri); - - string importedXsdFileWithoutDTD = new Regex(@"]*>", RegexOptions.Singleline | RegexOptions.IgnoreCase).Replace(importedXsdFile, String.Empty); - - using (StreamWriter outfile = new StreamWriter(loadedFileName)) - { - outfile.Write(importedXsdFileWithoutDTD); - } - } - catch (WebException ex) - { - if (ex.Response is HttpWebResponse) - { - HttpWebResponse response = ex.Response as HttpWebResponse; - if (response != null && RequestCredential != null && (response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden)) - { - string username = "", password = ""; - if (RequestCredential(url, "", out username, out password)) - { - webClient.Credentials = new System.Net.NetworkCredential(username, password); - tryAgain = true; - } - } - } - if (!tryAgain) - { - this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString()); - loadedFileName = null; - } - } - catch (Exception ex) - { - this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString()); - loadedFileName = null; - } - } - while (tryAgain); - } - } + string f = LoadSchemaFromUrl(basePath, url); + if (f != null) + loadedFileName = f; } } @@ -249,6 +207,217 @@ namespace XSDDiagram } } + private string LoadSchemaFromUrl(string basePath, string url) + { + Uri uri = new Uri(url); + if (uri.Segments.Length > 0) + { + string fileNameToImport = uri.Segments[uri.Segments.Length - 1]; + string loadedFileName = Path.Combine(basePath, fileNameToImport); + if (!File.Exists(loadedFileName)) + { + WebClient webClient = new WebClient(); + bool tryAgain = false; + int attemptCount = 0; + do + { + try + { + //webClient.DownloadFile(uri, loadedFileName); + tryAgain = false; + string importedXsdFile = webClient.DownloadString(uri); + + string importedXsdFileWithoutDTD = new Regex(@"]*>", RegexOptions.Singleline | RegexOptions.IgnoreCase).Replace(importedXsdFile, String.Empty); + + using (StreamWriter outfile = new StreamWriter(loadedFileName)) + { + outfile.Write(importedXsdFileWithoutDTD); + } + } + catch (WebException ex) + { + if (ex.Response is HttpWebResponse) + { + HttpWebResponse response = ex.Response as HttpWebResponse; + if (response != null && RequestCredential != null && (response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden)) + { + string username = "", password = ""; + if (RequestCredential(url, "", ++attemptCount, out username, out password)) + { + webClient.Credentials = new System.Net.NetworkCredential(username, password); + tryAgain = true; + } + } + } + if (!tryAgain) + { + this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString()); + loadedFileName = null; + } + } + catch (Exception ex) + { + this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString()); + loadedFileName = null; + } + } + while (tryAgain); + } + return loadedFileName; + } + return null; + } + + //private void ParseSchema(string fileName, XMLSchema.schema schemaDOM) + //{ + // string basePath = Path.GetDirectoryName(fileName); + // if (schemaDOM.Items != null) + // { + // foreach (XMLSchema.openAttrs openAttrs in schemaDOM.Items) + // { + // string loadedFileName = ""; + // string schemaLocation = ""; + + // if (openAttrs is XMLSchema.include) + // { + // XMLSchema.include include = openAttrs as XMLSchema.include; + // if (include.schemaLocation != null) + // schemaLocation = include.schemaLocation; + // } + // else if (openAttrs is XMLSchema.import) + // { + // XMLSchema.import import = openAttrs as XMLSchema.import; + // if (import.schemaLocation != null) + // schemaLocation = import.schemaLocation; + // } + + // if (!string.IsNullOrEmpty(schemaLocation)) + // { + // loadedFileName = basePath + Path.DirectorySeparatorChar + schemaLocation.Replace('/', Path.DirectorySeparatorChar); + + // string url = schemaLocation.Trim(); + // if (url.IndexOf("http://") == 0 || url.IndexOf("https://") == 0) + // { + // Uri uri = new Uri(url); + // if (uri.Segments.Length > 0) + // { + // string fileNameToImport = uri.Segments[uri.Segments.Length - 1]; + // loadedFileName = basePath + Path.DirectorySeparatorChar + fileNameToImport; + // if (!File.Exists(loadedFileName)) + // { + // WebClient webClient = new WebClient(); + // bool tryAgain = false; + // int attemptCount = 0; + // do + // { + // try + // { + // //webClient.DownloadFile(uri, loadedFileName); + // tryAgain = false; + // string importedXsdFile = webClient.DownloadString(uri); + + // string importedXsdFileWithoutDTD = new Regex(@"]*>", RegexOptions.Singleline | RegexOptions.IgnoreCase).Replace(importedXsdFile, String.Empty); + + // using (StreamWriter outfile = new StreamWriter(loadedFileName)) + // { + // outfile.Write(importedXsdFileWithoutDTD); + // } + // } + // catch (WebException ex) + // { + // if (ex.Response is HttpWebResponse) + // { + // HttpWebResponse response = ex.Response as HttpWebResponse; + // if (response != null && RequestCredential != null && (response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden)) + // { + // string username = "", password = ""; + // if (RequestCredential(url, "", ++attemptCount, out username, out password)) + // { + // webClient.Credentials = new System.Net.NetworkCredential(username, password); + // tryAgain = true; + // } + // } + // } + // if (!tryAgain) + // { + // this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString()); + // loadedFileName = null; + // } + // } + // catch (Exception ex) + // { + // this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString()); + // loadedFileName = null; + // } + // } + // while (tryAgain); + // } + // } + // } + // } + + // if (!string.IsNullOrEmpty(loadedFileName)) + // ImportSchema(loadedFileName); + // } + // } + + // string nameSpace = schemaDOM.targetNamespace; + + // if (schemaDOM.Items1 != null) + // { + // foreach (XMLSchema.openAttrs openAttrs in schemaDOM.Items1) + // { + // if (openAttrs is XMLSchema.element) + // { + // XMLSchema.element element = openAttrs as XMLSchema.element; + // XSDObject xsdObject = new XSDObject(fileName, element.name, nameSpace, "element", element); + // this.hashtableElementsByName[xsdObject.FullName] = xsdObject; + + // if (this.firstElement == null) + // this.firstElement = xsdObject; + + // elements.Add(xsdObject); + // } + // else if (openAttrs is XMLSchema.group) + // { + // XMLSchema.group group = openAttrs as XMLSchema.group; + // XSDObject xsdObject = new XSDObject(fileName, group.name, nameSpace, "group", group); + // this.hashtableElementsByName[xsdObject.FullName] = xsdObject; + + // elements.Add(xsdObject); + // } + // else if (openAttrs is XMLSchema.simpleType) + // { + // XMLSchema.simpleType simpleType = openAttrs as XMLSchema.simpleType; + // XSDObject xsdObject = new XSDObject(fileName, simpleType.name, nameSpace, "simpleType", simpleType); + // this.hashtableElementsByName[xsdObject.FullName] = xsdObject; + + // elements.Add(xsdObject); + // } + // else if (openAttrs is XMLSchema.complexType) + // { + // XMLSchema.complexType complexType = openAttrs as XMLSchema.complexType; + // XSDObject xsdObject = new XSDObject(fileName, complexType.name, nameSpace, "complexType", complexType); + // this.hashtableElementsByName[xsdObject.FullName] = xsdObject; + + // elements.Add(xsdObject); + // } + // else if (openAttrs is XMLSchema.attribute) + // { + // XMLSchema.attribute attribute = openAttrs as XMLSchema.attribute; + // XSDAttribute xsdAttribute = new XSDAttribute(fileName, attribute.name, nameSpace, "attribute", attribute.@ref != null, attribute.@default, attribute.use.ToString(), attribute); + // this.hashtableAttributesByName[xsdAttribute.FullName] = xsdAttribute; + // } + // else if (openAttrs is XMLSchema.attributeGroup) + // { + // XMLSchema.attributeGroup attributeGroup = openAttrs as XMLSchema.attributeGroup; + // XSDAttributeGroup xsdAttributeGroup = new XSDAttributeGroup(fileName, attributeGroup.name, nameSpace, "attributeGroup", attributeGroup is XMLSchema.attributeGroupRef, attributeGroup); + // this.hashtableAttributesByName[xsdAttributeGroup.FullName] = xsdAttributeGroup; + // } + // } + // } + //} + void schemaSerializer_UnknownAttribute(object sender, XmlAttributeEventArgs e) { this.loadError.Add("Unkonwn attribute (" + e.LineNumber + ", " + e.LinePosition + "): " + e.Attr.Name); diff --git a/XSDDiagrams/Rendering/DiagramExporter.cs b/XSDDiagrams/Rendering/DiagramExporter.cs index 1ea3d8b..6edcbb2 100644 --- a/XSDDiagrams/Rendering/DiagramExporter.cs +++ b/XSDDiagrams/Rendering/DiagramExporter.cs @@ -114,7 +114,7 @@ namespace XSDDiagram.Rendering String.Format("Do you agree to generate a {0}x{1} image?", bbox.Width, bbox.Height)); if (bypassAlert) { - Bitmap bitmap = new Bitmap(bbox.Width, bbox.Height); + Bitmap bitmap = new Bitmap(bbox.Width, bbox.Height); Graphics graphics = Graphics.FromImage(bitmap); graphics.FillRectangle(Brushes.White, 0, 0, bbox.Width, bbox.Height); DiagramGdiRenderer.Draw(_diagram, graphics); diff --git a/test.bat b/test.bat new file mode 100644 index 0000000..574ff3f --- /dev/null +++ b/test.bat @@ -0,0 +1,11 @@ +start "" /wait XSDDiagram.exe -r COLLADA -e 3 http://www.khronos.org/files/collada_schema_1_4_1.xsd +start "" /wait XSDDiagram.exe Tests\COLLADASchema_141.xsd +start "" /wait XSDDiagram.exe -r sphere -r COLLADA -e 3 Tests\COLLADASchema_141.xsd +start "" /wait XSDDiagramConsole.exe -o Tests\file.png -r COLLADA -e 3 -z 200 Tests\COLLADASchema_141.xsd +start "" /wait XSDDiagramConsole.exe -o Tests\file.jpg -r COLLADA -e 3 -z 200 Tests\COLLADASchema_141.xsd +start "" /wait XSDDiagramConsole.exe -o Tests\file.emf -r COLLADA -e 3 Tests\COLLADASchema_141.xsd +start "" /wait XSDDiagramConsole.exe -o Tests\file.svg -r COLLADA -e 3 Tests\COLLADASchema_141.xsd +XSDDiagramConsole.exe -os png -r COLLADA -e 3 -y Tests\COLLADASchema_141.xsd > Tests\stdout.png +XSDDiagramConsole.exe -os jpg -r COLLADA -e 3 -y Tests\COLLADASchema_141.xsd > Tests\stdout.jpg +XSDDiagramConsole.exe -os svg -r COLLADA -e 3 -y Tests\COLLADASchema_141.xsd > Tests\stdout.svg +@pause \ No newline at end of file