473,608 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transformation error

Please i intend to make an XML document from a string using tranformer
as shown below. It returns an error which trace is given below as well.
please help.

public org.w3c.dom.Nod e getTextXML() {

try
{

javax.xml.trans form.dom.DOMRes ult domresult=new
javax.xml.trans form.dom.DOMRes ult();
StringReader textReader=new StringReader("< a>testing</a>");
xmlin=new javax.xml.trans form.stream.Str eamSource(textR eader);

TransformerFact ory tfl=Transformer Factory.newInst ance();
Transformer trl=tfl.newTran sformer();
trl.transform (xmlin,domresul t);
return domresult.getNo de();
}

catch(Exception e)
{
e.printStackTra ce (System.out);

}
finally
{

}

return null;

}
javax.xml.trans form.Transforme rException:
org.xml.sax.SAX ParseException: Content is not allowed in prolog.
at
org.apache.xala n.transformer.T ransformerIdent ityImpl.transfo rm(TransformerI dentityImpl.jav a:501)
at Info.Mailer.get TextXML(Mailer. java:516)
at sun.reflect.Nat iveMethodAccess orImpl.invoke0( Native Method)
at
sun.reflect.Nat iveMethodAccess orImpl.invoke(N ativeMethodAcce ssorImpl.java:3 9)
at
sun.reflect.Del egatingMethodAc cessorImpl.invo ke(DelegatingMe thodAccessorImp l.java:25)
at java.lang.refle ct.Method.invok e(Method.java:5 85)
at
org.apache.xala n.extensions.Ex tensionHandlerJ avaClass.callFu nction(Extensio nHandlerJavaCla ss.java:399)
at
org.apache.xala n.extensions.Ex tensionHandlerJ avaClass.callFu nction(Extensio nHandlerJavaCla ss.java:438)
at
org.apache.xala n.extensions.Ex tensionsTable.e xtFunction(Exte nsionsTable.jav a:220)
at
org.apache.xala n.transformer.T ransformerImpl. extFunction(Tra nsformerImpl.ja va:473)
at
org.apache.xpat h.functions.Fun cExtFunction.ex ecute(FuncExtFu nction.java:206 )
at org.apache.xpat h.XPath.execute (XPath.java:335 )
at
org.apache.xala n.templates.Ele mCopyOf.execute (ElemCopyOf.jav a:132)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.transformer.T ransformerImpl. applyTemplateTo Node(Transforme rImpl.java:2281 )
at
org.apache.xala n.transformer.T ransformerImpl. transformNode(T ransformerImpl. java:1367)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :709)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1284)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1262)
at Info.Mailer.sen dmail(Mailer.ja va:153)
at Info.Mailer.mai n(Mailer.java:2 7)
Caused by: org.xml.sax.SAX ParseException: Content is not allowed in
prolog.
at
org.apache.xerc es.util.ErrorHa ndlerWrapper.cr eateSAXParseExc eption(Unknown
Source)
at
org.apache.xerc es.util.ErrorHa ndlerWrapper.fa talError(Unknow n Source)
at org.apache.xerc es.impl.XMLErro rReporter.repor tError(Unknown
Source)
at org.apache.xerc es.impl.XMLErro rReporter.repor tError(Unknown
Source)
at org.apache.xerc es.impl.XMLScan ner.reportFatal Error(Unknown
Source)
at
org.apache.xerc es.impl.XMLDocu mentScannerImpl $PrologDispatch er.dispatch(Unk nown
Source)
at
org.apache.xerc es.impl.XMLDocu mentFragmentSca nnerImpl.scanDo cument(Unknown
Source)
at org.apache.xerc es.parsers.XML1 1Configuration. parse(Unknown
Source)
at org.apache.xerc es.parsers.XML1 1Configuration. parse(Unknown
Source)
at org.apache.xerc es.parsers.XMLP arser.parse(Unk nown Source)
at org.apache.xerc es.parsers.Abst ractSAXParser.p arse(Unknown
Source)
at
org.apache.xala n.transformer.T ransformerIdent ityImpl.transfo rm(TransformerI dentityImpl.jav a:484)
... 28 more
---------
org.xml.sax.SAX ParseException: Content is not allowed in prolog.
at
org.apache.xerc es.util.ErrorHa ndlerWrapper.cr eateSAXParseExc eption(Unknown
Source)
at
org.apache.xerc es.util.ErrorHa ndlerWrapper.fa talError(Unknow n Source)
at org.apache.xerc es.impl.XMLErro rReporter.repor tError(Unknown
Source)
at org.apache.xerc es.impl.XMLErro rReporter.repor tError(Unknown
Source)
at org.apache.xerc es.impl.XMLScan ner.reportFatal Error(Unknown
Source)
at
org.apache.xerc es.impl.XMLDocu mentScannerImpl $PrologDispatch er.dispatch(Unk nown
Source)
at
org.apache.xerc es.impl.XMLDocu mentFragmentSca nnerImpl.scanDo cument(Unknown
Source)
at org.apache.xerc es.parsers.XML1 1Configuration. parse(Unknown
Source)
at org.apache.xerc es.parsers.XML1 1Configuration. parse(Unknown
Source)
at org.apache.xerc es.parsers.XMLP arser.parse(Unk nown Source)
at org.apache.xerc es.parsers.Abst ractSAXParser.p arse(Unknown
Source)
at
org.apache.xala n.transformer.T ransformerIdent ityImpl.transfo rm(TransformerI dentityImpl.jav a:484)
at Info.Mailer.get TextXML(Mailer. java:516)
at sun.reflect.Nat iveMethodAccess orImpl.invoke0( Native Method)
at
sun.reflect.Nat iveMethodAccess orImpl.invoke(N ativeMethodAcce ssorImpl.java:3 9)
at
sun.reflect.Del egatingMethodAc cessorImpl.invo ke(DelegatingMe thodAccessorImp l.java:25)
at java.lang.refle ct.Method.invok e(Method.java:5 85)
at
org.apache.xala n.extensions.Ex tensionHandlerJ avaClass.callFu nction(Extensio nHandlerJavaCla ss.java:399)
at
org.apache.xala n.extensions.Ex tensionHandlerJ avaClass.callFu nction(Extensio nHandlerJavaCla ss.java:438)
at
org.apache.xala n.extensions.Ex tensionsTable.e xtFunction(Exte nsionsTable.jav a:220)
at
org.apache.xala n.transformer.T ransformerImpl. extFunction(Tra nsformerImpl.ja va:473)
at
org.apache.xpat h.functions.Fun cExtFunction.ex ecute(FuncExtFu nction.java:206 )
at org.apache.xpat h.XPath.execute (XPath.java:335 )
at
org.apache.xala n.templates.Ele mCopyOf.execute (ElemCopyOf.jav a:132)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.templates.Ele mLiteralResult. execute(ElemLit eralResult.java :1374)
at
org.apache.xala n.transformer.T ransformerImpl. executeChildTem plates(Transfor merImpl.java:24 11)
at
org.apache.xala n.transformer.T ransformerImpl. applyTemplateTo Node(Transforme rImpl.java:2281 )
at
org.apache.xala n.transformer.T ransformerImpl. transformNode(T ransformerImpl. java:1367)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :709)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1284)
at
org.apache.xala n.transformer.T ransformerImpl. transform(Trans formerImpl.java :1262)
at Info.Mailer.sen dmail(Mailer.ja va:153)
at Info.Mailer.mai n(Mailer.java:2 7)

Sep 24 '06 #1
3 1694
moralbarometer wrote:
javax.xml.trans form.Transforme rException:
org.xml.sax.SAX ParseException: Content is not allowed in prolog.
Your input is not a well-formed XML document. You've probably made the
mistake of having non-whitespace text before the root element. Fix your
input.

http://www.w3.org/TR/2006/REC-xml11-...sec-prolog-dtd

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 24 '06 #2
hi joe, thx. the problem lies on less than and greater than signs in
this string: "<a>testing </a>"; I tried another approach by calling a
using a function in xsl that return this string. but the output of xsl
contains but &lt; and &gt; which the broswer doesn't understand. I
need these signs after calling the getting the string from the
function. Any idea?
thx

Joe Kesselman schrieb:
moralbarometer wrote:
javax.xml.trans form.Transforme rException:
org.xml.sax.SAX ParseException: Content is not allowed in prolog.

Your input is not a well-formed XML document. You've probably made the
mistake of having non-whitespace text before the root element. Fix your
input.

http://www.w3.org/TR/2006/REC-xml11-...sec-prolog-dtd

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 25 '06 #3
moralbarometer wrote:
but the output of xsl
contains but &lt; and &gt; which the broswer doesn't understand.
If you're outputting HTML for use in a browser, you should probably
consider setting the output mode to HTML rather than XML (see the
documentation for the xsl:output directive). That will switch to a
serializer which is more likely to be compatable with the typical browser.

But I think a browser which doesn't understand &lt; and &gt; should
probably be consdered broken...?
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2696
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited...
0
2095
by: Prasad | last post by:
We are invoking a SQL DTS component (lets call it Comp1) built by us in another component (Comp2).Comp1 was built by creating the DTS package using the SQL DTS wizard and then saving it as a VB .bas file - this was converted to .NET class module. To this module we added some cutom transformation tasks. An additional info - we are invoking Comp1 in a loop inside Comp2. The transformation succesfully happens for a few files in the list...
0
1221
by: MIke | last post by:
Hello , During transformation of data from sql server 2000 to Mysql using DTS import/export wizard( using mysql odbc 3.51 driver & file dsn).I encountered the following error: Error at Destination for row number 1.Errors encountered so far in this task:1 Insert error,Column 2('ANAME',DBTYPE_STR),status 6:Data overflow. Insert error,Column 1('ACODE',DBTYPE_STR),status 6:Data overflow.
4
2433
by: Kevin Dean | last post by:
I'm trying to create an XSL transformation that will strip out development-specific attributes from deployment descriptors and other XML files. I have already successfully done so with web.xml but I'm at a complete loss as to what is wrong with the one below. This is a very abbreviated server-config.wsdd: <?xml version="1.0" encoding="UTF-8"?> <deployment xmlns="http://xml.apache.org/axis/wsdd/"...
7
3242
by: CK | last post by:
Hello, I have the 60 MB XML string and I am coding a program in Visual Basic to run a XSL transformation on it. Currently, I'm using the Microsoft standard MSXML 2.0 to create a DOM document, load the XML, and then run the XSL transformation on it using the MSXML2.IXSLProcessor interface. The problem is that it kills my system because of an incredible amount of memory that it requires to do this (around 850 MB). Are there any other...
1
1921
by: Andrew Connell | last post by:
I have an XML document and an XSLT transformation sheet. My first issue is that my XML file won't load into the XPathDocument object. However, when I use an obsolete transformation method where I specify the XML input file and output file, I get the same error. The error is: An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll Additional information: System error. Here's my code... commented to show where...
2
1783
by: TomekR | last post by:
Hello ! I was developing xslt sheet lately and - experimenting - I made mistake resulting in that, the effect of the transformation is not well-formed xml document. I made these tests using XmlSpy and in output window I can see two parallel elements - according to "logic" of me sheet. The error of that document is that it doesn't have root element. Here is the contents of XmlSpy output window:
0
1227
by: Hugo Ferreira | last post by:
Hi all, I'm having a problem here, to which I hope someone to be able to help me :) I need to apply a XSLT transformation to the output of all my ASPX webpages. I've recently found the tag <asp:xml> which allows me to point out a transformation document, and put inline XML. The problem is: I cannot mix logic in this XML. A simple example: <asp:xml TransformSource="XslDemo.xslt" runat="server">
1
2246
by: Axel Dahmen | last post by:
Hi, today I've had a strange DTS error: In one of my transformations I'd been using several Copy Column transformations + one ActiveX transformation using a lookup function. This lookup function uses a second connection to the same SQL server but to a different database. I'm using this function to populate a new column in a table with calculated values. The transformation didn't run, I got an "Transaction context in use by another...
4
4302
by: =?Utf-8?B?REZC?= | last post by:
Within an XSLT transformation, I'm trying to switch the default namespace within a section of the generated XML document to a shared namespace. This way, the content of this section does not have to use a prefix for the shared namespace, thus making the document smaller and easier to read. This worked in .NET 1.1 with no problem, but now appears to be broken in 2.0. When you try to do this, the following XslTransformException is...
0
8067
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8483
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6820
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5479
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4030
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1336
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.