Expand my Community achievements bar.

SOLVED

Hidden subform XML extracted?

Avatar

Level 2

Hi,

I have a hidden subform with 2 objects(dropdown), when I try to extract the .xml the hidden subform dropdown values comes in that. Can anyone please suggest why is this happening?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi

I’m guessing the values of the two dropdowns are null and you want the parent element to be excluded from the XML.

So you will have a XSD something like (or are you using “Use name” binding?)

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

                <xs:element name="formData">

                                <xs:complexType>

                                                <xs:sequence>

                                                                <xs:element name="hiddenSubform" minOccurs="0">

                                                                                <xs:complexType>

                                                                                                <xs:sequence>

                                                                                                                <xs:element name="dropDown2" type="xs:int"/>

                                                                                                                <xs:element name="dropDown1" type="xs:int"/>

                                                                                                </xs:sequence>

                                                                                </xs:complexType>

                                                                </xs:element>

                                                </xs:sequence>

                                </xs:complexType>

                </xs:element>

</xs:schema>

That is with a minOccurs=”0” on the element you want to exclude.

This will generate a data connection in your form (if you look in the XML Source view)

   <dd:dataDescription xmlns:dd="http://ns.adobe.com/data-description/" dd:name="formData">

      <formData>

         <hiddenSubform dd:minOccur="0">

            <dropDown2/>

            <dropDown1/>

         </hiddenSubform>

      </formData>

   </dd:dataDescription>

If you are using XML Sample to create a data connection you will end up with the same thing.  With this data connection you will always get a hiddenSubform element in your XML … which is your problem.

To fix this you can add a dd:nullType="exclude" attribute to your data connection, so;

   <dd:dataDescription xmlns:dd="http://ns.adobe.com/data-description/" dd:name="formData">

      <formData>

         <hiddenSubform dd:nullType="exclude" dd:minOccur="0">

            <dropDown2/>

            <dropDown1/>

         </hiddenSubform>

      </formData>

   </dd:dataDescription>

There is more on this in John Brinkman’s blog, http://blogs.adobe.com/formfeed/2009/12/null_data_handling.html, he also uses a JavaScript method so you don’t have to edit the XML Source manually.

Hope this makes sense.

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi

I’m guessing the values of the two dropdowns are null and you want the parent element to be excluded from the XML.

So you will have a XSD something like (or are you using “Use name” binding?)

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

                <xs:element name="formData">

                                <xs:complexType>

                                                <xs:sequence>

                                                                <xs:element name="hiddenSubform" minOccurs="0">

                                                                                <xs:complexType>

                                                                                                <xs:sequence>

                                                                                                                <xs:element name="dropDown2" type="xs:int"/>

                                                                                                                <xs:element name="dropDown1" type="xs:int"/>

                                                                                                </xs:sequence>

                                                                                </xs:complexType>

                                                                </xs:element>

                                                </xs:sequence>

                                </xs:complexType>

                </xs:element>

</xs:schema>

That is with a minOccurs=”0” on the element you want to exclude.

This will generate a data connection in your form (if you look in the XML Source view)

   <dd:dataDescription xmlns:dd="http://ns.adobe.com/data-description/" dd:name="formData">

      <formData>

         <hiddenSubform dd:minOccur="0">

            <dropDown2/>

            <dropDown1/>

         </hiddenSubform>

      </formData>

   </dd:dataDescription>

If you are using XML Sample to create a data connection you will end up with the same thing.  With this data connection you will always get a hiddenSubform element in your XML … which is your problem.

To fix this you can add a dd:nullType="exclude" attribute to your data connection, so;

   <dd:dataDescription xmlns:dd="http://ns.adobe.com/data-description/" dd:name="formData">

      <formData>

         <hiddenSubform dd:nullType="exclude" dd:minOccur="0">

            <dropDown2/>

            <dropDown1/>

         </hiddenSubform>

      </formData>

   </dd:dataDescription>

There is more on this in John Brinkman’s blog, http://blogs.adobe.com/formfeed/2009/12/null_data_handling.html, he also uses a JavaScript method so you don’t have to edit the XML Source manually.

Hope this makes sense.

Bruce

Avatar

Level 2

Thanks BR001, It worked after adding

dd:nullType="exclude" to the XSD.