无效的 ReportDefinition Xml:cvc-complex-type.2.4.a:发现以元素“运算符”开头的无效内容

Posted

技术标签:

【中文标题】无效的 ReportDefinition Xml:cvc-complex-type.2.4.a:发现以元素“运算符”开头的无效内容【英文标题】:Invalid ReportDefinition Xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'operator' 【发布时间】:2013-09-30 13:41:11 【问题描述】:

我正在使用 201306,直到星期五我都可以正常下载报告。但是今天突然开始出现以下错误。

Invalid ReportDefinition Xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'operator'

我的代码sn-p:

 selector.fields = new[]
                    
                        PerformanceSelector.Date,
                        PerformanceSelector.KeywordId,
                        PerformanceSelector.KeywordText,
                        PerformanceSelector.AccountName,
                        PerformanceSelector.CampaignId,
                        PerformanceSelector.CampaignName,
                        PerformanceSelector.AdGroupId,
                        PerformanceSelector.AdGroupName,
                        PerformanceSelector.KeywordMatchType,
                        PerformanceSelector.Impressions,
                        PerformanceSelector.Clicks,
                        PerformanceSelector.AveragePosition,
                        PerformanceSelector.Cost,
                        PerformanceSelector.AverageCpc,
                        PerformanceSelector.ClickThroughRate,
                        PerformanceSelector.Conversions,
                        PerformanceSelector.ConversionRate,
                        PerformanceSelector.CostPerConversion,
                    ;

                    dates = new DateRange  min = String.Format("0:yyyyMMdd", StartDate), max = String.Format("0:yyyyMMdd", EndDate) ;
                    selector.dateRange = dates;

报告定义

    var reportDefinition = new ReportDefinition
        
            reportName = ReportName,
            reportType = ReportType,
            dateRangeType = ReportDefinitionDateRangeType.CUSTOM_DATE,
            includeZeroImpressions = true,
            downloadFormat = DownloadFormat.XML,
            selector = selector
        ;

我得到的错误是

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>ReportDownloadError.INVALID_REPORT_DEFINITION_XML</type><trigger>Invalid ReportDefinition Xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'operator'. One of '&quot;https://adwords.google.com/api/adwords/cm/v201306&quot;:field' is expected.</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>

【问题讨论】:

【参考方案1】:

我也有这个问题,但是忘记换版本了:

var utility = new ReportUtilities(user); utility.ReportVersion = "v201309";

还是 v201302

希望这会有所帮助。

史蒂芬

【讨论】:

这应该是公认的答案。如果您遇到此问题,请确保您使用的是最新版本的 API!

以上是关于无效的 ReportDefinition Xml:cvc-complex-type.2.4.a:发现以元素“运算符”开头的无效内容的主要内容,如果未能解决你的问题,请参考以下文章

s-s-rS 2008 部署问题

XSLT 无效令牌导致 XML 文档无效

解析Xml数据错误:文本内容中发现无效字符怎么处理

无效的 XML 显示为有效

在 C# 中转义无效的 XML 字符

无效格式xml的最佳PHP解析器[重复]