4 Replies Latest reply: Sep 13, 2012 11:22 AM by cool.br33ze RSS

    OSB, XQuery, CDATA and XML

    cool.br33ze
      Hi

      I'm new the OSB and I have the following problem.

      We have a tuxedo application making a call to an OSB Business service via a OSB proxy service.
      In the transforamtion of the message from tuxedo I need to create a CDATA text that looks like XML elements.
      The data being passed in is in an FML32 buffer.

      So how do I create something like this <Payload> in an XQuery transformation?

      <Payload>
           <![CDATA[
           <xml>
           <element1 DisplayName="element1">
                <element2 DisplayName="element2">FML_FIELD_1<element2>
                <element3 DisplayName="element3">FML_FIELD_2<element3>
                <element4 DisplayName="element4">FML_FIELD_3<element4>
                <element5 DisplayName="element5">
                     <element6 DisplayName="element6">
                          <element7 DisplayName="element7">FML_FIELD_4</element7>
                          <element8 DisplayName="element8">FML_FIELD_5<element8>
                          <element9>FML_FIELD_6<element9>
                          <element10>FML_FIELD_7<element10>
                          <element11>FML_FIELD_8<element11>
                     <element6>
                     <element12 DisplayName="element12">FML_FIELD_9<element12>
                     <element13 DisplayName="element13">FML_FIELD_10<element13>
                     <element14 DisplayName="element14">FML_FIELD_11<element14>
                     <element15 DisplayName="element15">FML_FIELD_12<element15>
                <element5>
           <element1>
           </xml>]]>
      </Payload>

      Thanks in advance for your help.
      MI
        • 1. Re: OSB, XQuery, CDATA and XML
          odie_63
          Hi,

          Looks like you need fn-bea:serialize() function :

          http://docs.oracle.com/cd/E14571_01/doc.1111/e15867/xquery.htm#autoId9
          • 2. Re: OSB, XQuery, CDATA and XML
            Josh-Oracle
            I don't think fn-bea:serialize will help you add a CDATA section though. For example consider this query:

            <Payload>
            { "<![CDATA[", fn-bea:serialize(<xml>...</xml>), "]]>" }
            </Payload>

            If you serialize the result of this query, I would expect it to look something like this:

            <Payload>&amp;lt;![CDATA[ &amp;lt;xml&amp;gt;...&amp;lt;/xml&amp;gt; ]]&amp;gt;</Payload>

            The BEA XQuery processor by itself doesn't support adding CDATA sections (at least in the currently released versions). I don't know about OSB though - it could have some extra facilities for this.

            Edited by: josh.spiegel on Sep 13, 2012 8:25 AM

            Edited by: josh.spiegel on Sep 13, 2012 8:26 AM
            • 3. Re: OSB, XQuery, CDATA and XML
              odie_63
              josh.spiegel wrote:
              I don't think fn-bea:serialize will help you add a CDATA section though. For example consider this query:
              Well, I suppose the XML document <xml> ... </xml> resides in a variable, say $input, then the result of
              <Payload>
              {
               fn-bea:serialize($input)
              }
              </Payload>
              will be :
              <Payload>&#38;lt;xml&#38;gt;...&#38;lt;/xml&#38;gt;</Payload>
              which is semantically equivalent to having a CDATA section :
              <Payload><![CDATA[<xml>...</xml>]]></Payload>
              <Payload>
              { "<![CDATA[", fn-bea:serialize(<xml>...</xml>), "]]>" }
              </Payload>
              That is not how we would build a CDATA section anyway.
              As you said, it requires the corresponding XQuery option to be implemented (http://www.w3.org/TR/xslt-xquery-serialization/#XML_CDATA-SECTION-ELEMENTS), but I don't know what's the status of OSB in this matter either.

              Here's a similar thread on the subject : {thread:id=2127302}
              • 4. Re: OSB, XQuery, CDATA and XML
                cool.br33ze
                I used "fn-bea:serialize" like this and its working


                <Payload>
                { fn-bea:serialize(
                <xml>
                <element1 DisplayName="element1">
                <element2 DisplayName="element2">FML_FIELD_1<element2>
                <element3 DisplayName="element3">FML_FIELD_2<element3>
                <element4 DisplayName="element4">FML_FIELD_3<element4>
                <element5 DisplayName="element5">
                <element6 DisplayName="element6">
                <element7 DisplayName="element7">FML_FIELD_4</element7>
                <element8 DisplayName="element8">FML_FIELD_5<element8>
                <element9>FML_FIELD_6<element9>
                <element10>FML_FIELD_7<element10>
                <element11>FML_FIELD_8<element11>
                <element6>
                <element12 DisplayName="element12">FML_FIELD_9<element12>
                <element13 DisplayName="element13">FML_FIELD_10<element13>
                <element14 DisplayName="element14">FML_FIELD_11<element14>
                <element15 DisplayName="element15">FML_FIELD_12<element15>
                <element5>
                <element1>
                </xml>
                ) }
                </Payload>

                Thankyou