Expand my Community achievements bar.

Creating XML nested tags as output in XML files

Avatar

Former Community Member
Hello:

My question is a little extraordinary compared to most users since I am

primarily concerned with the xml output that is generated when a form is
submitted and emailed to a recipient.

Can anyone tell me if it is possible to design a form that can generate an xml file containing nested XML tags using Designer? (See sample output below).

Example:



PARTIAL


MONOCLONAL ANTIBODY



Our company needs this type of nested code for input so we can paste it into a database field we are testing. I have other concerns but I'll defer these to another forum question.
Regards.

Harold
7 Replies

Avatar

Former Community Member
Harold_Woodall@adobeforums.com wrote:<br />> Hello:<br />> <br />> My question is a little extraordinary compared to most users since I am<br />> <br />> primarily concerned with the xml output that is generated when a form is<br />> submitted and emailed to a recipient.<br />> <br />> Can anyone tell me if it is possible to design a form that can generate an xml file containing nested XML tags using Designer? (See sample output below).<br />> <br />> Example:<br />> <br />> <PROTEIN><br />> <SEQUENCE_TYPE><br />> PARTIAL<br />> </SEQUENCE_TYPE><br />> <PROTEIN_TYPE><br />> MONOCLONAL ANTIBODY<br />> </PROTEIN_TYPE><br />> </PROTEIN><br />> <br />> Our company needs this type of nested code for input so we can paste it into a database field we are testing. I have other concerns but I'll defer these to another forum question.<br />> Regards.<br />> <br />> Harold<br /><br />Harold,<br /> You can do this creating fields on your form representing the <br />Sequence Type and Protein Type. Bind these fields to your XML nodes. <br />Then wrap these fields in a subform. Bind the subform to your <PROTEIN> <br />node. When the data is exported from the form, it should be in the <br />structure that you desire.<br /><br /> Justin Klei<br /> Cardinal Solutions Group<br /> www.cardinalsolutions.com

Avatar

Former Community Member
Thanks for the reply. That really helped! To build on this, I have another question which really gets to my dilemma. <br /><br />Is there a way to program a numeric text field to control the number of instances of a subform? For example, I would like to have a nested subform appear twice in the form if the user enters 2 in the numeric field. But more importantly, I would like to see its corresponding XML output appear like the following: <br /><br /><SUBUNIT_1> <br /> <LENGTH></LENGTH> <br /> <SEQUENCE> <br /> ELEESGGGLVQPGGRQSPEKGLETHYAE <br /> </SEQUENCE> <br /> <N_TERMINAL>Yes</N_TERMINAL> <br /> <C_TERMINAL></C_TERMINAL> <br /></SUBUNIT_1> <br /><br /><SUBUNIT_2> <br /> <LENGTH></LENGTH> <br /> <SEQUENCE> <br /> ELEESGGGLVQPGGRQSPEKGLETHYAE <br /> </SEQUENCE> <br /> <N_TERMINAL>No</N_TERMINAL> <br /> <C_TERMINAL></C_TERMINAL> <br /></SUBUNIT_2> <br /><br />If you pay close attention to the above code, you will see that I want the parent tag's ending digit incremented each time the subform is repeated. <SUBUNIT_1> <SUBUNIT_2> <SUBUNIT_3> ect . . . <br /><br />That is the twist! Is this programmatically possible? <br /><br />I might mention that the numeric field is not included as part of the subform. It is part of another subform.<br /><br />Regards. <br /><br />Harold

Avatar

Former Community Member
Harold_Woodall@adobeforums.com wrote:<br />> Thanks for the reply. That really helped! To build on this, I have another question which really gets to my dilemma.<br />> <br />> Is there a way to program a numeric text field to control the number of instances of a subform? For example, I would like to have a nested subform appear twice in the form if the user enters 2 in the numeric field. But more importantly, I would like to see its corresponding XML output appear like the following:<br />> <br />> <SUBUNIT_1><br />> <LENGTH></LENGTH><br />> <SEQUENCE><br />> ELEESGGGLVQPGGRQSPEKGLETHYAE<br />> </SEQUENCE><br />> <N_TERMINAL>Yes</N_TERMINAL><br />> <C_TERMINAL></C_TERMINAL><br />> </SUBUNIT_1><br />> <br />> <SUBUNIT_2><br />> <LENGTH></LENGTH><br />> <SEQUENCE><br />> ELEESGGGLVQPGGRQSPEKGLETHYAE<br />> </SEQUENCE><br />> <N_TERMINAL>No</N_TERMINAL><br />> <C_TERMINAL></C_TERMINAL><br />> </SUBUNIT_2><br />> <br />> If you pay close attention to the above code, you will see that I want the parent tag's ending digit incremented each time the subform is repeated. <SUBUNIT_1> <SUBUNIT_2> <SUBUNIT_3> ect . . .<br />> <br />> That is the twist! Is this programmatically possible?<br />> <br />> I might mention that the numeric field is not included as part of the subform. It is part of another subform.<br />> <br />> Regards.<br />> <br />> Harold<br /><br />I am going to respond to your question with another question. Why do <br />you want to do it in this manner? What you are trying to do is change <br />your XML schema on the fly. In my opinion, this is not a good idea, <br />because the data is no longer consistent. Couldn't you just add an <br />index attribute to your xml? For example:<br /> <SUBUNIT><br /> <INDEX>1</INDEX><br /> <LENGTH></LENGTH><br /> <SEQUENCE><br /> ELEESGGGLVQPGGRQSPEKGLETHYAE<br /> </SEQUENCE><br /> <N_TERMINAL>Yes</N_TERMINAL><br /> <C_TERMINAL></C_TERMINAL><br /> </SUBUNIT><br /> <SUBUNIT><br /> <INDEX>2</INDEX><br /> <LENGTH></LENGTH><br /> <SEQUENCE><br /> ELEESGGGLVQPGGRQSPEKGLETHYAE<br /> </SEQUENCE><br /> <N_TERMINAL>No</N_TERMINAL><br /> <C_TERMINAL></C_TERMINAL><br /> </SUBUNIT><br /><br /><br /> Justin Klei<br /> Cardinal Solutions Group<br /> www.cardinalsolutions.com

Avatar

Former Community Member
The product won't do that for you, I suppose you could use an XSLT on the output XML to accomplish your needs.



But I have to agree with Justin that this is not a very efficient way to represent data in XML and will likely cause you significant trouble if you go on to ever specify a schema for your data.



Adding an INDEX child to the SUBUNIT node is a better idea, but really, any XML parser is going to index repeating nodes for you anyways.



My 2 cents.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Thanks for both of your replies. Excellent points. I would, however, like to respond to Justin's comments. Our company needs to maintain a certain XML hierarchy to adhere to guidelines we are drafting to assist end users. I suppose an index could be created. But we would still need to have a dynamic form that could set multiple instances of a subform based on a user's numeric input into a numeric field. Currently, we have created the numeric field in the pdf form, but it is not linked to the subform we need to be dynamically repeated.



I know it is possible to create instances by programming a button object; I've seen it work. Is it possible to do the same thing with a numeric text field? That would really be helpful as I don't see our company adopting a button representation.



Regards,



Harold

Avatar

Former Community Member
Harold_Woodall@adobeforums.com wrote:

> Thanks for both of your replies. Excellent points. I would, however, like to respond to Justin's comments. Our company needs to maintain a certain XML hierarchy to adhere to guidelines we are drafting to assist end users. I suppose an index could be created. But we would still need to have a dynamic form that could set multiple instances of a subform based on a user's numeric input into a numeric field. Currently, we have created the numeric field in the pdf form, but it is not linked to the subform we need to be dynamically repeated.

>

> I know it is possible to create instances by programming a button object; I've seen it work. Is it possible to do the same thing with a numeric text field? That would really be helpful as I don't see our company adopting a button representation.

>

> Regards,

>

> Harold



Harold,

Where do you currently stand with this issue? Do you still require assistance?



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
Sure, I've attached a sample. You can see the script on the change event of the numeric field.



Chris

Adobe Enterprise Developer Support