Skip to Content

Create empty tag

Hello Gurus,

I need to generate below mapping for a field in mapping.

<filed></field>

If i pass a constant blank value then after mapping the output shown is  </filed>  which is excluded by target system.

Hence target system are requesting to send start tag and end tag without any value.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Jul 27, 2013 at 04:46 PM

    This is my few cents ...

    If the XML tag element has value the syntax  is

    <field>some value </field>

    If the element has no value then you should generate the tag element as

    <field/>

    so if you send the tag element syntax has <field/>  all the xml parsers should accept.  This is syntax rule.  Even if you do mapping or any sort of manipulations it will pass only  as <field/>

    But if you send as </field>  then it is wrong... You are missing the start tag.. and see where you miss it.

    Hope that helps.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 26, 2013 at 04:24 PM

    hi

    you have to know that <filed></field> is the same as </field> so if you need to generate the node to be sent to tha backend maybe you can think about send an space in the field for example.

    Regards

    Rodrigo

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 26, 2013 at 04:30 PM

    Hi Hari,

    i believe both are same.

    <filed></field>

    </filed>

    Did you check below link?

    http://stackoverflow.com/questions/7238254/xml-what-is-this-null-or-empty-element

    else you can use mapWithDefault to pass some constant value to target field.

    Regards,

    Muniyappan.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 27, 2013 at 01:58 AM

    Hello Hari,

    Can you right-click on the payload and choose view source? If it is displaying as </filed> then it is the content of your XML. What you can do to transform it to <filed></filed> is to use Java/XSLT mapping. Even if in the view source the field is <filed></filed>, it could still display as </filed> in some browsers (e.g moni).

    Hope this helps,
    Mark

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 27, 2013 at 09:33 AM

    Hi,

    Try mapWithDefault node function

    Regards,

    Mani

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 29, 2013 at 01:48 PM

    as i suguest in my first post. mapthe field with a value (space, character,etc)

    <field></field> and </field>is the same for fields with null values

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 29, 2013 at 11:31 PM

    <filed></field> and </filed> are both the same. Your target techee would know it :-)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 30, 2013 at 09:23 AM

    Hi,

    <filed></field> and </filed> are both the same. if u want same <filed></filed> you need to write Udf to achieve that on.

    Thanks

    srikanth

    Add comment
    10|10000 characters needed characters exceeded