I have a compiler extension which I wrote some time ago, based on studing the
DifxAppExtension and other Wix Extensions.  My new elements are children of
wix:Component so I originally defined my xsd like this:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
         
xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension";
       xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
         xmlns:html="http://www.w3.org/1999/xhtml";
    targetNamespace="http://mydomain/myext/2014";
              xmlns="http://mydomain/myext/2014";
         xmlns:me="http://mydomain/myext/2014";>

  <xs:import namespace="http://schemas.microsoft.com/wix/2006/wi"; />

  <xs:element name="Component">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Element1" minOccurs="0" maxOccurs="1">
....
        </xs:element>

        <xs:element name="Element2" minOccurs="0" maxOccurs="1">
....
         </xs:element>
       </xs:sequence>
      <xs:attribute name="Id" type="xs:string" />
    </xs:complexType>
  </xs:element>

</xs:schema>

Now even though this is working, I am refactoring this extension to add new
elements, and in reviewing the current wix source I noticed that the xsd
uses the xse:parent so I changed my xsd like this:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
         
xmlns:xse="http://schemas.microsoft.com/wix/2005/XmlSchemaExtension";
       xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
         xmlns:html="http://www.w3.org/1999/xhtml";
    targetNamespace="http://mydomain/myext/2014";
              xmlns="http://mydomain/myext/2014";
         xmlns:me="http://mydomain/myext/2014";>

  <xs:import namespace="http://schemas.microsoft.com/wix/2006/wi"; />

        <xs:element name="Element1" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:appinfo>
              <xse:parent
namespace="http://schemas.microsoft.com/wix/2006/wi"; ref="Component" />
            </xs:appinfo>
            <xs:documentation>....</xs:documentation>
          </xs:annotation>

....
        </xs:element>

        <xs:element name="Element2" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:appinfo>
              <xse:parent
namespace="http://schemas.microsoft.com/wix/2006/wi"; ref="Component" />
            </xs:appinfo>
            <xs:documentation>....</xs:documentation>
          </xs:annotation>
....
         </xs:element>

</xs:schema>

Now when a project which uses this extension is built an exception is
thrown:
candle.exe(0,0): error CNDL0001: The 'http://mydomain/myext/2014:Component'
element is not declared.
        Exception Type: System.Xml.Schema.XmlSchemaException
        Stack Trace:
           at
System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e,
XmlSeverityType severity)
           at
System.Xml.Schema.SchemaCollectionCompiler.CompileElement(XmlSchemaElement
xe)
           at
System.Xml.Schema.SchemaCollectionCompiler.CompileParticleElements(XmlSchemaComplexType
complexType, XmlSchemaParticle particle)
           at
System.Xml.Schema.SchemaCollectionCompiler.CompileParticleElements(XmlSchemaComplexType
complexType, XmlSchemaParticle particle)
           at
System.Xml.Schema.SchemaCollectionCompiler.CompileCompexTypeElements(XmlSchemaComplexType
complexType)
           at System.Xml.Schema.SchemaCollectionCompiler.Compile()
           at System.Xml.Schema.SchemaCollectionCompiler.Execute(XmlSchema 
schema,
SchemaInfo schemaInfo, Boolean compileContentModel)
           at System.Xml.Schema.XmlSchema.CompileSchema(XmlSchemaCollection xsc,
XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEventHandler validationEventHandler, XmlNameTable nameTable,
Boolean CompileContentModel)
           at System.Xml.Schema.XmlSchemaCollection.Add(String ns, SchemaInfo
schemaInfo, XmlSchema schema, Boolean compile, XmlResolver resolver)
           at System.Xml.Schema.XmlSchemaCollection.Add(XmlSchema schema,
XmlResolver resolver)
           at
Microsoft.Tools.WindowsInstallerXml.Compiler.ValidateDocument(XmlDocument
document)
           at Microsoft.Tools.WindowsInstallerXml.Compiler.Compile(XmlDocument
source)
           at Microsoft.Tools.WindowsInstallerXml.Tools.Candle.Run(String[] 
args)
Done building project "MyMSI.wixproj" -- FAILED.

I have studied the UtilExtension, DifAppExtension, and GamingExtension, both
reviewing the xsd, tables, and C# compiler code, and I just don't see how to
resolve this problem.  If I put the xsd back to the way it was, then
everything is happy, but I would like to understand what I am missing in
creating a Compiler Extension.  All assistance is appreciated!





--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/CompilerExtension-xsd-tp7598978.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to