Re: [Servingxml-help] Content is notallowed in prolog?
Brought to you by:
danielaparker
From: Daniel P. <dan...@sy...> - 2006-02-03 06:09:20
|
Sure. Just declare the prefix ord somewhere in scope, perhaps in the = sx:recordMapping element, and use qualified element names in the mapping = section, e.g. use ord:orders, ord:order, element=3D"ord:ordertype", etc. = Have a look at the resources-books.xml file in the samples. -- Daniel ----- Original Message -----=20 From: Akhil S. Srinivasan=20 To: Daniel Parker=20 Cc: ser...@li...=20 Sent: Friday, February 03, 2006 12:12 AM Subject: RE: [Servingxml-help] Content is notallowed in prolog? Thanks for pointing that out. The main problem that I now have is that = ServingXML generates the data itself. Basically I have a TextMessage coming in containing the initial string = B,AMZN,Amazon Inc,10.0 Which servicingXML converts into the xml block you have seen. This = block has to then be reconverted into the CSV format. =20 I have used this to convert the original CSV into XML =20 <sx:service id=3D"orderstoxml"> <sx:serialize> <sx:transform> <sx:content ref=3D"orders"/>=20 </sx:transform> </sx:serialize> </sx:service> =20 <sx:recordContent id=3D"orders"> <sx:flatFileReader> <!-- Is not need, it does the transform then on anything given <sx:stringSource /> <sx:urlSource url=3D"orders.csv"/>=20 --> <sx:flatFile ref=3D"ordersFlatFile"/> <!-- causes error for some reason <msv:msvRecordFilter schema=3D"order-record.xsd"/> --> </sx:flatFileReader> <sx:recordMapping ref=3D"ordersToXmlMapping"/> </sx:recordContent> =20 <sx:flatFile id=3D"ordersFlatFile"> <sx:commentSymbol value=3D"#"/> <sx:flatFileBody> <sx:flatRecordType id=3D"order"> <sx:fieldDelimiter value=3D","/> <sx:delimitedField name=3D"ordertype-field" = label=3D"OrderType"/> <sx:delimitedField name=3D"companyticker-field" = label=3D"CompanyTicker"/> <sx:delimitedField name=3D"companyname-field" = label=3D"CompanyName"/> <sx:delimitedField name=3D"quantity-field" = label=3D"Quantity"/> </sx:flatRecordType> </sx:flatFileBody> </sx:flatFile> =20 =20 <sx:recordMapping id=3D"ordersToXmlMapping"> <orders> <sx:onRecord> <order> <sx:fieldElementMap field=3D"ordertype-field" = element=3D"ordertype"/> =20 <sx:fieldElementMap field=3D"companyticker-field" = element=3D"companyticker"/> =20 <sx:fieldElementMap field=3D"companyname-field" = element=3D"companyname"/> =20 <sx:fieldElementMap field=3D"quantity-field" = element=3D"quantity"/> =20 </order> =20 </sx:onRecord> </orders> </sx:recordMapping>=20 =20 Is there any way I can force it to add namespace information? =20 Thanks =20 Akhil Srinivasan =20 =20 -------------------------------------------------------------------------= ----- From: Daniel Parker [mailto:dan...@sy...]=20 Sent: Friday, February 03, 2006 10:29 AM To: Akhil S. Srinivasan Subject: Re: [Servingxml-help] Content is notallowed in prolog? =20 Akhil, =20 I attempted to test this at the command line, and noted an = inconsistency between the resources script and the XML input. The = resources script assumes that the elements belong to a namespace, but = the elements in the input have no namespace. =20 If I enclose your resources script definitions with =20 <resources xmlns:sx=3D"http://www.servingxml.com/core" = xmlns:ord=3D"order"> ... </resources>=20 =20 and modify the XML input as follows =20 <?xml version=3D"1.0" encoding=3D"utf-8"?> <ord:orders xmlns:ord=3D"order"> <ord:order> <ord:ordertype>B</ord:ordertype> <ord:companyticker>AMZN</ord:companyticker> <ord:companyname>Amazon Inc</ord:companyname> <ord:quantity>10.0</ord:quantity> </ord:order> </ord:orders> I get the following output =20 B,AMZN,Amazon Inc,10.0 =20 Could you double check that your XML input and resources files are = consistent in your tests with servicemix? =20 Thanks, Daniel=20 ----- Original Message -----=20 From: Akhil S. Srinivasan=20 To: ser...@li...=20 Sent: Thursday, February 02, 2006 8:17 AM Subject: [Servingxml-help] Content is notallowed in prolog? =20 While converting from xmltocsv I get this error =20 [Fatal Error] :1:1: Content is not allowed in prolog. com.servingxml.util.ServingXmlException: Content is not allowed in = prolog. at = com.servingxml.components.xmlpipeline.Pipeline.execute(Pipeline.java:94) at = com.servingxml.components.inverserecordmapping.XmlRecordReader.readRecord= s(XmlRecordReader.java:93) at = com.servingxml.components.recordio.RecordPipeline.execute(RecordPipeline.= java:69) at = com.servingxml.components.recordio.ProcessRecordsAppender.execute(Process= RecordsAppender.java:81) at = com.servingxml.components.service.ServiceImpl.execute(ServiceImpl.java:66= ) at = com.mastek.servicemix.ServingXmlTransformer.toResult(ServingXmlTransforme= r.java:130) at = com.mastek.servicemix.TextSourceMarshaler.asString(TextSourceMarshaler.ja= va:28) =20 the xml block sent is=20 =20 <?xml version=3D"1.0" = encoding=3D"utf-8"?><orders><order><ordertype>B</ordertype><companyticker= >AMZN</companyticker><companyname>Amazon = Inc</companyname><quantity>10.0</quantity></order></orders> =20 In my resource file, I have configured as shown below=20 =20 <sx:service id=3D"orderstocsv" name=3D"orderstocsv"> <sx:writeRecords> <sx:flatFileWriter> <sx:flatFile ref=3D"ordersFlatFile"/> </sx:flatFileWriter> <sx:xmlRecordReader> <sx:inverseRecordMapping ref=3D"ordersToCSVMapping"/> <sx:transform> <sx:document/> </sx:transform> </sx:xmlRecordReader> </sx:writeRecords> =20 </sx:service> =20 =20 <sx:inverseRecordMapping id=3D"ordersToCSVMapping"> <sx:documentFragmentMap path=3D"/ord:orders/ord:order"> <sx:fragmentRecordMap recordType=3D"order"> <sx:fragmentFieldMap select=3D"ord:ordertype" = field=3D"ordertype-field"/> <sx:fragmentFieldMap select=3D"ord:companyticker" = field=3D"companyticker-field"/> <sx:fragmentFieldMap select=3D"ord:companyname" = field=3D"companyname-field"/> <sx:fragmentFieldMap select=3D"ord:quantity" = field=3D"quantity-field"/> </sx:fragmentRecordMap> </sx:documentFragmentMap> </sx:inverseRecordMapping> =20 <sx:flatFile id=3D"ordersFlatFile"> <sx:commentSymbol value=3D"#"/> <sx:flatFileBody> <sx:flatRecordType id=3D"order"> <sx:fieldDelimiter value=3D","/> <sx:delimitedField name=3D"ordertype-field" = label=3D"OrderType"/> <sx:delimitedField name=3D"companyticker-field" = label=3D"CompanyTicker"/> <sx:delimitedField name=3D"companyname-field" = label=3D"CompanyName"/> <sx:delimitedField name=3D"quantity-field" = label=3D"Quantity"/> </sx:flatRecordType> </sx:flatFileBody> </sx:flatFile> =20 =20 Any help would be appreciated? =20 Thank You =20 Akhil Srinivasan =20 MASTEK=20 "Making a valuable difference" Mastek in NASSCOM's 'India Top 20' Software Service Exporters = List. In the US, we're called MAJESCOMASTEK = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opinions expressed in this e-mail are those of the individual = and not that of Mastek Limited, unless specifically indicated to that = effect. Mastek Limited does not accept any responsibility or liability = 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 = person or entity to which it is addressed. Any review, re-transmission, = dissemination or other use of or taking of any action in reliance upon = this information by persons or entities other than the intended = recipient is prohibited. This e-mail and its attachments have been = scanned for the presence of computer 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. = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 =20 =20 =20 =20 MASTEK=20 "Making a valuable difference" Mastek in NASSCOM's 'India Top 20' Software Service Exporters = List. In the US, we're called MAJESCOMASTEK = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opinions expressed in this e-mail are those of the individual = and not that of Mastek Limited, unless specifically indicated to that = effect. Mastek Limited does not accept any responsibility or liability = 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 = person or entity to which it is addressed. Any review, re-transmission, = dissemination or other use of or taking of any action in reliance upon = this information by persons or entities other than the intended = recipient is prohibited. This e-mail and its attachments have been = scanned for the presence of computer 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. = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 |