QBO3任务渲染错误

时间:2017-11-02 15:56:28

标签: xslt

我创建了一个任务,其中包含在QBO3 DEV环境中定义的问题。从DEV导出到UAT后,同一任务在渲染时抛出错误:

  

消息:''字符,十六进制值0x0A,不能包含   在一个名字。

目前尚不清楚;我不知道如何继续。

完整堆栈跟踪是:

Type : System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : The '' character, hexadecimal value 0x0A, cannot be included in a name.
    Source : System.Xml
    Help link : 
    LineNumber : 0
    LinePosition : 0
    SourceUri : 
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Void ThrowInvalidName(System.String, Int32, Int32)
    HResult : -2146232000
    Stack Trace :    at System.Xml.ValidateNames.ThrowInvalidName(String s, Int32 offsetStartChar, Int32 offsetBadChar)
       at System.Xml.ValidateNames.ParseQNameThrow(String s, String& prefix, String& localName)
       at System.Xml.Xsl.Runtime.XmlQueryRuntime.ParseTagName(String tagName, Int32 idxPrefixMappings, String& prefix, String& localName, String& ns)
       at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartAttributeComputed(String tagName, Int32 prefixMappingsIndex)
       at <xsl:template name="Behaviors">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 Behaviors, String Value)
       at <xsl:template name="ControlGroup">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 FormElement, IList`1 Root, IList`1 IFQ, IList`1 XmlData)
       at <xsl:template name="compiler:generated"> (19)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator FormValidator, String ReadOnly, IList`1 ParentID, IList`1 Title, IList`1 CurrentXML, IList`1 FormElement, IList`1 ImportFormQuestions)
       at <xsl:template name="RenderPanel">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 ImportFormQuestions, IList`1 FormElement, IList`1 CurrentXML, IList`1 Title, IList`1 ParentID, String ReadOnly)
       at <xsl:template name="RenderPanels">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, IList`1 ImportFormQuestions, String ParentID, String ReadOnly)
       at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
       at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
       at System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input, XsltArgumentList arguments, XmlWriter results)
       at qbo.DecisionWeb.ImportForm.RenderEdit(HttpContext context) in C:\trunk\qbo.3\qbo.Core\Web Tier\qbo.DecisionWeb\Decision\ImportForm.ashx.cs:line 219
       at qbo.DecisionWeb.ImportForm.ProcessRequest(HttpContext context) in C:\trunk\qbo.3\qbo.Core\Web Tier\qbo.DecisionWeb\Decision\ImportForm.ashx.cs:line 63

1 个答案:

答案 0 :(得分:0)

根本原因是自定义问题的“行为”列中的前导换行符(ASCII字符10)。

当QBO3导出的XML是从浏览器的格式化XML而不是原始XML进行复制和粘贴时,会发生这种情况。

enter image description here

请注意,在上图中,浏览器通过渲染以下行中的文本来格式化节点以便于阅读。从此视图复制数据会复制&#34; extra&#34;换行。

不是从此视图中复制数据,而是右键单击并选择浏览器的“另存为”选项。

enter image description here

可以使用以下查询批量修复此类问题:

UPDATE  ImportFormQuestion 
SET     Behaviors = SUBSTRING(Behaviors, 2, 1000)
FROM    ImportFormQuestion
WHERE   ASCII(SUBSTRING(Behaviors, 1,1)) = 10