Browse Source

Fixed incorrect AddIn.xsd, and make BuildAddinDocumentation validate the schema before saving it (http://community.sharpdevelop.net/forums/t/12508.aspx)

pull/14/head
Daniel Grunwald 16 years ago
parent
commit
01c619cdf0
  1. 2
      data/schemas/AddIn.xsd
  2. 2
      doc/technotes/ConditionList.html
  3. 2
      doc/technotes/DoozerList.html
  4. 2
      src/Main/Base/Project/Src/Internal/Doozers/OptionPanelDoozer.cs
  5. 23
      src/Tools/BuildAddinDocumentation/MainClass.cs

2
data/schemas/AddIn.xsd

@ -732,7 +732,7 @@
<xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="ComplexCondition" /> <xs:element ref="ComplexCondition" />
<xs:element ref="Condition" /> <xs:element ref="Condition" />
<xs:element ref="IOptionPanel" /> <xs:element ref="OptionPanel" />
<xs:element ref="Include" /> <xs:element ref="Include" />
</xs:choice> </xs:choice>
<xs:attribute name="class" use="optional" type="xs:string"> <xs:attribute name="class" use="optional" type="xs:string">

2
doc/technotes/ConditionList.html

@ -5,7 +5,7 @@
</head><body> </head><body>
<h1>Condition List</h1> <h1>Condition List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'. <p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 4.0.0.7014.</p> It is based on SharpDevelop 4.0.0.7070.</p>
<ul> <ul>
<li><a href="#ActiveContentExtension">ActiveContentExtension</a> <li><a href="#ActiveContentExtension">ActiveContentExtension</a>
<li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a> <li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a>

2
doc/technotes/DoozerList.html

@ -5,7 +5,7 @@
</head><body> </head><body>
<h1>Doozer List</h1> <h1>Doozer List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'. <p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 4.0.0.7014.</p> It is based on SharpDevelop 4.0.0.7070.</p>
<ul> <ul>
<li><a href="#Class">Class</a> <li><a href="#Class">Class</a>
<li><a href="#CodeCompletionBinding">CodeCompletionBinding</a> <li><a href="#CodeCompletionBinding">CodeCompletionBinding</a>

2
src/Main/Base/Project/Src/Internal/Doozers/OptionPanelDoozer.cs

@ -18,7 +18,7 @@ namespace ICSharpCode.SharpDevelop
/// <attribute name="label" use="required"> /// <attribute name="label" use="required">
/// Caption of the dialog panel. /// Caption of the dialog panel.
/// </attribute> /// </attribute>
/// <children childTypes="IOptionPanel"> /// <children childTypes="OptionPanel">
/// In the SharpDevelop options, option pages can have subpages by specifying them /// In the SharpDevelop options, option pages can have subpages by specifying them
/// as children in the AddInTree. /// as children in the AddInTree.
/// </children> /// </children>

23
src/Tools/BuildAddinDocumentation/MainClass.cs

@ -10,6 +10,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml; using System.Xml;
using System.Xml.Schema;
namespace BuildAddinDocumentation namespace BuildAddinDocumentation
{ {
@ -71,13 +72,23 @@ namespace BuildAddinDocumentation
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.Load(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd")); doc.Load(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"));
UpdateSchema(doc, doozers, conditions); UpdateSchema(doc, doozers, conditions);
using (XmlTextWriter writer = new XmlTextWriter(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"), System.Text.Encoding.UTF8)) {
writer.Formatting = Formatting.Indented; // Test the schema
writer.IndentChar = '\t'; int errors = 0;
writer.Indentation = 1; ValidationEventHandler validation = (sender, e) => { Debug.WriteLine(e.Message); errors++; };
doc.Save(writer); XmlSchema.Read(new XmlNodeReader(doc.DocumentElement), validation).Compile(validation);
if (errors == 0) {
// save only if correct
using (XmlTextWriter writer = new XmlTextWriter(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"), System.Text.Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.IndentChar = '\t';
writer.Indentation = 1;
doc.Save(writer);
}
Debug.WriteLine("Finished");
} else {
Debug.WriteLine("Finished (with errors)");
} }
Debug.WriteLine("Finished");
} }
static void RecursiveInsertDoozerList(XmlElement e, List<XmlElement> doozers, List<XmlElement> conditionList) static void RecursiveInsertDoozerList(XmlElement e, List<XmlElement> doozers, List<XmlElement> conditionList)

Loading…
Cancel
Save