OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: XML/XSL Transformation ENCODING error



For the encoding format, try using "cp1252" or perhaps using UTF-8 (the
default XML encoding).

> -----Original Message-----
> From:	Thushara Perera [SMTP:thusharap@eurocenter.lk]
> Sent:	Friday, June 15, 2001 7:57 AM
> To:	JAVA-XML (E-mail); XSL News Group (E-mail); XML-DEV (E-mail)
> Subject:	XML/XSL Transformation ENCODING error
> 
> Hi
>  
> I am trying to transform one XML file to another using XSL and Java
> (Xerces). When I am performing transformation, it gives me this error
> message.
>  
> The encoding "windows-1252" is not supported.
> 
> Please tell me how to fix this.
>  
> Thanks
>  
> Thushara
>  
> Part of My XML file is:
>  
> <?xml version="1.0" encoding="windows-1252" ?>
> <HUBSHOPXML>
> <PRODUCTS>
> <PRODUCT xmllang="en">
>  <SUPPLIERCOMPANYID>EC002</SUPPLIERCOMPANYID>
>  <SUPPLIERCOMPANYQUALIFIER>TRA</SUPPLIERCOMPANYQUALIFIER>
>  <SUPPLIERCOMPANYNAME>Jhonson And Jhonson</SUPPLIERCOMPANYNAME>
>  <ACTION>P</ACTION>
>  <PRODUCTID>1000337</PRODUCTID>
>  <PRODUCTIDQ>MK</PRODUCTIDQ>
>  <PRODUCTNAME>"KJAAME-HF(C)1X2X0,5+0,5"</PRODUCTNAME>
>  <BRANDNAME></BRANDNAME>
>  <PRIMARYPRODUCTGROUPID>1011</PRIMARYPRODUCTGROUPID>
>  <PRIMARYPRODUCTGROUPNAME>Leverandør/Produsent Id:
> 0951617</PRIMARYPRODUCTGROUPNAME>
>  <PRIMARYPRODUCTGROUPIDQ>MK</PRIMARYPRODUCTGROUPIDQ>
>  <MANUFACTURERPRODUCTNAME>Leverandør/Produsent Id:
> 0951617</MANUFACTURERPRODUCTNAME>
> </PRODUCT>
> <PRODUCT xmllang="en">
>  <SUPPLIERCOMPANYID>EC002</SUPPLIERCOMPANYID>
>  <SUPPLIERCOMPANYQUALIFIER>TRA</SUPPLIERCOMPANYQUALIFIER>
>  <SUPPLIERCOMPANYNAME>Jhonson And Jhonson</SUPPLIERCOMPANYNAME>
>  <ACTION>P</ACTION>
>  <PRODUCTID>1000338</PRODUC
>  
> ================================
>  
> And a part of my XSL file is:
>  
> <?xml version="1.0" encoding="windows-1252" ?>
>  
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   
>  <xsl:output indent="yes" method="xml" standalone = "no"
> doctype-system = "HUBSHOPXML.DTD"/>
>  
>  <xsl:variable name="attribValue">
>   <xsl:value-of select="HUBSHOPXML/*/*/@xmllang"/> <!-- get the
> xmllang into a variable-->
>  </xsl:variable>
>  
>    <!-- Match the root element -->
>  <xsl:template match="HUBSHOPXML">
>   <xsl:copy>
>    <!-- set the global SUPPLIER element. Select from either
> PRODUCTS/PRODUCT or ARTICLES/ARTICLE or PACKAGES/PACKAGE - all of them
> have the same value. -->
>    <SUPPLIER>
>     <xsl:element name="COMPANYID">
>      <xsl:attribute name="QUALIFIER">
>       <xsl:value-of select="*/*/SUPPLIERCOMPANYQUALIFIER"/>  <!-- goto
> root and start search, cause QUAL can be anywhere -->
>      </xsl:attribute>
>      <xsl:value-of select="*/*/SUPPLIERCOMPANYID"/>
>     </xsl:element>
>     <xsl:element name="COMPANYNAME">
>      <xsl:value-of select="*/*/SUPPLIERCOMPANYNAME"/>
>     </xsl:element>
>    </SUPPLIER>
>    <!-- End set -->
>  
>    <xsl:apply-templates select="PRODUCTS"/>
>  
> ============================
>  
> And the a part from the Java program I use is:
>  
> private void performTransformation()
>   {
>     try
>     {
>       tFactory = TransformerFactory.newInstance();
>  
>       // Use the TransformerFactory to instantiate a Transformer that
> will work with the stylesheet you
>       // specify. This method call also processes the stylesheet into
> a compiled Templates object.
>  
>       transformer = tFactory.newTransformer(new
> StreamSource(XSLFileReference));
>  
>       // Use the Transformer to apply the associated Templates object
> to an XML document
>       // (foo.xml) and write the output to a file (foo.out).
>  
>       transformer.transform(new StreamSource(inputFileReference), new
> StreamResult(new FileOutputStream(outputFileReference)));
>  
>       classReturnValue = true; <file://process> success
>     }
>     catch (TransformerConfigurationException e)
>     {
>       <file://Need> to call the ERROR class here and below.. This is
> just a temp soln.
>       System.out.println(e.getMessage());
>  
> aConversion.errorLogWriter("","1","","TransformerConfigurationExceptio
> n: " + e.getMessageAndLocation(),false);
>       classReturnValue = false; <file://process> not success
>     }
>     catch (TransformerException e)
>     {
>       aConversion.errorLogWriter("","1","","TransformerException : " +
> e.getMessageAndLocation(),false);
>       classReturnValue = false; <file://process> not success
>     }
>     catch (FileNotFoundException e)
>     {
>       aConversion.errorLogWriter("","1","","FileNotFoundException : "
> + e.getMessage(),false);
>       classReturnValue = false; <file://process> not success
>     }
>     catch (IOException e)
>     {
>       aConversion.errorLogWriter("","1","","IOException : " +
> e.getMessage(),false);
>       classReturnValue = false; <file://process> not success
>     }
>   }
>  
>  
>  
>  
>  
>