Expand my Community achievements bar.

How can I "beautify" the output of an XML Query

Avatar

Former Community Member
Hi,<br /><br />I created a simple process that executes a SQL query and transforms the data to XML. I've put that variable as an output parameter to see the result.<br /><br />Unfortunately, LCES makes a document element from it with CDATA in it. This is not what I want. I want the nodes to appear directly in my output.<br /><br />Anybody who knows what I should do ?<br /><br />Regards<br />Yves<br /><br /><soapenv:Body><br /> <invokeResponse xmlns="http://adobe.com/idp/services"><br /> <test_data xsi:type="ns1:XML" xmlns:ns1="http://adobe.com/idp/services"><br /> <document><?xml version="1.0"?><br /><xml><row><EventDate type="DATE">2006-02-16</EventDate><Jobs type="INTEGER UNSIGNED">9</Jobs><Pages type="INTEGER UNSIGNED">9</Pages><FirstJob type="TIME">14:06:51</FirstJob><LastJob type="TIME">15:42:32</LastJob></row><row><EventDate type="DATE">2006-02-17</EventDate><Jobs type="INTEGER UNSIGNED">22</Jobs><Pages type="INTEGER UNSIGNED">22</Pages><FirstJob type="TIME">13:13:17</FirstJob><LastJob type="TIME">15:23:00</LastJob></row>
7 Replies

Avatar

Former Community Member
<soapenv:Body><br /> <invokeResponse xmlns="http://adobe.com/idp/services"><br /> <test_data xsi:type="ns1:XML" xmlns:ns1="http://adobe.com/idp/services"><br /> <document><?xml version="1.0"?><br /><xml><row><EventDate type="DATE">2006-02-16</EventDate><Jobs type="INTEGER UNSIGNED">9</Jobs><Pages type="INTEGER UNSIGNED">9</Pages><FirstJob type="TIME">14:06:51</FirstJob><LastJob type="TIME">15:42:32</LastJob></row><row><EventDate type="DATE">2006-02-17</EventDate><Jobs type="INTEGER UNSIGNED">22</Jobs><Pages type="INTEGER UNSIGNED">22</Pages><FirstJob type="TIME">13:13:17</FirstJob><LastJob type="TIME">15:23:00</LastJob></row>

Avatar

Former Community Member
Hmm, I can't post an example ... unless i split the CDATA<br /><br /><test_data xsi:type="ns1:XML" xmlns:ns1="http://adobe.com/idp/services"><br /> <document><![CD A T A[<?xml version="1.0"?><br /><xml><row><EventDate type="DATE">2006-02-16</EventDate><Jobs type="INTEGER UNSIGNED">9</Jobs><Pages type="INTEGER UNSIGNED">9</Pages><FirstJob type="TIME">14:06:51</FirstJob><LastJob type="TIME">15:42:32</LastJob></row>

Avatar

Former Community Member
When one XML document (e.g. a SOAP response) contains a separate XML document within it, that XML data is wrapped in a CDATA tag. One way to get around this is to use the XSLT Service to produce a new XML document containing only the contents of the CDATA. I attach a sample process xml and an xsl file that may be useful.



Gary

Avatar

Former Community Member
Hi,



Thanks for the response, but I don't see any attachments.

Could you please send your attachments to yves dot vindevogel at cronos dot be ?



Tia,

Yves

Avatar

Former Community Member
Input.xsl:<br /><br /><?xml version="1.0" encoding="UTF-8" ?> <br />- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gb="http://adobe.com/idp/services"><br /> <xsl:output method="xml" /> <br />- <xsl:template match="/"><br />- <data><br /> <xsl:value-of select="gb:document" /> <br /> </data><br /> </xsl:template><br /> </xsl:stylesheet><br /><br />SampleXSLT.1.0:<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><sup:process monitor-access="false" transaction-timeout="-1" transaction-propagation="REQUIRES NEW" type="transient" pof-object-type="" name="USBXSLT" id="P1178311695152" xmlns:jav="http://www.adobe.com/2006/JavaTypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sup="http://adobe.com/workflow/template/support"><sup:description/><sup:variables><sup:variable visibleInUI="true" searchable="true" description="" title="" pof-attribute="create_time" type="xs:dateTime" required="true" in="false" out="false" name="create_time" id="V1184187125673"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="true" searchable="true" description="" title="" pof-attribute="creator_id" type="xs:string" required="true" in="false" out="false" name="creator_id" id="V1184187125674"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="false" searchable="false" description="" title="" pof-attribute="" type="jav:xml" required="false" in="false" out="false" name="dataXML" id="V1184187125678"><sup:property readonly="false" dependent-property="" editor="" description="" name="xsd reference" id="VP1184187126024"/><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="false" searchable="false" description="" title="" pof-attribute="" type="jav:document" required="false" in="false" out="true" name="dataXMLDocument" id="V1184187125679"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="true" searchable="true" description="" title="" pof-attribute="id" type="xs:long" required="true" in="false" out="false" name="id" id="V1184187125675"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="false" searchable="false" description="" title="" pof-attribute="inputxml" type="jav:document" required="false" in="true" out="false" name="inputxml" id="V1184187125680"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="true" searchable="true" description="" title="" pof-attribute="status" type="xs:string" required="true" in="false" out="false" name="status" id="V1184187125676"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="false" searchable="false" description="" title="" pof-attribute="transformedxml" type="jav:document" required="false" in="false" out="false" name="transformedXML" id="V1184187125681"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="true" searchable="true" description="" title="" pof-attribute="update_time" type="xs:dateTime" required="true" in="false" out="false" name="update_time" id="V1184187125677"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="false" searchable="false" description="" title="" pof-attribute="xmlforxsl" type="jav:xml" required="false" in="false" out="false" name="xmlForXSL" id="V1184187125682"><sup:property readonly="false" dependent-property="" editor="" description="" name="xsd reference" id="VP1184187126025"/><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable><sup:variable visibleInUI="false" searchable="false" description="" title="" pof-attribute="xslturi" type="jav:string" required="false" in="true" out="false" name="xsltURI" id="V1184187125683"><sup:property readonly="false" dependent-property="" editor="" description="" name="length" id="VP1184187126026"/><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:variable></sup:variables><sup:branch start-action="Get XML from input doc" type="transactional" y-position="0" x-position="0" name="main-branch" id="B1178311695214"><sup:description xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><sup:pools><sup:pool start-action="Get XML from input doc" y-position="0" x-position="2" type="horizontal" name="POOL" id="PL1178311695214"><sup:description xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><sup:swimlanes><sup:swimlane type="horizontal" color="RGB{192, 192, 192}" width="2000" height="600" y-position="0" x-position="34" name="SWIMLANE0" id="S1178311695214"><sup:description xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><sup:actions><sup:invoke operation-name="transformFromURI" service-name="XSLTService" isFireAndForget="false" isLongLived="false" color="" y-position="200" x-position="130" name="Transform using XSLT URL" id="A1178311813709"><sup:description/><sup:routes><sup:route destination="Get Data XML" to-port="TOP_CENTER" from-port="BOTTOM_CENTER" segment-distance="0" segment="0" y-offset="0" x-offset="0" link-type="normal" connective="" name="route1" id="R1178388116299"><sup:description xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:route></sup:routes><sup:event-catchs><sup:default-exception-catch position="bottom-right" event-category="Exception" event-type-name="DEFAULT EXCEPTION" operation-name="transformFromURI" name="DEFAULT EXCEPTION" id="EC1178311813787"/></sup:event-catchs><sup:input type="LITERAL" name="factoryName"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:input><sup:input type="VARIABLE" name="xml"><sup:value>xmlForXSL</sup:value></sup:input><sup:input type="VARIABLE" name="xslt"><sup:value>xsltURI</sup:value></sup:input><sup:output type="VARIABLE" name="result"><sup:value>transformedXML</sup:value></sup:output></sup:invoke><sup:invoke operation-name="execute" service-name="SetValue" isFireAndForget="false" isLongLived="false" color="" y-position="50" x-position="130" name="Get XML from input doc" id="A1178327563980"><sup:description/><sup:routes><sup:route destination="Transform using XSLT URL" to-port="TOP_CENTER" from-port="RIGHT_CENTER" segment-distance="0" segment="0" y-offset="0" x-offset="0" link-type="normal" connective="" name="route0" id="R1178388116296"><sup:description xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:route></sup:routes><sup:input type="IMPLICIT" name="execution-context"><sup:value xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></sup:input><sup:input type="LITERAL" name="mappings"><sup:value><list><br /> <com.adobe.idp.workflow.dsc.type.SetValueMapping><br /> <m__locationExpr>/process_data/xmlForXSL</m__locationExpr><br /> <m__valueExpr>/process_data/@inputxml</m__valueExpr><br /> </com.adobe.idp.workflow.dsc.type.SetValueMapping><br /></list></sup:value></sup:input></sup:invoke><sup:invoke operation-name="writeDocument" service-name="FileUtilsService" isFireAndForget="false" isLongLived="false" color="" y-position="200" x-position="325" name="Debug XML" id="A1178464954420"><sup:description/><sup:event-catchs><sup:default-exception-catch position="bottom-right" event-category="Exception" event-type-name="DEFAULT EXCEPTION" operation-name="writeDocument" name="DEFAULT EXCEPTION" id="EC1178467322998"/></sup:event-catchs><sup:input type="LITERAL" name="pathnamePattern"><sup:value>c:\scrap\docdata.xml</sup:value></sup:input><sup:input type="VARIABLE" name="document"><sup:value>dataXMLDocument</sup:value></sup:input><sup:input type="LITERAL" name="makeUnique"><sup:value>t

Avatar

Former Community Member
Hi Kim,



Thanks for the reply, but this does not solve my problem.



I want to do this in the workbench itself. With your code, I can create a new variable with the content in it, but still, when exported, it gives me the document tag again with the CDATA tags.



Yves