cancel
Showing results for 
Search instead for 
Did you mean: 

Loading an XML document fails

Former Member
0 Kudos

Hi.

Hopefully an easy one.

xMII version 12. I have a transaction which loads an XML documents. But the XML needs to bee saved as ANSI. If saved as UTF-8, the load action fails. How can this be avoided?

BR

Poul.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I have an error while loading my xsl archive with the XML Loader action. You'll see the error below.

*"The markup in the document following the root element must be well-formed"*

My XSL file has this shape...

<?xml version="1.0"? encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">

+ <xsl:output method="xml" media-type="text/xml"/>+

+ <xsl:param name="Param.31"/>+

+ <xsl:param name="Param.32"/>+

+ <xsl:param name="SubtotalColumn"/>+

+ <xsl:param name="DisplayColumns"/>+

+ <xsl:param name="ShowDetails">Y</xsl:param>+

+ <xsl:param name="ShowSubtotals">Y</xsl:param>+

+ <xsl:param name="ShowGrandTotal">Y</xsl:param>+

+ <xsl:param name="ShowHeaders">Y</xsl:param>+

+ +

+ <xsl:template match="/">+

+ <Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">+

+ <xsl:copy-of select="FatalError"/>+

+ <xsl:copy-of select="Messages"/>+

+ <xsl:variable name="DocRoot" select="/"/>+

+ <xsl:variable name="SubtotalColumnName">+

+ <xsl:choose>+

+ <xsl:when test="$SubtotalColumn = ''">+

+ <xsl:value-of select="$Param.31"/>+

+ </xsl:when>+

+ <xsl:otherwise>+

+ <xsl:value-of select="$SubtotalColumn"/>+

+ </xsl:otherwise>+

+ </xsl:choose>+

+ </xsl:variable>+

+ <xsl:for-each select="Rowsets">+

+<!-- <xsl:for-each select="Rowset"> -->+

+ <Rowset>+

+ <!-- Tokenize our lists into node lists -->+

+ <xsl:variable name="ColumnNameList">+

+ <xsl:choose>+

+ <xsl:when test="$DisplayColumns = ''">+

+ <xsl:choose>+

+ <xsl:when test="$Param.32 = ''">+

+ <xsl:for-each select="Rowset[1]/Columns/Column">+

+ <xsl:value-of select="@Name"/>+

+ <xsl:if test="position() != last()">,</xsl:if>+

+ </xsl:for-each>+

+ </xsl:when>+

+ <xsl:otherwise>+

+ <xsl:value-of select="$Param.32"/>+

+ </xsl:otherwise>+

+ </xsl:choose>+

+ </xsl:when>+

+ <xsl:otherwise>+

+ <xsl:value-of select="$DisplayColumns"/>+

+ </xsl:otherwise>+

+ </xsl:choose>+

+ </xsl:variable>+

+ <xsl:variable name="ColumnNames" select="xalan:tokenize($ColumnNameList,',')"/>+

+ <xsl:variable name="ColumnCount">+

+ <xsl:value-of select="count($ColumnNames)"/>+

+ </xsl:variable>+

+ <Columns>+

+ <Column Name="RowType" SourceColumn="RowType" Description="RowType" SQLDataType="1" MinRange="0.0" MaxRange="100.0"/>+

+ <Column Name="GroupLabel" SourceColumn="GroupLabel" Description="GroupLabel" SQLDataType="1" MinRange="0.0" MaxRange="100.0"/>+

+ <xsl:for-each select="$ColumnNames">+

+ <xsl:variable name="ColName">+

+ <xsl:value-of select="."/>+

+ </xsl:variable>+

+ <xsl:copy-of select="$DocRoot/Rowsets/Rowset[1]/Columns/Column[@Name=$ColName]"/>+

+ </xsl:for-each>+

+ </Columns>+

+ <xsl:for-each select="xalan:distinct(/Rowsets/Rowset/Row/*[name() = $SubtotalColumnName])">+

+ <!-- Dynamically determine grouping/sorting expressions -->+

+ <xsl:variable name="SelGroup">+

+ <xsl:value-of select="."/>+

+ </xsl:variable>+

+ <xsl:variable name="DetailExpr">/Rowsets/Rowset/Row[<xsl:value-of select="$SubtotalColumnName"/>='<xsl:value-of select="$SelGroup"/>']</xsl:variable>+

+ <xsl:variable name="SubtotalExpr">/Rowsets/Rowset/Row/<xsl:value-of select="$SubtotalColumnName"/>"/></xsl:variable>+

+ <xsl:if test="$ShowSubtotals = 'Y' and $ShowHeaders = 'Y'">+

+ <Row>+

+ <RowType>SubtotalHeader</RowType>+

+ <GroupLabel>+

+ <xsl:value-of select="$SelGroup"/>+

+ </GroupLabel>+

+ <xsl:for-each select="$ColumnNames">+

+ <xsl:variable name="ColName">+

+ <xsl:value-of select="."/>+

+ </xsl:variable>+

+ <xsl:element name="{$ColName}"/>+

+ </xsl:for-each>+

+ </Row>+

+ </xsl:if>+

+ <!-- Output Details for Each Column -->+

+ <xsl:if test="$ShowDetails = 'Y'">+

+ <xsl:for-each select="xalan:evaluate($DetailExpr)">+

+ <Row>+

+ <RowType>Detail</RowType>+

+ <GroupLabel/>+

+ <xsl:variable name="CurrentRow" select="."/>+

+ <xsl:for-each select="$ColumnNames">+

+ <xsl:variable name="ColName">+

+ <xsl:value-of select="."/>+

+ </xsl:variable>+

+ <xsl:variable name="ColExpr">$CurrentRow/<xsl:value-of select="$ColName"/>+

+ </xsl:variable>+

+ <xsl:variable name="ColValue">+

+ <xsl:value-of select="xalan:evaluate($ColExpr)"/>+

+ </xsl:variable>+

+ <xsl:element name="{$ColName}">+

+ <xsl:value-of select="$ColValue"/>+

+ </xsl:element>+

+ </xsl:for-each>+

+ </Row>+

+ </xsl:for-each>+

+ </xsl:if>+

+ <!-- Output Subtotal For Group -->+

+ <xsl:if test="$ShowSubtotals = 'Y'">+

+ <Row>+

+ <RowType>SubtotalFooter</RowType>+

+ <GroupLabel>+

+ <xsl:value-of select="$SelGroup"/>+

+ </GroupLabel>+

+ <xsl:for-each select="$ColumnNames">+

+ <xsl:variable name="ColName">+

+ <xsl:value-of select="."/>+

+ </xsl:variable>+

+ <xsl:variable name="ColType">+

+ <xsl:value-of select="$DocRoot/Rowsets/Rowset[1]/Columns/Column[@Name=$ColName]/@SQLDataType"/>+

+ </xsl:variable>+

+ <xsl:element name="{$ColName}">+

+ <xsl:if test="$ColType = '2' or $ColType = '3' or $ColType = '4' or $ColType = '5' or $ColType = '6' or $ColType = '7' or $ColType = '8' or $ColType = '-7'">+

+ <xsl:variable name="SubTotalExpr">sum($DocRoot/Rowsets/Rowset/Row[<xsl:value-of select="$SubtotalColumnName"/>=$SelGroup]/<xsl:value-of select="."/>)</xsl:variable>+

+ <xsl:value-of select="xalan:evaluate($SubTotalExpr)"/>+

+ </xsl:if>+

+ </xsl:element>+

+ </xsl:for-each>+

+ </Row>+

+ </xsl:if>+

+ </xsl:for-each>+

+ <xsl:if test="$ShowGrandTotal = 'Y'">+

+ <Row>+

+ <RowType>Total</RowType>+

+ <GroupLabel>Total</GroupLabel>+

+ <xsl:for-each select="$ColumnNames">+

+ <xsl:variable name="ColName">+

+ <xsl:value-of select="."/>+

+ </xsl:variable>+

+ <xsl:variable name="ColType3">+

+ <xsl:value-of select="$DocRoot/Rowsets/Rowset[1]/Columns/Column[@Name=$ColName]/@SQLDataType"/>+

+ </xsl:variable>+

+ <xsl:element name="{$ColName}">+

+ <xsl:if test="$ColType3 = '2' or $ColType3 = '3' or $ColType3 = '4' or $ColType3 = '5' or $ColType3 = '6' or $ColType3 = '7' or $ColType3 = '8' or $ColType3 = '-7'">+

+ <xsl:variable name="TotalExpr">sum($DocRoot/Rowsets/Rowset/Row/<xsl:value-of select="."/>)</xsl:variable>+

+ <xsl:value-of select="xalan:evaluate($TotalExpr)"/>+

+ </xsl:if>+

+ </xsl:element>+

+ </xsl:for-each>+

+ </Row>+

+ </xsl:if>+

+ </Rowset>+

+<!-- </xsl:for-each> -->+

+ </xsl:for-each>+

+ </Rowsets>+

+ </xsl:template>+

</xsl:stylesheet>

I cannot find information about it. Can anybody help me, please?