Hi Geert,

Thanks for your support.

But my actual problem is, i couldnt able to add processing instruction to
the element.

I am using a search functionality and has to append PI with  resulted xml
sample code structure is  given below

declare function ns:getResult(--- params--) as element()*
{
let $resultXml=ns:getSearchResult(--params--)
return ($resultXml)
}
so that i am getting $resultXml as

 <result>
     <lst name="first">
         <elm1>1<elem1>
          <elm2>2<elem2>
     </lst>
       --
       --
</result>
and output xml will be the same
but expected output is as given below

<?xml version="1.0" encoding="UTF-8>
 <result>
     <lst name="first">
         <elm1>1<elem1>
          <elm2>2<elem2>
     </lst>
       --
       --
</result>

Please advice me how i can achieve this expected result by adding processing
instruction to the element.


regards,
Rojan


On Mon, Feb 28, 2011 at 12:55 PM, Geert Josten <[email protected]>wrote:

>  Hi Rojan,
>
>
>
> If you precede your root element with a processing-instruction, comment or
> string, you are returning a multi-item sequence. You will have to at least
> add a + or * behind the return type. Secondly, a pi or string is not an
> element. Use item() instead.
>
>
>
> By the way, are you sure that MarkLogic Server doesn’t prepend the xml pi
> itself upon returning results? You can set the encoding of the response
> using xdmp:set-response-encoding (
> http://developer.marklogic.com/pubs/4.2/apidocs/AppServerBuiltins.html#xdmp:set-response-encoding)
> ..
>
>
>
> Kind regards,
>
> Geert
>
>
>
> *Van:* [email protected] [mailto:
> [email protected]] *Namens *Rojan K K
> *Verzonden:* maandag 28 februari 2011 7:52
> *Aan:* [email protected]
> *Onderwerp:* [MarkLogic Dev General] prepend the xmlversion identifier
> with the resulted xml
>
>
>
> Hi,
>
>
>
> I would like to prepend the xml version identifier and encoding(<?xml
> version="1.0" encoding="UTF-8"?>) with the ouput xml which i am giving as
> the result of a method having element() return type.I tried to append it
> as string then its showing" Invalid coercion: "<?xml version=&quot;1.0&quot;
> encoding=&quot;UTF-8&quot;?>" as element() " since its not node type. Please
> help me to resolve this.
>
>
>
>
>
> Regards,
>
> Rojan
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to