AnsweredAssumed Answered

How to create an XML with the XML schema elements

Question asked by akhajooei272797 on Sep 21, 2016
Latest reply on Sep 27, 2016 by Seth Duda

Hi,

 

I am very confused on how to generate a certain XML to pass to my POST connector.

 

Below is how I would like the final XML look like:

 

                  <record>
                     <id>100220</id>
                     <sequenceNumber>1</sequenceNumber>
                     <values>
                        <value>
                           <picklistOptionId>-1</picklistOptionId>
                           <refId>230</refId>
                           <value xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">Central</value>
                        </value>

                        <value>
                           <picklistOptionId>2</picklistOptionId>
                           <refId>231</refId>
                           <value xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
                        </value>
                     </values>
                  </record>

 

However the final XML profile passed to the connector looks like this:

 

<?xml version='1.0' encoding='UTF-8'?>
<record>
  <values xmlns:ns1="http://www.w3.org/2001/XMLSchema-instance">
    <value>
      <picklistOptionId>-1</picklistOptionId>
      <refId>230</refId>
      <value>Central</value>
    </value>
    <value>
      <picklistOptionId>1</picklistOptionId>
      <refId>231</refId>
    </value>
</record>

 

There are two things wrong with this:

 

1. the value xsi:types are missing

2. also for refId 231 I want the whole <value> tag not to be there incase the picklistOptionId is empty.

 

I might be going in the wrong direction on this as I am very confused, I am just trying to send a post request to an end point with this xml in the post. I would really appreciate your help.

 

Thanks!!

Attachments

Outcomes