RE: [Servingxml-help] Content is notallowed in prolog?
Brought to you by:
danielaparker
From: Akhil S. S. <ak...@ma...> - 2006-02-03 05:21:13
|
Thanks for pointing that out. The main problem that I now have is that=0D=0A= ServingXML generates the data itself.=0D=0A=0D=0ABasically I have a TextMes= sage coming in containing the initial string=0D=0AB,AMZN,Amazon Inc,10.0=0D= =0A=0D=0AWhich servicingXML converts into the xml block you have seen. This= block=0D=0Ahas to then be reconverted into the CSV format.=0D=0A=0D=0A=20=0D= =0A=0D=0AI have used this to convert the original CSV into XML=0D=0A=0D=0A =0D= =0A=0D=0A <sx:service id=3D"orderstoxml">=0D=0A=0D=0A <sx:serialize>=0D= =0A=0D=0A <sx:transform>=0D=0A=0D=0A <sx:content ref=3D"orders"= />=20=0D=0A=0D=0A </sx:transform>=0D=0A=0D=0A </sx:serialize>=0D=0A=0D= =0A </sx:service>=0D=0A=0D=0A=20=0D=0A=0D=0A <sx:recordContent id=3D"orde= rs">=0D=0A=0D=0A <sx:flatFileReader>=0D=0A=0D=0A <!-- Is not need, = it does the transform then on anything given=0D=0A=0D=0A <sx:str= ingSource />=0D=0A=0D=0A <sx:urlSource url=3D"orders.csv"/>=20=0D= =0A=0D=0A -->=0D=0A=0D=0A <sx:flatFile ref=3D"ordersFlatFile"/>=0D= =0A=0D=0A <!-- causes error for some reason=0D=0A=0D=0A <ms= v:msvRecordFilter schema=3D"order-record.xsd"/>=0D=0A=0D=0A -->=0D=0A=0D= =0A </sx:flatFileReader>=0D=0A=0D=0A <sx:recordMapping ref=3D"ordersT= oXmlMapping"/>=0D=0A=0D=0A </sx:recordContent>=0D=0A=0D=0A =20=0D=0A=0D=0A= <sx:flatFile id=3D"ordersFlatFile">=0D=0A=0D=0A <sx:commentSymbol valu= e=3D"#"/>=0D=0A=0D=0A <sx:flatFileBody>=0D=0A=0D=0A <sx:flatRecor= dType id=3D"order">=0D=0A=0D=0A <sx:fieldDelimiter value=3D","/>=0D=0A=0D= =0A <sx:delimitedField name=3D"ordertype-field" label=3D"OrderType= "/>=0D=0A=0D=0A <sx:delimitedField name=3D"companyticker-field"=0D=0Al= abel=3D"CompanyTicker"/>=0D=0A=0D=0A <sx:delimitedField name=3D"co= mpanyname-field"=0D=0Alabel=3D"CompanyName"/>=0D=0A=0D=0A <sx:deli= mitedField name=3D"quantity-field" label=3D"Quantity"/>=0D=0A=0D=0A = </sx:flatRecordType>=0D=0A=0D=0A </sx:flatFileBody>=0D=0A=0D=0A </sx:fl= atFile> =20=0D=0A=0D=0A=20=0D=0A=0D=0A <sx:recordMapping id=3D"ordersT= oXmlMapping">=0D=0A=0D=0A <orders>=0D=0A=0D=0A <sx:onRecord>=0D=0A=0D= =0A <order>=0D=0A=0D=0A <sx:fieldElementMap field=3D"ordert= ype-field"=0D=0Aelement=3D"ordertype"/> =20=0D=0A=0D=0A <sx:fieldE= lementMap field=3D"companyticker-field"=0D=0Aelement=3D"companyticker"/> = =20=0D=0A=0D=0A <sx:fieldElementMap field=3D"companyname-fie= ld"=0D=0Aelement=3D"companyname"/> =20=0D=0A=0D=0A <sx:fieldElemen= tMap field=3D"quantity-field"=0D=0Aelement=3D"quantity"/> =20=0D=0A=0D= =0A </order> =20=0D=0A=0D=0A </sx:onRecord>=0D=0A=0D=0A </or= ders>=0D=0A=0D=0A </sx:recordMapping>=20=0D=0A=0D=0A=20=0D=0A=0D=0AIs ther= e any way I can force it to add namespace information=3F=0D=0A=0D=0A=20=0D=0A=0D= =0AThanks=0D=0A=0D=0A=20=0D=0A=0D=0AAkhil Srinivasan=0D=0A=0D=0A=20=0D=0A=0D= =0A=20=0D=0A=0D=0A _____ =20=0D=0A=0D=0AFrom: Daniel Parker [mailto:daniel= ap...@sy...]=20=0D=0ASent: Friday, February 03, 2006 10:29 AM=0D=0A= To: Akhil S. Srinivasan=0D=0ASubject: Re: [Servingxml-help] Content is nota= llowed in prolog=3F=0D=0A=0D=0A=20=0D=0A=0D=0AAkhil,=0D=0A=0D=0A=20=0D=0A=0D= =0AI attempted to test this at the command line, and noted an inconsistency=0D= =0Abetween the resources script and the XML input. The resources script=0D= =0Aassumes that the elements belong to a namespace, but the elements in the=0D= =0Ainput have no namespace.=0D=0A=0D=0A=20=0D=0A=0D=0AIf I enclose your res= ources script definitions with=0D=0A=0D=0A=20=0D=0A=0D=0A<resources xmlns:s= x=3D"http://www.servingxml.com/core" xmlns:ord=3D"order">=0D=0A=0D=0A...=0D= =0A</resources>=20=0D=0A=0D=0A=20=0D=0A=0D=0Aand modify the XML input as fo= llows=0D=0A=0D=0A=20=0D=0A=0D=0A<=3Fxml version=3D"1.0" encoding=3D"utf-8"=3F= >=0D=0A<ord:orders xmlns:ord=3D"order">=0D=0A <ord:order>=0D=0A <ord:or= dertype>B</ord:ordertype>=0D=0A <ord:companyticker>AMZN</ord:companytick= er>=0D=0A <ord:companyname>Amazon Inc</ord:companyname>=0D=0A <ord:qu= antity>10.0</ord:quantity>=0D=0A </ord:order>=0D=0A</ord:orders>=0D=0A=0D=0A= I get the following output=0D=0A=0D=0A=20=0D=0A=0D=0AB,AMZN,Amazon Inc,10.0=0D= =0A=0D=0A=20=0D=0A=0D=0ACould you double check that your XML input and reso= urces files are=0D=0Aconsistent in your tests with servicemix=3F=0D=0A=0D=0A= =20=0D=0A=0D=0AThanks,=0D=0A=0D=0ADaniel=20=0D=0A=0D=0A=09----- Original Me= ssage -----=20=0D=0A=0D=0A=09From: Akhil S. Srinivasan <mailto:akhilss@mast= ek.com> =20=0D=0A=0D=0A=09To: ser...@li...=20=0D=0A=0D= =0A=09Sent: Thursday, February 02, 2006 8:17 AM=0D=0A=0D=0A=09Subject: [Ser= vingxml-help] Content is notallowed in prolog=3F=0D=0A=0D=0A=09=20=0D=0A=0D= =0A=09While converting from xmltocsv I get this error=0D=0A=0D=0A=09=20=0D=0A=0D= =0A=09[Fatal Error] :1:1: Content is not allowed in prolog.=0D=0A=0D=0A=09c= om.servingxml.util.ServingXmlException: Content is not allowed=0D=0Ain prol= og.=0D=0A=0D=0A=09 at=0D=0Acom.servingxml.components.xmlpipeline.Pip= eline.execute(Pipeline.java:94)=0D=0A=0D=0A=09 at=0D=0Acom.servingxm= l.components.inverserecordmapping.XmlRecordReader.readRecor=0D=0Ads(XmlReco= rdReader.java:93)=0D=0A=0D=0A=09 at=0D=0Acom.servingxml.components.r= ecordio.RecordPipeline.execute(RecordPipeline=0D=0A.java:69)=0D=0A=0D=0A=09= at=0D=0Acom.servingxml.components.recordio.ProcessRecordsAppender.e= xecute(Proces=0D=0AsRecordsAppender.java:81)=0D=0A=0D=0A=09 at=0D=0A= com.servingxml.components.service.ServiceImpl.execute(ServiceImpl.java:6=0D= =0A6)=0D=0A=0D=0A=09 at=0D=0Acom.mastek.servicemix.ServingXmlTransfo= rmer.toResult(ServingXmlTransform=0D=0Aer.java:130)=0D=0A=0D=0A=09 a= t=0D=0Acom.mastek.servicemix.TextSourceMarshaler.asString(TextSourceMarshal= er.j=0D=0Aava:28)=0D=0A=0D=0A=09=20=0D=0A=0D=0A=09the xml block sent is=20=0D= =0A=0D=0A=09=20=0D=0A=0D=0A=09<=3Fxml version=3D"1.0"=0D=0Aencoding=3D"utf-= 8"=3F><orders><order><ordertype>B</ordertype><companyticker>=0D=0AAMZN</com= panyticker><companyname>Amazon=0D=0AInc</companyname><quantity>10.0</quanti= ty></order></orders>=0D=0A=0D=0A=09=20=0D=0A=0D=0A=09In my resource file, I= have configured as shown below=20=0D=0A=0D=0A=09=20=0D=0A=0D=0A=09 <sx:se= rvice id=3D"orderstocsv" name=3D"orderstocsv">=0D=0A=0D=0A=09 <sx:writeR= ecords>=0D=0A=0D=0A=09 <sx:flatFileWriter>=0D=0A=0D=0A=09 <sx:f= latFile ref=3D"ordersFlatFile"/>=0D=0A=0D=0A=09 </sx:flatFileWriter>=0D= =0A=0D=0A=09 <sx:xmlRecordReader>=0D=0A=0D=0A=09 <sx:inverseRec= ordMapping ref=3D"ordersToCSVMapping"/>=0D=0A=0D=0A=09 <sx:transform= >=0D=0A=0D=0A=09 <sx:document/>=0D=0A=0D=0A=09 </sx:tra= nsform>=0D=0A=0D=0A=09 </sx:xmlRecordReader>=0D=0A=0D=0A=09 </sx:wr= iteRecords> =20=0D=0A=0D=0A=09 </sx:service>=0D=0A=0D=0A=09=20=0D=0A=0D=0A= =09 =20=0D=0A=0D=0A=09 <sx:inverseRecordMapping id=3D"o= rdersToCSVMapping">=0D=0A=0D=0A=09 <sx:documentFragmentMap path=3D"/ord:= orders/ord:order">=0D=0A=0D=0A=09 <sx:fragmentRecordMap recordType=3D"= order">=0D=0A=0D=0A=09 <sx:fragmentFieldMap select=3D"ord:ordertype"=0D= =0Afield=3D"ordertype-field"/>=0D=0A=0D=0A=09 <sx:fragmentFieldMap s= elect=3D"ord:companyticker"=0D=0Afield=3D"companyticker-field"/>=0D=0A=0D=0A= =09 <sx:fragmentFieldMap select=3D"ord:companyname"=0D=0Afield=3D"co= mpanyname-field"/>=0D=0A=0D=0A=09 <sx:fragmentFieldMap select=3D"ord= :quantity"=0D=0Afield=3D"quantity-field"/>=0D=0A=0D=0A=09 </sx:fragmen= tRecordMap>=0D=0A=0D=0A=09 </sx:documentFragmentMap>=0D=0A=0D=0A=09 </s= x:inverseRecordMapping>=0D=0A=0D=0A=09=20=0D=0A=0D=0A=09 <sx:flatFile id=3D= "ordersFlatFile">=0D=0A=0D=0A=09 <sx:commentSymbol value=3D"#"/>=0D=0A=0D= =0A=09 <sx:flatFileBody>=0D=0A=0D=0A=09 <sx:flatRecordType id=3D"= order">=0D=0A=0D=0A=09 <sx:fieldDelimiter value=3D","/>=0D=0A=0D=0A=09= <sx:delimitedField name=3D"ordertype-field"=0D=0Alabel=3D"OrderTy= pe"/>=0D=0A=0D=0A=09 <sx:delimitedField name=3D"companyticker-field"=0D= =0Alabel=3D"CompanyTicker"/>=0D=0A=0D=0A=09 <sx:delimitedField nam= e=3D"companyname-field"=0D=0Alabel=3D"CompanyName"/>=0D=0A=0D=0A=09 = <sx:delimitedField name=3D"quantity-field"=0D=0Alabel=3D"Quantity"/>=0D=0A=0D= =0A=09 </sx:flatRecordType>=0D=0A=0D=0A=09 </sx:flatFileBody>=0D=0A=0D= =0A=09 </sx:flatFile> =20=0D=0A=0D=0A=09=20=0D=0A=0D=0A=09Any help wou= ld be appreciated=3F=0D=0A=0D=0A=09=20=0D=0A=0D=0A=09Thank You=0D=0A=0D=0A=09= =20=0D=0A=0D=0A=09Akhil Srinivasan=0D=0A=0D=0A=09=20=0D=0A=0D=0A=0D=0AMASTE= K=20=0D=0A"Making a valuable difference"=0D=0AMastek in NASSCOM's 'India To= p 20' Software Service Exporters List.=0D=0AIn the US, we're called MAJESCO= MASTEK=0D=0A=0D=0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~=0D=0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=0D=0AOpinions e= xpressed in this e-mail are those of the individual and not=0D=0Athat of Ma= stek Limited, unless specifically indicated to that effect.=0D=0AMastek Lim= ited does not accept any responsibility or liability for it.=0D=0AThis e-ma= il and attachments (if any) transmitted with it are=0D=0Aconfidential and/o= r privileged and solely for the use of the intended=0D=0Aperson or entity t= o which it is addressed. Any review, re-transmission,=0D=0Adissemination or= other use of or taking of any action in reliance upon=0D=0Athis informatio= n by persons or entities other than the intended=0D=0Arecipient is prohibit= ed. This e-mail and its attachments have been=0D=0Ascanned for the presence= of computer viruses. It is the responsibility=0D=0Aof the recipient to run= the virus check on e-mails and attachments=0D=0Abefore opening them. If yo= u have received this e-mail in error, kindly=0D=0Adelete this e-mail from a= ll computers.=0D=0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~=0D=0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=0D=0A=0D=0A =0D= =0A=0D=0A=20=0D=0A=0D=0A=20=0D=0A=0D=0AMASTEK=20=0D=0A"Making a valuable di= fference"=0D=0AMastek in NASSCOM's 'India Top 20' Software Service Exporter= s List.=0D=0AIn the US, we're called MAJESCOMASTEK=0D=0A=0D=0A~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~=0D=0AOpinions expressed in this e-mail are those of = the individual and not that of Mastek Limited, unless specifically indicate= d to that effect. Mastek Limited does not accept any responsibility or liab= ility for it. This e-mail and attachments (if any) transmitted with it are = confidential and/or privileged and solely for the use of the intended perso= n or entity to which it is addressed. Any review, re-transmission, dissemin= ation or other use of or taking of any action in reliance upon this informa= tion by persons or entities other than the intended recipient is prohibited= =2E This e-mail and its attachments have been scanned for the presence of c= omputer viruses. It is the responsibility of the recipient to run the virus= check on e-mails and attachments before opening them. If you have received= this e-mail in error, kindly delete this e-mail from all computers.=0D=0A~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=0D=0A |