Hi Sanjeev,

My advice to use sml:ExportToXMLFile in the SWP script was bad. The variable 
?output should already contain a perfectly good XML string, so it’s better to 
write it straight to a file with sml:ExportToTextFile, avoiding the re-parsing 
and re-serialising that ExportToXMLFile does. This also removes the need for 
adding the XML declaration, because our original ?output already had an XML 
declaration before it was removed by the parsing and re-serialising in 
ExportToXMLFile. So here’s a better version of geographyOutput:UpdateFile:

<ui:group let:outfile="/Test/out.xml">
    <ui:bind>
        <ui:stringify ui:format="ui:XML" ui:varName="output">
            <geographyOutput:getOutput/>
        </ui:stringify>
        <sml:ExportToTextFile sml:encoding="utf-8" sml:targetFilePath="{= 
?outfile }" sml:text="{= ?output }"/>
        <ui:group>XML output written to {= ?outfile }</ui:group>
    </ui:bind>
</ui:group>

Let me know if that works.

Richard



> On 13 Feb 2019, at 19:33, Sanjeev Devireddy <[email protected]> 
> wrote:
> 
> Hi Richard,
>    Could you please share the project/file for the above said example? For 
> some reason I get error. I tried the same that you said, by adding a new 
> ui:Services subclass with ui:responseType ui:TEXT and the following 
> ui:prototype. Please find the attachment for the example that I am trying 
> with.
> 
> 
> <Auto Generated Inline Image 1.png>
> 
> 
> I get different errors as shown below...
> Without XML declaration 
> Caused by: org.topbraid.spin.sparqlmotion.modules.SMException: Failed to 
> parse XML document for variable xml: 
> com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 
> Invalid byte 2 of 3-byte UTF-8 sequence
> 
> with XML declaration
> Failed to parse XML document for variable xml: org.xml.sax.SAXParseException; 
> lineNumber: 1; columnNumber: 45; The processing instruction target matching 
> "[xX][mM][lL]"
> 
> Thanks,
> Sanjeev
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> <geographyOutput.ui.ttlx><Auto Generated Inline Image 1.png>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to