diff options
Diffstat (limited to 'src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs')
| -rw-r--r-- | src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 8e9f48c4..a9a0fa9d 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
| @@ -6,6 +6,8 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Diagnostics; | 7 | using System.Diagnostics; |
| 8 | using System.Globalization; | 8 | using System.Globalization; |
| 9 | using System.Linq; | ||
| 10 | using System.Xml; | ||
| 9 | using System.Xml.Linq; | 11 | using System.Xml.Linq; |
| 10 | using WixToolset.Data; | 12 | using WixToolset.Data; |
| 11 | using WixToolset.Data.Symbols; | 13 | using WixToolset.Data.Symbols; |
| @@ -642,6 +644,19 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 642 | return value?.Trim(); | 644 | return value?.Trim(); |
| 643 | } | 645 | } |
| 644 | 646 | ||
| 647 | public void InnerTextDisallowed(XElement element) | ||
| 648 | { | ||
| 649 | if (element.Nodes().Any(n => XmlNodeType.Text == n.NodeType || XmlNodeType.CDATA == n.NodeType)) | ||
| 650 | { | ||
| 651 | var innerText = Common.GetInnerText(element); | ||
| 652 | if (!String.IsNullOrWhiteSpace(innerText)) | ||
| 653 | { | ||
| 654 | var sourceLineNumbers = this.GetSourceLineNumbers(element); | ||
| 655 | this.Messaging.Write(ErrorMessages.IllegalInnerText(sourceLineNumbers, element.Name.LocalName, innerText)); | ||
| 656 | } | ||
| 657 | } | ||
| 658 | } | ||
| 659 | |||
| 645 | public bool IsValidIdentifier(string value) | 660 | public bool IsValidIdentifier(string value) |
| 646 | { | 661 | { |
| 647 | return Common.IsIdentifier(value); | 662 | return Common.IsIdentifier(value); |
| @@ -714,17 +729,31 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 714 | 729 | ||
| 715 | public void ParseForExtensionElements(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element) | 730 | public void ParseForExtensionElements(IEnumerable<ICompilerExtension> extensions, Intermediate intermediate, IntermediateSection section, XElement element) |
| 716 | { | 731 | { |
| 717 | foreach (var child in element.Elements()) | 732 | var checkInnerText = false; |
| 733 | |||
| 734 | foreach (var child in element.Nodes()) | ||
| 718 | { | 735 | { |
| 719 | if (element.Name.Namespace == child.Name.Namespace) | 736 | if (child is XElement childElement) |
| 720 | { | 737 | { |
| 721 | this.UnexpectedElement(element, child); | 738 | if (element.Name.Namespace == childElement.Name.Namespace) |
| 739 | { | ||
| 740 | this.UnexpectedElement(element, childElement); | ||
| 741 | } | ||
| 742 | else | ||
| 743 | { | ||
| 744 | this.ParseExtensionElement(extensions, intermediate, section, element, childElement); | ||
| 745 | } | ||
| 722 | } | 746 | } |
| 723 | else | 747 | else |
| 724 | { | 748 | { |
| 725 | this.ParseExtensionElement(extensions, intermediate, section, element, child); | 749 | checkInnerText = true; |
| 726 | } | 750 | } |
| 727 | } | 751 | } |
| 752 | |||
| 753 | if (checkInnerText) | ||
| 754 | { | ||
| 755 | this.InnerTextDisallowed(element); | ||
| 756 | } | ||
| 728 | } | 757 | } |
| 729 | 758 | ||
| 730 | public WixActionSymbol ScheduleActionSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string actionName, string condition, string beforeAction, string afterAction, bool overridable = false) | 759 | public WixActionSymbol ScheduleActionSymbol(IntermediateSection section, SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string actionName, string condition, string beforeAction, string afterAction, bool overridable = false) |
