You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Anwar, Mohammed" <mo...@intel.com> on 2001/02/03 03:39:51 UTC

Cannot get XALAN 2 parse Microsoft Recordset XML

Hi,
	I have XML returned from microsoft sql server which includes the
namespaces in the schema part of the xml.
	XALAN version 1 works fine and is able to transform the xml.

	Version 2 d05 and d07 both fail..
	The error received when creating the transformer from the factory is
as follows:

	Extra illegal tokens: '#RowsetSchema', ':', 'row', '[', 'position',
'(', ')', '=', '1', ']'
Extra illegal tokens: '#RowsetSchema', ':', 'row', '[', 'position', '(',
')', '!', '=', '1', ']'

	Here is the java code...

		private void transform_(Document xmlo, String xslFilename,
Result result)
			throws IOException
		{
			try {
				TransformerFactory transformerFactory =
TransformerFactory.newInstance();
				// Create the transformer
				Transformer transformer =
transformerFactory.newTransformer(new StreamSource(xslFilename)); <--- The
above message is printed after this call..

				// Perform the transformation.
				transformer.transform(new
javax.xml.transform.dom.DOMSource(xmlo),result);
			}
			catch(TransformerException te) {
				throw new TibetRuntimeException(te);
			}
	

	Here is the schema part of the xml where the namespaces are
declared.....

	<xml xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:z="#RowsetSchema">
	<s:Schema id="RowsetSchema">
		<s:ElementType content="eltOnly" name="row"
rs:CommandTimeout="30" rs:ReshapeName="DSRowset1">
			<s:AttributeType name="ID" rs:number="1"
rs:writeunknown="true">
				<s:datatype dt:maxLength="4" dt:type="int"
rs:fixedlength="true" rs:maybenull="false" rs:precision="10"/>
			</s:AttributeType>
			<s:AttributeType name="Owner" rs:nullable="true"
rs:number="2" rs:writeunknown="true">
				<s:datatype dt:maxLength="255"
dt:type="string" rs:dbtype="str"/>
			</s:AttributeType>
	......
	
The data section is as follows:
<rs:data>
		<z:row ID="1" Owner="owner1" seID="1">
			<c3 base_1000_f_1020="This" seID="1"/>
			<c3 base_1000_f_1020="Those" seID="1"/>
			<Intent base_1000_f_1016="Sample include text with
&lt;tags&gt;  Hello  World " seID="1"/>
		</z:row>
		<z:row ID="2" Owner="owner1" seID="2">
			<c3 base_1000_f_1020="This" seID="2"/>
			<c3 base_1000_f_1020="Those" seID="2"/>
			<Intent base_1000_f_1016=" intent" seID="2"/>
		</z:row>
etc.....

	The xslt is a very simple one which works using other xslt
processors...


<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:z="#RowsetSchema">
<xsl:template match="xml">
	<xsl:apply-templates select="rs:data"/>
</xsl:template>

<xsl:template match="rs:data">
	<xsl:apply-templates select="z:row"/>
</xsl:template>

<xsl:template match="z:row">
	<xsl:for-each select="@*">
		<xsl:value-of select="local-name()"/>
				<xsl:text>=</xsl:text>
		<xsl:value-of select="."/>
		<xsl:text>; </xsl:text>
	</xsl:for-each>
	<xsl:text>"nl"</xsl:text>
</xsl:template>

<xsl:template match="//rs:data/z:row/*">
		<td>
		<xsl:choose>
			<xsl:when test="@rs:ReshapeName"><xsl:value-of
select="@rs:ReshapeName"/></xsl:when>
			<xsl:otherwise><xsl:value-of
select="@name"/></xsl:otherwise>
		</xsl:choose>
		</td>
</xsl:template>
</xsl:stylesheet>


Thanks
Anwar