Just a guess. But use GetAttributeValue not GetAttributeIdentifierValue when 
reading the Name attribute.

-----Original Message-----
From: Phill Hogland [mailto:phogl...@rimage.com] 
Sent: Wednesday, February 12, 2014 11:03 AM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] CompilerExtension text string reported as invalid 
identifier

The Compiler Extension code is basically from Wix-Contrib with modifications 
that I added by studying the wix tools.  (I added an attempt to get the 
InnerText of an element and use it as a condition.  That change is not working 
yet.  But in these examples I do not have any InnerText and
'condition' defaults to 'True'.)    The particular string which causes a
failure I just came across as I was testing different options.  At the moment I 
only need to enable a single WinFeature, which works.  But there is another 
project where I will need to enable (and rollback) multiple WinFeatures.  So I 
was testing those scenarios.

        private void ParseWinFeatureElement(XmlNode node, string componentId, 
string id, string featureName, string condition)
        {
            SourceLineNumberCollection sourceLineNumbers = 
Preprocessor.GetSourceLineNumbers(node);
            foreach (XmlAttribute attrib in node.Attributes)
            {
                if (0 == attrib.NamespaceURI.Length || attrib.NamespaceURI == 
this.schema.TargetNamespace)
                {
                    switch (attrib.LocalName)
                    {
                        case "Id":
                            id =
this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
                            break;
                        case "Name":
                            featureName = 
this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
                            break;
                        default:
                            this.Core.UnexpectedAttribute(sourceLineNumbers,
attrib);
                            break;
                    }
                }
                else
                {
                   
this.Core.UnsupportedExtensionAttribute(sourceLineNumbers, attrib);
                }
            }

Then I test for empty strings and then:

                if (!this.Core.EncounteredError)
                {
                    this.Core.EnsureTable(sourceLineNumbers,
"RdpEnableWinFeatures");
                    Row row = this.Core.CreateRow(sourceLineNumbers,
"RdpEnableWinFeatures");
                    row[0] = id;
                    row[1] = featureName;
                    row[2] = condition;
                    row[3] = componentId;
                }

The xsd is:
  <xs:element name="Component">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="EnableWinFeatures" minOccurs="0"
maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="WinFeature" nillable="true" minOccurs="0"
maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent msdata:ColumnName="WinFeature_Text"
msdata:Ordinal="2">
                    <xs:extension base="xs:string">
                      <xs:attribute name="Id" type="xs:string" />
                      <xs:attribute name="Name" type="xs:string" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Id" type="xs:string" />
            <xs:attribute name="Name" type="xs:string" />
          </xs:complexType>
        </xs:element>
.........................

I used xsd.exe to generate the xsd after creating a xml file with the element 
layout that I anticipated using.  I have a lot to learn about this stuff, but 
it is starting to make some sense.  Thanks for any advice.
Phill




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/CompilerExtension-text-string-reported-as-invalid-identifier-tp7592603p7592629.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to